20using namespace Qt::StringLiterals;
24 return mShaftLengthMethod;
34 return mMinShaftLength;
44 return mMaxShaftLength;
64 return mFixedShaftLength;
74 return mArrowHeadWidthRatio;
79 mArrowHeadWidthRatio = vectorHeadWidthRatio;
84 return mArrowHeadLengthRatio;
89 mArrowHeadLengthRatio = vectorHeadLengthRatio;
94 QDomElement elem = doc.createElement( u
"vector-arrow-settings"_s );
95 elem.setAttribute( u
"arrow-head-width-ratio"_s, mArrowHeadWidthRatio );
96 elem.setAttribute( u
"arrow-head-length-ratio"_s, mArrowHeadLengthRatio );
98 QDomElement elemShaft = doc.createElement( u
"shaft-length"_s );
100 switch ( mShaftLengthMethod )
103 methodTxt = u
"minmax"_s;
104 elemShaft.setAttribute( u
"min"_s, mMinShaftLength );
105 elemShaft.setAttribute( u
"max"_s, mMaxShaftLength );
108 methodTxt = u
"scaled"_s;
109 elemShaft.setAttribute( u
"scale-factor"_s, mScaleFactor );
112 methodTxt = u
"fixed"_s;
113 elemShaft.setAttribute( u
"fixed-length"_s, mFixedShaftLength );
116 elemShaft.setAttribute( u
"method"_s, methodTxt );
117 elem.appendChild( elemShaft );
123 mArrowHeadWidthRatio = elem.attribute( u
"arrow-head-width-ratio"_s ).toDouble();
124 mArrowHeadLengthRatio = elem.attribute( u
"arrow-head-length-ratio"_s ).toDouble();
126 const QDomElement elemShaft = elem.firstChildElement( u
"shaft-length"_s );
127 const QString methodTxt = elemShaft.attribute( u
"method"_s );
128 if ( u
"minmax"_s == methodTxt )
131 mMinShaftLength = elemShaft.attribute( u
"min"_s ).toDouble();
132 mMaxShaftLength = elemShaft.attribute( u
"max"_s ).toDouble();
134 else if ( u
"scaled"_s == methodTxt )
137 mScaleFactor = elemShaft.attribute( u
"scale-factor"_s ).toDouble();
142 mFixedShaftLength = elemShaft.attribute( u
"fixed-length"_s ).toDouble();
VectorFieldArrowScalingMethod
Algorithm to transform vector magnitude to length of arrow on the device in pixels.
@ Fixed
Use fixed length fixedShaftLength() regardless of vector's magnitude.
@ Scaled
Scale vector magnitude by factor scaleFactor().
@ MinMax
Scale vector magnitude linearly to fit in range of vectorFilterMin() and vectorFilterMax().
QDomElement writeXml(QDomDocument &doc) const
Writes configuration to a new DOM element.
void setFixedShaftLength(double fixedShaftLength)
Sets fixed length (in millimeters).
double minShaftLength() const
Returns mininimum shaft length (in millimeters).
Qgis::VectorFieldArrowScalingMethod shaftLengthMethod() const
Returns method used for drawing arrows.
void readXml(const QDomElement &elem)
Reads configuration from the given DOM element.
void setMinShaftLength(double minShaftLength)
Sets mininimum shaft length (in millimeters).
double arrowHeadLengthRatio() const
Returns ratio of the head length of the arrow (range 0-1).
void setShaftLengthMethod(Qgis::VectorFieldArrowScalingMethod shaftLengthMethod)
Sets method used for drawing arrows.
void setScaleFactor(double scaleFactor)
Sets scale factor.
double fixedShaftLength() const
Returns fixed arrow length (in millimeters).
void setArrowHeadWidthRatio(double arrowHeadWidthRatio)
Sets ratio of the head width of the arrow (range 0-1).
void setMaxShaftLength(double maxShaftLength)
Sets maximum shaft length (in millimeters).
double arrowHeadWidthRatio() const
Returns ratio of the head width of the arrow (range 0-1).
double maxShaftLength() const
Returns maximum shaft length (in millimeters).
double scaleFactor() const
Returns scale factor.
void setArrowHeadLengthRatio(double arrowHeadLengthRatio)
Sets ratio of the head length of the arrow (range 0-1).