LCOV - code coverage report
Current view: top level - ogr/ogrsf_frmts/dgn - ogr_dgn.h (source / functions) Hit Total Coverage
Test: gdal_filtered.info Lines: 9 13 69.2 %
Date: 2024-05-07 17:03:27 Functions: 4 6 66.7 %

          Line data    Source code
       1             : /******************************************************************************
       2             :  * $Id$
       3             :  *
       4             :  * Project:  OpenGIS Simple Features Reference Implementation
       5             :  * Purpose:  OGR Driver for DGN Reader.
       6             :  * Author:   Frank Warmerdam, warmerdam@pobox.com
       7             :  *
       8             :  ******************************************************************************
       9             :  * Copyright (c) 2000, Frank Warmerdam (warmerdam@pobox.com)
      10             :  *
      11             :  * Permission is hereby granted, free of charge, to any person obtaining a
      12             :  * copy of this software and associated documentation files (the "Software"),
      13             :  * to deal in the Software without restriction, including without limitation
      14             :  * the rights to use, copy, modify, merge, publish, distribute, sublicense,
      15             :  * and/or sell copies of the Software, and to permit persons to whom the
      16             :  * Software is furnished to do so, subject to the following conditions:
      17             :  *
      18             :  * The above copyright notice and this permission notice shall be included
      19             :  * in all copies or substantial portions of the Software.
      20             :  *
      21             :  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
      22             :  * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
      23             :  * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
      24             :  * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
      25             :  * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
      26             :  * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
      27             :  * DEALINGS IN THE SOFTWARE.
      28             :  ****************************************************************************/
      29             : 
      30             : #ifndef OGR_DGN_H_INCLUDED
      31             : #define OGR_DGN_H_INCLUDED
      32             : 
      33             : #include "dgnlib.h"
      34             : #include "ogrsf_frmts.h"
      35             : 
      36             : /************************************************************************/
      37             : /*                            OGRDGNLayer                               */
      38             : /************************************************************************/
      39             : 
      40             : class OGRDGNLayer final : public OGRLayer
      41             : {
      42             :     GDALDataset *m_poDS = nullptr;
      43             :     OGRFeatureDefn *poFeatureDefn;
      44             : 
      45             :     int iNextShapeId;
      46             : 
      47             :     DGNHandle hDGN;
      48             :     int bUpdate;
      49             : 
      50             :     char *pszLinkFormat;
      51             : 
      52             :     OGRFeature *ElementToFeature(DGNElemCore *, int nRecLevel);
      53             : 
      54             :     void ConsiderBrush(DGNElemCore *, const char *pszPen,
      55             :                        OGRFeature *poFeature);
      56             : 
      57             :     DGNElemCore **LineStringToElementGroup(const OGRLineString *, int);
      58             :     DGNElemCore **TranslateLabel(OGRFeature *);
      59             : 
      60             :     // Unused:
      61             :     // int                 bHaveSimpleQuery;
      62             :     OGRFeature *poEvalFeature;
      63             : 
      64             :     OGRErr CreateFeatureWithGeom(OGRFeature *, const OGRGeometry *);
      65             : 
      66             :   public:
      67             :     OGRDGNLayer(GDALDataset *poDS, const char *pszName, DGNHandle hDGN,
      68             :                 int bUpdate);
      69             :     virtual ~OGRDGNLayer();
      70             : 
      71             :     void SetSpatialFilter(OGRGeometry *) override;
      72             : 
      73           1 :     virtual void SetSpatialFilter(int iGeomField, OGRGeometry *poGeom) override
      74             :     {
      75           1 :         OGRLayer::SetSpatialFilter(iGeomField, poGeom);
      76           1 :     }
      77             : 
      78             :     void ResetReading() override;
      79             :     OGRFeature *GetNextFeature() override;
      80             :     OGRFeature *GetFeature(GIntBig nFeatureId) override;
      81             : 
      82             :     virtual GIntBig GetFeatureCount(int bForce = TRUE) override;
      83             :     virtual OGRErr GetExtent(OGREnvelope *psExtent, int bForce = TRUE) override;
      84             : 
      85           0 :     virtual OGRErr GetExtent(int iGeomField, OGREnvelope *psExtent,
      86             :                              int bForce) override
      87             :     {
      88           0 :         return OGRLayer::GetExtent(iGeomField, psExtent, bForce);
      89             :     }
      90             : 
      91         298 :     OGRFeatureDefn *GetLayerDefn() override
      92             :     {
      93         298 :         return poFeatureDefn;
      94             :     }
      95             : 
      96             :     int TestCapability(const char *) override;
      97             : 
      98             :     OGRErr ICreateFeature(OGRFeature *poFeature) override;
      99             : 
     100          18 :     GDALDataset *GetDataset() override
     101             :     {
     102          18 :         return m_poDS;
     103             :     }
     104             : };
     105             : 
     106             : /************************************************************************/
     107             : /*                          OGRDGNDataSource                            */
     108             : /************************************************************************/
     109             : 
     110             : class OGRDGNDataSource final : public OGRDataSource
     111             : {
     112             :     OGRDGNLayer **papoLayers;
     113             :     int nLayers;
     114             : 
     115             :     char *pszName;
     116             :     DGNHandle hDGN;
     117             : 
     118             :     char **papszOptions;
     119             : 
     120             :   public:
     121             :     OGRDGNDataSource();
     122             :     ~OGRDGNDataSource();
     123             : 
     124             :     int Open(const char *, int bTestOpen, int bUpdate);
     125             :     bool PreCreate(const char *, char **);
     126             : 
     127             :     OGRLayer *ICreateLayer(const char *pszName,
     128             :                            const OGRGeomFieldDefn *poGeomFieldDefn,
     129             :                            CSLConstList) override;
     130             : 
     131           0 :     const char *GetName() override
     132             :     {
     133           0 :         return pszName;
     134             :     }
     135             : 
     136          45 :     int GetLayerCount() override
     137             :     {
     138          45 :         return nLayers;
     139             :     }
     140             : 
     141             :     OGRLayer *GetLayer(int) override;
     142             : 
     143             :     int TestCapability(const char *) override;
     144             : };
     145             : 
     146             : #endif /* ndef OGR_DGN_H_INCLUDED */

Generated by: LCOV version 1.14