LCOV - code coverage report
Current view: top level - ogr - ogr_core.h (source / functions) Hit Total Coverage
Test: gdal_filtered.info Lines: 77 81 95.1 %
Date: 2024-11-21 22:18:42 Functions: 17 17 100.0 %

          Line data    Source code
       1             : /******************************************************************************
       2             :  * $Id$
       3             :  *
       4             :  * Project:  OpenGIS Simple Features Reference Implementation
       5             :  * Purpose:  Define some core portability services for cross-platform OGR code.
       6             :  * Author:   Frank Warmerdam, warmerdam@pobox.com
       7             :  *
       8             :  ******************************************************************************
       9             :  * Copyright (c) 1999, Frank Warmerdam
      10             :  * Copyright (c) 2007-2014, Even Rouault <even dot rouault at spatialys.com>
      11             :  *
      12             :  * SPDX-License-Identifier: MIT
      13             :  ****************************************************************************/
      14             : 
      15             : #ifndef OGR_CORE_H_INCLUDED
      16             : #define OGR_CORE_H_INCLUDED
      17             : 
      18             : #include "cpl_port.h"
      19             : #if defined(GDAL_COMPILATION)
      20             : #define DO_NOT_DEFINE_GDAL_DATE_NAME
      21             : #endif
      22             : #include "gdal_version.h"
      23             : 
      24             : /**
      25             :  * \file
      26             :  *
      27             :  * Core portability services for cross-platform OGR code.
      28             :  */
      29             : 
      30             : #if defined(__cplusplus) && !defined(CPL_SUPRESS_CPLUSPLUS)
      31             : 
      32             : extern "C++"
      33             : {
      34             : #if !defined(DOXYGEN_SKIP)
      35             : #include <cmath>
      36             : #include <limits>
      37             : #endif
      38             : 
      39             :     class OGREnvelope3D;
      40             : 
      41             :     /**
      42             :      * Simple container for a bounding region (rectangle)
      43             :      */
      44             :     class CPL_DLL OGREnvelope
      45             :     {
      46             :       public:
      47             :         /** Default constructor. Defines an empty rectangle  */
      48     8544096 :         OGREnvelope()
      49     8544096 :             : MinX(std::numeric_limits<double>::infinity()),
      50    17088152 :               MaxX(-std::numeric_limits<double>::infinity()),
      51     8544096 :               MinY(std::numeric_limits<double>::infinity()),
      52     8544086 :               MaxY(-std::numeric_limits<double>::infinity())
      53             :         {
      54     8544096 :         }
      55             : 
      56             :         /** Copy constructor */
      57      113407 :         OGREnvelope(const OGREnvelope &oOther)
      58      113407 :             : MinX(oOther.MinX), MaxX(oOther.MaxX), MinY(oOther.MinY),
      59      113407 :               MaxY(oOther.MaxY)
      60             :         {
      61      113407 :         }
      62             : 
      63             :         /** Assignment operator */
      64             :         OGREnvelope &operator=(const OGREnvelope &) = default;
      65             : 
      66             :         /** Minimum X value */
      67             :         double MinX;
      68             : 
      69             :         /** Maximum X value */
      70             :         double MaxX;
      71             : 
      72             :         /** Minimum Y value */
      73             :         double MinY;
      74             : 
      75             :         /** Maximum Y value */
      76             :         double MaxY;
      77             : 
      78             : #ifdef HAVE_GCC_DIAGNOSTIC_PUSH
      79             : #pragma GCC diagnostic push
      80             : #pragma GCC diagnostic ignored "-Wfloat-equal"
      81             : #endif
      82             :         /** Return whether the object has been initialized, that is, is non
      83             :          * empty */
      84        1592 :         int IsInit() const
      85             :         {
      86        1592 :             return MinX != std::numeric_limits<double>::infinity();
      87             :         }
      88             : 
      89             : #ifdef HAVE_GCC_DIAGNOSTIC_PUSH
      90             : #pragma GCC diagnostic pop
      91             : #endif
      92             : 
      93             :         /** Update the current object by computing its union with the other
      94             :          * rectangle */
      95      253470 :         void Merge(OGREnvelope const &sOther)
      96             :         {
      97      253470 :             MinX = MIN(MinX, sOther.MinX);
      98      253470 :             MaxX = MAX(MaxX, sOther.MaxX);
      99      253470 :             MinY = MIN(MinY, sOther.MinY);
     100      253470 :             MaxY = MAX(MaxY, sOther.MaxY);
     101      253470 :         }
     102             : 
     103             :         /** Update the current object by computing its union with the provided
     104             :          * point */
     105      187850 :         void Merge(double dfX, double dfY)
     106             :         {
     107      187850 :             MinX = MIN(MinX, dfX);
     108      187850 :             MaxX = MAX(MaxX, dfX);
     109      187850 :             MinY = MIN(MinY, dfY);
     110      187850 :             MaxY = MAX(MaxY, dfY);
     111      187850 :         }
     112             : 
     113             :         /** Update the current object by computing its intersection with the
     114             :          * other rectangle */
     115          33 :         void Intersect(OGREnvelope const &sOther)
     116             :         {
     117          33 :             if (Intersects(sOther))
     118             :             {
     119          28 :                 if (IsInit())
     120             :                 {
     121          28 :                     MinX = MAX(MinX, sOther.MinX);
     122          28 :                     MaxX = MIN(MaxX, sOther.MaxX);
     123          28 :                     MinY = MAX(MinY, sOther.MinY);
     124          28 :                     MaxY = MIN(MaxY, sOther.MaxY);
     125             :                 }
     126             :                 else
     127             :                 {
     128           0 :                     MinX = sOther.MinX;
     129           0 :                     MaxX = sOther.MaxX;
     130           0 :                     MinY = sOther.MinY;
     131           0 :                     MaxY = sOther.MaxY;
     132             :                 }
     133             :             }
     134             :             else
     135             :             {
     136           5 :                 *this = OGREnvelope();
     137             :             }
     138          33 :         }
     139             : 
     140             :         /** Return whether the current object intersects with the other
     141             :          * rectangle */
     142       14954 :         int Intersects(OGREnvelope const &other) const
     143             :         {
     144       14641 :             return MinX <= other.MaxX && MaxX >= other.MinX &&
     145       29595 :                    MinY <= other.MaxY && MaxY >= other.MinY;
     146             :         }
     147             : 
     148             :         /** Return whether the current object contains the other rectangle */
     149       16200 :         int Contains(OGREnvelope const &other) const
     150             :         {
     151        2566 :             return MinX <= other.MinX && MinY <= other.MinY &&
     152       18766 :                    MaxX >= other.MaxX && MaxY >= other.MaxY;
     153             :         }
     154             : 
     155             :         /** Return whether the current rectangle is equal to the other rectangle
     156             :          */
     157          51 :         bool operator==(const OGREnvelope &other) const
     158             :         {
     159             : #ifdef HAVE_GCC_DIAGNOSTIC_PUSH
     160             : #pragma GCC diagnostic push
     161             : #pragma GCC diagnostic ignored "-Wfloat-equal"
     162             : #endif
     163          45 :             return MinX == other.MinX && MinY == other.MinY &&
     164          96 :                    MaxX == other.MaxX && MaxY == other.MaxY;
     165             : 
     166             : #ifdef HAVE_GCC_DIAGNOSTIC_PUSH
     167             : #pragma GCC diagnostic pop
     168             : #endif
     169             :         }
     170             : 
     171             :         /** Return whether the current rectangle is not equal to the other
     172             :          * rectangle */
     173          45 :         bool operator!=(const OGREnvelope &other) const
     174             :         {
     175          45 :             return !(*this == other);
     176             :         }
     177             :     };
     178             : 
     179             : }  // extern "C++"
     180             : 
     181             : #else
     182             : typedef struct
     183             : {
     184             :     double MinX;
     185             :     double MaxX;
     186             :     double MinY;
     187             :     double MaxY;
     188             : } OGREnvelope;
     189             : #endif
     190             : 
     191             : #if defined(__cplusplus) && !defined(CPL_SUPRESS_CPLUSPLUS)
     192             : 
     193             : extern "C++"
     194             : {
     195             : 
     196             :     /**
     197             :      * Simple container for a bounding region in 3D.
     198             :      */
     199             :     class CPL_DLL OGREnvelope3D : public OGREnvelope
     200             :     {
     201             :       public:
     202             :         /** Default constructor. Defines an empty rectangle  */
     203     1590583 :         OGREnvelope3D()
     204     1590583 :             : OGREnvelope(), MinZ(std::numeric_limits<double>::infinity()),
     205     3181156 :               MaxZ(-std::numeric_limits<double>::infinity())
     206             :         {
     207     1590573 :         }
     208             : 
     209             :         /** Copy constructor */
     210          26 :         OGREnvelope3D(const OGREnvelope3D &oOther)
     211          26 :             : OGREnvelope(oOther), MinZ(oOther.MinZ), MaxZ(oOther.MaxZ)
     212             :         {
     213          26 :         }
     214             : 
     215             :         /** Assignment operator */
     216             :         OGREnvelope3D &operator=(const OGREnvelope3D &) = default;
     217             : 
     218             :         /** Returns TRUE if MinZ and MaxZ are both valid numbers. */
     219          30 :         bool Is3D() const
     220             :         {
     221          30 :             return std::isfinite(MinZ) && std::isfinite(MaxZ);
     222             :         }
     223             : 
     224             :         /** Minimum Z value */
     225             :         double MinZ;
     226             : 
     227             :         /** Maximum Z value */
     228             :         double MaxZ;
     229             : 
     230             : #ifdef HAVE_GCC_DIAGNOSTIC_PUSH
     231             : #pragma GCC diagnostic push
     232             : #pragma GCC diagnostic ignored "-Wfloat-equal"
     233             : #endif
     234             :         /** Return whether the object has been initialized, that is, is non
     235             :          * empty */
     236        1881 :         int IsInit() const
     237             :         {
     238        1881 :             return MinX != std::numeric_limits<double>::infinity();
     239             :         }
     240             : #ifdef HAVE_GCC_DIAGNOSTIC_PUSH
     241             : #pragma GCC diagnostic pop
     242             : #endif
     243             : 
     244             :         /** Update the current object by computing its union with the other
     245             :          * rectangle */
     246     1022511 :         void Merge(OGREnvelope3D const &sOther)
     247             :         {
     248     1022511 :             MinX = MIN(MinX, sOther.MinX);
     249     1022511 :             MaxX = MAX(MaxX, sOther.MaxX);
     250     1022511 :             MinY = MIN(MinY, sOther.MinY);
     251     1022511 :             MaxY = MAX(MaxY, sOther.MaxY);
     252     1022511 :             MinZ = MIN(MinZ, sOther.MinZ);
     253     1022511 :             MaxZ = MAX(MaxZ, sOther.MaxZ);
     254     1022511 :         }
     255             : 
     256             :         /** Update the current object by computing its union with the other
     257             :          * rectangle */
     258         171 :         void Merge(OGREnvelope const &sOther)
     259             :         {
     260         171 :             MinX = MIN(MinX, sOther.MinX);
     261         171 :             MaxX = MAX(MaxX, sOther.MaxX);
     262         171 :             MinY = MIN(MinY, sOther.MinY);
     263         171 :             MaxY = MAX(MaxY, sOther.MaxY);
     264         171 :         }
     265             : 
     266             :         /** Update the current object by computing its union with the provided
     267             :          * point */
     268       14973 :         void Merge(double dfX, double dfY, double dfZ)
     269             :         {
     270       14973 :             MinX = MIN(MinX, dfX);
     271       14973 :             MaxX = MAX(MaxX, dfX);
     272       14973 :             MinY = MIN(MinY, dfY);
     273       14973 :             MaxY = MAX(MaxY, dfY);
     274       14973 :             MinZ = MIN(MinZ, dfZ);
     275       14973 :             MaxZ = MAX(MaxZ, dfZ);
     276       14973 :         }
     277             : 
     278             :         /** Update the current object by computing its intersection with the
     279             :          * other rectangle */
     280             :         void Intersect(OGREnvelope3D const &sOther)
     281             :         {
     282             :             if (Intersects(sOther))
     283             :             {
     284             :                 if (IsInit())
     285             :                 {
     286             :                     MinX = MAX(MinX, sOther.MinX);
     287             :                     MaxX = MIN(MaxX, sOther.MaxX);
     288             :                     MinY = MAX(MinY, sOther.MinY);
     289             :                     MaxY = MIN(MaxY, sOther.MaxY);
     290             :                     MinZ = MAX(MinZ, sOther.MinZ);
     291             :                     MaxZ = MIN(MaxZ, sOther.MaxZ);
     292             :                 }
     293             :                 else
     294             :                 {
     295             :                     MinX = sOther.MinX;
     296             :                     MaxX = sOther.MaxX;
     297             :                     MinY = sOther.MinY;
     298             :                     MaxY = sOther.MaxY;
     299             :                     MinZ = sOther.MinZ;
     300             :                     MaxZ = sOther.MaxZ;
     301             :                 }
     302             :             }
     303             :             else
     304             :             {
     305             :                 *this = OGREnvelope3D();
     306             :             }
     307             :         }
     308             : 
     309             :         /** Return whether the current object intersects with the other
     310             :          * rectangle */
     311             :         int Intersects(OGREnvelope3D const &other) const
     312             :         {
     313             :             return MinX <= other.MaxX && MaxX >= other.MinX &&
     314             :                    MinY <= other.MaxY && MaxY >= other.MinY &&
     315             :                    MinZ <= other.MaxZ && MaxZ >= other.MinZ;
     316             :         }
     317             : 
     318             :         /** Return whether the current object contains the other rectangle */
     319             :         int Contains(OGREnvelope3D const &other) const
     320             :         {
     321             :             return MinX <= other.MinX && MinY <= other.MinY &&
     322             :                    MaxX >= other.MaxX && MaxY >= other.MaxY &&
     323             :                    MinZ <= other.MinZ && MaxZ >= other.MaxZ;
     324             :         }
     325             :     };
     326             : 
     327             : }  // extern "C++"
     328             : 
     329             : #else
     330             : typedef struct
     331             : {
     332             :     double MinX;
     333             :     double MaxX;
     334             :     double MinY;
     335             :     double MaxY;
     336             :     double MinZ;
     337             :     double MaxZ;
     338             : } OGREnvelope3D;
     339             : #endif
     340             : 
     341             : CPL_C_START
     342             : 
     343             : /*! @cond Doxygen_Suppress */
     344             : void CPL_DLL *OGRMalloc(size_t) CPL_WARN_DEPRECATED("Use CPLMalloc instead.");
     345             : void CPL_DLL *OGRCalloc(size_t, size_t)
     346             :     CPL_WARN_DEPRECATED("Use CPLCalloc instead.");
     347             : void CPL_DLL *OGRRealloc(void *, size_t)
     348             :     CPL_WARN_DEPRECATED("Use CPLRealloc instead.");
     349             : char CPL_DLL *OGRStrdup(const char *)
     350             :     CPL_WARN_DEPRECATED("Use CPLStrdup instead.");
     351             : void CPL_DLL OGRFree(void *) CPL_WARN_DEPRECATED("Use CPLFree instead.");
     352             : /*! @endcond */
     353             : 
     354             : #ifdef STRICT_OGRERR_TYPE
     355             : /** Type for a OGR error */
     356             : typedef enum
     357             : {
     358             :     OGRERR_NONE,                      /**< Success */
     359             :     OGRERR_NOT_ENOUGH_DATA,           /**< Not enough data to deserialize */
     360             :     OGRERR_NOT_ENOUGH_MEMORY,         /**< Not enough memory */
     361             :     OGRERR_UNSUPPORTED_GEOMETRY_TYPE, /**< Unsupported geometry type */
     362             :     OGRERR_UNSUPPORTED_OPERATION,     /**< Unsupported operation */
     363             :     OGRERR_CORRUPT_DATA,              /**< Corrupt data */
     364             :     OGRERR_FAILURE,                   /**< Failure */
     365             :     OGRERR_UNSUPPORTED_SRS,           /**< Unsupported SRS */
     366             :     OGRERR_INVALID_HANDLE,            /**< Invalid handle */
     367             :     OGRERR_NON_EXISTING_FEATURE /**< Non existing feature. Added in GDAL 2.0 */
     368             : } OGRErr;
     369             : #else
     370             : /** Type for a OGR error */
     371             : typedef int OGRErr;
     372             : 
     373             : #define OGRERR_NONE 0              /**< Success */
     374             : #define OGRERR_NOT_ENOUGH_DATA 1   /**< Not enough data to deserialize */
     375             : #define OGRERR_NOT_ENOUGH_MEMORY 2 /**< Not enough memory */
     376             : #define OGRERR_UNSUPPORTED_GEOMETRY_TYPE 3 /**< Unsupported geometry type */
     377             : #define OGRERR_UNSUPPORTED_OPERATION 4     /**< Unsupported operation */
     378             : #define OGRERR_CORRUPT_DATA 5              /**< Corrupt data */
     379             : #define OGRERR_FAILURE 6                   /**< Failure */
     380             : #define OGRERR_UNSUPPORTED_SRS 7           /**< Unsupported SRS */
     381             : #define OGRERR_INVALID_HANDLE 8            /**< Invalid handle */
     382             : #define OGRERR_NON_EXISTING_FEATURE                                            \
     383             :     9 /**< Non existing feature. Added in GDAL 2.0 */
     384             : 
     385             : #endif
     386             : 
     387             : /** Type for a OGR boolean */
     388             : typedef int OGRBoolean;
     389             : 
     390             : /* -------------------------------------------------------------------- */
     391             : /*      ogr_geometry.h related definitions.                             */
     392             : /* -------------------------------------------------------------------- */
     393             : 
     394             : #if defined(HAVE_GCC_DIAGNOSTIC_PUSH) && __STDC_VERSION__ < 202311L
     395             : /* wkbPoint25D and friends cause warnings with -Wpedantic prior to C23. */
     396             : /* Cf https://github.com/OSGeo/gdal/issues/2322 */
     397             : #pragma GCC diagnostic push
     398             : #pragma GCC diagnostic ignored "-Wpedantic"
     399             : #endif
     400             : 
     401             : /**
     402             :  * List of well known binary geometry types.  These are used within the BLOBs
     403             :  * but are also returned from OGRGeometry::getGeometryType() to identify the
     404             :  * type of a geometry object.
     405             :  */
     406             : typedef enum
     407             : {
     408             :     wkbUnknown = 0, /**< unknown type, non-standard */
     409             : 
     410             :     wkbPoint = 1,      /**< 0-dimensional geometric object, standard WKB */
     411             :     wkbLineString = 2, /**< 1-dimensional geometric object with linear
     412             :                         *   interpolation between Points, standard WKB */
     413             :     wkbPolygon = 3,    /**< planar 2-dimensional geometric object defined
     414             :                         *   by 1 exterior boundary and 0 or more interior
     415             :                         *   boundaries, standard WKB */
     416             :     wkbMultiPoint = 4, /**< GeometryCollection of Points, standard WKB */
     417             :     wkbMultiLineString =
     418             :         5,               /**< GeometryCollection of LineStrings, standard WKB */
     419             :     wkbMultiPolygon = 6, /**< GeometryCollection of Polygons, standard WKB */
     420             :     wkbGeometryCollection = 7, /**< geometric object that is a collection of 1
     421             :                                     or more geometric objects, standard WKB */
     422             : 
     423             :     wkbCircularString = 8, /**< one or more circular arc segments connected end
     424             :                             * to end, ISO SQL/MM Part 3. GDAL &gt;= 2.0 */
     425             :     wkbCompoundCurve = 9, /**< sequence of contiguous curves, ISO SQL/MM Part 3.
     426             :                              GDAL &gt;= 2.0 */
     427             :     wkbCurvePolygon = 10, /**< planar surface, defined by 1 exterior boundary
     428             :                            *   and zero or more interior boundaries, that are
     429             :                            * curves. ISO SQL/MM Part 3. GDAL &gt;= 2.0 */
     430             :     wkbMultiCurve = 11,   /**< GeometryCollection of Curves, ISO SQL/MM Part 3.
     431             :                              GDAL &gt;= 2.0 */
     432             :     wkbMultiSurface = 12, /**< GeometryCollection of Surfaces, ISO SQL/MM
     433             :                              Part 3. GDAL &gt;= 2.0 */
     434             :     wkbCurve =
     435             :         13, /**< Curve (abstract type). ISO SQL/MM Part 3. GDAL &gt;= 2.1 */
     436             :     wkbSurface =
     437             :         14, /**< Surface (abstract type). ISO SQL/MM Part 3. GDAL &gt;= 2.1 */
     438             :     wkbPolyhedralSurface =
     439             :         15,      /**< a contiguous collection of polygons, which share common
     440             :                   * boundary segments,      ISO SQL/MM Part 3. GDAL &gt;= 2.3 */
     441             :     wkbTIN = 16, /**< a PolyhedralSurface consisting only of Triangle patches
     442             :                   *    ISO SQL/MM Part 3. GDAL &gt;= 2.3 */
     443             :     wkbTriangle = 17, /**< a Triangle. ISO SQL/MM Part 3. GDAL &gt;= 2.3 */
     444             : 
     445             :     wkbNone = 100,       /**< non-standard, for pure attribute records */
     446             :     wkbLinearRing = 101, /**< non-standard, just for createGeometry() */
     447             : 
     448             :     wkbCircularStringZ = 1008, /**< wkbCircularString with Z component. ISO
     449             :                                   SQL/MM Part 3. GDAL &gt;= 2.0 */
     450             :     wkbCompoundCurveZ = 1009, /**< wkbCompoundCurve with Z component. ISO SQL/MM
     451             :                                  Part 3. GDAL &gt;= 2.0 */
     452             :     wkbCurvePolygonZ = 1010,  /**< wkbCurvePolygon with Z component. ISO SQL/MM
     453             :                                  Part 3. GDAL &gt;= 2.0 */
     454             :     wkbMultiCurveZ = 1011,    /**< wkbMultiCurve with Z component. ISO SQL/MM
     455             :                                  Part 3. GDAL &gt;= 2.0 */
     456             :     wkbMultiSurfaceZ = 1012,  /**< wkbMultiSurface with Z component. ISO SQL/MM
     457             :                                  Part 3. GDAL &gt;= 2.0 */
     458             :     wkbCurveZ = 1013,   /**< wkbCurve with Z component. ISO SQL/MM Part 3. GDAL
     459             :                            &gt;= 2.1 */
     460             :     wkbSurfaceZ = 1014, /**< wkbSurface with Z component. ISO SQL/MM Part 3.
     461             :                            GDAL &gt;= 2.1 */
     462             :     wkbPolyhedralSurfaceZ = 1015, /**< ISO SQL/MM Part 3. GDAL &gt;= 2.3 */
     463             :     wkbTINZ = 1016,               /**< ISO SQL/MM Part 3. GDAL &gt;= 2.3 */
     464             :     wkbTriangleZ = 1017,          /**< ISO SQL/MM Part 3. GDAL &gt;= 2.3 */
     465             : 
     466             :     wkbPointM = 2001,              /**< ISO SQL/MM Part 3. GDAL &gt;= 2.1 */
     467             :     wkbLineStringM = 2002,         /**< ISO SQL/MM Part 3. GDAL &gt;= 2.1 */
     468             :     wkbPolygonM = 2003,            /**< ISO SQL/MM Part 3. GDAL &gt;= 2.1 */
     469             :     wkbMultiPointM = 2004,         /**< ISO SQL/MM Part 3. GDAL &gt;= 2.1 */
     470             :     wkbMultiLineStringM = 2005,    /**< ISO SQL/MM Part 3. GDAL &gt;= 2.1 */
     471             :     wkbMultiPolygonM = 2006,       /**< ISO SQL/MM Part 3. GDAL &gt;= 2.1 */
     472             :     wkbGeometryCollectionM = 2007, /**< ISO SQL/MM Part 3. GDAL &gt;= 2.1 */
     473             :     wkbCircularStringM = 2008,     /**< ISO SQL/MM Part 3. GDAL &gt;= 2.1 */
     474             :     wkbCompoundCurveM = 2009,      /**< ISO SQL/MM Part 3. GDAL &gt;= 2.1 */
     475             :     wkbCurvePolygonM = 2010,       /**< ISO SQL/MM Part 3. GDAL &gt;= 2.1 */
     476             :     wkbMultiCurveM = 2011,         /**< ISO SQL/MM Part 3. GDAL &gt;= 2.1 */
     477             :     wkbMultiSurfaceM = 2012,       /**< ISO SQL/MM Part 3. GDAL &gt;= 2.1 */
     478             :     wkbCurveM = 2013,              /**< ISO SQL/MM Part 3. GDAL &gt;= 2.1 */
     479             :     wkbSurfaceM = 2014,            /**< ISO SQL/MM Part 3. GDAL &gt;= 2.1 */
     480             :     wkbPolyhedralSurfaceM = 2015,  /**< ISO SQL/MM Part 3. GDAL &gt;= 2.3 */
     481             :     wkbTINM = 2016,                /**< ISO SQL/MM Part 3. GDAL &gt;= 2.3 */
     482             :     wkbTriangleM = 2017,           /**< ISO SQL/MM Part 3. GDAL &gt;= 2.3 */
     483             : 
     484             :     wkbPointZM = 3001,              /**< ISO SQL/MM Part 3. GDAL &gt;= 2.1 */
     485             :     wkbLineStringZM = 3002,         /**< ISO SQL/MM Part 3. GDAL &gt;= 2.1 */
     486             :     wkbPolygonZM = 3003,            /**< ISO SQL/MM Part 3. GDAL &gt;= 2.1 */
     487             :     wkbMultiPointZM = 3004,         /**< ISO SQL/MM Part 3. GDAL &gt;= 2.1 */
     488             :     wkbMultiLineStringZM = 3005,    /**< ISO SQL/MM Part 3. GDAL &gt;= 2.1 */
     489             :     wkbMultiPolygonZM = 3006,       /**< ISO SQL/MM Part 3. GDAL &gt;= 2.1 */
     490             :     wkbGeometryCollectionZM = 3007, /**< ISO SQL/MM Part 3. GDAL &gt;= 2.1 */
     491             :     wkbCircularStringZM = 3008,     /**< ISO SQL/MM Part 3. GDAL &gt;= 2.1 */
     492             :     wkbCompoundCurveZM = 3009,      /**< ISO SQL/MM Part 3. GDAL &gt;= 2.1 */
     493             :     wkbCurvePolygonZM = 3010,       /**< ISO SQL/MM Part 3. GDAL &gt;= 2.1 */
     494             :     wkbMultiCurveZM = 3011,         /**< ISO SQL/MM Part 3. GDAL &gt;= 2.1 */
     495             :     wkbMultiSurfaceZM = 3012,       /**< ISO SQL/MM Part 3. GDAL &gt;= 2.1 */
     496             :     wkbCurveZM = 3013,              /**< ISO SQL/MM Part 3. GDAL &gt;= 2.1 */
     497             :     wkbSurfaceZM = 3014,            /**< ISO SQL/MM Part 3. GDAL &gt;= 2.1 */
     498             :     wkbPolyhedralSurfaceZM = 3015,  /**< ISO SQL/MM Part 3. GDAL &gt;= 2.3 */
     499             :     wkbTINZM = 3016,                /**< ISO SQL/MM Part 3. GDAL &gt;= 2.3 */
     500             :     wkbTriangleZM = 3017,           /**< ISO SQL/MM Part 3. GDAL &gt;= 2.3 */
     501             : 
     502             : #if defined(DOXYGEN_SKIP)
     503             :     // Sphinx doesn't like 0x8000000x constants
     504             :     wkbPoint25D = -2147483647,             /**< 2.5D extension as per 99-402 */
     505             :     wkbLineString25D = -2147483646,        /**< 2.5D extension as per 99-402 */
     506             :     wkbPolygon25D = -2147483645,           /**< 2.5D extension as per 99-402 */
     507             :     wkbMultiPoint25D = -2147483644,        /**< 2.5D extension as per 99-402 */
     508             :     wkbMultiLineString25D = -2147483643,   /**< 2.5D extension as per 99-402 */
     509             :     wkbMultiPolygon25D = -2147483642,      /**< 2.5D extension as per 99-402 */
     510             :     wkbGeometryCollection25D = -2147483641 /**< 2.5D extension as per 99-402 */
     511             : #else
     512             :     wkbPoint25D = 0x80000001,             /**< 2.5D extension as per 99-402 */
     513             :     wkbLineString25D = 0x80000002,        /**< 2.5D extension as per 99-402 */
     514             :     wkbPolygon25D = 0x80000003,           /**< 2.5D extension as per 99-402 */
     515             :     wkbMultiPoint25D = 0x80000004,        /**< 2.5D extension as per 99-402 */
     516             :     wkbMultiLineString25D = 0x80000005,   /**< 2.5D extension as per 99-402 */
     517             :     wkbMultiPolygon25D = 0x80000006,      /**< 2.5D extension as per 99-402 */
     518             :     wkbGeometryCollection25D = 0x80000007 /**< 2.5D extension as per 99-402 */
     519             : #endif
     520             : } OGRwkbGeometryType;
     521             : 
     522             : #if defined(HAVE_GCC_DIAGNOSTIC_PUSH) && __STDC_VERSION__ < 202311L
     523             : #pragma GCC diagnostic pop
     524             : #endif
     525             : 
     526             : /* clang-format off */
     527             : /**
     528             :  * Output variants of WKB we support.
     529             :  *
     530             :  * 99-402 was a short-lived extension to SFSQL 1.1 that used a high-bit flag
     531             :  * to indicate the presence of Z coordinates in a WKB geometry.
     532             :  *
     533             :  * SQL/MM Part 3 and SFSQL 1.2 use offsets of 1000 (Z), 2000 (M) and 3000 (ZM)
     534             :  * to indicate the present of higher dimensional coordinates in a WKB geometry.
     535             :  * Reference: <a href="https://portal.opengeospatial.org/files/?artifact_id=320243">
     536             :  * 09-009_Committee_Draft_ISOIEC_CD_13249-3_SQLMM_Spatial.pdf</a>,
     537             :  * ISO/IEC JTC 1/SC 32 N 1820, ISO/IEC CD 13249-3:201x(E), Date: 2009-01-16.
     538             :  * The codes are also found in §8.2.3 of <a href="http://portal.opengeospatial.org/files/?artifact_id=25355"> OGC
     539             :  * 06-103r4 "OpenGIS® Implementation Standard for Geographic information -
     540             :  * Simple feature access - Part 1: Common architecture", v1.2.1</a>
     541             :  */
     542             : /* clang-format on */
     543             : 
     544             : typedef enum
     545             : {
     546             :     wkbVariantOldOgc, /**< Old-style 99-402 extended dimension (Z) WKB types */
     547             :     wkbVariantIso, /**< SFSQL 1.2 and ISO SQL/MM Part 3 extended dimension (Z&M)
     548             :                       WKB types */
     549             :     wkbVariantPostGIS1 /**< PostGIS 1.X has different codes for CurvePolygon,
     550             :                           MultiCurve and MultiSurface */
     551             : } OGRwkbVariant;
     552             : 
     553             : #ifndef GDAL_COMPILATION
     554             : /** @deprecated in GDAL 2.0. Use wkbHasZ() or wkbSetZ() instead */
     555             : #define wkb25DBit 0x80000000
     556             : #endif
     557             : 
     558             : #ifndef __cplusplus
     559             : /** Return the 2D geometry type corresponding to the specified geometry type */
     560             : #define wkbFlatten(x) OGR_GT_Flatten((OGRwkbGeometryType)(x))
     561             : #else
     562             :                                           /** Return the 2D geometry type corresponding to the specified geometry type */
     563             : #define wkbFlatten(x) OGR_GT_Flatten(static_cast<OGRwkbGeometryType>(x))
     564             : #endif
     565             : 
     566             : /** Return if the geometry type is a 3D geometry type
     567             :  * @since GDAL 2.0
     568             :  */
     569             : #define wkbHasZ(x) (OGR_GT_HasZ(x) != 0)
     570             : 
     571             : /** Return the 3D geometry type corresponding to the specified geometry type.
     572             :  * @since GDAL 2.0
     573             :  */
     574             : #define wkbSetZ(x) OGR_GT_SetZ(x)
     575             : 
     576             : /** Return if the geometry type is a measured geometry type
     577             :  * @since GDAL 2.1
     578             :  */
     579             : #define wkbHasM(x) (OGR_GT_HasM(x) != 0)
     580             : 
     581             : /** Return the measured geometry type corresponding to the specified geometry
     582             :  * type.
     583             :  * @since GDAL 2.1
     584             :  */
     585             : #define wkbSetM(x) OGR_GT_SetM(x)
     586             : 
     587             : #ifndef DOXYGEN_SKIP
     588             : #define ogrZMarker 0x21125711
     589             : #endif
     590             : 
     591             : const char CPL_DLL *OGRGeometryTypeToName(OGRwkbGeometryType eType);
     592             : OGRwkbGeometryType CPL_DLL OGRMergeGeometryTypes(OGRwkbGeometryType eMain,
     593             :                                                  OGRwkbGeometryType eExtra);
     594             : OGRwkbGeometryType CPL_DLL OGRMergeGeometryTypesEx(OGRwkbGeometryType eMain,
     595             :                                                    OGRwkbGeometryType eExtra,
     596             :                                                    int bAllowPromotingToCurves);
     597             : OGRwkbGeometryType CPL_DLL OGR_GT_Flatten(OGRwkbGeometryType eType);
     598             : OGRwkbGeometryType CPL_DLL OGR_GT_SetZ(OGRwkbGeometryType eType);
     599             : OGRwkbGeometryType CPL_DLL OGR_GT_SetM(OGRwkbGeometryType eType);
     600             : OGRwkbGeometryType CPL_DLL OGR_GT_SetModifier(OGRwkbGeometryType eType,
     601             :                                               int bSetZ, int bSetM);
     602             : int CPL_DLL OGR_GT_HasZ(OGRwkbGeometryType eType);
     603             : int CPL_DLL OGR_GT_HasM(OGRwkbGeometryType eType);
     604             : int CPL_DLL OGR_GT_IsSubClassOf(OGRwkbGeometryType eType,
     605             :                                 OGRwkbGeometryType eSuperType);
     606             : int CPL_DLL OGR_GT_IsCurve(OGRwkbGeometryType);
     607             : int CPL_DLL OGR_GT_IsSurface(OGRwkbGeometryType);
     608             : int CPL_DLL OGR_GT_IsNonLinear(OGRwkbGeometryType);
     609             : OGRwkbGeometryType CPL_DLL OGR_GT_GetCollection(OGRwkbGeometryType eType);
     610             : OGRwkbGeometryType CPL_DLL OGR_GT_GetCurve(OGRwkbGeometryType eType);
     611             : OGRwkbGeometryType CPL_DLL OGR_GT_GetLinear(OGRwkbGeometryType eType);
     612             : 
     613             : /** Enumeration to describe byte order */
     614             : typedef enum
     615             : {
     616             :     wkbXDR = 0, /**< MSB/Sun/Motorola: Most Significant Byte First   */
     617             :     wkbNDR = 1  /**< LSB/Intel/Vax: Least Significant Byte First      */
     618             : } OGRwkbByteOrder;
     619             : 
     620             : #ifndef DOXYGEN_SKIP
     621             : 
     622             : #ifndef NO_HACK_FOR_IBM_DB2_V72
     623             : #define HACK_FOR_IBM_DB2_V72
     624             : #endif
     625             : 
     626             : #ifdef HACK_FOR_IBM_DB2_V72
     627             : #define DB2_V72_FIX_BYTE_ORDER(x) ((((x)&0x31) == (x)) ? ((x)&0x1) : (x))
     628             : #define DB2_V72_UNFIX_BYTE_ORDER(x)                                            \
     629             :     CPL_STATIC_CAST(unsigned char, OGRGeometry::bGenerate_DB2_V72_BYTE_ORDER   \
     630             :                                        ? ((x) | 0x30)                          \
     631             :                                        : (x))
     632             : #else
     633             : #define DB2_V72_FIX_BYTE_ORDER(x) (x)
     634             : #define DB2_V72_UNFIX_BYTE_ORDER(x) (x)
     635             : #endif
     636             : 
     637             : #endif /* #ifndef DOXYGEN_SKIP */
     638             : 
     639             : /** Alter field name.
     640             :  * Used by OGR_L_AlterFieldDefn().
     641             :  */
     642             : #define ALTER_NAME_FLAG 0x1
     643             : 
     644             : /** Alter field type.
     645             :  * Used by OGR_L_AlterFieldDefn().
     646             :  */
     647             : #define ALTER_TYPE_FLAG 0x2
     648             : 
     649             : /** Alter field width and precision.
     650             :  * Used by OGR_L_AlterFieldDefn().
     651             :  */
     652             : #define ALTER_WIDTH_PRECISION_FLAG 0x4
     653             : 
     654             : /** Alter field NOT NULL constraint.
     655             :  * Used by OGR_L_AlterFieldDefn().
     656             :  * @since GDAL 2.0
     657             :  */
     658             : #define ALTER_NULLABLE_FLAG 0x8
     659             : 
     660             : /** Alter field DEFAULT value.
     661             :  * Used by OGR_L_AlterFieldDefn().
     662             :  * @since GDAL 2.0
     663             :  */
     664             : #define ALTER_DEFAULT_FLAG 0x10
     665             : 
     666             : /** Alter field UNIQUE constraint.
     667             :  * Used by OGR_L_AlterFieldDefn().
     668             :  * @since GDAL 3.2
     669             :  */
     670             : #define ALTER_UNIQUE_FLAG 0x20
     671             : 
     672             : /** Alter field domain name.
     673             :  * Used by OGR_L_AlterFieldDefn().
     674             :  * @since GDAL 3.3
     675             :  */
     676             : #define ALTER_DOMAIN_FLAG 0x40
     677             : 
     678             : /** Alter field alternative name.
     679             :  * Used by OGR_L_AlterFieldDefn().
     680             :  * @since GDAL 3.7
     681             :  */
     682             : #define ALTER_ALTERNATIVE_NAME_FLAG 0x80
     683             : 
     684             : /** Alter field comment.
     685             :  * Used by OGR_L_AlterFieldDefn().
     686             :  * @since GDAL 3.7
     687             :  */
     688             : #define ALTER_COMMENT_FLAG 0x100
     689             : 
     690             : /** Alter all parameters of field definition.
     691             :  * Used by OGR_L_AlterFieldDefn().
     692             :  */
     693             : #define ALTER_ALL_FLAG                                                         \
     694             :     (ALTER_NAME_FLAG | ALTER_TYPE_FLAG | ALTER_WIDTH_PRECISION_FLAG |          \
     695             :      ALTER_NULLABLE_FLAG | ALTER_DEFAULT_FLAG | ALTER_UNIQUE_FLAG |            \
     696             :      ALTER_DOMAIN_FLAG | ALTER_ALTERNATIVE_NAME_FLAG | ALTER_COMMENT_FLAG)
     697             : 
     698             : /** Alter geometry field name.
     699             :  * Used by OGR_L_AlterGeomFieldDefn().
     700             :  * @since GDAL 3.6
     701             :  */
     702             : #define ALTER_GEOM_FIELD_DEFN_NAME_FLAG 0x1000
     703             : 
     704             : /** Alter geometry field type.
     705             :  * Used by OGR_L_AlterGeomFieldDefn().
     706             :  * @since GDAL 3.6
     707             :  */
     708             : #define ALTER_GEOM_FIELD_DEFN_TYPE_FLAG 0x2000
     709             : 
     710             : /** Alter geometry field nullable state.
     711             :  * Used by OGR_L_AlterGeomFieldDefn().
     712             :  * @since GDAL 3.6
     713             :  */
     714             : #define ALTER_GEOM_FIELD_DEFN_NULLABLE_FLAG 0x4000
     715             : 
     716             : /** Alter geometry field spatial reference system (except its coordinate epoch)
     717             :  * Used by OGR_L_AlterGeomFieldDefn().
     718             :  * @since GDAL 3.6
     719             :  */
     720             : #define ALTER_GEOM_FIELD_DEFN_SRS_FLAG 0x8000
     721             : 
     722             : /** Alter geometry field coordinate epoch
     723             :  * Used by OGR_L_AlterGeomFieldDefn().
     724             :  * @since GDAL 3.6
     725             :  */
     726             : #define ALTER_GEOM_FIELD_DEFN_SRS_COORD_EPOCH_FLAG 0x10000
     727             : 
     728             : /** Alter all parameters of field definition.
     729             :  * Used by OGR_L_AlterGeomFieldDefn().
     730             :  * @since GDAL 3.6
     731             :  */
     732             : #define ALTER_GEOM_FIELD_DEFN_ALL_FLAG                                         \
     733             :     (ALTER_GEOM_FIELD_DEFN_NAME_FLAG | ALTER_GEOM_FIELD_DEFN_TYPE_FLAG |       \
     734             :      ALTER_GEOM_FIELD_DEFN_NULLABLE_FLAG | ALTER_GEOM_FIELD_DEFN_SRS_FLAG |    \
     735             :      ALTER_GEOM_FIELD_DEFN_SRS_COORD_EPOCH_FLAG)
     736             : 
     737             : /** Validate that fields respect not-null constraints.
     738             :  * Used by OGR_F_Validate().
     739             :  * @since GDAL 2.0
     740             :  */
     741             : #define OGR_F_VAL_NULL 0x00000001
     742             : 
     743             : /** Validate that geometries respect geometry column type.
     744             :  * Used by OGR_F_Validate().
     745             :  * @since GDAL 2.0
     746             :  */
     747             : #define OGR_F_VAL_GEOM_TYPE 0x00000002
     748             : 
     749             : /** Validate that (string) fields respect field width.
     750             :  * Used by OGR_F_Validate().
     751             :  * @since GDAL 2.0
     752             :  */
     753             : #define OGR_F_VAL_WIDTH 0x00000004
     754             : 
     755             : /** Allow fields that are null when there's an associated default value.
     756             :  * This can be used for drivers where the low-level layers will automatically
     757             :  * set the field value to the associated default value. This flag only makes
     758             :  * sense if OGR_F_VAL_NULL is set too. Used by OGR_F_Validate().
     759             :  * @since GDAL 2.0
     760             :  */
     761             : #define OGR_F_VAL_ALLOW_NULL_WHEN_DEFAULT 0x00000008
     762             : 
     763             : /** Allow geometry fields to have a different coordinate dimension that their
     764             :  * geometry column type.
     765             :  * This flag only makes sense if OGR_F_VAL_GEOM_TYPE is set too.
     766             :  * Used by OGR_F_Validate().
     767             :  * @since GDAL 2.1
     768             :  */
     769             : #define OGR_F_VAL_ALLOW_DIFFERENT_GEOM_DIM 0x00000010
     770             : 
     771             : /** Enable all validation tests (except OGR_F_VAL_ALLOW_DIFFERENT_GEOM_DIM)
     772             :  * Used by OGR_F_Validate().
     773             :  * @since GDAL 2.0
     774             :  */
     775             : #define OGR_F_VAL_ALL (0x7FFFFFFF & ~OGR_F_VAL_ALLOW_DIFFERENT_GEOM_DIM)
     776             : 
     777             : /************************************************************************/
     778             : /*                  ogr_feature.h related definitions.                  */
     779             : /************************************************************************/
     780             : 
     781             : /**
     782             :  * List of feature field types.  This list is likely to be extended in the
     783             :  * future ... avoid coding applications based on the assumption that all
     784             :  * field types can be known.
     785             :  */
     786             : 
     787             : typedef enum
     788             : {
     789             :     /** Single signed 32bit integer */ OFTInteger = 0,
     790             :     /** List of signed 32bit integers */ OFTIntegerList = 1,
     791             :     /** Double Precision floating point */ OFTReal = 2,
     792             :     /** List of doubles */ OFTRealList = 3,
     793             :     /** String of ASCII chars */ OFTString = 4,
     794             :     /** Array of strings */ OFTStringList = 5,
     795             :     /** deprecated */ OFTWideString = 6,
     796             :     /** deprecated */ OFTWideStringList = 7,
     797             :     /** Raw Binary data */ OFTBinary = 8,
     798             :     /** Date */ OFTDate = 9,
     799             :     /** Time */ OFTTime = 10,
     800             :     /** Date and Time */ OFTDateTime = 11,
     801             :     /** Single signed 64bit integer */ OFTInteger64 = 12,
     802             :     /** List of signed 64bit integers */ OFTInteger64List = 13,
     803             :     OFTMaxType = 13
     804             : } OGRFieldType;
     805             : 
     806             : /**
     807             :  * List of field subtypes. A subtype represents a hint, a restriction of the
     808             :  * main type, that is not strictly necessary to consult.
     809             :  * This list is likely to be extended in the
     810             :  * future ... avoid coding applications based on the assumption that all
     811             :  * field types can be known.
     812             :  * Most subtypes only make sense for a restricted set of main types.
     813             :  * @since GDAL 2.0
     814             :  */
     815             : typedef enum
     816             : {
     817             :     /** No subtype. This is the default value */ OFSTNone = 0,
     818             :     /** Boolean integer. Only valid for OFTInteger and OFTIntegerList.*/
     819             :     OFSTBoolean = 1,
     820             :     /** Signed 16-bit integer. Only valid for OFTInteger and OFTIntegerList. */
     821             :     OFSTInt16 = 2,
     822             :     /** Single precision (32 bit) floating point. Only valid for OFTReal and
     823             :        OFTRealList. */
     824             :     OFSTFloat32 = 3,
     825             :     /** JSON content. Only valid for OFTString.
     826             :      * @since GDAL 2.4
     827             :      */
     828             :     OFSTJSON = 4,
     829             :     /** UUID string representation. Only valid for OFTString.
     830             :      * @since GDAL 3.3
     831             :      */
     832             :     OFSTUUID = 5,
     833             :     OFSTMaxSubType = 5
     834             : } OGRFieldSubType;
     835             : 
     836             : /**
     837             :  * Display justification for field values.
     838             :  */
     839             : 
     840             : typedef enum
     841             : {
     842             :     OJUndefined = 0,
     843             :     OJLeft = 1,
     844             :     OJRight = 2
     845             : } OGRJustification;
     846             : 
     847             : /** Special value for a unset FID */
     848             : #define OGRNullFID -1
     849             : 
     850             : /* Special value for an unknown field type. This should only be used
     851             :  * while reading a file. At the end of file any unknown types should
     852             :  * be set to OFTString.
     853             :  */
     854             : /*! @cond Doxygen_Suppress */
     855             : #define OGRUnknownType static_cast<OGRFieldType>(-1)
     856             : /*! @endcond */
     857             : 
     858             : /** Special value set in OGRField.Set.nMarker1, nMarker2 and nMarker3 for
     859             :  *  a unset field.
     860             :  *  Direct use of this value is strongly discouraged.
     861             :  *  Use OGR_RawField_SetUnset() or OGR_RawField_IsUnset() instead.
     862             :  */
     863             : #define OGRUnsetMarker -21121
     864             : 
     865             : /** Special value set in OGRField.Set.nMarker1, nMarker2 and nMarker3 for
     866             :  *  a null field.
     867             :  *  Direct use of this value is strongly discouraged.
     868             :  *  Use OGR_RawField_SetNull() or OGR_RawField_IsNull() instead.
     869             :  *  @since GDAL 2.2
     870             :  */
     871             : #define OGRNullMarker -21122
     872             : 
     873             : /** Time zone flag indicating unknown timezone. For the
     874             :  *  OGRFieldDefn::GetTZFlag() property, this may also indicate a mix of
     875             :  *  unknown, localtime or known time zones in the same field.
     876             :  */
     877             : #define OGR_TZFLAG_UNKNOWN 0
     878             : 
     879             : /** Time zone flag indicating local time */
     880             : #define OGR_TZFLAG_LOCALTIME 1
     881             : 
     882             : /** Time zone flag only returned by OGRFieldDefn::GetTZFlag() to indicate
     883             :  * that all values in the field have a known time zone (ie different from
     884             :  * OGR_TZFLAG_UNKNOWN and OGR_TZFLAG_LOCALTIME), but it may be different among
     885             :  * features. */
     886             : #define OGR_TZFLAG_MIXED_TZ 2
     887             : 
     888             : /** Time zone flag indicating UTC.
     889             :  * Used to derived other time zone flags with the following logic:
     890             :  * - values above 100 indicate a 15 minute increment per unit.
     891             :  * - values under 100 indicate a 15 minute decrement per unit.
     892             :  * For example: a value of 101 indicates UTC+00:15, a value of 102 UTC+00:30,
     893             :  * a value of 99 UTC-00:15 ,etc. */
     894             : #define OGR_TZFLAG_UTC 100
     895             : 
     896             : /************************************************************************/
     897             : /*                               OGRField                               */
     898             : /************************************************************************/
     899             : 
     900             : /**
     901             :  * OGRFeature field attribute value union.
     902             :  */
     903             : 
     904             : typedef union
     905             : {
     906             :     /*! @cond Doxygen_Suppress */
     907             :     int Integer;
     908             :     GIntBig Integer64;
     909             :     double Real;
     910             :     char *String;
     911             : 
     912             :     struct
     913             :     {
     914             :         int nCount;
     915             :         int *paList;
     916             :     } IntegerList;
     917             : 
     918             :     struct
     919             :     {
     920             :         int nCount;
     921             :         GIntBig *paList;
     922             :     } Integer64List;
     923             : 
     924             :     struct
     925             :     {
     926             :         int nCount;
     927             :         double *paList;
     928             :     } RealList;
     929             : 
     930             :     struct
     931             :     {
     932             :         int nCount;
     933             :         char **paList;
     934             :     } StringList;
     935             : 
     936             :     struct
     937             :     {
     938             :         int nCount;
     939             :         GByte *paData;
     940             :     } Binary;
     941             : 
     942             :     struct
     943             :     {
     944             :         int nMarker1;
     945             :         int nMarker2;
     946             :         int nMarker3;
     947             :     } Set;
     948             : 
     949             :     struct
     950             :     {
     951             :         GInt16 Year;
     952             :         GByte Month;
     953             :         GByte Day;
     954             :         GByte Hour;
     955             :         GByte Minute;
     956             :         GByte TZFlag;   /* 0=unknown, 1=localtime(ambiguous),
     957             :                            100=GMT, 104=GMT+1, 80=GMT-5, etc */
     958             :         GByte Reserved; /* must be set to 0 */
     959             :         float Second; /* with millisecond accuracy. at the end of the structure,
     960             :                          so as to keep it 12 bytes on 32 bit */
     961             :     } Date;
     962             : 
     963             :     /*! @endcond */
     964             : } OGRField;
     965             : 
     966             : /** Return the number of milliseconds from a datetime with decimal seconds */
     967             : int CPL_DLL OGR_GET_MS(float fSec);
     968             : 
     969             : /** Option for OGRParseDate() to ask for lax checks on the input format */
     970             : #define OGRPARSEDATE_OPTION_LAX 1
     971             : 
     972             : int CPL_DLL OGRParseDate(const char *pszInput, OGRField *psOutput,
     973             :                          int nOptions);
     974             : 
     975             : /* -------------------------------------------------------------------- */
     976             : /*      Constants from ogrsf_frmts.h for capabilities.                  */
     977             : /* -------------------------------------------------------------------- */
     978             : #define OLCRandomRead "RandomRead" /**< Layer capability for random read */
     979             : #define OLCSequentialWrite                                                     \
     980             :     "SequentialWrite" /**< Layer capability for sequential write */
     981             : #define OLCRandomWrite "RandomWrite" /**< Layer capability for random write */
     982             : #define OLCFastSpatialFilter                                                   \
     983             :     "FastSpatialFilter" /**< Layer capability for fast spatial filter */
     984             : #define OLCFastFeatureCount                                                    \
     985             :     "FastFeatureCount" /**< Layer capability for fast feature count retrieval  \
     986             :                         */
     987             : #define OLCFastGetExtent                                                       \
     988             :     "FastGetExtent" /**< Layer capability for fast extent retrieval */
     989             : #define OLCFastGetExtent3D                                                     \
     990             :     "FastGetExtent3D" /**< Layer capability for fast 3D extent retrieval */
     991             : #define OLCCreateField                                                         \
     992             :     "CreateField" /**< Layer capability for field creation                     \
     993             :                    */
     994             : #define OLCDeleteField                                                         \
     995             :     "DeleteField" /**< Layer capability for field deletion                     \
     996             :                    */
     997             : #define OLCReorderFields                                                       \
     998             :     "ReorderFields" /**< Layer capability for field reordering */
     999             : #define OLCAlterFieldDefn                                                      \
    1000             :     "AlterFieldDefn" /**< Layer capability for field alteration */
    1001             : #define OLCAlterGeomFieldDefn                                                  \
    1002             :     "AlterGeomFieldDefn" /**< Layer capability for geometry field alteration   \
    1003             :                           */
    1004             : #define OLCTransactions                                                        \
    1005             :     "Transactions" /**< Layer capability for transactions                      \
    1006             :                     */
    1007             : #define OLCDeleteFeature                                                       \
    1008             :     "DeleteFeature" /**< Layer capability for feature deletion */
    1009             : #define OLCUpsertFeature                                                       \
    1010             :     "UpsertFeature" /**< Layer capability for feature upsert */
    1011             : #define OLCUpdateFeature                                                       \
    1012             :     "UpdateFeature" /**< Layer capability for specialized \
    1013             :                                               UpdateFeature() implementation */
    1014             : #define OLCFastSetNextByIndex                                                  \
    1015             :     "FastSetNextByIndex" /**< Layer capability for setting next feature index  \
    1016             :                           */
    1017             : #define OLCStringsAsUTF8                                                       \
    1018             :     "StringsAsUTF8" /**< Layer capability for strings returned with UTF-8      \
    1019             :                        encoding */
    1020             : #define OLCIgnoreFields                                                        \
    1021             :     "IgnoreFields" /**< Layer capability for field ignoring */
    1022             : #define OLCCreateGeomField                                                     \
    1023             :     "CreateGeomField" /**< Layer capability for geometry field creation */
    1024             : #define OLCCurveGeometries                                                     \
    1025             :     "CurveGeometries" /**< Layer capability for curve geometries support */
    1026             : #define OLCMeasuredGeometries                                                  \
    1027             :     "MeasuredGeometries" /**< Layer capability for measured geometries support \
    1028             :                           */
    1029             : #define OLCZGeometries                                                         \
    1030             :     "ZGeometries" /**< Layer capability for geometry with Z dimension support. \
    1031             :                      Since GDAL 3.6. */
    1032             : #define OLCRename                                                              \
    1033             :     "Rename" /**< Layer capability for a layer that supports Rename() */
    1034             : #define OLCFastGetArrowStream                                                  \
    1035             :     "FastGetArrowStream" /**< Layer capability for fast GetArrowStream()       \
    1036             :                             implementation */
    1037             : #define OLCFastWriteArrowBatch                                                 \
    1038             :     "FastWriteArrowBatch" /**< Layer capability for fast WriteArrowBatch()     \
    1039             :                             implementation */
    1040             : 
    1041             : #define ODsCCreateLayer                                                        \
    1042             :     "CreateLayer" /**< Dataset capability for layer creation */
    1043             : #define ODsCDeleteLayer                                                        \
    1044             :     "DeleteLayer" /**< Dataset capability for layer deletion */
    1045             : /* Reserved:                   "RenameLayer" */
    1046             : #define ODsCCreateGeomFieldAfterCreateLayer                                    \
    1047             :     "CreateGeomFieldAfterCreateLayer" /**< Dataset capability for geometry     \
    1048             :                                          field creation support */
    1049             : #define ODsCCurveGeometries                                                    \
    1050             :     "CurveGeometries" /**< Dataset capability for curve geometries support */
    1051             : #define ODsCTransactions                                                       \
    1052             :     "Transactions" /**< Dataset capability for dataset transcations */
    1053             : #define ODsCEmulatedTransactions                                               \
    1054             :     "EmulatedTransactions" /**< Dataset capability for emulated dataset        \
    1055             :                               transactions */
    1056             : #define ODsCMeasuredGeometries                                                 \
    1057             :     "MeasuredGeometries" /**< Dataset capability for measured geometries       \
    1058             :                             support */
    1059             : #define ODsCZGeometries                                                        \
    1060             :     "ZGeometries" /**< Dataset capability for geometry with Z dimension        \
    1061             :                      support. Since GDAL 3.6. */
    1062             : #define ODsCRandomLayerRead                                                    \
    1063             :     "RandomLayerRead" /**< Dataset capability for GetNextFeature() returning   \
    1064             :                          features from random layers */
    1065             : /* Note the unfortunate trailing space at the end of the string */
    1066             : #define ODsCRandomLayerWrite                                                   \
    1067             :     "RandomLayerWrite " /**< Dataset capability for supporting CreateFeature   \
    1068             :                            on layer in random order */
    1069             : #define ODsCAddFieldDomain                                                     \
    1070             :     "AddFieldDomain" /**< Dataset capability for supporting AddFieldDomain()   \
    1071             :                         (at least partially) */
    1072             : #define ODsCDeleteFieldDomain                                                  \
    1073             :     "DeleteFieldDomain" /**< Dataset capability for supporting                 \
    1074             :                            DeleteFieldDomain()*/
    1075             : #define ODsCUpdateFieldDomain                                                  \
    1076             :     "UpdateFieldDomain" /**< Dataset capability for supporting                 \
    1077             :                            UpdateFieldDomain()*/
    1078             : 
    1079             : #define ODrCCreateDataSource                                                   \
    1080             :     "CreateDataSource" /**< Driver capability for datasource creation */
    1081             : #define ODrCDeleteDataSource                                                   \
    1082             :     "DeleteDataSource" /**< Driver capability for datasource deletion */
    1083             : 
    1084             : /* -------------------------------------------------------------------- */
    1085             : /*      Layer metadata items.                                           */
    1086             : /* -------------------------------------------------------------------- */
    1087             : /** Capability set to YES as metadata on a layer that has features with
    1088             :   * 64 bit identifiers.
    1089             :   @since GDAL 2.0
    1090             :   */
    1091             : #define OLMD_FID64 "OLMD_FID64"
    1092             : 
    1093             : /************************************************************************/
    1094             : /*                  ogr_featurestyle.h related definitions.             */
    1095             : /************************************************************************/
    1096             : 
    1097             : /**
    1098             :  * OGRStyleTool derived class types (returned by GetType()).
    1099             :  */
    1100             : 
    1101             : typedef enum ogr_style_tool_class_id
    1102             : {
    1103             :     OGRSTCNone = 0,   /**< None */
    1104             :     OGRSTCPen = 1,    /**< Pen */
    1105             :     OGRSTCBrush = 2,  /**< Brush */
    1106             :     OGRSTCSymbol = 3, /**< Symbol */
    1107             :     OGRSTCLabel = 4,  /**< Label */
    1108             :     OGRSTCVector = 5  /**< Vector */
    1109             : } OGRSTClassId;
    1110             : 
    1111             : /**
    1112             :  * List of units supported by OGRStyleTools.
    1113             :  */
    1114             : typedef enum ogr_style_tool_units_id
    1115             : {
    1116             :     OGRSTUGround = 0, /**< Ground unit */
    1117             :     OGRSTUPixel = 1,  /**< Pixel */
    1118             :     OGRSTUPoints = 2, /**< Points */
    1119             :     OGRSTUMM = 3,     /**< Millimeter */
    1120             :     OGRSTUCM = 4,     /**< Centimeter */
    1121             :     OGRSTUInches = 5  /**< Inch */
    1122             : } OGRSTUnitId;
    1123             : 
    1124             : /**
    1125             :  * List of parameters for use with OGRStylePen.
    1126             :  */
    1127             : typedef enum ogr_style_tool_param_pen_id
    1128             : {
    1129             :     OGRSTPenColor = 0,     /**< Color */
    1130             :     OGRSTPenWidth = 1,     /**< Width */
    1131             :     OGRSTPenPattern = 2,   /**< Pattern */
    1132             :     OGRSTPenId = 3,        /**< Id */
    1133             :     OGRSTPenPerOffset = 4, /**< Perpendicular offset */
    1134             :     OGRSTPenCap = 5,       /**< Cap */
    1135             :     OGRSTPenJoin = 6,      /**< Join */
    1136             :     OGRSTPenPriority = 7,  /**< Priority */
    1137             : #ifndef DOXYGEN_SKIP
    1138             :     OGRSTPenLast = 8
    1139             : #endif
    1140             : } OGRSTPenParam;
    1141             : 
    1142             : /**
    1143             :  * List of parameters for use with OGRStyleBrush.
    1144             :  */
    1145             : typedef enum ogr_style_tool_param_brush_id
    1146             : {
    1147             :     OGRSTBrushFColor = 0,   /**< Foreground color */
    1148             :     OGRSTBrushBColor = 1,   /**< Background color */
    1149             :     OGRSTBrushId = 2,       /**< Id */
    1150             :     OGRSTBrushAngle = 3,    /**< Angle */
    1151             :     OGRSTBrushSize = 4,     /**< Size */
    1152             :     OGRSTBrushDx = 5,       /**< Dx */
    1153             :     OGRSTBrushDy = 6,       /**< Dy */
    1154             :     OGRSTBrushPriority = 7, /**< Priority */
    1155             : #ifndef DOXYGEN_SKIP
    1156             :     OGRSTBrushLast = 8
    1157             : #endif
    1158             : 
    1159             : } OGRSTBrushParam;
    1160             : 
    1161             : /**
    1162             :  * List of parameters for use with OGRStyleSymbol.
    1163             :  */
    1164             : typedef enum ogr_style_tool_param_symbol_id
    1165             : {
    1166             :     OGRSTSymbolId = 0,        /**< Id */
    1167             :     OGRSTSymbolAngle = 1,     /**< Angle */
    1168             :     OGRSTSymbolColor = 2,     /**< Color */
    1169             :     OGRSTSymbolSize = 3,      /**< Size */
    1170             :     OGRSTSymbolDx = 4,        /**< Dx */
    1171             :     OGRSTSymbolDy = 5,        /**< Dy */
    1172             :     OGRSTSymbolStep = 6,      /**< Step */
    1173             :     OGRSTSymbolPerp = 7,      /**< Perpendicular */
    1174             :     OGRSTSymbolOffset = 8,    /**< Offset */
    1175             :     OGRSTSymbolPriority = 9,  /**< Priority */
    1176             :     OGRSTSymbolFontName = 10, /**< Font name */
    1177             :     OGRSTSymbolOColor = 11,   /**< Outline color */
    1178             : #ifndef DOXYGEN_SKIP
    1179             :     OGRSTSymbolLast = 12
    1180             : #endif
    1181             : } OGRSTSymbolParam;
    1182             : 
    1183             : /**
    1184             :  * List of parameters for use with OGRStyleLabel.
    1185             :  */
    1186             : typedef enum ogr_style_tool_param_label_id
    1187             : {
    1188             :     OGRSTLabelFontName = 0,   /**< Font name */
    1189             :     OGRSTLabelSize = 1,       /**< Size */
    1190             :     OGRSTLabelTextString = 2, /**< Text string */
    1191             :     OGRSTLabelAngle = 3,      /**< Angle */
    1192             :     OGRSTLabelFColor = 4,     /**< Foreground color */
    1193             :     OGRSTLabelBColor = 5,     /**< Background color */
    1194             :     OGRSTLabelPlacement = 6,  /**< Placement */
    1195             :     OGRSTLabelAnchor = 7,     /**< Anchor */
    1196             :     OGRSTLabelDx = 8,         /**< Dx */
    1197             :     OGRSTLabelDy = 9,         /**< Dy */
    1198             :     OGRSTLabelPerp = 10,      /**< Perpendicular */
    1199             :     OGRSTLabelBold = 11,      /**< Bold */
    1200             :     OGRSTLabelItalic = 12,    /**< Italic */
    1201             :     OGRSTLabelUnderline = 13, /**< Underline */
    1202             :     OGRSTLabelPriority = 14,  /**< Priority */
    1203             :     OGRSTLabelStrikeout = 15, /**< Strike out */
    1204             :     OGRSTLabelStretch = 16,   /**< Stretch */
    1205             :     OGRSTLabelAdjHor = 17,    /**< OBSOLETE; do not use */
    1206             :     OGRSTLabelAdjVert = 18,   /**< OBSOLETE; do not use */
    1207             :     OGRSTLabelHColor = 19,    /**< Highlight color */
    1208             :     OGRSTLabelOColor = 20,    /**< Outline color */
    1209             : #ifndef DOXYGEN_SKIP
    1210             :     OGRSTLabelLast = 21
    1211             : #endif
    1212             : } OGRSTLabelParam;
    1213             : 
    1214             : /* -------------------------------------------------------------------- */
    1215             : /*                          Field domains                               */
    1216             : /* -------------------------------------------------------------------- */
    1217             : 
    1218             : /** Associates a code and a value
    1219             :  *
    1220             :  * @since GDAL 3.3
    1221             :  */
    1222             : typedef struct
    1223             : {
    1224             :     /** Code. Content should be of the type of the OGRFieldDomain */
    1225             :     char *pszCode;
    1226             : 
    1227             :     /** Value. Might be NULL */
    1228             :     char *pszValue;
    1229             : } OGRCodedValue;
    1230             : 
    1231             : /** Type of field domain.
    1232             :  *
    1233             :  * @since GDAL 3.3
    1234             :  */
    1235             : typedef enum
    1236             : {
    1237             :     /** Coded */
    1238             :     OFDT_CODED,
    1239             :     /** Range (min/max) */
    1240             :     OFDT_RANGE,
    1241             :     /** Glob (used by GeoPackage) */
    1242             :     OFDT_GLOB
    1243             : } OGRFieldDomainType;
    1244             : 
    1245             : /** Split policy for field domains.
    1246             :  *
    1247             :  * When a feature is split in two, defines how the value of attributes
    1248             :  * following the domain are computed.
    1249             :  *
    1250             :  * @since GDAL 3.3
    1251             :  */
    1252             : typedef enum
    1253             : {
    1254             :     /** Default value */
    1255             :     OFDSP_DEFAULT_VALUE,
    1256             :     /** Duplicate */
    1257             :     OFDSP_DUPLICATE,
    1258             :     /** New values are computed by the ratio of their area/length compared to
    1259             :        the area/length of the original feature */
    1260             :     OFDSP_GEOMETRY_RATIO
    1261             : } OGRFieldDomainSplitPolicy;
    1262             : 
    1263             : /** Merge policy for field domains.
    1264             :  *
    1265             :  * When a feature is built by merging two features, defines how the value of
    1266             :  * attributes following the domain are computed.
    1267             :  *
    1268             :  * @since GDAL 3.3
    1269             :  */
    1270             : typedef enum
    1271             : {
    1272             :     /** Default value */
    1273             :     OFDMP_DEFAULT_VALUE,
    1274             :     /** Sum */
    1275             :     OFDMP_SUM,
    1276             :     /** New values are computed as the weighted average of the source values. */
    1277             :     OFDMP_GEOMETRY_WEIGHTED
    1278             : } OGRFieldDomainMergePolicy;
    1279             : 
    1280             : /* ------------------------------------------------------------------- */
    1281             : /*                        Version checking                             */
    1282             : /* -------------------------------------------------------------------- */
    1283             : 
    1284             : #ifndef DOXYGEN_SKIP
    1285             : 
    1286             : /* Note to developers : please keep this section in sync with gdal.h */
    1287             : 
    1288             : #ifndef GDAL_VERSION_INFO_DEFINED
    1289             : #define GDAL_VERSION_INFO_DEFINED
    1290             : const char CPL_DLL *CPL_STDCALL GDALVersionInfo(const char *);
    1291             : #endif
    1292             : 
    1293             : #ifndef GDAL_CHECK_VERSION
    1294             : 
    1295             : /** Return TRUE if GDAL library version at runtime matches
    1296             :    nVersionMajor.nVersionMinor.
    1297             : 
    1298             :     The purpose of this method is to ensure that calling code will run with the
    1299             :    GDAL version it is compiled for. It is primarily indented for external
    1300             :    plugins.
    1301             : 
    1302             :     @param nVersionMajor Major version to be tested against
    1303             :     @param nVersionMinor Minor version to be tested against
    1304             :     @param pszCallingComponentName If not NULL, in case of version mismatch, the
    1305             :    method will issue a failure mentioning the name of the calling component.
    1306             :   */
    1307             : int CPL_DLL CPL_STDCALL GDALCheckVersion(int nVersionMajor, int nVersionMinor,
    1308             :                                          const char *pszCallingComponentName);
    1309             : 
    1310             : /** Helper macro for GDALCheckVersion */
    1311             : #define GDAL_CHECK_VERSION(pszCallingComponentName)                            \
    1312             :     GDALCheckVersion(GDAL_VERSION_MAJOR, GDAL_VERSION_MINOR,                   \
    1313             :                      pszCallingComponentName)
    1314             : 
    1315             : #endif
    1316             : 
    1317             : #endif /* #ifndef DOXYGEN_SKIP */
    1318             : 
    1319             : CPL_C_END
    1320             : 
    1321             : #endif /* ndef OGR_CORE_H_INCLUDED */

Generated by: LCOV version 1.14