QGIS API Documentation
3.16.0-Hannover (43b64b13f3)
src
core
qgsprojutils.h
Go to the documentation of this file.
1
/***************************************************************************
2
qgsprojutils.h
3
-------------------
4
begin : March 2019
5
copyright : (C) 2019 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
#ifndef QGSPROJUTILS_H
18
#define QGSPROJUTILS_H
19
20
#include <QtGlobal>
21
22
#include "qgis_core.h"
23
#include "qgsconfig.h"
24
#include "
qgsdatumtransform.h
"
25
#include <memory>
26
#include <QStringList>
27
28
#if !defined(USE_THREAD_LOCAL) || defined(Q_OS_WIN)
29
#include <QThreadStorage>
30
#endif
31
32
#if PROJ_VERSION_MAJOR>=6
33
#ifndef SIP_RUN
34
struct
PJconsts;
35
typedef
struct
PJconsts PJ;
36
#endif
37
#endif
38
45
class
CORE_EXPORT
QgsProjUtils
46
{
47
public
:
48
52
static
int
projVersionMajor
()
53
{
54
return
PROJ_VERSION_MAJOR;
55
}
56
63
static
QStringList searchPaths();
64
65
#ifndef SIP_RUN
66
68
enum
IdentifyFlag
69
{
70
FlagMatchBoundCrsToUnderlyingSourceCrs = 1 << 0,
71
};
72
Q_DECLARE_FLAGS( IdentifyFlags, IdentifyFlag )
73
74
#if PROJ_VERSION_MAJOR >= 6
75
79
struct
ProjPJDeleter
80
{
81
85
void
CORE_EXPORT operator()( PJ *
object
);
86
87
};
88
92
using
proj_pj_unique_ptr = std::unique_ptr< PJ, ProjPJDeleter >;
93
98
static
bool
usesAngularUnit(
const
QString &projDef );
99
100
//TODO - remove when proj 6.1 is minimum supported version, and replace with proj_normalize_for_visualization
101
106
static
bool
axisOrderIsSwapped(
const
PJ *
crs
);
107
112
static
proj_pj_unique_ptr crsToSingleCrs(
const
PJ *
crs
);
113
120
static
bool
identifyCrs(
const
PJ *
crs
, QString &authName, QString &authCode, IdentifyFlags flags = IdentifyFlags() );
121
125
static
bool
coordinateOperationIsAvailable(
const
QString &projDef );
126
130
static
QList< QgsDatumTransform::GridDetails > gridsUsed(
const
QString &proj );
131
132
133
#if 0 // not possible in current Proj 6 API
134
139
static
QStringList nonAvailableGrids(
const
QString &projDef );
140
#endif
141
#endif
142
#endif
143
};
144
145
#ifndef SIP_RUN
146
147
#if PROJ_VERSION_MAJOR>=6
148
struct
projCtx_t;
149
typedef
struct
projCtx_t
PJ_CONTEXT
;
150
#else
151
typedef
void
PJ_CONTEXT
;
152
#endif
153
161
class
CORE_EXPORT
QgsProjContext
162
{
163
public
:
164
165
QgsProjContext
();
166
~
QgsProjContext
();
167
171
static
PJ_CONTEXT
*get();
172
173
private
:
174
PJ_CONTEXT
*mContext =
nullptr
;
175
180
#if defined(USE_THREAD_LOCAL) && !defined(Q_OS_WIN)
181
static
thread_local
QgsProjContext
sProjContext;
182
#else
183
static
QThreadStorage< QgsProjContext * > sProjContext;
184
#endif
185
};
186
187
Q_DECLARE_OPERATORS_FOR_FLAGS
( QgsProjUtils::IdentifyFlags )
188
#endif
189
#endif // QGSPROJUTILS_H
QgsProjUtils::IdentifyFlag
IdentifyFlag
Flags controlling CRS identification behavior.
Definition:
qgsprojutils.h:69
crs
const QgsCoordinateReferenceSystem & crs
Definition:
qgswfsgetfeature.cpp:51
qgsdatumtransform.h
Q_DECLARE_OPERATORS_FOR_FLAGS
Q_DECLARE_OPERATORS_FOR_FLAGS(QgsField::ConfigurationFlags) CORE_EXPORT QDataStream &operator<<(QDataStream &out
Writes the field to stream out. QGIS version compatibility is not guaranteed.
QgsProjUtils
Utility functions for working with the proj library.
Definition:
qgsprojutils.h:46
PJ_CONTEXT
void PJ_CONTEXT
Definition:
qgsprojutils.h:151
QgsProjContext
Used to create and store a proj context object, correctly freeing the context upon destruction.
Definition:
qgsprojutils.h:162
QgsProjUtils::projVersionMajor
static int projVersionMajor()
Returns the proj library major version number.
Definition:
qgsprojutils.h:52
Generated on Sat Oct 24 2020 17:43:09 for QGIS API Documentation by
1.8.20