2017-01-18 11:35:45 +10:00
|
|
|
typedef QMap< int, QgsPropertyDefinition > QgsPropertiesDefinition;
|
2017-01-10 19:35:19 +10:00
|
|
|
|
2017-01-04 07:16:44 +10:00
|
|
|
class QgsAbstractPropertyCollection
|
|
|
|
{
|
|
|
|
%TypeHeaderCode
|
|
|
|
#include <qgspropertycollection.h>
|
|
|
|
%End
|
2017-01-10 12:34:08 +10:00
|
|
|
|
|
|
|
%ConvertToSubClassCode
|
|
|
|
if ( dynamic_cast<QgsPropertyCollection*>(sipCpp) )
|
|
|
|
sipType = sipType_QgsPropertyCollection;
|
|
|
|
else if ( dynamic_cast<QgsPropertyCollectionStack*>(sipCpp) )
|
|
|
|
sipType = sipType_QgsPropertyCollectionStack;
|
|
|
|
else
|
|
|
|
sipType = sipType_QgsAbstractPropertyCollection;
|
|
|
|
%End
|
|
|
|
|
2017-01-04 07:16:44 +10:00
|
|
|
public:
|
|
|
|
|
|
|
|
QgsAbstractPropertyCollection( const QString& name = QString() );
|
|
|
|
|
|
|
|
QString name() const;
|
|
|
|
|
|
|
|
void setName( const QString& name );
|
|
|
|
|
|
|
|
virtual QSet<int> propertyKeys() const = 0;
|
|
|
|
|
|
|
|
virtual void clear() = 0;
|
|
|
|
|
|
|
|
virtual bool hasProperty( int key ) const = 0;
|
|
|
|
|
2017-01-18 22:47:55 +10:00
|
|
|
virtual QgsProperty property( int key ) const = 0;
|
|
|
|
|
2017-01-04 07:16:44 +10:00
|
|
|
virtual QVariant value( int key, const QgsExpressionContext& context, const QVariant& defaultValue = QVariant() ) const = 0;
|
|
|
|
|
2017-01-11 10:36:51 +10:00
|
|
|
QString valueAsString( int key, const QgsExpressionContext& context, const QString& defaultString = QString(), bool* ok /Out/ = nullptr ) const;
|
|
|
|
|
|
|
|
QColor valueAsColor( int key, const QgsExpressionContext& context, const QColor& defaultColor = QColor(), bool* ok /Out/ = nullptr ) const;
|
2017-01-04 07:16:44 +10:00
|
|
|
|
2017-01-11 10:36:51 +10:00
|
|
|
double valueAsDouble( int key, const QgsExpressionContext& context, double defaultValue = 0.0, bool* ok /Out/ = nullptr ) const;
|
2017-01-04 07:16:44 +10:00
|
|
|
|
2017-01-11 10:36:51 +10:00
|
|
|
int valueAsInt( int key, const QgsExpressionContext& context, int defaultValue = 0, bool* ok /Out/ = nullptr ) const;
|
2017-01-04 07:16:44 +10:00
|
|
|
|
2017-01-11 10:36:51 +10:00
|
|
|
bool valueAsBool( int key, const QgsExpressionContext& context, bool defaultValue = false, bool* ok /Out/ = nullptr ) const;
|
2017-01-10 19:35:19 +10:00
|
|
|
|
2017-01-10 13:33:17 +10:00
|
|
|
virtual bool prepare( const QgsExpressionContext& context = QgsExpressionContext() ) const = 0;
|
|
|
|
|
2017-01-04 07:16:44 +10:00
|
|
|
virtual QSet< QString > referencedFields( const QgsExpressionContext& context = QgsExpressionContext() ) const = 0;
|
|
|
|
|
|
|
|
virtual bool isActive( int key ) const = 0;
|
|
|
|
|
|
|
|
virtual bool hasActiveProperties() const = 0;
|
|
|
|
|
|
|
|
virtual bool hasActiveDynamicProperties() const = 0;
|
|
|
|
|
2017-01-18 11:35:45 +10:00
|
|
|
virtual bool writeXml( QDomElement& collectionElem, QDomDocument& doc, const QgsPropertiesDefinition& definitions ) const = 0;
|
2017-01-04 07:16:44 +10:00
|
|
|
|
2017-01-18 11:35:45 +10:00
|
|
|
virtual bool readXml( const QDomElement& collectionElem, const QDomDocument& doc, const QgsPropertiesDefinition &definitions ) = 0;
|
2017-01-04 07:16:44 +10:00
|
|
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
class QgsPropertyCollection : QgsAbstractPropertyCollection
|
|
|
|
{
|
|
|
|
%TypeHeaderCode
|
|
|
|
#include <qgspropertycollection.h>
|
|
|
|
%End
|
|
|
|
|
|
|
|
public:
|
|
|
|
|
|
|
|
QgsPropertyCollection( const QString& name = QString() );
|
|
|
|
|
|
|
|
~QgsPropertyCollection();
|
|
|
|
|
|
|
|
QgsPropertyCollection( const QgsPropertyCollection& other );
|
|
|
|
|
|
|
|
//QgsPropertyCollection& operator=( const QgsPropertyCollection& other );
|
|
|
|
|
|
|
|
int count() const;
|
|
|
|
|
|
|
|
QSet<int> propertyKeys() const;
|
|
|
|
void clear();
|
|
|
|
bool hasProperty( int key ) const;
|
2017-01-18 22:47:55 +10:00
|
|
|
QgsProperty& property( int key );
|
2017-01-04 07:16:44 +10:00
|
|
|
QVariant value( int key, const QgsExpressionContext& context, const QVariant& defaultValue = QVariant() ) const;
|
2017-01-10 13:33:17 +10:00
|
|
|
bool prepare( const QgsExpressionContext& context = QgsExpressionContext() ) const;
|
2017-01-04 07:16:44 +10:00
|
|
|
QSet< QString > referencedFields( const QgsExpressionContext& context = QgsExpressionContext() ) const;
|
|
|
|
bool isActive( int key ) const;
|
|
|
|
bool hasActiveProperties() const;
|
|
|
|
bool hasActiveDynamicProperties() const;
|
2017-01-18 11:35:45 +10:00
|
|
|
bool writeXml( QDomElement& collectionElem, QDomDocument& doc, const QgsPropertiesDefinition& definitions ) const;
|
|
|
|
bool readXml( const QDomElement& collectionElem, const QDomDocument& doc, const QgsPropertiesDefinition& definitions );
|
2017-01-04 07:16:44 +10:00
|
|
|
|
2017-01-18 22:47:55 +10:00
|
|
|
void setProperty( int key, const QgsProperty& property );
|
|
|
|
|
2017-01-04 07:16:44 +10:00
|
|
|
void setProperty( int key, const QVariant& value );
|
|
|
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
class QgsPropertyCollectionStack : QgsAbstractPropertyCollection
|
|
|
|
{
|
|
|
|
%TypeHeaderCode
|
|
|
|
#include <qgspropertycollection.h>
|
|
|
|
%End
|
|
|
|
|
|
|
|
public:
|
|
|
|
|
|
|
|
QgsPropertyCollectionStack();
|
|
|
|
|
|
|
|
~QgsPropertyCollectionStack();
|
|
|
|
|
|
|
|
QgsPropertyCollectionStack( const QgsPropertyCollectionStack& other );
|
|
|
|
|
|
|
|
//QgsPropertyCollectionStack& operator=( const QgsPropertyCollectionStack& other );
|
|
|
|
|
|
|
|
int count() const;
|
|
|
|
void clear();
|
|
|
|
void appendCollection( QgsPropertyCollection* collection /Transfer/ );
|
|
|
|
QgsPropertyCollection* at( int index );
|
|
|
|
//const QgsPropertyCollection* at( int index ) const;
|
|
|
|
QgsPropertyCollection* collection( const QString& name );
|
|
|
|
|
|
|
|
bool hasActiveProperties() const;
|
|
|
|
|
|
|
|
bool hasActiveDynamicProperties() const;
|
|
|
|
|
|
|
|
bool isActive( int key ) const;
|
|
|
|
|
2017-01-18 22:47:55 +10:00
|
|
|
QgsProperty property( int key ) const;
|
|
|
|
|
2017-01-04 07:16:44 +10:00
|
|
|
QVariant value( int key, const QgsExpressionContext& context, const QVariant& defaultValue = QVariant() ) const;
|
|
|
|
|
2017-01-10 13:33:17 +10:00
|
|
|
bool prepare( const QgsExpressionContext& context = QgsExpressionContext() ) const;
|
|
|
|
|
2017-01-04 07:16:44 +10:00
|
|
|
QSet< QString > referencedFields( const QgsExpressionContext& context = QgsExpressionContext() ) const;
|
|
|
|
|
|
|
|
QSet<int> propertyKeys() const;
|
|
|
|
bool hasProperty( int key ) const;
|
2017-01-18 11:35:45 +10:00
|
|
|
bool writeXml( QDomElement& collectionElem, QDomDocument& doc, const QgsPropertiesDefinition& definitions ) const;
|
|
|
|
bool readXml( const QDomElement& collectionElem, const QDomDocument& doc, const QgsPropertiesDefinition &definitions );
|
2017-01-04 07:16:44 +10:00
|
|
|
};
|
|
|
|
|