~ubuntu-branches/ubuntu/wily/qgis/wily

« back to all changes in this revision

Viewing changes to src/core/symbology-ng/qgssymbolv2.h

  • Committer: Bazaar Package Importer
  • Author(s): Johan Van de Wauw
  • Date: 2010-07-11 20:23:24 UTC
  • mfrom: (3.1.4 squeeze)
  • Revision ID: james.westby@ubuntu.com-20100711202324-5ktghxa7hracohmr
Tags: 1.4.0+12730-3ubuntu1
* Merge from Debian unstable (LP: #540941).
* Fix compilation issues with QT 4.7
* Add build-depends on libqt4-webkit-dev 

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
 
 
2
#ifndef QGSSYMBOLV2_H
 
3
#define QGSSYMBOLV2_H
 
4
 
 
5
#include "qgis.h"
 
6
#include <QList>
 
7
 
 
8
class QColor;
 
9
class QImage;
 
10
class QPainter;
 
11
class QSize;
 
12
class QPointF;
 
13
class QPolygonF;
 
14
//class
 
15
 
 
16
class QgsSymbolLayerV2;
 
17
class QgsRenderContext;
 
18
 
 
19
typedef QList<QgsSymbolLayerV2*> QgsSymbolLayerV2List;
 
20
 
 
21
class CORE_EXPORT QgsSymbolV2
 
22
{
 
23
  public:
 
24
 
 
25
    enum SymbolType
 
26
    {
 
27
      Marker,
 
28
      Line,
 
29
      Fill
 
30
    };
 
31
 
 
32
    virtual ~QgsSymbolV2();
 
33
 
 
34
    //! return new default symbol for specified geometry type
 
35
    static QgsSymbolV2* defaultSymbol( QGis::GeometryType geomType );
 
36
 
 
37
    SymbolType type() const { return mType; }
 
38
 
 
39
    // symbol layers handling
 
40
 
 
41
    QgsSymbolLayerV2* symbolLayer( int layer );
 
42
 
 
43
    int symbolLayerCount() { return mLayers.count(); }
 
44
 
 
45
    //! insert symbol layer to specified index
 
46
    bool insertSymbolLayer( int index, QgsSymbolLayerV2* layer );
 
47
 
 
48
    //! append symbol layer at the end of the list
 
49
    bool appendSymbolLayer( QgsSymbolLayerV2* layer );
 
50
 
 
51
    //! delete symbol layer at specified index
 
52
    bool deleteSymbolLayer( int index );
 
53
 
 
54
    //! remove symbol layer from the list and return pointer to it
 
55
    QgsSymbolLayerV2* takeSymbolLayer( int index );
 
56
 
 
57
    //! delete layer at specified index and set a new one
 
58
    bool changeSymbolLayer( int index, QgsSymbolLayerV2* layer );
 
59
 
 
60
 
 
61
    void startRender( QgsRenderContext& context );
 
62
    void stopRender( QgsRenderContext& context );
 
63
 
 
64
    void setColor( const QColor& color );
 
65
    QColor color();
 
66
 
 
67
    void drawPreviewIcon( QPainter* painter, QSize size );
 
68
 
 
69
    QImage bigSymbolPreviewImage();
 
70
 
 
71
    QString dump();
 
72
 
 
73
    virtual QgsSymbolV2* clone() const = 0;
 
74
 
 
75
  protected:
 
76
    QgsSymbolV2( SymbolType type, QgsSymbolLayerV2List layers ); // can't be instantiated
 
77
 
 
78
    QgsSymbolLayerV2List cloneLayers() const;
 
79
 
 
80
    SymbolType mType;
 
81
    QgsSymbolLayerV2List mLayers;
 
82
};
 
83
 
 
84
 
 
85
 
 
86
//////////////////////
 
87
 
 
88
 
 
89
 
 
90
class CORE_EXPORT QgsMarkerSymbolV2 : public QgsSymbolV2
 
91
{
 
92
  public:
 
93
    QgsMarkerSymbolV2( QgsSymbolLayerV2List layers = QgsSymbolLayerV2List() );
 
94
 
 
95
    void setAngle( double angle );
 
96
    double angle();
 
97
 
 
98
    void setSize( double size );
 
99
    double size();
 
100
 
 
101
    void renderPoint( const QPointF& point, QgsRenderContext& context, int layer = -1 );
 
102
 
 
103
    virtual QgsSymbolV2* clone() const;
 
104
};
 
105
 
 
106
 
 
107
 
 
108
class CORE_EXPORT QgsLineSymbolV2 : public QgsSymbolV2
 
109
{
 
110
  public:
 
111
    QgsLineSymbolV2( QgsSymbolLayerV2List layers = QgsSymbolLayerV2List() );
 
112
 
 
113
    void setWidth( double width );
 
114
    double width();
 
115
 
 
116
    void renderPolyline( const QPolygonF& points, QgsRenderContext& context, int layer = -1 );
 
117
 
 
118
    virtual QgsSymbolV2* clone() const;
 
119
};
 
120
 
 
121
 
 
122
 
 
123
class CORE_EXPORT QgsFillSymbolV2 : public QgsSymbolV2
 
124
{
 
125
  public:
 
126
    QgsFillSymbolV2( QgsSymbolLayerV2List layers = QgsSymbolLayerV2List() );
 
127
 
 
128
    void renderPolygon( const QPolygonF& points, QList<QPolygonF>* rings, QgsRenderContext& context, int layer = -1 );
 
129
 
 
130
    virtual QgsSymbolV2* clone() const;
 
131
};
 
132
 
 
133
#endif
 
134
 
 
135
 
 
136
/*
 
137
 
 
138
QgsSymbolV2* ps = new QgsPointSymbol();
 
139
 
 
140
// ----
 
141
 
 
142
sl = QgsSymbolLayerV2Registry::instance()->createSymbolLayer("SimpleLine", { "color", "..." })
 
143
 
 
144
// (or)
 
145
 
 
146
sl = QgsSymbolLayerV2Registry::defaultSymbolLayer(QgsSymbolV2::Line)
 
147
 
 
148
// (or)
 
149
 
 
150
QgsSymbolLayerV2* sl = new QgsSimpleLineSymbolLayer(x,y,z);
 
151
QgsLineSymbol* s = new LineSymbol( [ sl ] );
 
152
 
 
153
// ----
 
154
 
 
155
rend = QgsSingleSymbolRenderer( new LineSymbol() );
 
156
*/