|
1 | 1 | class QgsPropertyTransformer
|
2 | 2 | {
|
3 | 3 | %TypeHeaderCode
|
4 |
| -#include <qgsproperty.h> |
| 4 | +#include <qgspropertytransformer.h> |
5 | 5 | %End
|
6 | 6 |
|
7 | 7 | %ConvertToSubClassCode
|
8 |
| - if (sipCpp->transformerType() == QgsPropertyTransformer::SizeScaleTransformer) |
9 |
| - sipType = sipType_QgsSizeScaleTransformer; |
| 8 | + if (sipCpp->transformerType() == QgsPropertyTransformer::GenericNumericTransformer) |
| 9 | + sipType = sipType_QgsGenericNumericTransformer; |
| 10 | + else if (sipCpp->transformerType() == QgsPropertyTransformer::SizeScaleTransformer) |
| 11 | + sipType = sipType_QgsSizeScaleTransformer; |
10 | 12 | else if (sipCpp->transformerType() == QgsPropertyTransformer::ColorRampTransformer)
|
11 |
| - sipType = sipType_QgsColorRampTransformer; |
| 13 | + sipType = sipType_QgsColorRampTransformer; |
12 | 14 | else
|
13 |
| - sipType = sipType_QgsPropertyTransformer; |
| 15 | + sipType = sipType_QgsPropertyTransformer; |
14 | 16 | %End
|
15 | 17 |
|
16 | 18 | public:
|
17 | 19 |
|
18 |
| - //! Transformer types |
19 | 20 | enum Type
|
20 | 21 | {
|
21 |
| - SizeScaleTransformer, /*!< Size scaling transformer (QgsSizeScaleTransformer) */ |
22 |
| - ColorRampTransformer, /*!< Color ramp transformer (QgsColorRampTransformer) */ |
| 22 | + GenericNumericTransformer, |
| 23 | + SizeScaleTransformer, |
| 24 | + ColorRampTransformer, |
23 | 25 | };
|
24 | 26 |
|
25 | 27 | static QgsPropertyTransformer* create( Type type ) /Factory/;
|
@@ -50,11 +52,42 @@ class QgsPropertyTransformer
|
50 | 52 | static QgsPropertyTransformer* fromExpression( const QString& expression, QString& baseExpression /Out/, QString& fieldName /Out/ ) /Factory/;
|
51 | 53 |
|
52 | 54 | };
|
| 55 | +class QgsGenericNumericTransformer : QgsPropertyTransformer |
| 56 | +{ |
| 57 | +%TypeHeaderCode |
| 58 | +#include <qgspropertytransformer.h> |
| 59 | +%End |
| 60 | + |
| 61 | + public: |
| 62 | + QgsGenericNumericTransformer( double minValue = 0.0, |
| 63 | + double maxValue = 1.0, |
| 64 | + double minOutput = 0.0, |
| 65 | + double maxOutput = 1.0, |
| 66 | + double nullOutput = 0.0, |
| 67 | + double exponent = 1.0 ); |
| 68 | + |
| 69 | + virtual Type transformerType() const; |
| 70 | + virtual QgsGenericNumericTransformer* clone() /Factory/; |
| 71 | + virtual bool writeXml( QDomElement& transformerElem, QDomDocument& doc ) const; |
| 72 | + virtual bool readXml( const QDomElement& transformerElem, const QDomDocument& doc ); |
| 73 | + virtual QVariant transform( const QgsExpressionContext& context, const QVariant& value ) const; |
| 74 | + virtual QString toExpression( const QString& baseExpression ) const; |
| 75 | + static QgsGenericNumericTransformer* fromExpression( const QString& expression, QString& baseExpression, QString& fieldName ) /Factory/; |
| 76 | + double value( double input ) const; |
| 77 | + double minOutputValue() const; |
| 78 | + void setMinOutputValue( double size ); |
| 79 | + double maxOutputValue() const; |
| 80 | + void setMaxOutputValue( double size ); |
| 81 | + double nullOutputValue() const; |
| 82 | + void setNullOutputValue( double size ); |
| 83 | + double exponent() const; |
| 84 | + void setExponent( double exponent ); |
53 | 85 |
|
| 86 | +}; |
54 | 87 | class QgsSizeScaleTransformer : QgsPropertyTransformer
|
55 | 88 | {
|
56 | 89 | %TypeHeaderCode
|
57 |
| -#include <qgsproperty.h> |
| 90 | +#include <qgspropertytransformer.h> |
58 | 91 | %End
|
59 | 92 | public:
|
60 | 93 |
|
@@ -111,7 +144,7 @@ class QgsSizeScaleTransformer : QgsPropertyTransformer
|
111 | 144 | class QgsColorRampTransformer : QgsPropertyTransformer
|
112 | 145 | {
|
113 | 146 | %TypeHeaderCode
|
114 |
| -#include <qgsproperty.h> |
| 147 | +#include <qgspropertytransformer.h> |
115 | 148 | %End
|
116 | 149 | public:
|
117 | 150 |
|
|
0 commit comments