Coverage Report

Created: 2025-07-23 09:13

/src/gdal/ogr/ogrsf_frmts/idrisi/ogr_idrisi.h
Line
Count
Source (jump to first uncovered line)
1
/******************************************************************************
2
 *
3
 * Project:  Idrisi Translator
4
 * Purpose:  Definition of classes for OGR Idrisi driver.
5
 * Author:   Even Rouault, even dot rouault at spatialys.com
6
 *
7
 ******************************************************************************
8
 * Copyright (c) 2011-2012, Even Rouault <even dot rouault at spatialys.com>
9
 *
10
 * SPDX-License-Identifier: MIT
11
 ****************************************************************************/
12
13
#ifndef OGR_IDRISI_H_INCLUDED
14
#define OGR_IDRISI_H_INCLUDED
15
16
#include "ogrsf_frmts.h"
17
18
/************************************************************************/
19
/*                         OGRIdrisiLayer                               */
20
/************************************************************************/
21
22
class OGRIdrisiLayer final : public OGRLayer,
23
                             public OGRGetNextFeatureThroughRaw<OGRIdrisiLayer>
24
{
25
  protected:
26
    OGRFeatureDefn *poFeatureDefn;
27
    OGRSpatialReference *poSRS;
28
    OGRwkbGeometryType eGeomType;
29
30
    VSILFILE *fp;
31
    VSILFILE *fpAVL;
32
    bool bEOF;
33
34
    int nNextFID;
35
36
    bool bExtentValid;
37
    double dfMinX;
38
    double dfMinY;
39
    double dfMaxX;
40
    double dfMaxY;
41
42
    unsigned int nTotalFeatures;
43
44
    bool Detect_AVL_ADC(const char *pszFilename);
45
    void ReadAVLLine(OGRFeature *poFeature);
46
47
    OGRFeature *GetNextRawFeature();
48
49
  public:
50
    OGRIdrisiLayer(const char *pszFilename, const char *pszLayerName,
51
                   VSILFILE *fp, OGRwkbGeometryType eGeomType,
52
                   const char *pszWTKString);
53
    virtual ~OGRIdrisiLayer();
54
55
    virtual void ResetReading() override;
56
    DEFINE_GET_NEXT_FEATURE_THROUGH_RAW(OGRIdrisiLayer)
57
58
    virtual OGRFeatureDefn *GetLayerDefn() override
59
0
    {
60
0
        return poFeatureDefn;
61
0
    }
62
63
    virtual int TestCapability(const char *) override;
64
65
    void SetExtent(double dfMinX, double dfMinY, double dfMaxX, double dfMaxY);
66
    virtual OGRErr IGetExtent(int iGeomField, OGREnvelope *psExtent,
67
                              bool bForce) override;
68
69
    virtual GIntBig GetFeatureCount(int bForce = TRUE) override;
70
};
71
72
/************************************************************************/
73
/*                        OGRIdrisiDataSource                           */
74
/************************************************************************/
75
76
class OGRIdrisiDataSource final : public GDALDataset
77
{
78
    OGRLayer **papoLayers = nullptr;
79
    int nLayers = 0;
80
81
  public:
82
    OGRIdrisiDataSource();
83
    virtual ~OGRIdrisiDataSource();
84
85
    int Open(const char *pszFilename);
86
87
    virtual int GetLayerCount() override
88
0
    {
89
0
        return nLayers;
90
0
    }
91
92
    virtual OGRLayer *GetLayer(int) override;
93
};
94
95
#endif  // ndef OGR_IDRISI_H_INCLUDED