/usr/include/qgis/qgsrendercontext.h is in libqgis-dev 2.18.17+dfsg-1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 | /***************************************************************************
qgsrendercontext.h
------------------
begin : March 16, 2008
copyright : (C) 2008 by Marco Hugentobler
email : marco dot hugentobler at karto dot baug dot ethz dot ch
***************************************************************************/
/***************************************************************************
* *
* This program is free software; you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by *
* the Free Software Foundation; either version 2 of the License, or *
* (at your option) any later version. *
* *
***************************************************************************/
#ifndef QGSRENDERCONTEXT_H
#define QGSRENDERCONTEXT_H
#include <QColor>
#include "qgsabstractgeometryv2.h"
#include "qgscoordinatetransform.h"
#include "qgsmaptopixel.h"
#include "qgsrectangle.h"
#include "qgsvectorsimplifymethod.h"
#include "qgsexpressioncontext.h"
class QPainter;
class QgsAbstractGeometryV2;
class QgsLabelingEngineInterface;
class QgsLabelingEngineV2;
class QgsMapSettings;
class QgsFeatureFilterProvider;
/** \ingroup core
* Contains information about the context of a rendering operation.
* The context of a rendering operation defines properties such as
* the conversion ratio between screen and map units, the extents /
* bounding box to be rendered etc.
**/
class CORE_EXPORT QgsRenderContext
{
public:
QgsRenderContext();
QgsRenderContext( const QgsRenderContext& rh );
QgsRenderContext& operator=( const QgsRenderContext& rh );
~QgsRenderContext();
/** Enumeration of flags that affect rendering operations.
* @note added in QGIS 2.14
*/
enum Flag
{
DrawEditingInfo = 0x01, //!< Enable drawing of vertex markers for layers in editing mode
ForceVectorOutput = 0x02, //!< Vector graphics should not be cached and drawn as raster images
UseAdvancedEffects = 0x04, //!< Enable layer transparency and blending effects
UseRenderingOptimization = 0x08, //!< Enable vector simplification and other rendering optimizations
DrawSelection = 0x10, //!< Whether vector selections should be shown in the rendered map
DrawSymbolBounds = 0x20, //!< Draw bounds of symbols (for debugging/testing)
RenderMapTile = 0x40, //!< Draw map such that there are no problems between adjacent tiles
Antialiasing = 0x80, //!< Use antialiasing while drawing
RenderPartialOutput = 0x100, //!< Whether to make extra effort to update map image with partially rendered layers (better for interactive map canvas). Added in QGIS 2.18
};
Q_DECLARE_FLAGS( Flags, Flag )
/** Set combination of flags that will be used for rendering.
* @note added in QGIS 2.14
*/
void setFlags( const QgsRenderContext::Flags& flags );
/** Enable or disable a particular flag (other flags are not affected)
* @note added in QGIS 2.14
*/
void setFlag( Flag flag, bool on = true );
/** Return combination of flags used for rendering.
* @note added in QGIS 2.14
*/
Flags flags() const;
/** Check whether a particular flag is enabled.
* @note added in QGIS 2.14
*/
bool testFlag( Flag flag ) const;
//! create initialized QgsRenderContext instance from given QgsMapSettings
//! @note added in 2.4
static QgsRenderContext fromMapSettings( const QgsMapSettings& mapSettings );
//getters
QPainter* painter() {return mPainter;}
const QPainter* constPainter() const { return mPainter; }
const QgsCoordinateTransform* coordinateTransform() const {return mCoordTransform;}
const QgsRectangle& extent() const {return mExtent;}
const QgsMapToPixel& mapToPixel() const {return mMapToPixel;}
double scaleFactor() const {return mScaleFactor;}
double rasterScaleFactor() const {return mRasterScaleFactor;}
bool renderingStopped() const {return mRenderingStopped;}
bool forceVectorOutput() const;
/** Returns true if advanced effects such as blend modes such be used
*/
bool useAdvancedEffects() const;
/** Used to enable or disable advanced effects such as blend modes
*/
void setUseAdvancedEffects( bool enabled );
bool drawEditingInformation() const;
double rendererScale() const {return mRendererScale;}
QgsLabelingEngineInterface* labelingEngine() const { return mLabelingEngine; }
//! Get access to new labeling engine (may be nullptr)
//! @note not available in Python bindings
QgsLabelingEngineV2* labelingEngineV2() const { return mLabelingEngine2; }
QColor selectionColor() const { return mSelectionColor; }
/** Returns true if vector selections should be shown in the rendered map
* @returns true if selections should be shown
* @see setShowSelection
* @see selectionColor
* @note Added in QGIS v2.4
*/
bool showSelection() const;
//setters
/** Sets coordinate transformation. QgsRenderContext does not take ownership*/
void setCoordinateTransform( const QgsCoordinateTransform* t );
void setMapToPixel( const QgsMapToPixel& mtp ) {mMapToPixel = mtp;}
void setExtent( const QgsRectangle& extent ) {mExtent = extent;}
void setDrawEditingInformation( bool b );
void setRenderingStopped( bool stopped ) {mRenderingStopped = stopped;}
void setScaleFactor( double factor ) {mScaleFactor = factor;}
void setRasterScaleFactor( double factor ) {mRasterScaleFactor = factor;}
void setRendererScale( double scale ) {mRendererScale = scale;}
void setPainter( QPainter* p ) {mPainter = p;}
void setForceVectorOutput( bool force );
void setLabelingEngine( QgsLabelingEngineInterface* iface ) { mLabelingEngine = iface; }
//! Assign new labeling engine
//! @note not available in Python bindings
void setLabelingEngineV2( QgsLabelingEngineV2* engine2 ) { mLabelingEngine2 = engine2; }
void setSelectionColor( const QColor& color ) { mSelectionColor = color; }
/** Sets whether vector selections should be shown in the rendered map
* @param showSelection set to true if selections should be shown
* @see showSelection
* @see setSelectionColor
* @note Added in QGIS v2.4
*/
void setShowSelection( const bool showSelection );
/** Returns true if the rendering optimization (geometry simplification) can be executed
*/
bool useRenderingOptimization() const;
void setUseRenderingOptimization( bool enabled );
//! Added in QGIS v2.4
const QgsVectorSimplifyMethod& vectorSimplifyMethod() const { return mVectorSimplifyMethod; }
void setVectorSimplifyMethod( const QgsVectorSimplifyMethod& simplifyMethod ) { mVectorSimplifyMethod = simplifyMethod; }
/** Sets the expression context. This context is used for all expression evaluation
* associated with this render context.
* @see expressionContext()
* @note added in QGIS 2.12
*/
void setExpressionContext( const QgsExpressionContext& context ) { mExpressionContext = context; }
/** Gets the expression context. This context should be used for all expression evaluation
* associated with this render context.
* @see setExpressionContext()
* @note added in QGIS 2.12
*/
QgsExpressionContext& expressionContext() { return mExpressionContext; }
/** Gets the expression context (const version). This context should be used for all expression evaluation
* associated with this render context.
* @see setExpressionContext()
* @note added in QGIS 2.12
* @note not available in Python bindings
*/
const QgsExpressionContext& expressionContext() const { return mExpressionContext; }
/** Returns pointer to the unsegmentized geometry*/
const QgsAbstractGeometryV2* geometry() const { return mGeometry; }
/** Sets pointer to original (unsegmentized) geometry*/
void setGeometry( const QgsAbstractGeometryV2* geometry ) { mGeometry = geometry; }
/** Set a filter feature provider used for additional filtering of rendered features.
* @param ffp the filter feature provider
* @note added in QGIS 2.14
* @see featureFilterProvider()
*/
void setFeatureFilterProvider( const QgsFeatureFilterProvider* ffp );
/** Get the filter feature provider used for additional filtering of rendered features.
* @return the filter feature provider
* @note added in QGIS 2.14
* @see setFeatureFilterProvider()
*/
const QgsFeatureFilterProvider* featureFilterProvider() const { return mFeatureFilterProvider; }
/** Sets the segmentation tolerance applied when rendering curved geometries
@param tolerance the segmentation tolerance*/
void setSegmentationTolerance( double tolerance ) { mSegmentationTolerance = tolerance; }
/** Gets the segmentation tolerance applied when rendering curved geometries*/
double segmentationTolerance() const { return mSegmentationTolerance; }
/** Sets segmentation tolerance type (maximum angle or maximum difference between curve and approximation)
@param type the segmentation tolerance typename*/
void setSegmentationToleranceType( QgsAbstractGeometryV2::SegmentationToleranceType type ) { mSegmentationToleranceType = type; }
/** Gets segmentation tolerance type (maximum angle or maximum difference between curve and approximation)*/
QgsAbstractGeometryV2::SegmentationToleranceType segmentationToleranceType() const { return mSegmentationToleranceType; }
private:
Flags mFlags;
/** Painter for rendering operations*/
QPainter* mPainter;
/** For transformation between coordinate systems. Can be 0 if on-the-fly reprojection is not used*/
const QgsCoordinateTransform* mCoordTransform;
QgsRectangle mExtent;
QgsMapToPixel mMapToPixel;
/** True if the rendering has been canceled*/
bool mRenderingStopped;
/** Factor to scale line widths and point marker sizes*/
double mScaleFactor;
/** Factor to scale rasters*/
double mRasterScaleFactor;
/** Map scale*/
double mRendererScale;
/** Labeling engine (can be nullptr)*/
QgsLabelingEngineInterface* mLabelingEngine;
/** Newer labeling engine implementation (can be nullptr) */
QgsLabelingEngineV2* mLabelingEngine2;
/** Color used for features that are marked as selected */
QColor mSelectionColor;
/** Simplification object which holds the information about how to simplify the features for fast rendering */
QgsVectorSimplifyMethod mVectorSimplifyMethod;
/** Expression context */
QgsExpressionContext mExpressionContext;
/** Pointer to the (unsegmentized) geometry*/
const QgsAbstractGeometryV2* mGeometry;
/** The feature filter provider */
const QgsFeatureFilterProvider* mFeatureFilterProvider;
double mSegmentationTolerance;
QgsAbstractGeometryV2::SegmentationToleranceType mSegmentationToleranceType;
};
Q_DECLARE_OPERATORS_FOR_FLAGS( QgsRenderContext::Flags )
#endif
|