Skip to content

Commit

Permalink
[layout] Allow profiles to be displayed in layouts even if their sour…
Browse files Browse the repository at this point in the history
…ce is not a map layer (e.g., from web services)
  • Loading branch information
gacarrillor committed May 1, 2024
1 parent ee4664d commit b272322
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions src/core/layout/qgslayoutitemelevationprofile.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@
#include "qgsvectorlayer.h"
#include "qgslayoutrendercontext.h"
#include "qgslayoutreportcontext.h"
#include "qgsprofilesourceregistry.h"

#include <QTimer>

Expand Down Expand Up @@ -673,6 +674,9 @@ void QgsLayoutItemElevationProfile::paint( QPainter *painter, const QStyleOption
rc.setMapToPixel( QgsMapToPixel( mapUnitsPerPixel ) );

QList< QgsAbstractProfileSource * > sources;
QList< QgsAbstractProfileSource * > registrySources = QgsApplication::profileSourceRegistry()->profileSources();

sources << registrySources;
for ( const QgsMapLayerRef &layer : std::as_const( mLayers ) )
{
if ( QgsAbstractProfileSource *source = dynamic_cast< QgsAbstractProfileSource * >( layer.get() ) )
Expand Down Expand Up @@ -725,6 +729,9 @@ void QgsLayoutItemElevationProfile::paint( QPainter *painter, const QStyleOption
rc.setMapToPixel( QgsMapToPixel( mapUnitsPerPixel ) );

QList< QgsAbstractProfileSource * > sources;
QList< QgsAbstractProfileSource * > registrySources = QgsApplication::profileSourceRegistry()->profileSources();

sources << registrySources;
for ( const QgsMapLayerRef &layer : std::as_const( mLayers ) )
{
if ( QgsAbstractProfileSource *source = dynamic_cast< QgsAbstractProfileSource * >( layer.get() ) )
Expand Down Expand Up @@ -960,6 +967,9 @@ void QgsLayoutItemElevationProfile::recreateCachedImageInBackground()
mPainter.reset( new QPainter( mCacheRenderingImage.get() ) );

QList< QgsAbstractProfileSource * > sources;
QList< QgsAbstractProfileSource * > registrySources = QgsApplication::profileSourceRegistry()->profileSources();

sources << registrySources;
for ( const QgsMapLayerRef &layer : std::as_const( mLayers ) )
{
if ( QgsAbstractProfileSource *source = dynamic_cast< QgsAbstractProfileSource * >( layer.get() ) )
Expand Down

0 comments on commit b272322

Please sign in to comment.