18#ifndef QGSELEVATIONPROFILECANVAS_H
19#define QGSELEVATIONPROFILECANVAS_H
29class QgsElevationProfilePlotItem;
30class QgsElevationProfileCrossHairsItem;
63 void paintEvent( QPaintEvent *event )
override;
73 void scalePlot(
double xFactor,
double yFactor );
75 void zoomToRect(
const QRectF &rect )
override;
76 void wheelZoom( QWheelEvent *event )
override;
82 QRectF plotArea()
const;
94 void invalidateCurrentPlotExtent();
109 void setLayers(
const QList< QgsMapLayer * > &layers );
116 QList< QgsMapLayer * > layers()
const;
154 void setTolerance(
double tolerance );
173 void setVisiblePlotRange(
double minimumDistance,
double maximumDistance,
double minimumElevation,
double maximumElevation );
233 bool lockAxisScales() const;
241 void setLockAxisScales(
bool lock );
249 Qgis::DistanceUnit distanceUnit() const;
257 void setDistanceUnit(
Qgis::DistanceUnit unit );
267 void setBackgroundColor( const QColor &color );
274 void activeJobCountChanged(
int count );
298 void setSnappingEnabled(
bool enabled );
302 void generationFinished();
303 void onLayerProfileGenerationPropertyChanged();
304 void onLayerProfileRendererPropertyChanged();
305 void regenerateResultsForLayer();
306 void scheduleDeferredRegeneration();
307 void scheduleDeferredRedraw();
308 void startDeferredRegeneration();
309 void startDeferredRedraw();
310 void refineResults();
314 void updateChartFromPalette();
318 void setupLayerConnections(
QgsMapLayer *layer,
bool isDisconnect );
320 void adjustRangeForAxisScaleLock(
double &xMinimum,
double &xMaximum,
double &yMinimum,
double &yMaximum ) const;
324 bool mLockAxisScales = false;
328 Qgis::DistanceUnit mDistanceUnit =
Qgis::DistanceUnit::Unknown;
332 QgsElevationProfilePlotItem *mPlotItem =
nullptr;
333 QgsElevationProfileCrossHairsItem *mCrossHairsItem =
nullptr;
336 QTimer *mDeferredRegenerationTimer =
nullptr;
337 bool mDeferredRegenerationScheduled = false;
338 QTimer *mDeferredRedrawTimer =
nullptr;
339 bool mDeferredRedrawScheduled = false;
341 std::unique_ptr<
QgsCurve > mProfileCurve;
342 double mTolerance = 0;
344 bool mFirstDrawOccurred = false;
346 bool mSnappingEnabled = true;
348 bool mZoomFullWhenJobFinished = true;
350 bool mForceRegenerationAfterCurrentJobCompletes = false;
352 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