18#ifndef QGSELEVATIONPROFILECANVAS_H
19#define QGSELEVATIONPROFILECANVAS_H
29class QgsElevationProfilePlotItem;
30class QgsElevationProfileCrossHairsItem;
61 void paintEvent( QPaintEvent *event )
override;
71 void scalePlot(
double xFactor,
double yFactor );
73 void zoomToRect(
const QRectF &rect )
override;
74 void wheelZoom( QWheelEvent *event )
override;
80 QRectF plotArea()
const;
92 void invalidateCurrentPlotExtent();
107 void setLayers(
const QList<QgsMapLayer *> &layers );
114 QList<QgsMapLayer *> layers()
const;
152 void setTolerance(
double tolerance );
171 void setVisiblePlotRange(
double minimumDistance,
double maximumDistance,
double minimumElevation,
double maximumElevation );
231 bool lockAxisScales() const;
239 void setLockAxisScales(
bool lock );
247 Qgis::DistanceUnit distanceUnit() const;
255 void setDistanceUnit(
Qgis::DistanceUnit unit );
265 void setBackgroundColor( const QColor &color );
272 void activeJobCountChanged(
int count );
296 void setSnappingEnabled(
bool enabled );
300 void generationFinished();
301 void onLayerProfileGenerationPropertyChanged();
302 void onLayerProfileRendererPropertyChanged();
303 void regenerateResultsForLayer();
304 void scheduleDeferredRegeneration();
305 void scheduleDeferredRedraw();
306 void startDeferredRegeneration();
307 void startDeferredRedraw();
308 void refineResults();
311 void updateChartFromPalette();
315 void setupLayerConnections(
QgsMapLayer *layer,
bool isDisconnect );
317 void adjustRangeForAxisScaleLock(
double &xMinimum,
double &xMaximum,
double &yMinimum,
double &yMaximum ) const;
321 bool mLockAxisScales = false;
325 Qgis::DistanceUnit mDistanceUnit =
Qgis::DistanceUnit::Unknown;
329 QgsElevationProfilePlotItem *mPlotItem =
nullptr;
330 QgsElevationProfileCrossHairsItem *mCrossHairsItem =
nullptr;
333 QTimer *mDeferredRegenerationTimer =
nullptr;
334 bool mDeferredRegenerationScheduled = false;
335 QTimer *mDeferredRedrawTimer =
nullptr;
336 bool mDeferredRedrawScheduled = false;
338 std::unique_ptr<
QgsCurve> mProfileCurve;
339 double mTolerance = 0;
341 bool mFirstDrawOccurred = false;
343 bool mSnappingEnabled = true;
345 bool mZoomFullWhenJobFinished = true;
347 bool mForceRegenerationAfterCurrentJobCompletes = false;
349 static constexpr
double MAX_ERROR_PIXELS = 2;
The Qgis class provides global constants for use throughout the application.
Base class for 2-dimensional plot/chart/graphs.
Abstract base class for storage of elevation profiles.
This class represents a coordinate reference system (CRS).
Abstract base class for curved geometry type.
QgsRange which stores a range of double values.
A canvas for elevation profiles.
double tolerance() const
Returns the tolerance of the profile (in crs() units).
Base class for all map layer types.
Plot canvas is a class for displaying interactive 2d charts and plots.
virtual void cancelJobs()
Cancel any rendering job, in a blocking way.
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.
A class to represent a 2D point.
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.
const QgsCoordinateReferenceSystem & crs