|
4 | 4 | #include <QPainter>
|
5 | 5 | #include <QSet>
|
6 | 6 |
|
7 |
| -QgsEllipseSymbolLayerV2::QgsEllipseSymbolLayerV2(): mSymbolName("circle"), mSymbolWidth(4), mSymbolHeight(3), mRotation(0), mFillColor( Qt::black ), mOutlineColor( Qt::white ) |
| 7 | +QgsEllipseSymbolLayerV2::QgsEllipseSymbolLayerV2(): mSymbolName("circle"), mSymbolWidth(4), mSymbolHeight(3), |
| 8 | +mFillColor( Qt::black ), mOutlineColor( Qt::white ), mOutlineWidth( 0 ) |
8 | 9 | {
|
9 | 10 | mPen.setColor( mOutlineColor );
|
10 | 11 | mPen.setWidth( 1.0 );
|
11 | 12 | mPen.setJoinStyle( Qt::MiterJoin );
|
12 | 13 | mBrush.setColor( mFillColor );
|
13 | 14 | mBrush.setStyle( Qt::SolidPattern );
|
14 | 15 |
|
| 16 | + mAngle = 0; |
15 | 17 | mWidthField.first = -1;
|
16 | 18 | mHeightField.first = -1;
|
17 | 19 | mRotationField.first = -1;
|
@@ -39,9 +41,9 @@ QgsSymbolLayerV2* QgsEllipseSymbolLayerV2::create( const QgsStringMap& propertie
|
39 | 41 | {
|
40 | 42 | layer->setSymbolHeight( properties["symbol_height"].toDouble() );
|
41 | 43 | }
|
42 |
| - if( properties.contains("rotation") ) |
| 44 | + if( properties.contains("angle") ) |
43 | 45 | {
|
44 |
| - layer->setRotation( properties["rotation"].toDouble() ); |
| 46 | + layer->setAngle( properties["angle"].toDouble() ); |
45 | 47 | }
|
46 | 48 | if( properties.contains( "outline_width" ) )
|
47 | 49 | {
|
@@ -117,22 +119,15 @@ void QgsEllipseSymbolLayerV2::renderPoint( const QPointF& point, QgsSymbolV2Rend
|
117 | 119 | return;
|
118 | 120 | }
|
119 | 121 |
|
120 |
| - //priority for rotation: 1. data defined, 2. symbol layer rotation (mRotation), 3. symbol rotation (mAngle) |
| 122 | + //priority for rotation: 1. data defined, 2. symbol layer rotation (mAngle) |
121 | 123 | double rotation = 0.0;
|
122 |
| - if( mRotationField.first != -1 ) |
| 124 | + if( f && mRotationField.first != -1 ) |
123 | 125 | {
|
124 | 126 | rotation = f->attributeMap()[mRotationField.first].toDouble();
|
125 | 127 | }
|
126 |
| - else |
| 128 | + else if( !doubleNear( mAngle, 0.0 ) ) |
127 | 129 | {
|
128 |
| - if( !doubleNear( mRotation, 0.0 ) ) |
129 |
| - { |
130 |
| - rotation = mRotation; |
131 |
| - } |
132 |
| - else if( !doubleNear( mAngle, 0.0 ) ) |
133 |
| - { |
134 |
| - rotation = mAngle; |
135 |
| - } |
| 130 | + rotation = mAngle; |
136 | 131 | }
|
137 | 132 |
|
138 | 133 | QMatrix transform;
|
@@ -182,7 +177,7 @@ QgsStringMap QgsEllipseSymbolLayerV2::properties() const
|
182 | 177 | map["symbol_height"] = QString::number( mSymbolHeight );
|
183 | 178 | map["height_index"] = QString::number( mHeightField.first );
|
184 | 179 | map["height_field"] = mHeightField.second;
|
185 |
| - map["rotation"] = QString::number( mRotation ); |
| 180 | + map["angle"] = QString::number( mAngle ); |
186 | 181 | map["rotation_index"] = QString::number( mRotationField.first );
|
187 | 182 | map["rotation_field"] = mRotationField.second;
|
188 | 183 | map["outline_width"] = QString::number( mOutlineWidth );
|
@@ -262,6 +257,10 @@ QSet<QString> QgsEllipseSymbolLayerV2::usedAttributes() const
|
262 | 257 | {
|
263 | 258 | dataDefinedAttributes.insert( mHeightField.second );
|
264 | 259 | }
|
| 260 | + if( mRotationField.first != -1 ) |
| 261 | + { |
| 262 | + dataDefinedAttributes.insert( mRotationField.second ); |
| 263 | + } |
265 | 264 | if( mOutlineWidthField.first != -1 )
|
266 | 265 | {
|
267 | 266 | dataDefinedAttributes.insert( mOutlineWidthField.second );
|
|
0 commit comments