16 #ifndef QGSMAPRENDER_H
17 #define QGSMAPRENDER_H
21 #include <QStringList>
48 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 ):
49 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 ) {}
50 QgsLabelPosition(): featureId( -1 ), rotation( 0 ), labelRect(
QgsRectangle() ), width( 0 ), height( 0 ), layerID(
"" ), labelText(
"" ), labelFont( QFont() ), upsideDown( false ), isDiagram( false ), isPinned( false ) {}
80 virtual void clearActiveLayers() = 0;
92 { Q_UNUSED( layer ); Q_UNUSED( s );
return 0; }
97 { Q_UNUSED( layer ); Q_UNUSED( feat ); Q_UNUSED( context ); }
101 virtual void exit() = 0;
104 virtual QList<QgsLabelPosition> labelsAtPosition(
const QgsPoint& p ) = 0;
107 virtual QList<QgsLabelPosition> labelsWithinRect(
const QgsRectangle& r ) = 0;
167 void render( QPainter* painter,
double* forceWidthScale = 0 );
178 double scale()
const {
return mScale; }
184 int width()
const {
return mSize.width(); };
185 int height()
const {
return mSize.height(); };
196 void setOutputSize( QSize
size,
int dpi );
197 void setOutputSize( QSizeF
size,
double dpi );
203 QSizeF outputSizeF();
246 void setProjectionsEnabled(
bool enabled );
249 bool hasCrsTransformEnabled()
const;
265 QStringList& layerSet();
268 void setLayerSet(
const QStringList& layers );
271 void updateFullExtent();
274 bool readXML( QDomNode & theNode );
277 bool writeXML( QDomNode & theNode, QDomDocument & theDoc );
298 void addLayerCoordinateTransform(
const QString& layerId,
const QString& srcAuthId,
const QString& destAuthId,
int srcDatumTransform = -1,
int destDatumTransform = -1 );
299 void clearLayerCoordinateTransforms();
305 void drawingProgress(
int current,
int total );
314 void hasCrsTransformEnabled(
bool flag );
319 void hasCrsTransformEnabledChanged(
bool flag );
321 void destinationSrsChanged();
325 void mapUnitsChanged();
331 void datumTransformInfoRequested(
const QgsMapLayer* ml,
const QString& srcAuthId,
const QString& destAuthId )
const;
336 void onDrawingProgress(
int current,
int total );
341 void adjustExtentToSize();
virtual int addDiagramLayer(QgsVectorLayer *layer, QgsDiagramLayerSettings *s)
adds a diagram layer to the labeling engine
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.
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
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
BlendMode
Blending modes enum defining the available composition modes that can be used when rendering a layer...
QgsRectangle mExtent
current extent to be drawn
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 void registerDiagramFeature(QgsVectorLayer *layer, QgsFeature &feat, const QgsRenderContext &context=QgsRenderContext())
called for every diagram feature
bool mOverview
indicates whether it's map image for overview
A class to represent a point geometry.
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.
General purpose distance and area calculator.
Contains information about the context of a rendering operation.
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)
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 (NULL by default)
void setOutputUnits(OutputUnits u)
QgsRectangle mFullExtent
full extent of the layer set