QGIS API Documentation
2.18.21-Las Palmas (9fba24a)
src
core
qgsunittypes.h
Go to the documentation of this file.
1
/***************************************************************************
2
qgsunittypes.h
3
--------------
4
begin : February 2016
5
copyright : (C) 2016 by Nyall Dawson
6
email : nyall dot dawson at gmail dot com
7
***************************************************************************/
8
9
/***************************************************************************
10
* *
11
* This program is free software; you can redistribute it and/or modify *
12
* it under the terms of the GNU General Public License as published by *
13
* the Free Software Foundation; either version 2 of the License, or *
14
* (at your option) any later version. *
15
* *
16
***************************************************************************/
17
18
#ifndef QGSUNITTYPES_H
19
#define QGSUNITTYPES_H
20
21
#include "
qgis.h
"
22
23
/***************************************************************************
24
* This class is considered CRITICAL and any change MUST be accompanied with
25
* full unit tests in test_qgsunittypes.py.
26
* See details in QEP #17
27
****************************************************************************/
28
35
class
CORE_EXPORT
QgsUnitTypes
36
{
37
public
:
38
41
enum
DistanceUnitType
42
{
43
Standard = 0,
44
Geographic
,
45
UnknownType
,
46
};
47
49
enum
AreaUnit
50
{
51
SquareMeters = 0,
52
SquareKilometers
,
53
SquareFeet
,
54
SquareYards
,
55
SquareMiles
,
56
Hectares
,
57
Acres
,
58
SquareNauticalMiles
,
59
SquareDegrees
,
60
UnknownAreaUnit
,
61
};
62
64
enum
AngleUnit
65
{
66
AngleDegrees = 0,
67
Radians
,
68
Gon
,
69
MinutesOfArc
,
70
SecondsOfArc
,
71
Turn
,
72
UnknownAngleUnit
,
73
};
74
75
// DISTANCE UNITS
76
79
static
DistanceUnitType
unitType(
QGis::UnitType
unit );
80
86
static
QString
encodeUnit(
QGis::UnitType
unit );
87
94
static
QGis::UnitType
decodeDistanceUnit(
const
QString
&
string
,
bool
*ok = 0 );
95
100
static
QString
toString(
QGis::UnitType
unit );
101
107
static
QGis::UnitType
stringToDistanceUnit(
const
QString
&
string
,
bool
*ok = 0 );
108
114
static
double
fromUnitToUnitFactor(
QGis::UnitType
fromUnit,
QGis::UnitType
toUnit );
115
116
// AREAL UNITS
117
120
static
DistanceUnitType
unitType(
AreaUnit
unit );
121
127
static
QString
encodeUnit(
AreaUnit
unit );
128
135
static
AreaUnit
decodeAreaUnit(
const
QString
&
string
,
bool
*ok = 0 );
136
141
static
QString
toString(
AreaUnit
unit );
142
148
static
AreaUnit
stringToAreaUnit(
const
QString
&
string
,
bool
*ok = 0 );
149
155
static
double
fromUnitToUnitFactor(
AreaUnit
fromUnit,
AreaUnit
toUnit );
156
161
static
AreaUnit
distanceToAreaUnit(
QGis::UnitType
distanceUnit );
162
163
// ANGULAR UNITS
164
170
static
QString
encodeUnit(
AngleUnit
unit );
171
178
static
AngleUnit
decodeAngleUnit(
const
QString
&
string
,
bool
*ok = 0 );
179
183
static
QString
toString(
AngleUnit
unit );
184
190
static
double
fromUnitToUnitFactor(
AngleUnit
fromUnit,
AngleUnit
toUnit );
191
198
static
QString
formatAngle(
double
angle
,
int
decimals,
AngleUnit
unit );
199
200
//TODO QGIS 3.0 - enable and move symbol units here! Otherwise creates circular dependencies...
201
#if 0
202
// SYMBOL UNITS
203
209
static
QString
encodeUnit(
QgsSymbolV2::OutputUnit
unit );
210
217
static
QgsSymbolV2::OutputUnit
decodeSymbolUnit(
const
QString
&
string
,
bool
*ok = 0 );
218
#endif
219
220
};
221
222
#endif // QGSUNITTYPES_H
QgsUnitTypes::SquareYards
Definition:
qgsunittypes.h:54
QgsSymbolV2::OutputUnit
OutputUnit
The unit of the output.
Definition:
qgssymbolv2.h:65
QgsUnitTypes::SquareKilometers
Definition:
qgsunittypes.h:52
QgsUnitTypes::MinutesOfArc
Definition:
qgsunittypes.h:69
QgsUnitTypes
Helper functions for various unit types.
Definition:
qgsunittypes.h:35
QgsUnitTypes::Radians
Definition:
qgsunittypes.h:67
QgsUnitTypes::DistanceUnitType
DistanceUnitType
Types of distance units.
Definition:
qgsunittypes.h:41
QgsUnitTypes::AngleUnit
AngleUnit
Units of angles.
Definition:
qgsunittypes.h:64
QgsUnitTypes::Gon
Definition:
qgsunittypes.h:68
QgsUnitTypes::Hectares
Definition:
qgsunittypes.h:56
QString
QgsUnitTypes::UnknownAreaUnit
Definition:
qgsunittypes.h:60
MathUtils::angle
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)
QgsUnitTypes::Acres
Definition:
qgsunittypes.h:57
QgsUnitTypes::SquareMiles
Definition:
qgsunittypes.h:55
QgsUnitTypes::UnknownType
Definition:
qgsunittypes.h:45
QgsUnitTypes::Turn
Definition:
qgsunittypes.h:71
QgsUnitTypes::Geographic
Definition:
qgsunittypes.h:44
QgsUnitTypes::SecondsOfArc
Definition:
qgsunittypes.h:70
QgsUnitTypes::SquareDegrees
Definition:
qgsunittypes.h:59
QGis::UnitType
UnitType
Map units that qgis supports.
Definition:
qgis.h:159
QgsUnitTypes::SquareFeet
Definition:
qgsunittypes.h:53
qgis.h
QgsUnitTypes::SquareNauticalMiles
Definition:
qgsunittypes.h:58
QgsUnitTypes::UnknownAngleUnit
Definition:
qgsunittypes.h:72
QgsUnitTypes::AreaUnit
AreaUnit
Units of area.
Definition:
qgsunittypes.h:49
Generated on Sun Jun 24 2018 11:42:48 for QGIS API Documentation by
1.8.13