17#include "moc_qgsrasterlayerrenderer.cpp" 
   45#include <QElapsedTimer> 
   53  , mMinimalPreviewInterval( 250 )
 
   58void QgsRasterLayerRendererFeedback::onNewData()
 
   60  if ( !renderPartialOutput() )
 
   65  if ( mLastPreview.isValid() && mLastPreview.msecsTo( QTime::currentTime() ) < mMinimalPreviewInterval )
 
   70  QgsDebugMsgLevel( QStringLiteral( 
"new raster preview! %1" ).arg( mLastPreview.msecsTo( QTime::currentTime() ) ), 3 );
 
   78  drawer.draw( *( mR->renderContext() ), mR->mRasterViewPort, &feedback );
 
   79  mR->mReadyToCompose = 
true;
 
   80  QgsDebugMsgLevel( QStringLiteral( 
"total raster preview time: %1 ms" ).arg( t.elapsed() ), 3 );
 
   81  mLastPreview = QTime::currentTime();
 
   88  , mLayerName( layer->name() )
 
   89  , mLayerOpacity( layer->opacity() )
 
   90  , mProviderCapabilities( layer->dataProvider()->providerCapabilities() )
 
   91  , mInterfaceCapabilities( layer->dataProvider()->capabilities() )
 
   92  , mFeedback( new QgsRasterLayerRendererFeedback( this ) )
 
   93  , mEnableProfile( rendererContext.flags() & 
Qgis::RenderContextFlag::RecordProfile )
 
  108                                static_cast<int>( mapToPixel.
mapWidth() / 2.0 ),
 
  109                                static_cast<int>( mapToPixel.
mapHeight() / 2.0 )
 
  119    QgsDebugMsgLevel( QStringLiteral( 
"coordinateTransform set -> project extents." ), 4 );
 
  120    if ( rendererContext.
extent().
xMinimum() == std::numeric_limits<double>::lowest() &&
 
  121         rendererContext.
extent().
yMinimum() == std::numeric_limits<double>::lowest() &&
 
  122         rendererContext.
extent().
xMaximum() == std::numeric_limits<double>::max() &&
 
  123         rendererContext.
extent().
yMaximum() == std::numeric_limits<double>::max() )
 
  130      viewExtentInMapCrs = rendererContext.
extent();
 
  138        viewExtentInMapCrs = rendererContext.
mapExtent();
 
  162    viewExtentInMapCrs = rendererContext.
extent();
 
  163    layerExtentInMapCrs = layer->
extent();
 
  168  if ( visibleExtentOfRasterInMapCrs.
isEmpty() )
 
  174      QgsDebugMsgLevel( QStringLiteral( 
"draw request outside view extent." ), 2 );
 
  191      if ( visibleExtentInLayerCrs.
isEmpty() )
 
  193        QgsDebugMsgLevel( QStringLiteral( 
"draw request outside view extent." ), 2 );
 
  198      visibleExtentOfRasterInMapCrs = layerToMapTransform.
transformBoundingBox( visibleExtentInLayerCrs );
 
  207  if ( visibleExtentOfRasterInMapCrs.
isEmpty() )
 
  209    QgsDebugMsgLevel( QStringLiteral( 
"draw request outside view extent." ), 2 );
 
  228  mRasterViewPort->
mDrawnExtent = visibleExtentOfRasterInMapCrs;
 
  256  visibleExtentOfRasterInMapCrs.
set(
 
  271    const double dpiScaleFactor = rendererContext.
dpiTarget() / dpi;
 
  272    mRasterViewPort->
mWidth *= dpiScaleFactor;
 
  273    mRasterViewPort->
mHeight *= dpiScaleFactor;
 
  288  QgsDebugMsgLevel( QStringLiteral( 
"visibleExtentOfRasterInMapCrs.xMinimum() = %1" ).arg( visibleExtentOfRasterInMapCrs.
xMinimum() ), 3 );
 
  289  QgsDebugMsgLevel( QStringLiteral( 
"visibleExtentOfRasterInMapCrs.xMaximum() = %1" ).arg( visibleExtentOfRasterInMapCrs.
xMaximum() ), 3 );
 
  290  QgsDebugMsgLevel( QStringLiteral( 
"visibleExtentOfRasterInMapCrs.yMinimum() = %1" ).arg( visibleExtentOfRasterInMapCrs.
yMinimum() ), 3 );
 
  291  QgsDebugMsgLevel( QStringLiteral( 
"visibleExtentOfRasterInMapCrs.yMaximum() = %1" ).arg( visibleExtentOfRasterInMapCrs.
yMaximum() ), 3 );
 
  319      QList<double> minValues;
 
  320      QList<double> maxValues;
 
  322      for ( 
const int bandIdx : rasterRenderer->
usesBands() )
 
  329        minValues.append( min );
 
  330        maxValues.append( max );
 
  333      rasterRenderer->
refresh( rendererContext.
extent(), minValues, maxValues );
 
  349    bool matched = 
false;
 
  356    if ( matched && matchedBand > 0 )
 
  358      mPipe->renderer()->setInputBand( matchedBand );
 
  364    switch ( temporalProperties->
mode() )
 
  373        if ( mPipe->renderer()->usesBands().contains( temporalProperties->
bandNumber() ) )
 
  376          std::unique_ptr< QgsRasterTransparency > transparency;
 
  378            transparency = std::make_unique< QgsRasterTransparency >( *rendererTransparency );
 
  380            transparency = std::make_unique< QgsRasterTransparency >();
 
  382          QVector<QgsRasterTransparency::TransparentSingleValuePixel> transparentPixels = transparency->transparentSingleValuePixelList();
 
  391          transparency->setTransparentSingleValuePixelList( transparentPixels );
 
  392          mPipe->renderer()->setRasterTransparency( transparency.release() );
 
  400          temporalCapabilities->setRequestedTemporalRange( rendererContext.
temporalRange() );
 
  414  if ( elevationProperties && elevationProperties->
hasElevation() )
 
  416    mDrawElevationMap = 
true;
 
  417    mElevationScale = elevationProperties->
zScale();
 
  418    mElevationOffset = elevationProperties->
zOffset();
 
  419    mElevationBand = elevationProperties->
bandNumber();
 
  424      switch ( elevationProperties->
mode() )
 
  438          if ( mPipe->renderer()->usesBands().contains( mElevationBand ) )
 
  443              std::unique_ptr< QgsRasterNuller> nuller;
 
  445                nuller.reset( existingNuller->clone() );
 
  447                nuller = std::make_unique< QgsRasterNuller >();
 
  452              const double adjustedLower = ( rendererContext.
zRange().
lower() - mElevationOffset ) / mElevationScale;
 
  453              const double adjustedUpper = ( rendererContext.
zRange().
upper() - mElevationOffset ) / mElevationScale;
 
  456              nuller->setOutputNoDataValue( mElevationBand, 
static_cast< int >( adjustedLower - 1 ) );
 
  457              nuller->setNoData( mElevationBand, nullRanges );
 
  459              if ( !mPipe->insert( 1, nuller.release() ) )
 
  466              std::unique_ptr< QgsRasterTransparency > transparency;
 
  468                transparency = std::make_unique< QgsRasterTransparency >( *rendererTransparency );
 
  470                transparency = std::make_unique< QgsRasterTransparency >();
 
  472              QVector<QgsRasterTransparency::TransparentSingleValuePixel> transparentPixels = transparency->transparentSingleValuePixelList();
 
  476              const double adjustedLower = ( rendererContext.
zRange().
lower() - mElevationOffset ) / mElevationScale;
 
  477              const double adjustedUpper = ( rendererContext.
zRange().
upper() - mElevationOffset ) / mElevationScale;
 
  481              transparency->setTransparentSingleValuePixelList( transparentPixels );
 
  482              mPipe->renderer()->setRasterTransparency( transparency.release() );
 
  492  prepareLabeling( layer );
 
  494  mFeedback->setRenderContext( rendererContext );
 
  496  mPipe->moveToThread( 
nullptr );
 
  498  mPreparationTime = timer.elapsed();
 
 
  505  delete mRasterViewPort;
 
 
  510  std::unique_ptr< QgsScopedRuntimeProfile > profile;
 
  511  if ( mEnableProfile )
 
  513    profile = std::make_unique< QgsScopedRuntimeProfile >( mLayerName, QStringLiteral( 
"rendering" ), 
layerId() );
 
  514    if ( mPreparationTime > 0 )
 
  520                             !( mInterfaceCapabilities &
 
  524  mPipe->moveToThread( QThread::currentThread() );
 
  529  std::unique_ptr< QgsScopedRuntimeProfile > preparingProfile;
 
  530  if ( mEnableProfile )
 
  532    preparingProfile = std::make_unique< QgsScopedRuntimeProfile >( QObject::tr( 
"Preparing render" ), QStringLiteral( 
"rendering" ) );
 
  543  if ( !mClippingRegions.empty() )
 
  545    bool needsPainterClipPath = 
false;
 
  547    if ( needsPainterClipPath )
 
  552  bool restoreOldResamplingStage = 
false;
 
  564      restoreOldResamplingStage = 
true;
 
  573  preparingProfile.reset();
 
  574  std::unique_ptr< QgsScopedRuntimeProfile > renderingProfile;
 
  575  if ( mEnableProfile )
 
  577    renderingProfile = std::make_unique< QgsScopedRuntimeProfile >( QObject::tr( 
"Rendering" ), QStringLiteral( 
"rendering" ) );
 
  586    const QSize maxTileSize {provider->maximumTileSize()};
 
  594  if ( mDrawElevationMap )
 
  597  renderingProfile.reset();
 
  599  if ( mLabelProvider && !
renderContext()->renderingStopped() )
 
  601    std::unique_ptr< QgsScopedRuntimeProfile > labelingProfile;
 
  602    if ( mEnableProfile )
 
  604      labelingProfile = std::make_unique< QgsScopedRuntimeProfile >( QObject::tr( 
"Labeling" ), QStringLiteral( 
"rendering" ) );
 
  609  if ( restoreOldResamplingStage )
 
  611    mPipe->setResamplingStage( oldResamplingState );
 
  614  const QStringList 
errors = mFeedback->errors();
 
  615  for ( 
const QString &error : 
errors )
 
  620  QgsDebugMsgLevel( QStringLiteral( 
"total raster draw time (ms):     %1" ).arg( time.elapsed(), 5 ), 4 );
 
  623  mPipe->moveToThread( 
nullptr );
 
  625  return !mFeedback->isCanceled();
 
 
  635  if ( !mRasterViewPort || !mPipe )
 
 
  664void QgsRasterLayerRenderer::prepareLabeling( 
QgsRasterLayer *layer )
 
  674        std::unique_ptr< QgsRasterLayerLabelProvider > provider = labeling->provider( layer );
 
  678          mLabelProvider = provider.release();
 
  680          engine2->addProvider( mLabelProvider );
 
  687void QgsRasterLayerRenderer::drawLabeling()
 
  689  if ( mLabelProvider )
 
  693void QgsRasterLayerRenderer::drawElevationMap()
 
  698    double dpiScalefactor;
 
  703      dpiScalefactor = 1.0;
 
  709    int viewWidth =  
static_cast<int>( viewSize.width() / dpiScalefactor );
 
  710    int viewHeight =  
static_cast<int>( viewSize.height() / dpiScalefactor );
 
  712    bool canRenderElevation = 
false;
 
  713    std::unique_ptr<QgsRasterBlock> elevationBlock;
 
  716      elevationBlock.reset(
 
  723      canRenderElevation = 
true;
 
  733      if ( viewExtentInLayerCoordinate.
xMinimum() == std::numeric_limits<double>::lowest() &&
 
  734           viewExtentInLayerCoordinate.
yMinimum() == std::numeric_limits<double>::lowest() &&
 
  735           viewExtentInLayerCoordinate.
xMaximum() == std::numeric_limits<double>::max() &&
 
  736           viewExtentInLayerCoordinate.
yMaximum() == std::numeric_limits<double>::max() )
 
  738        viewExtentInLayerCoordinate = dataProvider->
extent();
 
  741      double xLayerResol = viewExtentInLayerCoordinate.
width() / 
static_cast<double>( viewWidth );
 
  742      double yLayerResol = viewExtentInLayerCoordinate.
height() / 
static_cast<double>( viewHeight );
 
  744      double overSampling = 1;
 
  745      if ( mPipe->resampleFilter() )
 
  746        overSampling = mPipe->resampleFilter()->maxOversampling();
 
  751        double providerXResol = dataProvider->
extent().
width() / dataProvider->
xSize();
 
  753        overSampling = ( xLayerResol / providerXResol + yLayerResol / providerYResol ) / 2;
 
  757      if ( overSampling > 1 )
 
  767        int sourceWidth = viewWidth + 4;
 
  768        int sourceHeight = viewHeight + 4;
 
  770                                        viewExtentInLayerCoordinate.
xMinimum() - xLayerResol * 2,
 
  771                                        viewExtentInLayerCoordinate.
yMinimum() - yLayerResol * 2,
 
  772                                        viewExtentInLayerCoordinate.
xMaximum() + xLayerResol * 2,
 
  773                                        viewExtentInLayerCoordinate.
yMaximum() + yLayerResol * 2 );
 
  776        std::unique_ptr<QgsRasterBlock> sourcedata( dataProvider->
block( mElevationBand, viewExtentInLayerCoordinate, sourceWidth, sourceHeight, mFeedback ) );
 
  785        elevationBlock->setNoDataValue( dataProvider->
sourceNoDataValue( mElevationBand ) );
 
  792        QString coordinateOperation;
 
  799        if ( coordinateOperation.isEmpty() )
 
  804                               coordinateOperation.toUtf8().constData() );
 
  808    if ( canRenderElevation )
 
  822        int top = elevMapHeight;
 
  823        int left = elevMapWidth;
 
  826        QList<QgsPointXY> corners;
 
  832        for ( 
const QgsPointXY &corner : std::as_const( corners ) )
 
  835          int x = 
static_cast<int>( std::round( dpt.
x() ) );
 
  836          int y = 
static_cast<int>( std::round( dpt.
y() ) );
 
  856        std::unique_ptr<QgsRasterBlock> rotatedElevationBlock =
 
  857          std::make_unique<QgsRasterBlock>( elevationBlock->dataType(),
 
  859                                            ( bottom - top ) * 
renderContext()->devicePixelRatio() + 1 );
 
  861        rotatedElevationBlock->setNoDataValue( elevationBlock->noDataValue() );
 
  871          elevationBlock = std::move( rotatedElevationBlock );
 
  874        topLeft = QPoint( left, top );
 
  882        elevationBlock.get(),
 
Provides global constants and enumerations for use throughout the application.
 
@ Default
Allow raster-based rendering in situations where it is required for correct rendering or where it wil...
 
@ PreferVector
Prefer vector-based rendering, when the result will still be visually near-identical to a raster-base...
 
@ ForceVector
Always force vector-based rendering, even when the result will be visually different to a raster-base...
 
RasterResamplingStage
Stage at which raster resampling occurs.
 
@ Provider
Resampling occurs in Provider.
 
@ ProviderHintCanPerformProviderResampling
Provider can perform resampling (to be opposed to post rendering resampling)
 
@ DpiDependentData
Provider's rendering is dependent on requested pixel size of the viewport.
 
@ InternalLayerOpacityHandling
The renderer internally handles the raster layer's opacity, so the default layer level opacity handli...
 
@ UseNoDataForOutOfRangePixels
Out of range pixels (eg those values outside of the rendered map's z range filter) should be set usin...
 
@ FixedRangePerBand
Layer has a fixed (manually specified) elevation range per band.
 
@ FixedElevationRange
Layer has a fixed elevation range.
 
@ RepresentsElevationSurface
Pixel values represent an elevation surface.
 
@ DynamicRangePerBand
Layer has a elevation range per band, calculated dynamically from an expression.
 
@ Milliseconds
Milliseconds.
 
@ RepresentsTemporalValues
Pixel values represent an datetime.
 
@ RedrawLayerOnly
Redraw the layer when temporal range changes, but don't apply any filtering. Useful when raster symbo...
 
@ FixedRangePerBand
Layer has a fixed temporal range per band.
 
@ TemporalRangeFromDataProvider
Mode when raster layer delegates temporal range handling to the dataprovider.
 
@ FixedTemporalRange
Mode when temporal properties have fixed start and end datetimes.
 
@ FixedDateTime
Layer has a fixed date time instant.
 
@ Prefetch
Allow prefetching of out-of-view images.
 
@ Size
Original data source size (and thus resolution) is known, it is not always available,...
 
DataType
Raster data types.
 
@ UnknownDataType
Unknown or unspecified type.
 
@ 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.
 
@ Reverse
Reverse/inverse transform (from destination to source)
 
Abstract base class for labeling settings for raster layers.
 
static QgsRuntimeProfiler * profiler()
Returns the application runtime profiler.
 
Represents a coordinate reference system (CRS).
 
Contains information about the context in which a coordinate transform is executed.
 
QString calculateCoordinateOperation(const QgsCoordinateReferenceSystem &source, const QgsCoordinateReferenceSystem &destination) const
Returns the Proj coordinate operation string to use when transforming from the specified source CRS t...
 
bool mustReverseCoordinateOperation(const QgsCoordinateReferenceSystem &source, const QgsCoordinateReferenceSystem &destination) const
Returns true if the coordinate operation returned by calculateCoordinateOperation() for the source to...
 
Custom exception class for Coordinate Reference System related exceptions.
 
bool isInfinite() const
Returns true if the range consists of all possible values.
 
Stores a digital elevation model in a raster image which may get updated as a part of the map layer r...
 
QImage rawElevationImage() const
Returns raw elevation image with elevations encoded as color values.
 
void fillWithRasterBlock(QgsRasterBlock *block, int top, int left, double zScale=1.0, double offset=0.0)
Fills the elevation map with values contains in a raster block starting from position defined by top ...
 
Base class for feedback objects to be used for cancellation of something running in a worker thread.
 
static bool resampleSingleBandRaster(GDALDatasetH hSrcDS, GDALDatasetH hDstDS, GDALResampleAlg resampleAlg, const char *pszCoordinateOperation)
Resamples a single band raster to the destination dataset with different resolution (and possibly wit...
 
static GDALResampleAlg gdalResamplingAlgorithm(Qgis::RasterResamplingMethod method)
Returns the GDAL resampling method corresponding to the QGIS resampling method.
 
static gdal::dataset_unique_ptr blockToSingleBandMemoryDataset(int pixelWidth, int pixelHeight, const QgsRectangle &extent, void *block, GDALDataType dataType)
Converts a data block to a single band GDAL memory dataset.
 
A representation of the interval between two datetime values.
 
double originalDuration() const
Returns the original interval duration.
 
Qgis::TemporalUnit originalUnit() const
Returns the original interval temporal unit.
 
Provides map labeling functionality.
 
static QPainterPath calculatePainterClipRegion(const QList< QgsMapClippingRegion > ®ions, const QgsRenderContext &context, Qgis::LayerType layerType, bool &shouldClip)
Returns a QPainterPath representing the intersection of clipping regions from context which should be...
 
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.
 
double zScale() const
Returns the z scale, which is a scaling factor which should be applied to z values from the layer.
 
double zOffset() const
Returns the z offset, which is a fixed offset amount which should be added to z values from the layer...
 
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...
 
QString layerId() const
Gets access to the ID of the layer rendered by this class.
 
void appendRenderedItemDetails(QgsRenderedItemDetails *details)
Appends the details of a rendered item to the renderer.
 
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
 
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, const char *file=__builtin_FILE(), const char *function=__builtin_FUNCTION(), int line=__builtin_LINE())
Adds a message to the log instance (and creates it if necessary).
 
double distance(double x, double y) const
Returns the distance between this point and a specified x, y coordinate.
 
void setY(double y)
Sets the y value of the point.
 
void setX(double x)
Sets the x value of the point.
 
QPointF toQPointF() const
Converts a point to a QPointF.
 
bool includeUpper() const
Returns true if the upper bound is inclusive, or false if the upper bound is exclusive.
 
T lower() const
Returns the lower bound of the range.
 
bool includeLower() const
Returns true if the lower bound is inclusive, or false if the lower bound is exclusive.
 
T upper() const
Returns the upper bound of the range.
 
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.
 
Implementation of data provider temporal properties for QgsRasterDataProviders.
 
Base class for raster data providers.
 
Qgis::RasterResamplingMethod zoomedInResamplingMethod() const
Returns resampling method for zoomed-in operations.
 
virtual double sourceNoDataValue(int bandNo) const
Value representing no data value.
 
void setDpi(int dpi)
Sets the output device resolution.
 
QgsRectangle extent() const override=0
Returns the extent of the layer.
 
Qgis::DataType dataType(int bandNo) const override=0
Returns data type for the band specified by number.
 
Qgis::RasterResamplingMethod zoomedOutResamplingMethod() const
Returns resampling method for zoomed-out operations.
 
QgsRasterBlock * block(int bandNo, const QgsRectangle &boundingBox, int width, int height, QgsRasterBlockFeedback *feedback=nullptr) override
Read block of data using given extent and size.
 
void statusChanged(const QString &) const
Emit a message to be displayed on status bar, usually used by network providers (WMS,...
 
The drawing pipe for raster layers.
 
void draw(QPainter *p, QgsRasterViewPort *viewPort, const QgsMapToPixel *qgsMapToPixel, QgsRasterBlockFeedback *feedback=nullptr)
Draws raster data.
 
virtual Qgis::RasterInterfaceCapabilities capabilities() const
Returns the capabilities supported by the interface.
 
virtual int xSize() const
Gets raster size.
 
virtual int ySize() const
 
Iterator for sequentially processing raster cells.
 
void setMaximumTileWidth(int w)
Sets the maximum tile width returned during iteration.
 
void setMaximumTileHeight(int h)
Sets the minimum tile height returned during iteration.
 
Raster layer specific subclass of QgsMapLayerElevationProperties.
 
Qgis::RasterElevationMode mode() const
Returns the elevation mode.
 
bool hasElevation() const override
Returns true if the layer has an elevation or z component.
 
int bandNumber() const
Returns the band number from which the elevation should be taken.
 
void generateLabels(QgsRenderContext &context, QgsRasterPipe *pipe, QgsRasterViewPort *rasterViewPort, QgsRasterLayerRendererFeedback *feedback)
Generates the labels, given a render context and input pipe.
 
void startRender(QgsRenderContext &context) final
To be called before rendering of labels begins.
 
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.
 
~QgsRasterLayerRenderer() override
 
QgsFeedback * feedback() const override
Access to feedback object of the layer renderer (may be nullptr)
 
Implementation of map layer temporal properties for raster layers.
 
QDateTime temporalRepresentationOffset() const
Returns the temporal offset, which is a fixed datetime which should be added to individual pixel valu...
 
Qgis::TemporalIntervalMatchMethod intervalHandlingMethod() const
Returns the desired method to use when resolving a temporal interval to matching layers or bands in t...
 
const QgsInterval & temporalRepresentationScale() const
Returns the scale, which is an interval factor which should be applied to individual pixel values fro...
 
Qgis::RasterTemporalMode mode() const
Returns the temporal properties mode.
 
int bandNumber() const
Returns the band number from which temporal values should be taken.
 
static int renderedBandForElevationAndTemporalRange(QgsRasterLayer *layer, const QgsDateTimeRange &temporalRange, const QgsDoubleRange &elevationRange, bool &matched)
Given a raster layer, returns the band which should be used for rendering the layer for a specified t...
 
Represents a raster layer.
 
const QgsAbstractRasterLayerLabeling * labeling() const
Access to const labeling configuration.
 
int height() const
Returns the height of the (unclipped) raster.
 
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 ...
 
void computeMinMax(int band, const QgsRasterMinMaxOrigin &mmo, Qgis::RasterRangeLimit limits, const QgsRectangle &extent, int sampleSize, double &min, double &max)
Compute the min max values along band according to MinMaxOrigin parameters mmo and extent.
 
bool labelsEnabled() const
Returns whether the layer contains labels which are enabled and should be drawn.
 
static const double SAMPLE_SIZE
Default sample size (number of pixels) for estimated statistics/histogram calculation.
 
QgsRasterDataProvider * dataProvider() override
Returns the source data provider.
 
int width() const
Returns the width of the (unclipped) raster.
 
QgsMapLayerElevationProperties * elevationProperties() override
Returns the layer's elevation properties.
 
Describes the origin of minimum and maximum values in a raster.
 
Qgis::RasterRangeLimit limits() const
Returns the raster limits.
 
Raster pipe that deals with null values.
 
Contains a pipeline of raster interfaces for sequential raster processing.
 
Implements approximate projection support for optimised raster transformation.
 
Q_DECL_DEPRECATED void setCrs(const QgsCoordinateReferenceSystem &srcCRS, const QgsCoordinateReferenceSystem &destCRS, int srcDatumTransform=-1, int destDatumTransform=-1)
Sets the source and destination CRS.
 
Represents a range of raster values between min and max, optionally including the min and max value.
 
@ IncludeMin
Include the min value, but not the max value, e.g. min <= value < max.
 
@ IncludeMinAndMax
Min and max values are inclusive.
 
@ IncludeMax
Include the max value, but not the min value, e.g. min < value <= max.
 
Raster renderer pipe that applies colors to a raster.
 
const QgsRasterMinMaxOrigin & minMaxOrigin() const
Returns const reference to origin of min/max values.
 
virtual bool refresh(const QgsRectangle &extent, const QList< double > &min, const QList< double > &max, bool forceRefresh=false)
Refreshes the renderer according to the min and max values associated with the extent.
 
virtual QList< int > usesBands() const
Returns a list of band numbers used by the renderer.
 
bool needsRefresh(const QgsRectangle &extent) const
Checks if the renderer needs to be refreshed according to extent.
 
Defines the list of pixel values to be considered as transparent or semi transparent when rendering r...
 
A rectangle specified with double values.
 
Q_INVOKABLE QString toString(int precision=16) const
Returns a string representation of form xmin,ymin : xmax,ymax Coordinates will be truncated to the sp...
 
void set(const QgsPointXY &p1, const QgsPointXY &p2, bool normalize=true)
Sets the rectangle from two QgsPoints.
 
void setNull()
Mark a rectangle as being null (holding no spatial information).
 
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.
 
double rendererScale() const
Returns the renderer map scale.
 
QgsExpressionContext & expressionContext()
Gets the expression context.
 
QgsCoordinateTransformContext transformContext() const
Returns the context's coordinate transform context, which stores various information regarding which ...
 
QgsElevationMap * elevationMap() const
Returns the destination elevation map for the render operation.
 
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.
 
float devicePixelRatio() const
Returns the device pixel ratio.
 
QgsRectangle mapExtent() const
Returns the original extent of the map being rendered.
 
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...
 
QgsDoubleRange zRange() const
Returns the range of z-values which should be rendered.
 
QSize deviceOutputSize() const
Returns the device output size of the render.
 
QgsLabelingEngine * labelingEngine() const
Gets access to new labeling engine (may be nullptr).
 
QgsCoordinateTransform coordinateTransform() const
Returns the current coordinate transform for the context.
 
Qgis::RenderContextFlags flags() const
Returns combination of flags used for rendering.
 
void setBoundingBox(const QgsRectangle &bounds)
Sets the bounding box of the item (in map units).
 
Contains computed statistics for a layer render.
 
void record(const QString &name, double time, const QString &group="startup", const QString &id=QString())
Manually adds a profile event with the given name and total time (in seconds).
 
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.
 
T begin() const
Returns the beginning of the range.
 
T end() const
Returns the upper bound of the range.
 
static Q_INVOKABLE double fromUnitToUnitFactor(Qgis::DistanceUnit fromUnit, Qgis::DistanceUnit toUnit)
Returns the conversion factor between the specified distance units.
 
std::unique_ptr< std::remove_pointer< GDALDatasetH >::type, GDALDatasetCloser > dataset_unique_ptr
Scoped GDAL dataset.
 
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...
 
bool qgsDoubleNear(double a, double b, double epsilon=4 *std::numeric_limits< double >::epsilon())
Compare two doubles (but allow some difference)
 
#define QgsDebugMsgLevel(str, level)
 
#define QgsDebugError(str)
 
QgsTemporalRange< QDateTime > QgsDateTimeRange
QgsRange which stores a range of date times.
 
QList< QgsRasterRange > QgsRasterRangeList
 
Defines the transparency for a range of single-band pixel values.
 
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 (map) 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 (layer) coordinate system.
 
QgsRectangle mDrawnExtent
Intersection of current map extent and layer extent, in map (destination) CRS.
 
QgsCoordinateTransformContext mTransformContext
Coordinate transform context.
 
qgssize mWidth
Width, number of columns to be rendered.