15 #include <QScopedPointer> 30 : mSettings( settings )
31 , mLayerFilterExpression( layerFilterExpression )
32 , mOnlyExpressions( false )
108 if ( hasStyleOverride )
143 bool allExpressionFalse =
false;
169 allExpressionFalse =
false;
176 lUsedSymbolsRuleKey.
insert( legendKey );
179 if ( moreSymbolsPerFeature )
196 if ( !allExpressionFalse )
199 usedSymbols = lUsedSymbols;
200 usedSymbolsRuleKey = lUsedSymbolsRuleKey;
203 if ( hasStyleOverride )
bool restoreOverrideStyle()
Restore the original store after a call to setOverrideStyle()
HitTest mHitTest
The hit test.
Class for parsing and evaluation of expressions (formerly called "search strings").
Wrapper for iterator of features from vector data provider or vector layer.
HitTest mHitTestRuleKey
The hit test, using legend rule keys.
void setDotsPerMeterX(int x)
virtual QSet< QString > legendKeysForFeature(QgsFeature &feature, QgsRenderContext &context)
Return legend keys matching a specified feature.
bool intersects(const QgsRectangle &r) const
Test for intersection with a rectangle (uses GEOS)
bool contains(const Key &key) const
Use exact geometry intersection (slower) instead of bounding boxes.
void setFeature(const QgsFeature &feature)
Convenience function for setting a feature for the context.
virtual Q_DECL_DEPRECATED QgsSymbolV2 * originalSymbolForFeature(QgsFeature &feature)
Return symbol for feature.
QgsMapLayer * mapLayer(const QString &theLayerId) const
Retrieve a pointer to a registered layer by layer ID.
QgsFeatureIterator getFeatures(const QgsFeatureRequest &request=QgsFeatureRequest())
Query the provider for features specified in request.
const QgsCoordinateReferenceSystem & crs() const
Returns layer's spatial reference system.
bool hasCrsTransformEnabled() const
returns true if projections are enabled for this layer set
bool isInScaleRange(double scale) const
Tests whether the layer should be visible at the specified scale.
A geometry is the spatial representation of a feature.
const QgsGeometry * constGeometry() const
Gets a const pointer to the geometry object associated with this feature.
QgsMapHitTest(const QgsMapSettings &settings, const QgsGeometry &polygon=QgsGeometry(), const LayerFilterExpression &layerFilterExpression=LayerFilterExpression())
const_iterator insert(const T &value)
The feature class encapsulates a single feature including its id, geometry and a list of field/values...
void setExtent(const QgsRectangle &extent)
QgsRectangle visibleExtent() const
Return the actual extent derived from requested extent that takes takes output image size into accoun...
virtual void startRender(QgsRenderContext &context, const QgsFields &fields)=0
Needs to be called when a new render cycle is started.
QgsFields fields() const
Returns the list of fields of this layer.
The QgsMapSettings class contains configuration for rendering of the map.
virtual void stopRender(QgsRenderContext &context)=0
Needs to be called when a render cycle has finished to clean up.
void setCoordinateTransform(const QgsCoordinateTransform *t)
Sets coordinate transformation.
QgsMapLayerStyleManager * styleManager() const
Get access to the layer's style manager.
virtual Q_DECL_DEPRECATED QgsSymbolV2List originalSymbolsForFeature(QgsFeature &feat)
Equivalent of originalSymbolsForFeature() call extended to support renderers that may use more symbol...
QgsFeatureRendererV2 * rendererV2()
Return renderer V2.
QString id() const
Get this layer's unique ID, this ID is used to access this layer from map layer registry.
LayerFilterExpression mLayerFilterExpression
List of expression filter for each layer.
const QgsRectangle & extent() const
double scale() const
Return the calculated scale of the map.
QSet< QString > SymbolV2Set
QImage::Format outputImageFormat() const
format of internal QImage, default QImage::Format_ARGB32_Premultiplied
This class wraps a request for features to a vector layer (or directly its vector data provider)...
bool isEmpty() const
Returns true if the geometry is empty (ie, contains no underlying geometry accessible via geometry)...
void setPainter(QPainter *p)
QgsFeatureRequest & setFlags(const QgsFeatureRequest::Flags &flags)
Set flags that affect how features will be fetched.
const QgsCoordinateTransform * layerTransform(QgsMapLayer *layer) const
Return coordinate transform from layer's CRS to destination CRS.
QGis::GeometryType type() const
Returns type of the geometry as a QGis::GeometryType.
bool symbolVisible(QgsSymbolV2 *symbol, QgsVectorLayer *layer) const
Tests whether a symbol is visible for a specified layer.
QgsExpressionContext & expressionContext()
Gets the expression context.
double outputDpi() const
Return DPI used for conversion between real world units (e.g.
void run()
Runs the map hit test.
Contains information about the context of a rendering operation.
may use more than one symbol to render a feature: symbolsForFeature() will return them ...
QMap< QString, QString > layerStyleOverrides() const
Get map of map layer style overrides (key: layer ID, value: style name) where a different style shoul...
static QgsMapLayerRegistry * instance()
Returns the instance pointer, creating the object on the first call.
QgsGeometry mPolygon
Polygon used for filtering items. May be empty.
static QgsRenderContext fromMapSettings(const QgsMapSettings &mapSettings)
create initialized QgsRenderContext instance from given QgsMapSettings
static QString symbolProperties(QgsSymbolV2 *symbol)
Returns a string representing the symbol.
QgsRectangle boundingBox() const
Returns the bounding box of this feature.
bool mOnlyExpressions
Whether to use only expressions during the filtering.
int transform(const QgsCoordinateTransform &ct)
Transform this geometry as described by CoordinateTransform ct.
bool legendKeyVisible(const QString &ruleKey, QgsVectorLayer *layer) const
Tests whether a given legend key is visible for a specified layer.
bool setOverrideStyle(const QString &styleDef)
Temporarily apply a different style to the layer.
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)
QStringList layers() const
Get list of layer IDs for map rendering The layers are stored in the reverse order of how they are re...
Represents a vector layer which manages a vector based data sets.
void runHitTestLayer(QgsVectorLayer *vl, SymbolV2Set &usedSymbols, SymbolV2Set &usedSymbolsRuleKey, QgsRenderContext &context)
Runs test for visible symbols within a layer.
QSize outputSize() const
Return the size of the resulting map image.
const QgsCoordinateReferenceSystem & destinationCrs() const
returns CRS of destination coordinate reference system
QgsRectangle outputExtentToLayerExtent(QgsMapLayer *theLayer, QgsRectangle extent) const
transform bounding box from output CRS to layer's CRS
QString authid() const
Returns the authority identifier for the CRS, which includes both the authority (eg EPSG) and the CRS...
QgsFeatureRequest & setFilterRect(const QgsRectangle &rect)
Set rectangle from which features will be taken.
QgsMapSettings mSettings
The initial map settings.
const T value(const Key &key) const