Quantum GIS API Documentation
1.7.4
|
00001 00002 #ifndef QGSLINESYMBOLLAYERV2_H 00003 #define QGSLINESYMBOLLAYERV2_H 00004 00005 #include "qgssymbollayerv2.h" 00006 00007 #include <QPen> 00008 #include <QVector> 00009 00010 #define DEFAULT_SIMPLELINE_COLOR QColor(0,0,0) 00011 #define DEFAULT_SIMPLELINE_WIDTH DEFAULT_LINE_WIDTH 00012 #define DEFAULT_SIMPLELINE_PENSTYLE Qt::SolidLine 00013 #define DEFAULT_SIMPLELINE_JOINSTYLE Qt::BevelJoin 00014 #define DEFAULT_SIMPLELINE_CAPSTYLE Qt::SquareCap 00015 00016 00017 class CORE_EXPORT QgsSimpleLineSymbolLayerV2 : public QgsLineSymbolLayerV2 00018 { 00019 public: 00020 QgsSimpleLineSymbolLayerV2( QColor color = DEFAULT_SIMPLELINE_COLOR, 00021 double width = DEFAULT_SIMPLELINE_WIDTH, 00022 Qt::PenStyle penStyle = DEFAULT_SIMPLELINE_PENSTYLE ); 00023 00024 // static stuff 00025 00026 static QgsSymbolLayerV2* create( const QgsStringMap& properties = QgsStringMap() ); 00027 00028 // implemented from base classes 00029 00030 QString layerType() const; 00031 00032 void startRender( QgsSymbolV2RenderContext& context ); 00033 00034 void stopRender( QgsSymbolV2RenderContext& context ); 00035 00036 void renderPolyline( const QPolygonF& points, QgsSymbolV2RenderContext& context ); 00037 00038 QgsStringMap properties() const; 00039 00040 QgsSymbolLayerV2* clone() const; 00041 00042 // new stuff 00043 00044 Qt::PenStyle penStyle() const { return mPenStyle; } 00045 void setPenStyle( Qt::PenStyle style ) { mPenStyle = style; } 00046 00047 Qt::PenJoinStyle penJoinStyle() const { return mPenJoinStyle; } 00048 void setPenJoinStyle( Qt::PenJoinStyle style ) { mPenJoinStyle = style; } 00049 00050 Qt::PenCapStyle penCapStyle() const { return mPenCapStyle; } 00051 void setPenCapStyle( Qt::PenCapStyle style ) { mPenCapStyle = style; } 00052 00053 double offset() const { return mOffset; } 00054 void setOffset( double offset ) { mOffset = offset; } 00055 00056 bool useCustomDashPattern() const { return mUseCustomDashPattern; } 00057 void setUseCustomDashPattern( bool b ) { mUseCustomDashPattern = b; } 00058 00059 QVector<qreal> customDashVector() const { return mCustomDashVector; } 00060 void setCustomDashVector( const QVector<qreal>& vector ) { mCustomDashVector = vector; } 00061 00062 protected: 00063 Qt::PenStyle mPenStyle; 00064 Qt::PenJoinStyle mPenJoinStyle; 00065 Qt::PenCapStyle mPenCapStyle; 00066 QPen mPen; 00067 QPen mSelPen; 00068 double mOffset; 00069 //use a custom dash dot pattern instead of the predefined ones 00070 bool mUseCustomDashPattern; 00072 QVector<qreal> mCustomDashVector; 00073 }; 00074 00076 00077 #define DEFAULT_MARKERLINE_ROTATE true 00078 #define DEFAULT_MARKERLINE_INTERVAL 3 00079 00080 class CORE_EXPORT QgsMarkerLineSymbolLayerV2 : public QgsLineSymbolLayerV2 00081 { 00082 public: 00083 QgsMarkerLineSymbolLayerV2( bool rotateMarker = DEFAULT_MARKERLINE_ROTATE, 00084 double interval = DEFAULT_MARKERLINE_INTERVAL ); 00085 00086 ~QgsMarkerLineSymbolLayerV2(); 00087 00088 enum Placement 00089 { 00090 Interval, 00091 Vertex, 00092 LastVertex, 00093 FirstVertex, 00094 CentralPoint 00095 }; 00096 00097 // static stuff 00098 00099 static QgsSymbolLayerV2* create( const QgsStringMap& properties = QgsStringMap() ); 00100 00101 // implemented from base classes 00102 00103 QString layerType() const; 00104 00105 void startRender( QgsSymbolV2RenderContext& context ); 00106 00107 void stopRender( QgsSymbolV2RenderContext& context ); 00108 00109 void renderPolyline( const QPolygonF& points, QgsSymbolV2RenderContext& context ); 00110 00111 QgsStringMap properties() const; 00112 00113 QgsSymbolLayerV2* clone() const; 00114 00115 void setColor( const QColor& color ); 00116 00117 QgsSymbolV2* subSymbol(); 00118 bool setSubSymbol( QgsSymbolV2* symbol ); 00119 00120 virtual void setWidth( double width ); 00121 virtual double width() const; 00122 00123 // new stuff 00124 00125 bool rotateMarker() const { return mRotateMarker; } 00126 void setRotateMarker( bool rotate ) { mRotateMarker = rotate; } 00127 00128 double interval() const { return mInterval; } 00129 void setInterval( double interval ) { mInterval = interval; } 00130 00131 double offset() const { return mOffset; } 00132 void setOffset( double offset ) { mOffset = offset; } 00133 00134 Placement placement() const { return mPlacement; } 00135 void setPlacement( Placement p ) { mPlacement = p; } 00136 00137 protected: 00138 00139 void renderPolylineInterval( const QPolygonF& points, QgsSymbolV2RenderContext& context ); 00140 void renderPolylineVertex( const QPolygonF& points, QgsSymbolV2RenderContext& context ); 00141 void renderPolylineCentral( const QPolygonF& points, QgsSymbolV2RenderContext& context ); 00142 00143 bool mRotateMarker; 00144 double mInterval; 00145 QgsMarkerSymbolV2* mMarker; 00146 double mOffset; 00147 Placement mPlacement; 00148 }; 00149 00151 00152 #define DEFAULT_LINEDECORATION_COLOR QColor(0,0,0) 00153 #define DEFAULT_LINEDECORATION_WIDTH DEFAULT_LINE_WIDTH 00154 00155 class CORE_EXPORT QgsLineDecorationSymbolLayerV2 : public QgsLineSymbolLayerV2 00156 { 00157 public: 00158 QgsLineDecorationSymbolLayerV2( QColor color = DEFAULT_LINEDECORATION_COLOR, 00159 double width = DEFAULT_LINEDECORATION_WIDTH ); 00160 00161 ~QgsLineDecorationSymbolLayerV2(); 00162 00163 // static stuff 00164 00165 static QgsSymbolLayerV2* create( const QgsStringMap& properties = QgsStringMap() ); 00166 00167 // implemented from base classes 00168 00169 QString layerType() const; 00170 00171 void startRender( QgsSymbolV2RenderContext& context ); 00172 00173 void stopRender( QgsSymbolV2RenderContext& context ); 00174 00175 void renderPolyline( const QPolygonF& points, QgsSymbolV2RenderContext& context ); 00176 00177 QgsStringMap properties() const; 00178 00179 QgsSymbolLayerV2* clone() const; 00180 00181 protected: 00182 QPen mPen; 00183 QPen mSelPen; 00184 00185 }; 00186 00187 #endif