Quantum GIS API Documentation
1.7.4
|
00001 00002 #ifndef QGSFILLSYMBOLLAYERV2_H 00003 #define QGSFILLSYMBOLLAYERV2_H 00004 00005 #include "qgssymbollayerv2.h" 00006 00007 #define DEFAULT_SIMPLEFILL_COLOR QColor(0,0,255) 00008 #define DEFAULT_SIMPLEFILL_STYLE Qt::SolidPattern 00009 #define DEFAULT_SIMPLEFILL_BORDERCOLOR QColor(0,0,0) 00010 #define DEFAULT_SIMPLEFILL_BORDERSTYLE Qt::SolidLine 00011 #define DEFAULT_SIMPLEFILL_BORDERWIDTH DEFAULT_LINE_WIDTH 00012 00013 #include <QPen> 00014 #include <QBrush> 00015 00016 class CORE_EXPORT QgsSimpleFillSymbolLayerV2 : public QgsFillSymbolLayerV2 00017 { 00018 public: 00019 QgsSimpleFillSymbolLayerV2( QColor color = DEFAULT_SIMPLEFILL_COLOR, 00020 Qt::BrushStyle style = DEFAULT_SIMPLEFILL_STYLE, 00021 QColor borderColor = DEFAULT_SIMPLEFILL_BORDERCOLOR, 00022 Qt::PenStyle borderStyle = DEFAULT_SIMPLEFILL_BORDERSTYLE, 00023 double borderWidth = DEFAULT_SIMPLEFILL_BORDERWIDTH ); 00024 00025 // static stuff 00026 00027 static QgsSymbolLayerV2* create( const QgsStringMap& properties = QgsStringMap() ); 00028 00029 // implemented from base classes 00030 00031 QString layerType() const; 00032 00033 void startRender( QgsSymbolV2RenderContext& context ); 00034 00035 void stopRender( QgsSymbolV2RenderContext& context ); 00036 00037 void renderPolygon( const QPolygonF& points, QList<QPolygonF>* rings, QgsSymbolV2RenderContext& context ); 00038 00039 QgsStringMap properties() const; 00040 00041 QgsSymbolLayerV2* clone() const; 00042 00043 Qt::BrushStyle brushStyle() const { return mBrushStyle; } 00044 void setBrushStyle( Qt::BrushStyle style ) { mBrushStyle = style; } 00045 00046 QColor borderColor() const { return mBorderColor; } 00047 void setBorderColor( QColor borderColor ) { mBorderColor = borderColor; } 00048 00049 Qt::PenStyle borderStyle() const { return mBorderStyle; } 00050 void setBorderStyle( Qt::PenStyle borderStyle ) { mBorderStyle = borderStyle; } 00051 00052 double borderWidth() const { return mBorderWidth; } 00053 void setBorderWidth( double borderWidth ) { mBorderWidth = borderWidth; } 00054 00055 void setOffset( QPointF offset ) { mOffset = offset; } 00056 QPointF offset() { return mOffset; } 00057 00058 protected: 00059 QBrush mBrush; 00060 QBrush mSelBrush; 00061 Qt::BrushStyle mBrushStyle; 00062 QColor mBorderColor; 00063 Qt::PenStyle mBorderStyle; 00064 double mBorderWidth; 00065 QPen mPen; 00066 00067 QPointF mOffset; 00068 }; 00069 00072 class CORE_EXPORT QgsSVGFillSymbolLayer: public QgsFillSymbolLayerV2 00073 { 00074 public: 00075 QgsSVGFillSymbolLayer( const QString& svgFilePath = "", double width = 20, double rotation = 0.0 ); 00076 QgsSVGFillSymbolLayer( const QByteArray& svgData, double width = 20, double rotation = 0.0 ); 00077 ~QgsSVGFillSymbolLayer(); 00078 00079 static QgsSymbolLayerV2* create( const QgsStringMap& properties = QgsStringMap() ); 00080 00081 // implemented from base classes 00082 00083 QString layerType() const; 00084 00085 void startRender( QgsSymbolV2RenderContext& context ); 00086 void stopRender( QgsSymbolV2RenderContext& context ); 00087 00088 void renderPolygon( const QPolygonF& points, QList<QPolygonF>* rings, QgsSymbolV2RenderContext& context ); 00089 00090 QgsStringMap properties() const; 00091 00092 QgsSymbolLayerV2* clone() const; 00093 00094 //getters and setters 00095 void setSvgFilePath( const QString& svgPath ); 00096 QString svgFilePath() const { return mSvgFilePath; } 00097 void setPatternWidth( double width ) { mPatternWidth = width;} 00098 double patternWidth() const { return mPatternWidth; } 00099 00100 QgsSymbolV2* subSymbol() { return mOutline; } 00101 bool setSubSymbol( QgsSymbolV2* symbol ); 00102 00103 protected: 00105 double mPatternWidth; 00107 QByteArray mSvgData; 00109 QString mSvgFilePath; 00111 QRectF mSvgViewBox; 00113 QBrush mBrush; 00115 double mOutlineWidth; 00117 QgsLineSymbolV2* mOutline; 00118 00119 private: 00121 void storeViewBox(); 00122 }; 00123 00124 00125 00126 class CORE_EXPORT QgsCentroidFillSymbolLayerV2 : public QgsFillSymbolLayerV2 00127 { 00128 public: 00129 QgsCentroidFillSymbolLayerV2(); 00130 ~QgsCentroidFillSymbolLayerV2(); 00131 00132 // static stuff 00133 00134 static QgsSymbolLayerV2* create( const QgsStringMap& properties = QgsStringMap() ); 00135 00136 // implemented from base classes 00137 00138 QString layerType() const; 00139 00140 void startRender( QgsSymbolV2RenderContext& context ); 00141 00142 void stopRender( QgsSymbolV2RenderContext& context ); 00143 00144 void renderPolygon( const QPolygonF& points, QList<QPolygonF>* rings, QgsSymbolV2RenderContext& context ); 00145 00146 QgsStringMap properties() const; 00147 00148 QgsSymbolLayerV2* clone() const; 00149 00150 void setColor( const QColor& color ); 00151 00152 QgsSymbolV2* subSymbol(); 00153 bool setSubSymbol( QgsSymbolV2* symbol ); 00154 00155 protected: 00156 QgsMarkerSymbolV2* mMarker; 00157 }; 00158 00159 #endif