22 mVectorFieldType( Cartesian ), mAngleOrientation( ClockwiseFromNorth ), mAngleUnits( Degrees ), mXIndex( -1 ), mYIndex( -1 )
44 if ( properties.contains(
"x_attribute" ) )
48 if ( properties.contains(
"y_attribute" ) )
52 if ( properties.contains(
"distance_unit" ) )
56 if ( properties.contains(
"scale" ) )
58 symbolLayer->
setScale( properties[
"scale"].toDouble() );
60 if ( properties.contains(
"vector_field_type" ) )
64 if ( properties.contains(
"angle_orientation" ) )
68 if ( properties.contains(
"angle_units" ) )
99 line << QPointF( 0, 50 );
100 line << QPointF( 100, 50 );
104 double xComponent = 0;
105 double yComponent = 0;
142 line << QPointF( point.x() + xComponent, point.y() - yComponent );
190 properties[
"scale"] = QString::number(
mScale );
193 properties[
"angle_units"] = QString::number(
mAngleUnits );
199 element.appendChild( doc.createComment(
"VectorField not implemented yet..." ) );
219 QSet<QString> attributes;
242 angle = 360 - angle + 90;
248 angle = angle *
M_PI / 180.0;
251 x = length * sin( angle );
252 y = length * cos( angle );
static QgsSymbolLayerV2 * createFromSld(QDomElement &element)
static QString encodeOutputUnit(QgsSymbolV2::OutputUnit unit)
QgsSymbolV2::OutputUnit mDistanceUnit
void setXAttribute(const QString &attribute)
AngleOrientation mAngleOrientation
void setYAttribute(const QString &attribute)
QgsVectorFieldSymbolLayer()
void setAngleUnits(AngleUnits units)
void drawPreviewIcon(QPainter *painter, QSize size)
VectorFieldType mVectorFieldType
The feature class encapsulates a single feature including its id, geometry and a list of field/values...
QgsSymbolV2::OutputUnit outputUnit() const
QMap< QString, QString > QgsStringMap
~QgsVectorFieldSymbolLayer()
void toSld(QDomDocument &doc, QDomElement &element, QgsStringMap props) const
void startRender(QgsSymbolV2RenderContext &context)
A symbol layer class for displaying displacement arrows based on point layer attributes.
void stopRender(QgsSymbolV2RenderContext &context)
const QgsFeature * feature() const
void toSld(QDomDocument &doc, QDomElement &element, QgsStringMap props) const
void renderPolyline(const QPolygonF &points, const QgsFeature *f, QgsRenderContext &context, int layer=-1, bool selected=false)
bool setSubSymbol(QgsSymbolV2 *symbol)
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)
virtual QgsSymbolV2 * clone() const
static QgsSymbolLayerV2 * create(const QgsStringMap &properties=QgsStringMap())
void drawPreviewIcon(QgsSymbolV2RenderContext &context, QSize size)
Contains information about the context of a rendering operation.
void setOutputUnit(QgsSymbolV2::OutputUnit unit)
QVariant attribute(const QString &name) const
Lookup attribute value from attribute name.
void stopRender(QgsRenderContext &context)
void renderPoint(const QPointF &point, QgsSymbolV2RenderContext &context)
QgsRenderContext & renderContext()
void startRender(QgsRenderContext &context, const QgsVectorLayer *layer=0)
QgsLineSymbolV2 * mLineSymbol
QgsSymbolLayerV2 * clone() const
void setDistanceUnit(QgsSymbolV2::OutputUnit unit)
static double lineWidthScaleFactor(const QgsRenderContext &c, QgsSymbolV2::OutputUnit u)
Returns the line width scale factor depending on the unit and the paint device.
void setAngleOrientation(AngleOrientation orientation)
QSet< QString > usedAttributes() const
void convertPolarToCartesian(double length, double angle, double &x, double &y) const
QgsStringMap properties() const
Represents a vector layer which manages a vector based data sets.
int fieldNameIndex(const QString &fieldName) const
Returns the index of a field name or -1 if the field does not exist.
virtual bool setSubSymbol(QgsSymbolV2 *symbol)
void setVectorFieldType(VectorFieldType type)
static QgsSymbolV2::OutputUnit decodeOutputUnit(QString str)
const QgsVectorLayer * layer() const