17#ifndef QGSPROFILERENDERER_H
18#define QGSPROFILERENDERER_H
27#include <QFutureWatcher>
178 QImage
renderToImage(
int width,
int height,
double distanceMin,
double distanceMax,
double zMin,
double zMax,
const QString &sourceId = QString(),
double devicePixelRatio = 1.0 );
185 void render(
QgsRenderContext &context,
double width,
double height,
double distanceMin,
double distanceMax,
double zMin,
double zMax,
const QString &sourceId = QString() );
250 void onGeneratingFinished();
254 static QTransform computeRenderTransform(
double width,
double height,
double distanceMin,
double distanceMax,
double zMin,
double zMax );
260 std::unique_ptr< QgsAbstractProfileResults > results;
261 std::unique_ptr< QgsAbstractProfileResults > invalidatedResults;
262 bool complete =
false;
266 static void generateProfileStatic( std::unique_ptr< ProfileJob > &job );
269 std::vector< std::unique_ptr< QgsAbstractProfileGenerator > > mGenerators;
273 std::vector< std::unique_ptr< ProfileJob > > mJobs;
275 QFuture<void> mFuture;
276 QFutureWatcher<void> mFutureWatcher;
278 enum { Idle, Generating } mStatus = Idle;
280 std::unique_ptr<QgsLineSymbol> mSubsectionsSymbol;
ProfileExportType
Types of export for elevation profiles.
Abstract base class for objects which generate elevation profiles.
Abstract base class for storage of elevation profiles.
Interface for classes which can generate elevation profiles.
QgsRange which stores a range of double values.
Base class for feedback objects to be used for cancellation of something running in a worker thread.
A line symbol type, for rendering LineString and MultiLineString geometries.
Encapsulates the context in which an elevation profile is to be generated.
Encapsulates the context of identifying profile results.
void setSubsectionsSymbol(QgsLineSymbol *symbol)
Sets the symbol used to draw the subsections.
QgsProfileSnapResult snapPoint(const QgsProfilePoint &point, const QgsProfileSnapContext &context)
Snap a point to the results.
void render(QgsRenderContext &context, double width, double height, double distanceMin, double distanceMax, double zMin, double zMax, const QString &sourceId=QString())
Renders a portion of the profile using the specified render context.
void renderSubsectionsIndicator(QgsRenderContext &context, const QRectF &plotArea, double distanceMin, double distanceMax, double zMin, double zMax)
Renders the vertices of the profile curve as vertical lines using the specified render context.
void regenerateInvalidatedResults()
Starts a background regeneration of any invalidated results and immediately returns.
QVector< QgsAbstractProfileResults::Feature > asFeatures(Qgis::ProfileExportType type, QgsFeedback *feedback=nullptr)
Exports the profile results as a set of features.
QImage renderToImage(int width, int height, double distanceMin, double distanceMax, double zMin, double zMax, const QString &sourceId=QString(), double devicePixelRatio=1.0)
Renders a portion of the profile to an image with the given width and height.
void cancelGenerationWithoutBlocking()
Triggers cancellation of the generation job without blocking.
QgsLineSymbol * subsectionsSymbol()
Returns the line symbol used to draw the subsections.
void invalidateAllRefinableSources()
Invalidates previous results from all refinable sources.
void cancelGeneration()
Stop the generation job - does not return until the job has terminated.
QgsProfilePlotRenderer(const QList< QgsAbstractProfileSource * > &sources, const QgsProfileRequest &request)
Constructor for QgsProfilePlotRenderer, using the provided list of profile sources to generate the re...
void generateSynchronously()
Generate the profile results synchronously in this thread.
void startGeneration()
Start the generation job and immediately return.
QgsDoubleRange zRange() const
Returns the limits of the retrieved elevation values.
QVector< QgsProfileIdentifyResults > identify(const QgsProfilePoint &point, const QgsProfileIdentifyContext &context)
Identify results visible at the specified profile point.
void waitForFinished()
Block until the current job has finished.
bool isActive() const
Returns true if the generation job is currently running in background.
QStringList sourceIds() const
Returns the ordered list of source IDs for the sources used by the renderer.
bool invalidateResults(QgsAbstractProfileSource *source)
Invalidates the profile results from the source with matching ID.
void replaceSource(QgsAbstractProfileSource *source)
Replaces the existing source with matching ID.
void setContext(const QgsProfileGenerationContext &context)
Sets the context in which the profile generation will occur.
void generationFinished()
Emitted when the profile generation is finished (or canceled).
static std::unique_ptr< QgsLineSymbol > defaultSubSectionsSymbol()
Returns the default line symbol to use for subsections lines.
Encapsulates a point on a distance-elevation profile.
Encapsulates properties and constraints relating to fetching elevation profiles from different source...
Encapsulates the context of snapping a profile point.
Encapsulates results of snapping a profile point.
Contains information about the context of a rendering operation.