|
| 1 | +class CORE_EXPORT QgsVectorOverlay |
| 2 | +{ |
| 3 | +%TypeHeaderCode |
| 4 | +#include "qgsvectoroverlay.h" |
| 5 | +%End |
| 6 | + public: |
| 7 | + QgsVectorOverlay( QgsVectorLayer* vl ); |
| 8 | + virtual ~QgsVectorOverlay(); |
| 9 | + |
| 10 | + /**Create the overlay objects contained in a view extent. Subclasses need to implement this method and assign width/height information to the overlay ovbjects*/ |
| 11 | + |
| 12 | + virtual void createOverlayObjects( const QgsRenderContext& renderContext ) = 0; |
| 13 | + |
| 14 | + /**Remove the overlay objects and release their memory*/ |
| 15 | + void removeOverlayObjects(); |
| 16 | + |
| 17 | + /**Draw the overlay objects*/ |
| 18 | + virtual void drawOverlayObjects( QgsRenderContext& context ) const = 0; |
| 19 | + |
| 20 | + /**Gives direct access to oberlay objects*/ |
| 21 | + QMap<int, QgsOverlayObject*>* overlayObjects() {return &mOverlayObjects;} |
| 22 | + |
| 23 | + /**Describes the overlay type (e.g. "diagram" or "label")*/ |
| 24 | + virtual QString typeName() const = 0; |
| 25 | + |
| 26 | + /**Set attribute indices necessary to fetch*/ |
| 27 | + void setAttributes( const QgsAttributeList& list ) {mAttributes = list;} |
| 28 | + |
| 29 | + bool displayFlag() const {return mDisplayFlag;} |
| 30 | + |
| 31 | + /**Display yes/no*/ |
| 32 | + void setDisplayFlag( bool flag ) {mDisplayFlag = flag;} |
| 33 | + |
| 34 | + /**Restore from project file*/ |
| 35 | + virtual bool readXML( const QDomNode& overlayNode ) = 0; |
| 36 | + |
| 37 | + /**Save to project file*/ |
| 38 | + virtual bool writeXML( QDomNode& layer_node, QDomDocument& doc ) const = 0; |
| 39 | + |
| 40 | + protected: |
| 41 | + /**Pointer to the vector layer for this overlay*/ |
| 42 | + QgsVectorLayer* mVectorLayer; |
| 43 | + |
| 44 | + /**True if overlay should be displayed*/ |
| 45 | + bool mDisplayFlag; |
| 46 | + |
| 47 | + /**A list with attribute indexes that are needed for overlay rendering*/ |
| 48 | + QgsAttributeList mAttributes; |
| 49 | + |
| 50 | + /**Key: feature ids, value: the corresponding overlay objects. Normally, they are created for each redraw and deleted before the next redraw*/ |
| 51 | + QMap<int, QgsOverlayObject*> mOverlayObjects; |
| 52 | + |
| 53 | + /**Position constraints that may be set to be persistent after redraws. Key is the feature id, value the map point |
| 54 | + where the feature should be placed*/ |
| 55 | + QMap<int, QgsPoint> mPositionConstraints; |
| 56 | +}; |
0 commit comments