mirror of
https://github.com/qgis/QGIS.git
synced 2025-02-27 00:33:48 -05:00
Nicer initialization of diagram property map
This commit is contained in:
parent
746034bfac
commit
1e0c62bc3a
@ -25,12 +25,21 @@
|
|||||||
#include <QDomElement>
|
#include <QDomElement>
|
||||||
#include <QPainter>
|
#include <QPainter>
|
||||||
|
|
||||||
QMap< int, QString > QgsDiagramLayerSettings::sPropertyNameMap;
|
const QMap< int, QString > QgsDiagramLayerSettings::sPropertyNameMap
|
||||||
|
|
||||||
QgsDiagramLayerSettings::QgsDiagramLayerSettings()
|
|
||||||
{
|
{
|
||||||
init();
|
{ QgsDiagramLayerSettings::BackgroundColor, "backgroundColor" },
|
||||||
}
|
{ QgsDiagramLayerSettings::OutlineColor, "outlineColor" },
|
||||||
|
{ QgsDiagramLayerSettings::OutlineWidth, "outlineWidth" },
|
||||||
|
{ QgsDiagramLayerSettings::PositionX, "positionX" },
|
||||||
|
{ QgsDiagramLayerSettings::PositionY, "positionY" },
|
||||||
|
{ QgsDiagramLayerSettings::Distance, "distance" },
|
||||||
|
{ QgsDiagramLayerSettings::Priority, "priority" },
|
||||||
|
{ QgsDiagramLayerSettings::ZIndex, "zIndex" },
|
||||||
|
{ QgsDiagramLayerSettings::IsObstacle, "isObstacle" },
|
||||||
|
{ QgsDiagramLayerSettings::Show, "show" },
|
||||||
|
{ QgsDiagramLayerSettings::AlwaysShow, "alwaysShow" },
|
||||||
|
{ QgsDiagramLayerSettings::StartAngle, "startAngle" }
|
||||||
|
};
|
||||||
|
|
||||||
QgsDiagramLayerSettings::QgsDiagramLayerSettings( const QgsDiagramLayerSettings& rh )
|
QgsDiagramLayerSettings::QgsDiagramLayerSettings( const QgsDiagramLayerSettings& rh )
|
||||||
: mCt( rh.mCt )
|
: mCt( rh.mCt )
|
||||||
@ -43,9 +52,7 @@ QgsDiagramLayerSettings::QgsDiagramLayerSettings( const QgsDiagramLayerSettings&
|
|||||||
, mRenderer( rh.mRenderer ? rh.mRenderer->clone() : nullptr )
|
, mRenderer( rh.mRenderer ? rh.mRenderer->clone() : nullptr )
|
||||||
, mShowAll( rh.mShowAll )
|
, mShowAll( rh.mShowAll )
|
||||||
, mProperties( rh.mProperties )
|
, mProperties( rh.mProperties )
|
||||||
{
|
{}
|
||||||
init();
|
|
||||||
}
|
|
||||||
|
|
||||||
QgsDiagramLayerSettings&QgsDiagramLayerSettings::operator=( const QgsDiagramLayerSettings & rh )
|
QgsDiagramLayerSettings&QgsDiagramLayerSettings::operator=( const QgsDiagramLayerSettings & rh )
|
||||||
{
|
{
|
||||||
@ -148,25 +155,6 @@ bool QgsDiagramLayerSettings::prepare( const QgsExpressionContext& context ) con
|
|||||||
return mProperties.prepare( context );
|
return mProperties.prepare( context );
|
||||||
}
|
}
|
||||||
|
|
||||||
void QgsDiagramLayerSettings::init()
|
|
||||||
{
|
|
||||||
if ( sPropertyNameMap.isEmpty() )
|
|
||||||
{
|
|
||||||
sPropertyNameMap.insert( BackgroundColor, "backgroundColor" );
|
|
||||||
sPropertyNameMap.insert( OutlineColor, "outlineColor" );
|
|
||||||
sPropertyNameMap.insert( OutlineWidth, "outlineWidth" );
|
|
||||||
sPropertyNameMap.insert( PositionX, "positionX" );
|
|
||||||
sPropertyNameMap.insert( PositionY, "positionY" );
|
|
||||||
sPropertyNameMap.insert( Distance, "distance" );
|
|
||||||
sPropertyNameMap.insert( Priority, "priority" );
|
|
||||||
sPropertyNameMap.insert( ZIndex, "zIndex" );
|
|
||||||
sPropertyNameMap.insert( IsObstacle, "isObstacle" );
|
|
||||||
sPropertyNameMap.insert( Show, "show" );
|
|
||||||
sPropertyNameMap.insert( AlwaysShow, "alwaysShow" );
|
|
||||||
sPropertyNameMap.insert( StartAngle, "startAngle" );
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
QSet<QString> QgsDiagramLayerSettings::referencedFields( const QgsExpressionContext &context ) const
|
QSet<QString> QgsDiagramLayerSettings::referencedFields( const QgsExpressionContext &context ) const
|
||||||
{
|
{
|
||||||
QSet< QString > referenced;
|
QSet< QString > referenced;
|
||||||
|
@ -95,7 +95,7 @@ class CORE_EXPORT QgsDiagramLayerSettings
|
|||||||
StartAngle, //! Angle offset for pie diagram
|
StartAngle, //! Angle offset for pie diagram
|
||||||
};
|
};
|
||||||
|
|
||||||
QgsDiagramLayerSettings();
|
QgsDiagramLayerSettings() = default;
|
||||||
|
|
||||||
//! Copy constructor
|
//! Copy constructor
|
||||||
QgsDiagramLayerSettings( const QgsDiagramLayerSettings& rh );
|
QgsDiagramLayerSettings( const QgsDiagramLayerSettings& rh );
|
||||||
@ -308,9 +308,7 @@ class CORE_EXPORT QgsDiagramLayerSettings
|
|||||||
//! Property collection for data defined diagram settings
|
//! Property collection for data defined diagram settings
|
||||||
QgsPropertyCollection mProperties;
|
QgsPropertyCollection mProperties;
|
||||||
|
|
||||||
static QMap< int, QString > sPropertyNameMap;
|
static const QMap< int, QString > sPropertyNameMap;
|
||||||
|
|
||||||
void init();
|
|
||||||
};
|
};
|
||||||
|
|
||||||
/** \ingroup core
|
/** \ingroup core
|
||||||
|
Loading…
x
Reference in New Issue
Block a user