Quantum GIS API Documentation
1.8
|
00001 /*************************************************************************** 00002 qgsstylev2.h 00003 --------------------- 00004 begin : November 2009 00005 copyright : (C) 2009 by Martin Dobias 00006 email : wonder.sk at gmail.com 00007 *************************************************************************** 00008 * * 00009 * This program is free software; you can redistribute it and/or modify * 00010 * it under the terms of the GNU General Public License as published by * 00011 * the Free Software Foundation; either version 2 of the License, or * 00012 * (at your option) any later version. * 00013 * * 00014 ***************************************************************************/ 00015 00016 #ifndef QGSSTYLEV2_H 00017 #define QGSSTYLEV2_H 00018 00019 #include <QMap> 00020 #include <QString> 00021 00022 #include "qgssymbollayerv2utils.h" // QgsStringMap 00023 00024 class QgsSymbolV2; 00025 class QgsSymbolLayerV2; 00026 class QgsVectorColorRampV2; 00027 00028 class QDomDocument; 00029 class QDomElement; 00030 00031 typedef QMap<QString, QgsVectorColorRampV2* > QgsVectorColorRampV2Map; 00032 00033 class CORE_EXPORT QgsStyleV2 00034 { 00035 public: 00036 00037 QgsStyleV2(); 00038 ~QgsStyleV2(); 00039 00041 static QgsStyleV2* defaultStyle(); 00042 00044 void clear(); 00045 00047 bool addSymbol( QString name, QgsSymbolV2* symbol ); 00048 00050 bool removeSymbol( QString name ); 00051 00054 bool renameSymbol( QString oldName, QString newName ); 00055 00057 QgsSymbolV2* symbol( QString name ); 00058 00060 const QgsSymbolV2* symbolRef( QString name ) const; 00061 00063 int symbolCount(); 00064 00066 QStringList symbolNames(); 00067 00068 00070 bool addColorRamp( QString name, QgsVectorColorRampV2* colorRamp ); 00071 00073 bool removeColorRamp( QString name ); 00074 00077 bool renameColorRamp( QString oldName, QString newName ); 00078 00080 QgsVectorColorRampV2* colorRamp( QString name ); 00081 00083 const QgsVectorColorRampV2* colorRampRef( QString name ) const; 00084 00086 int colorRampCount(); 00087 00089 QStringList colorRampNames(); 00090 00091 00093 bool load( QString filename ); 00094 00096 bool save( QString filename = QString() ); 00097 00099 QString errorString() { return mErrorString; } 00100 00102 QString fileName() { return mFileName; } 00103 00104 protected: 00105 00106 QgsSymbolV2Map mSymbols; 00107 QgsVectorColorRampV2Map mColorRamps; 00108 00109 QString mErrorString; 00110 QString mFileName; 00111 00112 static QgsStyleV2* mDefaultStyle; 00113 }; 00114 00115 00116 #endif