16 #ifndef QGSMAPRENDER_H 17 #define QGSMAPRENDER_H 21 #include <QStringList> 52 QgsLabelPosition(
int id,
double r,
const QVector< QgsPoint >& corners,
const QgsRectangle& rect,
double w,
double h,
const QString& layer,
const QString& labeltext,
const QFont& labelfont,
bool upside_down,
bool diagram =
false,
bool pinned =
false,
const QString& providerId =
QString() )
55 , cornerPoints( corners )
60 , labelText( labeltext )
61 , labelFont( labelfont )
62 , upsideDown( upside_down )
63 , isDiagram( diagram )
65 , providerID( providerId )
75 , labelFont(
QFont() )
113 virtual void clearActiveLayers() = 0;
115 virtual void clearActiveLayer(
const QString& layerID ) = 0;
124 { Q_UNUSED( layer ); Q_UNUSED( attrNames ); Q_UNUSED( ctx );
return 0; }
128 { Q_UNUSED( layer ); Q_UNUSED( s );
return 0; }
133 { Q_UNUSED( layerID ); Q_UNUSED( feat ); Q_UNUSED( context ); }
137 virtual void exit() = 0;
217 void render(
QPainter* painter,
double* forceWidthScale =
nullptr );
228 void setRotation(
double degrees );
232 double rotation()
const;
237 double scale()
const {
return mScale; }
243 int width()
const {
return static_cast< int >( mSize.width() ); }
244 int height()
const {
return static_cast< int >( mSize.height() ); }
260 void setOutputSize(
QSize size,
double dpi );
267 void setOutputSize(
QSizeF size,
double dpi );
276 QSize outputSize()
const;
282 QSizeF outputSizeF()
const;
325 void setProjectionsEnabled(
bool enabled );
328 bool hasCrsTransformEnabled()
const;
331 void setDestinationCrs(
const QgsCoordinateReferenceSystem& crs,
bool refreshCoordinateTransformInfo =
true,
bool transformExtent =
true );
350 void updateFullExtent();
369 static QPainter::CompositionMode getCompositionMode(
BlendMode blendMode );
373 void addLayerCoordinateTransform(
const QString& layerId,
const QString& srcAuthId,
const QString& destAuthId,
int srcDatumTransform = -1,
int destDatumTransform = -1 );
374 void clearLayerCoordinateTransforms();
396 mRenderContext.setFeatureFilterProvider( ffp );
405 void drawingProgress(
int current,
int total );
414 void hasCrsTransformEnabled(
bool flag );
419 void hasCrsTransformEnabledChanged(
bool flag );
421 void destinationSrsChanged();
426 void mapUnitsChanged();
433 void extentsChanged();
437 void rotationChanged(
double );
447 Q_DECL_DEPRECATED
void onDrawingProgress(
int current,
int total );
452 void adjustExtentToSize();
522 void readDefaultDatumTransformations();
const QgsMapToPixel * coordinateTransform()
virtual ~QgsLabelingEngineInterface()
A rectangle specified with double values.
Base class for all map layer types.
QgsRenderContext * rendererContext()
Accessor for render context.
OutputUnits outputUnits() const
OutputUnits mOutputUnits
Output units.
bool mProjectionsEnabled
detemines whether on the fly projection support is enabled
QgsRectangle mLastExtent
Last extent to we drew so we know if we can used layer render caching or not.
QgsScaleCalculator * mScaleCalculator
scale calculator
virtual int prepareDiagramLayer(QgsVectorLayer *layer, QStringList &attrNames, QgsRenderContext &ctx)
adds a diagram layer to the labeling engine
void setScale(double scale)
Sets scale for scale based visibility.
static bool mDrawing
indicates drawing in progress
void enableOverviewMode(bool isOverview=true)
sets whether map image will be for overview
double scale() const
Scale denominator.
QHash< QPair< QString, QString >, QPair< int, int > > mDefaultDatumTransformations
The feature class encapsulates a single feature including its id, geometry and a list of field/values...
A non GUI class for rendering a map layer set onto a QPainter.
QVector< QgsPoint > cornerPoints
BlendMode
Blending modes enum defining the available composition modes that can be used when rendering a layer...
QgsRectangle mExtent
current extent to be drawn
The QgsMapSettings class contains configuration for rendering of the map.
double mRotation
Map rotation.
QMutex mRenderMutex
Locks rendering loop for concurrent draws.
Perform transforms between map coordinates and device coordinates.
void setFeatureFilterProvider(const QgsFeatureFilterProvider *ffp)
Set a feature filter provider to filter the features shown in the map.
QgsCoordinateReferenceSystem * mDestCRS
destination spatial reference system of the projection
QgsDistanceArea * mDistArea
tool for measuring
bool mTileRenderMode
Tell the render system we are rendering a map tile.
void setTileRenderMode(bool enabled)
Set tile mode (render code tries to prevent tile border effects)
virtual Q_DECL_DEPRECATED int addDiagramLayer(QgsVectorLayer *layer, const QgsDiagramLayerSettings *s)
adds a diagram layer to the labeling engine
bool mOverview
indicates whether it's map image for overview
Abstract interface for use by classes that filter the features of a layer.
A class to represent a point.
OutputUnits
Output units for pen width and point marker width/height.
Calculates scale for a given combination of canvas size, map extent, and monitor dpi.
Stores the settings for rendering of all diagrams for a layer.
General purpose distance and area calculator.
virtual void registerDiagramFeature(const QString &layerID, QgsFeature &feat, QgsRenderContext &context)
called for every diagram feature
double mapUnitsPerPixel() const
Contains information about the context of a rendering operation.
QgsMapSettings mMapSettings
map settings - used only for export in mapSettings() for use in classes that deal with QgsMapSettings...
QgsLabelPosition(int id, double r, const QVector< QgsPoint > &corners, const QgsRectangle &rect, double w, double h, const QString &layer, const QString &labeltext, const QFont &labelfont, bool upside_down, bool diagram=false, bool pinned=false, const QString &providerId=QString())
QgsLabelingEngineInterface * labelingEngine()
Labeling engine (nullptr if there's no custom engine)
double mScale
Map scale denominator at its current zoom level.
QHash< QString, QgsLayerCoordinateTransform > mLayerCoordinateTransformInfo
Class for storing a coordinate reference system (CRS)
UnitType
Map units that qgis supports.
QStringList mLayerSet
stores array of layers to be rendered (identified by string)
double mMapUnitsPerPixel
map units per pixel
Labeling engine interface.
QgsRenderContext mRenderContext
Encapsulates context of rendering.
Represents a vector layer which manages a vector based data sets.
QgsLabelingEngineInterface * mLabelingEngine
Labeling engine (nullptr by default)
void setOutputUnits(OutputUnits u)
QgsRectangle mFullExtent
full extent of the layer set