|
| 1 | +class CORE_EXPORT QgsOverlayObject: public pal::PalGeometry |
| 2 | +{ |
| 3 | +%TypeHeaderCode |
| 4 | +#include "qgsoverlayobject.h" |
| 5 | +%End |
| 6 | + public: |
| 7 | + QgsOverlayObject( int width = 0, int height = 0, double rotation = 0, QgsGeometry* geometry = 0 ); |
| 8 | + virtual ~QgsOverlayObject(); |
| 9 | + |
| 10 | + //copy constructor and assignment operator necessary because of mGeometry |
| 11 | + QgsOverlayObject( const QgsOverlayObject& other ); |
| 12 | + QgsOverlayObject& operator=( const QgsOverlayObject& other ); |
| 13 | + |
| 14 | + |
| 15 | + /**Returns the feature geometry in geos format. The calling function does _not_ take |
| 16 | + ownership of the generated object*/ |
| 17 | + GEOSGeometry* getGeosGeometry(); |
| 18 | + /**Feature geometry is released when object is destructed so this function is empty*/ |
| 19 | + void releaseGeosGeometry( GEOSGeometry *the_geom ) {} |
| 20 | + |
| 21 | + //getters |
| 22 | + int width() const {return mWidth;} |
| 23 | + int height() const {return mHeight;} |
| 24 | + double rotation() const {return mRotation;} |
| 25 | + QgsGeometry* geometry() {return mGeometry;} |
| 26 | + const QgsGeometry* geometry() const {return mGeometry;} |
| 27 | + QgsPoint position() const; |
| 28 | + QList<QgsPoint> positions() const {return mPositions;} |
| 29 | + |
| 30 | + //setters |
| 31 | + void setHeight( int height ) {mHeight = height;} |
| 32 | + void setWidth( int width ) {mWidth = width;} |
| 33 | + void setRotation( double rotation ) {mRotation = rotation;} |
| 34 | + /**Set geometry. This class takes ownership of the object*/ |
| 35 | + void setGeometry( QgsGeometry* g ); |
| 36 | + /**Adds a position in map coordinates*/ |
| 37 | + void addPosition( const QgsPoint& position ); |
| 38 | + |
| 39 | + |
| 40 | + private: |
| 41 | + |
| 42 | + /**Width of the bounding box in pixels*/ |
| 43 | + int mWidth; |
| 44 | + /**Height of the bounding box in pixels*/ |
| 45 | + int mHeight; |
| 46 | + /**Position of the object in map coordinates. Note that it is possible that an object |
| 47 | + has several positions, e.g. a multiobject or an object that is split into multiple parts |
| 48 | + by the edge of the view extent*/ |
| 49 | + QList<QgsPoint> mPositions; |
| 50 | + /**Rotation of the object*/ |
| 51 | + double mRotation; |
| 52 | + /**Copy of the feature geometry. A copy is necessary because in QGIS geometries are deleted |
| 53 | + after drawing*/ |
| 54 | + QgsGeometry* mGeometry; |
| 55 | + |
| 56 | +}; |
0 commit comments