QGIS API Documentation
3.14.0-Pi (9f7028fd23)
|
Go to the documentation of this file.
33 , mMinimalPreviewInterval( 250 )
38 void QgsRasterLayerRendererFeedback::onNewData()
40 if ( !renderPartialOutput() )
45 if ( mLastPreview.isValid() && mLastPreview.msecsTo( QTime::currentTime() ) < mMinimalPreviewInterval )
50 QgsDebugMsgLevel( QStringLiteral(
"new raster preview! %1" ).arg( mLastPreview.msecsTo( QTime::currentTime() ) ), 3 );
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();
67 , mProviderCapabilities( static_cast<
QgsRasterDataProvider::Capability>( layer->dataProvider()->capabilities() ) )
68 , mFeedback( new QgsRasterLayerRendererFeedback( this ) )
78 static_cast<int>( mapToPixel.
mapWidth() / 2.0 ),
79 static_cast<int>( mapToPixel.
mapHeight() / 2.0 )
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() )
100 myProjectedViewExtent = rendererContext.
extent();
132 myProjectedViewExtent = rendererContext.
extent();
133 myProjectedLayerExtent = layer->
extent();
138 if ( myRasterExtent.
isEmpty() )
140 QgsDebugMsgLevel( QStringLiteral(
"draw request outside view extent." ), 2 );
236 switch ( temporalProperties->
mode() )
262 delete mRasterViewPort;
269 if ( !mRasterViewPort || (
renderContext()->testFlag( QgsRenderContext::Flag::RenderPreviewJob ) &&
270 !( mProviderCapabilities &
271 QgsRasterInterface::Capability::Prefetch ) ) )
297 const QStringList
errors = mFeedback->errors();
298 for (
const QString &error :
errors )
303 QgsDebugMsgLevel( QStringLiteral(
"total raster draw time (ms): %1" ).arg( time.elapsed(), 5 ), 4 );
QgsPointXY mBottomRightPoint
Coordinate (in output device coordinate system) of bottom right corner of the part of the raster that...
QgsCoordinateReferenceSystem crs
bool testFlag(Flag flag) const
Check whether a particular flag is enabled.
const QgsMapToPixel & mapToPixel() const
Returns the context's map to pixel transform, which transforms between map coordinates and device coo...
double mapUnitsPerPixel() const
Returns current map units per pixel.
bool ignoreExtents() const
If the ignoreExtent flag is set, the layer will also render outside the bounding box reported by the ...
void setIntervalHandlingMethod(IntervalHandlingMethod method)
Sets the desired method to use when resolving a temporal interval to matching layers or bands in the ...
#define QgsDebugMsgLevel(str, level)
QStringList errors() const
Returns list of errors (problems) that happened during the rendering.
double xMaximum() const
Returns the x maximum value (right side of rectangle).
QgsCoordinateReferenceSystem mSrcCRS
Source coordinate system.
void statusChanged(const QString &status)
Emit a signal with status (e.g. to be caught by QgisApp and display a msg on status bar)
const QgsDateTimeRange & temporalRange() const
Returns the datetime range for the object.
QgsRenderContext * renderContext()
Returns the render context associated with the renderer.
QgsPointXY mTopLeftPoint
Coordinate (in output device coordinate system) of top left corner of the part of the raster that is ...
double scaleFactor() const
Returns the scaling factor for the render to convert painter units to physical sizes.
@ ModeTemporalRangeFromDataProvider
Mode when raster layer delegates temporal range handling to the dataprovider.
QgsPointXY toMapCoordinates(int x, int y) const
Transform device coordinates to map (world) coordinates.
QgsRectangle intersect(const QgsRectangle &rect) const
Returns the intersection with the given rectangle.
const QgsRectangle & extent() const
When rendering a map layer, calling this method returns the "clipping" extent for the layer (in the l...
QgsRasterDataProvider * provider() const
QgsRasterProjector implements approximate projection support for it calculates grid of points in sour...
~QgsRasterLayerRenderer() override
@ ModeFixedTemporalRange
Mode when temporal properties have fixed start and end datetimes.
QgsCoordinateTransform coordinateTransform() const
Returns the current coordinate transform for the context.
QgsFeedback * feedback() const override
Access to feedback object of the layer renderer (may be nullptr)
int width() const
Returns the width of the (unclipped) raster.
void draw(QPainter *p, QgsRasterViewPort *viewPort, const QgsMapToPixel *qgsMapToPixel, QgsRasterBlockFeedback *feedback=nullptr)
Draws raster data.
bool isActive() const
Returns true if the temporal property is active.
QgsRasterRenderer * renderer() const
QgsCoordinateTransformContext mTransformContext
Coordinate transform context.
int mapHeight() const
Returns current map height in pixels.
double mapRotation() const
Returns current map rotation in degrees.
int height() const
Returns the height of the (unclipped) raster.
virtual QgsRectangle extent() const
Returns the extent of the layer.
QgsMapLayerTemporalProperties * temporalProperties() override
Returns the layer's temporal properties.
void setDpi(int dpi)
Sets the output device resolution.
void setY(double y)
Sets the y value of the point.
Q_DECL_DEPRECATED void setCrs(const QgsCoordinateReferenceSystem &srcCRS, const QgsCoordinateReferenceSystem &destCRS, int srcDatumTransform=-1, int destDatumTransform=-1)
Sets the source and destination CRS.
TemporalMode mode() const
Returns the temporal properties mode.
void setRenderPartialOutput(bool enable)
Set whether our painter is drawing to a temporary image used just by this layer.
QgsRasterDataProviderTemporalCapabilities::IntervalHandlingMethod intervalHandlingMethod() const
Returns the desired method to use when resolving a temporal interval to matching layers or bands in t...
QgsPointXY transform(const QgsPointXY &p) const
Transform the point from map (world) coordinates to device coordinates.
double yMaximum() const
Returns the y maximum value (top side of rectangle).
QString toString(int precision=16) const
Returns a string representation of form xmin,ymin : xmax,ymax Coordinates will be truncated to the sp...
bool render() override
Do the rendering (based on data stored in the class)
@ RenderPartialOutput
Whether to make extra effort to update map image with partially rendered layers (better for interacti...
QgsRasterInterface * last() const
qgssize mHeight
Distance in map units from bottom edge to top edge for the part of the raster that is to be rendered.
qgssize mWidth
Width, number of columns to be rendered.
int mapWidth() const
Returns current map width in pixels The information is only known if setRotation was used.
QgsRasterPipe * pipe()
Returns the raster pipe.
QgsCoordinateTransformContext transformContext() const
Returns the context's coordinate transform context, which stores various information regarding which ...
void set(const QgsPointXY &p1, const QgsPointXY &p2)
Sets the rectangle from two QgsPoints.
void statusChanged(const QString &) const
Emit a message to be displayed on status bar, usually used by network providers (WMS,...
void refreshRendererIfNeeded(QgsRasterRenderer *rasterRenderer, const QgsRectangle &extent)
Refresh renderer with new extent, if needed.
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).
double yMinimum() const
Returns the y minimum value (bottom side of rectangle).
void setPreviewOnly(bool preview)
set flag whether the block request is for preview purposes only
void setX(double x)
Sets the x value of the point.
QgsRasterProjector * projector() const
void setMinimal()
Set a rectangle so that min corner is at max and max corner is at min.
QgsCoordinateReferenceSystem mDestCRS
Target coordinate system.
bool isEmpty() const
Returns true if the rectangle is empty.
@ RenderPreviewJob
Render is a 'canvas preview' render, and shortcuts should be taken to ensure fast rendering.
void setMapRotation(double degrees, double cx, double cy)
Set map rotation in degrees (clockwise)
QgsRasterDataProviderTemporalCapabilities * temporalCapabilities() override
Returns the provider's temporal capabilities.
QgsRectangle mDrawnExtent
Intersection of current map extent and layer extent.
QgsRasterDataProvider * dataProvider() override
Returns the source data provider.
double xMinimum() const
Returns the x minimum value (left side of rectangle).
Flags flags() const
Returns combination of flags used for rendering.
QgsRasterLayerRenderer(QgsRasterLayer *layer, QgsRenderContext &rendererContext)
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...