Coverage Report

Created: 2025-12-31 06:48

next uncovered line (L), next uncovered region (R), next uncovered branch (B)
/src/gdal/ogr/ogrsf_frmts/gmlutils/gmlutils.h
Line
Count
Source
1
/******************************************************************************
2
 *
3
 * Project:  GML Utils
4
 * Purpose:  GML reader
5
 * Author:   Even Rouault, <even dot rouault at spatialys.com>
6
 *
7
 ******************************************************************************
8
 * Copyright (c) 2010-2011, Even Rouault <even dot rouault at spatialys.com>
9
 *
10
 * SPDX-License-Identifier: MIT
11
 ****************************************************************************/
12
13
#ifndef CPL_GMLUTILS_H_INCLUDED
14
#define CPL_GMLUTILS_H_INCLUDED
15
16
#include <memory>
17
#include <vector>
18
#include <string>
19
#include "cpl_minixml.h"
20
21
#include "ogr_geometry.h"
22
23
class OGRSpatialReference;
24
25
typedef enum
26
{
27
    GML_SWAP_AUTO,
28
    GML_SWAP_YES,
29
    GML_SWAP_NO,
30
} GMLSwapCoordinatesEnum;
31
32
typedef enum
33
{
34
    SRSNAME_SHORT,
35
    SRSNAME_OGC_URN,
36
    SRSNAME_OGC_URL
37
} OGRGMLSRSNameFormat;
38
39
const char CPL_DLL *
40
GML_ExtractSrsNameFromGeometry(const CPLXMLNode *const *papsGeometry,
41
                               std::string &osWork, bool bConsiderEPSGAsURN);
42
43
bool CPL_DLL GML_IsSRSLatLongOrder(const char *pszSRSName);
44
bool CPL_DLL GML_IsLegitSRSName(const char *pszSRSName);
45
46
class OGRGML_SRSCache;
47
OGRGML_SRSCache CPL_DLL *OGRGML_SRSCache_Create();
48
void CPL_DLL OGRGML_SRSCache_Destroy(OGRGML_SRSCache *hSRSCache);
49
50
class OGRGML_SRSCacheEntry
51
{
52
  public:
53
    OGRSpatialReference *poSRS = nullptr;
54
    double dfSemiMajor = 0;
55
    double dfLinearUnits = 0;  // only set if bIsProjected
56
    int nAxisCount = 0;
57
    bool bIsGeographic = false;
58
    bool bIsProjected = false;
59
    bool bAngularUnitIsDegree = false;  // only set if bIsGeographic
60
    bool bInvertedAxisOrder = false;
61
62
0
    OGRGML_SRSCacheEntry() = default;
63
    ~OGRGML_SRSCacheEntry();
64
65
    OGRGML_SRSCacheEntry(const OGRGML_SRSCacheEntry &) = delete;
66
    OGRGML_SRSCacheEntry &operator=(const OGRGML_SRSCacheEntry &) = delete;
67
};
68
69
std::shared_ptr<OGRGML_SRSCacheEntry> CPL_DLL
70
OGRGML_SRSCache_GetInfo(OGRGML_SRSCache *hSRSCache, const char *pszSRSName);
71
72
OGRGeometry CPL_DLL *GML2OGRGeometry_XMLNode(
73
    const CPLXMLNode *psNode, int nPseudoBoolGetSecondaryGeometryOption,
74
    OGRGML_SRSCache *hSRSCache, int nRecLevel = 0, int nSRSDimension = 0,
75
    bool bIgnoreGSG = false, bool bOrientation = true,
76
    bool bFaceHoleNegative = false, const char *pszId = nullptr);
77
78
OGRGeometry CPL_DLL *GML_BuildOGRGeometryFromList(
79
    const CPLXMLNode *const *papsGeometry, bool bTryToMakeMultipolygons,
80
    bool bInvertAxisOrderIfLatLong, const char *pszDefaultSRSName,
81
    bool bConsiderEPSGAsURN, GMLSwapCoordinatesEnum eSwapCoordinates,
82
    int nPseudoBoolGetSecondaryGeometryOption, OGRGML_SRSCache *hSRSCache,
83
    bool bFaceHoleNegative = false);
84
85
char CPL_DLL *GML_GetSRSName(const OGRSpatialReference *poSRS,
86
                             OGRGMLSRSNameFormat eSRSNameFormat,
87
                             bool *pbCoordSwap);
88
89
#endif /* _CPL_GMLREADERP_H_INCLUDED */