41 , mFields( layer->pendingFields() )
46 , mLayerTransparency( 0 )
66 QString markerTypeString = settings.value(
"/qgis/digitizing/marker_style",
"Cross" ).toString();
67 if ( markerTypeString ==
"Cross" )
71 else if ( markerTypeString ==
"SemiTransparentCircle" )
141 bool validTransform =
true;
158 QgsDebugMsg( QString(
"Simplify - SourceTransformRect=%1" ).arg( sourceRect.
toString( 16 ) ) );
159 QgsDebugMsg( QString(
"Simplify - TargetTransformRect=%1" ).arg( targetRect.toString( 16 ) ) );
161 if ( !sourceRect.
isEmpty() && sourceRect.
isFinite() && !targetRect.isEmpty() && targetRect.isFinite() )
165 QgsPoint minimumDstPoint( targetRect.xMinimum(), targetRect.yMinimum() );
166 QgsPoint maximumDstPoint( targetRect.xMaximum(), targetRect.yMaximum() );
168 double sourceHypothenuse = sqrt( minimumSrcPoint.sqrDist( maximumSrcPoint ) );
169 double targetHypothenuse = sqrt( minimumDstPoint.sqrDist( maximumDstPoint ) );
171 QgsDebugMsg( QString(
"Simplify - SourceHypothenuse=%1" ).arg( sourceHypothenuse ) );
172 QgsDebugMsg( QString(
"Simplify - TargetHypothenuse=%1" ).arg( targetHypothenuse ) );
174 if ( targetHypothenuse != 0 )
175 map2pixelTol *= ( sourceHypothenuse / targetHypothenuse );
181 validTransform =
false;
185 if ( validTransform )
214 drawRendererV2Levels( fit );
216 drawRendererV2( fit );
223 QColor transparentFillColor = QColor( 0, 0, 0, 255 - ( 255 *
mLayerTransparency / 100 ) );
225 mContext.
painter()->setCompositionMode( QPainter::CompositionMode_DestinationIn );
275 Q_UNUSED( rendered );
291 QgsDebugMsg( QString(
"Failed to transform a point while drawing a feature with ID '%1'. Ignoring this feature. %2" )
292 .arg( fet.
id() ).arg( cse.
what() ) );
296 stopRendererV2( NULL );
301 QHash< QgsSymbolV2*, QList<QgsFeature> > features;
321 qDebug(
"rendering stop!" );
322 stopRendererV2( selRenderer );
332 if ( !features.contains( sym ) )
334 features.insert( sym, QList<QgsFeature>() );
336 features[sym].append( fet );
360 for (
int i = 0; i < symbols.count(); i++ )
366 if ( level < 0 || level >= 1000 )
369 while ( level >= levels.count() )
371 levels[level].append( item );
376 for (
int l = 0; l < levels.count(); l++ )
379 for (
int i = 0; i < level.count(); i++ )
382 if ( !features.contains( item.
symbol() ) )
387 int layer = item.
layer();
388 QList<QgsFeature>& lst = features[item.
symbol()];
389 QList<QgsFeature>::iterator fit;
390 for ( fit = lst.begin(); fit != lst.end(); ++fit )
394 stopRendererV2( selRenderer );
409 QgsDebugMsg( QString(
"Failed to transform a point while drawing a feature with ID '%1'. Ignoring this feature. %2" )
410 .arg( fet.
id() ).arg( cse.
what() ) );
416 stopRendererV2( selRenderer );
433 void QgsVectorLayerRenderer::prepareLabeling(
QgsVectorLayer* layer, QStringList& attributeNames )
445 #if 0 // TODO: limit of labels, font not found 455 int nFeatsToLabel = 0;
467 mLabelFontNotFoundNotified =
true;
473 void QgsVectorLayerRenderer::prepareDiagrams(
QgsVectorLayer* layer, QStringList& attributeNames )
490 QList<QString>::const_iterator attIt = att.constBegin();
491 for ( ; attIt != att.constEnd(); ++attIt )
495 QStringList::const_iterator columnsIterator = columns.constBegin();
496 for ( ; columnsIterator != columns.constEnd(); ++columnsIterator )
498 if ( !attributeNames.contains( *columnsIterator ) )
499 attributeNames << *columnsIterator;
504 if ( linearlyInterpolatedDiagramRenderer != NULL )
510 QStringList::const_iterator columnsIterator = columns.constBegin();
511 for ( ; columnsIterator != columns.constEnd(); ++columnsIterator )
513 if ( !attributeNames.contains( *columnsIterator ) )
514 attributeNames << *columnsIterator;
520 if ( !attributeNames.contains( name ) )
521 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.
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
virtual int prepareLayer(QgsVectorLayer *layer, QStringList &attrNames, QgsRenderContext &ctx)=0
called when starting rendering of a layer
QList< QgsSymbolV2 * > QgsSymbolV2List
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.
QgsGeometry * geometry() const
Get the geometry object associated with this feature.
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.
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.
const QgsField & at(int i) const
Get field at particular index (must be in range 0..N-1)
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
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.
bool simplifyDrawingCanbeApplied(const QgsRenderContext &renderContext, QgsVectorSimplifyMethod::SimplifyHint simplifyHint) const
Returns whether the VectorLayer can apply the specified simplification hint.
QPainter::CompositionMode featureBlendMode() const
Read blend mode for layer.
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...
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 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...
QList< QgsSymbolV2LevelItem > QgsSymbolV2Level
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.
int layerTransparency() const
Read transparency for 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)
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
void cacheGeometry(QgsFeatureId fid, const QgsGeometry &geom)
store a geometry in the cache
const QgsMapToPixel & mapToPixel() const
QList< QgsSymbolV2Level > QgsSymbolV2LevelOrder
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.
Custom exception class for Coordinate Reference System related exceptions.
QgsSymbolLayerV2 * symbolLayer(int layer)
Returns a specific symbol layers contained in the symbol.
virtual int capabilities()
returns bitwise OR-ed capabilities of the renderer
bool nextFeature(QgsFeature &f)
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
double xMinimum() const
Get the x minimum value (left side of rectangle)
QgsPoint center() const
Center point of the rectangle.
QgsFeatureRequest & setFilterRect(const QgsRectangle &rect)
Set rectangle from which features will be taken.
~QgsVectorLayerRenderer()
QgsLabelingEngineInterface * labelingEngine() const