19#include "moc_qgslayoutitemelevationprofile.cpp" 
   41#define CACHE_SIZE_LIMIT 5000 
   44class QgsLayoutItemElevationProfilePlot : 
public Qgs2DPlot 
   48    QgsLayoutItemElevationProfilePlot()
 
   62        const double distanceMin = 
xMinimum() * xScale;
 
   63        const double distanceMax = 
xMaximum() * xScale;
 
   64        rc.
painter()->translate( plotArea.left(), plotArea.top() );
 
   65        mRenderer->render( rc, plotArea.width(), plotArea.height(), distanceMin, distanceMax, yMinimum(), 
yMaximum() );
 
   66        rc.
painter()->translate( -plotArea.left(), -plotArea.top() );
 
   67        mRenderer->renderSubsectionsIndicator( rc, plotArea, distanceMin, distanceMax, 
yMinimum(), 
yMaximum() );
 
   82  , mPlot( std::make_unique< QgsLayoutItemElevationProfilePlot >() )
 
   84  mBackgroundUpdateTimer = 
new QTimer( 
this );
 
   85  mBackgroundUpdateTimer->setSingleShot( 
true );
 
   86  connect( mBackgroundUpdateTimer, &QTimer::timeout, 
this, &QgsLayoutItemElevationProfile::recreateCachedImageInBackground );
 
   88  setCacheMode( QGraphicsItem::NoCache );
 
 
  110    mRenderJob->cancelGeneration(); 
 
 
  134  bool forceUpdate = 
false;
 
  139    double value = mTolerance;
 
  159    double value = mPlot->xMinimum();
 
  170      mPlot->setXMinimum( value );
 
  179    double value = mPlot->xMaximum();
 
  190      mPlot->setXMaximum( value );
 
  199    double value = mPlot->yMinimum();
 
  210      mPlot->setYMinimum( value );
 
  219    double value = mPlot->yMaximum();
 
  230      mPlot->setYMaximum( value );
 
  239    double value = mPlot->xAxis().gridIntervalMajor();
 
  250      mPlot->xAxis().setGridIntervalMajor( value );
 
  259    double value = mPlot->xAxis().gridIntervalMinor();
 
  270      mPlot->xAxis().setGridIntervalMinor( value );
 
  279    double value = mPlot->xAxis().labelInterval();
 
  290      mPlot->xAxis().setLabelInterval( value );
 
  299    double value = mPlot->yAxis().gridIntervalMajor();
 
  310      mPlot->yAxis().setGridIntervalMajor( value );
 
  319    double value = mPlot->yAxis().gridIntervalMinor();
 
  330      mPlot->yAxis().setGridIntervalMinor( value );
 
  339    double value = mPlot->yAxis().labelInterval();
 
  350      mPlot->yAxis().setLabelInterval( value );
 
  359    double value = mPlot->margins().left();
 
  372      mPlot->setMargins( margins );
 
  381    double value = mPlot->margins().right();
 
  394      mPlot->setMargins( margins );
 
  403    double value = mPlot->margins().top();
 
  416      mPlot->setMargins( margins );
 
  425    double value = mPlot->margins().bottom();
 
  438      mPlot->setMargins( margins );
 
  446    mCacheInvalidated = 
true;
 
 
  462  return blendMode() != QPainter::CompositionMode_SourceOver;
 
 
  467  return mEvaluatedOpacity < 1.0;
 
 
  482  return _qgis_listRefToRaw( mLayers );
 
 
  487  if ( 
layers == _qgis_listRefToRaw( mLayers ) )
 
  490  mLayers = _qgis_listRawToRef( 
layers );
 
 
  496  mCurve.reset( curve );
 
 
  535  mAtlasDriven = enabled;
 
 
  561  if ( !
mLayout || !painter || !painter->device() || !mUpdatesEnabled )
 
  570  QRectF thisPaintRect = rect();
 
  574  if ( 
mLayout->renderContext().isPreviewRender() )
 
  580    painter->setClipRect( thisPaintRect );
 
  581    if ( !mCacheFinalImage || mCacheFinalImage->isNull() )
 
  584      painter->setBrush( QBrush( QColor( 125, 125, 125, 125 ) ) );
 
  585      painter->drawRect( thisPaintRect );
 
  586      painter->setBrush( Qt::NoBrush );
 
  588      messageFont.setPointSize( 12 );
 
  589      painter->setFont( messageFont );
 
  590      painter->setPen( QColor( 255, 255, 255, 255 ) );
 
  591      painter->drawText( thisPaintRect, Qt::AlignCenter | Qt::AlignHCenter, tr( 
"Rendering profile" ) );
 
  594        ( mRenderJob && mCacheInvalidated && !mDrawingPreview ) 
 
  596        ( !mRenderJob && !mDrawingPreview ) 
 
  601        mBackgroundUpdateTimer->start( 1 );
 
  606      if ( mCacheInvalidated && !mDrawingPreview )
 
  610        mBackgroundUpdateTimer->start( 1 );
 
  615      double imagePixelWidth = mCacheFinalImage->width(); 
 
  616      double scale = rect().width() / imagePixelWidth;
 
  620      painter->scale( scale, scale );
 
  621      painter->setCompositionMode( blendModeForRender() );
 
  622      painter->drawImage( 0, 0, *mCacheFinalImage );
 
  625    painter->setClipRect( thisPaintRect, Qt::NoClip );
 
  638    QPaintDevice *paintDevice = painter->device();
 
  645      painter->setRenderHint( QPainter::LosslessImageRendering, 
true );
 
  658        int widthInPixels = 
static_cast< int >( std::round( boundingRect().width() * layoutUnitsInInches * destinationDpi ) );
 
  659        int heightInPixels = 
static_cast< int >( std::round( boundingRect().height() * layoutUnitsInInches * destinationDpi ) );
 
  660        QImage image = QImage( widthInPixels, heightInPixels, QImage::Format_ARGB32 );
 
  662        image.fill( Qt::transparent );
 
  663        image.setDotsPerMeterX( 
static_cast< int >( std::round( 1000 * destinationDpi / 25.4 ) ) );
 
  664        image.setDotsPerMeterY( 
static_cast< int >( std::round( 1000 * destinationDpi / 25.4 ) ) );
 
  665        double dotsPerMM = destinationDpi / 25.4;
 
  666        layoutSize *= dotsPerMM; 
 
  667        QPainter p( &image );
 
  668        preparePainter( &p );
 
  673        p.scale( dotsPerMM, dotsPerMM );
 
  679        p.scale( 1.0 / dotsPerMM, 1.0 / dotsPerMM );
 
  681        const double mapUnitsPerPixel = 
static_cast<double>( mPlot->xMaximum() - mPlot->xMinimum() ) * mPlot->xScale / layoutSize.width();
 
  684        QList< QgsAbstractProfileSource * > sources;
 
  689            sources.append( source );
 
  697        mPlot->setRenderer( &renderer );
 
  700        mPlot->setSize( layoutSize );
 
  704        mPlot->setRenderer( 
nullptr );
 
  706        p.scale( dotsPerMM, dotsPerMM );
 
  714        painter->setCompositionMode( blendModeForRender() );
 
  715        painter->scale( 1 / dotsPerMM, 1 / dotsPerMM ); 
 
  716        painter->drawImage( 0, 0, image );
 
  717        painter->scale( dotsPerMM, dotsPerMM );
 
  732        double dotsPerMM = paintDevice->logicalDpiX() / 25.4;
 
  733        layoutSize *= dotsPerMM; 
 
  734        painter->scale( 1 / dotsPerMM, 1 / dotsPerMM ); 
 
  736        const double mapUnitsPerPixel = 
static_cast<double>( mPlot->xMaximum() - mPlot->xMinimum() ) * mPlot->xScale / layoutSize.width();
 
  739        QList< QgsAbstractProfileSource * > sources;
 
  744            sources.append( source );
 
  758        mPlot->setRenderer( &renderer );
 
  761        mPlot->setSize( layoutSize );
 
  765        mPlot->setRenderer( 
nullptr );
 
  767        painter->setClipRect( thisPaintRect, Qt::NoClip );
 
 
  782  if ( mAtlasDriven && 
mLayout && 
mLayout->reportContext().layer() )
 
  791      if ( 
const QgsCurve *curve = qgsgeometry_cast< const QgsCurve * >( geom->simplifiedTypeRef() ) )
 
  793        mCurve.reset( curve->clone() );
 
 
  806  mCacheInvalidated = 
true;
 
 
  817    QDomElement plotElement = doc.createElement( QStringLiteral( 
"plot" ) );
 
  818    mPlot->writeXml( plotElement, doc, rwContext );
 
  819    layoutProfileElem.appendChild( plotElement );
 
  822  layoutProfileElem.setAttribute( QStringLiteral( 
"distanceUnit" ), 
qgsEnumValueToKey( mDistanceUnit ) );
 
  824  layoutProfileElem.setAttribute( QStringLiteral( 
"tolerance" ), mTolerance );
 
  825  layoutProfileElem.setAttribute( QStringLiteral( 
"atlasDriven" ), mAtlasDriven ? QStringLiteral( 
"1" ) : QStringLiteral( 
"0" ) );
 
  828    QDomElement crsElem = doc.createElement( QStringLiteral( 
"crs" ) );
 
  830    layoutProfileElem.appendChild( crsElem );
 
  834    QDomElement curveElem = doc.createElement( QStringLiteral( 
"curve" ) );
 
  835    curveElem.appendChild( doc.createTextNode( mCurve->asWkt( ) ) );
 
  836    layoutProfileElem.appendChild( curveElem );
 
  840    QDomElement layersElement = doc.createElement( QStringLiteral( 
"layers" ) );
 
  843      QDomElement layerElement = doc.createElement( QStringLiteral( 
"layer" ) );
 
  844      layer.writeXml( layerElement, rwContext );
 
  845      layersElement.appendChild( layerElement );
 
  847    layoutProfileElem.appendChild( layersElement );
 
  850  if ( mSubsectionsSymbol )
 
  852    QDomElement subsectionsElement = doc.createElement( QStringLiteral( 
"subsections" ) );
 
  854    subsectionsElement.appendChild( symbolElement );
 
  855    layoutProfileElem.appendChild( subsectionsElement );
 
 
  863  const QDomElement plotElement = itemElem.firstChildElement( QStringLiteral( 
"plot" ) );
 
  864  if ( !plotElement.isNull() )
 
  866    mPlot->readXml( plotElement, context );
 
  869  const QDomNodeList crsNodeList = itemElem.elementsByTagName( QStringLiteral( 
"crs" ) );
 
  871  if ( !crsNodeList.isEmpty() )
 
  873    const QDomElement crsElem = crsNodeList.at( 0 ).toElement();
 
  880  const QDomNodeList curveNodeList = itemElem.elementsByTagName( QStringLiteral( 
"curve" ) );
 
  881  if ( !curveNodeList.isEmpty() )
 
  883    const QDomElement curveElem = curveNodeList.at( 0 ).toElement();
 
  885    if ( 
const QgsCurve *curveGeom = qgsgeometry_cast< const QgsCurve * >( curve.
constGet() ) )
 
  887      mCurve.reset( curveGeom->clone() );
 
  895  mTolerance = itemElem.attribute( QStringLiteral( 
"tolerance" ) ).toDouble();
 
  896  mAtlasDriven = 
static_cast< bool >( itemElem.attribute( QStringLiteral( 
"atlasDriven" ), QStringLiteral( 
"0" ) ).toInt() );
 
  900    const QDomElement layersElement = itemElem.firstChildElement( QStringLiteral( 
"layers" ) );
 
  901    QDomElement layerElement = layersElement.firstChildElement( QStringLiteral( 
"layer" ) );
 
  902    while ( !layerElement.isNull() )
 
  905      ref.
readXml( layerElement, context );
 
  907      mLayers.append( ref );
 
  909      layerElement = layerElement.nextSiblingElement( QStringLiteral( 
"layer" ) );
 
  913  const QDomElement subsectionsElement = itemElem.firstChildElement( QStringLiteral( 
"subsections" ) );
 
  914  const QDomElement symbolsElement = subsectionsElement.firstChildElement( QStringLiteral( 
"symbol" ) );
 
  915  if ( !symbolsElement.isNull() )
 
  917    std::unique_ptr< QgsLineSymbol > subSectionsSymbol = QgsSymbolLayerUtils::loadSymbol<QgsLineSymbol >( symbolsElement, context );
 
  918    if ( subSectionsSymbol )
 
 
  928void QgsLayoutItemElevationProfile::recreateCachedImageInBackground()
 
  934    QPainter *oldPainter = mPainter.release();
 
  935    QImage *oldImage = mCacheRenderingImage.release();
 
  938      oldJob->deleteLater();
 
  946    mCacheRenderingImage.reset( 
nullptr );
 
  950  Q_ASSERT( !mRenderJob );
 
  951  Q_ASSERT( !mPainter );
 
  952  Q_ASSERT( !mCacheRenderingImage );
 
  955  double widthLayoutUnits = layoutSize.width();
 
  956  double heightLayoutUnits = layoutSize.height();
 
  958  int w = 
static_cast< int >( std::round( widthLayoutUnits * mPreviewScaleFactor ) );
 
  959  int h = 
static_cast< int >( std::round( heightLayoutUnits * mPreviewScaleFactor ) );
 
  962  if ( w > 5000 || h > 5000 )
 
  967      h = 
static_cast< int>( std::round( w * heightLayoutUnits / widthLayoutUnits ) );
 
  972      w = 
static_cast< int >( std::round( h * widthLayoutUnits / heightLayoutUnits ) );
 
  976  if ( w <= 0 || h <= 0 )
 
  979  mCacheRenderingImage.reset( 
new QImage( w, h, QImage::Format_ARGB32 ) );
 
  982  mCacheRenderingImage->setDotsPerMeterX( 
static_cast< int >( std::round( 1000 * w / widthLayoutUnits ) ) );
 
  983  mCacheRenderingImage->setDotsPerMeterY( 
static_cast< int >( std::round( 1000 * h / heightLayoutUnits ) ) );
 
  986  mCacheRenderingImage->fill( Qt::transparent );
 
  993  mCacheInvalidated = 
false;
 
  994  mPainter.reset( 
new QPainter( mCacheRenderingImage.get() ) );
 
  996  QList< QgsAbstractProfileSource * > sources;
 
 1001      sources.append( source );
 
 1004  mRenderJob = std::make_unique< QgsProfilePlotRenderer >( sources, 
profileRequest() );
 
 1006  mRenderJob->setSubsectionsSymbol( rendererSubSectionsSymbol.release() );
 
 1008  mRenderJob->startGeneration();
 
 1010  mDrawingPreview = 
false;
 
 1013void QgsLayoutItemElevationProfile::profileGenerationFinished()
 
 1015  mPlot->setRenderer( mRenderJob.get() );
 
 1021  const double mapUnitsPerPixel = 
static_cast< double >( mPlot->xMaximum() - mPlot->xMinimum() ) * mPlot->xScale /
 
 1022                                  mCacheRenderingImage->size().width();
 
 1026  mPlot->setSize( mCacheRenderingImage->size() );
 
 1028  mPlot->render( rc );
 
 1030  mPlot->setRenderer( 
nullptr );
 
 1033  mRenderJob.reset( 
nullptr );
 
 1034  mPainter.reset( 
nullptr );
 
 1035  mCacheFinalImage = std::move( mCacheRenderingImage );
 
 1043  return mDistanceUnit;
 
 
 1048  mDistanceUnit = unit;
 
 1050  switch ( mDistanceUnit )
 
 1104      mPlot->xAxis().setLabelSuffix( QObject::tr( 
"°" ) );
 
 1108      mPlot->xAxis().setLabelSuffix( QString() );
 
 
 1115  mSubsectionsSymbol.reset( symbol );
 
 
@ ForceVector
Always force vector-based rendering, even when the result will be visually different to a raster-base...
 
DistanceUnit
Units of distance.
 
@ YardsBritishSears1922Truncated
British yards (Sears 1922 truncated)
 
@ MilesUSSurvey
US Survey miles.
 
@ LinksBritishSears1922
British links (Sears 1922)
 
@ YardsBritishBenoit1895A
British yards (Benoit 1895 A)
 
@ LinksBritishBenoit1895A
British links (Benoit 1895 A)
 
@ Centimeters
Centimeters.
 
@ YardsIndian1975
Indian yards (1975)
 
@ FeetUSSurvey
US Survey feet.
 
@ Millimeters
Millimeters.
 
@ FeetBritishSears1922
British feet (Sears 1922)
 
@ YardsClarkes
Clarke's yards.
 
@ YardsIndian
Indian yards.
 
@ FeetBritishBenoit1895B
British feet (Benoit 1895 B)
 
@ Miles
Terrestrial miles.
 
@ LinksUSSurvey
US Survey links.
 
@ ChainsUSSurvey
US Survey chains.
 
@ FeetClarkes
Clarke's feet.
 
@ Unknown
Unknown distance unit.
 
@ FeetBritish1936
British feet (1936)
 
@ FeetIndian1962
Indian feet (1962)
 
@ YardsBritishSears1922
British yards (Sears 1922)
 
@ FeetIndian1937
Indian feet (1937)
 
@ YardsIndian1937
Indian yards (1937)
 
@ Degrees
Degrees, for planar geographic CRS distance measurements.
 
@ ChainsBritishBenoit1895B
British chains (Benoit 1895 B)
 
@ LinksBritishSears1922Truncated
British links (Sears 1922 truncated)
 
@ ChainsBritishBenoit1895A
British chains (Benoit 1895 A)
 
@ YardsBritishBenoit1895B
British yards (Benoit 1895 B)
 
@ FeetBritish1865
British feet (1865)
 
@ YardsIndian1962
Indian yards (1962)
 
@ FeetBritishSears1922Truncated
British feet (Sears 1922 truncated)
 
@ MetersGermanLegal
German legal meter.
 
@ LinksBritishBenoit1895B
British links (Benoit 1895 B)
 
@ ChainsInternational
International chains.
 
@ LinksInternational
International links.
 
@ ChainsBritishSears1922Truncated
British chains (Sears 1922 truncated)
 
@ FeetIndian
Indian (geodetic) feet.
 
@ NauticalMiles
Nautical miles.
 
@ ChainsClarkes
Clarke's chains.
 
@ LinksClarkes
Clarke's links.
 
@ ChainsBritishSears1922
British chains (Sears 1922)
 
@ FeetIndian1975
Indian feet (1975)
 
@ FeetGoldCoast
Gold Coast feet.
 
@ FeetBritishBenoit1895A
British feet (Benoit 1895 A)
 
@ LosslessImageRendering
Render images losslessly whenever possible, instead of the default lossy jpeg rendering used for some...
 
Base class for 2-dimensional plot/chart/graphs.
 
double yMaximum() const
Returns the maximum value of the y axis.
 
double xMaximum() const
Returns the maximum value of the x axis.
 
double xMinimum() const
Returns the minimum value of the x axis.
 
double yMinimum() const
Returns the minimum value of the y axis.
 
virtual void renderContent(QgsRenderContext &context, const QRectF &plotArea)
Renders the plot content.
 
Abstract base class for all geometries.
 
Interface for classes which can generate elevation profiles.
 
double valueAsDouble(int key, const QgsExpressionContext &context, double defaultValue=0.0, bool *ok=nullptr) const
Calculates the current value of the property with the specified key and interprets it as a double.
 
Abstract base class for terrain providers.
 
static QIcon getThemeIcon(const QString &name, const QColor &fillColor=QColor(), const QColor &strokeColor=QColor())
Helper to get a theme icon.
 
static QgsProfileSourceRegistry * profileSourceRegistry()
Returns registry of available profile source implementations.
 
Represents a coordinate reference system (CRS).
 
bool isValid() const
Returns whether this CRS is correctly initialized and usable.
 
bool readXml(const QDomNode &node)
Restores state from the given DOM node.
 
bool writeXml(QDomNode &node, QDomDocument &doc) const
Stores state to the given Dom node in the given document.
 
Qgis::DistanceUnit mapUnits
 
Abstract base class for curved geometry type.
 
Expression contexts are used to encapsulate the parameters around which a QgsExpression should be eva...
 
A geometry is the spatial representation of a feature.
 
const QgsAbstractGeometry * constGet() const
Returns a non-modifiable (const) reference to the underlying abstract geometry primitive.
 
static Q_INVOKABLE QgsGeometry fromWkt(const QString &wkt)
Creates a new geometry from a WKT string.
 
A layout item subclass for elevation profile plots.
 
static QgsLayoutItemElevationProfile * create(QgsLayout *layout)
Returns a new elevation profile item for the specified layout.
 
~QgsLayoutItemElevationProfile() override
 
QgsCurve * profileCurve() const
Returns the cross section profile curve, which represents the line along which the profile should be ...
 
void refreshDataDefinedProperty(QgsLayoutObject::DataDefinedProperty property=QgsLayoutObject::DataDefinedProperty::AllProperties) override
Refreshes a data defined property for the item by reevaluating the property's value and redrawing the...
 
void setLayers(const QList< QgsMapLayer * > &layers)
Sets the list of map layers participating in the elevation profile.
 
void setSubsectionsSymbol(QgsLineSymbol *symbol)
Sets the symbol used to draw the subsections.
 
QList< QgsMapLayer * > layers() const
Returns the list of map layers participating in the elevation profile.
 
void invalidateCache() override
 
void setCrs(const QgsCoordinateReferenceSystem &crs)
Sets the desired Coordinate Reference System (crs) for the profile.
 
bool writePropertiesToElement(QDomElement &element, QDomDocument &document, const QgsReadWriteContext &context) const override
Stores item state within an XML DOM element.
 
void draw(QgsLayoutItemRenderContext &context) override
Draws the item's contents using the specified item render context.
 
QgsLayoutItem::Flags itemFlags() const override
Returns the item's flags, which indicate how the item behaves.
 
void setDistanceUnit(Qgis::DistanceUnit unit)
Sets the unit for the distance axis.
 
Qgs2DPlot * plot()
Returns a reference to the elevation plot object, which can be used to set plot appearance and proper...
 
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.
 
void setAtlasDriven(bool enabled)
Sets whether the profile curve will follow the current atlas feature.
 
double tolerance() const
Returns the tolerance of the request (in crs() units).
 
QgsLineSymbol * subsectionsSymbol()
Returns the symbol used to draw the subsections.
 
Qgis::DistanceUnit distanceUnit() const
Returns the units for the distance axis.
 
bool requiresRasterization() const override
Returns true if the item is drawn in such a way that forces the whole layout to be rasterized when ex...
 
bool containsAdvancedEffects() const override
Returns true if the item contains contents with blend modes or transparency effects which can only be...
 
void paint(QPainter *painter, const QStyleOptionGraphicsItem *itemStyle, QWidget *pWidget) override
 
QIcon icon() const override
Returns the item's icon.
 
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...
 
bool readPropertiesFromElement(const QDomElement &element, const QDomDocument &document, const QgsReadWriteContext &context) override
Sets item state from a DOM element.
 
QgsProfileRequest profileRequest() const
Returns the profile request used to generate the elevation profile.
 
int type() const override
 
@ LayoutElevationProfile
Elevation profile item.
 
Contains settings and helpers relating to a render of a QgsLayoutItem.
 
Base class for graphical items within a QgsLayout.
 
virtual void drawFrame(QgsRenderContext &context)
Draws the frame around the item.
 
QColor backgroundColor(bool useDataDefined=true) const
Returns the background color for this item.
 
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...
 
QgsLayoutSize sizeWithUnits() const
Returns the item's current size, including units.
 
void refreshItemSize()
Refreshes an item's size by rechecking it against any possible item fixed or minimum sizes.
 
QgsExpressionContext createExpressionContext() const override
This method needs to be reimplemented in all classes which implement this interface and return an exp...
 
virtual void drawBackground(QgsRenderContext &context)
Draws the background for the item.
 
bool shouldDrawItem() const
Returns whether the item should be drawn in the current context.
 
@ FlagOverridesPaint
Item overrides the default layout item painting method.
 
@ FlagDisableSceneCaching
Item should not have QGraphicsItem caching enabled.
 
void sizePositionChanged()
Emitted when the item's size or position changes.
 
bool frameEnabled() const
Returns true if the item includes a frame.
 
bool hasBackground() const
Returns true if the item has a background.
 
void refresh() override
Refreshes the item, causing a recalculation of any property overrides and recalculation of its positi...
 
friend class QgsLayoutItemElevationProfile
 
void setBackgroundEnabled(bool drawBackground)
Sets whether this item has a background drawn under it or not.
 
QPainter::CompositionMode blendMode() const
Returns the item's composition blending mode.
 
void backgroundTaskCountChanged(int count)
Emitted whenever the number of background tasks an item is executing changes.
 
QgsPropertyCollection mDataDefinedProperties
 
const QgsLayout * layout() const
Returns the layout the object is attached to.
 
QPointer< QgsLayout > mLayout
 
DataDefinedProperty
Data defined properties for different item types.
 
@ ElevationProfileMaximumDistance
Maximum distance value for elevation profile.
 
@ MarginBottom
Bottom margin.
 
@ ElevationProfileElevationMinorInterval
Minor grid line interval for elevation profile elevation axis.
 
@ ElevationProfileDistanceMinorInterval
Minor grid line interval for elevation profile distance axis.
 
@ ElevationProfileMinimumDistance
Minimum distance value for elevation profile.
 
@ ElevationProfileMaximumElevation
Maximum elevation value for elevation profile.
 
@ ElevationProfileDistanceLabelInterval
Label interval for elevation profile distance axis.
 
@ ElevationProfileTolerance
Tolerance distance for elevation profiles.
 
@ ElevationProfileMinimumElevation
Minimum elevation value for elevation profile.
 
@ MarginRight
Right margin.
 
@ ElevationProfileElevationLabelInterval
Label interval for elevation profile elevation axis.
 
@ ElevationProfileDistanceMajorInterval
Major grid line interval for elevation profile distance axis.
 
@ ElevationProfileElevationMajorInterval
Major grid line interval for elevation profile elevation axis.
 
@ AllProperties
All properties for item.
 
static QgsRenderContext createRenderContextForLayout(QgsLayout *layout, QPainter *painter, double dpi=-1)
Creates a render context suitable for the specified layout and painter destination.
 
static Q_DECL_DEPRECATED double scaleFactorFromItemStyle(const QStyleOptionGraphicsItem *style)
Extracts the scale factor from an item style.
 
Base class for layouts, which can contain items such as maps, labels, scalebars, etc.
 
void refreshed()
Emitted when the layout has been refreshed and items should also be refreshed and updated.
 
A line symbol type, for rendering LineString and MultiLineString geometries.
 
Perform transforms between map coordinates and device coordinates.
 
Defines the four margins of a rectangle.
 
void setBottom(double bottom)
Sets the bottom margin to bottom.
 
void setLeft(double left)
Sets the left margin to left.
 
void setRight(double right)
Sets the right margin to right.
 
void setTop(double top)
Sets the top margin to top.
 
static void logMessage(const QString &message, const QString &tag=QString(), Qgis::MessageLevel level=Qgis::MessageLevel::Warning, bool notifyUser=true, const char *file=__builtin_FILE(), const char *function=__builtin_FUNCTION(), int line=__builtin_LINE())
Adds a message to the log instance (and creates it if necessary).
 
Generates and renders elevation profile plots.
 
void setSubsectionsSymbol(QgsLineSymbol *symbol)
Sets the symbol used to draw the subsections.
 
void cancelGenerationWithoutBlocking()
Triggers cancellation of the generation job without blocking.
 
void generateSynchronously()
Generate the profile results synchronously in this thread.
 
void generationFinished()
Emitted when the profile generation is finished (or canceled).
 
Encapsulates properties and constraints relating to fetching elevation profiles from different source...
 
QgsProfileRequest & setExpressionContext(const QgsExpressionContext &context)
Sets the expression context used to evaluate expressions.
 
QgsProfileRequest & setTransformContext(const QgsCoordinateTransformContext &context)
Sets the transform context, for use when transforming coordinates from a source to the request's crs(...
 
QgsProfileRequest & setTerrainProvider(QgsAbstractTerrainProvider *provider)
Sets the terrain provider.
 
QgsProfileRequest & setTolerance(double tolerance)
Sets the tolerance of the request (in crs() units).
 
QgsProfileRequest & setCrs(const QgsCoordinateReferenceSystem &crs)
Sets the desired Coordinate Reference System (crs) for the profile.
 
QList< QgsAbstractProfileSource * > profileSources() const
Returns a list of registered profile sources.
 
Encapsulates a QGIS project, including sets of map layers and their styles, layouts,...
 
bool isActive(int key) const final
Returns true if the collection contains an active property with the specified key.
 
A container for the context for various read/write operations on objects.
 
Contains information about the context of a rendering operation.
 
QPainter * painter()
Returns the destination QPainter for the render operation.
 
void setMapToPixel(const QgsMapToPixel &mtp)
Sets the context's map to pixel transform, which transforms between map coordinates and device coordi...
 
void setExpressionContext(const QgsExpressionContext &context)
Sets the expression context.
 
Scoped object for saving and restoring a QPainter object's state.
 
static QDomElement saveSymbol(const QString &symbolName, const QgsSymbol *symbol, QDomDocument &doc, const QgsReadWriteContext &context)
Writes a symbol definition to XML.
 
static Q_INVOKABLE double fromUnitToUnitFactor(Qgis::DistanceUnit fromUnit, Qgis::DistanceUnit toUnit)
Returns the conversion factor between the specified distance units.
 
static Q_INVOKABLE QString toAbbreviatedString(Qgis::DistanceUnit unit)
Returns a translated abbreviation representing a distance unit.
 
Represents a vector layer which manages a vector based dataset.
 
T qgsEnumKeyToValue(const QString &key, const T &defaultValue, bool tryValueAsKey=true, bool *returnOk=nullptr)
Returns the value corresponding to the given key of an enum.
 
QString qgsEnumValueToKey(const T &value, bool *returnOk=nullptr)
Returns the value for the given key of an enum.
 
bool qgsDoubleNear(double a, double b, double epsilon=4 *std::numeric_limits< double >::epsilon())
Compare two doubles (but allow some difference)
 
const QgsCoordinateReferenceSystem & crs
 
TYPE * resolveWeakly(const QgsProject *project, MatchType matchType=MatchType::All)
Resolves the map layer by attempting to find a matching layer in a project using a weak match.
 
bool readXml(const QDomElement &element, const QgsReadWriteContext &context)
Reads the layer's properties from an XML element.