QGIS API Documentation 3.28.14-Firenze (exported)
Loading...
Searching...
No Matches
qgsrasterlayerrenderer.cpp
Go to the documentation of this file.
1/***************************************************************************
2 qgsrasterlayerrenderer.cpp
3 --------------------------------------
4 Date : December 2013
5 Copyright : (C) 2013 by Martin Dobias
6 Email : wonder dot sk at gmail dot com
7 ***************************************************************************
8 * *
9 * This program is free software; you can redistribute it and/or modify *
10 * it under the terms of the GNU General Public License as published by *
11 * the Free Software Foundation; either version 2 of the License, or *
12 * (at your option) any later version. *
13 * *
14 ***************************************************************************/
15
17
18#include "qgsmessagelog.h"
20#include "qgsrasterdrawer.h"
21#include "qgsrasteriterator.h"
22#include "qgsrasterlayer.h"
23#include "qgsrasterprojector.h"
24#include "qgsrendercontext.h"
25#include "qgsrasterrenderer.h"
26#include "qgsexception.h"
28#include "qgsmapclippingutils.h"
29#include "qgsrasterpipe.h"
30
31#include <QElapsedTimer>
32#include <QPointer>
33#include <QThread>
34
36
37QgsRasterLayerRendererFeedback::QgsRasterLayerRendererFeedback( QgsRasterLayerRenderer *r )
38 : mR( r )
39 , mMinimalPreviewInterval( 250 )
40{
42}
43
44void QgsRasterLayerRendererFeedback::onNewData()
45{
46 if ( !renderPartialOutput() )
47 return; // we were not asked for partial renders and we may not have a temporary image for overwriting...
48
49 // update only once upon a time
50 // (preview itself takes some time)
51 if ( mLastPreview.isValid() && mLastPreview.msecsTo( QTime::currentTime() ) < mMinimalPreviewInterval )
52 return;
53
54 // TODO: update only the area that got new data
55
56 QgsDebugMsgLevel( QStringLiteral( "new raster preview! %1" ).arg( mLastPreview.msecsTo( QTime::currentTime() ) ), 3 );
57 QElapsedTimer t;
58 t.start();
60 feedback.setPreviewOnly( true );
61 feedback.setRenderPartialOutput( true );
62 QgsRasterIterator iterator( mR->mPipe->last() );
63 QgsRasterDrawer drawer( &iterator );
64 drawer.draw( *( mR->renderContext() ), mR->mRasterViewPort, &feedback );
65 mR->mReadyToCompose = true;
66 QgsDebugMsgLevel( QStringLiteral( "total raster preview time: %1 ms" ).arg( t.elapsed() ), 3 );
67 mLastPreview = QTime::currentTime();
68}
69
73 : QgsMapLayerRenderer( layer->id(), &rendererContext )
74 , mLayerOpacity( layer->opacity() )
75 , mProviderCapabilities( static_cast<QgsRasterDataProvider::Capability>( layer->dataProvider()->capabilities() ) )
76 , mFeedback( new QgsRasterLayerRendererFeedback( this ) )
77{
78 mReadyToCompose = false;
79 QgsMapToPixel mapToPixel = rendererContext.mapToPixel();
80 if ( rendererContext.mapToPixel().mapRotation() )
81 {
82 // unset rotation for the sake of local computations.
83 // Rotation will be handled by QPainter later
84 // TODO: provide a method of QgsMapToPixel to fetch map center
85 // in geographical units
86 const QgsPointXY center = mapToPixel.toMapCoordinates(
87 static_cast<int>( mapToPixel.mapWidth() / 2.0 ),
88 static_cast<int>( mapToPixel.mapHeight() / 2.0 )
89 );
90 mapToPixel.setMapRotation( 0, center.x(), center.y() );
91 }
92
93 QgsRectangle myProjectedViewExtent;
94 QgsRectangle myProjectedLayerExtent;
95
96 if ( rendererContext.coordinateTransform().isValid() )
97 {
98 QgsDebugMsgLevel( QStringLiteral( "coordinateTransform set -> project extents." ), 4 );
99 if ( rendererContext.extent().xMinimum() == std::numeric_limits<double>::lowest() &&
100 rendererContext.extent().yMinimum() == std::numeric_limits<double>::lowest() &&
101 rendererContext.extent().xMaximum() == std::numeric_limits<double>::max() &&
102 rendererContext.extent().yMaximum() == std::numeric_limits<double>::max() )
103 {
104 // We get in this situation if the view CRS is geographical and the
105 // extent goes beyond -180,-90,180,90. To avoid reprojection issues to the
106 // layer CRS, then this dummy extent is returned by QgsMapRendererJob::reprojectToLayerExtent()
107 // Don't try to reproject it now to view extent as this would return
108 // a null rectangle.
109 myProjectedViewExtent = rendererContext.extent();
110 }
111 else
112 {
113 try
114 {
115 QgsCoordinateTransform ct = rendererContext.coordinateTransform();
117 myProjectedViewExtent = ct.transformBoundingBox( rendererContext.extent() );
118 }
119 catch ( QgsCsException &cs )
120 {
121 QgsMessageLog::logMessage( QObject::tr( "Could not reproject view extent: %1" ).arg( cs.what() ), QObject::tr( "Raster" ) );
122 myProjectedViewExtent.setMinimal();
123 }
124 }
125
126 try
127 {
128 QgsCoordinateTransform ct = rendererContext.coordinateTransform();
130 myProjectedLayerExtent = ct.transformBoundingBox( layer->extent() );
131 }
132 catch ( QgsCsException &cs )
133 {
134 QgsMessageLog::logMessage( QObject::tr( "Could not reproject layer extent: %1" ).arg( cs.what() ), QObject::tr( "Raster" ) );
135 myProjectedLayerExtent.setMinimal();
136 }
137 }
138 else
139 {
140 QgsDebugMsgLevel( QStringLiteral( "coordinateTransform not set" ), 4 );
141 myProjectedViewExtent = rendererContext.extent();
142 myProjectedLayerExtent = layer->extent();
143 }
144
145 // clip raster extent to view extent
146 QgsRectangle myRasterExtent = layer->ignoreExtents() ? myProjectedViewExtent : myProjectedViewExtent.intersect( myProjectedLayerExtent );
147 if ( myRasterExtent.isEmpty() )
148 {
149 QgsDebugMsgLevel( QStringLiteral( "draw request outside view extent." ), 2 );
150 // nothing to do
151 return;
152 }
153
154 QgsDebugMsgLevel( "theViewExtent is " + rendererContext.extent().toString(), 4 );
155 QgsDebugMsgLevel( "myProjectedViewExtent is " + myProjectedViewExtent.toString(), 4 );
156 QgsDebugMsgLevel( "myProjectedLayerExtent is " + myProjectedLayerExtent.toString(), 4 );
157 QgsDebugMsgLevel( "myRasterExtent is " + myRasterExtent.toString(), 4 );
158
159 //
160 // The first thing we do is set up the QgsRasterViewPort. This struct stores all the settings
161 // relating to the size (in pixels and coordinate system units) of the raster part that is
162 // in view in the map window. It also stores the origin.
163 //
164 //this is not a class level member because every time the user pans or zooms
165 //the contents of the rasterViewPort will change
166 mRasterViewPort = new QgsRasterViewPort();
167
168 mRasterViewPort->mDrawnExtent = myRasterExtent;
169 if ( rendererContext.coordinateTransform().isValid() )
170 {
171 mRasterViewPort->mSrcCRS = layer->crs();
172 mRasterViewPort->mDestCRS = rendererContext.coordinateTransform().destinationCrs();
173 mRasterViewPort->mTransformContext = rendererContext.transformContext();
174 }
175 else
176 {
177 mRasterViewPort->mSrcCRS = QgsCoordinateReferenceSystem(); // will be invalid
178 mRasterViewPort->mDestCRS = QgsCoordinateReferenceSystem(); // will be invalid
179 }
180
181 // get dimensions of clipped raster image in device coordinate space (this is the size of the viewport)
182 mRasterViewPort->mTopLeftPoint = mapToPixel.transform( myRasterExtent.xMinimum(), myRasterExtent.yMaximum() );
183 mRasterViewPort->mBottomRightPoint = mapToPixel.transform( myRasterExtent.xMaximum(), myRasterExtent.yMinimum() );
184
185 // align to output device grid, i.e. std::floor/ceil to integers
186 // TODO: this should only be done if paint device is raster - screen, image
187 // for other devices (pdf) it can have floating point origin
188 // we could use floating point for raster devices as well, but respecting the
189 // output device grid should make it more effective as the resampling is done in
190 // the provider anyway
191 mRasterViewPort->mTopLeftPoint.setX( std::floor( mRasterViewPort->mTopLeftPoint.x() ) );
192 mRasterViewPort->mTopLeftPoint.setY( std::floor( mRasterViewPort->mTopLeftPoint.y() ) );
193 mRasterViewPort->mBottomRightPoint.setX( std::ceil( mRasterViewPort->mBottomRightPoint.x() ) );
194 mRasterViewPort->mBottomRightPoint.setY( std::ceil( mRasterViewPort->mBottomRightPoint.y() ) );
195 // recalc myRasterExtent to aligned values
196 myRasterExtent.set(
197 mapToPixel.toMapCoordinates( mRasterViewPort->mTopLeftPoint.x(),
198 mRasterViewPort->mBottomRightPoint.y() ),
199 mapToPixel.toMapCoordinates( mRasterViewPort->mBottomRightPoint.x(),
200 mRasterViewPort->mTopLeftPoint.y() )
201 );
202
203 //raster viewport top left / bottom right are already rounded to int
204 mRasterViewPort->mWidth = static_cast<qgssize>( std::abs( mRasterViewPort->mBottomRightPoint.x() - mRasterViewPort->mTopLeftPoint.x() ) );
205 mRasterViewPort->mHeight = static_cast<qgssize>( std::abs( mRasterViewPort->mBottomRightPoint.y() - mRasterViewPort->mTopLeftPoint.y() ) );
206
207 const double dpi = 25.4 * rendererContext.scaleFactor();
208 if ( mProviderCapabilities & QgsRasterDataProvider::DpiDependentData
209 && rendererContext.dpiTarget() >= 0.0 )
210 {
211 const double dpiScaleFactor = rendererContext.dpiTarget() / dpi;
212 mRasterViewPort->mWidth *= dpiScaleFactor;
213 mRasterViewPort->mHeight *= dpiScaleFactor;
214 }
215 else
216 {
217 rendererContext.setDpiTarget( -1.0 );
218 }
219
220 //the drawable area can start to get very very large when you get down displaying 2x2 or smaller, this is because
221 //mapToPixel.mapUnitsPerPixel() is less then 1,
222 //so we will just get the pixel data and then render these special cases differently in paintImageToCanvas()
223
224 QgsDebugMsgLevel( QStringLiteral( "mapUnitsPerPixel = %1" ).arg( mapToPixel.mapUnitsPerPixel() ), 3 );
225 QgsDebugMsgLevel( QStringLiteral( "mWidth = %1" ).arg( layer->width() ), 3 );
226 QgsDebugMsgLevel( QStringLiteral( "mHeight = %1" ).arg( layer->height() ), 3 );
227 QgsDebugMsgLevel( QStringLiteral( "myRasterExtent.xMinimum() = %1" ).arg( myRasterExtent.xMinimum() ), 3 );
228 QgsDebugMsgLevel( QStringLiteral( "myRasterExtent.xMaximum() = %1" ).arg( myRasterExtent.xMaximum() ), 3 );
229 QgsDebugMsgLevel( QStringLiteral( "myRasterExtent.yMinimum() = %1" ).arg( myRasterExtent.yMinimum() ), 3 );
230 QgsDebugMsgLevel( QStringLiteral( "myRasterExtent.yMaximum() = %1" ).arg( myRasterExtent.yMaximum() ), 3 );
231
232 QgsDebugMsgLevel( QStringLiteral( "mTopLeftPoint.x() = %1" ).arg( mRasterViewPort->mTopLeftPoint.x() ), 3 );
233 QgsDebugMsgLevel( QStringLiteral( "mBottomRightPoint.x() = %1" ).arg( mRasterViewPort->mBottomRightPoint.x() ), 3 );
234 QgsDebugMsgLevel( QStringLiteral( "mTopLeftPoint.y() = %1" ).arg( mRasterViewPort->mTopLeftPoint.y() ), 3 );
235 QgsDebugMsgLevel( QStringLiteral( "mBottomRightPoint.y() = %1" ).arg( mRasterViewPort->mBottomRightPoint.y() ), 3 );
236
237 QgsDebugMsgLevel( QStringLiteral( "mWidth = %1" ).arg( mRasterViewPort->mWidth ), 3 );
238 QgsDebugMsgLevel( QStringLiteral( "mHeight = %1" ).arg( mRasterViewPort->mHeight ), 3 );
239
240 // /\/\/\ - added to handle zoomed-in rasters
241
242 // TODO R->mLastViewPort = *mRasterViewPort;
243
244 // TODO: is it necessary? Probably WMS only?
245 layer->dataProvider()->setDpi( dpi );
246
247 // copy the whole raster pipe!
248 mPipe = new QgsRasterPipe( *layer->pipe() );
250 QgsRasterRenderer *rasterRenderer = mPipe->renderer();
251 if ( rasterRenderer
252 && !( rendererContext.flags() & Qgis::RenderContextFlag::RenderPreviewJob )
253 && !( rendererContext.flags() & Qgis::RenderContextFlag::Render3DMap ) )
254 {
255 layer->refreshRendererIfNeeded( rasterRenderer, rendererContext.extent() );
256 }
257
258 mPipe->evaluateDataDefinedProperties( rendererContext.expressionContext() );
259
260 const QgsRasterLayerTemporalProperties *temporalProperties = qobject_cast< const QgsRasterLayerTemporalProperties * >( layer->temporalProperties() );
261 if ( temporalProperties->isActive() && renderContext()->isTemporal() )
262 {
263 switch ( temporalProperties->mode() )
264 {
267 break;
268
270 // in this mode we need to pass on the desired render temporal range to the data provider
271 if ( mPipe->provider()->temporalCapabilities() )
272 {
275 }
276 break;
277 }
278 }
279 else if ( mPipe->provider()->temporalCapabilities() )
280 {
283 }
284
286
287 mFeedback->setRenderContext( rendererContext );
288
289 mPipe->moveToThread( nullptr );
290}
291
293{
294 delete mFeedback;
295
296 delete mRasterViewPort;
297 delete mPipe;
298}
299
301{
302 // Skip rendering of out of view tiles (xyz)
303 if ( !mRasterViewPort || ( renderContext()->testFlag( Qgis::RenderContextFlag::RenderPreviewJob ) &&
304 !( mProviderCapabilities &
306 return true;
307
308 mPipe->moveToThread( QThread::currentThread() );
309
310 QElapsedTimer time;
311 time.start();
312 //
313 //
314 // The goal here is to make as many decisions as possible early on (outside of the rendering loop)
315 // so that we can maximise performance of the rendering process. So now we check which drawing
316 // procedure to use :
317 //
318
319 const QgsScopedQPainterState painterSate( renderContext()->painter() );
320 if ( !mClippingRegions.empty() )
321 {
322 bool needsPainterClipPath = false;
323 const QPainterPath path = QgsMapClippingUtils::calculatePainterClipRegion( mClippingRegions, *renderContext(), QgsMapLayerType::RasterLayer, needsPainterClipPath );
324 if ( needsPainterClipPath )
325 renderContext()->painter()->setClipPath( path, Qt::IntersectClip );
326 }
327
328 QgsRasterProjector *projector = mPipe->projector();
329 bool restoreOldResamplingStage = false;
330 const Qgis::RasterResamplingStage oldResamplingState = mPipe->resamplingStage();
331
332 // TODO add a method to interface to get provider and get provider
333 // params in QgsRasterProjector
334 if ( projector )
335 {
336 // Force provider resampling if reprojection is needed
338 mRasterViewPort->mSrcCRS != mRasterViewPort->mDestCRS &&
339 oldResamplingState != Qgis::RasterResamplingStage::Provider )
340 {
341 restoreOldResamplingStage = true;
343 }
344 projector->setCrs( mRasterViewPort->mSrcCRS, mRasterViewPort->mDestCRS, mRasterViewPort->mTransformContext );
345 }
346
347 // important -- disable SmoothPixmapTransform for raster layer renders. We want individual pixels to be clearly defined!
348 renderContext()->painter()->setRenderHint( QPainter::SmoothPixmapTransform, false );
349
350 // Drawer to pipe?
351 QgsRasterIterator iterator( mPipe->last() );
352 QgsRasterDrawer drawer( &iterator );
353 drawer.draw( *( renderContext() ), mRasterViewPort, mFeedback );
354
355 if ( restoreOldResamplingStage )
356 {
357 mPipe->setResamplingStage( oldResamplingState );
358 }
359
360 const QStringList errors = mFeedback->errors();
361 for ( const QString &error : errors )
362 {
363 mErrors.append( error );
364 }
365
366 QgsDebugMsgLevel( QStringLiteral( "total raster draw time (ms): %1" ).arg( time.elapsed(), 5 ), 4 );
367 mReadyToCompose = true;
368
369 mPipe->moveToThread( nullptr );
370
371 return !mFeedback->isCanceled();
372}
373
375{
376 return mFeedback;
377}
378
380{
381 if ( !mRasterViewPort || !mPipe )
382 return false; // this layer is not going to get rendered
383
384 // preview of intermediate raster rendering results requires a temporary output image
386 return true;
387
388 if ( QgsRasterRenderer *renderer = mPipe->renderer() )
389 {
391 && renderContext()->testFlag( Qgis::RenderContextFlag::UseAdvancedEffects ) && ( !qgsDoubleNear( mLayerOpacity, 1.0 ) ) )
392 return true;
393 }
394
395 return false;
396}
RasterResamplingStage
Stage at which raster resampling occurs.
Definition qgis.h:721
@ Provider
Resampling occurs in Provider.
@ InternalLayerOpacityHandling
The renderer internally handles the raster layer's opacity, so the default layer level opacity handli...
@ RedrawLayerOnly
Redraw the layer when temporal range changes, but don't apply any filtering. Useful when raster symbo...
@ TemporalRangeFromDataProvider
Mode when raster layer delegates temporal range handling to the dataprovider.
@ FixedTemporalRange
Mode when temporal properties have fixed start and end datetimes.
@ RenderPreviewJob
Render is a 'canvas preview' render, and shortcuts should be taken to ensure fast rendering.
@ RenderPartialOutput
Whether to make extra effort to update map image with partially rendered layers (better for interacti...
@ Render3DMap
Render is for a 3D map.
@ UseAdvancedEffects
Enable layer opacity and blending effects.
This class represents a coordinate reference system (CRS).
Class for doing transforms between two map coordinate systems.
void setBallparkTransformsAreAppropriate(bool appropriate)
Sets whether approximate "ballpark" results are appropriate for this coordinate transform.
QgsRectangle transformBoundingBox(const QgsRectangle &rectangle, Qgis::TransformDirection direction=Qgis::TransformDirection::Forward, bool handle180Crossover=false) const
Transforms a rectangle from the source CRS to the destination CRS.
bool isValid() const
Returns true if the coordinate transform is valid, ie both the source and destination CRS have been s...
QgsCoordinateReferenceSystem destinationCrs() const
Returns the destination coordinate reference system, which the transform will transform coordinates t...
Custom exception class for Coordinate Reference System related exceptions.
QString what() const
Base class for feedback objects to be used for cancellation of something running in a worker thread.
Definition qgsfeedback.h:45
static QList< QgsMapClippingRegion > collectClippingRegionsForLayer(const QgsRenderContext &context, const QgsMapLayer *layer)
Collects the list of map clipping regions from a context which apply to a map layer.
static QPainterPath calculatePainterClipRegion(const QList< QgsMapClippingRegion > &regions, const QgsRenderContext &context, QgsMapLayerType layerType, bool &shouldClip)
Returns a QPainterPath representing the intersection of clipping regions from context which should be...
Base class for utility classes that encapsulate information necessary for rendering of map layers.
bool mReadyToCompose
The flag must be set to false in renderer's constructor if wants to use the smarter map redraws funct...
QgsRenderContext * renderContext()
Returns the render context associated with the renderer.
QStringList errors() const
Returns list of errors (problems) that happened during the rendering.
virtual QgsRectangle extent() const
Returns the extent of the layer.
QgsCoordinateReferenceSystem crs
Definition qgsmaplayer.h:79
void statusChanged(const QString &status)
Emit a signal with status (e.g. to be caught by QgisApp and display a msg on status bar)
Perform transforms between map coordinates and device coordinates.
int mapHeight() const
Returns current map height in pixels.
void setMapRotation(double degrees, double cx, double cy)
Sets map rotation in degrees (clockwise).
double mapUnitsPerPixel() const
Returns the current map units per pixel.
QgsPointXY toMapCoordinates(int x, int y) const
Transforms device coordinates to map (world) coordinates.
int mapWidth() const
Returns the current map width in pixels.
QgsPointXY transform(const QgsPointXY &p) const
Transforms a point p from map (world) coordinates to device coordinates.
double mapRotation() const
Returns the current map rotation in degrees (clockwise).
static void logMessage(const QString &message, const QString &tag=QString(), Qgis::MessageLevel level=Qgis::MessageLevel::Warning, bool notifyUser=true)
Adds a message to the log instance (and creates it if necessary).
A class to represent a 2D point.
Definition qgspointxy.h:59
void setY(double y)
Sets the y value of the point.
Definition qgspointxy.h:132
double y
Definition qgspointxy.h:63
double x
Definition qgspointxy.h:62
void setX(double x)
Sets the x value of the point.
Definition qgspointxy.h:122
Feedback object tailored for raster block reading.
void setPreviewOnly(bool preview)
set flag whether the block request is for preview purposes only
void setRenderPartialOutput(bool enable)
Set whether our painter is drawing to a temporary image used just by this layer.
void setIntervalHandlingMethod(Qgis::TemporalIntervalMatchMethod method)
Sets the desired method to use when resolving a temporal interval to matching layers or bands in the ...
void setRequestedTemporalRange(const QgsDateTimeRange &range)
Sets the requested temporal range to retrieve when returning data from the associated data provider.
Base class for raster data providers.
virtual QgsRasterDataProvider::ProviderCapabilities providerCapabilities() const
Returns flags containing the supported capabilities of the data provider.
void setDpi(int dpi)
Sets the output device resolution.
@ ProviderHintCanPerformProviderResampling
Provider can perform resampling (to be opposed to post rendering resampling) (since QGIS 3....
void statusChanged(const QString &) const
Emit a message to be displayed on status bar, usually used by network providers (WMS,...
QgsRasterDataProviderTemporalCapabilities * temporalCapabilities() override
Returns the provider's temporal capabilities.
The drawing pipe for raster layers.
void draw(QPainter *p, QgsRasterViewPort *viewPort, const QgsMapToPixel *qgsMapToPixel, QgsRasterBlockFeedback *feedback=nullptr)
Draws raster data.
@ Prefetch
Allow prefetching of out-of-view images.
Iterator for sequentially processing raster cells.
Implementation of threaded rendering for raster layers.
bool render() override
Do the rendering (based on data stored in the class).
QgsRasterLayerRenderer(QgsRasterLayer *layer, QgsRenderContext &rendererContext)
bool forceRasterRender() const override
Returns true if the renderer must be rendered to a raster paint device (e.g.
QgsFeedback * feedback() const override
Access to feedback object of the layer renderer (may be nullptr)
Implementation of map layer temporal properties for raster layers.
Qgis::TemporalIntervalMatchMethod intervalHandlingMethod() const
Returns the desired method to use when resolving a temporal interval to matching layers or bands in t...
Qgis::RasterTemporalMode mode() const
Returns the temporal properties mode.
Represents a raster layer.
int height() const
Returns the height of the (unclipped) raster.
void refreshRendererIfNeeded(QgsRasterRenderer *rasterRenderer, const QgsRectangle &extent)
Refresh renderer with new extent, if needed.
QgsMapLayerTemporalProperties * temporalProperties() override
Returns the layer's temporal properties.
QgsRasterPipe * pipe()
Returns the raster pipe.
bool ignoreExtents() const
If the ignoreExtent flag is set, the layer will also render outside the bounding box reported by the ...
QgsRasterDataProvider * dataProvider() override
Returns the source data provider.
int width() const
Returns the width of the (unclipped) raster.
Contains a pipeline of raster interfaces for sequential raster processing.
QgsRasterInterface * last() const
Returns last interface in the pipe.
void moveToThread(QThread *thread)
Moves the pipe to another thread.
QgsRasterDataProvider * provider() const
Returns the data provider interface, or nullptr if no data provider is present in the pipe.
void setResamplingStage(Qgis::RasterResamplingStage stage)
Sets which stage of the pipe should apply resampling.
void evaluateDataDefinedProperties(QgsExpressionContext &context)
Evaluates any data defined properties set on the pipe, applying their results to the corresponding in...
QgsRasterProjector * projector() const
Returns the projector interface, or nullptr if no projector is present in the pipe.
QgsRasterRenderer * renderer() const
Returns the raster renderer interface, or nullptr if no raster renderer is present in the pipe.
Qgis::RasterResamplingStage resamplingStage() const
Returns which stage of the pipe should apply resampling.
QgsRasterProjector implements approximate projection support for it calculates grid of points in sour...
Q_DECL_DEPRECATED void setCrs(const QgsCoordinateReferenceSystem &srcCRS, const QgsCoordinateReferenceSystem &destCRS, int srcDatumTransform=-1, int destDatumTransform=-1)
Sets the source and destination CRS.
Raster renderer pipe that applies colors to a raster.
A rectangle specified with double values.
QString toString(int precision=16) const
Returns a string representation of form xmin,ymin : xmax,ymax Coordinates will be truncated to the sp...
double xMinimum() const
Returns the x minimum value (left side of rectangle).
double yMinimum() const
Returns the y minimum value (bottom side of rectangle).
void setMinimal()
Set a rectangle so that min corner is at max and max corner is at min.
double xMaximum() const
Returns the x maximum value (right side of rectangle).
double yMaximum() const
Returns the y maximum value (top side of rectangle).
void set(const QgsPointXY &p1, const QgsPointXY &p2, bool normalize=true)
Sets the rectangle from two QgsPoints.
bool isEmpty() const
Returns true if the rectangle is empty.
QgsRectangle intersect(const QgsRectangle &rect) const
Returns the intersection with the given rectangle.
Contains information about the context of a rendering operation.
double scaleFactor() const
Returns the scaling factor for the render to convert painter units to physical sizes.
QPainter * painter()
Returns the destination QPainter for the render operation.
QgsExpressionContext & expressionContext()
Gets the expression context.
QgsCoordinateTransformContext transformContext() const
Returns the context's coordinate transform context, which stores various information regarding which ...
const QgsRectangle & extent() const
When rendering a map layer, calling this method returns the "clipping" extent for the layer (in the l...
bool testFlag(Qgis::RenderContextFlag flag) const
Check whether a particular flag is enabled.
void setDpiTarget(double dpi)
Sets the targeted dpi for rendering.
double dpiTarget() const
Returns the targeted DPI for rendering.
const QgsMapToPixel & mapToPixel() const
Returns the context's map to pixel transform, which transforms between map coordinates and device coo...
QgsCoordinateTransform coordinateTransform() const
Returns the current coordinate transform for the context.
Qgis::RenderContextFlags flags() const
Returns combination of flags used for rendering.
Scoped object for saving and restoring a QPainter object's state.
bool isActive() const
Returns true if the temporal property is active.
const QgsDateTimeRange & temporalRange() const
Returns the datetime range for the object.
@ RasterLayer
Raster layer.
unsigned long long qgssize
Qgssize is used instead of size_t, because size_t is stdlib type, unknown by SIP, and it would be har...
Definition qgis.h:3032
bool qgsDoubleNear(double a, double b, double epsilon=4 *std::numeric_limits< double >::epsilon())
Compare two doubles (but allow some difference)
Definition qgis.h:2527
#define QgsDebugMsgLevel(str, level)
Definition qgslogger.h:39
QgsTemporalRange< QDateTime > QgsDateTimeRange
QgsRange which stores a range of date times.
Definition qgsrange.h:693
This class provides details of the viewable area that a raster will be rendered into.
qgssize mHeight
Height, number of rows to be rendered.
QgsCoordinateReferenceSystem mDestCRS
Target coordinate system.
QgsPointXY mBottomRightPoint
Coordinate (in output device coordinate system) of bottom right corner of the part of the raster that...
QgsPointXY mTopLeftPoint
Coordinate (in output device coordinate system) of top left corner of the part of the raster that is ...
QgsCoordinateReferenceSystem mSrcCRS
Source coordinate system.
QgsRectangle mDrawnExtent
Intersection of current map extent and layer extent.
QgsCoordinateTransformContext mTransformContext
Coordinate transform context.
qgssize mWidth
Width, number of columns to be rendered.