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: 2024-11-25 13:07:18 Functions: 9 9 100.0 %

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

Generated by: LCOV version 1.14