17#ifndef QGSLAYOUTITEMELEVATIONPROFILE_H
18#define QGSLAYOUTITEMELEVATIONPROFILE_H
24class QgsLayoutItemElevationProfilePlot;
54 int type()
const override;
55 QIcon
icon()
const override;
78 QList< QgsMapLayer * >
layers()
const;
94 QList<QgsAbstractProfileSource *>
sources()
const;
179 void setAtlasDriven(
bool enabled );
186 void paint( QPainter *painter,
const QStyleOptionGraphicsItem *itemStyle, QWidget *pWidget )
override;
242 void recreateCachedImageInBackground();
243 void profileGenerationFinished();
244 void setSourcesPrivate();
247 std::unique_ptr< QgsLayoutItemElevationProfilePlot > mPlot;
249 QList< QgsMapLayerRef > mLayers;
250 QList< std::variant< QgsMapLayerRef, QgsAbstractProfileSource * > > mSources;
254 std::unique_ptr< QgsCurve> mCurve;
255 bool mAtlasDriven =
false;
257 double mTolerance = 0;
259 std::unique_ptr<QgsLineSymbol> mSubsectionsSymbol;
264 std::unique_ptr< QImage > mCacheFinalImage;
265 std::unique_ptr< QImage > mCacheRenderingImage;
266 bool mUpdatesEnabled =
true;
267 bool mCacheInvalidated =
true;
268 bool mDrawing =
false;
269 bool mDrawingPreview =
false;
270 QTimer *mBackgroundUpdateTimer =
nullptr;
271 double mPreviewScaleFactor = 0;
272 std::unique_ptr< QPainter > mPainter;
273 std::unique_ptr< QgsProfilePlotRenderer > mRenderJob;
DistanceUnit
Units of distance.
@ Unknown
Unknown distance unit.
Base class for 2-dimensional plot/chart/graphs with an X and Y axes.
Represents a coordinate reference system (CRS).
Abstract base class for curved geometry type.
static QgsLayoutItemElevationProfile * create(QgsLayout *layout)
Returns a new elevation profile item for the specified layout.
Qgs2DXyPlot * plot()
Returns a reference to the elevation plot object, which can be used to set plot appearance and proper...
QgsLayoutItemElevationProfile(QgsLayout *layout)
Constructor for QgsLayoutItemElevationProfile, with the specified parent layout.
QgsCurve * profileCurve() const
Returns the cross section profile curve, which represents the line along which the profile should be ...
void setLayers(const QList< QgsMapLayer * > &layers)
Sets the list of map layers participating in the elevation profile.
QList< QgsMapLayer * > layers() const
Returns the list of map layers participating in the elevation profile.
void setCrs(const QgsCoordinateReferenceSystem &crs)
Sets the desired Coordinate Reference System (crs) for the profile.
QList< QgsAbstractProfileSource * > sources() const
Returns the list of sources participating in the elevation profile.
void setTolerance(double tolerance)
Sets the tolerance of the request (in crs() units).
QgsCoordinateReferenceSystem crs() const
Returns the desired Coordinate Reference System for the profile.
double tolerance() const
Returns the tolerance of the request (in crs() units).
QgsLineSymbol * subsectionsSymbol()
Returns the symbol used to draw the subsections.
bool atlasDriven() const
Returns whether the profile curve is set to follow the current atlas feature.
void setSources(const QList< QgsAbstractProfileSource * > &sources)
Sets the list of sources participating in the elevation profile.
void previewRefreshed()
Emitted whenever the item's preview has been refreshed.
void setProfileCurve(QgsCurve *curve)
Sets the cross section profile curve, which represents the line along which the profile should be gen...
Contains settings and helpers relating to a render of a QgsLayoutItem.
virtual void refreshDataDefinedProperty(QgsLayoutObject::DataDefinedProperty property=QgsLayoutObject::DataDefinedProperty::AllProperties)
Refreshes a data defined property for the item by reevaluating the property's value and redrawing the...
QgsLayoutItem(QgsLayout *layout, bool manageZValue=true)
Constructor for QgsLayoutItem, with the specified parent layout.
virtual QIcon icon() const
Returns the item's icon.
void paint(QPainter *painter, const QStyleOptionGraphicsItem *itemStyle, QWidget *pWidget) override
Handles preparing a paint surface for the layout item and painting the item's content.
virtual bool writePropertiesToElement(QDomElement &element, QDomDocument &document, const QgsReadWriteContext &context) const
Stores item state within an XML DOM element.
int type() const override
Returns a unique graphics item type identifier.
virtual bool requiresRasterization() const
Returns true if the item is drawn in such a way that forces the whole layout to be rasterized when ex...
virtual bool containsAdvancedEffects() const
Returns true if the item contains contents with blend modes or transparency effects which can only be...
virtual void invalidateCache()
Forces a deferred update of any cached image the item uses.
virtual Flags itemFlags() const
Returns the item's flags, which indicate how the item behaves.
virtual bool readPropertiesFromElement(const QDomElement &element, const QDomDocument &document, const QgsReadWriteContext &context)
Sets item state from a DOM element.
void refresh() override
Refreshes the item, causing a recalculation of any property overrides and recalculation of its positi...
friend class QgsLayoutItemElevationProfile
virtual void draw(QgsLayoutItemRenderContext &context)=0
Draws the item's contents using the specified item render context.
const QgsLayout * layout() const
Returns the layout the object is attached to.
DataDefinedProperty
Data defined properties for different item types.
@ AllProperties
All properties for item.
A line symbol type, for rendering LineString and MultiLineString geometries.
Generates and renders elevation profile plots.
Encapsulates properties and constraints relating to fetching elevation profiles from different source...
A container for the context for various read/write operations on objects.