QGIS API Documentation
3.26.3-Buenos Aires (65e4edfdad)
src
core
proj
qgscoordinatereferencesystemutils.cpp
Go to the documentation of this file.
1
/***************************************************************************
2
qgscoordinatereferencesystemutils.h
3
-------------------
4
begin : April 2022
5
copyright : (C) 202 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
#include "
qgscoordinatereferencesystemutils.h
"
18
#include "
qgscoordinatereferencesystem.h
"
19
20
Qgis::CoordinateOrder
QgsCoordinateReferenceSystemUtils::defaultCoordinateOrderForCrs
(
const
QgsCoordinateReferenceSystem
&
crs
)
21
{
22
const
QList< Qgis::CrsAxisDirection > axisList =
crs
.
axisOrdering
();
23
if
( axisList.size() < 2 )
24
return
Qgis::CoordinateOrder::XY
;
25
26
for
(
Qgis::CrsAxisDirection
axis : axisList )
27
{
28
// we're trying to map all the different possible values to just XY or YX, so excuse the coarseness!
29
switch
( axis )
30
{
31
case
Qgis::CrsAxisDirection::North
:
32
case
Qgis::CrsAxisDirection::NorthNorthEast
:
33
case
Qgis::CrsAxisDirection::SouthSouthEast
:
34
case
Qgis::CrsAxisDirection::South
:
35
case
Qgis::CrsAxisDirection::SouthSouthWest
:
36
case
Qgis::CrsAxisDirection::NorthNorthWest
:
37
case
Qgis::CrsAxisDirection::GeocentricY
:
38
case
Qgis::CrsAxisDirection::DisplayUp
:
39
case
Qgis::CrsAxisDirection::DisplayDown
:
40
return
Qgis::CoordinateOrder::YX
;
41
42
case
Qgis::CrsAxisDirection::NorthEast
:
43
case
Qgis::CrsAxisDirection::EastNorthEast
:
44
case
Qgis::CrsAxisDirection::East
:
45
case
Qgis::CrsAxisDirection::EastSouthEast
:
46
case
Qgis::CrsAxisDirection::SouthEast
:
47
case
Qgis::CrsAxisDirection::SouthWest
:
48
case
Qgis::CrsAxisDirection::WestSouthWest
:
49
case
Qgis::CrsAxisDirection::West
:
50
case
Qgis::CrsAxisDirection::WestNorthWest
:
51
case
Qgis::CrsAxisDirection::NorthWest
:
52
case
Qgis::CrsAxisDirection::GeocentricX
:
53
case
Qgis::CrsAxisDirection::DisplayRight
:
54
case
Qgis::CrsAxisDirection::DisplayLeft
:
55
return
Qgis::CoordinateOrder::XY
;
56
57
case
Qgis::CrsAxisDirection::GeocentricZ
:
58
case
Qgis::CrsAxisDirection::Up
:
59
case
Qgis::CrsAxisDirection::Down
:
60
case
Qgis::CrsAxisDirection::Forward
:
61
case
Qgis::CrsAxisDirection::Aft
:
62
case
Qgis::CrsAxisDirection::Port
:
63
case
Qgis::CrsAxisDirection::Starboard
:
64
case
Qgis::CrsAxisDirection::Clockwise
:
65
case
Qgis::CrsAxisDirection::CounterClockwise
:
66
case
Qgis::CrsAxisDirection::ColumnPositive
:
67
case
Qgis::CrsAxisDirection::ColumnNegative
:
68
case
Qgis::CrsAxisDirection::RowPositive
:
69
case
Qgis::CrsAxisDirection::RowNegative
:
70
case
Qgis::CrsAxisDirection::Future
:
71
case
Qgis::CrsAxisDirection::Past
:
72
case
Qgis::CrsAxisDirection::Towards
:
73
case
Qgis::CrsAxisDirection::AwayFrom
:
74
case
Qgis::CrsAxisDirection::Unspecified
:
75
break
;
76
}
77
}
78
79
return
Qgis::CoordinateOrder::XY
;
80
}
81
82
QString
QgsCoordinateReferenceSystemUtils::axisDirectionToAbbreviatedString
(
Qgis::CrsAxisDirection
axis )
83
{
84
switch
( axis )
85
{
86
case
Qgis::CrsAxisDirection::North
:
87
return
QObject::tr(
"N"
,
"axis"
);
88
case
Qgis::CrsAxisDirection::NorthNorthEast
:
89
return
QObject::tr(
"NNE"
,
"axis"
);
90
case
Qgis::CrsAxisDirection::SouthSouthEast
:
91
return
QObject::tr(
"SSE"
,
"axis"
);
92
case
Qgis::CrsAxisDirection::South
:
93
return
QObject::tr(
"S"
,
"axis"
);
94
case
Qgis::CrsAxisDirection::SouthSouthWest
:
95
return
QObject::tr(
"SSW"
,
"axis"
);
96
case
Qgis::CrsAxisDirection::NorthNorthWest
:
97
return
QObject::tr(
"NNW"
,
"axis"
);
98
case
Qgis::CrsAxisDirection::GeocentricY
:
99
return
QObject::tr(
"Y"
,
"axis"
);
100
case
Qgis::CrsAxisDirection::DisplayUp
:
101
return
QObject::tr(
"Up"
,
"axis"
);
102
case
Qgis::CrsAxisDirection::DisplayDown
:
103
return
QObject::tr(
"Down"
,
"axis"
);
104
case
Qgis::CrsAxisDirection::NorthEast
:
105
return
QObject::tr(
"NE"
,
"axis"
);
106
case
Qgis::CrsAxisDirection::EastNorthEast
:
107
return
QObject::tr(
"ENE"
,
"axis"
);
108
case
Qgis::CrsAxisDirection::East
:
109
return
QObject::tr(
"E"
,
"axis"
);
110
case
Qgis::CrsAxisDirection::EastSouthEast
:
111
return
QObject::tr(
"ESE"
,
"axis"
);
112
case
Qgis::CrsAxisDirection::SouthEast
:
113
return
QObject::tr(
"SE"
,
"axis"
);
114
case
Qgis::CrsAxisDirection::SouthWest
:
115
return
QObject::tr(
"SW"
,
"axis"
);
116
case
Qgis::CrsAxisDirection::WestSouthWest
:
117
return
QObject::tr(
"WSW"
,
"axis"
);
118
case
Qgis::CrsAxisDirection::West
:
119
return
QObject::tr(
"W"
,
"axis"
);
120
case
Qgis::CrsAxisDirection::WestNorthWest
:
121
return
QObject::tr(
"WNW"
,
"axis"
);
122
case
Qgis::CrsAxisDirection::NorthWest
:
123
return
QObject::tr(
"NW"
,
"axis"
);
124
case
Qgis::CrsAxisDirection::GeocentricX
:
125
return
QObject::tr(
"X"
,
"axis"
);
126
case
Qgis::CrsAxisDirection::DisplayRight
:
127
return
QObject::tr(
"Disp. R"
,
"axis"
);
128
case
Qgis::CrsAxisDirection::DisplayLeft
:
129
return
QObject::tr(
"Disp. L"
,
"axis"
);
130
case
Qgis::CrsAxisDirection::GeocentricZ
:
131
return
QObject::tr(
"Z"
,
"axis"
);
132
case
Qgis::CrsAxisDirection::Up
:
133
return
QObject::tr(
"U"
,
"axis"
);
134
case
Qgis::CrsAxisDirection::Down
:
135
return
QObject::tr(
"D"
,
"axis"
);
136
case
Qgis::CrsAxisDirection::Forward
:
137
return
QObject::tr(
"F"
,
"axis"
);
138
case
Qgis::CrsAxisDirection::Aft
:
139
return
QObject::tr(
"A"
,
"axis"
);
140
case
Qgis::CrsAxisDirection::Port
:
141
return
QObject::tr(
"P"
,
"axis"
);
142
case
Qgis::CrsAxisDirection::Starboard
:
143
return
QObject::tr(
"STBD"
,
"axis"
);
144
case
Qgis::CrsAxisDirection::Clockwise
:
145
return
QObject::tr(
"CW"
,
"axis"
);
146
case
Qgis::CrsAxisDirection::CounterClockwise
:
147
return
QObject::tr(
"CCW"
,
"axis"
);
148
case
Qgis::CrsAxisDirection::ColumnPositive
:
149
return
QObject::tr(
"C+"
,
"axis"
);
150
case
Qgis::CrsAxisDirection::ColumnNegative
:
151
return
QObject::tr(
"C-"
,
"axis"
);
152
case
Qgis::CrsAxisDirection::RowPositive
:
153
return
QObject::tr(
"R+"
,
"axis"
);
154
case
Qgis::CrsAxisDirection::RowNegative
:
155
return
QObject::tr(
"R-"
,
"axis"
);
156
case
Qgis::CrsAxisDirection::Future
:
157
return
QObject::tr(
"F"
,
"axis"
);
158
case
Qgis::CrsAxisDirection::Past
:
159
return
QObject::tr(
"P"
,
"axis"
);
160
case
Qgis::CrsAxisDirection::Towards
:
161
return
QObject::tr(
"T"
,
"axis"
);
162
case
Qgis::CrsAxisDirection::AwayFrom
:
163
return
QObject::tr(
"AF"
,
"axis"
);
164
case
Qgis::CrsAxisDirection::Unspecified
:
165
break
;
166
}
167
168
return
QString();
169
}
Qgis::CrsAxisDirection::Towards
@ Towards
Towards.
Qgis::CrsAxisDirection::WestNorthWest
@ WestNorthWest
West North West.
Qgis::CrsAxisDirection::SouthWest
@ SouthWest
South West.
Qgis::CrsAxisDirection::Unspecified
@ Unspecified
Unspecified.
Qgis::CrsAxisDirection::DisplayDown
@ DisplayDown
Display down.
Qgis::CrsAxisDirection::West
@ West
West.
Qgis::CrsAxisDirection::Future
@ Future
Future.
Qgis::CrsAxisDirection::DisplayUp
@ DisplayUp
Display up.
crs
const QgsCoordinateReferenceSystem & crs
Definition:
qgswfsgetfeature.cpp:105
Qgis::CrsAxisDirection::SouthSouthEast
@ SouthSouthEast
South South East.
Qgis::CrsAxisDirection::RowNegative
@ RowNegative
Row negative.
Qgis::CrsAxisDirection::NorthNorthWest
@ NorthNorthWest
North North West.
QgsCoordinateReferenceSystem::axisOrdering
QList< Qgis::CrsAxisDirection > axisOrdering() const
Returns an ordered list of the axis directions reflecting the native axis order for the CRS.
Definition:
qgscoordinatereferencesystem.cpp:804
Qgis::CrsAxisDirection::GeocentricY
@ GeocentricY
Geocentric (Y)
QgsCoordinateReferenceSystemUtils::defaultCoordinateOrderForCrs
static Qgis::CoordinateOrder defaultCoordinateOrderForCrs(const QgsCoordinateReferenceSystem &crs)
Returns the default coordinate order to use for the specified crs.
Definition:
qgscoordinatereferencesystemutils.cpp:20
Qgis::CrsAxisDirection::GeocentricZ
@ GeocentricZ
Geocentric (Z)
Qgis::CrsAxisDirection::East
@ East
East.
Qgis::CrsAxisDirection::Past
@ Past
Past.
Qgis::CrsAxisDirection::CounterClockwise
@ CounterClockwise
Counter clockwise.
Qgis::CrsAxisDirection::SouthSouthWest
@ SouthSouthWest
South South West.
Qgis::CrsAxisDirection::DisplayLeft
@ DisplayLeft
Display left.
Qgis::CrsAxisDirection::South
@ South
South.
Qgis::CrsAxisDirection::AwayFrom
@ AwayFrom
Away from.
Qgis::CrsAxisDirection::DisplayRight
@ DisplayRight
Display right.
Qgis::CrsAxisDirection::EastSouthEast
@ EastSouthEast
East South East.
Qgis::CoordinateOrder::XY
@ XY
Easting/Northing (or Longitude/Latitude for geographic CRS)
Qgis::CrsAxisDirection::RowPositive
@ RowPositive
Row positive.
Qgis::CrsAxisDirection::NorthWest
@ NorthWest
North West.
qgscoordinatereferencesystemutils.h
Qgis::CrsAxisDirection::Aft
@ Aft
Aft.
Qgis::CrsAxisDirection::GeocentricX
@ GeocentricX
Geocentric (X)
QgsCoordinateReferenceSystem
This class represents a coordinate reference system (CRS).
Definition:
qgscoordinatereferencesystem.h:211
Qgis::CrsAxisDirection::NorthNorthEast
@ NorthNorthEast
North North East.
Qgis::CoordinateOrder::YX
@ YX
Northing/Easting (or Latitude/Longitude for geographic CRS)
Qgis::CrsAxisDirection::ColumnNegative
@ ColumnNegative
Column negative.
QgsCoordinateReferenceSystemUtils::axisDirectionToAbbreviatedString
static QString axisDirectionToAbbreviatedString(Qgis::CrsAxisDirection axis)
Returns a translated abbreviation representing an axis direction.
Definition:
qgscoordinatereferencesystemutils.cpp:82
Qgis::CrsAxisDirection
CrsAxisDirection
Data provider flags.
Definition:
qgis.h:1051
Qgis::CrsAxisDirection::Up
@ Up
Up.
Qgis::CrsAxisDirection::WestSouthWest
@ WestSouthWest
West South West.
Qgis::CrsAxisDirection::EastNorthEast
@ EastNorthEast
East North East.
Qgis::CrsAxisDirection::ColumnPositive
@ ColumnPositive
Column positive.
Qgis::CrsAxisDirection::Port
@ Port
Port.
Qgis::CoordinateOrder
CoordinateOrder
Order of coordinates.
Definition:
qgis.h:1101
qgscoordinatereferencesystem.h
Qgis::CrsAxisDirection::Forward
@ Forward
Forward.
Qgis::CrsAxisDirection::Down
@ Down
Down.
Qgis::CrsAxisDirection::North
@ North
North.
Qgis::CrsAxisDirection::Clockwise
@ Clockwise
Clockwise.
Qgis::CrsAxisDirection::NorthEast
@ NorthEast
North East.
Qgis::CrsAxisDirection::SouthEast
@ SouthEast
South East.
Qgis::CrsAxisDirection::Starboard
@ Starboard
Starboard.
Generated on Sun Sep 11 2022 00:03:17 for QGIS API Documentation by
1.8.17