QgsSymbol Class Reference

Encapsulates settings for drawing (QPen, QBrush, Point symbol) and classification (lower value, upper value). More...

#include <qgssymbol.h>

List of all members.

Public Member Functions

 QgsSymbol (QGis::GeometryType t, QString lvalue="", QString uvalue="", QString label="")
 Constructor.
 QgsSymbol (QGis::GeometryType t, QString lvalue, QString uvalue, QString label, QColor c)
 Constructor.
 QgsSymbol (const QgsSymbol &)
 QgsSymbol ()
 old constructors
 QgsSymbol (QColor c)
virtual void setBrush (QBrush b)
 Sets the brush.
virtual const QBrush & brush () const
 Gets a reference to m_brush, Don't use the brush to change color/style.
virtual void setColor (QColor c)
 Set the color.
virtual QColor color () const
 Get the current color.
virtual QColor fillColor () const
 Get the fill color.
virtual void setFillColor (QColor c)
 Sets the fill color.
virtual double lineWidth () const
 Get the line width.
virtual void setLineWidth (double w)
 Sets the line width.
virtual void setPen (QPen p)
 Sets the pen.
virtual const QPen & pen () const
 Gets a reference to m_pen.
virtual void setLineStyle (Qt::PenStyle s)
 Set the line (pen) style.
virtual void setFillStyle (Qt::BrushStyle s)
 Set the fill (brush) style.
virtual QString customTexture () const
 Gets the path to the customs texture image.
virtual void setCustomTexture (QString path)
 Sets the path to the custom texture, and sets the brush to use TexturePattern.
virtual void setLowerValue (QString value)
virtual QString lowerValue () const
virtual void setUpperValue (QString value)
virtual QString upperValue () const
virtual void setLabel (QString label)
virtual QString label () const
virtual void setNamedPointSymbol (QString name)
 Set point symbol from name.
virtual QString pointSymbolName () const
 Get point symbol.
virtual void setPointSize (double s)
 Set point size.
virtual double pointSize () const
 Get size.
virtual void setPointSizeUnits (bool sizeInMapUnits)
 Set point size units.
virtual bool pointSizeUnits () const
 get point size units
virtual ~QgsSymbol ()
 Destructor.
virtual QImage getLineSymbolAsImage ()
 Get a little icon for the legend.
virtual QImage getPolygonSymbolAsImage ()
 Get a little icon for the legend.
virtual QImage getCachedPointSymbolAsImage (double widthScale=1.0, bool selected=false, QColor selectionColor=Qt::yellow, double opacity=1.0)
 Get QImage representation of point symbol with current settings.
virtual QImage getPointSymbolAsImage (double widthScale=1.0, bool selected=false, QColor selectionColor=Qt::yellow, double scale=1.0, double rotation=0.0, double rasterScaleFactor=1.0, double opacity=1.0)
 Get QImage representation of point symbol with current settings and scaled (can be slow when scale != 1.0).
virtual bool writeXML (QDomNode &item, QDomDocument &document, const QgsVectorLayer *vl) const
 Writes the contents of the symbol to a configuration file @ return true in case of success.
virtual bool readXML (QDomNode &symbol, const QgsVectorLayer *vl)
 Reads the contents of the symbol from a configuration file @ return true in case of success.
QGis::GeometryType type () const
 Returns if this symbol is point/ line or polygon.
int rotationClassificationField () const
 Returns the number of the rotation classification field.
void setRotationClassificationField (int field)
 Sets the number of the rotation classicifation field.
int scaleClassificationField () const
 Returns the number of the scale classification field.
void setScaleClassificationField (int field)
 Sets the number of the scale classicifation field.
int symbolField () const
 Returns the number of the symbol field.
void setSymbolField (int field)
 Sets the number of the symbol field.

Protected Member Functions

void cache (QColor selectionColor)
void cache2 (double widthScale, QColor selectionColor, double opacity)

Protected Attributes

QString mLowerValue
 Lower value for classification.
QString mUpperValue
 Upper value for classification.
QString mLabel
QGis::GeometryType mType
 Vector type (point, line, polygon).
QPen mPen
QBrush mBrush
QString mTextureFilePath
QString mPointSymbolName
double mSize
bool mSizeInMapUnits
QImage mPointSymbolImage
QImage mPointSymbolImageSelected
double mWidthScale
QImage mPointSymbolImage2
QImage mPointSymbolImageSelected2
double mOpacity
bool mCacheUpToDate
bool mCacheUpToDate2
QColor mSelectionColor
QColor mSelectionColor2
int mRotationClassificationField
 Index of the classification fields (it must be a numerical field index).
int mScaleClassificationField
int mSymbolField

Private Member Functions

int readFieldName (QDomNode &synode, QString name, const QgsVectorLayer &vl)
void appendField (QDomElement &symbol, QDomDocument &document, const QgsVectorLayer &vl, QString name, int idx) const
void appendText (QDomElement &symbol, QDomDocument &document, QString name, QString value) const


Detailed Description

Encapsulates settings for drawing (QPen, QBrush, Point symbol) and classification (lower value, upper value).

Definition at line 35 of file qgssymbol.h.


Constructor & Destructor Documentation

QgsSymbol::QgsSymbol ( QGis::GeometryType  t,
QString  lvalue = "",
QString  uvalue = "",
QString  label = "" 
)

Constructor.

Definition at line 40 of file qgssymbol.cpp.

References DEFAULT_LINE_WIDTH, and mPen.

QgsSymbol::QgsSymbol ( QGis::GeometryType  t,
QString  lvalue,
QString  uvalue,
QString  label,
QColor  c 
)

Constructor.

Definition at line 60 of file qgssymbol.cpp.

References DEFAULT_LINE_WIDTH, and mPen.

QgsSymbol::QgsSymbol ( const QgsSymbol s  ) 

QgsSymbol::QgsSymbol (  ) 

old constructors

Definition at line 81 of file qgssymbol.cpp.

References DEFAULT_LINE_WIDTH, and mPen.

QgsSymbol::QgsSymbol ( QColor  c  ) 

Definition at line 97 of file qgssymbol.cpp.

References DEFAULT_LINE_WIDTH, and mPen.

QgsSymbol::~QgsSymbol (  )  [virtual]

Destructor.

Definition at line 143 of file qgssymbol.cpp.


Member Function Documentation

void QgsSymbol::setBrush ( QBrush  b  )  [inline, virtual]

Sets the brush.

Definition at line 230 of file qgssymbol.h.

References mBrush.

const QBrush & QgsSymbol::brush (  )  const [inline, virtual]

void QgsSymbol::setColor ( QColor  c  )  [virtual]

QColor QgsSymbol::color ( void   )  const [virtual]

Get the current color.

Definition at line 148 of file qgssymbol.cpp.

References mPen.

Referenced by QgsSymbologyV2Conversion::symbolV1toV2().

QColor QgsSymbol::fillColor (  )  const [virtual]

Get the fill color.

Definition at line 159 of file qgssymbol.cpp.

References mBrush.

Referenced by QgsContinuousColorRenderer::renderFeature(), and QgsSymbologyV2Conversion::symbolV1toV2().

void QgsSymbol::setFillColor ( QColor  c  )  [virtual]

double QgsSymbol::lineWidth (  )  const [virtual]

Get the line width.

Definition at line 170 of file qgssymbol.cpp.

References mPen.

Referenced by QgsSymbologyV2Conversion::symbolV1toV2().

void QgsSymbol::setLineWidth ( double  w  )  [virtual]

Sets the line width.

Definition at line 175 of file qgssymbol.cpp.

References mCacheUpToDate, mCacheUpToDate2, and mPen.

Referenced by readXML(), and QgsSymbologyV2Conversion::symbolV2toV1().

void QgsSymbol::setPen ( QPen  p  )  [inline, virtual]

Sets the pen.

Definition at line 240 of file qgssymbol.h.

References mPen.

const QPen & QgsSymbol::pen (  )  const [inline, virtual]

void QgsSymbol::setLineStyle ( Qt::PenStyle  s  )  [virtual]

Set the line (pen) style.

Definition at line 181 of file qgssymbol.cpp.

References mCacheUpToDate, mCacheUpToDate2, and mPen.

Referenced by readXML(), and QgsSymbologyV2Conversion::symbolV2toV1().

void QgsSymbol::setFillStyle ( Qt::BrushStyle  s  )  [virtual]

Set the fill (brush) style.

Definition at line 187 of file qgssymbol.cpp.

References mBrush, mCacheUpToDate, and mCacheUpToDate2.

Referenced by QgsSingleSymbolRenderer::QgsSingleSymbolRenderer(), readXML(), and QgsSymbologyV2Conversion::symbolV2toV1().

QString QgsSymbol::customTexture (  )  const [virtual]

Gets the path to the customs texture image.

Definition at line 193 of file qgssymbol.cpp.

References mTextureFilePath.

void QgsSymbol::setCustomTexture ( QString  path  )  [virtual]

Sets the path to the custom texture, and sets the brush to use TexturePattern.

Definition at line 198 of file qgssymbol.cpp.

References mBrush, mCacheUpToDate, mCacheUpToDate2, and mTextureFilePath.

Referenced by readXML().

void QgsSymbol::setLowerValue ( QString  value  )  [inline, virtual]

Definition at line 250 of file qgssymbol.h.

References mLowerValue.

Referenced by QgsSymbologyV2Conversion::rendererV2toV1().

QString QgsSymbol::lowerValue (  )  const [inline, virtual]

void QgsSymbol::setUpperValue ( QString  value  )  [inline, virtual]

Definition at line 260 of file qgssymbol.h.

References mUpperValue.

Referenced by QgsSymbologyV2Conversion::rendererV2toV1().

QString QgsSymbol::upperValue (  )  const [inline, virtual]

void QgsSymbol::setLabel ( QString  label  )  [inline, virtual]

Definition at line 270 of file qgssymbol.h.

References mLabel.

Referenced by QgsSymbologyV2Conversion::rendererV2toV1().

QString QgsSymbol::label (  )  const [inline, virtual]

void QgsSymbol::setNamedPointSymbol ( QString  name  )  [virtual]

QString QgsSymbol::pointSymbolName (  )  const [virtual]

void QgsSymbol::setPointSize ( double  s  )  [virtual]

double QgsSymbol::pointSize (  )  const [virtual]

void QgsSymbol::setPointSizeUnits ( bool  sizeInMapUnits  )  [virtual]

Set point size units.

Definition at line 268 of file qgssymbol.cpp.

References mSizeInMapUnits.

Referenced by readXML(), and QgsSingleSymbolRenderer::renderFeature().

bool QgsSymbol::pointSizeUnits (  )  const [virtual]

QImage QgsSymbol::getLineSymbolAsImage (  )  [virtual]

Get a little icon for the legend.

Definition at line 297 of file qgssymbol.cpp.

References mPen.

Referenced by QgsLegendModel::itemFromSymbol(), and QgsComposerSymbolItem::readXML().

QImage QgsSymbol::getPolygonSymbolAsImage (  )  [virtual]

Get a little icon for the legend.

Definition at line 317 of file qgssymbol.cpp.

References mBrush, and mPen.

Referenced by QgsLegendModel::itemFromSymbol(), and QgsComposerSymbolItem::readXML().

QImage QgsSymbol::getCachedPointSymbolAsImage ( double  widthScale = 1.0,
bool  selected = false,
QColor  selectionColor = Qt::yellow,
double  opacity = 1.0 
) [virtual]

Get QImage representation of point symbol with current settings.

Definition at line 357 of file qgssymbol.cpp.

References cache2(), mCacheUpToDate2, mOpacity, mPointSymbolImage2, mPointSymbolImageSelected2, and mSelectionColor.

Referenced by getPointSymbolAsImage().

QImage QgsSymbol::getPointSymbolAsImage ( double  widthScale = 1.0,
bool  selected = false,
QColor  selectionColor = Qt::yellow,
double  scale = 1.0,
double  rotation = 0.0,
double  rasterScaleFactor = 1.0,
double  opacity = 1.0 
) [virtual]

bool QgsSymbol::writeXML ( QDomNode &  item,
QDomDocument &  document,
const QgsVectorLayer vl 
) const [virtual]

bool QgsSymbol::readXML ( QDomNode &  symbol,
const QgsVectorLayer vl 
) [virtual]

QGis::GeometryType QgsSymbol::type (  )  const [inline]

int QgsSymbol::rotationClassificationField (  )  const

void QgsSymbol::setRotationClassificationField ( int  field  ) 

Sets the number of the rotation classicifation field.

Parameters:
field the number of the field to classify for rotation

Definition at line 695 of file qgssymbol.cpp.

References mRotationClassificationField.

int QgsSymbol::scaleClassificationField (  )  const

void QgsSymbol::setScaleClassificationField ( int  field  ) 

Sets the number of the scale classicifation field.

Parameters:
field the number of the field to classify for scale

Definition at line 705 of file qgssymbol.cpp.

References mScaleClassificationField.

int QgsSymbol::symbolField (  )  const

void QgsSymbol::setSymbolField ( int  field  ) 

Sets the number of the symbol field.

Parameters:
field the number of the field to select the symbol

Definition at line 715 of file qgssymbol.cpp.

References mSymbolField.

void QgsSymbol::cache ( QColor  selectionColor  )  [protected]

void QgsSymbol::cache2 ( double  widthScale,
QColor  selectionColor,
double  opacity 
) [protected]

int QgsSymbol::readFieldName ( QDomNode &  synode,
QString  name,
const QgsVectorLayer vl 
) [private]

Definition at line 565 of file qgssymbol.cpp.

References QgsVectorLayer::pendingFields().

Referenced by readXML().

void QgsSymbol::appendField ( QDomElement &  symbol,
QDomDocument &  document,
const QgsVectorLayer vl,
QString  name,
int  idx 
) const [private]

Definition at line 478 of file qgssymbol.cpp.

References appendText(), and QgsVectorLayer::pendingFields().

Referenced by writeXML().

void QgsSymbol::appendText ( QDomElement &  symbol,
QDomDocument &  document,
QString  name,
QString  value 
) const [private]

Definition at line 483 of file qgssymbol.cpp.

Referenced by appendField(), and writeXML().


Member Data Documentation

QString QgsSymbol::mLowerValue [protected]

Lower value for classification.

Definition at line 156 of file qgssymbol.h.

Referenced by lowerValue(), QgsSymbol(), readXML(), setLowerValue(), and writeXML().

QString QgsSymbol::mUpperValue [protected]

Upper value for classification.

Definition at line 158 of file qgssymbol.h.

Referenced by QgsSymbol(), readXML(), setUpperValue(), upperValue(), and writeXML().

QString QgsSymbol::mLabel [protected]

Definition at line 159 of file qgssymbol.h.

Referenced by label(), QgsSymbol(), readXML(), setLabel(), and writeXML().

Vector type (point, line, polygon).

Definition at line 161 of file qgssymbol.h.

Referenced by QgsSymbol().

QPen QgsSymbol::mPen [protected]

QBrush QgsSymbol::mBrush [protected]

QString QgsSymbol::mTextureFilePath [protected]

Definition at line 165 of file qgssymbol.h.

Referenced by customTexture(), QgsSymbol(), setCustomTexture(), and writeXML().

QString QgsSymbol::mPointSymbolName [protected]

double QgsSymbol::mSize [protected]

Definition at line 169 of file qgssymbol.h.

Referenced by cache(), cache2(), getPointSymbolAsImage(), pointSize(), QgsSymbol(), and setPointSize().

bool QgsSymbol::mSizeInMapUnits [protected]

QImage QgsSymbol::mPointSymbolImage [protected]

Definition at line 187 of file qgssymbol.h.

Referenced by cache(), and QgsSymbol().

Definition at line 190 of file qgssymbol.h.

Referenced by cache(), and QgsSymbol().

double QgsSymbol::mWidthScale [protected]

Definition at line 193 of file qgssymbol.h.

Referenced by cache2(), getPointSymbolAsImage(), and QgsSymbol().

QImage QgsSymbol::mPointSymbolImage2 [protected]

Definition at line 196 of file qgssymbol.h.

Referenced by cache2(), getCachedPointSymbolAsImage(), and QgsSymbol().

Definition at line 197 of file qgssymbol.h.

Referenced by cache2(), getCachedPointSymbolAsImage(), and QgsSymbol().

double QgsSymbol::mOpacity [protected]

Definition at line 200 of file qgssymbol.h.

Referenced by cache2(), and getCachedPointSymbolAsImage().

bool QgsSymbol::mCacheUpToDate [protected]

bool QgsSymbol::mCacheUpToDate2 [protected]

QColor QgsSymbol::mSelectionColor [protected]

Definition at line 215 of file qgssymbol.h.

Referenced by cache(), getCachedPointSymbolAsImage(), and QgsSymbol().

QColor QgsSymbol::mSelectionColor2 [protected]

Definition at line 216 of file qgssymbol.h.

Referenced by cache2(), and QgsSymbol().

Index of the classification fields (it must be a numerical field index).

Definition at line 219 of file qgssymbol.h.

Referenced by QgsSymbol(), readXML(), rotationClassificationField(), setRotationClassificationField(), and writeXML().

int QgsSymbol::mSymbolField [protected]

Definition at line 221 of file qgssymbol.h.

Referenced by QgsSymbol(), readXML(), setSymbolField(), symbolField(), and writeXML().


The documentation for this class was generated from the following files:

Generated on Sat Feb 4 19:17:54 2012 for Quantum GIS API Documentation by  doxygen 1.5.6