18#ifndef QGSELEVATIONPROFILECANVAS_H
19#define QGSELEVATIONPROFILECANVAS_H
31class QgsElevationProfilePlotItem;
32class QgsElevationProfileCrossHairsItem;
73 void scalePlot(
double xFactor,
double yFactor );
75 void zoomToRect(
const QRectF &rect )
override;
116 QList<QgsMapLayer *>
layers()
const;
132 QList<QgsAbstractProfileSource *>
sources()
const;
189 void setVisiblePlotRange(
double minimumDistance,
double maximumDistance,
double minimumElevation,
double maximumElevation );
259 bool lockAxisScales() const;
267 void setLockAxisScales(
bool lock );
276 double axisScaleRatio() const;
290 void setAxisScaleRatio(
double scale );
298 Qgis::DistanceUnit distanceUnit() const;
306 void setDistanceUnit(
Qgis::DistanceUnit unit );
316 void setBackgroundColor( const QColor &color );
375 void generationFinished();
376 void onLayerProfileGenerationPropertyChanged();
377 void onLayerProfileRendererPropertyChanged();
378 void regenerateResultsForLayer();
379 void scheduleDeferredRegeneration();
380 void scheduleDeferredRedraw();
381 void startDeferredRegeneration();
382 void startDeferredRedraw();
383 void refineResults();
384 void setSourcesPrivate();
387 void updateChartFromPalette();
391 void setupLayerConnections(
QgsMapLayer *layer,
bool isDisconnect );
393 void adjustRangeForAxisScaleLock(
double &xMinimum,
double &xMaximum,
double &yMinimum,
double &yMaximum )
const;
397 bool mLockAxisScales =
false;
398 double mLockedAxisScale = 1;
405 QList< std::variant< QgsWeakMapLayerPointer, QgsAbstractProfileSource * > > mSources;
407 QgsElevationProfilePlotItem *mPlotItem =
nullptr;
408 QgsElevationProfileCrossHairsItem *mCrossHairsItem =
nullptr;
411 QTimer *mDeferredRegenerationTimer =
nullptr;
412 bool mDeferredRegenerationScheduled =
false;
413 QTimer *mDeferredRedrawTimer =
nullptr;
414 bool mDeferredRedrawScheduled =
false;
416 std::unique_ptr<QgsCurve> mProfileCurve;
417 double mTolerance = 0;
419 bool mFirstDrawOccurred =
false;
421 bool mSnappingEnabled =
true;
423 bool mZoomFullWhenJobFinished =
true;
425 bool mForceRegenerationAfterCurrentJobCompletes =
false;
427 static constexpr double MAX_ERROR_PIXELS = 2;
429 std::unique_ptr<QgsLineSymbol> mSubsectionsSymbol;
Provides global constants and enumerations for use throughout the application.
DistanceUnit
Units of distance.
@ Unknown
Unknown distance unit.
Base class for 2-dimensional plot/chart/graphs with an X and Y axes.
Abstract base class for storage of elevation profiles.
Represents a coordinate reference system (CRS).
Abstract base class for curved geometry type.
QgsRange which stores a range of double values.
QgsCurve * profileCurve() const
Returns the profile curve.
void setTolerance(double tolerance)
Sets the profile tolerance (in crs() units).
void setSources(const QList< QgsAbstractProfileSource * > &sources)
Sets the list of sources to include in the profile.
void setProfileCurve(QgsCurve *curve)
Sets the profile curve.
void activeJobCountChanged(int count)
Emitted when the number of active background jobs changes.
QgsElevationProfileCanvas(QWidget *parent=nullptr)
Constructor for QgsElevationProfileCanvas, with the specified parent widget.
void paintEvent(QPaintEvent *event) override
QgsCoordinateReferenceSystem crs() const override
Returns the coordinate reference system (CRS) for map coordinates used by the canvas.
void clear()
Clears the current profile.
void canvasPointHovered(const QgsPointXY &point, const QgsProfilePoint &profilePoint)
Emitted when the mouse hovers over the specified point (in canvas coordinates).
void setProject(QgsProject *project)
Sets the project associated with the profile.
QList< QgsMapLayer * > layers() const
Returns the list of layers included in the profile.
double tolerance() const
Returns the tolerance of the profile (in crs() units).
void invalidateCurrentPlotExtent()
Invalidates the current plot extent, which means that the visible plot area will be recalculated and ...
void setCrs(const QgsCoordinateReferenceSystem &crs)
Sets the crs associated with the canvas' map coordinates.
QList< QgsAbstractProfileSource * > sources() const
Returns the list of sources included in the profile.
void setLayers(const QList< QgsMapLayer * > &layers)
Sets the list of layers to include in the profile.
void zoomFull()
Zooms to the full extent of the profile.
void scaleChanged()
Emitted when the plot scale is changed.
QgsLineSymbol * subsectionsSymbol()
Returns the symbol used to draw the subsections.
void setSnappingEnabled(bool enabled)
Sets whether snapping of cursor points is enabled.
QRectF plotArea() const
Returns the interior rectangle representing the surface of the plot, in canvas coordinates.
A line symbol type, for rendering LineString and MultiLineString geometries.
Base class for all map layer types.
bool event(QEvent *e) override
virtual void cancelJobs()
Cancel any rendering job, in a blocking way.
QgsPlotCanvas(QWidget *parent=nullptr)
Constructor for QgsPlotCanvas, with the specified parent widget.
virtual void refresh()
Updates and redraws the plot.
virtual void zoomToRect(const QRectF &rect)
Zooms the plot to the specified rect in canvas units.
virtual void panContentsBy(double dx, double dy)
Pans the plot contents by dx, dy in canvas units.
virtual QgsPointXY toCanvasCoordinates(const QgsPoint &point) const
Converts a point in map coordinates to the associated canvas point.
void mouseMoveEvent(QMouseEvent *e) override
void resizeEvent(QResizeEvent *e) override
virtual void scalePlot(double factor)
Scales the plot by a specified scale factor.
virtual QgsCoordinateReferenceSystem crs() const
Returns the coordinate reference system (CRS) for map coordinates used by the canvas.
virtual void wheelZoom(QWheelEvent *event)
Zoom plot from a mouse wheel event.
virtual QgsPoint toMapCoordinates(const QgsPointXY &point) const
Converts a point on the canvas to the associated map coordinate.
virtual QgsPointXY snapToPlot(QPoint point)
Snap a canvas point to the plot.
virtual void centerPlotOn(double x, double y)
Centers the plot on the plot point corresponding to x, y in canvas units.
Point geometry type, with support for z-dimension and m-values.
Encapsulates the context of identifying profile results.
Stores identify results generated by a QgsAbstractProfileResults object.
Generates and renders elevation profile plots.
Encapsulates a point on a distance-elevation profile.
Encapsulates the context of snapping a profile point.
Encapsulates a QGIS project, including sets of map layers and their styles, layouts,...
Contains information about the context of a rendering operation.
A utility class for dynamic handling of changes to screen properties.
QList< QgsWeakMapLayerPointer > QgsWeakMapLayerPointerList
A list of weak pointers to QgsMapLayers.