20using namespace Qt::StringLiterals;
24 mShaftLength = elem.attribute( u
"shaft-length"_s, u
"10"_s ).toDouble();
25 mShaftLengthUnits =
static_cast<Qgis::RenderUnit>( elem.attribute( u
"shaft-length-units"_s ).toInt() );
26 mMagnitudeMultiplier = elem.attribute( u
"magnitude-multiplier"_s, u
"1"_s ).toDouble();
27 mMagnitudeUnits =
static_cast<Qgis::WindSpeedUnit>( elem.attribute( u
"magnitude-units"_s, u
"0"_s ).toInt() );
32 QDomElement elem = doc.createElement( u
"vector-windbarb-settings"_s );
33 elem.setAttribute( u
"shaft-length"_s, mShaftLength );
34 elem.setAttribute( u
"shaft-length-units"_s,
static_cast< int >( mShaftLengthUnits ) );
35 elem.setAttribute( u
"magnitude-multiplier"_s, mMagnitudeMultiplier );
36 elem.setAttribute( u
"magnitude-units"_s,
static_cast< int >( mMagnitudeUnits ) );
42 switch ( mMagnitudeUnits )
47 return 3600.0 / 1852.0;
51 return 1.609344 / 1.852;
53 return 3600.0 / 1.852 / 5280.0 * 1.609344;
55 return mMagnitudeMultiplier;
77 return mShaftLengthUnits;
82 mShaftLengthUnits = shaftLengthUnit;
87 return mMagnitudeUnits;
92 mMagnitudeUnits = units;
WindSpeedUnit
Wind speed units.
@ FeetPerSecond
Feet per second.
@ KilometersPerHour
Kilometers per hour.
@ Knots
Knots (Nautical miles per hour).
@ MilesPerHour
Miles per hour.
@ MetersPerSecond
Meters per second.
RenderUnit
Rendering size units.
Qgis::WindSpeedUnit magnitudeUnits() const
Returns the units that the data are in.
double shaftLength() const
Returns the shaft length (in millimeters).
void readXml(const QDomElement &elem)
Reads configuration from the given DOM element.
QDomElement writeXml(QDomDocument &doc) const
Writes configuration to a new DOM element.
void setMagnitudeMultiplier(double magnitudeMultiplier)
Sets a multiplier for the magnitude to convert it to knots.
void setMagnitudeUnits(Qgis::WindSpeedUnit units)
Sets the units that the data are in.
double magnitudeMultiplier() const
Returns the multiplier for the magnitude to convert it to knots, according to the units set with setM...
void setShaftLength(double shaftLength)
Sets the shaft length (in millimeters).
Qgis::RenderUnit shaftLengthUnits() const
Returns the units for the shaft length.
void setShaftLengthUnits(Qgis::RenderUnit shaftLengthUnit)
Sets the units for the shaft length.