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" ) )
159 line << QPointF( 100, 50 );
163 double xComponent = 0;
164 double yComponent = 0;
167 if ( f && mXIndex != -1 )
172 if ( f && mYIndex != -1 )
177 switch ( mVectorFieldType )
184 convertPolarToCartesian( xVal, yVal, xComponent, yComponent );
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;
252 properties[
"angle_orientation"] =
QString::number( mAngleOrientation );
266 mLineSymbol->
toSld( doc, element, props );
288 attributes.
insert( mXAttribute );
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 );
static QgsSymbolLayerV2 * createFromSld(QDomElement &element)
static QString encodeOutputUnit(QgsSymbolV2::OutputUnit unit)
QgsMapUnitScale mapUnitScale() const override
void setXAttribute(const QString &attribute)
QgsSymbolV2::OutputUnit outputUnit() const override
QgsMapUnitScale mSizeMapUnitScale
void setYAttribute(const QString &attribute)
bool contains(const Key &key) const
QgsVectorFieldSymbolLayer()
QDomNode appendChild(const QDomNode &newChild)
void setAngleUnits(AngleUnits units)
int fieldNameIndex(const QString &fieldName) const
Look up field's index from name - case insensitive TODO: sort out case sensitive (indexFromName()) vs...
void setOffset(QPointF offset)
static QPointF decodePoint(QString str)
Container of fields for a vector layer.
static QString encodeMapUnitScale(const QgsMapUnitScale &mapUnitScale)
const_iterator insert(const T &value)
The feature class encapsulates a single feature including its id, geometry and a list of field/values...
void setOffsetMapUnitScale(const QgsMapUnitScale &scale)
void setMapUnitScale(const QgsMapUnitScale &scale) override
~QgsVectorFieldSymbolLayer()
void setOffsetUnit(QgsSymbolV2::OutputUnit unit)
A symbol layer class for displaying displacement arrows based on point layer attributes.
QString number(int n, int base)
const QgsFeature * feature() const
Current feature being rendered - may be null.
static QString encodePoint(QPointF point)
void startRender(QgsRenderContext &context, const QgsFields *fields=0)
void toSld(QDomDocument &doc, QDomElement &element, QgsStringMap props) const
QgsStringMap properties() const override
void renderPolyline(const QPolygonF &points, const QgsFeature *f, QgsRenderContext &context, int layer=-1, bool selected=false)
void setSizeUnit(QgsSymbolV2::OutputUnit unit)
void setMapUnitScale(const QgsMapUnitScale &scale) override
void setDistanceMapUnitScale(const QgsMapUnitScale &scale)
void stopRender(QgsSymbolV2RenderContext &context) override
void toSld(QDomDocument &doc, QDomElement &element, QgsStringMap props) const override
double ANALYSIS_EXPORT angle(Point3D *p1, Point3D *p2, Point3D *p3, Point3D *p4)
Calculates the angle between two segments (in 2 dimension, z-values are ignored)
void startRender(QgsSymbolV2RenderContext &context) override
void renderPoint(const QPointF &point, QgsSymbolV2RenderContext &context) override
static QgsSymbolLayerV2 * create(const QgsStringMap &properties=QgsStringMap())
bool setSubSymbol(QgsSymbolV2 *symbol) override
Contains information about the context of a rendering operation.
QVariant attribute(const QString &name) const
Lookup attribute value from attribute name.
void stopRender(QgsRenderContext &context)
static double lineWidthScaleFactor(const QgsRenderContext &c, QgsSymbolV2::OutputUnit u, const QgsMapUnitScale &scale=QgsMapUnitScale())
Returns the line width scale factor depending on the unit and the paint device.
QgsSymbolV2::OutputUnit outputUnit() const override
QgsMapUnitScale mapUnitScale() const override
QSet< QString > usedAttributes() const override
Returns the set of attributes referenced by the layer.
void drawPreviewIcon(QgsSymbolV2RenderContext &context, QSize size) override
QgsRenderContext & renderContext()
void setDistanceUnit(QgsSymbolV2::OutputUnit unit)
const QgsFields * fields() const
Fields of the layer.
void setAngleOrientation(AngleOrientation orientation)
QgsSymbolV2::OutputUnit mOffsetUnit
double toDouble(bool *ok) const
QgsSymbolV2::OutputUnit mSizeUnit
QgsMapUnitScale mOffsetMapUnitScale
static QgsMapUnitScale decodeMapUnitScale(const QString &str)
QgsSymbolLayerV2 * clone() const override
void drawPreviewIcon(QPainter *painter, QSize size, QgsRenderContext *customContext=0)
Draw icon of the symbol that occupyies area given by size using the painter.
void setSize(double size)
void setOutputUnit(QgsSymbolV2::OutputUnit unit) override
virtual QgsSymbolV2 * clone() const override
virtual bool setSubSymbol(QgsSymbolV2 *symbol)
void setVectorFieldType(VectorFieldType type)
void setSizeMapUnitScale(const QgsMapUnitScale &scale)
void setOutputUnit(QgsSymbolV2::OutputUnit unit) override
static QgsSymbolV2::OutputUnit decodeOutputUnit(QString str)