16 #ifndef QGSMAPRENDER_H
17 #define QGSMAPRENDER_H
21 #include <QStringList>
49 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 ):
50 featureId( id ), rotation( r ), cornerPoints( corners ), labelRect( rect ), width( w ), height( h ), layerID( layer ), labelText( labeltext ), labelFont( labelfont ), upsideDown( upside_down ), isDiagram( diagram ), isPinned( pinned ) {}
51 QgsLabelPosition(): featureId( -1 ), rotation( 0 ), labelRect(
QgsRectangle() ), width( 0 ), height( 0 ), layerID(
"" ), labelText(
"" ), labelFont(
QFont() ), upsideDown( false ), isDiagram( false ), isPinned( false ) {}
81 virtual void clearActiveLayers() = 0;
83 virtual void clearActiveLayer(
const QString& layerID ) = 0;
92 { Q_UNUSED( layer ); Q_UNUSED( attrNames ); Q_UNUSED( ctx );
return 0; }
96 { Q_UNUSED( layer ); Q_UNUSED( s );
return 0; }
101 { Q_UNUSED( layerID ); Q_UNUSED( feat ); Q_UNUSED( context ); }
105 virtual void exit() = 0;
185 void render(
QPainter* painter,
double* forceWidthScale = 0 );
196 void setRotation(
double degrees );
200 double rotation()
const;
205 double scale()
const {
return mScale; }
211 int width()
const {
return (
int ) mSize.width(); }
212 int height()
const {
return (
int ) mSize.height(); }
223 void setOutputSize(
QSize size,
int dpi );
224 void setOutputSize(
QSizeF size,
double dpi );
273 void setProjectionsEnabled(
bool enabled );
276 bool hasCrsTransformEnabled()
const;
279 void setDestinationCrs(
const QgsCoordinateReferenceSystem& crs,
bool refreshCoordinateTransformInfo =
true,
bool transformExtent =
true );
298 void updateFullExtent();
321 void addLayerCoordinateTransform(
const QString& layerId,
const QString& srcAuthId,
const QString& destAuthId,
int srcDatumTransform = -1,
int destDatumTransform = -1 );
322 void clearLayerCoordinateTransforms();
341 void drawingProgress(
int current,
int total );
350 void hasCrsTransformEnabled(
bool flag );
355 void hasCrsTransformEnabledChanged(
bool flag );
357 void destinationSrsChanged();
362 void mapUnitsChanged();
369 void extentsChanged();
373 void rotationChanged(
double );
382 Q_DECL_DEPRECATED
void onDrawingProgress(
int current,
int total );
387 void adjustExtentToSize();
const QgsMapToPixel * coordinateTransform()
virtual ~QgsLabelingEngineInterface()
A rectangle specified with double values.
Base class for all map layer types.
QgsRenderContext * rendererContext()
Accessor for render context.
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)
OutputUnits outputUnits() const
OutputUnits mOutputUnits
Output units.
UnitType
Map units that qgis supports.
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
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
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.
QgsCoordinateReferenceSystem * mDestCRS
destination spatial reference system of the projection
QgsDistanceArea * mDistArea
tool for measuring
double mapUnitsPerPixel() const
double scale() const
Scale denominator.
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
A class to represent a point.
BlendMode
Blending modes enum defining the available composition modes that can be used when rendering a layer...
Calculates scale for a given combination of canvas size, map extent, and monitor dpi.
General purpose distance and area calculator.
virtual void registerDiagramFeature(const QString &layerID, QgsFeature &feat, QgsRenderContext &context)
called for every diagram feature
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...
OutputUnits
Output units for pen width and point marker width/height.
QgsLabelingEngineInterface * labelingEngine()
Labeling engine (NULL 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)
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 (NULL by default)
void setOutputUnits(OutputUnits u)
QgsRectangle mFullExtent
full extent of the layer set