43 , mFields( layer->pendingFields() )
48 , mLayerTransparency( 0 )
68 QString markerTypeString = settings.
value(
"/qgis/digitizing/marker_style",
"Cross" ).
toString();
69 if ( markerTypeString ==
"Cross" )
73 else if ( markerTypeString ==
"SemiTransparentCircle" )
122 bool usingEffect =
false;
150 bool validTransform =
true;
168 QgsDebugMsg(
QString(
"Simplify - TargetTransformRect=%1" ).arg( targetRect.toString( 16 ) ) );
170 if ( !sourceRect.
isEmpty() && sourceRect.
isFinite() && !targetRect.isEmpty() && targetRect.isFinite() )
174 QgsPoint minimumDstPoint( targetRect.xMinimum(), targetRect.yMinimum() );
175 QgsPoint maximumDstPoint( targetRect.xMaximum(), targetRect.yMaximum() );
177 double sourceHypothenuse = sqrt( minimumSrcPoint.sqrDist( maximumSrcPoint ) );
178 double targetHypothenuse = sqrt( minimumDstPoint.sqrDist( maximumDstPoint ) );
183 if ( targetHypothenuse != 0 )
184 map2pixelTol *= ( sourceHypothenuse / targetHypothenuse );
190 validTransform =
false;
194 if ( validTransform )
223 drawRendererV2Levels( fit );
225 drawRendererV2( fit );
289 Q_UNUSED( rendered );
305 QgsDebugMsg(
QString(
"Failed to transform a point while drawing a feature with ID '%1'. Ignoring this feature. %2" )
306 .arg( fet.
id() ).arg( cse.
what() ) );
310 stopRendererV2( NULL );
335 qDebug(
"rendering stop!" );
336 stopRendererV2( selRenderer );
350 features[sym].append( fet );
374 for (
int i = 0; i < symbols.
count(); i++ )
380 if ( level < 0 || level >= 1000 )
383 while ( level >= levels.
count() )
385 levels[level].
append( item );
390 for (
int l = 0; l < levels.
count(); l++ )
393 for (
int i = 0; i < level.
count(); i++ )
401 int layer = item.
layer();
404 for ( fit = lst.
begin(); fit != lst.
end(); ++fit )
408 stopRendererV2( selRenderer );
423 QgsDebugMsg(
QString(
"Failed to transform a point while drawing a feature with ID '%1'. Ignoring this feature. %2" )
424 .arg( fet.
id() ).arg( cse.
what() ) );
430 stopRendererV2( selRenderer );
459 #if 0 // TODO: limit of labels, font not found
469 int nFeatsToLabel = 0;
481 mLabelFontNotFoundNotified =
true;
505 for ( ; attIt != att.
constEnd(); ++attIt )
510 for ( ; columnsIterator != columns.
constEnd(); ++columnsIterator )
512 if ( !attributeNames.
contains( *columnsIterator ) )
513 attributeNames << *columnsIterator;
518 if ( linearlyInterpolatedDiagramRenderer != NULL )
525 for ( ; columnsIterator != columns.
constEnd(); ++columnsIterator )
527 if ( !attributeNames.
contains( *columnsIterator ) )
528 attributeNames << *columnsIterator;
534 if ( !attributeNames.
contains( name ) )
535 attributeNames << name;
QgsFeatureId id() const
Get the feature ID for this feature.
Class for parsing and evaluation of expressions (formerly called "search strings").
const QString & name() const
Gets the name of the field.
Wrapper for iterator of features from vector data provider or vector layer.
QgsFeatureRendererV2 * rendererV2()
Return renderer V2.
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.
QStringList referencedColumns() const
Get list of columns referenced by the expression.
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)
QColor selectionColor() const
virtual void stopRender(QgsRenderContext &context) override
virtual QgsPalLayerSettings & layer(const QString &layerName)=0
returns PAL layer settings for a registered layer
virtual QString dump() const
for debugging
virtual QList< QString > diagramAttributes() const =0
Returns attribute indices needed for diagram rendering.
bool isFinite() const
Returns true if the rectangle has finite boundaries.
QgsExpression * getExpression(const QString &expression, const QgsFields *fields)
double yMaximum() const
Get the y maximum value (top side of rectangle)
QgsFeatureIds mSelectedFeatureIds
The geometries can be simplified using the current map2pixel context state.
QgsDiagram * diagram() const
const QgsVectorSimplifyMethod & simplifyMethod() const
Returns the simplification settings for fast rendering of features.
void setSimplifyHints(SimplifyHints simplifyHints)
Sets the simplification hints of the vector layer managed.
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.
bool contains(const QString &str, Qt::CaseSensitivity cs) const
QgsFeatureRequest & setSubsetOfAttributes(const QgsAttributeList &attrs)
Set a subset of attributes that will be fetched.
QPainter::CompositionMode mFeatureBlendMode
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
virtual int addDiagramLayer(QgsVectorLayer *layer, const QgsDiagramLayerSettings *s)
adds a diagram layer to the labeling engine
The feature class encapsulates a single feature including its id, geometry and a list of field/values...
const QgsDiagramLayerSettings * diagramLayerSettings() const
const QgsCoordinateTransform * coordinateTransform() const
void setCachedGeometriesRect(const QgsRectangle &extent)
QgsVectorSimplifyMethod mSimplifyMethod
QString tr(const char *sourceText, const char *disambiguation, int n)
virtual void startRender(QgsRenderContext &context, const QgsFields &fields)=0
static void logMessage(QString message, QString tag=QString::null, MessageLevel level=WARNING)
add a message to the instance (and create it if necessary)
Returns diagram settings for a feature.
QString layerID() const
Get access to the ID of the layer rendered by this class.
virtual void stopRender(QgsRenderContext &context)=0
bool useAdvancedEffects() const
Returns true if advanced effects such as blend modes such be used.
virtual QgsSymbolV2List symbols()=0
for symbol levels
Perform transforms between map coordinates and device coordinates.
virtual bool renderFeature(QgsFeature &feature, QgsRenderContext &context, int layer=-1, bool selected=false, bool drawVertexMarker=false)
void setColor(const QColor &color)
Simplify using the map2pixel data to optimize the rendering of geometries.
virtual QgsFeatureRendererV2 * clone() const =0
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
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.
int toInt(bool *ok) const
double yMinimum() const
Get the y minimum value (bottom side of rectangle)
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
bool mVertexMarkerOnlyForSelection
void setTolerance(double tolerance)
Sets the tolerance of simplification. Represents the maximum distance between two coordinates which c...
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
const QgsField & at(int i) const
Get field at particular index (must be in range 0..N-1)
const QgsDiagramRendererV2 * diagramRenderer() const
A class to represent a point.
bool drawEditingInformation() const
bool forceLocalOptimization() const
Gets where the simplification executes, after fetch the geometries from provider, or when supported...
Partial snapshot of vector layer's state (only the members necessary for access to features) ...
int renderingPass() const
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.
int classificationAttribute() const
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)
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
static QgsSymbolV2 * defaultSymbol(QGis::GeometryType geomType)
return new default symbol for specified geometry type
virtual void registerFeature(const QString &layerID, QgsFeature &feat, const QgsRenderContext &context=QgsRenderContext(), QString dxfLayer=QString::null)=0
called for every feature
QGis::GeometryType mGeometryType
void setMethodType(MethodType methodType)
Sets the simplification type.
void setVertexMarkerAppearance(int type, int size)
set type and size of editing vertex markers for subsequent rendering
bool usingSymbolLevels() const
bool classificationAttributeIsExpression() 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
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
Custom exception class for Coordinate Reference System related exceptions.
QgsSymbolLayerV2 * symbolLayer(int layer)
Returns a specific symbol layers contained in the symbol.
const_iterator constEnd() const
virtual int capabilities()
returns bitwise OR-ed capabilities of the renderer
bool nextFeature(QgsFeature &f)
const_iterator constBegin() const
QString classificationAttributeExpression() const
virtual void registerDiagramFeature(const QString &layerID, QgsFeature &feat, const QgsRenderContext &context=QgsRenderContext())
called for every diagram feature
Represents a vector layer which manages a vector based data sets.
QgsGeometryCache * mCache
bool geographicFlag() const
QString toString(bool automaticPrecision=false) const
returns string representation of form xmin,ymin xmax,ymax
virtual QgsSymbolV2 * symbolForFeature(QgsFeature &feature)=0
to be overridden
virtual void startRender(QgsRenderContext &context, const QgsFields &fields) override
virtual void end(QgsRenderContext &context)
Ends interception of paint operations to a render context, and draws the result to the render context...
double xMinimum() const
Get the x minimum value (left side of rectangle)
QgsPoint center() const
Center point of the rectangle.
virtual void begin(QgsRenderContext &context)
Begins intercepting paint operations to a render context.
QgsFeatureRequest & setFilterRect(const QgsRectangle &rect)
Set rectangle from which features will be taken.
~QgsVectorLayerRenderer()
QgsLabelingEngineInterface * labelingEngine() const