Quantum GIS API Documentation  1.8
src/core/symbology-ng/qgsellipsesymbollayerv2.h
Go to the documentation of this file.
00001 /***************************************************************************
00002     qgsellipsesymbollayerv2.h
00003     ---------------------
00004     begin                : June 2011
00005     copyright            : (C) 2011 by Marco Hugentobler
00006     email                : marco dot hugentobler at sourcepole dot ch
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 #ifndef QGSELLIPSESYMBOLLAYERV2_H
00016 #define QGSELLIPSESYMBOLLAYERV2_H
00017 
00018 #include "qgsmarkersymbollayerv2.h"
00019 #include <QPainterPath>
00020 
00022 class CORE_EXPORT QgsEllipseSymbolLayerV2: public QgsMarkerSymbolLayerV2
00023 {
00024   public:
00025     QgsEllipseSymbolLayerV2();
00026     ~QgsEllipseSymbolLayerV2();
00027 
00028     static QgsSymbolLayerV2* create( const QgsStringMap& properties = QgsStringMap() );
00029     static QgsSymbolLayerV2* createFromSld( QDomElement &element );
00030 
00031     void renderPoint( const QPointF& point, QgsSymbolV2RenderContext& context );
00032     QString layerType() const;
00033     void startRender( QgsSymbolV2RenderContext& context );
00034     void stopRender( QgsSymbolV2RenderContext& context );
00035     QgsSymbolLayerV2* clone() const;
00036     QgsStringMap properties() const;
00037 
00038     void toSld( QDomDocument& doc, QDomElement &element, QgsStringMap props ) const;
00039     void writeSldMarker( QDomDocument& doc, QDomElement &element, QgsStringMap props ) const;
00040 
00041     void setSymbolName( const QString& name ) { mSymbolName = name; }
00042     QString symbolName() const { return mSymbolName; }
00043 
00044     void setSymbolNameField( const QString& field ) { mSymbolNameField = field; }
00045     const QString& symbolNameField() const { return mSymbolNameField; }
00046 
00047     void setSymbolWidth( double w ) { mSymbolWidth = w; }
00048     double symbolWidth() const { return mSymbolWidth; }
00049 
00050     void setWidthField( const QString& field ) { mWidthField = field; }
00051     const QString& widthField() const { return mWidthField; }
00052 
00053     void setSymbolHeight( double h ) { mSymbolHeight = h; }
00054     double symbolHeight() const { return mSymbolHeight; }
00055 
00056     void setHeightField( const QString& field ) { mHeightField = field; }
00057     const QString& heightField() const { return mHeightField; }
00058 
00059     void setRotationField( const QString& field ) { mRotationField = field; }
00060     const QString& rotationField() const { return mRotationField; }
00061 
00062     void setOutlineWidth( double w ) { mOutlineWidth = w; }
00063     double outlineWidth() const { return mOutlineWidth; }
00064 
00065     void setOutlineWidthField( const QString& field ) { mOutlineWidthField = field; }
00066     const QString& outlineWidthField() const { return mOutlineWidthField; }
00067 
00068     void setFillColor( const QColor& c ) { mFillColor = c;}
00069     QColor fillColor() const { return mFillColor; }
00070 
00071     void setFillColorField( const QString& field ) { mFillColorField = field; }
00072     const QString& fillColorField() const { return mFillColorField; }
00073 
00074     void setOutlineColor( const QColor& c ) { mOutlineColor = c; }
00075     QColor outlineColor() const { return mOutlineColor; }
00076 
00077     void setOutlineColorField( const QString& field ) { mOutlineColorField = field; }
00078     const QString& outlineColorField() const { return mOutlineColorField; }
00079 
00080     QSet<QString> usedAttributes() const;
00081 
00082   private:
00083     QString mSymbolName;
00084     double mSymbolWidth;
00085     double mSymbolHeight;
00086     QColor mFillColor;
00087     QColor mOutlineColor;
00088     double mOutlineWidth;
00089 
00090 #if 0
00091 
00092     QPair<int, QString> mWidthField;
00094     QPair<int, QString> mHeightField;
00096     QPair<int, QString> mRotationField;
00098     QPair<int, QString> mOutlineWidthField;
00100     QPair<int, QString> mFillColorField;
00102     QPair<int, QString> mOutlineColorField;
00104     QPair<int, QString> mSymbolNameField;
00105 #endif //0
00106 
00107     //data defined property fields
00108     QString mWidthField;
00109     QString mHeightField;
00110     QString mRotationField;
00111     QString mOutlineWidthField;
00112     QString mFillColorField;
00113     QString mOutlineColorField;
00114     QString mSymbolNameField;
00115 
00116     //field indices for data defined properties
00117     //resolved in startRender method
00118     int mWidthIndex;
00119     int mHeightIndex;
00120     int mRotationIndex;
00121     int mOutlineWidthIndex;
00122     int mFillColorIndex;
00123     int mOutlineColorIndex;
00124     int mSymbolNameIndex;
00125 
00126     QPainterPath mPainterPath;
00127 
00128     QPen mPen;
00129     QBrush mBrush;
00130 
00135     void preparePath( const QString& symbolName, QgsSymbolV2RenderContext& context, const QgsFeature* f = 0 );
00136 
00138     bool hasDataDefinedProperty() const;
00139 };
00140 
00141 #endif // QGSELLIPSESYMBOLLAYERV2_H
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines