/src/gdal/frmts/miramon/miramon_dataset.h
Line | Count | Source |
1 | | /****************************************************************************** |
2 | | * |
3 | | * Project: MiraMon Raster Driver |
4 | | * Purpose: Implements MMRDataset class: responsible for generating the |
5 | | * main dataset or the subdatasets as needed. |
6 | | * Author: Abel Pau |
7 | | * |
8 | | ****************************************************************************** |
9 | | * Copyright (c) 2025, Xavier Pons |
10 | | * |
11 | | * SPDX-License-Identifier: MIT |
12 | | ****************************************************************************/ |
13 | | |
14 | | #ifndef MMRDATASET_H_INCLUDED |
15 | | #define MMRDATASET_H_INCLUDED |
16 | | |
17 | | #include <cstddef> |
18 | | #include <vector> |
19 | | #include <optional> |
20 | | #include <array> |
21 | | |
22 | | #include "gdal_pam.h" |
23 | | #include "gdal_rat.h" |
24 | | |
25 | | #include "../miramon_common/mm_gdal_constants.h" // For MM_EXT_DBF_N_FIELDS |
26 | | #include "miramon_rel.h" |
27 | | |
28 | | /* ==================================================================== */ |
29 | | /* MMRDataset */ |
30 | | /* ==================================================================== */ |
31 | | |
32 | | class MMRRasterBand; |
33 | | class MMRRel; |
34 | | |
35 | | class MMRDataset final : public GDALPamDataset |
36 | | { |
37 | | public: |
38 | | explicit MMRDataset(GDALOpenInfo *poOpenInfo); |
39 | | MMRDataset(const MMRDataset &) = |
40 | | delete; // I don't want to construct a MMRDataset from another MMRDataset (effc++) |
41 | | MMRDataset &operator=(const MMRDataset &) = |
42 | | delete; // I don't want to assign a MMRDataset to another MMRDataset (effc++) |
43 | | ~MMRDataset() override; |
44 | | |
45 | | static int Identify(GDALOpenInfo *); |
46 | | static GDALDataset *Open(GDALOpenInfo *); |
47 | | |
48 | | MMRRel *GetRel() |
49 | 2.96k | { |
50 | 2.96k | return m_pMMRRel.get(); |
51 | 2.96k | } |
52 | | |
53 | | private: |
54 | | void ReadProjection(); |
55 | | void AssignBandsToSubdataSets(); |
56 | | void CreateSubdatasetsFromBands(); |
57 | | bool CreateRasterBands(); |
58 | | bool IsNextBandInANewDataSet(int nIBand) const; |
59 | | |
60 | | int UpdateGeoTransform(); |
61 | | const OGRSpatialReference *GetSpatialRef() const override; |
62 | | CPLErr GetGeoTransform(GDALGeoTransform >) const override; |
63 | | |
64 | | bool IsValid() const |
65 | 5.74k | { |
66 | 5.74k | return m_bIsValid; |
67 | 5.74k | } |
68 | | |
69 | | GDALGeoTransform m_gt{}; |
70 | | OGRSpatialReference m_oSRS{}; |
71 | | |
72 | | bool m_bIsValid = |
73 | | false; // Determines if the created object is valid or not. |
74 | | std::unique_ptr<MMRRel> m_pMMRRel = nullptr; |
75 | | |
76 | | std::vector<gdal::GCP> m_aoGCPs{}; |
77 | | |
78 | | // Numbers of subdatasets (if any) in this dataset. |
79 | | int m_nNSubdataSets = 0; |
80 | | }; |
81 | | |
82 | | #endif // MMRDATASET_H_INCLUDED |