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

« back to all changes in this revision

Viewing changes to src/core/symbology-ng/qgsstylev2.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 QGSSTYLEV2_H
 
3
#define QGSSTYLEV2_H
 
4
 
 
5
#include <QMap>
 
6
#include <QString>
 
7
 
 
8
#include "qgssymbollayerv2utils.h" // QgsStringMap
 
9
 
 
10
class QgsSymbolV2;
 
11
class QgsSymbolLayerV2;
 
12
class QgsVectorColorRampV2;
 
13
 
 
14
class QDomDocument;
 
15
class QDomElement;
 
16
 
 
17
typedef QMap<QString, QgsVectorColorRampV2* > QgsVectorColorRampV2Map;
 
18
 
 
19
class CORE_EXPORT QgsStyleV2
 
20
{
 
21
  public:
 
22
 
 
23
    QgsStyleV2();
 
24
    ~QgsStyleV2();
 
25
 
 
26
    //! return default application-wide style
 
27
    static QgsStyleV2* defaultStyle();
 
28
 
 
29
    //! remove all contents of the style
 
30
    void clear();
 
31
 
 
32
    //! add symbol to style. takes symbol's ownership
 
33
    bool addSymbol( QString name, QgsSymbolV2* symbol );
 
34
 
 
35
    //! remove symbol from style (and delete it)
 
36
    bool removeSymbol( QString name );
 
37
 
 
38
    //! return a NEW copy of symbol
 
39
    QgsSymbolV2* symbol( QString name );
 
40
 
 
41
    //! return a const pointer to a symbol (doesn't create new instance)
 
42
    const QgsSymbolV2* symbolRef( QString name ) const;
 
43
 
 
44
    //! return count of symbols in style
 
45
    int symbolCount();
 
46
 
 
47
    //! return a list of names of symbols
 
48
    QStringList symbolNames();
 
49
 
 
50
 
 
51
    //! add color ramp to style. takes ramp's ownership
 
52
    bool addColorRamp( QString name, QgsVectorColorRampV2* colorRamp );
 
53
 
 
54
    //! remove color ramp from style (and delete it)
 
55
    bool removeColorRamp( QString name );
 
56
 
 
57
    //! return a NEW copy of color ramp
 
58
    QgsVectorColorRampV2* colorRamp( QString name );
 
59
 
 
60
    //! return a const pointer to a symbol (doesn't create new instance)
 
61
    const QgsVectorColorRampV2* colorRampRef( QString name ) const;
 
62
 
 
63
    //! return count of color ramps
 
64
    int colorRampCount();
 
65
 
 
66
    //! return a list of names of color ramps
 
67
    QStringList colorRampNames();
 
68
 
 
69
 
 
70
    //! load a file into the style
 
71
    bool load( QString filename );
 
72
 
 
73
    //! save style into a file (will use current filename if empty string is passed)
 
74
    bool save( QString filename = QString() );
 
75
 
 
76
    //! return last error from load/save operation
 
77
    QString errorString() { return mErrorString; }
 
78
 
 
79
    //! return current file name of the style
 
80
    QString fileName() { return mFileName; }
 
81
 
 
82
  protected:
 
83
 
 
84
    QgsSymbolV2Map mSymbols;
 
85
    QgsVectorColorRampV2Map mColorRamps;
 
86
 
 
87
    QString mErrorString;
 
88
    QString mFileName;
 
89
 
 
90
    static QgsStyleV2* mDefaultStyle;
 
91
};
 
92
 
 
93
 
 
94
#endif