QGIS API Documentation 3.29.0-Master (8c80f25a4f)
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 ***************************************************************************/
19
21{
22 const QList< Qgis::CrsAxisDirection > axisList = crs.axisOrdering();
23 if ( axisList.size() < 2 )
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 {
41
56
75 break;
76 }
77 }
78
80}
81
83{
84 switch ( axis )
85 {
87 return QObject::tr( "N", "axis" );
89 return QObject::tr( "NNE", "axis" );
91 return QObject::tr( "SSE", "axis" );
93 return QObject::tr( "S", "axis" );
95 return QObject::tr( "SSW", "axis" );
97 return QObject::tr( "NNW", "axis" );
99 return QObject::tr( "Y", "axis" );
101 return QObject::tr( "Up", "axis" );
103 return QObject::tr( "Down", "axis" );
105 return QObject::tr( "NE", "axis" );
107 return QObject::tr( "ENE", "axis" );
109 return QObject::tr( "E", "axis" );
111 return QObject::tr( "ESE", "axis" );
113 return QObject::tr( "SE", "axis" );
115 return QObject::tr( "SW", "axis" );
117 return QObject::tr( "WSW", "axis" );
119 return QObject::tr( "W", "axis" );
121 return QObject::tr( "WNW", "axis" );
123 return QObject::tr( "NW", "axis" );
125 return QObject::tr( "X", "axis" );
127 return QObject::tr( "Disp. R", "axis" );
129 return QObject::tr( "Disp. L", "axis" );
131 return QObject::tr( "Z", "axis" );
133 return QObject::tr( "U", "axis" );
135 return QObject::tr( "D", "axis" );
137 return QObject::tr( "F", "axis" );
139 return QObject::tr( "A", "axis" );
141 return QObject::tr( "P", "axis" );
143 return QObject::tr( "STBD", "axis" );
145 return QObject::tr( "CW", "axis" );
147 return QObject::tr( "CCW", "axis" );
149 return QObject::tr( "C+", "axis" );
151 return QObject::tr( "C-", "axis" );
153 return QObject::tr( "R+", "axis" );
155 return QObject::tr( "R-", "axis" );
157 return QObject::tr( "F", "axis" );
159 return QObject::tr( "P", "axis" );
161 return QObject::tr( "T", "axis" );
163 return QObject::tr( "AF", "axis" );
165 break;
166 }
167
168 return QString();
169}
CoordinateOrder
Order of coordinates.
Definition: qgis.h:1308
@ XY
Easting/Northing (or Longitude/Latitude for geographic CRS)
@ YX
Northing/Easting (or Latitude/Longitude for geographic CRS)
CrsAxisDirection
Data provider flags.
Definition: qgis.h:1258
@ ColumnPositive
Column positive.
@ SouthSouthEast
South South East.
@ NorthWest
North West.
@ ColumnNegative
Column negative.
@ RowPositive
Row positive.
@ DisplayDown
Display down.
@ GeocentricZ
Geocentric (Z)
@ DisplayRight
Display right.
@ WestSouthWest
West South West.
@ RowNegative
Row negative.
@ NorthNorthEast
North North East.
@ EastNorthEast
East North East.
@ Unspecified
Unspecified.
@ NorthEast
North East.
@ NorthNorthWest
North North West.
@ GeocentricY
Geocentric (Y)
@ SouthEast
South East.
@ CounterClockwise
Counter clockwise.
@ SouthSouthWest
South South West.
@ DisplayLeft
Display left.
@ WestNorthWest
West North West.
@ EastSouthEast
East South East.
@ SouthWest
South West.
@ DisplayUp
Display up.
@ GeocentricX
Geocentric (X)
static Qgis::CoordinateOrder defaultCoordinateOrderForCrs(const QgsCoordinateReferenceSystem &crs)
Returns the default coordinate order to use for the specified crs.
static QString axisDirectionToAbbreviatedString(Qgis::CrsAxisDirection axis)
Returns a translated abbreviation representing an axis direction.
This class represents a coordinate reference system (CRS).
QList< Qgis::CrsAxisDirection > axisOrdering() const
Returns an ordered list of the axis directions reflecting the native axis order for the CRS.
const QgsCoordinateReferenceSystem & crs