26 , mVectorFieldType( Cartesian )
27 , mAngleOrientation( ClockwiseFromNorth )
28 , mAngleUnits( Degrees )
59 mDistanceMapUnitScale =
scale;
66 return mDistanceMapUnitScale;
74 if ( properties.contains(
"x_attribute" ) )
78 if ( properties.contains(
"y_attribute" ) )
82 if ( properties.contains(
"distance_unit" ) )
86 if ( properties.contains(
"distance_map_unit_scale" ) )
90 if ( properties.contains(
"scale" ) )
92 symbolLayer->
setScale( properties[
"scale"].toDouble() );
94 if ( properties.contains(
"vector_field_type" ) )
98 if ( properties.contains(
"angle_orientation" ) )
102 if ( properties.contains(
"angle_units" ) )
106 if ( properties.contains(
"size" ) )
108 symbolLayer->
setSize( properties[
"size"].toDouble() );
110 if ( properties.contains(
"size_unit" ) )
114 if ( properties.contains(
"size_map_unit_scale" ) )
118 if ( properties.contains(
"offset" ) )
122 if ( properties.contains(
"offset_unit" ) )
126 if ( properties.contains(
"offset_map_unit_scale" ) )
158 line << QPointF( 0, 50 );
159 line << QPointF( 100, 50 );
163 double xComponent = 0;
164 double yComponent = 0;
167 if ( f && mXIndex != -1 )
169 xVal = f->
attribute( mXIndex ).toDouble();
172 if ( f && mYIndex != -1 )
174 yVal = f->
attribute( mYIndex ).toDouble();
177 switch ( mVectorFieldType )
181 yComponent = yVal * QgsSymbolLayerV2Utils::lineWidthScaleFactor( ctx, mDistanceUnit, mDistanceMapUnitScale );
184 convertPolarToCartesian( xVal, yVal, xComponent, yComponent );
185 xComponent = xComponent * QgsSymbolLayerV2Utils::lineWidthScaleFactor( ctx, mDistanceUnit, mDistanceMapUnitScale );
186 yComponent = yComponent * QgsSymbolLayerV2Utils::lineWidthScaleFactor( ctx, mDistanceUnit, mDistanceMapUnitScale );
190 yComponent = yVal * QgsSymbolLayerV2Utils::lineWidthScaleFactor( ctx, mDistanceUnit, mDistanceMapUnitScale );
196 xComponent *= mScale;
197 yComponent *= mScale;
201 line << QPointF( point.x() + xComponent, point.y() - yComponent );
246 properties[
"x_attribute"] = mXAttribute;
247 properties[
"y_attribute"] = mYAttribute;
250 properties[
"scale"] = QString::number( mScale );
251 properties[
"vector_field_type"] = QString::number( mVectorFieldType );
252 properties[
"angle_orientation"] = QString::number( mAngleOrientation );
253 properties[
"angle_units"] = QString::number( mAngleUnits );
254 properties[
"size"] = QString::number(
mSize );
265 element.appendChild( doc.createComment(
"VectorField not implemented yet..." ) );
266 mLineSymbol->
toSld( doc, element, props );
285 QSet<QString> attributes;
286 if ( !mXAttribute.isEmpty() )
288 attributes.insert( mXAttribute );
290 if ( !mYAttribute.isEmpty() )
292 attributes.insert( mYAttribute );
297 void QgsVectorFieldSymbolLayer::convertPolarToCartesian(
double length,
double angle,
double& x,
double& y )
const
308 angle = 360 - angle + 90;
314 angle = angle *
M_PI / 180.0;
317 x = length * sin( angle );
318 y = length * cos( angle );