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

Generated by: LCOV version 1.14