QGIS API Documentation
2.18.21-Las Palmas (9fba24a)
|
Helper functions for various unit types. More...
#include <qgsunittypes.h>
Public Types | |
enum | AngleUnit { AngleDegrees = 0, Radians, Gon, MinutesOfArc, SecondsOfArc, Turn, UnknownAngleUnit } |
Units of angles. More... | |
enum | AreaUnit { SquareMeters = 0, SquareKilometers, SquareFeet, SquareYards, SquareMiles, Hectares, Acres, SquareNauticalMiles, SquareDegrees, UnknownAreaUnit } |
Units of area. More... | |
enum | DistanceUnitType { Standard = 0, Geographic, UnknownType } |
Types of distance units. More... | |
Static Public Member Functions | |
static AngleUnit | decodeAngleUnit (const QString &string, bool *ok=0) |
Decodes an angular unit from a string. More... | |
static AreaUnit | decodeAreaUnit (const QString &string, bool *ok=0) |
Decodes an areal unit from a string. More... | |
static QGis::UnitType | decodeDistanceUnit (const QString &string, bool *ok=0) |
Decodes a distance unit from a string. More... | |
static AreaUnit | distanceToAreaUnit (QGis::UnitType distanceUnit) |
Converts a distance unit to its corresponding area unit, eg meters to square meters. More... | |
static QString | encodeUnit (QGis::UnitType unit) |
Encodes a distance unit to a string. More... | |
static QString | encodeUnit (AreaUnit unit) |
Encodes an areal unit to a string. More... | |
static QString | encodeUnit (AngleUnit unit) |
Encodes an angular unit to a string. More... | |
static QString | formatAngle (double angle, int decimals, AngleUnit unit) |
Returns an angle formatted as a friendly string. More... | |
static double | fromUnitToUnitFactor (QGis::UnitType fromUnit, QGis::UnitType toUnit) |
Returns the conversion factor between the specified distance units. More... | |
static double | fromUnitToUnitFactor (AreaUnit fromUnit, AreaUnit toUnit) |
Returns the conversion factor between the specified areal units. More... | |
static double | fromUnitToUnitFactor (AngleUnit fromUnit, AngleUnit toUnit) |
Returns the conversion factor between the specified angular units. More... | |
static AreaUnit | stringToAreaUnit (const QString &string, bool *ok=0) |
Converts a translated string to an areal unit. More... | |
static QGis::UnitType | stringToDistanceUnit (const QString &string, bool *ok=0) |
Converts a translated string to a distance unit. More... | |
static QString | toString (QGis::UnitType unit) |
Returns a translated string representing a distance unit. More... | |
static QString | toString (AreaUnit unit) |
Returns a translated string representing an areal unit. More... | |
static QString | toString (AngleUnit unit) |
Returns a translated string representing an angular unit. More... | |
static DistanceUnitType | unitType (QGis::UnitType unit) |
Returns the type for a distance unit. More... | |
static DistanceUnitType | unitType (AreaUnit unit) |
Returns the type for an areal unit. More... | |
Helper functions for various unit types.
Definition at line 35 of file qgsunittypes.h.
Units of angles.
Enumerator | |
---|---|
AngleDegrees | degrees |
Radians | square kilometers |
Gon | gon/gradian |
MinutesOfArc | minutes of arc |
SecondsOfArc | seconds of arc |
Turn | turn/revolutions |
UnknownAngleUnit | unknown angle unit |
Definition at line 64 of file qgsunittypes.h.
Units of area.
Definition at line 49 of file qgsunittypes.h.
Types of distance units.
Enumerator | |
---|---|
Standard | unit is a standard measurement unit |
Geographic | unit is a geographic (eg degree based) unit |
UnknownType | unknown unit type |
Definition at line 41 of file qgsunittypes.h.
|
static |
Decodes an angular unit from a string.
string | string to decode |
ok | optional boolean, will be set to true if string was converted successfully |
Definition at line 859 of file qgsunittypes.cpp.
|
static |
Decodes an areal unit from a string.
string | string to decode |
ok | optional boolean, will be set to true if string was converted successfully |
Definition at line 432 of file qgsunittypes.cpp.
|
static |
Decodes a distance unit from a string.
string | string to decode |
ok | optional boolean, will be set to true if string was converted successfully |
Definition at line 108 of file qgsunittypes.cpp.
|
static |
Converts a distance unit to its corresponding area unit, eg meters to square meters.
distanceUnit | distance unit to convert |
Definition at line 805 of file qgsunittypes.cpp.
|
static |
Encodes a distance unit to a string.
unit | unit to encode |
Definition at line 71 of file qgsunittypes.cpp.
|
static |
Encodes an areal unit to a string.
unit | unit to encode |
Definition at line 404 of file qgsunittypes.cpp.
|
static |
Encodes an angular unit to a string.
unit | unit to encode |
Definition at line 837 of file qgsunittypes.cpp.
|
static |
Returns an angle formatted as a friendly string.
angle | angle to format |
decimals | number of decimal places to show |
unit | unit of angle |
Definition at line 1045 of file qgsunittypes.cpp.
|
static |
Returns the conversion factor between the specified distance units.
fromUnit | distance unit to convert from |
toUnit | distance unit to convert to |
Definition at line 211 of file qgsunittypes.cpp.
|
static |
Returns the conversion factor between the specified areal units.
fromUnit | area unit to convert from |
toUnit | area unit to convert to |
Definition at line 527 of file qgsunittypes.cpp.
|
static |
Returns the conversion factor between the specified angular units.
fromUnit | angle unit to convert from |
toUnit | angle unit to convert to |
Definition at line 908 of file qgsunittypes.cpp.
|
static |
Converts a translated string to an areal unit.
string | string representing an areal unit |
ok | optional boolean, will be set to true if string was converted successfully |
Definition at line 494 of file qgsunittypes.cpp.
|
static |
Converts a translated string to a distance unit.
string | string representing a distance unit |
ok | optional boolean, will be set to true if string was converted successfully |
Definition at line 175 of file qgsunittypes.cpp.
|
static |
Returns a translated string representing a distance unit.
unit | unit to convert to string |
Definition at line 138 of file qgsunittypes.cpp.
|
static |
Returns a translated string representing an areal unit.
unit | unit to convert to string |
Definition at line 466 of file qgsunittypes.cpp.
|
static |
Returns a translated string representing an angular unit.
unit | unit to convert to string |
Definition at line 886 of file qgsunittypes.cpp.
|
static |
Returns the type for a distance unit.
Definition at line 26 of file qgsunittypes.cpp.
|
static |
Returns the type for an areal unit.
Definition at line 47 of file qgsunittypes.cpp.