Quantum GIS API Documentation  1.8
Public Member Functions | Protected Member Functions | Protected Attributes | Private Member Functions
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 34 of file qgssymbol.h.


Constructor & Destructor Documentation

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

Constructor.

Definition at line 38 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 58 of file qgssymbol.cpp.

References DEFAULT_LINE_WIDTH, and mPen.

old constructors

Definition at line 79 of file qgssymbol.cpp.

References DEFAULT_LINE_WIDTH, and mPen.

QgsSymbol::QgsSymbol ( QColor  c)

Definition at line 95 of file qgssymbol.cpp.

References DEFAULT_LINE_WIDTH, and mPen.

QgsSymbol::~QgsSymbol ( ) [virtual]

Destructor.

Definition at line 141 of file qgssymbol.cpp.


Member Function Documentation

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

Definition at line 476 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 481 of file qgssymbol.cpp.

Referenced by appendField(), and writeXML().

const QBrush & QgsSymbol::brush ( ) const [inline, virtual]
void QgsSymbol::cache ( QColor  selectionColor) [protected]
void QgsSymbol::cache2 ( double  widthScale,
QColor  selectionColor,
double  opacity 
) [protected]
QColor QgsSymbol::color ( void  ) const [virtual]

Get the current color.

Definition at line 146 of file qgssymbol.cpp.

References mPen.

Referenced by QgsSymbologyV2Conversion::symbolV1toV2().

QString QgsSymbol::customTexture ( ) const [virtual]

Gets the path to the customs texture image.

Definition at line 191 of file qgssymbol.cpp.

References mTextureFilePath.

QColor QgsSymbol::fillColor ( ) const [virtual]

Get the fill color.

Definition at line 157 of file qgssymbol.cpp.

References mBrush.

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

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 355 of file qgssymbol.cpp.

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

Referenced by getPointSymbolAsImage().

QImage QgsSymbol::getLineSymbolAsImage ( ) [virtual]

Get a little icon for the legend.

Definition at line 295 of file qgssymbol.cpp.

References mPen.

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

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]
QImage QgsSymbol::getPolygonSymbolAsImage ( ) [virtual]

Get a little icon for the legend.

Definition at line 315 of file qgssymbol.cpp.

References mBrush, and mPen.

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

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

Get the line width.

Definition at line 168 of file qgssymbol.cpp.

References mPen.

Referenced by QgsSymbologyV2Conversion::symbolV1toV2().

QString QgsSymbol::lowerValue ( ) const [inline, virtual]
const QPen & QgsSymbol::pen ( ) const [inline, virtual]
double QgsSymbol::pointSize ( ) const [virtual]
bool QgsSymbol::pointSizeUnits ( ) const [virtual]
QString QgsSymbol::pointSymbolName ( ) const [virtual]
int QgsSymbol::readFieldName ( QDomNode &  synode,
QString  name,
const QgsVectorLayer vl 
) [private]

Definition at line 563 of file qgssymbol.cpp.

References QgsVectorLayer::pendingFields().

Referenced by readXML().

bool QgsSymbol::readXML ( QDomNode &  symbol,
const QgsVectorLayer vl 
) [virtual]
void QgsSymbol::setBrush ( QBrush  b) [inline, virtual]

Sets the brush.

Definition at line 229 of file qgssymbol.h.

References mBrush.

void QgsSymbol::setColor ( QColor  c) [virtual]
void QgsSymbol::setCustomTexture ( QString  path) [virtual]

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

Definition at line 196 of file qgssymbol.cpp.

References mBrush, mCacheUpToDate, mCacheUpToDate2, and mTextureFilePath.

Referenced by readXML().

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

Set the fill (brush) style.

Definition at line 185 of file qgssymbol.cpp.

References mBrush, mCacheUpToDate, and mCacheUpToDate2.

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

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

Definition at line 269 of file qgssymbol.h.

References label(), and mLabel.

Referenced by QgsSymbologyV2Conversion::rendererV2toV1().

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

Set the line (pen) style.

Definition at line 179 of file qgssymbol.cpp.

References mCacheUpToDate, mCacheUpToDate2, and mPen.

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

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

Sets the line width.

Definition at line 173 of file qgssymbol.cpp.

References mCacheUpToDate, mCacheUpToDate2, and mPen.

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

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

Definition at line 249 of file qgssymbol.h.

References mLowerValue.

Referenced by QgsSymbologyV2Conversion::rendererV2toV1().

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

Sets the pen.

Definition at line 239 of file qgssymbol.h.

References mPen.

Referenced by QgsQuickPrint::printMap().

void QgsSymbol::setPointSize ( double  s) [virtual]
void QgsSymbol::setPointSizeUnits ( bool  sizeInMapUnits) [virtual]

Set point size units.

Definition at line 266 of file qgssymbol.cpp.

References mSizeInMapUnits.

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

Sets the number of the rotation classicifation field.

Parameters:
fieldthe number of the field to classify for rotation

Definition at line 693 of file qgssymbol.cpp.

References mRotationClassificationField.

Sets the number of the scale classicifation field.

Parameters:
fieldthe number of the field to classify for scale

Definition at line 703 of file qgssymbol.cpp.

References mScaleClassificationField.

void QgsSymbol::setSymbolField ( int  field)

Sets the number of the symbol field.

Parameters:
fieldthe number of the field to select the symbol

Definition at line 713 of file qgssymbol.cpp.

References mSymbolField.

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

Definition at line 259 of file qgssymbol.h.

References mUpperValue.

Referenced by QgsSymbologyV2Conversion::rendererV2toV1().

int QgsSymbol::symbolField ( ) const
QGis::GeometryType QgsSymbol::type ( ) const [inline]
QString QgsSymbol::upperValue ( ) const [inline, virtual]
bool QgsSymbol::writeXML ( QDomNode &  item,
QDomDocument &  document,
const QgsVectorLayer vl 
) const [virtual]

Member Data Documentation

QBrush QgsSymbol::mBrush [protected]
bool QgsSymbol::mCacheUpToDate [protected]
bool QgsSymbol::mCacheUpToDate2 [protected]
QString QgsSymbol::mLabel [protected]

Definition at line 158 of file qgssymbol.h.

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

QString QgsSymbol::mLowerValue [protected]

Lower value for classification.

Definition at line 155 of file qgssymbol.h.

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

double QgsSymbol::mOpacity [protected]

Definition at line 199 of file qgssymbol.h.

Referenced by cache2(), and getCachedPointSymbolAsImage().

QPen QgsSymbol::mPen [protected]
QImage QgsSymbol::mPointSymbolImage [protected]

Definition at line 186 of file qgssymbol.h.

Referenced by cache(), and QgsSymbol().

QImage QgsSymbol::mPointSymbolImage2 [protected]

Definition at line 195 of file qgssymbol.h.

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

Definition at line 189 of file qgssymbol.h.

Referenced by cache(), and QgsSymbol().

Definition at line 196 of file qgssymbol.h.

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

QString QgsSymbol::mPointSymbolName [protected]

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

Definition at line 218 of file qgssymbol.h.

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

QColor QgsSymbol::mSelectionColor [protected]

Definition at line 214 of file qgssymbol.h.

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

QColor QgsSymbol::mSelectionColor2 [protected]

Definition at line 215 of file qgssymbol.h.

Referenced by cache2(), and QgsSymbol().

double QgsSymbol::mSize [protected]

Definition at line 168 of file qgssymbol.h.

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

bool QgsSymbol::mSizeInMapUnits [protected]
int QgsSymbol::mSymbolField [protected]

Definition at line 220 of file qgssymbol.h.

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

QString QgsSymbol::mTextureFilePath [protected]

Definition at line 164 of file qgssymbol.h.

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

Vector type (point, line, polygon)

Definition at line 160 of file qgssymbol.h.

Referenced by QgsSymbol().

QString QgsSymbol::mUpperValue [protected]

Upper value for classification.

Definition at line 157 of file qgssymbol.h.

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

double QgsSymbol::mWidthScale [protected]

Definition at line 192 of file qgssymbol.h.

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


The documentation for this class was generated from the following files:
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines