48 , mFields( layer->fields() )
49 , mRendererV2( nullptr )
53 , mLabelProvider( nullptr )
54 , mDiagramProvider( nullptr )
55 , mLayerTransparency( 0 )
75 QString markerTypeString = settings.
value(
"/qgis/digitizing/marker_style",
"Cross" ).
toString();
76 if ( markerTypeString ==
"Cross" )
80 else if ( markerTypeString ==
"SemiTransparentCircle" )
131 bool usingEffect =
false;
163 if ( featureFilterProvider )
167 if ( !rendererFilter.
isEmpty() && rendererFilter !=
"TRUE" )
176 bool validTransform =
true;
194 QgsDebugMsg(
QString(
"Simplify - TargetTransformRect=%1" ).arg( targetRect.toString( 16 ) ) );
196 if ( !sourceRect.
isEmpty() && sourceRect.
isFinite() && !targetRect.isEmpty() && targetRect.isFinite() )
200 QgsPoint minimumDstPoint( targetRect.xMinimum(), targetRect.yMinimum() );
201 QgsPoint maximumDstPoint( targetRect.xMaximum(), targetRect.yMaximum() );
203 double sourceHypothenuse = sqrt( minimumSrcPoint.sqrDist( maximumSrcPoint ) );
204 double targetHypothenuse = sqrt( minimumDstPoint.sqrDist( maximumDstPoint ) );
210 map2pixelTol *= ( sourceHypothenuse / targetHypothenuse );
216 validTransform =
false;
220 if ( validTransform )
251 drawRendererV2Levels( fit );
253 drawRendererV2( fit );
365 QgsDebugMsg(
QString(
"Failed to transform a point while drawing a feature with ID '%1'. Ignoring this feature. %2" )
366 .arg( fet.
id() ).arg( cse.
what() ) );
372 stopRendererV2(
nullptr );
400 qDebug(
"rendering stop!" );
401 stopRendererV2( selRenderer );
417 features[sym].append( fet );
469 for (
int i = 0; i < symbols.
count(); i++ )
475 if ( level < 0 || level >= 1000 )
478 while ( level >= levels.
count() )
480 levels[level].
append( item );
485 for (
int l = 0; l < levels.
count(); l++ )
488 for (
int i = 0; i < level.
count(); i++ )
496 int layer = item.
layer();
499 for ( fit = lst.
begin(); fit != lst.
end(); ++fit )
503 stopRendererV2( selRenderer );
520 QgsDebugMsg(
QString(
"Failed to transform a point while drawing a feature with ID '%1'. Ignoring this feature. %2" )
521 .arg( fet.
id() ).arg( cse.
what() ) );
527 stopRendererV2( selRenderer );
571 #if 0 // TODO: limit of labels, font not found 583 int nFeatsToLabel = 0;
595 mLabelFontNotFoundNotified =
true;
QgsFeatureId id() const
Get the feature ID for this feature.
Wrapper for iterator of features from vector data provider or vector layer.
void setThreshold(float threshold)
Sets the simplification threshold in pixels. Represents the maximum distance in pixels between two co...
A rectangle specified with double values.
bool isEmpty() const
test if rectangle is empty.
iterator insert(const Key &key, const T &value)
float threshold() const
Gets the simplification threshold of the vector layer managed.
QgsVectorLayer * mLayer
The rendered layer.
QgsSymbolV2 * symbol() const
bool diagramsEnabled() const
Returns whether the layer contains diagrams which are enabled and should be drawn.
virtual int prepareLayer(QgsVectorLayer *layer, QStringList &attrNames, QgsRenderContext &ctx)=0
called when starting rendering of a layer
void fillRect(const QRectF &rectangle, const QBrush &brush)
void setCompositionMode(CompositionMode mode)
QgsFeatureRequest::OrderBy orderBy() const
Get the order in which features shall be processed by this renderer.
virtual bool prepare(const QgsRenderContext &context, QStringList &attributeNames)
Prepare for registration of features.
QColor selectionColor() const
virtual void stopRender(QgsRenderContext &context) override
Needs to be called when a render cycle has finished to clean up.
virtual QString dump() const
for debugging
bool isFinite() const
Returns true if the rectangle has finite boundaries.
double yMaximum() const
Get the y maximum value (top side of rectangle)
void setFeature(const QgsFeature &feature)
Convenience function for setting a feature for the context.
QgsFeatureIds mSelectedFeatureIds
The geometries can be simplified using the current map2pixel context state.
virtual void registerFeature(const QString &layerID, QgsFeature &feat, QgsRenderContext &context, const QString &dxfLayer=QString::null)=0
called for every feature
virtual Q_DECL_DEPRECATED QgsPalLayerSettings & layer(const QString &layerName)=0
returns PAL layer settings for a registered layer
virtual int prepareDiagramLayer(QgsVectorLayer *layer, QStringList &attrNames, QgsRenderContext &ctx)
adds a diagram layer to the labeling engine
bool orderByEnabled() const
Returns whether custom ordering will be applied before features are processed by this renderer...
const QgsVectorSimplifyMethod & simplifyMethod() const
Returns the simplification settings for fast rendering of features.
const T & at(int i) const
void setGeometryCachePointer(QgsGeometryCache *cache)
where to save the cached geometries
virtual void modifyRequestExtent(QgsRectangle &extent, QgsRenderContext &context)
Allows for a renderer to modify the extent of a feature request prior to rendering.
bool enabled() const
Returns whether the effect is enabled.
QgsFeatureRequest & setSubsetOfAttributes(const QgsAttributeList &attrs)
Set a subset of attributes that will be fetched.
QGis::GeometryType type() const
Returns type of the geometry as a QGis::GeometryType.
QPainter::CompositionMode mFeatureBlendMode
The QgsLabelingEngineV2 class provides map labeling functionality.
static QgsGeometry * getPointObstacleGeometry(QgsFeature &fet, QgsRenderContext &context, const QgsSymbolV2List &symbols)
Returns the geometry for a point feature which should be used as an obstacle for labels.
void setVectorSimplifyMethod(const QgsVectorSimplifyMethod &simplifyMethod)
QgsRenderContext & mContext
const QgsRectangle & extent() const
bool showSelection() const
Returns true if vector selections should be shown in the rendered map.
virtual QList< QString > usedAttributes()=0
Returns a set of attributes required for this renderer.
The feature class encapsulates a single feature including its id, geometry and a list of field/values...
virtual QString filter(const QgsFields &fields=QgsFields())
If a renderer does not require all the features this method may be overridden and return an expressio...
const QgsCoordinateTransform * coordinateTransform() const
void setCachedGeometriesRect(const QgsRectangle &extent)
QgsVectorSimplifyMethod mSimplifyMethod
void setSimplifyHints(const SimplifyHints &simplifyHints)
Sets the simplification hints of the vector layer managed.
virtual bool prepare(const QgsRenderContext &context, QStringList &attributeNames)
Prepare for registration of features.
QString tr(const char *sourceText, const char *disambiguation, int n)
bool qgsDoubleNear(double a, double b, double epsilon=4 *DBL_EPSILON)
bool mLabeling
used with old labeling engine (QgsPalLabeling): whether labeling is enabled
double x() const
Get the x value of the point.
virtual void startRender(QgsRenderContext &context, const QgsFields &fields)=0
Needs to be called when a new render cycle is started.
const QgsFeatureFilterProvider * featureFilterProvider() const
Get the filter feature provider used for additional filtering of rendered features.
QString layerID() const
Get access to the ID of the layer rendered by this class.
virtual void stopRender(QgsRenderContext &context)=0
Needs to be called when a render cycle has finished to clean up.
bool useAdvancedEffects() const
Returns true if advanced effects such as blend modes such be used.
QgsFeatureRequest & combineFilterExpression(const QString &expression)
Modifies the existing filter expression to add an additional expression filter.
virtual Q_DECL_DEPRECATED QgsSymbolV2List originalSymbolsForFeature(QgsFeature &feat)
Equivalent of originalSymbolsForFeature() call extended to support renderers that may use more symbol...
Perform transforms between map coordinates and device coordinates.
QgsFeatureRequest & setExpressionContext(const QgsExpressionContext &context)
Sets the expression context used to evaluate filter expressions.
virtual bool renderFeature(QgsFeature &feature, QgsRenderContext &context, int layer=-1, bool selected=false, bool drawVertexMarker=false)
Render a feature using this renderer in the given context.
void setColor(const QColor &color)
Simplify using the map2pixel data to optimize the rendering of geometries.
virtual QgsFeatureRendererV2 * clone() const =0
QgsFeatureRendererV2 * rendererV2()
Return renderer V2.
QgsVectorLayerEditBuffer * editBuffer()
Buffer with uncommitted editing operations. Only valid after editing has been turned on...
No simplification can be applied.
int count(const T &value) const
virtual Q_DECL_DEPRECATED QgsSymbolV2 * symbolForFeature(QgsFeature &feature)
To be overridden.
bool simplifyDrawingCanbeApplied(const QgsRenderContext &renderContext, QgsVectorSimplifyMethod::SimplifyHint simplifyHint) const
Returns whether the VectorLayer can apply the specified simplification hint.
void append(const T &value)
QPainter::CompositionMode featureBlendMode() const
Returns the current blending mode for features.
QgsLabelingEngineV2 * labelingEngineV2() const
Get access to new labeling engine (may be nullptr)
int toInt(bool *ok) const
double yMinimum() const
Get the y minimum value (bottom side of rectangle)
const QgsAbstractVectorLayerLabeling * labeling() const
Access to labeling configuration.
double xMaximum() const
Get the x maximum value (right side of rectangle)
const QgsFeatureIds & selectedFeaturesIds() const
Return reference to identifiers of selected features.
QgsVectorLayerRenderer(QgsVectorLayer *layer, QgsRenderContext &context)
bool renderingStopped() const
QgsVectorLayerLabelProvider * mLabelProvider
used with new labeling engine (QgsLabelingEngineV2): provider for labels.
bool mVertexMarkerOnlyForSelection
The QgsVectorLayerDiagramProvider class implements support for diagrams within the labeling engine...
void setTolerance(double tolerance)
Sets the tolerance of simplification in map units. Represents the maximum distance in map units betwe...
static void logMessage(const QString &message, const QString &tag=QString::null, MessageLevel level=WARNING)
add a message to the instance (and create it if necessary)
QPaintDevice * device() const
This class wraps a request for features to a vector layer (or directly its vector data provider)...
QgsVectorLayerFeatureSource * mSource
QList< int > QgsAttributeList
int symbolLayerCount()
Returns total number of symbol layers contained in the symbol.
double mapUnitsPerPixel() const
Return current map units per pixel.
QGis::GeometryType geometryType() const
Returns point, line or polygon.
QgsFeatureRendererV2 * mRendererV2
Abstract interface for use by classes that filter the features of a layer.
virtual Q_DECL_DEPRECATED QgsSymbolV2List symbols()
For symbol levels.
Single scope for storing variables and functions for use within a QgsExpressionContext.
A class to represent a point.
virtual void registerFeature(QgsFeature &feature, QgsRenderContext &context, QgsGeometry *obstacleGeometry=nullptr)
Register a feature for labeling as one or more QgsLabelFeature objects stored into mFeatures...
bool drawEditingInformation() const
bool forceLocalOptimization() const
Gets where the simplification executes, after fetch the geometries from provider, or when supported...
virtual void registerFeature(QgsFeature &feature, QgsRenderContext &context, QgsGeometry *obstacleGeometry=nullptr)
Register a feature for labeling as one or more QgsLabelFeature objects stored into mLabels...
Partial snapshot of vector layer's state (only the members necessary for access to features) ...
virtual void filterFeatures(const QgsVectorLayer *layer, QgsFeatureRequest &featureRequest) const =0
Add additional filters to the feature request to further restrict the features returned by the reques...
int renderingPass() const
QgsExpressionContext & expressionContext()
Gets the expression context.
QgsFeatureRequest & setSimplifyMethod(const QgsSimplifyMethod &simplifyMethod)
Set a simplification method for geometries that will be fetched.
bool contains(const T &value) const
int layerTransparency() const
Returns the current transparency for the vector layer.
void setForceLocalOptimization(bool localOptimization)
Sets whether the simplification executes after fetch the geometries from provider, otherwise it executes, when supported, in provider before fetch the geometries.
virtual bool render() override
Do the rendering (based on data stored in the class)
virtual void registerDiagramFeature(const QString &layerID, QgsFeature &feat, QgsRenderContext &context)
called for every diagram feature
QVariant value(const QString &key, const QVariant &defaultValue) const
This class contains information how to simplify geometries fetched from a vector layer.
Contains information about the context of a rendering operation.
virtual QgsFeatureIterator getFeatures(const QgsFeatureRequest &request) override
Get an iterator for features matching the specified request.
static QgsSymbolV2 * defaultSymbol(QGis::GeometryType geomType)
return new default symbol for specified geometry type
QGis::GeometryType mGeometryType
void setMethodType(MethodType methodType)
Sets the simplification type.
void appendScope(QgsExpressionContextScope *scope)
Appends a scope to the end of the context.
void setVertexMarkerAppearance(int type, int size)
set type and size of editing vertex markers for subsequent rendering
bool usingSymbolLevels() const
const QgsGeometry * constGeometry() const
Gets a const pointer to the geometry object associated with this feature.
void cacheGeometry(QgsFeatureId fid, const QgsGeometry &geom)
store a geometry in the cache
QgsPaintEffect * paintEffect() const
Returns the current paint effect for the renderer.
const QgsMapToPixel & mapToPixel() const
double y() const
Get the y value of the point.
Base class for utility classes that encapsulate information necessary for rendering of map layers...
This class contains information about how to simplify geometries fetched from a QgsFeatureIterator.
bool contains(const Key &key) const
QgsFeatureRequest & setOrderBy(const OrderBy &orderBy)
Set a list of order by clauses.
Custom exception class for Coordinate Reference System related exceptions.
QgsSymbolLayerV2 * symbolLayer(int layer)
Returns a specific symbol layers contained in the symbol.
QgsExpressionContextScope * popScope()
Removes the last scope from the expression context and return it.
static QgsExpressionContextScope * layerScope(const QgsMapLayer *layer)
Creates a new scope which contains variables and functions relating to a QgsMapLayer.
virtual int capabilities()
returns bitwise OR-ed capabilities of the renderer
bool nextFeature(QgsFeature &f)
QgsVectorLayerDiagramProvider * mDiagramProvider
used with new labeling engine (QgsLabelingEngineV2): provider for diagrams.
Represents a vector layer which manages a vector based data sets.
QgsGeometryCache * mCache
bool geographicFlag() const
Returns whether the CRS is a geographic CRS.
QString toString(bool automaticPrecision=false) const
returns string representation of form xmin,ymin xmax,ymax
virtual void startRender(QgsRenderContext &context, const QgsFields &fields) override
Needs to be called when a new render cycle is started.
virtual void end(QgsRenderContext &context)
Ends interception of paint operations to a render context, and draws the result to the render context...
static QgsExpressionContextScope * updateSymbolScope(const QgsSymbolV2 *symbol, QgsExpressionContextScope *symbolScope=nullptr)
Updates a symbol scope related to a QgsSymbolV2 to an expression context.
double xMinimum() const
Get the x minimum value (left side of rectangle)
QgsPoint center() const
Center point of the rectangle.
bool mDiagrams
used with new labeling engine (QgsPalLabeling): whether diagrams are enabled
virtual void begin(QgsRenderContext &context)
Begins intercepting paint operations to a render context.
virtual QgsVectorLayerLabelProvider * provider(QgsVectorLayer *layer) const =0
Factory for label provider implementation.
QgsFeatureRequest & setFilterRect(const QgsRectangle &rect)
Set rectangle from which features will be taken.
~QgsVectorLayerRenderer()
QgsLabelingEngineInterface * labelingEngine() const