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
00025
00026 static QgsSymbolLayerV2* create( const QgsStringMap& properties = QgsStringMap() );
00027
00028
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
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
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
00089
00090 static QgsSymbolLayerV2* create( const QgsStringMap& properties = QgsStringMap() );
00091
00092
00093
00094 QString layerType() const;
00095
00096 void startRender( QgsSymbolV2RenderContext& context );
00097
00098 void stopRender( QgsSymbolV2RenderContext& context );
00099
00100 void renderPolyline( const QPolygonF& points, QgsSymbolV2RenderContext& context );
00101
00102 QgsStringMap properties() const;
00103
00104 QgsSymbolLayerV2* clone() const;
00105
00106 void setColor( QColor color );
00107
00108 QgsSymbolV2* subSymbol();
00109 bool setSubSymbol( QgsSymbolV2* symbol );
00110
00111 virtual void setWidth( double width );
00112 virtual double width() const;
00113
00114
00115
00116 bool rotateMarker() const { return mRotateMarker; }
00117 void setRotateMarker( bool rotate ) { mRotateMarker = rotate; }
00118
00119 double interval() const { return mInterval; }
00120 void setInterval( double interval ) { mInterval = interval; }
00121
00122 double offset() const { return mOffset; }
00123 void setOffset( double offset ) { mOffset = offset; }
00124
00125 protected:
00126
00127 void renderPolylineNoOffset( const QPolygonF& points, QgsSymbolV2RenderContext& context );
00128
00129 bool mRotateMarker;
00130 double mInterval;
00131 QgsMarkerSymbolV2* mMarker;
00132 double mOffset;
00133 };
00134
00136
00137 #define DEFAULT_LINEDECORATION_COLOR QColor(0,0,0)
00138
00139 class CORE_EXPORT QgsLineDecorationSymbolLayerV2 : public QgsLineSymbolLayerV2
00140 {
00141 public:
00142 QgsLineDecorationSymbolLayerV2( QColor color = DEFAULT_LINEDECORATION_COLOR );
00143
00144 ~QgsLineDecorationSymbolLayerV2();
00145
00146
00147
00148 static QgsSymbolLayerV2* create( const QgsStringMap& properties = QgsStringMap() );
00149
00150
00151
00152 QString layerType() const;
00153
00154 void startRender( QgsSymbolV2RenderContext& context );
00155
00156 void stopRender( QgsSymbolV2RenderContext& context );
00157
00158 void renderPolyline( const QPolygonF& points, QgsSymbolV2RenderContext& context );
00159
00160 QgsStringMap properties() const;
00161
00162 QgsSymbolLayerV2* clone() const;
00163
00164 protected:
00165 QPen mPen;
00166 QPen mSelPen;
00167
00168 };
00169
00170 #endif