28 #define POINTS_TO_MM 2.83464567    29 #define INCH_TO_MM 25.4    32   : mFlags( DrawEditingInfo | UseAdvancedEffects | DrawSelection | UseRenderingOptimization )
    42   , mPainter( rh.mPainter )
    43   , mCoordTransform( rh.mCoordTransform )
    44   , mDistanceArea( rh.mDistanceArea )
    45   , mExtent( rh.mExtent )
    46   , mMapToPixel( rh.mMapToPixel )
    47   , mRenderingStopped( rh.mRenderingStopped )
    48   , mScaleFactor( rh.mScaleFactor )
    49   , mRendererScale( rh.mRendererScale )
    50   , mLabelingEngine( rh.mLabelingEngine )
    51   , mSelectionColor( rh.mSelectionColor )
    52   , mVectorSimplifyMethod( rh.mVectorSimplifyMethod )
    53   , mExpressionContext( rh.mExpressionContext )
    54   , mGeometry( rh.mGeometry )
    55   , mFeatureFilterProvider( rh.mFeatureFilterProvider ? rh.mFeatureFilterProvider->clone() : nullptr )
    56   , mSegmentationTolerance( rh.mSegmentationTolerance )
    57   , mSegmentationToleranceType( rh.mSegmentationToleranceType )
    58   , mTransformContext( rh.mTransformContext )
    59   , mPathResolver( rh.mPathResolver )
    61   , mHasTransformContext( rh.mHasTransformContext )
    69   mPainter = rh.mPainter;
    70   mCoordTransform = rh.mCoordTransform;
    72   mMapToPixel = rh.mMapToPixel;
    73   mRenderingStopped = rh.mRenderingStopped;
    74   mScaleFactor = rh.mScaleFactor;
    75   mRendererScale = rh.mRendererScale;
    76   mLabelingEngine = rh.mLabelingEngine;
    77   mSelectionColor = rh.mSelectionColor;
    78   mVectorSimplifyMethod = rh.mVectorSimplifyMethod;
    79   mExpressionContext = rh.mExpressionContext;
    80   mGeometry = rh.mGeometry;
    81   mFeatureFilterProvider.reset( rh.mFeatureFilterProvider ? rh.mFeatureFilterProvider->clone() : nullptr );
    82   mSegmentationTolerance = rh.mSegmentationTolerance;
    83   mSegmentationToleranceType = rh.mSegmentationToleranceType;
    84   mDistanceArea = rh.mDistanceArea;
    85   mTransformContext = rh.mTransformContext;
    86   mPathResolver = rh.mPathResolver;
    88   mHasTransformContext = rh.mHasTransformContext;
    98   if ( painter && painter->device() )
   100     context.
setScaleFactor( painter->device()->logicalDpiX() / 25.4 );
   112   if ( !mHasTransformContext )
   113     qWarning( 
"No QgsCoordinateTransformContext context set for transform" );
   115   return mTransformContext;
   120   mTransformContext = context;
   122   mHasTransformContext = 
true;
   146   return mFlags.testFlag( flag );
   241     mFeatureFilterProvider.reset( ffp->
clone() );
   245     mFeatureFilterProvider.reset( 
nullptr );
   251   return mFeatureFilterProvider.get();
   256   double conversionFactor = 1.0;
   260       conversionFactor = mScaleFactor;
   283         conversionFactor = 1.0 / mup;
   287         conversionFactor = 1.0;
   292       conversionFactor = 1.0;
   298       conversionFactor = 1.0;
   302   double convertedSize = size * conversionFactor;
   308       convertedSize = std::max( convertedSize, scale.
minSizeMM * mScaleFactor );
   310       convertedSize = std::min( convertedSize, scale.
maxSizeMM * mScaleFactor );
   313   return convertedSize;
   331       double minSizeMU = std::numeric_limits<double>::lowest();
   334         minSizeMU = scale.
minSizeMM * mScaleFactor * mup;
   338         minSizeMU = std::max( minSizeMU, size * ( mRendererScale / scale.
minScale ) );
   340       size = std::max( size, minSizeMU );
   342       double maxSizeMU = std::numeric_limits<double>::max();
   345         maxSizeMU = scale.
maxSizeMM * mScaleFactor * mup;
   349         maxSizeMU = std::min( maxSizeMU, size * ( mRendererScale / scale.
maxScale ) );
   351       size = std::min( size, maxSizeMU );
   357       return size * mScaleFactor * mup;
   365       return size * mScaleFactor * mup * 
INCH_TO_MM;
   384   switch ( outputUnit )
   392       return sizeInMapUnits;
   396       return sizeInMapUnits / ( mScaleFactor * mup );
   400       return sizeInMapUnits / ( mScaleFactor * mup / 
POINTS_TO_MM );
   404       return sizeInMapUnits / ( mScaleFactor * mup * 
INCH_TO_MM );
   408       return sizeInMapUnits / mup;
   433         pointCenter = mCoordTransform.
transform( pointCenter );
 void setForceVectorOutput(bool force)
 
Meters value as Map units. 
 
double convertToMapUnits(double size, QgsUnitTypes::RenderUnit unit, const QgsMapUnitScale &scale=QgsMapUnitScale()) const
Converts a size from the specified units to map units. 
 
Enable layer opacity and blending effects. 
 
void setRenderingStopped(bool stopped)
 
double minSizeMM
The minimum size in millimeters, or 0.0 if unset. 
 
Enable vector simplification and other rendering optimizations. 
 
virtual QgsFeatureFilterProvider * clone() const =0
Create a clone of the feature filter provider. 
 
QgsCoordinateTransformContext transformContext() const
Returns the coordinate transform context, which stores various information regarding which datum tran...
 
const QgsExpressionContext & expressionContext() const
Gets the expression context. 
 
QgsCoordinateTransformContext transformContext() const
Returns the context's coordinate transform context, which stores various information regarding which ...
 
void setFlags(QgsRenderContext::Flags flags)
Set combination of flags that will be used for rendering. 
 
Use antialiasing while drawing. 
 
double convertFromMapUnits(double sizeInMapUnits, QgsUnitTypes::RenderUnit outputUnit) const
Converts a size from map units to the specified units. 
 
void setCoordinateTransform(const QgsCoordinateTransform &t)
Sets coordinate transformation. 
 
A class to represent a 2D point. 
 
bool qgsDoubleNear(double a, double b, double epsilon=4 *std::numeric_limits< double >::epsilon())
Compare two doubles (but allow some difference) 
 
void setSimplifyHints(SimplifyHints simplifyHints)
Sets the simplification hints of the vector layer managed. 
 
void setRendererScale(double scale)
Sets the renderer map scale. 
 
Whether to make extra effort to update map image with partially rendered layers (better for interacti...
 
void setPathResolver(const QgsPathResolver &resolver)
Sets the path resolver for conversion between relative and absolute paths during rendering operations...
 
void setTransformContext(const QgsCoordinateTransformContext &context)
Sets the context's coordinate transform context, which stores various information regarding which dat...
 
double computeMapUnitsPerPixel(const QgsRenderContext &c) const
Computes a map units per pixel scaling factor, respecting the minimum and maximum scales set for the ...
 
Flags flags() const
Returns combination of flags used for rendering. 
 
QgsUnitTypes::DistanceUnit mapUnits
 
bool setEllipsoid(const QString &ellipsoid)
Sets the ellipsoid by its acronym. 
 
Percentage of another measurement (e.g., canvas size, feature size) 
 
Enable layer opacity and blending effects. 
 
Whether vector selections should be shown in the rendered map. 
 
void setExtent(const QgsRectangle &extent)
 
QgsRectangle visibleExtent() const
Returns the actual extent derived from requested extent that takes takes output image size into accou...
 
double maxScale
The maximum scale, or 0.0 if unset. 
 
const QgsFeatureFilterProvider * featureFilterProvider() const
Gets the filter feature provider used for additional filtering of rendered features. 
 
bool minSizeMMEnabled
Whether the minimum size in mm should be respected. 
 
QgsCoordinateReferenceSystem destinationCrs() const
returns CRS of destination coordinate reference system 
 
Vector graphics should not be cached and drawn as raster images. 
 
The QgsMapSettings class contains configuration for rendering of the map. 
 
double convertMetersToMapUnits(double meters) const
Convert meter distances to active MapUnit values for QgsUnitTypes::RenderMetersInMapUnits. 
 
void setSelectionColor(const QColor &color)
 
No simplification can be applied. 
 
QString ellipsoidAcronym() const
Returns the ellipsoid acronym for the ellipsoid used by the CRS. 
 
void setUseAdvancedEffects(bool enabled)
Used to enable or disable advanced effects such as blend modes. 
 
void setScaleFactor(double factor)
Sets the scaling factor for the render to convert painter units to physical sizes. 
 
QgsRenderContext & operator=(const QgsRenderContext &rh)
 
Whether vector selections should be shown in the rendered map. 
 
double scale() const
Returns the calculated map scale. 
 
void setDrawEditingInformation(bool b)
 
Enable anti-aliasing for map rendering. 
 
points (e.g., for font sizes) 
 
static QgsRenderContext fromQPainter(QPainter *painter)
Creates a default render context given a pixel based QPainter destination. 
 
bool drawEditingInformation() const
 
Draw bounds of symbols (for debugging/testing) 
 
Degrees, for planar geographic CRS distance measurements. 
 
void setPainter(QPainter *p)
Sets the destination QPainter for the render operation. 
 
Abstract interface for use by classes that filter the features of a layer. 
 
void setSegmentationToleranceType(QgsAbstractGeometry::SegmentationToleranceType type)
Sets segmentation tolerance type (maximum angle or maximum difference between curve and approximation...
 
Contains information about the context in which a coordinate transform is executed. 
 
double mapUnitsPerPixel() const
Returns current map units per pixel. 
 
const QgsMapToPixel & mapToPixel() const
 
Draw bounds of symbols (for debugging/testing) 
 
Vector graphics should not be cached and drawn as raster images. 
 
Enable drawing of vertex markers for layers in editing mode. 
 
QgsAbstractGeometry::SegmentationToleranceType segmentationToleranceType() const
Gets segmentation tolerance type (maximum angle or maximum difference between curve and approximation...
 
const QgsPathResolver & pathResolver() const
Returns the path resolver for conversion between relative and absolute paths during rendering operati...
 
bool forceVectorOutput() const
 
QgsCoordinateReferenceSystem sourceCrs() const
Returns the source spatial reference system. 
 
void setSegmentationTolerance(double tolerance)
Sets the segmentation tolerance applied when rendering curved geometries. 
 
bool useRenderingOptimization() const
Returns true if the rendering optimization (geometry simplification) can be executed. 
 
Draw map such that there are no problems between adjacent tiles. 
 
Render is a 'canvas preview' render, and shortcuts should be taken to ensure fast rendering...
 
double outputDpi() const
Returns DPI used for conversion between real world units (e.g. 
 
Render is a 'canvas preview' render, and shortcuts should be taken to ensure fast rendering...
 
Contains information about the context of a rendering operation. 
 
double convertToPainterUnits(double size, QgsUnitTypes::RenderUnit unit, const QgsMapUnitScale &scale=QgsMapUnitScale()) const
Converts a size from the specified units to painter units (pixels). 
 
QString ellipsoid() const
Returns ellipsoid's acronym. 
 
double segmentationTolerance() const
Gets the segmentation tolerance applied when rendering curved geometries. 
 
QPainter * painter()
Returns the destination QPainter for the render operation. 
 
double maxSizeMM
The maximum size in millimeters, or 0.0 if unset. 
 
void setShowSelection(bool showSelection)
Sets whether vector selections should be shown in the rendered map. 
 
Struct for storing maximum and minimum scales for measurements in map units. 
 
Whether to make extra effort to update map image with partially rendered layers (better for interacti...
 
static QgsRenderContext fromMapSettings(const QgsMapSettings &mapSettings)
create initialized QgsRenderContext instance from given QgsMapSettings 
 
double measureLineProjected(const QgsPointXY &p1, double distance=1, double azimuth=M_PI_2, QgsPointXY *projectedPoint=nullptr) const
Calculates the distance from one point with distance in meters and azimuth (direction) When the sourc...
 
bool useAdvancedEffects() const
Returns true if advanced effects such as blend modes such be used. 
 
void setMapToPixel(const QgsMapToPixel &mtp)
 
void setUseRenderingOptimization(bool enabled)
 
bool showSelection() const
Returns true if vector selections should be shown in the rendered map. 
 
void setFlag(Flag flag, bool on=true)
Enable or disable a particular flag (other flags are not affected) 
 
void setFeatureFilterProvider(const QgsFeatureFilterProvider *ffp)
Set a filter feature provider used for additional filtering of rendered features. ...
 
Enable vector simplification and other rendering optimizations. 
 
void setSourceCrs(const QgsCoordinateReferenceSystem &crs, const QgsCoordinateTransformContext &context)
Sets source spatial reference system crs. 
 
bool testFlag(Flag flag) const
Check whether a particular flag is enabled. 
 
QColor selectionColor() const
Gets color that is used for drawing of selected vector features. 
 
QgsPointXY center() const
Returns the center point of the rectangle. 
 
bool testFlag(Flag flag) const
Check whether a particular flag is enabled. 
 
Draw map such that there are no problems between adjacent tiles. 
 
Flag
Enumeration of flags that affect rendering operations. 
 
static Q_INVOKABLE double fromUnitToUnitFactor(QgsUnitTypes::DistanceUnit fromUnit, QgsUnitTypes::DistanceUnit toUnit)
Returns the conversion factor between the specified distance units. 
 
Enable drawing of vertex markers for layers in editing mode. 
 
double minScale
The minimum scale, or 0.0 if unset. 
 
bool maxSizeMMEnabled
Whether the maximum size in mm should be respected. 
 
RenderUnit
Rendering size units. 
 
void setExpressionContext(const QgsExpressionContext &context)
Sets the expression context.