File indexing completed on 2024-04-28 05:32:10

0001 #ifndef oxygengeometry_h
0002 #define oxygengeometry_h
0003 /*
0004 * this file is part of the oxygen gtk engine
0005 * SPDX-FileCopyrightText: 2010 Hugo Pereira Da Costa <hugo.pereira@free.fr>
0006 *
0007 * SPDX-License-Identifier: LGPL-2.0-or-later
0008 */
0009 
0010 #include <vector>
0011 
0012 namespace Oxygen
0013 {
0014 
0015     class Point
0016     {
0017         public:
0018 
0019         //! constructor
0020         explicit Point( double x, double y):
0021             _x( x ),
0022             _y( y )
0023         {}
0024 
0025 
0026         //! destructor
0027         virtual ~Point( void )
0028         {}
0029 
0030         //! accessors
0031         //@{
0032         double x( void ) const { return _x; }
0033         double y( void ) const { return _y; }
0034         //@}
0035 
0036         //! modifiers
0037         void setX( double x ) { _x = x; }
0038         void setY( double y ) { _y = y; }
0039 
0040         private:
0041 
0042         double _x;
0043         double _y;
0044 
0045     };
0046 
0047     //! polygons
0048     class Polygon: public std::vector<Point>
0049     {
0050 
0051         public:
0052 
0053         Polygon& operator << (const Point& point )
0054         {
0055             push_back( point );
0056             return *this;
0057         }
0058 
0059     };
0060 
0061 }
0062 
0063 #endif