QGIS API Documentation  3.14.0-Pi (9f7028fd23)
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 
16 #include "qgsrasterlayerrenderer.h"
17 
18 #include "qgsmessagelog.h"
19 #include "qgsrasterdataprovider.h"
20 #include "qgsrasterdrawer.h"
21 #include "qgsrasteriterator.h"
22 #include "qgsrasterlayer.h"
23 #include "qgsrasterprojector.h"
24 #include "qgsrendercontext.h"
25 #include "qgsproject.h"
26 #include "qgsexception.h"
28 
30 
31 QgsRasterLayerRendererFeedback::QgsRasterLayerRendererFeedback( QgsRasterLayerRenderer *r )
32  : mR( r )
33  , mMinimalPreviewInterval( 250 )
34 {
35  setRenderPartialOutput( r->renderContext()->testFlag( QgsRenderContext::RenderPartialOutput ) );
36 }
37 
38 void QgsRasterLayerRendererFeedback::onNewData()
39 {
40  if ( !renderPartialOutput() )
41  return; // we were not asked for partial renders and we may not have a temporary image for overwriting...
42 
43  // update only once upon a time
44  // (preview itself takes some time)
45  if ( mLastPreview.isValid() && mLastPreview.msecsTo( QTime::currentTime() ) < mMinimalPreviewInterval )
46  return;
47 
48  // TODO: update only the area that got new data
49 
50  QgsDebugMsgLevel( QStringLiteral( "new raster preview! %1" ).arg( mLastPreview.msecsTo( QTime::currentTime() ) ), 3 );
51  QElapsedTimer t;
52  t.start();
53  QgsRasterBlockFeedback feedback;
54  feedback.setPreviewOnly( true );
55  feedback.setRenderPartialOutput( true );
56  QgsRasterIterator iterator( mR->mPipe->last() );
57  QgsRasterDrawer drawer( &iterator );
58  drawer.draw( mR->renderContext()->painter(), mR->mRasterViewPort, &mR->renderContext()->mapToPixel(), &feedback );
59  QgsDebugMsgLevel( QStringLiteral( "total raster preview time: %1 ms" ).arg( t.elapsed() ), 3 );
60  mLastPreview = QTime::currentTime();
61 }
62 
66  : QgsMapLayerRenderer( layer->id(), &rendererContext )
67  , mProviderCapabilities( static_cast<QgsRasterDataProvider::Capability>( layer->dataProvider()->capabilities() ) )
68  , mFeedback( new QgsRasterLayerRendererFeedback( this ) )
69 {
70  QgsMapToPixel mapToPixel = rendererContext.mapToPixel();
71  if ( rendererContext.mapToPixel().mapRotation() )
72  {
73  // unset rotation for the sake of local computations.
74  // Rotation will be handled by QPainter later
75  // TODO: provide a method of QgsMapToPixel to fetch map center
76  // in geographical units
77  QgsPointXY center = mapToPixel.toMapCoordinates(
78  static_cast<int>( mapToPixel.mapWidth() / 2.0 ),
79  static_cast<int>( mapToPixel.mapHeight() / 2.0 )
80  );
81  mapToPixel.setMapRotation( 0, center.x(), center.y() );
82  }
83 
84  QgsRectangle myProjectedViewExtent;
85  QgsRectangle myProjectedLayerExtent;
86 
87  if ( rendererContext.coordinateTransform().isValid() )
88  {
89  QgsDebugMsgLevel( QStringLiteral( "coordinateTransform set -> project extents." ), 4 );
90  if ( rendererContext.extent().xMinimum() == std::numeric_limits<double>::lowest() &&
91  rendererContext.extent().yMinimum() == std::numeric_limits<double>::lowest() &&
92  rendererContext.extent().xMaximum() == std::numeric_limits<double>::max() &&
93  rendererContext.extent().yMaximum() == std::numeric_limits<double>::max() )
94  {
95  // We get in this situation if the view CRS is geographical and the
96  // extent goes beyond -180,-90,180,90. To avoid reprojection issues to the
97  // layer CRS, then this dummy extent is returned by QgsMapRendererJob::reprojectToLayerExtent()
98  // Don't try to reproject it now to view extent as this would return
99  // a null rectangle.
100  myProjectedViewExtent = rendererContext.extent();
101  }
102  else
103  {
104  try
105  {
106  QgsCoordinateTransform ct = rendererContext.coordinateTransform();
108  myProjectedViewExtent = ct.transformBoundingBox( rendererContext.extent() );
109  }
110  catch ( QgsCsException &cs )
111  {
112  QgsMessageLog::logMessage( QObject::tr( "Could not reproject view extent: %1" ).arg( cs.what() ), QObject::tr( "Raster" ) );
113  myProjectedViewExtent.setMinimal();
114  }
115  }
116 
117  try
118  {
119  QgsCoordinateTransform ct = rendererContext.coordinateTransform();
121  myProjectedLayerExtent = ct.transformBoundingBox( layer->extent() );
122  }
123  catch ( QgsCsException &cs )
124  {
125  QgsMessageLog::logMessage( QObject::tr( "Could not reproject layer extent: %1" ).arg( cs.what() ), QObject::tr( "Raster" ) );
126  myProjectedLayerExtent.setMinimal();
127  }
128  }
129  else
130  {
131  QgsDebugMsgLevel( QStringLiteral( "coordinateTransform not set" ), 4 );
132  myProjectedViewExtent = rendererContext.extent();
133  myProjectedLayerExtent = layer->extent();
134  }
135 
136  // clip raster extent to view extent
137  QgsRectangle myRasterExtent = layer->ignoreExtents() ? myProjectedViewExtent : myProjectedViewExtent.intersect( myProjectedLayerExtent );
138  if ( myRasterExtent.isEmpty() )
139  {
140  QgsDebugMsgLevel( QStringLiteral( "draw request outside view extent." ), 2 );
141  // nothing to do
142  return;
143  }
144 
145  QgsDebugMsgLevel( "theViewExtent is " + rendererContext.extent().toString(), 4 );
146  QgsDebugMsgLevel( "myProjectedViewExtent is " + myProjectedViewExtent.toString(), 4 );
147  QgsDebugMsgLevel( "myProjectedLayerExtent is " + myProjectedLayerExtent.toString(), 4 );
148  QgsDebugMsgLevel( "myRasterExtent is " + myRasterExtent.toString(), 4 );
149 
150  //
151  // The first thing we do is set up the QgsRasterViewPort. This struct stores all the settings
152  // relating to the size (in pixels and coordinate system units) of the raster part that is
153  // in view in the map window. It also stores the origin.
154  //
155  //this is not a class level member because every time the user pans or zooms
156  //the contents of the rasterViewPort will change
157  mRasterViewPort = new QgsRasterViewPort();
158 
159  mRasterViewPort->mDrawnExtent = myRasterExtent;
160  if ( rendererContext.coordinateTransform().isValid() )
161  {
162  mRasterViewPort->mSrcCRS = layer->crs();
163  mRasterViewPort->mDestCRS = rendererContext.coordinateTransform().destinationCrs();
164  mRasterViewPort->mTransformContext = rendererContext.transformContext();
165  }
166  else
167  {
168  mRasterViewPort->mSrcCRS = QgsCoordinateReferenceSystem(); // will be invalid
169  mRasterViewPort->mDestCRS = QgsCoordinateReferenceSystem(); // will be invalid
170  }
171 
172  // get dimensions of clipped raster image in device coordinate space (this is the size of the viewport)
173  mRasterViewPort->mTopLeftPoint = mapToPixel.transform( myRasterExtent.xMinimum(), myRasterExtent.yMaximum() );
174  mRasterViewPort->mBottomRightPoint = mapToPixel.transform( myRasterExtent.xMaximum(), myRasterExtent.yMinimum() );
175 
176  // align to output device grid, i.e. std::floor/ceil to integers
177  // TODO: this should only be done if paint device is raster - screen, image
178  // for other devices (pdf) it can have floating point origin
179  // we could use floating point for raster devices as well, but respecting the
180  // output device grid should make it more effective as the resampling is done in
181  // the provider anyway
182  mRasterViewPort->mTopLeftPoint.setX( std::floor( mRasterViewPort->mTopLeftPoint.x() ) );
183  mRasterViewPort->mTopLeftPoint.setY( std::floor( mRasterViewPort->mTopLeftPoint.y() ) );
184  mRasterViewPort->mBottomRightPoint.setX( std::ceil( mRasterViewPort->mBottomRightPoint.x() ) );
185  mRasterViewPort->mBottomRightPoint.setY( std::ceil( mRasterViewPort->mBottomRightPoint.y() ) );
186  // recalc myRasterExtent to aligned values
187  myRasterExtent.set(
188  mapToPixel.toMapCoordinates( mRasterViewPort->mTopLeftPoint.x(),
189  mRasterViewPort->mBottomRightPoint.y() ),
190  mapToPixel.toMapCoordinates( mRasterViewPort->mBottomRightPoint.x(),
191  mRasterViewPort->mTopLeftPoint.y() )
192  );
193 
194  //raster viewport top left / bottom right are already rounded to int
195  mRasterViewPort->mWidth = static_cast<qgssize>( std::abs( mRasterViewPort->mBottomRightPoint.x() - mRasterViewPort->mTopLeftPoint.x() ) );
196  mRasterViewPort->mHeight = static_cast<qgssize>( std::abs( mRasterViewPort->mBottomRightPoint.y() - mRasterViewPort->mTopLeftPoint.y() ) );
197 
198  //the drawable area can start to get very very large when you get down displaying 2x2 or smaller, this is because
199  //mapToPixel.mapUnitsPerPixel() is less then 1,
200  //so we will just get the pixel data and then render these special cases differently in paintImageToCanvas()
201 
202  QgsDebugMsgLevel( QStringLiteral( "mapUnitsPerPixel = %1" ).arg( mapToPixel.mapUnitsPerPixel() ), 3 );
203  QgsDebugMsgLevel( QStringLiteral( "mWidth = %1" ).arg( layer->width() ), 3 );
204  QgsDebugMsgLevel( QStringLiteral( "mHeight = %1" ).arg( layer->height() ), 3 );
205  QgsDebugMsgLevel( QStringLiteral( "myRasterExtent.xMinimum() = %1" ).arg( myRasterExtent.xMinimum() ), 3 );
206  QgsDebugMsgLevel( QStringLiteral( "myRasterExtent.xMaximum() = %1" ).arg( myRasterExtent.xMaximum() ), 3 );
207  QgsDebugMsgLevel( QStringLiteral( "myRasterExtent.yMinimum() = %1" ).arg( myRasterExtent.yMinimum() ), 3 );
208  QgsDebugMsgLevel( QStringLiteral( "myRasterExtent.yMaximum() = %1" ).arg( myRasterExtent.yMaximum() ), 3 );
209 
210  QgsDebugMsgLevel( QStringLiteral( "mTopLeftPoint.x() = %1" ).arg( mRasterViewPort->mTopLeftPoint.x() ), 3 );
211  QgsDebugMsgLevel( QStringLiteral( "mBottomRightPoint.x() = %1" ).arg( mRasterViewPort->mBottomRightPoint.x() ), 3 );
212  QgsDebugMsgLevel( QStringLiteral( "mTopLeftPoint.y() = %1" ).arg( mRasterViewPort->mTopLeftPoint.y() ), 3 );
213  QgsDebugMsgLevel( QStringLiteral( "mBottomRightPoint.y() = %1" ).arg( mRasterViewPort->mBottomRightPoint.y() ), 3 );
214 
215  QgsDebugMsgLevel( QStringLiteral( "mWidth = %1" ).arg( mRasterViewPort->mWidth ), 3 );
216  QgsDebugMsgLevel( QStringLiteral( "mHeight = %1" ).arg( mRasterViewPort->mHeight ), 3 );
217 
218  // /\/\/\ - added to handle zoomed-in rasters
219 
220  // TODO R->mLastViewPort = *mRasterViewPort;
221 
222  // TODO: is it necessary? Probably WMS only?
223  layer->dataProvider()->setDpi( 25.4 * rendererContext.scaleFactor() );
224 
225 
226  // copy the whole raster pipe!
227  mPipe = new QgsRasterPipe( *layer->pipe() );
228  QObject::connect( mPipe->provider(), &QgsRasterDataProvider::statusChanged, layer, &QgsRasterLayer::statusChanged );
229  QgsRasterRenderer *rasterRenderer = mPipe->renderer();
230  if ( rasterRenderer && !( rendererContext.flags() & QgsRenderContext::RenderPreviewJob ) )
231  layer->refreshRendererIfNeeded( rasterRenderer, rendererContext.extent() );
232 
233  const QgsRasterLayerTemporalProperties *temporalProperties = qobject_cast< const QgsRasterLayerTemporalProperties * >( layer->temporalProperties() );
234  if ( temporalProperties->isActive() && renderContext()->isTemporal() )
235  {
236  switch ( temporalProperties->mode() )
237  {
239  break;
240 
242  // in this mode we need to pass on the desired render temporal range to the data provider
243  if ( mPipe->provider()->temporalCapabilities() )
244  {
245  mPipe->provider()->temporalCapabilities()->setRequestedTemporalRange( rendererContext.temporalRange() );
247  }
248  break;
249  }
250  }
251  else if ( mPipe->provider()->temporalCapabilities() )
252  {
253  mPipe->provider()->temporalCapabilities()->setRequestedTemporalRange( QgsDateTimeRange() );
255  }
256 }
257 
259 {
260  delete mFeedback;
261 
262  delete mRasterViewPort;
263  delete mPipe;
264 }
265 
267 {
268  // Skip rendering of out of view tiles (xyz)
269  if ( !mRasterViewPort || ( renderContext()->testFlag( QgsRenderContext::Flag::RenderPreviewJob ) &&
270  !( mProviderCapabilities &
271  QgsRasterInterface::Capability::Prefetch ) ) )
272  return true;
273 
274  QElapsedTimer time;
275  time.start();
276  //
277  //
278  // The goal here is to make as many decisions as possible early on (outside of the rendering loop)
279  // so that we can maximise performance of the rendering process. So now we check which drawing
280  // procedure to use :
281  //
282 
283  QgsRasterProjector *projector = mPipe->projector();
284 
285  // TODO add a method to interface to get provider and get provider
286  // params in QgsRasterProjector
287  if ( projector )
288  {
289  projector->setCrs( mRasterViewPort->mSrcCRS, mRasterViewPort->mDestCRS, mRasterViewPort->mTransformContext );
290  }
291 
292  // Drawer to pipe?
293  QgsRasterIterator iterator( mPipe->last() );
294  QgsRasterDrawer drawer( &iterator );
295  drawer.draw( renderContext()->painter(), mRasterViewPort, &renderContext()->mapToPixel(), mFeedback );
296 
297  const QStringList errors = mFeedback->errors();
298  for ( const QString &error : errors )
299  {
300  mErrors.append( error );
301  }
302 
303  QgsDebugMsgLevel( QStringLiteral( "total raster draw time (ms): %1" ).arg( time.elapsed(), 5 ), 4 );
304 
305  return true;
306 }
307 
309 {
310  return mFeedback;
311 }
312 
QgsRasterViewPort::mBottomRightPoint
QgsPointXY mBottomRightPoint
Coordinate (in output device coordinate system) of bottom right corner of the part of the raster that...
Definition: qgsrasterviewport.h:63
QgsMapLayer::crs
QgsCoordinateReferenceSystem crs
Definition: qgsmaplayer.h:88
qgsrasterprojector.h
QgsRenderContext::testFlag
bool testFlag(Flag flag) const
Check whether a particular flag is enabled.
Definition: qgsrendercontext.cpp:165
QgsPointXY::y
double y
Definition: qgspointxy.h:48
QgsRenderContext::mapToPixel
const QgsMapToPixel & mapToPixel() const
Returns the context's map to pixel transform, which transforms between map coordinates and device coo...
Definition: qgsrendercontext.h:309
qgsrasterlayer.h
QgsMapToPixel::mapUnitsPerPixel
double mapUnitsPerPixel() const
Returns current map units per pixel.
Definition: qgsmaptopixel.cpp:128
QgsRasterLayer::ignoreExtents
bool ignoreExtents() const
If the ignoreExtent flag is set, the layer will also render outside the bounding box reported by the ...
Definition: qgsrasterlayer.cpp:958
QgsRasterDataProviderTemporalCapabilities::setIntervalHandlingMethod
void setIntervalHandlingMethod(IntervalHandlingMethod method)
Sets the desired method to use when resolving a temporal interval to matching layers or bands in the ...
Definition: qgsrasterdataprovidertemporalcapabilities.cpp:66
QgsDebugMsgLevel
#define QgsDebugMsgLevel(str, level)
Definition: qgslogger.h:39
qgsrasterdrawer.h
QgsMapLayerRenderer::errors
QStringList errors() const
Returns list of errors (problems) that happened during the rendering.
Definition: qgsmaplayerrenderer.h:74
QgsRectangle::xMaximum
double xMaximum() const
Returns the x maximum value (right side of rectangle).
Definition: qgsrectangle.h:162
QgsRasterViewPort::mSrcCRS
QgsCoordinateReferenceSystem mSrcCRS
Source coordinate system.
Definition: qgsrasterviewport.h:78
QgsMapLayer::statusChanged
void statusChanged(const QString &status)
Emit a signal with status (e.g. to be caught by QgisApp and display a msg on status bar)
QgsRasterPipe
Definition: qgsrasterpipe.h:46
QgsTemporalRangeObject::temporalRange
const QgsDateTimeRange & temporalRange() const
Returns the datetime range for the object.
Definition: qgstemporalrangeobject.cpp:43
QgsRenderContext
Definition: qgsrendercontext.h:57
QgsMapLayerRenderer::renderContext
QgsRenderContext * renderContext()
Returns the render context associated with the renderer.
Definition: qgsmaplayerrenderer.h:84
QgsRasterViewPort::mTopLeftPoint
QgsPointXY mTopLeftPoint
Coordinate (in output device coordinate system) of top left corner of the part of the raster that is ...
Definition: qgsrasterviewport.h:58
QgsRasterViewPort
Definition: qgsrasterviewport.h:34
QgsRenderContext::scaleFactor
double scaleFactor() const
Returns the scaling factor for the render to convert painter units to physical sizes.
Definition: qgsrendercontext.h:317
QgsRasterLayerTemporalProperties::ModeTemporalRangeFromDataProvider
@ ModeTemporalRangeFromDataProvider
Mode when raster layer delegates temporal range handling to the dataprovider.
Definition: qgsrasterlayertemporalproperties.h:57
QgsMapToPixel::toMapCoordinates
QgsPointXY toMapCoordinates(int x, int y) const
Transform device coordinates to map (world) coordinates.
Definition: qgsmaptopixel.cpp:108
QgsRectangle::intersect
QgsRectangle intersect(const QgsRectangle &rect) const
Returns the intersection with the given rectangle.
Definition: qgsrectangle.h:312
QgsCoordinateTransform::isValid
bool isValid() const
Returns true if the coordinate transform is valid, ie both the source and destination CRS have been s...
Definition: qgscoordinatetransform.cpp:876
QgsRenderContext::extent
const QgsRectangle & extent() const
When rendering a map layer, calling this method returns the "clipping" extent for the layer (in the l...
Definition: qgsrendercontext.h:290
QgsRectangle
Definition: qgsrectangle.h:41
QgsCoordinateTransform::transformBoundingBox
QgsRectangle transformBoundingBox(const QgsRectangle &rectangle, TransformDirection direction=ForwardTransform, bool handle180Crossover=false) const SIP_THROW(QgsCsException)
Transforms a rectangle from the source CRS to the destination CRS.
Definition: qgscoordinatetransform.cpp:511
QgsRasterLayerTemporalProperties
Definition: qgsrasterlayertemporalproperties.h:35
QgsRasterPipe::provider
QgsRasterDataProvider * provider() const
Definition: qgsrasterpipe.cpp:232
QgsMapLayerRenderer
Definition: qgsmaplayerrenderer.h:50
QgsCoordinateTransform::destinationCrs
QgsCoordinateReferenceSystem destinationCrs() const
Returns the destination coordinate reference system, which the transform will transform coordinates t...
Definition: qgscoordinatetransform.cpp:234
qgsrasteriterator.h
QgsRasterProjector
QgsRasterProjector implements approximate projection support for it calculates grid of points in sour...
Definition: qgsrasterprojector.h:47
QgsRasterLayerRenderer::~QgsRasterLayerRenderer
~QgsRasterLayerRenderer() override
Definition: qgsrasterlayerrenderer.cpp:258
QgsRasterLayerTemporalProperties::ModeFixedTemporalRange
@ ModeFixedTemporalRange
Mode when temporal properties have fixed start and end datetimes.
Definition: qgsrasterlayertemporalproperties.h:56
QgsRenderContext::coordinateTransform
QgsCoordinateTransform coordinateTransform() const
Returns the current coordinate transform for the context.
Definition: qgsrendercontext.h:229
QgsRasterLayerRenderer::feedback
QgsFeedback * feedback() const override
Access to feedback object of the layer renderer (may be nullptr)
Definition: qgsrasterlayerrenderer.cpp:308
QgsCsException
Definition: qgsexception.h:65
QgsRasterLayer::width
int width() const
Returns the width of the (unclipped) raster.
Definition: qgsrasterlayer.cpp:2373
QgsRasterDrawer::draw
void draw(QPainter *p, QgsRasterViewPort *viewPort, const QgsMapToPixel *qgsMapToPixel, QgsRasterBlockFeedback *feedback=nullptr)
Draws raster data.
Definition: qgsrasterdrawer.cpp:36
QgsTemporalProperty::isActive
bool isActive() const
Returns true if the temporal property is active.
Definition: qgstemporalproperty.cpp:36
QgsCoordinateTransform::setBallparkTransformsAreAppropriate
void setBallparkTransformsAreAppropriate(bool appropriate)
Sets whether approximate "ballpark" results are appropriate for this coordinate transform.
Definition: qgscoordinatetransform.cpp:919
QgsRasterPipe::renderer
QgsRasterRenderer * renderer() const
Definition: qgsrasterpipe.cpp:237
QgsRasterRenderer
Definition: qgsrasterrenderer.h:38
QgsRasterViewPort::mTransformContext
QgsCoordinateTransformContext mTransformContext
Coordinate transform context.
Definition: qgsrasterviewport.h:86
QgsFeedback
Definition: qgsfeedback.h:43
QgsMapToPixel::mapHeight
int mapHeight() const
Returns current map height in pixels.
Definition: qgsmaptopixel.cpp:69
QgsMapToPixel::mapRotation
double mapRotation() const
Returns current map rotation in degrees.
Definition: qgsmaptopixel.cpp:158
QgsRasterLayer::height
int height() const
Returns the height of the (unclipped) raster.
Definition: qgsrasterlayer.cpp:2379
QgsMapLayer::extent
virtual QgsRectangle extent() const
Returns the extent of the layer.
Definition: qgsmaplayer.cpp:197
QgsRasterLayer::temporalProperties
QgsMapLayerTemporalProperties * temporalProperties() override
Returns the layer's temporal properties.
Definition: qgsrasterlayer.cpp:963
QgsException::what
QString what() const
Definition: qgsexception.h:48
QgsRasterDataProvider::setDpi
void setDpi(int dpi)
Sets the output device resolution.
Definition: qgsrasterdataprovider.h:422
qgsrendercontext.h
QgsRasterDrawer
Definition: qgsrasterdrawer.h:37
QgsPointXY::setY
void setY(double y)
Sets the y value of the point.
Definition: qgspointxy.h:117
QgsMapLayerRenderer::mErrors
QStringList mErrors
Definition: qgsmaplayerrenderer.h:87
QgsRasterProjector::setCrs
Q_DECL_DEPRECATED void setCrs(const QgsCoordinateReferenceSystem &srcCRS, const QgsCoordinateReferenceSystem &destCRS, int srcDatumTransform=-1, int destDatumTransform=-1)
Sets the source and destination CRS.
QgsRasterLayerTemporalProperties::mode
TemporalMode mode() const
Returns the temporal properties mode.
Definition: qgsrasterlayertemporalproperties.cpp:61
QgsRasterLayer
Definition: qgsrasterlayer.h:72
QgsRasterBlockFeedback::setRenderPartialOutput
void setRenderPartialOutput(bool enable)
Set whether our painter is drawing to a temporary image used just by this layer.
Definition: qgsrasterinterface.h:90
QgsRasterIterator
Definition: qgsrasteriterator.h:34
QgsRasterLayerTemporalProperties::intervalHandlingMethod
QgsRasterDataProviderTemporalCapabilities::IntervalHandlingMethod intervalHandlingMethod() const
Returns the desired method to use when resolving a temporal interval to matching layers or bands in t...
Definition: qgsrasterlayertemporalproperties.cpp:78
QgsCoordinateReferenceSystem
Definition: qgscoordinatereferencesystem.h:206
QgsMapToPixel::transform
QgsPointXY transform(const QgsPointXY &p) const
Transform the point from map (world) coordinates to device coordinates.
Definition: qgsmaptopixel.cpp:217
qgsrasterlayerrenderer.h
QgsRectangle::yMaximum
double yMaximum() const
Returns the y maximum value (top side of rectangle).
Definition: qgsrectangle.h:172
QgsRectangle::toString
QString toString(int precision=16) const
Returns a string representation of form xmin,ymin : xmax,ymax Coordinates will be truncated to the sp...
Definition: qgsrectangle.cpp:127
QgsPointXY
Definition: qgspointxy.h:43
QgsRasterLayerRenderer::render
bool render() override
Do the rendering (based on data stored in the class)
Definition: qgsrasterlayerrenderer.cpp:266
QgsRenderContext::RenderPartialOutput
@ RenderPartialOutput
Whether to make extra effort to update map image with partially rendered layers (better for interacti...
Definition: qgsrendercontext.h:79
QgsRasterPipe::last
QgsRasterInterface * last() const
Definition: qgsrasterpipe.h:114
QgsRasterViewPort::mHeight
qgssize mHeight
Distance in map units from bottom edge to top edge for the part of the raster that is to be rendered.
Definition: qgsrasterviewport.h:72
QgsRasterLayerRenderer
Definition: qgsrasterlayerrenderer.h:69
QgsRasterViewPort::mWidth
qgssize mWidth
Width, number of columns to be rendered.
Definition: qgsrasterviewport.h:66
QgsMapToPixel
Definition: qgsmaptopixel.h:37
QgsMapToPixel::mapWidth
int mapWidth() const
Returns current map width in pixels The information is only known if setRotation was used.
Definition: qgsmaptopixel.cpp:74
QgsRasterLayer::pipe
QgsRasterPipe * pipe()
Returns the raster pipe.
Definition: qgsrasterlayer.h:276
QgsRenderContext::transformContext
QgsCoordinateTransformContext transformContext() const
Returns the context's coordinate transform context, which stores various information regarding which ...
Definition: qgsrendercontext.cpp:130
QgsRectangle::set
void set(const QgsPointXY &p1, const QgsPointXY &p2)
Sets the rectangle from two QgsPoints.
Definition: qgsrectangle.h:105
QgsPointXY::x
double x
Definition: qgspointxy.h:47
QgsRasterBlockFeedback
Definition: qgsrasterinterface.h:40
QgsRasterDataProvider::statusChanged
void statusChanged(const QString &) const
Emit a message to be displayed on status bar, usually used by network providers (WMS,...
QgsRasterLayer::refreshRendererIfNeeded
void refreshRendererIfNeeded(QgsRasterRenderer *rasterRenderer, const QgsRectangle &extent)
Refresh renderer with new extent, if needed.
Definition: qgsrasterlayer.cpp:1150
QgsMessageLog::logMessage
static void logMessage(const QString &message, const QString &tag=QString(), Qgis::MessageLevel level=Qgis::Warning, bool notifyUser=true)
Adds a message to the log instance (and creates it if necessary).
Definition: qgsmessagelog.cpp:27
QgsRectangle::yMinimum
double yMinimum() const
Returns the y minimum value (bottom side of rectangle).
Definition: qgsrectangle.h:177
QgsRasterBlockFeedback::setPreviewOnly
void setPreviewOnly(bool preview)
set flag whether the block request is for preview purposes only
Definition: qgsrasterinterface.h:78
qgsrasterlayertemporalproperties.h
qgsexception.h
QgsPointXY::setX
void setX(double x)
Sets the x value of the point.
Definition: qgspointxy.h:107
QgsRasterPipe::projector
QgsRasterProjector * projector() const
Definition: qgsrasterpipe.cpp:257
QgsRectangle::setMinimal
void setMinimal()
Set a rectangle so that min corner is at max and max corner is at min.
Definition: qgsrectangle.h:151
QgsCoordinateTransform
Definition: qgscoordinatetransform.h:52
QgsRasterViewPort::mDestCRS
QgsCoordinateReferenceSystem mDestCRS
Target coordinate system.
Definition: qgsrasterviewport.h:81
QgsRectangle::isEmpty
bool isEmpty() const
Returns true if the rectangle is empty.
Definition: qgsrectangle.h:437
QgsRenderContext::RenderPreviewJob
@ RenderPreviewJob
Render is a 'canvas preview' render, and shortcuts should be taken to ensure fast rendering.
Definition: qgsrendercontext.h:80
QgsMapToPixel::setMapRotation
void setMapRotation(double degrees, double cx, double cy)
Set map rotation in degrees (clockwise)
Definition: qgsmaptopixel.cpp:133
QgsRasterDataProvider::temporalCapabilities
QgsRasterDataProviderTemporalCapabilities * temporalCapabilities() override
Returns the provider's temporal capabilities.
Definition: qgsrasterdataprovider.cpp:413
QgsRasterViewPort::mDrawnExtent
QgsRectangle mDrawnExtent
Intersection of current map extent and layer extent.
Definition: qgsrasterviewport.h:75
QgsRasterDataProvider
Definition: qgsrasterdataprovider.h:88
qgsproject.h
QgsRasterLayer::dataProvider
QgsRasterDataProvider * dataProvider() override
Returns the source data provider.
Definition: qgsrasterlayer.cpp:233
QgsRectangle::xMinimum
double xMinimum() const
Returns the x minimum value (left side of rectangle).
Definition: qgsrectangle.h:167
qgsrasterdataprovider.h
QgsRenderContext::flags
Flags flags() const
Returns combination of flags used for rendering.
Definition: qgsrendercontext.cpp:160
QgsRasterLayerRenderer::QgsRasterLayerRenderer
QgsRasterLayerRenderer(QgsRasterLayer *layer, QgsRenderContext &rendererContext)
Definition: qgsrasterlayerrenderer.cpp:65
qgsmessagelog.h
qgssize
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:723