Skip to content
Permalink
Browse files

avoid forward declaration of QgsDataDefinedSizeLegend (fixes windows …

…build)
  • Loading branch information
jef-n committed Jun 25, 2017
1 parent d79b18f commit 1c1e771c8554de9e6c5cd7f700e1c2a88d420b67
@@ -729,6 +729,11 @@ QgsDataDefinedSizeLegendNode::QgsDataDefinedSizeLegendNode( QgsLayerTreeLayer *n
{
}

QgsDataDefinedSizeLegendNode::~QgsDataDefinedSizeLegendNode()
{
delete mSettings;
}

QVariant QgsDataDefinedSizeLegendNode::data( int role ) const
{
if ( role == Qt::DecorationRole )
@@ -391,15 +391,15 @@ class CORE_EXPORT QgsDataDefinedSizeLegendNode : public QgsLayerTreeModelLegendN
public:
//! Construct the node using QgsDataDefinedSizeLegend as definition of the node's appearance
QgsDataDefinedSizeLegendNode( QgsLayerTreeLayer *nodeLayer, const QgsDataDefinedSizeLegend &settings, QObject *parent SIP_TRANSFERTHIS = nullptr );
~QgsDataDefinedSizeLegendNode();

virtual QVariant data( int role ) const override;

ItemMetrics draw( const QgsLegendSettings &settings, ItemContext *ctx ) override;

private:
void cacheImage() const;

std::unique_ptr<QgsDataDefinedSizeLegend> mSettings;
QgsDataDefinedSizeLegend *mSettings = nullptr;
mutable QImage mImage;
};

@@ -613,6 +613,11 @@ QgsLinearlyInterpolatedDiagramRenderer::QgsLinearlyInterpolatedDiagramRenderer(
{
}

QgsLinearlyInterpolatedDiagramRenderer::~QgsLinearlyInterpolatedDiagramRenderer()
{
delete mDataDefinedSizeLegend;
}

QgsLinearlyInterpolatedDiagramRenderer *QgsLinearlyInterpolatedDiagramRenderer::clone() const
{
return new QgsLinearlyInterpolatedDiagramRenderer( *this );
@@ -683,17 +688,19 @@ void QgsLinearlyInterpolatedDiagramRenderer::readXml( const QDomElement &elem, c
mSettings.readXml( settingsElem );
}

delete mDataDefinedSizeLegend;

QDomElement ddsLegendSizeElem = elem.firstChildElement( "data-defined-size-legend" );
if ( !ddsLegendSizeElem.isNull() )
{
mDataDefinedSizeLegend.reset( QgsDataDefinedSizeLegend::readXml( ddsLegendSizeElem, context ) );
mDataDefinedSizeLegend = QgsDataDefinedSizeLegend::readXml( ddsLegendSizeElem, context );
}
else
{
// pre-3.0 projects
if ( elem.attribute( QStringLiteral( "sizeLegend" ), QStringLiteral( "0" ) ) != QLatin1String( "0" ) )
{
mDataDefinedSizeLegend.reset( new QgsDataDefinedSizeLegend() );
mDataDefinedSizeLegend = new QgsDataDefinedSizeLegend();
QDomElement sizeLegendSymbolElem = elem.firstChildElement( QStringLiteral( "symbol" ) );
if ( !sizeLegendSymbolElem.isNull() && sizeLegendSymbolElem.attribute( QStringLiteral( "name" ) ) == QLatin1String( "sizeSymbol" ) )
{
@@ -702,7 +709,7 @@ void QgsLinearlyInterpolatedDiagramRenderer::readXml( const QDomElement &elem, c
}
else
{
mDataDefinedSizeLegend.reset( nullptr );
mDataDefinedSizeLegend = nullptr;
}
}

@@ -808,10 +815,11 @@ QList< QgsLayerTreeModelLegendNode * > QgsLinearlyInterpolatedDiagramRenderer::l

void QgsLinearlyInterpolatedDiagramRenderer::setDataDefinedSizeLegend( QgsDataDefinedSizeLegend *settings )
{
mDataDefinedSizeLegend.reset( settings );
delete settings;
mDataDefinedSizeLegend = settings;
}

QgsDataDefinedSizeLegend *QgsLinearlyInterpolatedDiagramRenderer::dataDefinedSizeLegend() const
{
return mDataDefinedSizeLegend.get();
return mDataDefinedSizeLegend;
}
@@ -646,6 +646,7 @@ class CORE_EXPORT QgsLinearlyInterpolatedDiagramRenderer : public QgsDiagramRend
{
public:
QgsLinearlyInterpolatedDiagramRenderer();
~QgsLinearlyInterpolatedDiagramRenderer();

QgsLinearlyInterpolatedDiagramRenderer *clone() const override SIP_FACTORY;

@@ -722,7 +723,7 @@ class CORE_EXPORT QgsLinearlyInterpolatedDiagramRenderer : public QgsDiagramRend
QgsDiagramInterpolationSettings mInterpolationSettings;

//! Stores more settings about how legend for varying size of symbols should be rendered
std::unique_ptr<QgsDataDefinedSizeLegend> mDataDefinedSizeLegend;
QgsDataDefinedSizeLegend *mDataDefinedSizeLegend = nullptr;
};

#endif // QGSDIAGRAMRENDERERV2_H
@@ -51,6 +51,7 @@ QgsLegendSymbolItem::QgsLegendSymbolItem( const QgsLegendSymbolItem &other )
QgsLegendSymbolItem::~QgsLegendSymbolItem()
{
delete mSymbol;
delete mDataDefinedSizeLegendSettings;
}

QgsLegendSymbolItem &QgsLegendSymbolItem::operator=( const QgsLegendSymbolItem &other )
@@ -62,7 +63,8 @@ QgsLegendSymbolItem &QgsLegendSymbolItem::operator=( const QgsLegendSymbolItem &
mLabel = other.mLabel;
mKey = other.mKey;
mCheckable = other.mCheckable;
mDataDefinedSizeLegendSettings.reset( other.mDataDefinedSizeLegendSettings.get() ? new QgsDataDefinedSizeLegend( *other.mDataDefinedSizeLegendSettings.get() ) : nullptr );
delete mDataDefinedSizeLegendSettings;
mDataDefinedSizeLegendSettings = other.mDataDefinedSizeLegendSettings ? new QgsDataDefinedSizeLegend( *other.mDataDefinedSizeLegendSettings ) : nullptr;
mOriginalSymbolPointer = other.mOriginalSymbolPointer;
mScaleMinDenom = other.mScaleMinDenom;
mScaleMaxDenom = other.mScaleMaxDenom;
@@ -94,10 +96,11 @@ void QgsLegendSymbolItem::setSymbol( QgsSymbol *s )

void QgsLegendSymbolItem::setDataDefinedSizeLegendSettings( QgsDataDefinedSizeLegend *settings )
{
mDataDefinedSizeLegendSettings.reset( settings );
delete settings;
mDataDefinedSizeLegendSettings = settings;
}

QgsDataDefinedSizeLegend *QgsLegendSymbolItem::dataDefinedSizeLegendSettings() const
{
return mDataDefinedSizeLegendSettings.get();
return mDataDefinedSizeLegendSettings;
}
@@ -18,8 +18,8 @@

#include <memory>
#include <QString>
#include "qgis.h"

#include "qgis.h"
#include "qgis_core.h"

class QgsDataDefinedSizeLegend;
@@ -40,6 +40,7 @@ class CORE_EXPORT QgsLegendSymbolItem
//! \since QGIS 2.8
QgsLegendSymbolItem( QgsSymbol *symbol, const QString &label, const QString &ruleKey, bool checkable = false, int scaleMinDenom = -1, int scaleMaxDenom = -1, int level = 0, const QString &parentRuleKey = QString() );
~QgsLegendSymbolItem();

QgsLegendSymbolItem( const QgsLegendSymbolItem &other );
QgsLegendSymbolItem &operator=( const QgsLegendSymbolItem &other );

@@ -103,7 +104,7 @@ class CORE_EXPORT QgsLegendSymbolItem

//! optional pointer to data-defined legend size settings - if set, the output legend
//! node should be QgsDataDefinedSizeLegendNode rather than ordinary QgsSymbolLegendNode
std::unique_ptr<QgsDataDefinedSizeLegend> mDataDefinedSizeLegendSettings;
QgsDataDefinedSizeLegend *mDataDefinedSizeLegendSettings = nullptr;

// additional data that may be used for filtering

0 comments on commit 1c1e771

Please sign in to comment.
You can’t perform that action at this time.