Skip to content

Commit 03c8438

Browse files
author
mhugent
committed
Add overlay object, modify core.sip to include it
git-svn-id: http://svn.osgeo.org/qgis/trunk@10506 c8812cc2-4d05-0410-92ff-de0c093fc19c
1 parent ae26704 commit 03c8438

File tree

2 files changed

+58
-0
lines changed

2 files changed

+58
-0
lines changed

python/core/core.sip

+2
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,7 @@
4242
%Include qgsmaptopixel.sip
4343
%Include qgsmarkercatalogue.sip
4444
%Include qgsmessageoutput.sip
45+
%Include qgsoverlayobject.sip
4546
%Include qgspoint.sip
4647
%Include qgsproject.sip
4748
%Include qgsprovidermetadata.sip
@@ -69,4 +70,5 @@
6970
%Include qgsvectordataprovider.sip
7071
%Include qgsvectorfilewriter.sip
7172
%Include qgsvectorlayer.sip
73+
%Include qgsvectoroverlay.sip
7274

python/core/qgsoverlayobject.sip

+56
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,56 @@
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

Comments
 (0)