~ubuntu-branches/ubuntu/trusty/qgis/trusty

« back to all changes in this revision

Viewing changes to src/core/symbology-ng/qgsmarkersymbollayerv2.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 QGSMARKERSYMBOLLAYERV2_H
 
3
#define QGSMARKERSYMBOLLAYERV2_H
 
4
 
 
5
#include "qgssymbollayerv2.h"
 
6
 
 
7
#define DEFAULT_SIMPLEMARKER_NAME         "circle"
 
8
#define DEFAULT_SIMPLEMARKER_COLOR        QColor(255,0,0)
 
9
#define DEFAULT_SIMPLEMARKER_BORDERCOLOR  QColor(0,0,0)
 
10
#define DEFAULT_SIMPLEMARKER_SIZE         9
 
11
#define DEFAULT_SIMPLEMARKER_ANGLE        0
 
12
 
 
13
#include <QPen>
 
14
#include <QBrush>
 
15
#include <QPicture>
 
16
#include <QPolygonF>
 
17
 
 
18
class CORE_EXPORT QgsSimpleMarkerSymbolLayerV2 : public QgsMarkerSymbolLayerV2
 
19
{
 
20
  public:
 
21
    QgsSimpleMarkerSymbolLayerV2( QString name = DEFAULT_SIMPLEMARKER_NAME,
 
22
                                  QColor color = DEFAULT_SIMPLEMARKER_COLOR,
 
23
                                  QColor borderColor = DEFAULT_SIMPLEMARKER_BORDERCOLOR,
 
24
                                  double size = DEFAULT_SIMPLEMARKER_SIZE,
 
25
                                  double angle = DEFAULT_SIMPLEMARKER_ANGLE );
 
26
 
 
27
    // static stuff
 
28
 
 
29
    static QgsSymbolLayerV2* create( const QgsStringMap& properties = QgsStringMap() );
 
30
 
 
31
    // implemented from base classes
 
32
 
 
33
    QString layerType() const;
 
34
 
 
35
    void startRender( QgsRenderContext& context );
 
36
 
 
37
    void stopRender( QgsRenderContext& context );
 
38
 
 
39
    void renderPoint( const QPointF& point, QgsRenderContext& context );
 
40
 
 
41
    QgsStringMap properties() const;
 
42
 
 
43
    QgsSymbolLayerV2* clone() const;
 
44
 
 
45
    QString name() const { return mName; }
 
46
    void setName( QString name ) { mName = name; }
 
47
 
 
48
    QColor borderColor() const { return mBorderColor; }
 
49
    void setBorderColor( QColor color ) { mBorderColor = color; }
 
50
 
 
51
  protected:
 
52
 
 
53
    void drawMarker( QPainter* p );
 
54
 
 
55
    QColor mBorderColor;
 
56
    QPen mPen;
 
57
    QBrush mBrush;
 
58
    QPolygonF mPolygon;
 
59
    QString mName;
 
60
    QImage mCache;
 
61
};
 
62
 
 
63
//////////
 
64
 
 
65
#define DEFAULT_SVGMARKER_NAME         "/symbol/Star1.svg"
 
66
#define DEFAULT_SVGMARKER_SIZE         9
 
67
#define DEFAULT_SVGMARKER_ANGLE        0
 
68
 
 
69
class CORE_EXPORT QgsSvgMarkerSymbolLayerV2 : public QgsMarkerSymbolLayerV2
 
70
{
 
71
  public:
 
72
    QgsSvgMarkerSymbolLayerV2( QString name = DEFAULT_SVGMARKER_NAME,
 
73
                               double size = DEFAULT_SVGMARKER_SIZE,
 
74
                               double angle = DEFAULT_SVGMARKER_ANGLE );
 
75
 
 
76
    // static stuff
 
77
 
 
78
    static QgsSymbolLayerV2* create( const QgsStringMap& properties = QgsStringMap() );
 
79
 
 
80
    //! Return a list of all available svg files
 
81
    static QStringList listSvgFiles();
 
82
 
 
83
    //! Get symbol's path from its name
 
84
    static QString symbolNameToPath( QString name );
 
85
 
 
86
    //! Get symbols's name from its path
 
87
    static QString symbolPathToName( QString path );
 
88
 
 
89
    // implemented from base classes
 
90
 
 
91
    QString layerType() const;
 
92
 
 
93
    void startRender( QgsRenderContext& context );
 
94
 
 
95
    void stopRender( QgsRenderContext& context );
 
96
 
 
97
    void renderPoint( const QPointF& point, QgsRenderContext& context );
 
98
 
 
99
    QgsStringMap properties() const;
 
100
 
 
101
    QgsSymbolLayerV2* clone() const;
 
102
 
 
103
    QString path() const { return mPath; }
 
104
    void setPath( QString path ) { mPath = path; }
 
105
 
 
106
  protected:
 
107
 
 
108
    void loadSvg();
 
109
 
 
110
    QString mPath;
 
111
    QPicture mPicture;
 
112
};
 
113
 
 
114
#endif