LCOV - code coverage report
Current view: top level - ogr/ogrsf_frmts/ogdi - ogrogdi.h (source / functions) Hit Total Coverage
Test: gdal_filtered.info Lines: 20 20 100.0 %
Date: 2025-01-18 12:42:00 Functions: 9 9 100.0 %

          Line data    Source code
       1             : /******************************************************************************
       2             :  *
       3             :  * Project:  OGDI Bridge
       4             :  * Purpose:  Private definitions within the OGDI driver to implement
       5             :  *           integration with OGR.
       6             :  * Author:   Daniel Morissette, danmo@videotron.ca
       7             :  *           (Based on some code contributed by Frank Warmerdam :)
       8             :  *
       9             :  ******************************************************************************
      10             :  * Copyright (c) 2000,  Daniel Morissette
      11             :  *
      12             :  * SPDX-License-Identifier: MIT
      13             :  ****************************************************************************/
      14             : 
      15             : #ifndef OGDOGDI_H_INCLUDED
      16             : #define OGDOGDI_H_INCLUDED
      17             : 
      18             : #include <math.h>
      19             : extern "C"
      20             : {
      21             : /* Older versions of OGDI have register keywords as qualifier for arguments
      22             :  * of functions, which is illegal in C++17 */
      23             : #define register
      24             : #include "ecs.h"
      25             : #undef register
      26             : }
      27             : #include "ogrsf_frmts.h"
      28             : 
      29             : /************************************************************************/
      30             : /*                             OGROGDILayer                             */
      31             : /************************************************************************/
      32             : class OGROGDIDataSource;
      33             : 
      34             : class OGROGDILayer final : public OGRLayer
      35             : {
      36             :     OGROGDIDataSource *m_poODS;
      37             :     int m_nClientID;
      38             :     char *m_pszOGDILayerName;
      39             :     ecs_Family m_eFamily;
      40             : 
      41             :     OGRFeatureDefn *m_poFeatureDefn;
      42             :     OGRSpatialReference *m_poSpatialRef;
      43             :     ecs_Region m_sFilterBounds;
      44             : 
      45             :     int m_iNextShapeId;
      46             :     int m_nTotalShapeCount;
      47             :     int m_nFilteredOutShapes;
      48             : 
      49             :     OGRFeature *GetNextRawFeature();
      50             : 
      51             :   public:
      52             :     OGROGDILayer(OGROGDIDataSource *, const char *, ecs_Family);
      53             :     virtual ~OGROGDILayer();
      54             : 
      55             :     virtual void SetSpatialFilter(OGRGeometry *) override;
      56             : 
      57          78 :     virtual void SetSpatialFilter(int iGeomField, OGRGeometry *poGeom) override
      58             :     {
      59          78 :         OGRLayer::SetSpatialFilter(iGeomField, poGeom);
      60          78 :     }
      61             : 
      62             :     virtual OGRErr SetAttributeFilter(const char *pszQuery) override;
      63             : 
      64             :     void ResetReading() override;
      65             :     OGRFeature *GetNextFeature() override;
      66             : 
      67             :     OGRFeature *GetFeature(GIntBig nFeatureId) override;
      68             : 
      69        1887 :     OGRFeatureDefn *GetLayerDefn() override
      70             :     {
      71        1887 :         return m_poFeatureDefn;
      72             :     }
      73             : 
      74             :     GIntBig GetFeatureCount(int) override;
      75             : 
      76             :     int TestCapability(const char *) override;
      77             : 
      78             :   private:
      79             :     void BuildFeatureDefn();
      80             : };
      81             : 
      82             : /************************************************************************/
      83             : /*                          OGROGDIDataSource                           */
      84             : /************************************************************************/
      85             : 
      86             : class OGROGDIDataSource final : public GDALDataset
      87             : {
      88             :     OGROGDILayer **m_papoLayers;
      89             :     int m_nLayers;
      90             : 
      91             :     int m_nClientID;
      92             : 
      93             :     ecs_Region m_sGlobalBounds;
      94             :     OGRSpatialReference *m_poSpatialRef;
      95             : 
      96             :     OGROGDILayer *m_poCurrentLayer;
      97             : 
      98             :     int m_bLaunderLayerNames;
      99             : 
     100             :     void IAddLayer(const char *pszLayerName, ecs_Family eFamily);
     101             : 
     102             :   public:
     103             :     OGROGDIDataSource();
     104             :     ~OGROGDIDataSource();
     105             : 
     106             :     int Open(const char *);
     107             : 
     108         455 :     int GetLayerCount() override
     109             :     {
     110         455 :         return m_nLayers;
     111             :     }
     112             : 
     113             :     OGRLayer *GetLayer(int) override;
     114             : 
     115         608 :     ecs_Region *GetGlobalBounds()
     116             :     {
     117         608 :         return &m_sGlobalBounds;
     118             :     }
     119             : 
     120          19 :     OGRSpatialReference *DSGetSpatialRef()
     121             :     {
     122          19 :         return m_poSpatialRef;
     123             :     }
     124             : 
     125          19 :     int GetClientID()
     126             :     {
     127          19 :         return m_nClientID;
     128             :     }
     129             : 
     130        1378 :     OGROGDILayer *GetCurrentLayer()
     131             :     {
     132        1378 :         return m_poCurrentLayer;
     133             :     }
     134             : 
     135           8 :     void SetCurrentLayer(OGROGDILayer *poLayer)
     136             :     {
     137           8 :         m_poCurrentLayer = poLayer;
     138           8 :     }
     139             : 
     140          19 :     int LaunderLayerNames()
     141             :     {
     142          19 :         return m_bLaunderLayerNames;
     143             :     }
     144             : };
     145             : 
     146             : #endif /* OGDOGDI_H_INCLUDED */

Generated by: LCOV version 1.14