QGIS API Documentation
2.0.1-Dufour
|
#include <qgsrendererv2.h>
Public Types | |
enum | Capabilities { SymbolLevels = 1, RotationField = 1 << 1, MoreSymbolsPerFeature = 1 << 2, Filter = 1 << 3, ScaleDependent = 1 << 4 } |
Public Member Functions | |
QString | type () const |
virtual QgsSymbolV2 * | symbolForFeature (QgsFeature &feature)=0 |
to be overridden | |
virtual void | startRender (QgsRenderContext &context, const QgsVectorLayer *vlayer)=0 |
virtual void | stopRender (QgsRenderContext &context)=0 |
virtual QList< QString > | usedAttributes ()=0 |
virtual | ~QgsFeatureRendererV2 () |
virtual QgsFeatureRendererV2 * | clone ()=0 |
virtual bool | renderFeature (QgsFeature &feature, QgsRenderContext &context, int layer=-1, bool selected=false, bool drawVertexMarker=false) |
virtual QString | dump () const |
for debugging | |
virtual int | capabilities () |
returns bitwise OR-ed capabilities of the renderer | |
virtual QgsSymbolV2List | symbols ()=0 |
for symbol levels | |
bool | usingSymbolLevels () const |
void | setUsingSymbolLevels (bool usingSymbolLevels) |
virtual QDomElement | save (QDomDocument &doc) |
store renderer info to XML element | |
virtual QDomElement | writeSld (QDomDocument &doc, const QgsVectorLayer &layer) const |
create the SLD UserStyle element following the SLD v1.1 specs | |
virtual void | toSld (QDomDocument &doc, QDomElement &element) const |
used from subclasses to create SLD Rule elements following SLD v1.1 specs | |
virtual QgsLegendSymbologyList | legendSymbologyItems (QSize iconSize) |
return a list of symbology items for the legend | |
virtual QgsLegendSymbolList | legendSymbolItems () |
return a list of item text / symbol | |
void | setVertexMarkerAppearance (int type, int size) |
set type and size of editing vertex markers for subsequent rendering | |
virtual QString | rotationField () const |
return rotation field name (or empty string if not set or not supported by renderer) | |
virtual void | setRotationField (QString fieldName) |
sets rotation field of renderer (if supported by the renderer) | |
virtual bool | willRenderFeature (QgsFeature &feat) |
return whether the renderer will render a feature or not. | |
virtual QgsSymbolV2List | symbolsForFeature (QgsFeature &feat) |
return list of symbols used for rendering the feature. |
Static Public Member Functions | |
static QgsFeatureRendererV2 * | defaultRenderer (QGis::GeometryType geomType) |
return a new renderer - used by default in vector layers | |
static QgsFeatureRendererV2 * | load (QDomElement &symbologyElem) |
create a renderer from XML element | |
static QgsFeatureRendererV2 * | loadSld (const QDomNode &node, QGis::GeometryType geomType, QString &errorMessage) |
create a new renderer according to the information contained in the UserStyle element of a SLD style document |
Protected Member Functions | |
QgsFeatureRendererV2 (QString type) | |
void | renderFeatureWithSymbol (QgsFeature &feature, QgsSymbolV2 *symbol, QgsRenderContext &context, int layer, bool selected, bool drawVertexMarker) |
void | renderVertexMarker (QPointF &pt, QgsRenderContext &context) |
render editing vertex marker at specified point | |
void | renderVertexMarkerPolyline (QPolygonF &pts, QgsRenderContext &context) |
render editing vertex marker for a polyline | |
void | renderVertexMarkerPolygon (QPolygonF &pts, QList< QPolygonF > *rings, QgsRenderContext &context) |
render editing vertex marker for a polygon | |
void | setScaleMethodToSymbol (QgsSymbolV2 *symbol, int scaleMethod) |
Static Protected Member Functions | |
static const unsigned char * | _getPoint (QPointF &pt, QgsRenderContext &context, const unsigned char *wkb) |
static const unsigned char * | _getLineString (QPolygonF &pts, QgsRenderContext &context, const unsigned char *wkb) |
static const unsigned char * | _getPolygon (QPolygonF &pts, QList< QPolygonF > &holes, QgsRenderContext &context, const unsigned char *wkb) |
Protected Attributes | |
QString | mType |
bool | mUsingSymbolLevels |
int | mCurrentVertexMarkerType |
The current type of editing marker. | |
int | mCurrentVertexMarkerSize |
The current size of editing marker. |
Definition at line 68 of file qgsrendererv2.h.
Definition at line 99 of file qgsrendererv2.h.
|
inlinevirtual |
Definition at line 90 of file qgsrendererv2.h.
|
protected |
Definition at line 202 of file qgsrendererv2.cpp.
|
staticprotected |
Definition at line 61 of file qgsrendererv2.cpp.
References QgsClipper::clippedLineWKB(), QgsRenderContext::coordinateTransform(), QgsRenderContext::extent(), QgsRectangle::height(), QgsRenderContext::mapToPixel(), QgsMapToPixel::transformInPlace(), QgsCoordinateTransform::transformPolygon(), QgsRectangle::width(), QGis::WKBLineString25D, QgsRectangle::xMaximum(), QgsRectangle::xMinimum(), QgsRectangle::yMaximum(), and QgsRectangle::yMinimum().
Referenced by renderFeatureWithSymbol().
|
staticprotected |
Definition at line 37 of file qgsrendererv2.cpp.
References QgsRenderContext::coordinateTransform(), QgsRenderContext::mapToPixel(), QgsMapToPixel::transformInPlace(), QgsCoordinateTransform::transformInPlace(), and QGis::WKBPolygon25D.
Referenced by QgsPointDisplacementRenderer::renderFeature(), and renderFeatureWithSymbol().
|
staticprotected |
Definition at line 117 of file qgsrendererv2.cpp.
References QgsRenderContext::coordinateTransform(), QgsRenderContext::extent(), QgsRectangle::height(), QgsRenderContext::mapToPixel(), QgsMapToPixel::transformInPlace(), QgsCoordinateTransform::transformPolygon(), QgsClipper::trimPolygon(), QgsRectangle::width(), QGis::WKBPolygon25D, QgsRectangle::xMaximum(), QgsRectangle::xMinimum(), QgsRectangle::yMaximum(), and QgsRectangle::yMinimum().
Referenced by renderFeatureWithSymbol().
|
inlinevirtual |
returns bitwise OR-ed capabilities of the renderer
Reimplemented in QgsRuleBasedRendererV2, QgsCategorizedSymbolRendererV2, QgsGraduatedSymbolRendererV2, and QgsSingleSymbolRendererV2.
Definition at line 110 of file qgsrendererv2.h.
Referenced by QgsVectorLayer::draw(), QgsAttributeTableFilterModel::generateListOfVisibleFeatures(), QgsMapToolIdentify::identifyVectorLayer(), and QgsVectorFileWriter::writeAsVectorFormat().
|
pure virtual |
Implemented in QgsRuleBasedRendererV2, QgsCategorizedSymbolRendererV2, QgsGraduatedSymbolRendererV2, QgsSingleSymbolRendererV2, and QgsPointDisplacementRenderer.
Referenced by QgsPointDisplacementRenderer::clone().
|
static |
return a new renderer - used by default in vector layers
Definition at line 209 of file qgsrendererv2.cpp.
References QgsSymbolV2::defaultSymbol().
Referenced by QgsPointDisplacementRenderer::QgsPointDisplacementRenderer(), QgsVectorLayer::QgsVectorLayer(), and QgsVectorLayer::readSymbology().
|
virtual |
for debugging
Reimplemented in QgsRuleBasedRendererV2, QgsCategorizedSymbolRendererV2, QgsGraduatedSymbolRendererV2, and QgsSingleSymbolRendererV2.
Definition at line 365 of file qgsrendererv2.cpp.
Referenced by QgsVectorLayer::draw().
|
virtual |
return a list of item text / symbol
Reimplemented in QgsRuleBasedRendererV2, QgsGraduatedSymbolRendererV2, QgsCategorizedSymbolRendererV2, QgsSingleSymbolRendererV2, and QgsPointDisplacementRenderer.
Definition at line 510 of file qgsrendererv2.cpp.
Referenced by QgsLegendModel::addVectorLayerItemsV2(), QgsVectorLayer::countSymbolFeatures(), QgsPointDisplacementRenderer::legendSymbolItems(), QgsComposerLayerItem::setDefaultStyle(), and QgsLegendModel::updateSymbolV2ItemText().
|
virtual |
return a list of symbology items for the legend
Reimplemented in QgsRuleBasedRendererV2, QgsGraduatedSymbolRendererV2, QgsCategorizedSymbolRendererV2, QgsSingleSymbolRendererV2, and QgsPointDisplacementRenderer.
Definition at line 503 of file qgsrendererv2.cpp.
Referenced by QgsPointDisplacementRenderer::legendSymbologyItems().
|
static |
create a renderer from XML element
Definition at line 371 of file qgsrendererv2.cpp.
References QgsRendererV2AbstractMetadata::createRenderer(), QgsRendererV2Registry::instance(), QgsRendererV2Registry::rendererMetadata(), and setUsingSymbolLevels().
Referenced by QgsPointDisplacementRenderer::create(), and QgsVectorLayer::readSymbology().
|
static |
create a new renderer according to the information contained in the UserStyle element of a SLD style document
node | the node in the SLD document whose the UserStyle element is a child |
geomType | the geometry type of the features, used to convert Symbolizer elements |
errorMessage | it will contain the error message if something went wrong |
Definition at line 399 of file qgsrendererv2.cpp.
References QgsRendererV2AbstractMetadata::createRendererFromSld(), QgsRendererV2Registry::instance(), QgsDebugMsg, and QgsRendererV2Registry::rendererMetadata().
Referenced by QgsVectorLayer::readSld().
|
virtual |
Reimplemented in QgsRuleBasedRendererV2, and QgsPointDisplacementRenderer.
Definition at line 215 of file qgsrendererv2.cpp.
References renderFeatureWithSymbol(), and symbolForFeature().
Referenced by QgsVectorLayer::drawRendererV2(), and QgsVectorLayer::drawRendererV2Levels().
|
protected |
Definition at line 225 of file qgsrendererv2.cpp.
References _getLineString(), _getPoint(), _getPolygon(), QgsGeometry::asWkb(), QgsSymbolV2::Fill, QgsFeature::geometry(), QgsFeature::id(), QgsSymbolV2::Line, QgsSymbolV2::Marker, QgsDebugMsg, renderVertexMarkerPolygon(), renderVertexMarkerPolyline(), QgsSymbolV2::type(), QGis::WKBLineString, QGis::WKBLineString25D, QGis::WKBMultiLineString, QGis::WKBMultiLineString25D, QGis::WKBMultiPoint, QGis::WKBMultiPoint25D, QGis::WKBMultiPolygon, QGis::WKBMultiPolygon25D, QGis::WKBPoint, QGis::WKBPoint25D, QGis::WKBPolygon, QGis::WKBPolygon25D, and QgsGeometry::wkbType().
Referenced by renderFeature(), and QgsRuleBasedRendererV2::stopRender().
|
protected |
render editing vertex marker at specified point
Definition at line 521 of file qgsrendererv2.cpp.
References QgsVectorLayer::drawVertexMarker(), mCurrentVertexMarkerSize, mCurrentVertexMarkerType, and QgsRenderContext::painter().
Referenced by renderVertexMarkerPolygon(), and renderVertexMarkerPolyline().
|
protected |
render editing vertex marker for a polygon
Definition at line 534 of file qgsrendererv2.cpp.
References renderVertexMarker().
Referenced by renderFeatureWithSymbol().
|
protected |
render editing vertex marker for a polyline
Definition at line 528 of file qgsrendererv2.cpp.
References renderVertexMarker().
Referenced by renderFeatureWithSymbol().
|
inlinevirtual |
return rotation field name (or empty string if not set or not supported by renderer)
Reimplemented in QgsGraduatedSymbolRendererV2, QgsCategorizedSymbolRendererV2, and QgsSingleSymbolRendererV2.
Definition at line 159 of file qgsrendererv2.h.
|
virtual |
store renderer info to XML element
Reimplemented in QgsRuleBasedRendererV2, QgsGraduatedSymbolRendererV2, QgsCategorizedSymbolRendererV2, QgsSingleSymbolRendererV2, and QgsPointDisplacementRenderer.
Definition at line 393 of file qgsrendererv2.cpp.
References RENDERER_TAG_NAME.
Referenced by QgsPointDisplacementRenderer::save(), and QgsVectorLayer::writeSymbology().
|
inlinevirtual |
sets rotation field of renderer (if supported by the renderer)
Reimplemented in QgsGraduatedSymbolRendererV2, QgsCategorizedSymbolRendererV2, and QgsSingleSymbolRendererV2.
Definition at line 162 of file qgsrendererv2.h.
|
protected |
Definition at line 186 of file qgsrendererv2.cpp.
References QgsSymbolV2::Marker, QgsMarkerSymbolV2::setScaleMethod(), and QgsSymbolV2::type().
Referenced by QgsSingleSymbolRendererV2::setScaleMethod(), QgsCategorizedSymbolRendererV2::setScaleMethod(), and QgsGraduatedSymbolRendererV2::setScaleMethod().
|
inline |
Definition at line 116 of file qgsrendererv2.h.
Referenced by QgsSingleSymbolRendererV2::clone(), QgsGraduatedSymbolRendererV2::clone(), QgsCategorizedSymbolRendererV2::clone(), QgsRuleBasedRendererV2::clone(), and load().
void QgsFeatureRendererV2::setVertexMarkerAppearance | ( | int | type, |
int | size | ||
) |
set type and size of editing vertex markers for subsequent rendering
Definition at line 515 of file qgsrendererv2.cpp.
References mCurrentVertexMarkerSize, mCurrentVertexMarkerType, size, and type().
Referenced by QgsVectorLayer::draw(), and QgsVectorLayer::drawRendererV2Levels().
|
pure virtual |
Implemented in QgsRuleBasedRendererV2, QgsCategorizedSymbolRendererV2, QgsGraduatedSymbolRendererV2, QgsPointDisplacementRenderer, and QgsSingleSymbolRendererV2.
Referenced by QgsVectorLayer::countSymbolFeatures(), QgsVectorLayer::draw(), QgsVectorLayer::drawLabels(), QgsAttributeTableFilterModel::generateListOfVisibleFeatures(), QgsMapToolIdentify::identifyVectorLayer(), QgsPointDisplacementRenderer::startRender(), and QgsVectorFileWriter::startRender().
|
pure virtual |
Implemented in QgsRuleBasedRendererV2, QgsCategorizedSymbolRendererV2, QgsGraduatedSymbolRendererV2, QgsPointDisplacementRenderer, and QgsSingleSymbolRendererV2.
Referenced by QgsVectorLayer::countSymbolFeatures(), QgsVectorLayer::drawLabels(), QgsAttributeTableFilterModel::generateListOfVisibleFeatures(), QgsMapToolIdentify::identifyVectorLayer(), QgsPointDisplacementRenderer::stopRender(), QgsVectorFileWriter::stopRender(), and QgsVectorLayer::stopRendererV2().
|
pure virtual |
to be overridden
feature | feature |
Implemented in QgsRuleBasedRendererV2, QgsCategorizedSymbolRendererV2, QgsGraduatedSymbolRendererV2, QgsPointDisplacementRenderer, and QgsSingleSymbolRendererV2.
Referenced by QgsVectorLayer::drawRendererV2Levels(), QgsVectorFileWriter::exportFeaturesSymbolLevels(), renderFeature(), and symbolsForFeature().
|
pure virtual |
for symbol levels
Implemented in QgsRuleBasedRendererV2, QgsCategorizedSymbolRendererV2, QgsGraduatedSymbolRendererV2, QgsSingleSymbolRendererV2, and QgsPointDisplacementRenderer.
Referenced by QgsVectorFileWriter::createSymbolLayerTable(), QgsVectorLayer::drawRendererV2Levels(), QgsVectorFileWriter::exportFeaturesSymbolLevels(), and QgsPointDisplacementRenderer::symbols().
|
virtual |
return list of symbols used for rendering the feature.
For renderers that do not support MoreSymbolsPerFeature it is more efficient to use symbolForFeature()
Reimplemented in QgsRuleBasedRendererV2.
Definition at line 549 of file qgsrendererv2.cpp.
References symbolForFeature().
Referenced by QgsVectorFileWriter::addFeature(), QgsVectorLayer::countSymbolFeatures(), and QgsPointDisplacementRenderer::firstSymbolForFeature().
|
inlinevirtual |
used from subclasses to create SLD Rule elements following SLD v1.1 specs
Reimplemented in QgsRuleBasedRendererV2, QgsCategorizedSymbolRendererV2, QgsGraduatedSymbolRendererV2, QgsSingleSymbolRendererV2, and QgsPointDisplacementRenderer.
Definition at line 143 of file qgsrendererv2.h.
Referenced by QgsPointDisplacementRenderer::toSld(), and writeSld().
|
inline |
Definition at line 76 of file qgsrendererv2.h.
Referenced by setVertexMarkerAppearance(), and QgsLegendModel::updateSymbolV2ItemText().
|
pure virtual |
Implemented in QgsRuleBasedRendererV2, QgsCategorizedSymbolRendererV2, QgsGraduatedSymbolRendererV2, QgsPointDisplacementRenderer, and QgsSingleSymbolRendererV2.
Referenced by QgsVectorFileWriter::addRendererAttributes(), QgsVectorLayer::draw(), QgsVectorLayer::drawLabels(), and QgsPointDisplacementRenderer::usedAttributes().
|
inline |
Definition at line 115 of file qgsrendererv2.h.
Referenced by QgsSingleSymbolRendererV2::clone(), QgsGraduatedSymbolRendererV2::clone(), QgsCategorizedSymbolRendererV2::clone(), QgsRuleBasedRendererV2::clone(), QgsVectorLayer::draw(), and QgsVectorFileWriter::writeAsVectorFormat().
|
inlinevirtual |
return whether the renderer will render a feature or not.
Must be called between startRender() and stopRender() calls. Default implementation uses symbolForFeature().
Reimplemented in QgsRuleBasedRendererV2.
Definition at line 168 of file qgsrendererv2.h.
Referenced by QgsVectorLayer::drawLabels(), QgsAttributeTableFilterModel::generateListOfVisibleFeatures(), and QgsMapToolIdentify::identifyVectorLayer().
|
virtual |
create the SLD UserStyle element following the SLD v1.1 specs
Definition at line 488 of file qgsrendererv2.cpp.
References QgsMapLayer::name(), and toSld().
Referenced by QgsVectorLayer::writeSld().
|
protected |
The current size of editing marker.
Definition at line 206 of file qgsrendererv2.h.
Referenced by renderVertexMarker(), and setVertexMarkerAppearance().
|
protected |
The current type of editing marker.
Definition at line 204 of file qgsrendererv2.h.
Referenced by renderVertexMarker(), and setVertexMarkerAppearance().
|
protected |
Definition at line 199 of file qgsrendererv2.h.
|
protected |
Definition at line 201 of file qgsrendererv2.h.
Referenced by QgsSingleSymbolRendererV2::save(), QgsCategorizedSymbolRendererV2::save(), QgsGraduatedSymbolRendererV2::save(), and QgsRuleBasedRendererV2::save().