| 1 | /****************************************************************************** |
| 2 | * |
| 3 | * Project: Hierarchical Data Format Release 5 (HDF5) |
| 4 | * Purpose: Read S100 bathymetric datasets. |
| 5 | * Author: Even Rouault <even dot rouault at spatialys dot com> |
| 6 | * |
| 7 | ****************************************************************************** |
| 8 | * Copyright (c) 2023, Even Rouault <even dot rouault at spatialys dot com> |
| 9 | * |
| 10 | * SPDX-License-Identifier: MIT |
| 11 | ****************************************************************************/ |
| 12 | |
| 13 | #ifndef S100_H |
| 14 | #define S100_Hcxx . . $ `frmts/hdf5/s100.h:14:9`! |
| 15 | |
| 16 | #include "cpl_port.h"cxx . . $ `<file>/port/cpl_port.h`/ |
| 17 | |
| 18 | #include "gdal_pam.h"cxx . . $ `<file>/gcore/gdal_pam.h`/ |
| 19 | #include "gdal_priv.h"cxx . . $ `<file>/gcore/gdal_priv.h`/ |
| 20 | #include "ogr_spatialref.h"cxx . . $ `<file>/ogr/ogr_spatialref.h`/ |
| 21 | |
| 22 | #include "hdf5_api.h"cxx . . $ `<file>/frmts/hdf5/hdf5_api.h`/ |
| 23 | #include "gh5_convenience.h"cxx . . $ `<file>/frmts/hdf5/gh5_convenience.h`/ |
| 24 | |
| 25 | #include <array> |
| 26 | |
| 27 | /************************************************************************/ |
| 28 | /* S100BaseDataset */ |
| 29 | /************************************************************************/ |
| 30 | |
| 31 | class S100BaseDatasetcxx . . $ S100BaseDataset# CPL_NON_FINALcxx . . $ `port/cpl_port.h:1094:9`! : public GDALPamDatasetcxx . . $ GDALPamDataset# |
| 32 | { |
| 33 | private: |
| 34 | void ReadSRScxx . . $ S100BaseDataset#ReadSRS(49f6e7a06ebc5aa8).(); |
| 35 | |
| 36 | protected: |
| 37 | stdcxx . . $ std/::string m_osFilenamecxx . . $ S100BaseDataset#m_osFilename.{}; |
| 38 | stdcxx . . $ std/::shared_ptr<GDALGroupcxx . . $ GDALGroup#> m_poRootGroupcxx . . $ S100BaseDataset#m_poRootGroup.{}; |
| 39 | OGRSpatialReferencecxx . . $ OGRSpatialReference# m_oSRScxx . . $ S100BaseDataset#m_oSRS.{cxx . . $ OGRSpatialReference#OGRSpatialReference(85c52e162fed56f9).}; |
| 40 | bool m_bHasGTcxx . . $ S100BaseDataset#m_bHasGT. = false; |
| 41 | GDALGeoTransformcxx . . $ GDALGeoTransform# m_gtcxx . . $ S100BaseDataset#m_gt.{cxx . . $ GDALGeoTransform#GDALGeoTransform(ced63f7c635d850d).}; |
| 42 | stdcxx . . $ std/::string m_osMetadataFilecxx . . $ S100BaseDataset#m_osMetadataFile.{}; |
| 43 | |
| 44 | explicit S100BaseDatasetcxx . . $ S100BaseDataset#S100BaseDataset(9c546c94e5fcce4e).(const stdcxx . . $ std/::string &osFilename); |
| 45 | |
| 46 | bool Initcxx . . $ S100BaseDataset#Init(c9857a73d68e59ba).(); |
| 47 | |
| 48 | void SetMetadataForDataDynamicitycxx . . $ S100BaseDataset#SetMetadataForDataDynamicity(cc5f936d1eea3c62).(const GDALAttributecxx . . $ GDALAttribute# *poAttr); |
| 49 | void SetMetadataForCommonPointRulecxx . . $ S100BaseDataset#SetMetadataForCommonPointRule(cc5f936d1eea3c62).(const GDALAttributecxx . . $ GDALAttribute# *poAttr); |
| 50 | void SetMetadataForInterpolationTypecxx . . $ S100BaseDataset#SetMetadataForInterpolationType(cc5f936d1eea3c62).(const GDALAttributecxx . . $ GDALAttribute# *poAttr); |
| 51 | |
| 52 | public: |
| 53 | CPLErr GetGeoTransformcxx . . $ S100BaseDataset#GetGeoTransform(9cfa0773fdb41a90).(GDALGeoTransformcxx . . $ GDALGeoTransform# >) const override; |
| 54 | const OGRSpatialReferencecxx . . $ OGRSpatialReference# *GetSpatialRefcxx . . $ S100BaseDataset#GetSpatialRef(8a5496c2eeefaeaf).() const override; |
| 55 | |
| 56 | char **GetFileListcxx . . $ S100BaseDataset#GetFileList(de5739791ae7584).() override; |
| 57 | }; |
| 58 | |
| 59 | /************************************************************************/ |
| 60 | /* S100BaseWriter */ |
| 61 | /************************************************************************/ |
| 62 | |
| 63 | class S100BaseWritercxx . . $ S100BaseWriter# CPL_NON_FINALcxx . . $ `port/cpl_port.h:1094:9`! |
| 64 | { |
| 65 | public: |
| 66 | virtual ~cxx . . $ S100BaseWriter#`~S100BaseWriter`(ced63f7c635d850d).S100BaseWritercxx . . $ S100BaseWriter#(); |
| 67 | |
| 68 | protected: |
| 69 | S100BaseWritercxx . . $ S100BaseWriter#S100BaseWriter(43f60fd4681c0287).(const char *pszDestFilename, GDALDatasetcxx . . $ GDALDataset# *poSrcDS, |
| 70 | CSLConstListcxx . . $ CSLConstList# papszOptions); |
| 71 | |
| 72 | // to be called by destructor of derived classes which must also |
| 73 | // end up by calling BaseClose() |
| 74 | virtual bool Closecxx . . $ S100BaseWriter#Close(c9857a73d68e59ba).() = 0; |
| 75 | bool BaseClosecxx . . $ S100BaseWriter#BaseClose(c9857a73d68e59ba).(); |
| 76 | |
| 77 | bool BaseCheckscxx . . $ S100BaseWriter#BaseChecks(3eb0425edbfac44e).(const char *pszDriverName, bool crsMustBeEPSG, |
| 78 | bool verticalDatumRequired); |
| 79 | |
| 80 | static bool WriteUInt8Valuecxx . . $ S100BaseWriter#WriteUInt8Value(d7e4c0f9a05cefdb).(hid_tcxx . . $ hid_t# hGroup, const char *pszName, int value); |
| 81 | static bool WriteUInt16Valuecxx . . $ S100BaseWriter#WriteUInt16Value(d7e4c0f9a05cefdb).(hid_tcxx . . $ hid_t# hGroup, const char *pszName, int value); |
| 82 | static bool WriteInt32Valuecxx . . $ S100BaseWriter#WriteInt32Value(d7e4c0f9a05cefdb).(hid_tcxx . . $ hid_t# hGroup, const char *pszName, int value); |
| 83 | static bool WriteUInt32Valuecxx . . $ S100BaseWriter#WriteUInt32Value(bc96fe933a11baf5).(hid_tcxx . . $ hid_t# hGroup, const char *pszName, |
| 84 | unsigned value); |
| 85 | static bool WriteFloat32Valuecxx . . $ S100BaseWriter#WriteFloat32Value(3563a2714346952b).(hid_tcxx . . $ hid_t# hGroup, const char *pszName, |
| 86 | double value); |
| 87 | static bool WriteFloat64Valuecxx . . $ S100BaseWriter#WriteFloat64Value(3563a2714346952b).(hid_tcxx . . $ hid_t# hGroup, const char *pszName, |
| 88 | double value); |
| 89 | static bool WriteVarLengthStringValuecxx . . $ S100BaseWriter#WriteVarLengthStringValue(452d2ecb493b9a11).(hid_tcxx . . $ hid_t# hGroup, const char *pszName, |
| 90 | const char *pszValue); |
| 91 | static bool WriteFixedLengthStringValuecxx . . $ S100BaseWriter#WriteFixedLengthStringValue(452d2ecb493b9a11).(hid_tcxx . . $ hid_t# hGroup, const char *pszName, |
| 92 | const char *pszValue); |
| 93 | static bool WriteOneDimensionalVarLengthStringArraycxx . . $ S100BaseWriter#WriteOneDimensionalVarLengthStringArray(a7e7f3f088d1e443).(hid_tcxx . . $ hid_t# hGroup, |
| 94 | const char *name, |
| 95 | CSLConstListcxx . . $ CSLConstList# values); |
| 96 | |
| 97 | bool OpenFileUpdateModecxx . . $ S100BaseWriter#OpenFileUpdateMode(c9857a73d68e59ba).(); |
| 98 | bool CreateFilecxx . . $ S100BaseWriter#CreateFile(c9857a73d68e59ba).(); |
| 99 | bool WriteProductSpecificationcxx . . $ S100BaseWriter#WriteProductSpecification(c5f7da30cbc0f4e9).(const char *pszProductSpecification); |
| 100 | bool WriteIssueDatecxx . . $ S100BaseWriter#WriteIssueDate(c9857a73d68e59ba).(); |
| 101 | bool WriteIssueTimecxx . . $ S100BaseWriter#WriteIssueTime(efaadfb7dc14930a).(bool bAutogenerateFromCurrent); |
| 102 | bool WriteTopLevelBoundingBoxcxx . . $ S100BaseWriter#WriteTopLevelBoundingBox(c9857a73d68e59ba).(); |
| 103 | bool WriteHorizontalCRScxx . . $ S100BaseWriter#WriteHorizontalCRS(c9857a73d68e59ba).(); |
| 104 | bool WriteVerticalCScxx . . $ S100BaseWriter#WriteVerticalCS(83c267b20bac841a).(int nCode); |
| 105 | bool WriteVerticalCoordinateBasecxx . . $ S100BaseWriter#WriteVerticalCoordinateBase(83c267b20bac841a).(int nCode); |
| 106 | static bool WriteVerticalDatumReferencecxx . . $ S100BaseWriter#WriteVerticalDatumReference(24611ac0148652c8).(hid_tcxx . . $ hid_t# hGroup, int nCode); |
| 107 | static bool WriteVerticalDatumcxx . . $ S100BaseWriter#WriteVerticalDatum(d8419428f607efed).(hid_tcxx . . $ hid_t# hGroup, hid_tcxx . . $ hid_t# hType, int nCode); |
| 108 | |
| 109 | bool CreateFeatureGroupcxx . . $ S100BaseWriter#CreateFeatureGroup(c5f7da30cbc0f4e9).(const char *name); |
| 110 | static bool WriteDataCodingFormatcxx . . $ S100BaseWriter#WriteDataCodingFormat(24611ac0148652c8).(hid_tcxx . . $ hid_t# hGroup, int nCode); |
| 111 | static bool WriteCommonPointRulecxx . . $ S100BaseWriter#WriteCommonPointRule(24611ac0148652c8).(hid_tcxx . . $ hid_t# hGroup, int nCode); |
| 112 | static bool WriteDataOffsetCodecxx . . $ S100BaseWriter#WriteDataOffsetCode(24611ac0148652c8).(hid_tcxx . . $ hid_t# hGroup, int nCode); |
| 113 | static bool WriteDimensioncxx . . $ S100BaseWriter#WriteDimension(24611ac0148652c8).(hid_tcxx . . $ hid_t# hGroup, int nCode); |
| 114 | static bool WriteHorizontalPositionUncertaintycxx . . $ S100BaseWriter#WriteHorizontalPositionUncertainty(9ec04f5ced9ed542).(hid_tcxx . . $ hid_t# hGroup, float fValue); |
| 115 | static bool WriteVerticalUncertaintycxx . . $ S100BaseWriter#WriteVerticalUncertainty(9ec04f5ced9ed542).(hid_tcxx . . $ hid_t# hGroup, float fValue); |
| 116 | static bool WriteInterpolationTypecxx . . $ S100BaseWriter#WriteInterpolationType(24611ac0148652c8).(hid_tcxx . . $ hid_t# hGroup, int nCode); |
| 117 | static bool WriteNumInstancescxx . . $ S100BaseWriter#WriteNumInstances(d8419428f607efed).(hid_tcxx . . $ hid_t# hGroup, hid_tcxx . . $ hid_t# hType, int numInstances); |
| 118 | static bool WriteSequencingRuleScanDirectioncxx . . $ S100BaseWriter#WriteSequencingRuleScanDirection(2bec37e606c77b57).(hid_tcxx . . $ hid_t# hGroup, |
| 119 | const char *pszValue); |
| 120 | static bool WriteSequencingRuleTypecxx . . $ S100BaseWriter#WriteSequencingRuleType(24611ac0148652c8).(hid_tcxx . . $ hid_t# hGroup, int nCode); |
| 121 | bool WriteAxisNamescxx . . $ S100BaseWriter#WriteAxisNames(2ff18951ca35fa3e).(hid_tcxx . . $ hid_t# hGroup); |
| 122 | |
| 123 | bool CreateFeatureInstanceGroupcxx . . $ S100BaseWriter#CreateFeatureInstanceGroup(c5f7da30cbc0f4e9).(const char *name); |
| 124 | bool WriteFIGGridRelatedParameterscxx . . $ S100BaseWriter#WriteFIGGridRelatedParameters(2ff18951ca35fa3e).(hid_tcxx . . $ hid_t# hGroup); |
| 125 | static bool WriteNumGRPcxx . . $ S100BaseWriter#WriteNumGRP(d8419428f607efed).(hid_tcxx . . $ hid_t# hGroup, hid_tcxx . . $ hid_t# hType, int numGRP); |
| 126 | |
| 127 | bool CreateValuesGroupcxx . . $ S100BaseWriter#CreateValuesGroup(c5f7da30cbc0f4e9).(const char *name); |
| 128 | |
| 129 | bool CreateGroupFcxx . . $ S100BaseWriter#CreateGroupF(c9857a73d68e59ba).(); |
| 130 | |
| 131 | static constexpr int GROUP_F_DATASET_FIELD_COUNTcxx . . $ S100BaseWriter#GROUP_F_DATASET_FIELD_COUNT. = 8; |
| 132 | bool WriteGroupFDatasetcxx . . $ S100BaseWriter#WriteGroupFDataset(cffe32852c4de72f).( |
| 133 | const char *name, |
| 134 | const stdcxx . . $ std/::vector<stdcxx . . $ std/::arraycxx . . $ std/array#<const char *, GROUP_F_DATASET_FIELD_COUNTcxx . . $ S100BaseWriter#GROUP_F_DATASET_FIELD_COUNT.>> |
| 135 | &rows); |
| 136 | |
| 137 | const stdcxx . . $ std/::string m_osDestFilenamecxx . . $ S100BaseWriter#m_osDestFilename.; |
| 138 | GDALDatasetcxx . . $ GDALDataset# *const m_poSrcDScxx . . $ S100BaseWriter#m_poSrcDS.; |
| 139 | const CPLStringList m_aosOptionscxx . . $ S100BaseWriter#m_aosOptions.; |
| 140 | GDALGeoTransformcxx . . $ GDALGeoTransform# m_gtcxx . . $ S100BaseWriter#m_gt.{cxx . . $ GDALGeoTransform#GDALGeoTransform(ced63f7c635d850d).}; |
| 141 | GH5_HIDFileHoldercxx . . $ GH5_HIDFileHolder# m_hdf5cxx . . $ S100BaseWriter#m_hdf5.{cxx . . $ GH5_HIDFileHolder#GH5_HIDFileHolder(1624ee8275b10bda).}; |
| 142 | GH5_HIDGroupHoldercxx . . $ GH5_HIDGroupHolder# m_GroupFcxx . . $ S100BaseWriter#m_GroupF.{cxx . . $ GH5_HIDGroupHolder#GH5_HIDGroupHolder(1624ee8275b10bda).}; |
| 143 | GH5_HIDGroupHoldercxx . . $ GH5_HIDGroupHolder# m_featureGroupcxx . . $ S100BaseWriter#m_featureGroup.{cxx . . $ GH5_HIDGroupHolder#GH5_HIDGroupHolder(1624ee8275b10bda).}; |
| 144 | GH5_HIDGroupHoldercxx . . $ GH5_HIDGroupHolder# m_featureInstanceGroupcxx . . $ S100BaseWriter#m_featureInstanceGroup.{cxx . . $ GH5_HIDGroupHolder#GH5_HIDGroupHolder(1624ee8275b10bda).}; |
| 145 | GH5_HIDGroupHoldercxx . . $ GH5_HIDGroupHolder# m_valuesGroupcxx . . $ S100BaseWriter#m_valuesGroup.{cxx . . $ GH5_HIDGroupHolder#GH5_HIDGroupHolder(1624ee8275b10bda).}; |
| 146 | const OGRSpatialReferencecxx . . $ OGRSpatialReference# *m_poSRScxx . . $ S100BaseWriter#m_poSRS. = nullptr; |
| 147 | int m_nVerticalDatumcxx . . $ S100BaseWriter#m_nVerticalDatum. = 0; |
| 148 | int m_nEPSGCodecxx . . $ S100BaseWriter#m_nEPSGCode. = 0; |
| 149 | |
| 150 | CPL_DISALLOW_COPY_ASSIGNcxx . . $ S100BaseWriter#(S100BaseWriter) |
| 151 | }; |
| 152 | |
| 153 | /************************************************************************/ |
| 154 | /* Function declarations */ |
| 155 | /************************************************************************/ |
| 156 | |
| 157 | bool S100GetNumPointsLongitudinalLatitudinalcxx . . $ S100GetNumPointsLongitudinalLatitudinal(7758a77bcb95f085).(const GDALGroupcxx . . $ GDALGroup# *poGroup, |
| 158 | int &nNumPointsLongitudinal, |
| 159 | int &nNumPointsLatitudinal); |
| 160 | |
| 161 | bool S100ReadSRScxx . . $ S100ReadSRS(baa0a1f4b7fc2b5).(const GDALGroupcxx . . $ GDALGroup# *poRootGroup, OGRSpatialReferencecxx . . $ OGRSpatialReference# &oSRS); |
| 162 | |
| 163 | bool S100GetDimensionscxx . . $ S100GetDimensions(5392c630afd4a).( |
| 164 | const GDALGroupcxx . . $ GDALGroup# *poGroup, |
| 165 | stdcxx . . $ std/::vector<stdcxx . . $ std/::shared_ptr<GDALDimensioncxx . . $ GDALDimension#>> &apoDims, |
| 166 | stdcxx . . $ std/::vector<stdcxx . . $ std/::shared_ptr<GDALMDArraycxx . . $ GDALMDArray#>> &apoIndexingVars); |
| 167 | |
| 168 | bool S100GetGeoTransformcxx . . $ S100GetGeoTransform(51e6a3eb21cee64).(const GDALGroupcxx . . $ GDALGroup# *poGroup, GDALGeoTransformcxx . . $ GDALGeoTransform# >, |
| 169 | bool bNorthUp); |
| 170 | |
| 171 | constexpr const char *S100_VERTICAL_DATUM_NAMEcxx . . $ S100_VERTICAL_DATUM_NAME. = "VERTICAL_DATUM_NAME"; |
| 172 | constexpr const char *S100_VERTICAL_DATUM_ABBREVcxx . . $ S100_VERTICAL_DATUM_ABBREV. = "VERTICAL_DATUM_ABBREV"; |
| 173 | constexpr const char *S100_VERTICAL_DATUM_EPSG_CODEcxx . . $ S100_VERTICAL_DATUM_EPSG_CODE. = |
| 174 | "VERTICAL_DATUM_EPSG_CODE"; |
| 175 | |
| 176 | int S100GetVerticalDatumCodeFromNameOrAbbrevcxx . . $ S100GetVerticalDatumCodeFromNameOrAbbrev(5c4306d8553b3696).(const char *pszStr); |
| 177 | void S100ReadVerticalDatumcxx . . $ S100ReadVerticalDatum(cea10c6bb85185d9).(GDALMajorObjectcxx . . $ GDALMajorObject# *poMO, const GDALGroupcxx . . $ GDALGroup# *poGroup); |
| 178 | |
| 179 | stdcxx . . $ std/::string S100ReadMetadatacxx . . $ S100ReadMetadata(9d708d78aad44f2).(GDALDatasetcxx . . $ GDALDataset# *poDS, const stdcxx . . $ std/::string &osFilename, |
| 180 | const GDALGroupcxx . . $ GDALGroup# *poRootGroup); |
| 181 | |
| 182 | #endif // S100_H |