LCOV - code coverage report
Current view: top level - ogr/ogrsf_frmts/gmt - ogr_gmt.h (source / functions) Hit Total Coverage
Test: gdal_filtered.info Lines: 7 7 100.0 %
Date: 2025-02-18 14:19:29 Functions: 4 4 100.0 %

          Line data    Source code
       1             : /******************************************************************************
       2             :  *
       3             :  * Project:  OpenGIS Simple Features Reference Implementation
       4             :  * Purpose:  Private definitions within the OGR GMT driver.
       5             :  * Author:   Frank Warmerdam, warmerdam@pobox.com
       6             :  *
       7             :  ******************************************************************************
       8             :  * Copyright (c) 2007, Frank Warmerdam <warmerdam@pobox.com>
       9             :  *
      10             :  * SPDX-License-Identifier: MIT
      11             :  ****************************************************************************/
      12             : 
      13             : #ifndef OGRGMT_H_INCLUDED
      14             : #define OGRGMT_H_INCLUDED
      15             : 
      16             : #include "ogrsf_frmts.h"
      17             : #include "ogr_api.h"
      18             : #include "cpl_string.h"
      19             : 
      20             : /************************************************************************/
      21             : /*                             OGRGmtLayer                              */
      22             : /************************************************************************/
      23             : 
      24             : class OGRGmtLayer final : public OGRLayer,
      25             :                           public OGRGetNextFeatureThroughRaw<OGRGmtLayer>
      26             : {
      27             :     GDALDataset *m_poDS = nullptr;
      28             :     OGRSpatialReference *m_poSRS = nullptr;
      29             :     OGRFeatureDefn *poFeatureDefn;
      30             : 
      31             :     int iNextFID;
      32             : 
      33             :     bool bUpdate;
      34             :     bool bHeaderComplete;
      35             : 
      36             :     bool bRegionComplete;
      37             :     OGREnvelope sRegion;
      38             :     vsi_l_offset nRegionOffset;
      39             : 
      40             :     VSILFILE *m_fp = nullptr;
      41             : 
      42             :     bool ReadLine();
      43             :     CPLString osLine;
      44             :     char **papszKeyedValues;
      45             : 
      46             :     bool ScanAheadForHole();
      47             :     bool NextIsFeature();
      48             : 
      49             :     OGRFeature *GetNextRawFeature();
      50             : 
      51             :     OGRErr WriteGeometry(OGRGeometryH hGeom, bool bHaveAngle);
      52             :     OGRErr CompleteHeader(OGRGeometry *);
      53             : 
      54             :   public:
      55             :     bool bValidFile;
      56             : 
      57             :     OGRGmtLayer(GDALDataset *poDS, const char *pszFilename, VSILFILE *fp,
      58             :                 const OGRSpatialReference *poSRS, int bUpdate);
      59             :     virtual ~OGRGmtLayer();
      60             : 
      61             :     void ResetReading() override;
      62          50 :     DEFINE_GET_NEXT_FEATURE_THROUGH_RAW(OGRGmtLayer)
      63             : 
      64         352 :     OGRFeatureDefn *GetLayerDefn() override
      65             :     {
      66         352 :         return poFeatureDefn;
      67             :     }
      68             : 
      69             :     OGRErr IGetExtent(int iGeomField, OGREnvelope *psExtent,
      70             :                       bool bForce) override;
      71             : 
      72             :     OGRErr ICreateFeature(OGRFeature *poFeature) override;
      73             : 
      74             :     virtual OGRErr CreateField(const OGRFieldDefn *poField,
      75             :                                int bApproxOK = TRUE) override;
      76             : 
      77             :     int TestCapability(const char *) override;
      78             : 
      79          17 :     GDALDataset *GetDataset() override
      80             :     {
      81          17 :         return m_poDS;
      82             :     }
      83             : };
      84             : 
      85             : /************************************************************************/
      86             : /*                           OGRGmtDataSource                           */
      87             : /************************************************************************/
      88             : 
      89             : class OGRGmtDataSource final : public GDALDataset
      90             : {
      91             :     OGRGmtLayer **papoLayers;
      92             :     int nLayers;
      93             : 
      94             :     bool bUpdate;
      95             : 
      96             :   public:
      97             :     OGRGmtDataSource();
      98             :     virtual ~OGRGmtDataSource();
      99             : 
     100             :     int Open(const char *pszFilename, VSILFILE *fp,
     101             :              const OGRSpatialReference *poSRS, int bUpdate);
     102             : 
     103           3 :     int GetLayerCount() override
     104             :     {
     105           3 :         return nLayers;
     106             :     }
     107             : 
     108             :     OGRLayer *GetLayer(int) override;
     109             : 
     110             :     OGRLayer *ICreateLayer(const char *pszName,
     111             :                            const OGRGeomFieldDefn *poGeomFieldDefn,
     112             :                            CSLConstList papszOptions) override;
     113             :     int TestCapability(const char *) override;
     114             : };
     115             : 
     116             : #endif /* ndef OGRGMT_H_INCLUDED */

Generated by: LCOV version 1.14