@cpp.js/package-gdal 1.0.0-beta.21 → 1.0.0-beta.23
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +18 -0
- package/cppjs-package-gdal.podspec +1 -1
- package/cppjs.build.js +1 -0
- package/dist/prebuilt/Android-x86_64/include/cpl_atomic_ops.h +90 -0
- package/dist/prebuilt/Android-x86_64/include/cpl_auto_close.h +73 -0
- package/dist/prebuilt/Android-x86_64/include/cpl_compressor.h +112 -0
- package/dist/prebuilt/Android-x86_64/include/cpl_config.h +215 -0
- package/dist/prebuilt/Android-x86_64/include/cpl_config_extras.h +34 -0
- package/dist/prebuilt/Android-x86_64/include/cpl_conv.h +417 -0
- package/dist/prebuilt/Android-x86_64/include/cpl_csv.h +71 -0
- package/dist/prebuilt/Android-x86_64/include/cpl_error.h +344 -0
- package/dist/prebuilt/Android-x86_64/include/cpl_hash_set.h +83 -0
- package/dist/prebuilt/Android-x86_64/include/cpl_http.h +319 -0
- package/dist/prebuilt/Android-x86_64/include/cpl_json.h +301 -0
- package/dist/prebuilt/Android-x86_64/include/cpl_list.h +59 -0
- package/dist/prebuilt/Android-x86_64/include/cpl_minixml.h +211 -0
- package/dist/prebuilt/Android-x86_64/include/cpl_multiproc.h +241 -0
- package/dist/prebuilt/Android-x86_64/include/cpl_port.h +1182 -0
- package/dist/prebuilt/Android-x86_64/include/cpl_progress.h +49 -0
- package/dist/prebuilt/Android-x86_64/include/cpl_quad_tree.h +105 -0
- package/dist/prebuilt/Android-x86_64/include/cpl_spawn.h +60 -0
- package/dist/prebuilt/Android-x86_64/include/cpl_string.h +863 -0
- package/dist/prebuilt/Android-x86_64/include/cpl_time.h +29 -0
- package/dist/prebuilt/Android-x86_64/include/cpl_virtualmem.h +365 -0
- package/dist/prebuilt/Android-x86_64/include/cpl_vsi.h +830 -0
- package/dist/prebuilt/Android-x86_64/include/cpl_vsi_error.h +55 -0
- package/dist/prebuilt/Android-x86_64/include/cpl_vsi_virtual.h +580 -0
- package/dist/prebuilt/Android-x86_64/include/cplkeywordparser.h +61 -0
- package/dist/prebuilt/Android-x86_64/include/gdal.h +2667 -0
- package/dist/prebuilt/Android-x86_64/include/gdal_alg.h +717 -0
- package/dist/prebuilt/Android-x86_64/include/gdal_alg_priv.h +386 -0
- package/dist/prebuilt/Android-x86_64/include/gdal_csv.h +25 -0
- package/dist/prebuilt/Android-x86_64/include/gdal_frmts.h +236 -0
- package/dist/prebuilt/Android-x86_64/include/gdal_mdreader.h +240 -0
- package/dist/prebuilt/Android-x86_64/include/gdal_pam.h +461 -0
- package/dist/prebuilt/Android-x86_64/include/gdal_priv.h +4599 -0
- package/dist/prebuilt/Android-x86_64/include/gdal_proxy.h +470 -0
- package/dist/prebuilt/Android-x86_64/include/gdal_rat.h +390 -0
- package/dist/prebuilt/Android-x86_64/include/gdal_simplesurf.h +579 -0
- package/dist/prebuilt/Android-x86_64/include/gdal_utils.h +313 -0
- package/dist/prebuilt/Android-x86_64/include/gdal_version.h +33 -0
- package/dist/prebuilt/Android-x86_64/include/gdal_vrt.h +89 -0
- package/dist/prebuilt/Android-x86_64/include/gdalcachedpixelaccessor.h +439 -0
- package/dist/prebuilt/Android-x86_64/include/gdalgeorefpamdataset.h +73 -0
- package/dist/prebuilt/Android-x86_64/include/gdalgrid.h +102 -0
- package/dist/prebuilt/Android-x86_64/include/gdalgrid_priv.h +67 -0
- package/dist/prebuilt/Android-x86_64/include/gdaljp2abstractdataset.h +61 -0
- package/dist/prebuilt/Android-x86_64/include/gdaljp2metadata.h +237 -0
- package/dist/prebuilt/Android-x86_64/include/gdalpansharpen.h +258 -0
- package/dist/prebuilt/Android-x86_64/include/gdalsubdatasetinfo.h +104 -0
- package/dist/prebuilt/Android-x86_64/include/gdalwarper.h +622 -0
- package/dist/prebuilt/Android-x86_64/include/gnm.h +750 -0
- package/dist/prebuilt/Android-x86_64/include/gnm_api.h +101 -0
- package/dist/prebuilt/Android-x86_64/include/gnmgraph.h +258 -0
- package/dist/prebuilt/Android-x86_64/include/memdataset.h +176 -0
- package/dist/prebuilt/Android-x86_64/include/ogr_api.h +1024 -0
- package/dist/prebuilt/Android-x86_64/include/ogr_core.h +1321 -0
- package/dist/prebuilt/Android-x86_64/include/ogr_feature.h +1981 -0
- package/dist/prebuilt/Android-x86_64/include/ogr_featurestyle.h +858 -0
- package/dist/prebuilt/Android-x86_64/include/ogr_geocoding.h +46 -0
- package/dist/prebuilt/Android-x86_64/include/ogr_geomcoordinateprecision.h +79 -0
- package/dist/prebuilt/Android-x86_64/include/ogr_geometry.h +4346 -0
- package/dist/prebuilt/Android-x86_64/include/ogr_p.h +324 -0
- package/dist/prebuilt/Android-x86_64/include/ogr_recordbatch.h +125 -0
- package/dist/prebuilt/Android-x86_64/include/ogr_spatialref.h +1007 -0
- package/dist/prebuilt/Android-x86_64/include/ogr_srs_api.h +1088 -0
- package/dist/prebuilt/Android-x86_64/include/ogr_swq.h +529 -0
- package/dist/prebuilt/Android-x86_64/include/ogrsf_frmts.h +746 -0
- package/dist/prebuilt/Android-x86_64/include/rawdataset.h +255 -0
- package/dist/prebuilt/Android-x86_64/include/vrtdataset.h +2426 -0
- package/dist/prebuilt/Android-x86_64/lib/cmake/gdal/GDAL-targets-release.cmake +19 -0
- package/dist/prebuilt/Android-x86_64/lib/cmake/gdal/GDAL-targets.cmake +106 -0
- package/dist/prebuilt/Android-x86_64/lib/cmake/gdal/GDALConfig.cmake +21 -0
- package/dist/prebuilt/Android-x86_64/lib/cmake/gdal/GDALConfigVersion.cmake +85 -0
- package/dist/prebuilt/Android-x86_64/lib/gdalplugins/drivers.ini +290 -0
- package/dist/prebuilt/Android-x86_64/lib/libgdal.so +0 -0
- package/dist/prebuilt/Android-x86_64/lib/pkgconfig/gdal.pc +17 -0
- package/dist/prebuilt/Android-x86_64/share/gdal/GDALLogoBW.svg +138 -0
- package/dist/prebuilt/Android-x86_64/share/gdal/GDALLogoColor.svg +126 -0
- package/dist/prebuilt/Android-x86_64/share/gdal/GDALLogoGS.svg +126 -0
- package/dist/prebuilt/Android-x86_64/share/gdal/LICENSE.TXT +467 -0
- package/dist/prebuilt/Android-x86_64/share/gdal/MM_m_idofic.csv +321 -0
- package/dist/prebuilt/Android-x86_64/share/gdal/cubewerx_extra.wkt +48 -0
- package/dist/prebuilt/Android-x86_64/share/gdal/default.rsc +0 -0
- package/dist/prebuilt/Android-x86_64/share/gdal/ecw_cs.wkt +1453 -0
- package/dist/prebuilt/Android-x86_64/share/gdal/epsg.wkt +1 -0
- package/dist/prebuilt/Android-x86_64/share/gdal/esri_StatePlane_extra.wkt +631 -0
- package/dist/prebuilt/Android-x86_64/share/gdal/gdalicon.png +0 -0
- package/dist/prebuilt/Android-x86_64/share/gdal/gdalinfo_output.schema.json +346 -0
- package/dist/prebuilt/Android-x86_64/share/gdal/gdalmdiminfo_output.schema.json +321 -0
- package/dist/prebuilt/Android-x86_64/share/gdal/gdaltileindex.xsd +253 -0
- package/dist/prebuilt/Android-x86_64/share/gdal/gdalvrt.xsd +881 -0
- package/dist/prebuilt/Android-x86_64/share/gdal/gfs.xsd +246 -0
- package/dist/prebuilt/Android-x86_64/share/gdal/gml_registry.xml +117 -0
- package/dist/prebuilt/Android-x86_64/share/gdal/gml_registry.xsd +66 -0
- package/dist/prebuilt/Android-x86_64/share/gdal/grib2_center.csv +251 -0
- package/dist/prebuilt/Android-x86_64/share/gdal/grib2_process.csv +102 -0
- package/dist/prebuilt/Android-x86_64/share/gdal/grib2_subcenter.csv +63 -0
- package/dist/prebuilt/Android-x86_64/share/gdal/grib2_table_4_2_0_0.csv +261 -0
- package/dist/prebuilt/Android-x86_64/share/gdal/grib2_table_4_2_0_1.csv +261 -0
- package/dist/prebuilt/Android-x86_64/share/gdal/grib2_table_4_2_0_13.csv +261 -0
- package/dist/prebuilt/Android-x86_64/share/gdal/grib2_table_4_2_0_14.csv +261 -0
- package/dist/prebuilt/Android-x86_64/share/gdal/grib2_table_4_2_0_15.csv +261 -0
- package/dist/prebuilt/Android-x86_64/share/gdal/grib2_table_4_2_0_16.csv +261 -0
- package/dist/prebuilt/Android-x86_64/share/gdal/grib2_table_4_2_0_17.csv +11 -0
- package/dist/prebuilt/Android-x86_64/share/gdal/grib2_table_4_2_0_18.csv +261 -0
- package/dist/prebuilt/Android-x86_64/share/gdal/grib2_table_4_2_0_19.csv +261 -0
- package/dist/prebuilt/Android-x86_64/share/gdal/grib2_table_4_2_0_190.csv +261 -0
- package/dist/prebuilt/Android-x86_64/share/gdal/grib2_table_4_2_0_191.csv +261 -0
- package/dist/prebuilt/Android-x86_64/share/gdal/grib2_table_4_2_0_2.csv +261 -0
- package/dist/prebuilt/Android-x86_64/share/gdal/grib2_table_4_2_0_20.csv +261 -0
- package/dist/prebuilt/Android-x86_64/share/gdal/grib2_table_4_2_0_21.csv +261 -0
- package/dist/prebuilt/Android-x86_64/share/gdal/grib2_table_4_2_0_3.csv +261 -0
- package/dist/prebuilt/Android-x86_64/share/gdal/grib2_table_4_2_0_4.csv +261 -0
- package/dist/prebuilt/Android-x86_64/share/gdal/grib2_table_4_2_0_5.csv +261 -0
- package/dist/prebuilt/Android-x86_64/share/gdal/grib2_table_4_2_0_6.csv +261 -0
- package/dist/prebuilt/Android-x86_64/share/gdal/grib2_table_4_2_0_7.csv +261 -0
- package/dist/prebuilt/Android-x86_64/share/gdal/grib2_table_4_2_10_0.csv +261 -0
- package/dist/prebuilt/Android-x86_64/share/gdal/grib2_table_4_2_10_1.csv +261 -0
- package/dist/prebuilt/Android-x86_64/share/gdal/grib2_table_4_2_10_191.csv +261 -0
- package/dist/prebuilt/Android-x86_64/share/gdal/grib2_table_4_2_10_2.csv +261 -0
- package/dist/prebuilt/Android-x86_64/share/gdal/grib2_table_4_2_10_3.csv +261 -0
- package/dist/prebuilt/Android-x86_64/share/gdal/grib2_table_4_2_10_4.csv +261 -0
- package/dist/prebuilt/Android-x86_64/share/gdal/grib2_table_4_2_1_0.csv +261 -0
- package/dist/prebuilt/Android-x86_64/share/gdal/grib2_table_4_2_1_1.csv +261 -0
- package/dist/prebuilt/Android-x86_64/share/gdal/grib2_table_4_2_1_2.csv +261 -0
- package/dist/prebuilt/Android-x86_64/share/gdal/grib2_table_4_2_20_0.csv +261 -0
- package/dist/prebuilt/Android-x86_64/share/gdal/grib2_table_4_2_20_1.csv +261 -0
- package/dist/prebuilt/Android-x86_64/share/gdal/grib2_table_4_2_20_2.csv +261 -0
- package/dist/prebuilt/Android-x86_64/share/gdal/grib2_table_4_2_2_0.csv +261 -0
- package/dist/prebuilt/Android-x86_64/share/gdal/grib2_table_4_2_2_3.csv +261 -0
- package/dist/prebuilt/Android-x86_64/share/gdal/grib2_table_4_2_2_4.csv +261 -0
- package/dist/prebuilt/Android-x86_64/share/gdal/grib2_table_4_2_2_5.csv +261 -0
- package/dist/prebuilt/Android-x86_64/share/gdal/grib2_table_4_2_2_6.csv +261 -0
- package/dist/prebuilt/Android-x86_64/share/gdal/grib2_table_4_2_3_0.csv +261 -0
- package/dist/prebuilt/Android-x86_64/share/gdal/grib2_table_4_2_3_1.csv +261 -0
- package/dist/prebuilt/Android-x86_64/share/gdal/grib2_table_4_2_3_2.csv +28 -0
- package/dist/prebuilt/Android-x86_64/share/gdal/grib2_table_4_2_3_3.csv +8 -0
- package/dist/prebuilt/Android-x86_64/share/gdal/grib2_table_4_2_3_4.csv +14 -0
- package/dist/prebuilt/Android-x86_64/share/gdal/grib2_table_4_2_3_5.csv +11 -0
- package/dist/prebuilt/Android-x86_64/share/gdal/grib2_table_4_2_3_6.csv +11 -0
- package/dist/prebuilt/Android-x86_64/share/gdal/grib2_table_4_2_4_0.csv +261 -0
- package/dist/prebuilt/Android-x86_64/share/gdal/grib2_table_4_2_4_1.csv +261 -0
- package/dist/prebuilt/Android-x86_64/share/gdal/grib2_table_4_2_4_10.csv +261 -0
- package/dist/prebuilt/Android-x86_64/share/gdal/grib2_table_4_2_4_2.csv +261 -0
- package/dist/prebuilt/Android-x86_64/share/gdal/grib2_table_4_2_4_3.csv +261 -0
- package/dist/prebuilt/Android-x86_64/share/gdal/grib2_table_4_2_4_4.csv +261 -0
- package/dist/prebuilt/Android-x86_64/share/gdal/grib2_table_4_2_4_5.csv +261 -0
- package/dist/prebuilt/Android-x86_64/share/gdal/grib2_table_4_2_4_6.csv +261 -0
- package/dist/prebuilt/Android-x86_64/share/gdal/grib2_table_4_2_4_7.csv +261 -0
- package/dist/prebuilt/Android-x86_64/share/gdal/grib2_table_4_2_4_8.csv +261 -0
- package/dist/prebuilt/Android-x86_64/share/gdal/grib2_table_4_2_4_9.csv +261 -0
- package/dist/prebuilt/Android-x86_64/share/gdal/grib2_table_4_2_local_Canada.csv +5 -0
- package/dist/prebuilt/Android-x86_64/share/gdal/grib2_table_4_2_local_HPC.csv +2 -0
- package/dist/prebuilt/Android-x86_64/share/gdal/grib2_table_4_2_local_MRMS.csv +175 -0
- package/dist/prebuilt/Android-x86_64/share/gdal/grib2_table_4_2_local_NCEP.csv +401 -0
- package/dist/prebuilt/Android-x86_64/share/gdal/grib2_table_4_2_local_NDFD.csv +38 -0
- package/dist/prebuilt/Android-x86_64/share/gdal/grib2_table_4_2_local_index.csv +7 -0
- package/dist/prebuilt/Android-x86_64/share/gdal/grib2_table_4_5.csv +261 -0
- package/dist/prebuilt/Android-x86_64/share/gdal/grib2_table_versions.csv +3 -0
- package/dist/prebuilt/Android-x86_64/share/gdal/gt_datum.csv +229 -0
- package/dist/prebuilt/Android-x86_64/share/gdal/gt_ellips.csv +24 -0
- package/dist/prebuilt/Android-x86_64/share/gdal/header.dxf +1124 -0
- package/dist/prebuilt/Android-x86_64/share/gdal/inspire_cp_BasicPropertyUnit.gfs +57 -0
- package/dist/prebuilt/Android-x86_64/share/gdal/inspire_cp_CadastralBoundary.gfs +60 -0
- package/dist/prebuilt/Android-x86_64/share/gdal/inspire_cp_CadastralParcel.gfs +81 -0
- package/dist/prebuilt/Android-x86_64/share/gdal/inspire_cp_CadastralZoning.gfs +161 -0
- package/dist/prebuilt/Android-x86_64/share/gdal/jpfgdgml_AdmArea.gfs +59 -0
- package/dist/prebuilt/Android-x86_64/share/gdal/jpfgdgml_AdmBdry.gfs +49 -0
- package/dist/prebuilt/Android-x86_64/share/gdal/jpfgdgml_AdmPt.gfs +59 -0
- package/dist/prebuilt/Android-x86_64/share/gdal/jpfgdgml_BldA.gfs +54 -0
- package/dist/prebuilt/Android-x86_64/share/gdal/jpfgdgml_BldL.gfs +54 -0
- package/dist/prebuilt/Android-x86_64/share/gdal/jpfgdgml_Cntr.gfs +54 -0
- package/dist/prebuilt/Android-x86_64/share/gdal/jpfgdgml_CommBdry.gfs +49 -0
- package/dist/prebuilt/Android-x86_64/share/gdal/jpfgdgml_CommPt.gfs +59 -0
- package/dist/prebuilt/Android-x86_64/share/gdal/jpfgdgml_Cstline.gfs +54 -0
- package/dist/prebuilt/Android-x86_64/share/gdal/jpfgdgml_ElevPt.gfs +54 -0
- package/dist/prebuilt/Android-x86_64/share/gdal/jpfgdgml_GCP.gfs +94 -0
- package/dist/prebuilt/Android-x86_64/share/gdal/jpfgdgml_LeveeEdge.gfs +49 -0
- package/dist/prebuilt/Android-x86_64/share/gdal/jpfgdgml_RailCL.gfs +54 -0
- package/dist/prebuilt/Android-x86_64/share/gdal/jpfgdgml_RdASL.gfs +44 -0
- package/dist/prebuilt/Android-x86_64/share/gdal/jpfgdgml_RdArea.gfs +54 -0
- package/dist/prebuilt/Android-x86_64/share/gdal/jpfgdgml_RdCompt.gfs +59 -0
- package/dist/prebuilt/Android-x86_64/share/gdal/jpfgdgml_RdEdg.gfs +59 -0
- package/dist/prebuilt/Android-x86_64/share/gdal/jpfgdgml_RdMgtBdry.gfs +49 -0
- package/dist/prebuilt/Android-x86_64/share/gdal/jpfgdgml_RdSgmtA.gfs +59 -0
- package/dist/prebuilt/Android-x86_64/share/gdal/jpfgdgml_RvrMgtBdry.gfs +49 -0
- package/dist/prebuilt/Android-x86_64/share/gdal/jpfgdgml_SBAPt.gfs +49 -0
- package/dist/prebuilt/Android-x86_64/share/gdal/jpfgdgml_SBArea.gfs +54 -0
- package/dist/prebuilt/Android-x86_64/share/gdal/jpfgdgml_SBBdry.gfs +44 -0
- package/dist/prebuilt/Android-x86_64/share/gdal/jpfgdgml_WA.gfs +54 -0
- package/dist/prebuilt/Android-x86_64/share/gdal/jpfgdgml_WL.gfs +54 -0
- package/dist/prebuilt/Android-x86_64/share/gdal/jpfgdgml_WStrA.gfs +54 -0
- package/dist/prebuilt/Android-x86_64/share/gdal/jpfgdgml_WStrL.gfs +54 -0
- package/dist/prebuilt/Android-x86_64/share/gdal/nitf_spec.xml +3290 -0
- package/dist/prebuilt/Android-x86_64/share/gdal/nitf_spec.xsd +173 -0
- package/dist/prebuilt/Android-x86_64/share/gdal/ogrinfo_output.schema.json +528 -0
- package/dist/prebuilt/Android-x86_64/share/gdal/ogrvrt.xsd +530 -0
- package/dist/prebuilt/Android-x86_64/share/gdal/osmconf.ini +134 -0
- package/dist/prebuilt/Android-x86_64/share/gdal/ozi_datum.csv +131 -0
- package/dist/prebuilt/Android-x86_64/share/gdal/ozi_ellips.csv +35 -0
- package/dist/prebuilt/Android-x86_64/share/gdal/pci_datum.txt +530 -0
- package/dist/prebuilt/Android-x86_64/share/gdal/pci_ellips.txt +129 -0
- package/dist/prebuilt/Android-x86_64/share/gdal/pdfcomposition.xsd +705 -0
- package/dist/prebuilt/Android-x86_64/share/gdal/ruian_vf_ob_v1.gfs +1455 -0
- package/dist/prebuilt/Android-x86_64/share/gdal/ruian_vf_st_uvoh_v1.gfs +86 -0
- package/dist/prebuilt/Android-x86_64/share/gdal/ruian_vf_st_v1.gfs +1489 -0
- package/dist/prebuilt/Android-x86_64/share/gdal/ruian_vf_v1.gfs +2126 -0
- package/dist/prebuilt/Android-x86_64/share/gdal/s57agencies.csv +249 -0
- package/dist/prebuilt/Android-x86_64/share/gdal/s57attributes.csv +484 -0
- package/dist/prebuilt/Android-x86_64/share/gdal/s57expectedinput.csv +1008 -0
- package/dist/prebuilt/Android-x86_64/share/gdal/s57objectclasses.csv +287 -0
- package/dist/prebuilt/Android-x86_64/share/gdal/seed_2d.dgn +0 -0
- package/dist/prebuilt/Android-x86_64/share/gdal/seed_3d.dgn +0 -0
- package/dist/prebuilt/Android-x86_64/share/gdal/stateplane.csv +259 -0
- package/dist/prebuilt/Android-x86_64/share/gdal/tms_LINZAntarticaMapTileGrid.json +190 -0
- package/dist/prebuilt/Android-x86_64/share/gdal/tms_MapML_APSTILE.json +268 -0
- package/dist/prebuilt/Android-x86_64/share/gdal/tms_MapML_CBMTILE.json +346 -0
- package/dist/prebuilt/Android-x86_64/share/gdal/tms_NZTM2000.json +243 -0
- package/dist/prebuilt/Android-x86_64/share/gdal/trailer.dxf +434 -0
- package/dist/prebuilt/Android-x86_64/share/gdal/vdv452.xml +351 -0
- package/dist/prebuilt/Android-x86_64/share/gdal/vdv452.xsd +47 -0
- package/gdal.xcframework/ios-arm64_arm64e/libgdal.a +0 -0
- package/gdal.xcframework/ios-arm64_arm64e_x86_64-simulator/libgdal.a +0 -0
- package/package.json +12 -12
|
@@ -0,0 +1,4599 @@
|
|
|
1
|
+
/******************************************************************************
|
|
2
|
+
* $Id$
|
|
3
|
+
*
|
|
4
|
+
* Name: gdal_priv.h
|
|
5
|
+
* Project: GDAL Core
|
|
6
|
+
* Purpose: GDAL Core C++/Private declarations.
|
|
7
|
+
* Author: Frank Warmerdam, warmerdam@pobox.com
|
|
8
|
+
*
|
|
9
|
+
******************************************************************************
|
|
10
|
+
* Copyright (c) 1998, Frank Warmerdam
|
|
11
|
+
* Copyright (c) 2007-2014, Even Rouault <even dot rouault at spatialys.com>
|
|
12
|
+
*
|
|
13
|
+
* SPDX-License-Identifier: MIT
|
|
14
|
+
****************************************************************************/
|
|
15
|
+
|
|
16
|
+
#ifndef GDAL_PRIV_H_INCLUDED
|
|
17
|
+
#define GDAL_PRIV_H_INCLUDED
|
|
18
|
+
|
|
19
|
+
/**
|
|
20
|
+
* \file gdal_priv.h
|
|
21
|
+
*
|
|
22
|
+
* C++ GDAL entry points.
|
|
23
|
+
*/
|
|
24
|
+
|
|
25
|
+
/* -------------------------------------------------------------------- */
|
|
26
|
+
/* Predeclare various classes before pulling in gdal.h, the */
|
|
27
|
+
/* public declarations. */
|
|
28
|
+
/* -------------------------------------------------------------------- */
|
|
29
|
+
class GDALMajorObject;
|
|
30
|
+
class GDALDataset;
|
|
31
|
+
class GDALRasterBand;
|
|
32
|
+
class GDALDriver;
|
|
33
|
+
class GDALRasterAttributeTable;
|
|
34
|
+
class GDALProxyDataset;
|
|
35
|
+
class GDALProxyRasterBand;
|
|
36
|
+
class GDALAsyncReader;
|
|
37
|
+
class GDALRelationship;
|
|
38
|
+
|
|
39
|
+
/* -------------------------------------------------------------------- */
|
|
40
|
+
/* Pull in the public declarations. This gets the C apis, and */
|
|
41
|
+
/* also various constants. However, we will still get to */
|
|
42
|
+
/* provide the real class definitions for the GDAL classes. */
|
|
43
|
+
/* -------------------------------------------------------------------- */
|
|
44
|
+
|
|
45
|
+
#include "gdal.h"
|
|
46
|
+
#include "gdal_frmts.h"
|
|
47
|
+
#include "gdalsubdatasetinfo.h"
|
|
48
|
+
#include "cpl_vsi.h"
|
|
49
|
+
#include "cpl_conv.h"
|
|
50
|
+
#include "cpl_string.h"
|
|
51
|
+
#include "cpl_minixml.h"
|
|
52
|
+
#include "cpl_multiproc.h"
|
|
53
|
+
#include "cpl_atomic_ops.h"
|
|
54
|
+
|
|
55
|
+
#include <stdarg.h>
|
|
56
|
+
|
|
57
|
+
#include <cmath>
|
|
58
|
+
#include <complex>
|
|
59
|
+
#include <cstdint>
|
|
60
|
+
#include <iterator>
|
|
61
|
+
#include <limits>
|
|
62
|
+
#include <map>
|
|
63
|
+
#include <memory>
|
|
64
|
+
#include <set>
|
|
65
|
+
#if __cplusplus >= 202002L
|
|
66
|
+
#include <span>
|
|
67
|
+
#endif
|
|
68
|
+
#include <vector>
|
|
69
|
+
|
|
70
|
+
#include "ogr_core.h"
|
|
71
|
+
#include "ogr_feature.h"
|
|
72
|
+
|
|
73
|
+
//! @cond Doxygen_Suppress
|
|
74
|
+
#define GMO_VALID 0x0001
|
|
75
|
+
#define GMO_IGNORE_UNIMPLEMENTED 0x0002
|
|
76
|
+
#define GMO_SUPPORT_MD 0x0004
|
|
77
|
+
#define GMO_SUPPORT_MDMD 0x0008
|
|
78
|
+
#define GMO_MD_DIRTY 0x0010
|
|
79
|
+
#define GMO_PAM_CLASS 0x0020
|
|
80
|
+
|
|
81
|
+
//! @endcond
|
|
82
|
+
|
|
83
|
+
/************************************************************************/
|
|
84
|
+
/* GDALMultiDomainMetadata */
|
|
85
|
+
/************************************************************************/
|
|
86
|
+
|
|
87
|
+
//! @cond Doxygen_Suppress
|
|
88
|
+
class CPL_DLL GDALMultiDomainMetadata
|
|
89
|
+
{
|
|
90
|
+
private:
|
|
91
|
+
CPLStringList aosDomainList{};
|
|
92
|
+
|
|
93
|
+
struct Comparator
|
|
94
|
+
{
|
|
95
|
+
bool operator()(const char *a, const char *b) const
|
|
96
|
+
{
|
|
97
|
+
return STRCASECMP(a, b) < 0;
|
|
98
|
+
}
|
|
99
|
+
};
|
|
100
|
+
|
|
101
|
+
std::map<const char *, CPLStringList, Comparator> oMetadata{};
|
|
102
|
+
|
|
103
|
+
public:
|
|
104
|
+
GDALMultiDomainMetadata();
|
|
105
|
+
~GDALMultiDomainMetadata();
|
|
106
|
+
|
|
107
|
+
int XMLInit(const CPLXMLNode *psMetadata, int bMerge);
|
|
108
|
+
CPLXMLNode *Serialize() const;
|
|
109
|
+
|
|
110
|
+
CSLConstList GetDomainList() const
|
|
111
|
+
{
|
|
112
|
+
return aosDomainList.List();
|
|
113
|
+
}
|
|
114
|
+
|
|
115
|
+
char **GetMetadata(const char *pszDomain = "");
|
|
116
|
+
CPLErr SetMetadata(CSLConstList papszMetadata, const char *pszDomain = "");
|
|
117
|
+
const char *GetMetadataItem(const char *pszName,
|
|
118
|
+
const char *pszDomain = "");
|
|
119
|
+
CPLErr SetMetadataItem(const char *pszName, const char *pszValue,
|
|
120
|
+
const char *pszDomain = "");
|
|
121
|
+
|
|
122
|
+
void Clear();
|
|
123
|
+
|
|
124
|
+
inline void clear()
|
|
125
|
+
{
|
|
126
|
+
Clear();
|
|
127
|
+
}
|
|
128
|
+
};
|
|
129
|
+
|
|
130
|
+
//! @endcond
|
|
131
|
+
|
|
132
|
+
/* ******************************************************************** */
|
|
133
|
+
/* GDALMajorObject */
|
|
134
|
+
/* */
|
|
135
|
+
/* Base class providing metadata, description and other */
|
|
136
|
+
/* services shared by major objects. */
|
|
137
|
+
/* ******************************************************************** */
|
|
138
|
+
|
|
139
|
+
/** Object with metadata. */
|
|
140
|
+
class CPL_DLL GDALMajorObject
|
|
141
|
+
{
|
|
142
|
+
protected:
|
|
143
|
+
//! @cond Doxygen_Suppress
|
|
144
|
+
int nFlags; // GMO_* flags.
|
|
145
|
+
CPLString sDescription{};
|
|
146
|
+
GDALMultiDomainMetadata oMDMD{};
|
|
147
|
+
|
|
148
|
+
//! @endcond
|
|
149
|
+
|
|
150
|
+
char **BuildMetadataDomainList(char **papszList, int bCheckNonEmpty,
|
|
151
|
+
...) CPL_NULL_TERMINATED;
|
|
152
|
+
|
|
153
|
+
public:
|
|
154
|
+
GDALMajorObject();
|
|
155
|
+
virtual ~GDALMajorObject();
|
|
156
|
+
|
|
157
|
+
int GetMOFlags() const;
|
|
158
|
+
void SetMOFlags(int nFlagsIn);
|
|
159
|
+
|
|
160
|
+
virtual const char *GetDescription() const;
|
|
161
|
+
virtual void SetDescription(const char *);
|
|
162
|
+
|
|
163
|
+
virtual char **GetMetadataDomainList();
|
|
164
|
+
|
|
165
|
+
virtual char **GetMetadata(const char *pszDomain = "");
|
|
166
|
+
virtual CPLErr SetMetadata(char **papszMetadata,
|
|
167
|
+
const char *pszDomain = "");
|
|
168
|
+
virtual const char *GetMetadataItem(const char *pszName,
|
|
169
|
+
const char *pszDomain = "");
|
|
170
|
+
virtual CPLErr SetMetadataItem(const char *pszName, const char *pszValue,
|
|
171
|
+
const char *pszDomain = "");
|
|
172
|
+
|
|
173
|
+
/** Convert a GDALMajorObject* to a GDALMajorObjectH.
|
|
174
|
+
* @since GDAL 2.3
|
|
175
|
+
*/
|
|
176
|
+
static inline GDALMajorObjectH ToHandle(GDALMajorObject *poMajorObject)
|
|
177
|
+
{
|
|
178
|
+
return static_cast<GDALMajorObjectH>(poMajorObject);
|
|
179
|
+
}
|
|
180
|
+
|
|
181
|
+
/** Convert a GDALMajorObjectH to a GDALMajorObject*.
|
|
182
|
+
* @since GDAL 2.3
|
|
183
|
+
*/
|
|
184
|
+
static inline GDALMajorObject *FromHandle(GDALMajorObjectH hMajorObject)
|
|
185
|
+
{
|
|
186
|
+
return static_cast<GDALMajorObject *>(hMajorObject);
|
|
187
|
+
}
|
|
188
|
+
};
|
|
189
|
+
|
|
190
|
+
/* ******************************************************************** */
|
|
191
|
+
/* GDALDefaultOverviews */
|
|
192
|
+
/* ******************************************************************** */
|
|
193
|
+
|
|
194
|
+
//! @cond Doxygen_Suppress
|
|
195
|
+
class GDALOpenInfo;
|
|
196
|
+
|
|
197
|
+
class CPL_DLL GDALDefaultOverviews
|
|
198
|
+
{
|
|
199
|
+
friend class GDALDataset;
|
|
200
|
+
|
|
201
|
+
GDALDataset *poDS;
|
|
202
|
+
GDALDataset *poODS;
|
|
203
|
+
|
|
204
|
+
CPLString osOvrFilename{};
|
|
205
|
+
|
|
206
|
+
bool bOvrIsAux;
|
|
207
|
+
|
|
208
|
+
bool bCheckedForMask;
|
|
209
|
+
bool bOwnMaskDS;
|
|
210
|
+
GDALDataset *poMaskDS;
|
|
211
|
+
|
|
212
|
+
// For "overview datasets" we record base level info so we can
|
|
213
|
+
// find our way back to get overview masks.
|
|
214
|
+
GDALDataset *poBaseDS;
|
|
215
|
+
|
|
216
|
+
// Stuff for deferred initialize/overviewscans.
|
|
217
|
+
bool bCheckedForOverviews;
|
|
218
|
+
void OverviewScan();
|
|
219
|
+
char *pszInitName;
|
|
220
|
+
bool bInitNameIsOVR;
|
|
221
|
+
char **papszInitSiblingFiles;
|
|
222
|
+
|
|
223
|
+
public:
|
|
224
|
+
GDALDefaultOverviews();
|
|
225
|
+
~GDALDefaultOverviews();
|
|
226
|
+
|
|
227
|
+
void Initialize(GDALDataset *poDSIn, const char *pszName = nullptr,
|
|
228
|
+
CSLConstList papszSiblingFiles = nullptr,
|
|
229
|
+
bool bNameIsOVR = false);
|
|
230
|
+
|
|
231
|
+
void Initialize(GDALDataset *poDSIn, GDALOpenInfo *poOpenInfo,
|
|
232
|
+
const char *pszName = nullptr,
|
|
233
|
+
bool bTransferSiblingFilesIfLoaded = true);
|
|
234
|
+
|
|
235
|
+
void TransferSiblingFiles(char **papszSiblingFiles);
|
|
236
|
+
|
|
237
|
+
int IsInitialized();
|
|
238
|
+
|
|
239
|
+
int CloseDependentDatasets();
|
|
240
|
+
|
|
241
|
+
// Overview Related
|
|
242
|
+
|
|
243
|
+
int GetOverviewCount(int nBand);
|
|
244
|
+
GDALRasterBand *GetOverview(int nBand, int iOverview);
|
|
245
|
+
|
|
246
|
+
CPLErr BuildOverviews(const char *pszBasename, const char *pszResampling,
|
|
247
|
+
int nOverviews, const int *panOverviewList,
|
|
248
|
+
int nBands, const int *panBandList,
|
|
249
|
+
GDALProgressFunc pfnProgress, void *pProgressData,
|
|
250
|
+
CSLConstList papszOptions);
|
|
251
|
+
|
|
252
|
+
CPLErr BuildOverviewsSubDataset(const char *pszPhysicalFile,
|
|
253
|
+
const char *pszResampling, int nOverviews,
|
|
254
|
+
const int *panOverviewList, int nBands,
|
|
255
|
+
const int *panBandList,
|
|
256
|
+
GDALProgressFunc pfnProgress,
|
|
257
|
+
void *pProgressData,
|
|
258
|
+
CSLConstList papszOptions);
|
|
259
|
+
|
|
260
|
+
CPLErr BuildOverviewsMask(const char *pszResampling, int nOverviews,
|
|
261
|
+
const int *panOverviewList,
|
|
262
|
+
GDALProgressFunc pfnProgress, void *pProgressData,
|
|
263
|
+
CSLConstList papszOptions);
|
|
264
|
+
|
|
265
|
+
CPLErr CleanOverviews();
|
|
266
|
+
|
|
267
|
+
// Mask Related
|
|
268
|
+
|
|
269
|
+
CPLErr CreateMaskBand(int nFlags, int nBand = -1);
|
|
270
|
+
GDALRasterBand *GetMaskBand(int nBand);
|
|
271
|
+
int GetMaskFlags(int nBand);
|
|
272
|
+
|
|
273
|
+
int HaveMaskFile(char **papszSiblings = nullptr,
|
|
274
|
+
const char *pszBasename = nullptr);
|
|
275
|
+
|
|
276
|
+
char **GetSiblingFiles()
|
|
277
|
+
{
|
|
278
|
+
return papszInitSiblingFiles;
|
|
279
|
+
}
|
|
280
|
+
|
|
281
|
+
private:
|
|
282
|
+
CPL_DISALLOW_COPY_ASSIGN(GDALDefaultOverviews)
|
|
283
|
+
};
|
|
284
|
+
|
|
285
|
+
//! @endcond
|
|
286
|
+
|
|
287
|
+
/* ******************************************************************** */
|
|
288
|
+
/* GDALOpenInfo */
|
|
289
|
+
/* ******************************************************************** */
|
|
290
|
+
|
|
291
|
+
/** Class for dataset open functions. */
|
|
292
|
+
class CPL_DLL GDALOpenInfo
|
|
293
|
+
{
|
|
294
|
+
bool bHasGotSiblingFiles;
|
|
295
|
+
char **papszSiblingFiles;
|
|
296
|
+
int nHeaderBytesTried;
|
|
297
|
+
|
|
298
|
+
public:
|
|
299
|
+
GDALOpenInfo(const char *pszFile, int nOpenFlagsIn,
|
|
300
|
+
const char *const *papszSiblingFiles = nullptr);
|
|
301
|
+
~GDALOpenInfo(void);
|
|
302
|
+
|
|
303
|
+
/** Filename */
|
|
304
|
+
char *pszFilename;
|
|
305
|
+
/** Open options */
|
|
306
|
+
char **papszOpenOptions;
|
|
307
|
+
|
|
308
|
+
/** Access flag */
|
|
309
|
+
GDALAccess eAccess;
|
|
310
|
+
/** Open flags */
|
|
311
|
+
int nOpenFlags;
|
|
312
|
+
|
|
313
|
+
/** Whether stat()'ing the file was successful */
|
|
314
|
+
int bStatOK;
|
|
315
|
+
/** Whether the file is a directory */
|
|
316
|
+
int bIsDirectory;
|
|
317
|
+
|
|
318
|
+
/** Pointer to the file */
|
|
319
|
+
VSILFILE *fpL;
|
|
320
|
+
|
|
321
|
+
/** Number of bytes in pabyHeader */
|
|
322
|
+
int nHeaderBytes;
|
|
323
|
+
/** Buffer with first bytes of the file */
|
|
324
|
+
GByte *pabyHeader;
|
|
325
|
+
|
|
326
|
+
/** Allowed drivers (NULL for all) */
|
|
327
|
+
const char *const *papszAllowedDrivers;
|
|
328
|
+
|
|
329
|
+
int TryToIngest(int nBytes);
|
|
330
|
+
char **GetSiblingFiles();
|
|
331
|
+
char **StealSiblingFiles();
|
|
332
|
+
bool AreSiblingFilesLoaded() const;
|
|
333
|
+
|
|
334
|
+
bool IsSingleAllowedDriver(const char *pszDriverName) const;
|
|
335
|
+
|
|
336
|
+
private:
|
|
337
|
+
CPL_DISALLOW_COPY_ASSIGN(GDALOpenInfo)
|
|
338
|
+
};
|
|
339
|
+
|
|
340
|
+
/* ******************************************************************** */
|
|
341
|
+
/* gdal::GCP */
|
|
342
|
+
/* ******************************************************************** */
|
|
343
|
+
|
|
344
|
+
namespace gdal
|
|
345
|
+
{
|
|
346
|
+
/** C++ wrapper over the C GDAL_GCP structure.
|
|
347
|
+
*
|
|
348
|
+
* It has the same binary layout, and thus a gdal::GCP pointer can be cast as a
|
|
349
|
+
* GDAL_GCP pointer.
|
|
350
|
+
*
|
|
351
|
+
* @since 3.9
|
|
352
|
+
*/
|
|
353
|
+
class CPL_DLL GCP
|
|
354
|
+
{
|
|
355
|
+
public:
|
|
356
|
+
explicit GCP(const char *pszId = "", const char *pszInfo = "",
|
|
357
|
+
double dfPixel = 0, double dfLine = 0, double dfX = 0,
|
|
358
|
+
double dfY = 0, double dfZ = 0);
|
|
359
|
+
~GCP();
|
|
360
|
+
GCP(const GCP &);
|
|
361
|
+
explicit GCP(const GDAL_GCP &other);
|
|
362
|
+
GCP &operator=(const GCP &);
|
|
363
|
+
GCP(GCP &&);
|
|
364
|
+
GCP &operator=(GCP &&);
|
|
365
|
+
|
|
366
|
+
/** Returns the "id" member. */
|
|
367
|
+
inline const char *Id() const
|
|
368
|
+
{
|
|
369
|
+
return gcp.pszId;
|
|
370
|
+
}
|
|
371
|
+
|
|
372
|
+
void SetId(const char *pszId);
|
|
373
|
+
|
|
374
|
+
/** Returns the "info" member. */
|
|
375
|
+
inline const char *Info() const
|
|
376
|
+
{
|
|
377
|
+
return gcp.pszInfo;
|
|
378
|
+
}
|
|
379
|
+
|
|
380
|
+
void SetInfo(const char *pszInfo);
|
|
381
|
+
|
|
382
|
+
/** Returns the "pixel" member. */
|
|
383
|
+
inline double Pixel() const
|
|
384
|
+
{
|
|
385
|
+
return gcp.dfGCPPixel;
|
|
386
|
+
}
|
|
387
|
+
|
|
388
|
+
/** Returns a reference to the "pixel" member. */
|
|
389
|
+
inline double &Pixel()
|
|
390
|
+
{
|
|
391
|
+
return gcp.dfGCPPixel;
|
|
392
|
+
}
|
|
393
|
+
|
|
394
|
+
/** Returns the "line" member. */
|
|
395
|
+
inline double Line() const
|
|
396
|
+
{
|
|
397
|
+
return gcp.dfGCPLine;
|
|
398
|
+
}
|
|
399
|
+
|
|
400
|
+
/** Returns a reference to the "line" member. */
|
|
401
|
+
inline double &Line()
|
|
402
|
+
{
|
|
403
|
+
return gcp.dfGCPLine;
|
|
404
|
+
}
|
|
405
|
+
|
|
406
|
+
/** Returns the "X" member. */
|
|
407
|
+
inline double X() const
|
|
408
|
+
{
|
|
409
|
+
return gcp.dfGCPX;
|
|
410
|
+
}
|
|
411
|
+
|
|
412
|
+
/** Returns a reference to the "X" member. */
|
|
413
|
+
inline double &X()
|
|
414
|
+
{
|
|
415
|
+
return gcp.dfGCPX;
|
|
416
|
+
}
|
|
417
|
+
|
|
418
|
+
/** Returns the "Y" member. */
|
|
419
|
+
inline double Y() const
|
|
420
|
+
{
|
|
421
|
+
return gcp.dfGCPY;
|
|
422
|
+
}
|
|
423
|
+
|
|
424
|
+
/** Returns a reference to the "Y" member. */
|
|
425
|
+
inline double &Y()
|
|
426
|
+
{
|
|
427
|
+
return gcp.dfGCPY;
|
|
428
|
+
}
|
|
429
|
+
|
|
430
|
+
/** Returns the "Z" member. */
|
|
431
|
+
inline double Z() const
|
|
432
|
+
{
|
|
433
|
+
return gcp.dfGCPZ;
|
|
434
|
+
}
|
|
435
|
+
|
|
436
|
+
/** Returns a reference to the "Z" member. */
|
|
437
|
+
inline double &Z()
|
|
438
|
+
{
|
|
439
|
+
return gcp.dfGCPZ;
|
|
440
|
+
}
|
|
441
|
+
|
|
442
|
+
/** Casts as a C GDAL_GCP pointer */
|
|
443
|
+
inline const GDAL_GCP *c_ptr() const
|
|
444
|
+
{
|
|
445
|
+
return &gcp;
|
|
446
|
+
}
|
|
447
|
+
|
|
448
|
+
static const GDAL_GCP *c_ptr(const std::vector<GCP> &asGCPs);
|
|
449
|
+
|
|
450
|
+
static std::vector<GCP> fromC(const GDAL_GCP *pasGCPList, int nGCPCount);
|
|
451
|
+
|
|
452
|
+
private:
|
|
453
|
+
GDAL_GCP gcp;
|
|
454
|
+
};
|
|
455
|
+
|
|
456
|
+
} /* namespace gdal */
|
|
457
|
+
|
|
458
|
+
/* ******************************************************************** */
|
|
459
|
+
/* GDALDataset */
|
|
460
|
+
/* ******************************************************************** */
|
|
461
|
+
|
|
462
|
+
class OGRLayer;
|
|
463
|
+
class OGRGeometry;
|
|
464
|
+
class OGRSpatialReference;
|
|
465
|
+
class OGRStyleTable;
|
|
466
|
+
class swq_select;
|
|
467
|
+
class swq_select_parse_options;
|
|
468
|
+
class GDALGroup;
|
|
469
|
+
|
|
470
|
+
//! @cond Doxygen_Suppress
|
|
471
|
+
typedef struct GDALSQLParseInfo GDALSQLParseInfo;
|
|
472
|
+
//! @endcond
|
|
473
|
+
|
|
474
|
+
//! @cond Doxygen_Suppress
|
|
475
|
+
#ifdef GDAL_COMPILATION
|
|
476
|
+
#define OPTIONAL_OUTSIDE_GDAL(val)
|
|
477
|
+
#else
|
|
478
|
+
#define OPTIONAL_OUTSIDE_GDAL(val) = val
|
|
479
|
+
#endif
|
|
480
|
+
//! @endcond
|
|
481
|
+
|
|
482
|
+
//! @cond Doxygen_Suppress
|
|
483
|
+
// This macro can be defined to check that GDALDataset::IRasterIO()
|
|
484
|
+
// implementations do not alter the passed panBandList. It is not defined
|
|
485
|
+
// by default (and should not!), hence int* is used.
|
|
486
|
+
#if defined(GDAL_BANDMAP_TYPE_CONST_SAFE)
|
|
487
|
+
#define BANDMAP_TYPE const int *
|
|
488
|
+
#else
|
|
489
|
+
#define BANDMAP_TYPE int *
|
|
490
|
+
#endif
|
|
491
|
+
//! @endcond
|
|
492
|
+
|
|
493
|
+
/** A set of associated raster bands, usually from one file. */
|
|
494
|
+
class CPL_DLL GDALDataset : public GDALMajorObject
|
|
495
|
+
{
|
|
496
|
+
friend GDALDatasetH CPL_STDCALL
|
|
497
|
+
GDALOpenEx(const char *pszFilename, unsigned int nOpenFlags,
|
|
498
|
+
const char *const *papszAllowedDrivers,
|
|
499
|
+
const char *const *papszOpenOptions,
|
|
500
|
+
const char *const *papszSiblingFiles);
|
|
501
|
+
friend CPLErr CPL_STDCALL GDALClose(GDALDatasetH hDS);
|
|
502
|
+
|
|
503
|
+
friend class GDALDriver;
|
|
504
|
+
friend class GDALDefaultOverviews;
|
|
505
|
+
friend class GDALProxyDataset;
|
|
506
|
+
friend class GDALDriverManager;
|
|
507
|
+
|
|
508
|
+
CPL_INTERNAL void AddToDatasetOpenList();
|
|
509
|
+
|
|
510
|
+
CPL_INTERNAL void UnregisterFromSharedDataset();
|
|
511
|
+
|
|
512
|
+
CPL_INTERNAL static void ReportErrorV(const char *pszDSName,
|
|
513
|
+
CPLErr eErrClass, CPLErrorNum err_no,
|
|
514
|
+
const char *fmt, va_list args);
|
|
515
|
+
|
|
516
|
+
protected:
|
|
517
|
+
//! @cond Doxygen_Suppress
|
|
518
|
+
GDALDriver *poDriver = nullptr;
|
|
519
|
+
GDALAccess eAccess = GA_ReadOnly;
|
|
520
|
+
|
|
521
|
+
// Stored raster information.
|
|
522
|
+
int nRasterXSize = 512;
|
|
523
|
+
int nRasterYSize = 512;
|
|
524
|
+
int nBands = 0;
|
|
525
|
+
GDALRasterBand **papoBands = nullptr;
|
|
526
|
+
|
|
527
|
+
static constexpr int OPEN_FLAGS_CLOSED = -1;
|
|
528
|
+
int nOpenFlags =
|
|
529
|
+
0; // set to OPEN_FLAGS_CLOSED after Close() has been called
|
|
530
|
+
|
|
531
|
+
int nRefCount = 1;
|
|
532
|
+
bool bForceCachedIO = false;
|
|
533
|
+
bool bShared = false;
|
|
534
|
+
bool bIsInternal = true;
|
|
535
|
+
bool bSuppressOnClose = false;
|
|
536
|
+
|
|
537
|
+
mutable std::map<std::string, std::unique_ptr<OGRFieldDomain>>
|
|
538
|
+
m_oMapFieldDomains{};
|
|
539
|
+
|
|
540
|
+
GDALDataset(void);
|
|
541
|
+
explicit GDALDataset(int bForceCachedIO);
|
|
542
|
+
|
|
543
|
+
void RasterInitialize(int, int);
|
|
544
|
+
void SetBand(int nNewBand, GDALRasterBand *poBand);
|
|
545
|
+
void SetBand(int nNewBand, std::unique_ptr<GDALRasterBand> poBand);
|
|
546
|
+
|
|
547
|
+
GDALDefaultOverviews oOvManager{};
|
|
548
|
+
|
|
549
|
+
virtual CPLErr IBuildOverviews(const char *pszResampling, int nOverviews,
|
|
550
|
+
const int *panOverviewList, int nListBands,
|
|
551
|
+
const int *panBandList,
|
|
552
|
+
GDALProgressFunc pfnProgress,
|
|
553
|
+
void *pProgressData,
|
|
554
|
+
CSLConstList papszOptions);
|
|
555
|
+
|
|
556
|
+
virtual CPLErr
|
|
557
|
+
IRasterIO(GDALRWFlag eRWFlag, int nXOff, int nYOff, int nXSize, int nYSize,
|
|
558
|
+
void *pData, int nBufXSize, int nBufYSize, GDALDataType eBufType,
|
|
559
|
+
int nBandCount, BANDMAP_TYPE panBandMap, GSpacing nPixelSpace,
|
|
560
|
+
GSpacing nLineSpace, GSpacing nBandSpace,
|
|
561
|
+
GDALRasterIOExtraArg *psExtraArg) CPL_WARN_UNUSED_RESULT;
|
|
562
|
+
|
|
563
|
+
/* This method should only be be overloaded by GDALProxyDataset */
|
|
564
|
+
virtual CPLErr
|
|
565
|
+
BlockBasedRasterIO(GDALRWFlag eRWFlag, int nXOff, int nYOff, int nXSize,
|
|
566
|
+
int nYSize, void *pData, int nBufXSize, int nBufYSize,
|
|
567
|
+
GDALDataType eBufType, int nBandCount,
|
|
568
|
+
const int *panBandMap, GSpacing nPixelSpace,
|
|
569
|
+
GSpacing nLineSpace, GSpacing nBandSpace,
|
|
570
|
+
GDALRasterIOExtraArg *psExtraArg) CPL_WARN_UNUSED_RESULT;
|
|
571
|
+
CPLErr BlockBasedFlushCache(bool bAtClosing);
|
|
572
|
+
|
|
573
|
+
CPLErr
|
|
574
|
+
BandBasedRasterIO(GDALRWFlag eRWFlag, int nXOff, int nYOff, int nXSize,
|
|
575
|
+
int nYSize, void *pData, int nBufXSize, int nBufYSize,
|
|
576
|
+
GDALDataType eBufType, int nBandCount,
|
|
577
|
+
const int *panBandMap, GSpacing nPixelSpace,
|
|
578
|
+
GSpacing nLineSpace, GSpacing nBandSpace,
|
|
579
|
+
GDALRasterIOExtraArg *psExtraArg) CPL_WARN_UNUSED_RESULT;
|
|
580
|
+
|
|
581
|
+
CPLErr
|
|
582
|
+
RasterIOResampled(GDALRWFlag eRWFlag, int nXOff, int nYOff, int nXSize,
|
|
583
|
+
int nYSize, void *pData, int nBufXSize, int nBufYSize,
|
|
584
|
+
GDALDataType eBufType, int nBandCount,
|
|
585
|
+
const int *panBandMap, GSpacing nPixelSpace,
|
|
586
|
+
GSpacing nLineSpace, GSpacing nBandSpace,
|
|
587
|
+
GDALRasterIOExtraArg *psExtraArg) CPL_WARN_UNUSED_RESULT;
|
|
588
|
+
|
|
589
|
+
CPLErr ValidateRasterIOOrAdviseReadParameters(
|
|
590
|
+
const char *pszCallingFunc, int *pbStopProcessingOnCENone, int nXOff,
|
|
591
|
+
int nYOff, int nXSize, int nYSize, int nBufXSize, int nBufYSize,
|
|
592
|
+
int nBandCount, const int *panBandMap);
|
|
593
|
+
|
|
594
|
+
CPLErr TryOverviewRasterIO(GDALRWFlag eRWFlag, int nXOff, int nYOff,
|
|
595
|
+
int nXSize, int nYSize, void *pData,
|
|
596
|
+
int nBufXSize, int nBufYSize,
|
|
597
|
+
GDALDataType eBufType, int nBandCount,
|
|
598
|
+
const int *panBandMap, GSpacing nPixelSpace,
|
|
599
|
+
GSpacing nLineSpace, GSpacing nBandSpace,
|
|
600
|
+
GDALRasterIOExtraArg *psExtraArg, int *pbTried);
|
|
601
|
+
|
|
602
|
+
void ShareLockWithParentDataset(GDALDataset *poParentDataset);
|
|
603
|
+
|
|
604
|
+
bool m_bCanBeReopened = false;
|
|
605
|
+
|
|
606
|
+
virtual bool CanBeCloned(int nScopeFlags, bool bCanShareState) const;
|
|
607
|
+
|
|
608
|
+
friend class GDALThreadSafeDataset;
|
|
609
|
+
friend class MEMDataset;
|
|
610
|
+
virtual std::unique_ptr<GDALDataset> Clone(int nScopeFlags,
|
|
611
|
+
bool bCanShareState) const;
|
|
612
|
+
|
|
613
|
+
//! @endcond
|
|
614
|
+
|
|
615
|
+
void CleanupPostFileClosing();
|
|
616
|
+
|
|
617
|
+
virtual int CloseDependentDatasets();
|
|
618
|
+
//! @cond Doxygen_Suppress
|
|
619
|
+
int ValidateLayerCreationOptions(const char *const *papszLCO);
|
|
620
|
+
|
|
621
|
+
char **papszOpenOptions = nullptr;
|
|
622
|
+
|
|
623
|
+
friend class GDALRasterBand;
|
|
624
|
+
|
|
625
|
+
// The below methods related to read write mutex are fragile logic, and
|
|
626
|
+
// should not be used by out-of-tree code if possible.
|
|
627
|
+
int EnterReadWrite(GDALRWFlag eRWFlag);
|
|
628
|
+
void LeaveReadWrite();
|
|
629
|
+
void InitRWLock();
|
|
630
|
+
|
|
631
|
+
void TemporarilyDropReadWriteLock();
|
|
632
|
+
void ReacquireReadWriteLock();
|
|
633
|
+
|
|
634
|
+
void DisableReadWriteMutex();
|
|
635
|
+
|
|
636
|
+
int AcquireMutex();
|
|
637
|
+
void ReleaseMutex();
|
|
638
|
+
|
|
639
|
+
bool IsAllBands(int nBandCount, const int *panBandList) const;
|
|
640
|
+
//! @endcond
|
|
641
|
+
|
|
642
|
+
public:
|
|
643
|
+
~GDALDataset() override;
|
|
644
|
+
|
|
645
|
+
virtual CPLErr Close();
|
|
646
|
+
|
|
647
|
+
int GetRasterXSize() const;
|
|
648
|
+
int GetRasterYSize() const;
|
|
649
|
+
int GetRasterCount() const;
|
|
650
|
+
GDALRasterBand *GetRasterBand(int);
|
|
651
|
+
const GDALRasterBand *GetRasterBand(int) const;
|
|
652
|
+
|
|
653
|
+
/**
|
|
654
|
+
* @brief SetQueryLoggerFunc
|
|
655
|
+
* @param pfnQueryLoggerFuncIn query logger function callback
|
|
656
|
+
* @param poQueryLoggerArgIn arguments passed to the query logger function
|
|
657
|
+
* @return true on success
|
|
658
|
+
*/
|
|
659
|
+
virtual bool SetQueryLoggerFunc(GDALQueryLoggerFunc pfnQueryLoggerFuncIn,
|
|
660
|
+
void *poQueryLoggerArgIn);
|
|
661
|
+
|
|
662
|
+
/** Class returned by GetBands() that act as a container for raster bands.
|
|
663
|
+
*/
|
|
664
|
+
class CPL_DLL Bands
|
|
665
|
+
{
|
|
666
|
+
private:
|
|
667
|
+
friend class GDALDataset;
|
|
668
|
+
GDALDataset *m_poSelf;
|
|
669
|
+
|
|
670
|
+
CPL_INTERNAL explicit Bands(GDALDataset *poSelf) : m_poSelf(poSelf)
|
|
671
|
+
{
|
|
672
|
+
}
|
|
673
|
+
|
|
674
|
+
class CPL_DLL Iterator
|
|
675
|
+
{
|
|
676
|
+
struct Private;
|
|
677
|
+
std::unique_ptr<Private> m_poPrivate;
|
|
678
|
+
|
|
679
|
+
public:
|
|
680
|
+
Iterator(GDALDataset *poDS, bool bStart);
|
|
681
|
+
Iterator(const Iterator &oOther); // declared but not defined.
|
|
682
|
+
// Needed for gcc 5.4 at least
|
|
683
|
+
Iterator(Iterator &&oOther) noexcept; // declared but not defined.
|
|
684
|
+
// Needed for gcc 5.4 at least
|
|
685
|
+
~Iterator();
|
|
686
|
+
GDALRasterBand *operator*();
|
|
687
|
+
Iterator &operator++();
|
|
688
|
+
bool operator!=(const Iterator &it) const;
|
|
689
|
+
};
|
|
690
|
+
|
|
691
|
+
public:
|
|
692
|
+
const Iterator begin() const;
|
|
693
|
+
|
|
694
|
+
const Iterator end() const;
|
|
695
|
+
|
|
696
|
+
size_t size() const;
|
|
697
|
+
|
|
698
|
+
GDALRasterBand *operator[](int iBand);
|
|
699
|
+
GDALRasterBand *operator[](size_t iBand);
|
|
700
|
+
};
|
|
701
|
+
|
|
702
|
+
Bands GetBands();
|
|
703
|
+
|
|
704
|
+
virtual CPLErr FlushCache(bool bAtClosing = false);
|
|
705
|
+
virtual CPLErr DropCache();
|
|
706
|
+
|
|
707
|
+
virtual GIntBig GetEstimatedRAMUsage();
|
|
708
|
+
|
|
709
|
+
virtual const OGRSpatialReference *GetSpatialRef() const;
|
|
710
|
+
virtual CPLErr SetSpatialRef(const OGRSpatialReference *poSRS);
|
|
711
|
+
|
|
712
|
+
// Compatibility layer
|
|
713
|
+
const char *GetProjectionRef(void) const;
|
|
714
|
+
CPLErr SetProjection(const char *pszProjection);
|
|
715
|
+
|
|
716
|
+
virtual CPLErr GetGeoTransform(double *padfTransform);
|
|
717
|
+
virtual CPLErr SetGeoTransform(double *padfTransform);
|
|
718
|
+
|
|
719
|
+
virtual CPLErr AddBand(GDALDataType eType, char **papszOptions = nullptr);
|
|
720
|
+
|
|
721
|
+
virtual void *GetInternalHandle(const char *pszHandleName);
|
|
722
|
+
virtual GDALDriver *GetDriver(void);
|
|
723
|
+
virtual char **GetFileList(void);
|
|
724
|
+
|
|
725
|
+
virtual const char *GetDriverName();
|
|
726
|
+
|
|
727
|
+
virtual const OGRSpatialReference *GetGCPSpatialRef() const;
|
|
728
|
+
virtual int GetGCPCount();
|
|
729
|
+
virtual const GDAL_GCP *GetGCPs();
|
|
730
|
+
virtual CPLErr SetGCPs(int nGCPCount, const GDAL_GCP *pasGCPList,
|
|
731
|
+
const OGRSpatialReference *poGCP_SRS);
|
|
732
|
+
|
|
733
|
+
// Compatibility layer
|
|
734
|
+
const char *GetGCPProjection();
|
|
735
|
+
CPLErr SetGCPs(int nGCPCount, const GDAL_GCP *pasGCPList,
|
|
736
|
+
const char *pszGCPProjection);
|
|
737
|
+
|
|
738
|
+
virtual CPLErr AdviseRead(int nXOff, int nYOff, int nXSize, int nYSize,
|
|
739
|
+
int nBufXSize, int nBufYSize, GDALDataType eDT,
|
|
740
|
+
int nBandCount, int *panBandList,
|
|
741
|
+
char **papszOptions);
|
|
742
|
+
|
|
743
|
+
virtual CPLErr CreateMaskBand(int nFlagsIn);
|
|
744
|
+
|
|
745
|
+
virtual GDALAsyncReader *
|
|
746
|
+
BeginAsyncReader(int nXOff, int nYOff, int nXSize, int nYSize, void *pBuf,
|
|
747
|
+
int nBufXSize, int nBufYSize, GDALDataType eBufType,
|
|
748
|
+
int nBandCount, int *panBandMap, int nPixelSpace,
|
|
749
|
+
int nLineSpace, int nBandSpace, char **papszOptions);
|
|
750
|
+
virtual void EndAsyncReader(GDALAsyncReader *poARIO);
|
|
751
|
+
|
|
752
|
+
//! @cond Doxygen_Suppress
|
|
753
|
+
struct RawBinaryLayout
|
|
754
|
+
{
|
|
755
|
+
enum class Interleaving
|
|
756
|
+
{
|
|
757
|
+
UNKNOWN,
|
|
758
|
+
BIP,
|
|
759
|
+
BIL,
|
|
760
|
+
BSQ
|
|
761
|
+
};
|
|
762
|
+
std::string osRawFilename{};
|
|
763
|
+
Interleaving eInterleaving = Interleaving::UNKNOWN;
|
|
764
|
+
GDALDataType eDataType = GDT_Unknown;
|
|
765
|
+
bool bLittleEndianOrder = false;
|
|
766
|
+
|
|
767
|
+
vsi_l_offset nImageOffset = 0;
|
|
768
|
+
GIntBig nPixelOffset = 0;
|
|
769
|
+
GIntBig nLineOffset = 0;
|
|
770
|
+
GIntBig nBandOffset = 0;
|
|
771
|
+
};
|
|
772
|
+
|
|
773
|
+
virtual bool GetRawBinaryLayout(RawBinaryLayout &);
|
|
774
|
+
//! @endcond
|
|
775
|
+
|
|
776
|
+
#ifndef DOXYGEN_SKIP
|
|
777
|
+
CPLErr RasterIO(GDALRWFlag eRWFlag, int nXOff, int nYOff, int nXSize,
|
|
778
|
+
int nYSize, void *pData, int nBufXSize, int nBufYSize,
|
|
779
|
+
GDALDataType eBufType, int nBandCount,
|
|
780
|
+
const int *panBandMap, GSpacing nPixelSpace,
|
|
781
|
+
GSpacing nLineSpace, GSpacing nBandSpace,
|
|
782
|
+
GDALRasterIOExtraArg *psExtraArg
|
|
783
|
+
OPTIONAL_OUTSIDE_GDAL(nullptr)) CPL_WARN_UNUSED_RESULT;
|
|
784
|
+
#else
|
|
785
|
+
CPLErr RasterIO(GDALRWFlag eRWFlag, int nXOff, int nYOff, int nXSize,
|
|
786
|
+
int nYSize, void *pData, int nBufXSize, int nBufYSize,
|
|
787
|
+
GDALDataType eBufType, int nBandCount,
|
|
788
|
+
const int *panBandMap, GSpacing nPixelSpace,
|
|
789
|
+
GSpacing nLineSpace, GSpacing nBandSpace,
|
|
790
|
+
GDALRasterIOExtraArg *psExtraArg) CPL_WARN_UNUSED_RESULT;
|
|
791
|
+
#endif
|
|
792
|
+
|
|
793
|
+
virtual CPLStringList GetCompressionFormats(int nXOff, int nYOff,
|
|
794
|
+
int nXSize, int nYSize,
|
|
795
|
+
int nBandCount,
|
|
796
|
+
const int *panBandList);
|
|
797
|
+
virtual CPLErr ReadCompressedData(const char *pszFormat, int nXOff,
|
|
798
|
+
int nYOff, int nXSize, int nYSize,
|
|
799
|
+
int nBands, const int *panBandList,
|
|
800
|
+
void **ppBuffer, size_t *pnBufferSize,
|
|
801
|
+
char **ppszDetailedFormat);
|
|
802
|
+
|
|
803
|
+
int Reference();
|
|
804
|
+
int Dereference();
|
|
805
|
+
int ReleaseRef();
|
|
806
|
+
|
|
807
|
+
/** Return access mode.
|
|
808
|
+
* @return access mode.
|
|
809
|
+
*/
|
|
810
|
+
GDALAccess GetAccess() const
|
|
811
|
+
{
|
|
812
|
+
return eAccess;
|
|
813
|
+
}
|
|
814
|
+
|
|
815
|
+
int GetShared() const;
|
|
816
|
+
void MarkAsShared();
|
|
817
|
+
|
|
818
|
+
void MarkSuppressOnClose();
|
|
819
|
+
void UnMarkSuppressOnClose();
|
|
820
|
+
|
|
821
|
+
/** Return MarkSuppressOnClose flag.
|
|
822
|
+
* @return MarkSuppressOnClose flag.
|
|
823
|
+
*/
|
|
824
|
+
bool IsMarkedSuppressOnClose() const
|
|
825
|
+
{
|
|
826
|
+
return bSuppressOnClose;
|
|
827
|
+
}
|
|
828
|
+
|
|
829
|
+
/** Return open options.
|
|
830
|
+
* @return open options.
|
|
831
|
+
*/
|
|
832
|
+
char **GetOpenOptions()
|
|
833
|
+
{
|
|
834
|
+
return papszOpenOptions;
|
|
835
|
+
}
|
|
836
|
+
|
|
837
|
+
bool IsThreadSafe(int nScopeFlags) const;
|
|
838
|
+
|
|
839
|
+
#ifndef DOXYGEN_SKIP
|
|
840
|
+
/** Return open options.
|
|
841
|
+
* @return open options.
|
|
842
|
+
*/
|
|
843
|
+
CSLConstList GetOpenOptions() const
|
|
844
|
+
{
|
|
845
|
+
return papszOpenOptions;
|
|
846
|
+
}
|
|
847
|
+
#endif
|
|
848
|
+
|
|
849
|
+
static GDALDataset **GetOpenDatasets(int *pnDatasetCount);
|
|
850
|
+
|
|
851
|
+
#ifndef DOXYGEN_SKIP
|
|
852
|
+
CPLErr
|
|
853
|
+
BuildOverviews(const char *pszResampling, int nOverviews,
|
|
854
|
+
const int *panOverviewList, int nListBands,
|
|
855
|
+
const int *panBandList, GDALProgressFunc pfnProgress,
|
|
856
|
+
void *pProgressData,
|
|
857
|
+
CSLConstList papszOptions OPTIONAL_OUTSIDE_GDAL(nullptr));
|
|
858
|
+
#else
|
|
859
|
+
CPLErr BuildOverviews(const char *pszResampling, int nOverviews,
|
|
860
|
+
const int *panOverviewList, int nListBands,
|
|
861
|
+
const int *panBandList, GDALProgressFunc pfnProgress,
|
|
862
|
+
void *pProgressData, CSLConstList papszOptions);
|
|
863
|
+
#endif
|
|
864
|
+
|
|
865
|
+
#ifndef DOXYGEN_XML
|
|
866
|
+
void ReportError(CPLErr eErrClass, CPLErrorNum err_no, const char *fmt,
|
|
867
|
+
...) const CPL_PRINT_FUNC_FORMAT(4, 5);
|
|
868
|
+
|
|
869
|
+
static void ReportError(const char *pszDSName, CPLErr eErrClass,
|
|
870
|
+
CPLErrorNum err_no, const char *fmt, ...)
|
|
871
|
+
CPL_PRINT_FUNC_FORMAT(4, 5);
|
|
872
|
+
#endif
|
|
873
|
+
|
|
874
|
+
char **GetMetadata(const char *pszDomain = "") override;
|
|
875
|
+
|
|
876
|
+
// Only defined when Doxygen enabled
|
|
877
|
+
#ifdef DOXYGEN_SKIP
|
|
878
|
+
CPLErr SetMetadata(char **papszMetadata, const char *pszDomain) override;
|
|
879
|
+
CPLErr SetMetadataItem(const char *pszName, const char *pszValue,
|
|
880
|
+
const char *pszDomain) override;
|
|
881
|
+
#endif
|
|
882
|
+
|
|
883
|
+
char **GetMetadataDomainList() override;
|
|
884
|
+
|
|
885
|
+
virtual void ClearStatistics();
|
|
886
|
+
|
|
887
|
+
/** Convert a GDALDataset* to a GDALDatasetH.
|
|
888
|
+
* @since GDAL 2.3
|
|
889
|
+
*/
|
|
890
|
+
static inline GDALDatasetH ToHandle(GDALDataset *poDS)
|
|
891
|
+
{
|
|
892
|
+
return static_cast<GDALDatasetH>(poDS);
|
|
893
|
+
}
|
|
894
|
+
|
|
895
|
+
/** Convert a GDALDatasetH to a GDALDataset*.
|
|
896
|
+
* @since GDAL 2.3
|
|
897
|
+
*/
|
|
898
|
+
static inline GDALDataset *FromHandle(GDALDatasetH hDS)
|
|
899
|
+
{
|
|
900
|
+
return static_cast<GDALDataset *>(hDS);
|
|
901
|
+
}
|
|
902
|
+
|
|
903
|
+
/** @see GDALOpenEx().
|
|
904
|
+
* @since GDAL 2.3
|
|
905
|
+
*/
|
|
906
|
+
static GDALDataset *Open(const char *pszFilename,
|
|
907
|
+
unsigned int nOpenFlags = 0,
|
|
908
|
+
const char *const *papszAllowedDrivers = nullptr,
|
|
909
|
+
const char *const *papszOpenOptions = nullptr,
|
|
910
|
+
const char *const *papszSiblingFiles = nullptr)
|
|
911
|
+
{
|
|
912
|
+
return FromHandle(GDALOpenEx(pszFilename, nOpenFlags,
|
|
913
|
+
papszAllowedDrivers, papszOpenOptions,
|
|
914
|
+
papszSiblingFiles));
|
|
915
|
+
}
|
|
916
|
+
|
|
917
|
+
/** Object returned by GetFeatures() iterators */
|
|
918
|
+
struct FeatureLayerPair
|
|
919
|
+
{
|
|
920
|
+
/** Unique pointer to a OGRFeature. */
|
|
921
|
+
OGRFeatureUniquePtr feature{};
|
|
922
|
+
|
|
923
|
+
/** Layer to which the feature belongs to. */
|
|
924
|
+
OGRLayer *layer = nullptr;
|
|
925
|
+
};
|
|
926
|
+
|
|
927
|
+
//! @cond Doxygen_Suppress
|
|
928
|
+
// SetEnableOverviews() only to be used by GDALOverviewDataset
|
|
929
|
+
void SetEnableOverviews(bool bEnable);
|
|
930
|
+
|
|
931
|
+
// Only to be used by driver's GetOverviewCount() method.
|
|
932
|
+
bool AreOverviewsEnabled() const;
|
|
933
|
+
//! @endcond
|
|
934
|
+
|
|
935
|
+
private:
|
|
936
|
+
class Private;
|
|
937
|
+
Private *m_poPrivate;
|
|
938
|
+
|
|
939
|
+
CPL_INTERNAL OGRLayer *BuildLayerFromSelectInfo(
|
|
940
|
+
swq_select *psSelectInfo, OGRGeometry *poSpatialFilter,
|
|
941
|
+
const char *pszDialect, swq_select_parse_options *poSelectParseOptions);
|
|
942
|
+
CPLStringList oDerivedMetadataList{};
|
|
943
|
+
|
|
944
|
+
public:
|
|
945
|
+
virtual int GetLayerCount();
|
|
946
|
+
virtual OGRLayer *GetLayer(int iLayer);
|
|
947
|
+
|
|
948
|
+
virtual bool IsLayerPrivate(int iLayer) const;
|
|
949
|
+
|
|
950
|
+
/** Class returned by GetLayers() that acts as a range of layers.
|
|
951
|
+
* @since GDAL 2.3
|
|
952
|
+
*/
|
|
953
|
+
class CPL_DLL Layers
|
|
954
|
+
{
|
|
955
|
+
private:
|
|
956
|
+
friend class GDALDataset;
|
|
957
|
+
GDALDataset *m_poSelf;
|
|
958
|
+
|
|
959
|
+
CPL_INTERNAL explicit Layers(GDALDataset *poSelf) : m_poSelf(poSelf)
|
|
960
|
+
{
|
|
961
|
+
}
|
|
962
|
+
|
|
963
|
+
public:
|
|
964
|
+
/** Layer iterator.
|
|
965
|
+
* @since GDAL 2.3
|
|
966
|
+
*/
|
|
967
|
+
class CPL_DLL Iterator
|
|
968
|
+
{
|
|
969
|
+
struct Private;
|
|
970
|
+
std::unique_ptr<Private> m_poPrivate;
|
|
971
|
+
|
|
972
|
+
public:
|
|
973
|
+
using value_type = OGRLayer *; /**< value_type */
|
|
974
|
+
using reference = OGRLayer *; /**< reference */
|
|
975
|
+
using difference_type = void; /**< difference_type */
|
|
976
|
+
using pointer = void; /**< pointer */
|
|
977
|
+
using iterator_category =
|
|
978
|
+
std::input_iterator_tag; /**< iterator_category */
|
|
979
|
+
|
|
980
|
+
Iterator(); /**< Default constructor */
|
|
981
|
+
Iterator(GDALDataset *poDS, bool bStart); /**< Constructor */
|
|
982
|
+
Iterator(const Iterator &oOther); /**< Copy constructor */
|
|
983
|
+
Iterator(Iterator &&oOther) noexcept; /**< Move constructor */
|
|
984
|
+
~Iterator(); /**< Destructor */
|
|
985
|
+
|
|
986
|
+
Iterator &
|
|
987
|
+
operator=(const Iterator &oOther); /**< Assignment operator */
|
|
988
|
+
Iterator &operator=(
|
|
989
|
+
Iterator &&oOther) noexcept; /**< Move assignment operator */
|
|
990
|
+
|
|
991
|
+
OGRLayer *operator*() const; /**< Dereference operator */
|
|
992
|
+
Iterator &operator++(); /**< Pre-increment operator */
|
|
993
|
+
Iterator operator++(int); /**< Post-increment operator */
|
|
994
|
+
bool operator!=(const Iterator &it)
|
|
995
|
+
const; /**< Difference comparison operator */
|
|
996
|
+
};
|
|
997
|
+
|
|
998
|
+
Iterator begin() const;
|
|
999
|
+
Iterator end() const;
|
|
1000
|
+
|
|
1001
|
+
size_t size() const;
|
|
1002
|
+
|
|
1003
|
+
OGRLayer *operator[](int iLayer);
|
|
1004
|
+
OGRLayer *operator[](size_t iLayer);
|
|
1005
|
+
OGRLayer *operator[](const char *pszLayername);
|
|
1006
|
+
};
|
|
1007
|
+
|
|
1008
|
+
Layers GetLayers();
|
|
1009
|
+
|
|
1010
|
+
virtual OGRLayer *GetLayerByName(const char *);
|
|
1011
|
+
virtual OGRErr DeleteLayer(int iLayer);
|
|
1012
|
+
|
|
1013
|
+
virtual void ResetReading();
|
|
1014
|
+
virtual OGRFeature *GetNextFeature(OGRLayer **ppoBelongingLayer,
|
|
1015
|
+
double *pdfProgressPct,
|
|
1016
|
+
GDALProgressFunc pfnProgress,
|
|
1017
|
+
void *pProgressData);
|
|
1018
|
+
|
|
1019
|
+
/** Class returned by GetFeatures() that act as a container for vector
|
|
1020
|
+
* features. */
|
|
1021
|
+
class CPL_DLL Features
|
|
1022
|
+
{
|
|
1023
|
+
private:
|
|
1024
|
+
friend class GDALDataset;
|
|
1025
|
+
GDALDataset *m_poSelf;
|
|
1026
|
+
|
|
1027
|
+
CPL_INTERNAL explicit Features(GDALDataset *poSelf) : m_poSelf(poSelf)
|
|
1028
|
+
{
|
|
1029
|
+
}
|
|
1030
|
+
|
|
1031
|
+
class CPL_DLL Iterator
|
|
1032
|
+
{
|
|
1033
|
+
struct Private;
|
|
1034
|
+
std::unique_ptr<Private> m_poPrivate;
|
|
1035
|
+
|
|
1036
|
+
public:
|
|
1037
|
+
Iterator(GDALDataset *poDS, bool bStart);
|
|
1038
|
+
Iterator(const Iterator &oOther); // declared but not defined.
|
|
1039
|
+
// Needed for gcc 5.4 at least
|
|
1040
|
+
Iterator(Iterator &&oOther) noexcept; // declared but not defined.
|
|
1041
|
+
// Needed for gcc 5.4 at least
|
|
1042
|
+
~Iterator();
|
|
1043
|
+
const FeatureLayerPair &operator*() const;
|
|
1044
|
+
Iterator &operator++();
|
|
1045
|
+
bool operator!=(const Iterator &it) const;
|
|
1046
|
+
};
|
|
1047
|
+
|
|
1048
|
+
public:
|
|
1049
|
+
const Iterator begin() const;
|
|
1050
|
+
|
|
1051
|
+
const Iterator end() const;
|
|
1052
|
+
};
|
|
1053
|
+
|
|
1054
|
+
Features GetFeatures();
|
|
1055
|
+
|
|
1056
|
+
virtual int TestCapability(const char *);
|
|
1057
|
+
|
|
1058
|
+
virtual std::vector<std::string>
|
|
1059
|
+
GetFieldDomainNames(CSLConstList papszOptions = nullptr) const;
|
|
1060
|
+
|
|
1061
|
+
virtual const OGRFieldDomain *GetFieldDomain(const std::string &name) const;
|
|
1062
|
+
|
|
1063
|
+
virtual bool AddFieldDomain(std::unique_ptr<OGRFieldDomain> &&domain,
|
|
1064
|
+
std::string &failureReason);
|
|
1065
|
+
|
|
1066
|
+
virtual bool DeleteFieldDomain(const std::string &name,
|
|
1067
|
+
std::string &failureReason);
|
|
1068
|
+
|
|
1069
|
+
virtual bool UpdateFieldDomain(std::unique_ptr<OGRFieldDomain> &&domain,
|
|
1070
|
+
std::string &failureReason);
|
|
1071
|
+
|
|
1072
|
+
virtual std::vector<std::string>
|
|
1073
|
+
GetRelationshipNames(CSLConstList papszOptions = nullptr) const;
|
|
1074
|
+
|
|
1075
|
+
virtual const GDALRelationship *
|
|
1076
|
+
GetRelationship(const std::string &name) const;
|
|
1077
|
+
|
|
1078
|
+
virtual bool
|
|
1079
|
+
AddRelationship(std::unique_ptr<GDALRelationship> &&relationship,
|
|
1080
|
+
std::string &failureReason);
|
|
1081
|
+
|
|
1082
|
+
virtual bool DeleteRelationship(const std::string &name,
|
|
1083
|
+
std::string &failureReason);
|
|
1084
|
+
|
|
1085
|
+
virtual bool
|
|
1086
|
+
UpdateRelationship(std::unique_ptr<GDALRelationship> &&relationship,
|
|
1087
|
+
std::string &failureReason);
|
|
1088
|
+
|
|
1089
|
+
//! @cond Doxygen_Suppress
|
|
1090
|
+
OGRLayer *CreateLayer(const char *pszName);
|
|
1091
|
+
|
|
1092
|
+
OGRLayer *CreateLayer(const char *pszName, std::nullptr_t);
|
|
1093
|
+
//! @endcond
|
|
1094
|
+
|
|
1095
|
+
OGRLayer *CreateLayer(const char *pszName,
|
|
1096
|
+
const OGRSpatialReference *poSpatialRef,
|
|
1097
|
+
OGRwkbGeometryType eGType = wkbUnknown,
|
|
1098
|
+
CSLConstList papszOptions = nullptr);
|
|
1099
|
+
|
|
1100
|
+
OGRLayer *CreateLayer(const char *pszName,
|
|
1101
|
+
const OGRGeomFieldDefn *poGeomFieldDefn,
|
|
1102
|
+
CSLConstList papszOptions = nullptr);
|
|
1103
|
+
|
|
1104
|
+
virtual OGRLayer *CopyLayer(OGRLayer *poSrcLayer, const char *pszNewName,
|
|
1105
|
+
char **papszOptions = nullptr);
|
|
1106
|
+
|
|
1107
|
+
virtual OGRStyleTable *GetStyleTable();
|
|
1108
|
+
virtual void SetStyleTableDirectly(OGRStyleTable *poStyleTable);
|
|
1109
|
+
|
|
1110
|
+
virtual void SetStyleTable(OGRStyleTable *poStyleTable);
|
|
1111
|
+
|
|
1112
|
+
virtual OGRLayer *ExecuteSQL(const char *pszStatement,
|
|
1113
|
+
OGRGeometry *poSpatialFilter,
|
|
1114
|
+
const char *pszDialect);
|
|
1115
|
+
virtual void ReleaseResultSet(OGRLayer *poResultsSet);
|
|
1116
|
+
virtual OGRErr AbortSQL();
|
|
1117
|
+
|
|
1118
|
+
int GetRefCount() const;
|
|
1119
|
+
int GetSummaryRefCount() const;
|
|
1120
|
+
OGRErr Release();
|
|
1121
|
+
|
|
1122
|
+
virtual OGRErr StartTransaction(int bForce = FALSE);
|
|
1123
|
+
virtual OGRErr CommitTransaction();
|
|
1124
|
+
virtual OGRErr RollbackTransaction();
|
|
1125
|
+
|
|
1126
|
+
virtual std::shared_ptr<GDALGroup> GetRootGroup() const;
|
|
1127
|
+
|
|
1128
|
+
//! @cond Doxygen_Suppress
|
|
1129
|
+
static int IsGenericSQLDialect(const char *pszDialect);
|
|
1130
|
+
|
|
1131
|
+
// Semi-public methods. Only to be used by in-tree drivers.
|
|
1132
|
+
GDALSQLParseInfo *
|
|
1133
|
+
BuildParseInfo(swq_select *psSelectInfo,
|
|
1134
|
+
swq_select_parse_options *poSelectParseOptions);
|
|
1135
|
+
static void DestroyParseInfo(GDALSQLParseInfo *psParseInfo);
|
|
1136
|
+
OGRLayer *ExecuteSQL(const char *pszStatement, OGRGeometry *poSpatialFilter,
|
|
1137
|
+
const char *pszDialect,
|
|
1138
|
+
swq_select_parse_options *poSelectParseOptions);
|
|
1139
|
+
//! @endcond
|
|
1140
|
+
|
|
1141
|
+
protected:
|
|
1142
|
+
virtual OGRLayer *ICreateLayer(const char *pszName,
|
|
1143
|
+
const OGRGeomFieldDefn *poGeomFieldDefn,
|
|
1144
|
+
CSLConstList papszOptions);
|
|
1145
|
+
|
|
1146
|
+
//! @cond Doxygen_Suppress
|
|
1147
|
+
OGRErr ProcessSQLCreateIndex(const char *);
|
|
1148
|
+
OGRErr ProcessSQLDropIndex(const char *);
|
|
1149
|
+
OGRErr ProcessSQLDropTable(const char *);
|
|
1150
|
+
OGRErr ProcessSQLAlterTableAddColumn(const char *);
|
|
1151
|
+
OGRErr ProcessSQLAlterTableDropColumn(const char *);
|
|
1152
|
+
OGRErr ProcessSQLAlterTableAlterColumn(const char *);
|
|
1153
|
+
OGRErr ProcessSQLAlterTableRenameColumn(const char *);
|
|
1154
|
+
|
|
1155
|
+
OGRStyleTable *m_poStyleTable = nullptr;
|
|
1156
|
+
|
|
1157
|
+
friend class GDALProxyPoolDataset;
|
|
1158
|
+
//! @endcond
|
|
1159
|
+
|
|
1160
|
+
private:
|
|
1161
|
+
CPL_DISALLOW_COPY_ASSIGN(GDALDataset)
|
|
1162
|
+
};
|
|
1163
|
+
|
|
1164
|
+
//! @cond Doxygen_Suppress
|
|
1165
|
+
struct CPL_DLL GDALDatasetUniquePtrDeleter
|
|
1166
|
+
{
|
|
1167
|
+
void operator()(GDALDataset *poDataset) const
|
|
1168
|
+
{
|
|
1169
|
+
GDALClose(poDataset);
|
|
1170
|
+
}
|
|
1171
|
+
};
|
|
1172
|
+
|
|
1173
|
+
//! @endcond
|
|
1174
|
+
|
|
1175
|
+
//! @cond Doxygen_Suppress
|
|
1176
|
+
struct CPL_DLL GDALDatasetUniquePtrReleaser
|
|
1177
|
+
{
|
|
1178
|
+
void operator()(GDALDataset *poDataset) const
|
|
1179
|
+
{
|
|
1180
|
+
if (poDataset)
|
|
1181
|
+
poDataset->Release();
|
|
1182
|
+
}
|
|
1183
|
+
};
|
|
1184
|
+
|
|
1185
|
+
//! @endcond
|
|
1186
|
+
|
|
1187
|
+
/** Unique pointer type for GDALDataset.
|
|
1188
|
+
* Appropriate for use on datasets open in non-shared mode and onto which
|
|
1189
|
+
* reference counter has not been manually modified.
|
|
1190
|
+
* @since GDAL 2.3
|
|
1191
|
+
*/
|
|
1192
|
+
using GDALDatasetUniquePtr =
|
|
1193
|
+
std::unique_ptr<GDALDataset, GDALDatasetUniquePtrDeleter>;
|
|
1194
|
+
|
|
1195
|
+
/* ******************************************************************** */
|
|
1196
|
+
/* GDALRasterBlock */
|
|
1197
|
+
/* ******************************************************************** */
|
|
1198
|
+
|
|
1199
|
+
/** A single raster block in the block cache.
|
|
1200
|
+
*
|
|
1201
|
+
* And the global block manager that manages a least-recently-used list of
|
|
1202
|
+
* blocks from various datasets/bands */
|
|
1203
|
+
class CPL_DLL GDALRasterBlock
|
|
1204
|
+
{
|
|
1205
|
+
friend class GDALAbstractBandBlockCache;
|
|
1206
|
+
|
|
1207
|
+
GDALDataType eType;
|
|
1208
|
+
|
|
1209
|
+
bool bDirty;
|
|
1210
|
+
volatile int nLockCount;
|
|
1211
|
+
|
|
1212
|
+
int nXOff;
|
|
1213
|
+
int nYOff;
|
|
1214
|
+
|
|
1215
|
+
int nXSize;
|
|
1216
|
+
int nYSize;
|
|
1217
|
+
|
|
1218
|
+
void *pData;
|
|
1219
|
+
|
|
1220
|
+
GDALRasterBand *poBand;
|
|
1221
|
+
|
|
1222
|
+
GDALRasterBlock *poNext;
|
|
1223
|
+
GDALRasterBlock *poPrevious;
|
|
1224
|
+
|
|
1225
|
+
bool bMustDetach;
|
|
1226
|
+
|
|
1227
|
+
CPL_INTERNAL void Detach_unlocked(void);
|
|
1228
|
+
CPL_INTERNAL void Touch_unlocked(void);
|
|
1229
|
+
|
|
1230
|
+
CPL_INTERNAL void RecycleFor(int nXOffIn, int nYOffIn);
|
|
1231
|
+
|
|
1232
|
+
public:
|
|
1233
|
+
GDALRasterBlock(GDALRasterBand *, int, int);
|
|
1234
|
+
GDALRasterBlock(int nXOffIn, int nYOffIn); /* only for lookup purpose */
|
|
1235
|
+
virtual ~GDALRasterBlock();
|
|
1236
|
+
|
|
1237
|
+
CPLErr Internalize(void);
|
|
1238
|
+
void Touch(void);
|
|
1239
|
+
void MarkDirty(void);
|
|
1240
|
+
void MarkClean(void);
|
|
1241
|
+
|
|
1242
|
+
/** Increment the lock count */
|
|
1243
|
+
int AddLock(void)
|
|
1244
|
+
{
|
|
1245
|
+
return CPLAtomicInc(&nLockCount);
|
|
1246
|
+
}
|
|
1247
|
+
|
|
1248
|
+
/** Decrement the lock count */
|
|
1249
|
+
int DropLock(void)
|
|
1250
|
+
{
|
|
1251
|
+
return CPLAtomicDec(&nLockCount);
|
|
1252
|
+
}
|
|
1253
|
+
|
|
1254
|
+
void Detach();
|
|
1255
|
+
|
|
1256
|
+
CPLErr Write();
|
|
1257
|
+
|
|
1258
|
+
/** Return the data type
|
|
1259
|
+
* @return data type
|
|
1260
|
+
*/
|
|
1261
|
+
GDALDataType GetDataType() const
|
|
1262
|
+
{
|
|
1263
|
+
return eType;
|
|
1264
|
+
}
|
|
1265
|
+
|
|
1266
|
+
/** Return the x offset of the top-left corner of the block
|
|
1267
|
+
* @return x offset
|
|
1268
|
+
*/
|
|
1269
|
+
int GetXOff() const
|
|
1270
|
+
{
|
|
1271
|
+
return nXOff;
|
|
1272
|
+
}
|
|
1273
|
+
|
|
1274
|
+
/** Return the y offset of the top-left corner of the block
|
|
1275
|
+
* @return y offset
|
|
1276
|
+
*/
|
|
1277
|
+
int GetYOff() const
|
|
1278
|
+
{
|
|
1279
|
+
return nYOff;
|
|
1280
|
+
}
|
|
1281
|
+
|
|
1282
|
+
/** Return the width of the block
|
|
1283
|
+
* @return width
|
|
1284
|
+
*/
|
|
1285
|
+
int GetXSize() const
|
|
1286
|
+
{
|
|
1287
|
+
return nXSize;
|
|
1288
|
+
}
|
|
1289
|
+
|
|
1290
|
+
/** Return the height of the block
|
|
1291
|
+
* @return height
|
|
1292
|
+
*/
|
|
1293
|
+
int GetYSize() const
|
|
1294
|
+
{
|
|
1295
|
+
return nYSize;
|
|
1296
|
+
}
|
|
1297
|
+
|
|
1298
|
+
/** Return the dirty flag
|
|
1299
|
+
* @return dirty flag
|
|
1300
|
+
*/
|
|
1301
|
+
int GetDirty() const
|
|
1302
|
+
{
|
|
1303
|
+
return bDirty;
|
|
1304
|
+
}
|
|
1305
|
+
|
|
1306
|
+
/** Return the data buffer
|
|
1307
|
+
* @return data buffer
|
|
1308
|
+
*/
|
|
1309
|
+
void *GetDataRef(void)
|
|
1310
|
+
{
|
|
1311
|
+
return pData;
|
|
1312
|
+
}
|
|
1313
|
+
|
|
1314
|
+
/** Return the block size in bytes
|
|
1315
|
+
* @return block size.
|
|
1316
|
+
*/
|
|
1317
|
+
GPtrDiff_t GetBlockSize() const
|
|
1318
|
+
{
|
|
1319
|
+
return static_cast<GPtrDiff_t>(nXSize) * nYSize *
|
|
1320
|
+
GDALGetDataTypeSizeBytes(eType);
|
|
1321
|
+
}
|
|
1322
|
+
|
|
1323
|
+
int TakeLock();
|
|
1324
|
+
int DropLockForRemovalFromStorage();
|
|
1325
|
+
|
|
1326
|
+
/// @brief Accessor to source GDALRasterBand object.
|
|
1327
|
+
/// @return source raster band of the raster block.
|
|
1328
|
+
GDALRasterBand *GetBand()
|
|
1329
|
+
{
|
|
1330
|
+
return poBand;
|
|
1331
|
+
}
|
|
1332
|
+
|
|
1333
|
+
static void FlushDirtyBlocks();
|
|
1334
|
+
static int FlushCacheBlock(int bDirtyBlocksOnly = FALSE);
|
|
1335
|
+
static void Verify();
|
|
1336
|
+
|
|
1337
|
+
static void EnterDisableDirtyBlockFlush();
|
|
1338
|
+
static void LeaveDisableDirtyBlockFlush();
|
|
1339
|
+
|
|
1340
|
+
#ifdef notdef
|
|
1341
|
+
static void CheckNonOrphanedBlocks(GDALRasterBand *poBand);
|
|
1342
|
+
void DumpBlock();
|
|
1343
|
+
static void DumpAll();
|
|
1344
|
+
#endif
|
|
1345
|
+
|
|
1346
|
+
/* Should only be called by GDALDestroyDriverManager() */
|
|
1347
|
+
//! @cond Doxygen_Suppress
|
|
1348
|
+
CPL_INTERNAL static void DestroyRBMutex();
|
|
1349
|
+
//! @endcond
|
|
1350
|
+
|
|
1351
|
+
private:
|
|
1352
|
+
CPL_DISALLOW_COPY_ASSIGN(GDALRasterBlock)
|
|
1353
|
+
};
|
|
1354
|
+
|
|
1355
|
+
/* ******************************************************************** */
|
|
1356
|
+
/* GDALColorTable */
|
|
1357
|
+
/* ******************************************************************** */
|
|
1358
|
+
|
|
1359
|
+
/** A color table / palette. */
|
|
1360
|
+
|
|
1361
|
+
class CPL_DLL GDALColorTable
|
|
1362
|
+
{
|
|
1363
|
+
GDALPaletteInterp eInterp;
|
|
1364
|
+
|
|
1365
|
+
std::vector<GDALColorEntry> aoEntries{};
|
|
1366
|
+
|
|
1367
|
+
public:
|
|
1368
|
+
explicit GDALColorTable(GDALPaletteInterp = GPI_RGB);
|
|
1369
|
+
~GDALColorTable();
|
|
1370
|
+
|
|
1371
|
+
GDALColorTable *Clone() const;
|
|
1372
|
+
int IsSame(const GDALColorTable *poOtherCT) const;
|
|
1373
|
+
|
|
1374
|
+
GDALPaletteInterp GetPaletteInterpretation() const;
|
|
1375
|
+
|
|
1376
|
+
int GetColorEntryCount() const;
|
|
1377
|
+
const GDALColorEntry *GetColorEntry(int i) const;
|
|
1378
|
+
int GetColorEntryAsRGB(int i, GDALColorEntry *poEntry) const;
|
|
1379
|
+
void SetColorEntry(int i, const GDALColorEntry *poEntry);
|
|
1380
|
+
int CreateColorRamp(int nStartIndex, const GDALColorEntry *psStartColor,
|
|
1381
|
+
int nEndIndex, const GDALColorEntry *psEndColor);
|
|
1382
|
+
bool IsIdentity() const;
|
|
1383
|
+
|
|
1384
|
+
/** Convert a GDALColorTable* to a GDALRasterBandH.
|
|
1385
|
+
* @since GDAL 2.3
|
|
1386
|
+
*/
|
|
1387
|
+
static inline GDALColorTableH ToHandle(GDALColorTable *poCT)
|
|
1388
|
+
{
|
|
1389
|
+
return static_cast<GDALColorTableH>(poCT);
|
|
1390
|
+
}
|
|
1391
|
+
|
|
1392
|
+
/** Convert a GDALColorTableH to a GDALColorTable*.
|
|
1393
|
+
* @since GDAL 2.3
|
|
1394
|
+
*/
|
|
1395
|
+
static inline GDALColorTable *FromHandle(GDALColorTableH hCT)
|
|
1396
|
+
{
|
|
1397
|
+
return static_cast<GDALColorTable *>(hCT);
|
|
1398
|
+
}
|
|
1399
|
+
};
|
|
1400
|
+
|
|
1401
|
+
/* ******************************************************************** */
|
|
1402
|
+
/* GDALAbstractBandBlockCache */
|
|
1403
|
+
/* ******************************************************************** */
|
|
1404
|
+
|
|
1405
|
+
//! @cond Doxygen_Suppress
|
|
1406
|
+
|
|
1407
|
+
//! This manages how a raster band store its cached block.
|
|
1408
|
+
// only used by GDALRasterBand implementation.
|
|
1409
|
+
|
|
1410
|
+
class GDALAbstractBandBlockCache
|
|
1411
|
+
{
|
|
1412
|
+
// List of blocks that can be freed or recycled, and its lock
|
|
1413
|
+
CPLLock *hSpinLock = nullptr;
|
|
1414
|
+
GDALRasterBlock *psListBlocksToFree = nullptr;
|
|
1415
|
+
|
|
1416
|
+
// Band keep alive counter, and its lock & condition
|
|
1417
|
+
CPLCond *hCond = nullptr;
|
|
1418
|
+
CPLMutex *hCondMutex = nullptr;
|
|
1419
|
+
volatile int nKeepAliveCounter = 0;
|
|
1420
|
+
|
|
1421
|
+
volatile int m_nDirtyBlocks = 0;
|
|
1422
|
+
|
|
1423
|
+
CPL_DISALLOW_COPY_ASSIGN(GDALAbstractBandBlockCache)
|
|
1424
|
+
|
|
1425
|
+
protected:
|
|
1426
|
+
GDALRasterBand *poBand;
|
|
1427
|
+
|
|
1428
|
+
int m_nInitialDirtyBlocksInFlushCache = 0;
|
|
1429
|
+
int m_nLastTick = -1;
|
|
1430
|
+
size_t m_nWriteDirtyBlocksDisabled = 0;
|
|
1431
|
+
|
|
1432
|
+
void FreeDanglingBlocks();
|
|
1433
|
+
void UnreferenceBlockBase();
|
|
1434
|
+
|
|
1435
|
+
void StartDirtyBlockFlushingLog();
|
|
1436
|
+
void UpdateDirtyBlockFlushingLog();
|
|
1437
|
+
void EndDirtyBlockFlushingLog();
|
|
1438
|
+
|
|
1439
|
+
public:
|
|
1440
|
+
explicit GDALAbstractBandBlockCache(GDALRasterBand *poBand);
|
|
1441
|
+
virtual ~GDALAbstractBandBlockCache();
|
|
1442
|
+
|
|
1443
|
+
GDALRasterBlock *CreateBlock(int nXBlockOff, int nYBlockOff);
|
|
1444
|
+
void AddBlockToFreeList(GDALRasterBlock *poBlock);
|
|
1445
|
+
void IncDirtyBlocks(int nInc);
|
|
1446
|
+
void WaitCompletionPendingTasks();
|
|
1447
|
+
|
|
1448
|
+
void EnableDirtyBlockWriting()
|
|
1449
|
+
{
|
|
1450
|
+
--m_nWriteDirtyBlocksDisabled;
|
|
1451
|
+
}
|
|
1452
|
+
|
|
1453
|
+
void DisableDirtyBlockWriting()
|
|
1454
|
+
{
|
|
1455
|
+
++m_nWriteDirtyBlocksDisabled;
|
|
1456
|
+
}
|
|
1457
|
+
|
|
1458
|
+
bool HasDirtyBlocks() const
|
|
1459
|
+
{
|
|
1460
|
+
return m_nDirtyBlocks > 0;
|
|
1461
|
+
}
|
|
1462
|
+
|
|
1463
|
+
virtual bool Init() = 0;
|
|
1464
|
+
virtual bool IsInitOK() = 0;
|
|
1465
|
+
virtual CPLErr FlushCache() = 0;
|
|
1466
|
+
virtual CPLErr AdoptBlock(GDALRasterBlock *poBlock) = 0;
|
|
1467
|
+
virtual GDALRasterBlock *TryGetLockedBlockRef(int nXBlockOff,
|
|
1468
|
+
int nYBlockYOff) = 0;
|
|
1469
|
+
virtual CPLErr UnreferenceBlock(GDALRasterBlock *poBlock) = 0;
|
|
1470
|
+
virtual CPLErr FlushBlock(int nXBlockOff, int nYBlockOff,
|
|
1471
|
+
int bWriteDirtyBlock) = 0;
|
|
1472
|
+
};
|
|
1473
|
+
|
|
1474
|
+
GDALAbstractBandBlockCache *
|
|
1475
|
+
GDALArrayBandBlockCacheCreate(GDALRasterBand *poBand);
|
|
1476
|
+
GDALAbstractBandBlockCache *
|
|
1477
|
+
GDALHashSetBandBlockCacheCreate(GDALRasterBand *poBand);
|
|
1478
|
+
|
|
1479
|
+
//! @endcond
|
|
1480
|
+
|
|
1481
|
+
/* ******************************************************************** */
|
|
1482
|
+
/* GDALRasterBand */
|
|
1483
|
+
/* ******************************************************************** */
|
|
1484
|
+
|
|
1485
|
+
class GDALMDArray;
|
|
1486
|
+
class GDALDoublePointsCache;
|
|
1487
|
+
|
|
1488
|
+
/** Range of values found in a mask band */
|
|
1489
|
+
typedef enum
|
|
1490
|
+
{
|
|
1491
|
+
GMVR_UNKNOWN, /*! Unknown (can also be used for any values between 0 and 255
|
|
1492
|
+
for a Byte band) */
|
|
1493
|
+
GMVR_0_AND_1_ONLY, /*! Only 0 and 1 */
|
|
1494
|
+
GMVR_0_AND_255_ONLY, /*! Only 0 and 255 */
|
|
1495
|
+
} GDALMaskValueRange;
|
|
1496
|
+
|
|
1497
|
+
/** Suggested/most efficient access pattern to blocks. */
|
|
1498
|
+
typedef int GDALSuggestedBlockAccessPattern;
|
|
1499
|
+
|
|
1500
|
+
/** Unknown, or no particular read order is suggested. */
|
|
1501
|
+
constexpr GDALSuggestedBlockAccessPattern GSBAP_UNKNOWN = 0;
|
|
1502
|
+
|
|
1503
|
+
/** Random access to blocks is efficient. */
|
|
1504
|
+
constexpr GDALSuggestedBlockAccessPattern GSBAP_RANDOM = 1;
|
|
1505
|
+
|
|
1506
|
+
/** Reading by strips from top to bottom is the most efficient. */
|
|
1507
|
+
constexpr GDALSuggestedBlockAccessPattern GSBAP_TOP_TO_BOTTOM = 2;
|
|
1508
|
+
|
|
1509
|
+
/** Reading by strips from bottom to top is the most efficient. */
|
|
1510
|
+
constexpr GDALSuggestedBlockAccessPattern GSBAP_BOTTOM_TO_TOP = 3;
|
|
1511
|
+
|
|
1512
|
+
/** Reading the largest chunk from the raster is the most efficient (can be
|
|
1513
|
+
* combined with above values). */
|
|
1514
|
+
constexpr GDALSuggestedBlockAccessPattern GSBAP_LARGEST_CHUNK_POSSIBLE = 0x100;
|
|
1515
|
+
|
|
1516
|
+
/** A single raster band (or channel). */
|
|
1517
|
+
|
|
1518
|
+
class CPL_DLL GDALRasterBand : public GDALMajorObject
|
|
1519
|
+
{
|
|
1520
|
+
private:
|
|
1521
|
+
friend class GDALArrayBandBlockCache;
|
|
1522
|
+
friend class GDALHashSetBandBlockCache;
|
|
1523
|
+
friend class GDALRasterBlock;
|
|
1524
|
+
friend class GDALDataset;
|
|
1525
|
+
|
|
1526
|
+
CPLErr eFlushBlockErr = CE_None;
|
|
1527
|
+
GDALAbstractBandBlockCache *poBandBlockCache = nullptr;
|
|
1528
|
+
|
|
1529
|
+
CPL_INTERNAL void SetFlushBlockErr(CPLErr eErr);
|
|
1530
|
+
CPL_INTERNAL CPLErr UnreferenceBlock(GDALRasterBlock *poBlock);
|
|
1531
|
+
CPL_INTERNAL void IncDirtyBlocks(int nInc);
|
|
1532
|
+
|
|
1533
|
+
protected:
|
|
1534
|
+
//! @cond Doxygen_Suppress
|
|
1535
|
+
GDALDataset *poDS = nullptr;
|
|
1536
|
+
int nBand = 0; /* 1 based */
|
|
1537
|
+
|
|
1538
|
+
int nRasterXSize = 0;
|
|
1539
|
+
int nRasterYSize = 0;
|
|
1540
|
+
|
|
1541
|
+
GDALDataType eDataType = GDT_Byte;
|
|
1542
|
+
GDALAccess eAccess = GA_ReadOnly;
|
|
1543
|
+
|
|
1544
|
+
/* stuff related to blocking, and raster cache */
|
|
1545
|
+
int nBlockXSize = -1;
|
|
1546
|
+
int nBlockYSize = -1;
|
|
1547
|
+
int nBlocksPerRow = 0;
|
|
1548
|
+
int nBlocksPerColumn = 0;
|
|
1549
|
+
|
|
1550
|
+
int nBlockReads = 0;
|
|
1551
|
+
int bForceCachedIO = 0;
|
|
1552
|
+
|
|
1553
|
+
class GDALRasterBandOwnedOrNot
|
|
1554
|
+
{
|
|
1555
|
+
public:
|
|
1556
|
+
GDALRasterBandOwnedOrNot()
|
|
1557
|
+
{
|
|
1558
|
+
}
|
|
1559
|
+
|
|
1560
|
+
GDALRasterBandOwnedOrNot(GDALRasterBand *poBand, bool bOwned)
|
|
1561
|
+
: m_poBandOwned(bOwned ? poBand : nullptr),
|
|
1562
|
+
m_poBandRef(bOwned ? nullptr : poBand)
|
|
1563
|
+
{
|
|
1564
|
+
}
|
|
1565
|
+
|
|
1566
|
+
void reset()
|
|
1567
|
+
{
|
|
1568
|
+
m_poBandOwned.reset();
|
|
1569
|
+
m_poBandRef = nullptr;
|
|
1570
|
+
}
|
|
1571
|
+
|
|
1572
|
+
void reset(GDALRasterBand *poBand, bool bOwned)
|
|
1573
|
+
{
|
|
1574
|
+
m_poBandOwned.reset(bOwned ? poBand : nullptr);
|
|
1575
|
+
m_poBandRef = bOwned ? nullptr : poBand;
|
|
1576
|
+
}
|
|
1577
|
+
|
|
1578
|
+
const GDALRasterBand *get() const
|
|
1579
|
+
{
|
|
1580
|
+
return static_cast<const GDALRasterBand *>(*this);
|
|
1581
|
+
}
|
|
1582
|
+
|
|
1583
|
+
GDALRasterBand *get()
|
|
1584
|
+
{
|
|
1585
|
+
return static_cast<GDALRasterBand *>(*this);
|
|
1586
|
+
}
|
|
1587
|
+
|
|
1588
|
+
bool IsOwned() const
|
|
1589
|
+
{
|
|
1590
|
+
return m_poBandOwned != nullptr;
|
|
1591
|
+
}
|
|
1592
|
+
|
|
1593
|
+
operator const GDALRasterBand *() const
|
|
1594
|
+
{
|
|
1595
|
+
return m_poBandOwned ? m_poBandOwned.get() : m_poBandRef;
|
|
1596
|
+
}
|
|
1597
|
+
|
|
1598
|
+
operator GDALRasterBand *()
|
|
1599
|
+
{
|
|
1600
|
+
return m_poBandOwned ? m_poBandOwned.get() : m_poBandRef;
|
|
1601
|
+
}
|
|
1602
|
+
|
|
1603
|
+
private:
|
|
1604
|
+
CPL_DISALLOW_COPY_ASSIGN(GDALRasterBandOwnedOrNot)
|
|
1605
|
+
std::unique_ptr<GDALRasterBand> m_poBandOwned{};
|
|
1606
|
+
GDALRasterBand *m_poBandRef = nullptr;
|
|
1607
|
+
};
|
|
1608
|
+
|
|
1609
|
+
GDALRasterBandOwnedOrNot poMask{};
|
|
1610
|
+
bool m_bEnablePixelTypeSignedByteWarning =
|
|
1611
|
+
true; // Remove me in GDAL 4.0. See GetMetadataItem() implementation
|
|
1612
|
+
int nMaskFlags = 0;
|
|
1613
|
+
|
|
1614
|
+
void InvalidateMaskBand();
|
|
1615
|
+
|
|
1616
|
+
friend class GDALProxyRasterBand;
|
|
1617
|
+
friend class GDALDefaultOverviews;
|
|
1618
|
+
|
|
1619
|
+
CPLErr
|
|
1620
|
+
RasterIOResampled(GDALRWFlag eRWFlag, int nXOff, int nYOff, int nXSize,
|
|
1621
|
+
int nYSize, void *pData, int nBufXSize, int nBufYSize,
|
|
1622
|
+
GDALDataType eBufType, GSpacing nPixelSpace,
|
|
1623
|
+
GSpacing nLineSpace,
|
|
1624
|
+
GDALRasterIOExtraArg *psExtraArg) CPL_WARN_UNUSED_RESULT;
|
|
1625
|
+
|
|
1626
|
+
int EnterReadWrite(GDALRWFlag eRWFlag);
|
|
1627
|
+
void LeaveReadWrite();
|
|
1628
|
+
void InitRWLock();
|
|
1629
|
+
void SetValidPercent(GUIntBig nSampleCount, GUIntBig nValidCount);
|
|
1630
|
+
|
|
1631
|
+
mutable GDALDoublePointsCache *m_poPointsCache = nullptr;
|
|
1632
|
+
|
|
1633
|
+
//! @endcond
|
|
1634
|
+
|
|
1635
|
+
protected:
|
|
1636
|
+
virtual CPLErr IReadBlock(int nBlockXOff, int nBlockYOff, void *pData) = 0;
|
|
1637
|
+
virtual CPLErr IWriteBlock(int nBlockXOff, int nBlockYOff, void *pData);
|
|
1638
|
+
|
|
1639
|
+
virtual CPLErr
|
|
1640
|
+
IRasterIO(GDALRWFlag eRWFlag, int nXOff, int nYOff, int nXSize, int nYSize,
|
|
1641
|
+
void *pData, int nBufXSize, int nBufYSize, GDALDataType eBufType,
|
|
1642
|
+
GSpacing nPixelSpace, GSpacing nLineSpace,
|
|
1643
|
+
GDALRasterIOExtraArg *psExtraArg) CPL_WARN_UNUSED_RESULT;
|
|
1644
|
+
|
|
1645
|
+
virtual int IGetDataCoverageStatus(int nXOff, int nYOff, int nXSize,
|
|
1646
|
+
int nYSize, int nMaskFlagStop,
|
|
1647
|
+
double *pdfDataPct);
|
|
1648
|
+
//! @cond Doxygen_Suppress
|
|
1649
|
+
CPLErr
|
|
1650
|
+
OverviewRasterIO(GDALRWFlag eRWFlag, int nXOff, int nYOff, int nXSize,
|
|
1651
|
+
int nYSize, void *pData, int nBufXSize, int nBufYSize,
|
|
1652
|
+
GDALDataType eBufType, GSpacing nPixelSpace,
|
|
1653
|
+
GSpacing nLineSpace,
|
|
1654
|
+
GDALRasterIOExtraArg *psExtraArg) CPL_WARN_UNUSED_RESULT;
|
|
1655
|
+
|
|
1656
|
+
CPLErr TryOverviewRasterIO(GDALRWFlag eRWFlag, int nXOff, int nYOff,
|
|
1657
|
+
int nXSize, int nYSize, void *pData,
|
|
1658
|
+
int nBufXSize, int nBufYSize,
|
|
1659
|
+
GDALDataType eBufType, GSpacing nPixelSpace,
|
|
1660
|
+
GSpacing nLineSpace,
|
|
1661
|
+
GDALRasterIOExtraArg *psExtraArg, int *pbTried);
|
|
1662
|
+
|
|
1663
|
+
int InitBlockInfo();
|
|
1664
|
+
|
|
1665
|
+
void AddBlockToFreeList(GDALRasterBlock *);
|
|
1666
|
+
|
|
1667
|
+
bool HasBlockCache() const
|
|
1668
|
+
{
|
|
1669
|
+
return poBandBlockCache != nullptr;
|
|
1670
|
+
}
|
|
1671
|
+
|
|
1672
|
+
bool HasDirtyBlocks() const
|
|
1673
|
+
{
|
|
1674
|
+
return poBandBlockCache && poBandBlockCache->HasDirtyBlocks();
|
|
1675
|
+
}
|
|
1676
|
+
|
|
1677
|
+
//! @endcond
|
|
1678
|
+
|
|
1679
|
+
public:
|
|
1680
|
+
GDALRasterBand();
|
|
1681
|
+
explicit GDALRasterBand(int bForceCachedIO);
|
|
1682
|
+
|
|
1683
|
+
~GDALRasterBand() override;
|
|
1684
|
+
|
|
1685
|
+
int GetXSize() const;
|
|
1686
|
+
int GetYSize() const;
|
|
1687
|
+
int GetBand() const;
|
|
1688
|
+
GDALDataset *GetDataset() const;
|
|
1689
|
+
|
|
1690
|
+
GDALDataType GetRasterDataType(void) const;
|
|
1691
|
+
void GetBlockSize(int *pnXSize, int *pnYSize) const;
|
|
1692
|
+
CPLErr GetActualBlockSize(int nXBlockOff, int nYBlockOff, int *pnXValid,
|
|
1693
|
+
int *pnYValid) const;
|
|
1694
|
+
|
|
1695
|
+
virtual GDALSuggestedBlockAccessPattern
|
|
1696
|
+
GetSuggestedBlockAccessPattern() const;
|
|
1697
|
+
|
|
1698
|
+
GDALAccess GetAccess();
|
|
1699
|
+
|
|
1700
|
+
#ifndef DOXYGEN_SKIP
|
|
1701
|
+
CPLErr RasterIO(GDALRWFlag eRWFlag, int nXOff, int nYOff, int nXSize,
|
|
1702
|
+
int nYSize, void *pData, int nBufXSize, int nBufYSize,
|
|
1703
|
+
GDALDataType eBufType, GSpacing nPixelSpace,
|
|
1704
|
+
GSpacing nLineSpace,
|
|
1705
|
+
GDALRasterIOExtraArg *psExtraArg
|
|
1706
|
+
OPTIONAL_OUTSIDE_GDAL(nullptr)) CPL_WARN_UNUSED_RESULT;
|
|
1707
|
+
#else
|
|
1708
|
+
CPLErr RasterIO(GDALRWFlag eRWFlag, int nXOff, int nYOff, int nXSize,
|
|
1709
|
+
int nYSize, void *pData, int nBufXSize, int nBufYSize,
|
|
1710
|
+
GDALDataType eBufType, GSpacing nPixelSpace,
|
|
1711
|
+
GSpacing nLineSpace,
|
|
1712
|
+
GDALRasterIOExtraArg *psExtraArg) CPL_WARN_UNUSED_RESULT;
|
|
1713
|
+
#endif
|
|
1714
|
+
|
|
1715
|
+
template <class T>
|
|
1716
|
+
CPLErr ReadRaster(T *pData, size_t nArrayEltCount = 0, double dfXOff = 0,
|
|
1717
|
+
double dfYOff = 0, double dfXSize = 0, double dfYSize = 0,
|
|
1718
|
+
size_t nBufXSize = 0, size_t nBufYSize = 0,
|
|
1719
|
+
GDALRIOResampleAlg eResampleAlg = GRIORA_NearestNeighbour,
|
|
1720
|
+
GDALProgressFunc pfnProgress = nullptr,
|
|
1721
|
+
void *pProgressData = nullptr) const;
|
|
1722
|
+
|
|
1723
|
+
template <class T>
|
|
1724
|
+
CPLErr ReadRaster(std::vector<T> &vData, double dfXOff = 0,
|
|
1725
|
+
double dfYOff = 0, double dfXSize = 0, double dfYSize = 0,
|
|
1726
|
+
size_t nBufXSize = 0, size_t nBufYSize = 0,
|
|
1727
|
+
GDALRIOResampleAlg eResampleAlg = GRIORA_NearestNeighbour,
|
|
1728
|
+
GDALProgressFunc pfnProgress = nullptr,
|
|
1729
|
+
void *pProgressData = nullptr) const;
|
|
1730
|
+
|
|
1731
|
+
#if __cplusplus >= 202002L
|
|
1732
|
+
//! @cond Doxygen_Suppress
|
|
1733
|
+
template <class T>
|
|
1734
|
+
inline CPLErr
|
|
1735
|
+
ReadRaster(std::span<T> pData, double dfXOff = 0, double dfYOff = 0,
|
|
1736
|
+
double dfXSize = 0, double dfYSize = 0, size_t nBufXSize = 0,
|
|
1737
|
+
size_t nBufYSize = 0,
|
|
1738
|
+
GDALRIOResampleAlg eResampleAlg = GRIORA_NearestNeighbour,
|
|
1739
|
+
GDALProgressFunc pfnProgress = nullptr,
|
|
1740
|
+
void *pProgressData = nullptr) const
|
|
1741
|
+
{
|
|
1742
|
+
return ReadRaster(pData.data(), pData.size(), dfXOff, dfYOff, dfXSize,
|
|
1743
|
+
dfYSize, nBufXSize, nBufYSize, eResampleAlg,
|
|
1744
|
+
pfnProgress, pProgressData);
|
|
1745
|
+
}
|
|
1746
|
+
|
|
1747
|
+
//! @endcond
|
|
1748
|
+
#endif
|
|
1749
|
+
|
|
1750
|
+
CPLErr ReadBlock(int nXBlockOff, int nYBlockOff,
|
|
1751
|
+
void *pImage) CPL_WARN_UNUSED_RESULT;
|
|
1752
|
+
|
|
1753
|
+
CPLErr WriteBlock(int nXBlockOff, int nYBlockOff,
|
|
1754
|
+
void *pImage) CPL_WARN_UNUSED_RESULT;
|
|
1755
|
+
|
|
1756
|
+
// This method should only be overloaded by GDALProxyRasterBand
|
|
1757
|
+
virtual GDALRasterBlock *
|
|
1758
|
+
GetLockedBlockRef(int nXBlockOff, int nYBlockOff,
|
|
1759
|
+
int bJustInitialize = FALSE) CPL_WARN_UNUSED_RESULT;
|
|
1760
|
+
|
|
1761
|
+
// This method should only be overloaded by GDALProxyRasterBand
|
|
1762
|
+
virtual GDALRasterBlock *
|
|
1763
|
+
TryGetLockedBlockRef(int nXBlockOff,
|
|
1764
|
+
int nYBlockYOff) CPL_WARN_UNUSED_RESULT;
|
|
1765
|
+
|
|
1766
|
+
// This method should only be overloaded by GDALProxyRasterBand
|
|
1767
|
+
virtual CPLErr FlushBlock(int nXBlockOff, int nYBlockOff,
|
|
1768
|
+
int bWriteDirtyBlock = TRUE);
|
|
1769
|
+
|
|
1770
|
+
unsigned char *
|
|
1771
|
+
GetIndexColorTranslationTo(/* const */ GDALRasterBand *poReferenceBand,
|
|
1772
|
+
unsigned char *pTranslationTable = nullptr,
|
|
1773
|
+
int *pApproximateMatching = nullptr);
|
|
1774
|
+
|
|
1775
|
+
// New OpengIS CV_SampleDimension stuff.
|
|
1776
|
+
|
|
1777
|
+
virtual CPLErr FlushCache(bool bAtClosing = false);
|
|
1778
|
+
virtual CPLErr DropCache();
|
|
1779
|
+
virtual char **GetCategoryNames();
|
|
1780
|
+
virtual double GetNoDataValue(int *pbSuccess = nullptr);
|
|
1781
|
+
virtual int64_t GetNoDataValueAsInt64(int *pbSuccess = nullptr);
|
|
1782
|
+
virtual uint64_t GetNoDataValueAsUInt64(int *pbSuccess = nullptr);
|
|
1783
|
+
virtual double GetMinimum(int *pbSuccess = nullptr);
|
|
1784
|
+
virtual double GetMaximum(int *pbSuccess = nullptr);
|
|
1785
|
+
virtual double GetOffset(int *pbSuccess = nullptr);
|
|
1786
|
+
virtual double GetScale(int *pbSuccess = nullptr);
|
|
1787
|
+
virtual const char *GetUnitType();
|
|
1788
|
+
virtual GDALColorInterp GetColorInterpretation();
|
|
1789
|
+
virtual GDALColorTable *GetColorTable();
|
|
1790
|
+
virtual CPLErr Fill(double dfRealValue, double dfImaginaryValue = 0);
|
|
1791
|
+
|
|
1792
|
+
virtual CPLErr SetCategoryNames(char **papszNames);
|
|
1793
|
+
virtual CPLErr SetNoDataValue(double dfNoData);
|
|
1794
|
+
virtual CPLErr SetNoDataValueAsInt64(int64_t nNoData);
|
|
1795
|
+
virtual CPLErr SetNoDataValueAsUInt64(uint64_t nNoData);
|
|
1796
|
+
virtual CPLErr DeleteNoDataValue();
|
|
1797
|
+
virtual CPLErr SetColorTable(GDALColorTable *poCT);
|
|
1798
|
+
virtual CPLErr SetColorInterpretation(GDALColorInterp eColorInterp);
|
|
1799
|
+
virtual CPLErr SetOffset(double dfNewOffset);
|
|
1800
|
+
virtual CPLErr SetScale(double dfNewScale);
|
|
1801
|
+
virtual CPLErr SetUnitType(const char *pszNewValue);
|
|
1802
|
+
|
|
1803
|
+
virtual CPLErr GetStatistics(int bApproxOK, int bForce, double *pdfMin,
|
|
1804
|
+
double *pdfMax, double *pdfMean,
|
|
1805
|
+
double *padfStdDev);
|
|
1806
|
+
virtual CPLErr ComputeStatistics(int bApproxOK, double *pdfMin,
|
|
1807
|
+
double *pdfMax, double *pdfMean,
|
|
1808
|
+
double *pdfStdDev, GDALProgressFunc,
|
|
1809
|
+
void *pProgressData);
|
|
1810
|
+
virtual CPLErr SetStatistics(double dfMin, double dfMax, double dfMean,
|
|
1811
|
+
double dfStdDev);
|
|
1812
|
+
virtual CPLErr ComputeRasterMinMax(int bApproxOK, double *adfMinMax);
|
|
1813
|
+
|
|
1814
|
+
// Only defined when Doxygen enabled
|
|
1815
|
+
#ifdef DOXYGEN_SKIP
|
|
1816
|
+
CPLErr SetMetadata(char **papszMetadata, const char *pszDomain) override;
|
|
1817
|
+
CPLErr SetMetadataItem(const char *pszName, const char *pszValue,
|
|
1818
|
+
const char *pszDomain) override;
|
|
1819
|
+
#endif
|
|
1820
|
+
virtual const char *GetMetadataItem(const char *pszName,
|
|
1821
|
+
const char *pszDomain = "") override;
|
|
1822
|
+
|
|
1823
|
+
virtual int HasArbitraryOverviews();
|
|
1824
|
+
virtual int GetOverviewCount();
|
|
1825
|
+
virtual GDALRasterBand *GetOverview(int i);
|
|
1826
|
+
virtual GDALRasterBand *GetRasterSampleOverview(GUIntBig);
|
|
1827
|
+
virtual CPLErr BuildOverviews(const char *pszResampling, int nOverviews,
|
|
1828
|
+
const int *panOverviewList,
|
|
1829
|
+
GDALProgressFunc pfnProgress,
|
|
1830
|
+
void *pProgressData,
|
|
1831
|
+
CSLConstList papszOptions);
|
|
1832
|
+
|
|
1833
|
+
virtual CPLErr AdviseRead(int nXOff, int nYOff, int nXSize, int nYSize,
|
|
1834
|
+
int nBufXSize, int nBufYSize,
|
|
1835
|
+
GDALDataType eBufType, char **papszOptions);
|
|
1836
|
+
|
|
1837
|
+
virtual CPLErr GetHistogram(double dfMin, double dfMax, int nBuckets,
|
|
1838
|
+
GUIntBig *panHistogram, int bIncludeOutOfRange,
|
|
1839
|
+
int bApproxOK, GDALProgressFunc,
|
|
1840
|
+
void *pProgressData);
|
|
1841
|
+
|
|
1842
|
+
virtual CPLErr GetDefaultHistogram(double *pdfMin, double *pdfMax,
|
|
1843
|
+
int *pnBuckets, GUIntBig **ppanHistogram,
|
|
1844
|
+
int bForce, GDALProgressFunc,
|
|
1845
|
+
void *pProgressData);
|
|
1846
|
+
virtual CPLErr SetDefaultHistogram(double dfMin, double dfMax, int nBuckets,
|
|
1847
|
+
GUIntBig *panHistogram);
|
|
1848
|
+
|
|
1849
|
+
virtual GDALRasterAttributeTable *GetDefaultRAT();
|
|
1850
|
+
virtual CPLErr SetDefaultRAT(const GDALRasterAttributeTable *poRAT);
|
|
1851
|
+
|
|
1852
|
+
virtual GDALRasterBand *GetMaskBand();
|
|
1853
|
+
virtual int GetMaskFlags();
|
|
1854
|
+
virtual CPLErr CreateMaskBand(int nFlagsIn);
|
|
1855
|
+
virtual bool IsMaskBand() const;
|
|
1856
|
+
virtual GDALMaskValueRange GetMaskValueRange() const;
|
|
1857
|
+
|
|
1858
|
+
virtual CPLVirtualMem *
|
|
1859
|
+
GetVirtualMemAuto(GDALRWFlag eRWFlag, int *pnPixelSpace,
|
|
1860
|
+
GIntBig *pnLineSpace,
|
|
1861
|
+
char **papszOptions) CPL_WARN_UNUSED_RESULT;
|
|
1862
|
+
|
|
1863
|
+
int GetDataCoverageStatus(int nXOff, int nYOff, int nXSize, int nYSize,
|
|
1864
|
+
int nMaskFlagStop = 0,
|
|
1865
|
+
double *pdfDataPct = nullptr);
|
|
1866
|
+
|
|
1867
|
+
std::shared_ptr<GDALMDArray> AsMDArray() const;
|
|
1868
|
+
|
|
1869
|
+
virtual CPLErr InterpolateAtPoint(double dfPixel, double dfLine,
|
|
1870
|
+
GDALRIOResampleAlg eInterpolation,
|
|
1871
|
+
double *pdfRealValue,
|
|
1872
|
+
double *pdfImagValue = nullptr) const;
|
|
1873
|
+
|
|
1874
|
+
#ifndef DOXYGEN_XML
|
|
1875
|
+
void ReportError(CPLErr eErrClass, CPLErrorNum err_no, const char *fmt,
|
|
1876
|
+
...) const CPL_PRINT_FUNC_FORMAT(4, 5);
|
|
1877
|
+
#endif
|
|
1878
|
+
|
|
1879
|
+
/** Convert a GDALRasterBand* to a GDALRasterBandH.
|
|
1880
|
+
* @since GDAL 2.3
|
|
1881
|
+
*/
|
|
1882
|
+
static inline GDALRasterBandH ToHandle(GDALRasterBand *poBand)
|
|
1883
|
+
{
|
|
1884
|
+
return static_cast<GDALRasterBandH>(poBand);
|
|
1885
|
+
}
|
|
1886
|
+
|
|
1887
|
+
/** Convert a GDALRasterBandH to a GDALRasterBand*.
|
|
1888
|
+
* @since GDAL 2.3
|
|
1889
|
+
*/
|
|
1890
|
+
static inline GDALRasterBand *FromHandle(GDALRasterBandH hBand)
|
|
1891
|
+
{
|
|
1892
|
+
return static_cast<GDALRasterBand *>(hBand);
|
|
1893
|
+
}
|
|
1894
|
+
|
|
1895
|
+
//! @cond Doxygen_Suppress
|
|
1896
|
+
// Remove me in GDAL 4.0. See GetMetadataItem() implementation
|
|
1897
|
+
// Internal use in GDAL only !
|
|
1898
|
+
virtual void EnablePixelTypeSignedByteWarning(bool b)
|
|
1899
|
+
#ifndef GDAL_COMPILATION
|
|
1900
|
+
CPL_WARN_DEPRECATED("Do not use that method outside of GDAL!")
|
|
1901
|
+
#endif
|
|
1902
|
+
;
|
|
1903
|
+
|
|
1904
|
+
//! @endcond
|
|
1905
|
+
|
|
1906
|
+
private:
|
|
1907
|
+
CPL_DISALLOW_COPY_ASSIGN(GDALRasterBand)
|
|
1908
|
+
};
|
|
1909
|
+
|
|
1910
|
+
//! @cond Doxygen_Suppress
|
|
1911
|
+
#define GDAL_EXTERN_TEMPLATE_READ_RASTER(T) \
|
|
1912
|
+
extern template CPLErr GDALRasterBand::ReadRaster<T>( \
|
|
1913
|
+
T * pData, size_t nArrayEltCount, double dfXOff, double dfYOff, \
|
|
1914
|
+
double dfXSize, double dfYSize, size_t nBufXSize, size_t nBufYSize, \
|
|
1915
|
+
GDALRIOResampleAlg eResampleAlg, GDALProgressFunc pfnProgress, \
|
|
1916
|
+
void *pProgressData) const;
|
|
1917
|
+
|
|
1918
|
+
GDAL_EXTERN_TEMPLATE_READ_RASTER(uint8_t)
|
|
1919
|
+
GDAL_EXTERN_TEMPLATE_READ_RASTER(int8_t)
|
|
1920
|
+
GDAL_EXTERN_TEMPLATE_READ_RASTER(uint16_t)
|
|
1921
|
+
GDAL_EXTERN_TEMPLATE_READ_RASTER(int16_t)
|
|
1922
|
+
GDAL_EXTERN_TEMPLATE_READ_RASTER(uint32_t)
|
|
1923
|
+
GDAL_EXTERN_TEMPLATE_READ_RASTER(int32_t)
|
|
1924
|
+
GDAL_EXTERN_TEMPLATE_READ_RASTER(uint64_t)
|
|
1925
|
+
GDAL_EXTERN_TEMPLATE_READ_RASTER(int64_t)
|
|
1926
|
+
GDAL_EXTERN_TEMPLATE_READ_RASTER(float)
|
|
1927
|
+
GDAL_EXTERN_TEMPLATE_READ_RASTER(double)
|
|
1928
|
+
// Not allowed by C++ standard
|
|
1929
|
+
// GDAL_EXTERN_TEMPLATE_READ_RASTER(std::complex<int16_t>)
|
|
1930
|
+
// GDAL_EXTERN_TEMPLATE_READ_RASTER(std::complex<int32_t>)
|
|
1931
|
+
GDAL_EXTERN_TEMPLATE_READ_RASTER(std::complex<float>)
|
|
1932
|
+
GDAL_EXTERN_TEMPLATE_READ_RASTER(std::complex<double>)
|
|
1933
|
+
|
|
1934
|
+
#define GDAL_EXTERN_TEMPLATE_READ_RASTER_VECTOR(T) \
|
|
1935
|
+
extern template CPLErr GDALRasterBand::ReadRaster<T>( \
|
|
1936
|
+
std::vector<T> & vData, double dfXOff, double dfYOff, double dfXSize, \
|
|
1937
|
+
double dfYSize, size_t nBufXSize, size_t nBufYSize, \
|
|
1938
|
+
GDALRIOResampleAlg eResampleAlg, GDALProgressFunc pfnProgress, \
|
|
1939
|
+
void *pProgressData) const;
|
|
1940
|
+
|
|
1941
|
+
GDAL_EXTERN_TEMPLATE_READ_RASTER_VECTOR(uint8_t)
|
|
1942
|
+
GDAL_EXTERN_TEMPLATE_READ_RASTER_VECTOR(int8_t)
|
|
1943
|
+
GDAL_EXTERN_TEMPLATE_READ_RASTER_VECTOR(uint16_t)
|
|
1944
|
+
GDAL_EXTERN_TEMPLATE_READ_RASTER_VECTOR(int16_t)
|
|
1945
|
+
GDAL_EXTERN_TEMPLATE_READ_RASTER_VECTOR(uint32_t)
|
|
1946
|
+
GDAL_EXTERN_TEMPLATE_READ_RASTER_VECTOR(int32_t)
|
|
1947
|
+
GDAL_EXTERN_TEMPLATE_READ_RASTER_VECTOR(uint64_t)
|
|
1948
|
+
GDAL_EXTERN_TEMPLATE_READ_RASTER_VECTOR(int64_t)
|
|
1949
|
+
GDAL_EXTERN_TEMPLATE_READ_RASTER_VECTOR(float)
|
|
1950
|
+
GDAL_EXTERN_TEMPLATE_READ_RASTER_VECTOR(double)
|
|
1951
|
+
// Not allowed by C++ standard
|
|
1952
|
+
// GDAL_EXTERN_TEMPLATE_READ_RASTER_VECTOR(std::complex<int16_t>)
|
|
1953
|
+
// GDAL_EXTERN_TEMPLATE_READ_RASTER_VECTOR(std::complex<int32_t>)
|
|
1954
|
+
GDAL_EXTERN_TEMPLATE_READ_RASTER_VECTOR(std::complex<float>)
|
|
1955
|
+
GDAL_EXTERN_TEMPLATE_READ_RASTER_VECTOR(std::complex<double>)
|
|
1956
|
+
|
|
1957
|
+
//! @endcond
|
|
1958
|
+
|
|
1959
|
+
//! @cond Doxygen_Suppress
|
|
1960
|
+
/* ******************************************************************** */
|
|
1961
|
+
/* GDALAllValidMaskBand */
|
|
1962
|
+
/* ******************************************************************** */
|
|
1963
|
+
|
|
1964
|
+
class CPL_DLL GDALAllValidMaskBand : public GDALRasterBand
|
|
1965
|
+
{
|
|
1966
|
+
protected:
|
|
1967
|
+
CPLErr IReadBlock(int, int, void *) override;
|
|
1968
|
+
|
|
1969
|
+
CPL_DISALLOW_COPY_ASSIGN(GDALAllValidMaskBand)
|
|
1970
|
+
|
|
1971
|
+
public:
|
|
1972
|
+
explicit GDALAllValidMaskBand(GDALRasterBand *);
|
|
1973
|
+
~GDALAllValidMaskBand() override;
|
|
1974
|
+
|
|
1975
|
+
GDALRasterBand *GetMaskBand() override;
|
|
1976
|
+
int GetMaskFlags() override;
|
|
1977
|
+
|
|
1978
|
+
bool IsMaskBand() const override
|
|
1979
|
+
{
|
|
1980
|
+
return true;
|
|
1981
|
+
}
|
|
1982
|
+
|
|
1983
|
+
GDALMaskValueRange GetMaskValueRange() const override
|
|
1984
|
+
{
|
|
1985
|
+
return GMVR_0_AND_255_ONLY;
|
|
1986
|
+
}
|
|
1987
|
+
|
|
1988
|
+
CPLErr ComputeStatistics(int bApproxOK, double *pdfMin, double *pdfMax,
|
|
1989
|
+
double *pdfMean, double *pdfStdDev,
|
|
1990
|
+
GDALProgressFunc, void *pProgressData) override;
|
|
1991
|
+
};
|
|
1992
|
+
|
|
1993
|
+
/* ******************************************************************** */
|
|
1994
|
+
/* GDALNoDataMaskBand */
|
|
1995
|
+
/* ******************************************************************** */
|
|
1996
|
+
|
|
1997
|
+
class CPL_DLL GDALNoDataMaskBand : public GDALRasterBand
|
|
1998
|
+
{
|
|
1999
|
+
friend class GDALRasterBand;
|
|
2000
|
+
double m_dfNoDataValue = 0;
|
|
2001
|
+
int64_t m_nNoDataValueInt64 = 0;
|
|
2002
|
+
uint64_t m_nNoDataValueUInt64 = 0;
|
|
2003
|
+
GDALRasterBand *m_poParent = nullptr;
|
|
2004
|
+
|
|
2005
|
+
CPL_DISALLOW_COPY_ASSIGN(GDALNoDataMaskBand)
|
|
2006
|
+
|
|
2007
|
+
protected:
|
|
2008
|
+
CPLErr IReadBlock(int, int, void *) override;
|
|
2009
|
+
CPLErr IRasterIO(GDALRWFlag, int, int, int, int, void *, int, int,
|
|
2010
|
+
GDALDataType, GSpacing, GSpacing,
|
|
2011
|
+
GDALRasterIOExtraArg *psExtraArg) override;
|
|
2012
|
+
|
|
2013
|
+
public:
|
|
2014
|
+
explicit GDALNoDataMaskBand(GDALRasterBand *);
|
|
2015
|
+
explicit GDALNoDataMaskBand(GDALRasterBand *, double dfNoDataValue);
|
|
2016
|
+
~GDALNoDataMaskBand() override;
|
|
2017
|
+
|
|
2018
|
+
bool IsMaskBand() const override
|
|
2019
|
+
{
|
|
2020
|
+
return true;
|
|
2021
|
+
}
|
|
2022
|
+
|
|
2023
|
+
GDALMaskValueRange GetMaskValueRange() const override
|
|
2024
|
+
{
|
|
2025
|
+
return GMVR_0_AND_255_ONLY;
|
|
2026
|
+
}
|
|
2027
|
+
|
|
2028
|
+
static bool IsNoDataInRange(double dfNoDataValue, GDALDataType eDataType);
|
|
2029
|
+
};
|
|
2030
|
+
|
|
2031
|
+
/* ******************************************************************** */
|
|
2032
|
+
/* GDALNoDataValuesMaskBand */
|
|
2033
|
+
/* ******************************************************************** */
|
|
2034
|
+
|
|
2035
|
+
class CPL_DLL GDALNoDataValuesMaskBand : public GDALRasterBand
|
|
2036
|
+
{
|
|
2037
|
+
double *padfNodataValues;
|
|
2038
|
+
|
|
2039
|
+
CPL_DISALLOW_COPY_ASSIGN(GDALNoDataValuesMaskBand)
|
|
2040
|
+
|
|
2041
|
+
protected:
|
|
2042
|
+
CPLErr IReadBlock(int, int, void *) override;
|
|
2043
|
+
|
|
2044
|
+
public:
|
|
2045
|
+
explicit GDALNoDataValuesMaskBand(GDALDataset *);
|
|
2046
|
+
~GDALNoDataValuesMaskBand() override;
|
|
2047
|
+
|
|
2048
|
+
bool IsMaskBand() const override
|
|
2049
|
+
{
|
|
2050
|
+
return true;
|
|
2051
|
+
}
|
|
2052
|
+
|
|
2053
|
+
GDALMaskValueRange GetMaskValueRange() const override
|
|
2054
|
+
{
|
|
2055
|
+
return GMVR_0_AND_255_ONLY;
|
|
2056
|
+
}
|
|
2057
|
+
};
|
|
2058
|
+
|
|
2059
|
+
/* ******************************************************************** */
|
|
2060
|
+
/* GDALRescaledAlphaBand */
|
|
2061
|
+
/* ******************************************************************** */
|
|
2062
|
+
|
|
2063
|
+
class GDALRescaledAlphaBand : public GDALRasterBand
|
|
2064
|
+
{
|
|
2065
|
+
GDALRasterBand *poParent;
|
|
2066
|
+
void *pTemp;
|
|
2067
|
+
|
|
2068
|
+
CPL_DISALLOW_COPY_ASSIGN(GDALRescaledAlphaBand)
|
|
2069
|
+
|
|
2070
|
+
protected:
|
|
2071
|
+
CPLErr IReadBlock(int, int, void *) override;
|
|
2072
|
+
CPLErr IRasterIO(GDALRWFlag, int, int, int, int, void *, int, int,
|
|
2073
|
+
GDALDataType, GSpacing, GSpacing,
|
|
2074
|
+
GDALRasterIOExtraArg *psExtraArg) override;
|
|
2075
|
+
|
|
2076
|
+
public:
|
|
2077
|
+
explicit GDALRescaledAlphaBand(GDALRasterBand *);
|
|
2078
|
+
~GDALRescaledAlphaBand() override;
|
|
2079
|
+
|
|
2080
|
+
bool IsMaskBand() const override
|
|
2081
|
+
{
|
|
2082
|
+
return true;
|
|
2083
|
+
}
|
|
2084
|
+
};
|
|
2085
|
+
|
|
2086
|
+
//! @endcond
|
|
2087
|
+
|
|
2088
|
+
/* ******************************************************************** */
|
|
2089
|
+
/* GDALIdentifyEnum */
|
|
2090
|
+
/* ******************************************************************** */
|
|
2091
|
+
|
|
2092
|
+
/**
|
|
2093
|
+
* Enumeration used by GDALDriver::pfnIdentify().
|
|
2094
|
+
*
|
|
2095
|
+
* @since GDAL 2.1
|
|
2096
|
+
*/
|
|
2097
|
+
typedef enum
|
|
2098
|
+
{
|
|
2099
|
+
/** Identify could not determine if the file is recognized or not by the
|
|
2100
|
+
probed driver. */
|
|
2101
|
+
GDAL_IDENTIFY_UNKNOWN = -1,
|
|
2102
|
+
/** Identify determined the file is not recognized by the probed driver. */
|
|
2103
|
+
GDAL_IDENTIFY_FALSE = 0,
|
|
2104
|
+
/** Identify determined the file is recognized by the probed driver. */
|
|
2105
|
+
GDAL_IDENTIFY_TRUE = 1
|
|
2106
|
+
} GDALIdentifyEnum;
|
|
2107
|
+
|
|
2108
|
+
/* ******************************************************************** */
|
|
2109
|
+
/* GDALDriver */
|
|
2110
|
+
/* ******************************************************************** */
|
|
2111
|
+
|
|
2112
|
+
/**
|
|
2113
|
+
* \brief Format specific driver.
|
|
2114
|
+
*
|
|
2115
|
+
* An instance of this class is created for each supported format, and
|
|
2116
|
+
* manages information about the format.
|
|
2117
|
+
*
|
|
2118
|
+
* This roughly corresponds to a file format, though some
|
|
2119
|
+
* drivers may be gateways to many formats through a secondary
|
|
2120
|
+
* multi-library.
|
|
2121
|
+
*/
|
|
2122
|
+
|
|
2123
|
+
class CPL_DLL GDALDriver : public GDALMajorObject
|
|
2124
|
+
{
|
|
2125
|
+
public:
|
|
2126
|
+
GDALDriver();
|
|
2127
|
+
~GDALDriver() override;
|
|
2128
|
+
|
|
2129
|
+
CPLErr SetMetadataItem(const char *pszName, const char *pszValue,
|
|
2130
|
+
const char *pszDomain = "") override;
|
|
2131
|
+
|
|
2132
|
+
/* -------------------------------------------------------------------- */
|
|
2133
|
+
/* Public C++ methods. */
|
|
2134
|
+
/* -------------------------------------------------------------------- */
|
|
2135
|
+
GDALDataset *Create(const char *pszName, int nXSize, int nYSize, int nBands,
|
|
2136
|
+
GDALDataType eType,
|
|
2137
|
+
CSLConstList papszOptions) CPL_WARN_UNUSED_RESULT;
|
|
2138
|
+
|
|
2139
|
+
GDALDataset *
|
|
2140
|
+
CreateMultiDimensional(const char *pszName,
|
|
2141
|
+
CSLConstList papszRootGroupOptions,
|
|
2142
|
+
CSLConstList papszOptions) CPL_WARN_UNUSED_RESULT;
|
|
2143
|
+
|
|
2144
|
+
CPLErr Delete(const char *pszName);
|
|
2145
|
+
CPLErr Rename(const char *pszNewName, const char *pszOldName);
|
|
2146
|
+
CPLErr CopyFiles(const char *pszNewName, const char *pszOldName);
|
|
2147
|
+
|
|
2148
|
+
GDALDataset *CreateCopy(const char *, GDALDataset *, int,
|
|
2149
|
+
CSLConstList papszOptions,
|
|
2150
|
+
GDALProgressFunc pfnProgress,
|
|
2151
|
+
void *pProgressData) CPL_WARN_UNUSED_RESULT;
|
|
2152
|
+
|
|
2153
|
+
bool CanVectorTranslateFrom(const char *pszDestName,
|
|
2154
|
+
GDALDataset *poSourceDS,
|
|
2155
|
+
CSLConstList papszVectorTranslateArguments,
|
|
2156
|
+
char ***ppapszFailureReasons);
|
|
2157
|
+
|
|
2158
|
+
GDALDataset *
|
|
2159
|
+
VectorTranslateFrom(const char *pszDestName, GDALDataset *poSourceDS,
|
|
2160
|
+
CSLConstList papszVectorTranslateArguments,
|
|
2161
|
+
GDALProgressFunc pfnProgress,
|
|
2162
|
+
void *pProgressData) CPL_WARN_UNUSED_RESULT;
|
|
2163
|
+
|
|
2164
|
+
/* -------------------------------------------------------------------- */
|
|
2165
|
+
/* The following are semiprivate, not intended to be accessed */
|
|
2166
|
+
/* by anyone but the formats instantiating and populating the */
|
|
2167
|
+
/* drivers. */
|
|
2168
|
+
/* -------------------------------------------------------------------- */
|
|
2169
|
+
//! @cond Doxygen_Suppress
|
|
2170
|
+
|
|
2171
|
+
// Not aimed at being used outside of GDAL. Use GDALDataset::Open() instead
|
|
2172
|
+
GDALDataset *Open(GDALOpenInfo *poOpenInfo, bool bSetOpenOptions);
|
|
2173
|
+
|
|
2174
|
+
typedef GDALDataset *(*OpenCallback)(GDALOpenInfo *);
|
|
2175
|
+
|
|
2176
|
+
OpenCallback pfnOpen = nullptr;
|
|
2177
|
+
|
|
2178
|
+
virtual OpenCallback GetOpenCallback()
|
|
2179
|
+
{
|
|
2180
|
+
return pfnOpen;
|
|
2181
|
+
}
|
|
2182
|
+
|
|
2183
|
+
typedef GDALDataset *(*CreateCallback)(const char *pszName, int nXSize,
|
|
2184
|
+
int nYSize, int nBands,
|
|
2185
|
+
GDALDataType eType,
|
|
2186
|
+
char **papszOptions);
|
|
2187
|
+
|
|
2188
|
+
CreateCallback pfnCreate = nullptr;
|
|
2189
|
+
|
|
2190
|
+
virtual CreateCallback GetCreateCallback()
|
|
2191
|
+
{
|
|
2192
|
+
return pfnCreate;
|
|
2193
|
+
}
|
|
2194
|
+
|
|
2195
|
+
GDALDataset *(*pfnCreateEx)(GDALDriver *, const char *pszName, int nXSize,
|
|
2196
|
+
int nYSize, int nBands, GDALDataType eType,
|
|
2197
|
+
char **papszOptions) = nullptr;
|
|
2198
|
+
|
|
2199
|
+
typedef GDALDataset *(*CreateMultiDimensionalCallback)(
|
|
2200
|
+
const char *pszName, CSLConstList papszRootGroupOptions,
|
|
2201
|
+
CSLConstList papszOptions);
|
|
2202
|
+
|
|
2203
|
+
CreateMultiDimensionalCallback pfnCreateMultiDimensional = nullptr;
|
|
2204
|
+
|
|
2205
|
+
virtual CreateMultiDimensionalCallback GetCreateMultiDimensionalCallback()
|
|
2206
|
+
{
|
|
2207
|
+
return pfnCreateMultiDimensional;
|
|
2208
|
+
}
|
|
2209
|
+
|
|
2210
|
+
typedef CPLErr (*DeleteCallback)(const char *pszName);
|
|
2211
|
+
DeleteCallback pfnDelete = nullptr;
|
|
2212
|
+
|
|
2213
|
+
virtual DeleteCallback GetDeleteCallback()
|
|
2214
|
+
{
|
|
2215
|
+
return pfnDelete;
|
|
2216
|
+
}
|
|
2217
|
+
|
|
2218
|
+
typedef GDALDataset *(*CreateCopyCallback)(const char *, GDALDataset *, int,
|
|
2219
|
+
char **,
|
|
2220
|
+
GDALProgressFunc pfnProgress,
|
|
2221
|
+
void *pProgressData);
|
|
2222
|
+
|
|
2223
|
+
CreateCopyCallback pfnCreateCopy = nullptr;
|
|
2224
|
+
|
|
2225
|
+
virtual CreateCopyCallback GetCreateCopyCallback()
|
|
2226
|
+
{
|
|
2227
|
+
return pfnCreateCopy;
|
|
2228
|
+
}
|
|
2229
|
+
|
|
2230
|
+
void *pDriverData = nullptr;
|
|
2231
|
+
|
|
2232
|
+
void (*pfnUnloadDriver)(GDALDriver *) = nullptr;
|
|
2233
|
+
|
|
2234
|
+
/** Identify() if the file is recognized or not by the driver.
|
|
2235
|
+
|
|
2236
|
+
Return GDAL_IDENTIFY_TRUE (1) if the passed file is certainly recognized
|
|
2237
|
+
by the driver. Return GDAL_IDENTIFY_FALSE (0) if the passed file is
|
|
2238
|
+
certainly NOT recognized by the driver. Return GDAL_IDENTIFY_UNKNOWN (-1)
|
|
2239
|
+
if the passed file may be or may not be recognized by the driver, and
|
|
2240
|
+
that a potentially costly test must be done with pfnOpen.
|
|
2241
|
+
*/
|
|
2242
|
+
int (*pfnIdentify)(GDALOpenInfo *) = nullptr;
|
|
2243
|
+
int (*pfnIdentifyEx)(GDALDriver *, GDALOpenInfo *) = nullptr;
|
|
2244
|
+
|
|
2245
|
+
typedef CPLErr (*RenameCallback)(const char *pszNewName,
|
|
2246
|
+
const char *pszOldName);
|
|
2247
|
+
RenameCallback pfnRename = nullptr;
|
|
2248
|
+
|
|
2249
|
+
virtual RenameCallback GetRenameCallback()
|
|
2250
|
+
{
|
|
2251
|
+
return pfnRename;
|
|
2252
|
+
}
|
|
2253
|
+
|
|
2254
|
+
typedef CPLErr (*CopyFilesCallback)(const char *pszNewName,
|
|
2255
|
+
const char *pszOldName);
|
|
2256
|
+
CopyFilesCallback pfnCopyFiles = nullptr;
|
|
2257
|
+
|
|
2258
|
+
virtual CopyFilesCallback GetCopyFilesCallback()
|
|
2259
|
+
{
|
|
2260
|
+
return pfnCopyFiles;
|
|
2261
|
+
}
|
|
2262
|
+
|
|
2263
|
+
// Used for legacy OGR drivers, and Python drivers
|
|
2264
|
+
GDALDataset *(*pfnOpenWithDriverArg)(GDALDriver *,
|
|
2265
|
+
GDALOpenInfo *) = nullptr;
|
|
2266
|
+
|
|
2267
|
+
/* For legacy OGR drivers */
|
|
2268
|
+
GDALDataset *(*pfnCreateVectorOnly)(GDALDriver *, const char *pszName,
|
|
2269
|
+
char **papszOptions) = nullptr;
|
|
2270
|
+
CPLErr (*pfnDeleteDataSource)(GDALDriver *, const char *pszName) = nullptr;
|
|
2271
|
+
|
|
2272
|
+
/** Whether pfnVectorTranslateFrom() can be run given the source dataset
|
|
2273
|
+
* and the non-positional arguments of GDALVectorTranslate() stored
|
|
2274
|
+
* in papszVectorTranslateArguments.
|
|
2275
|
+
*/
|
|
2276
|
+
bool (*pfnCanVectorTranslateFrom)(
|
|
2277
|
+
const char *pszDestName, GDALDataset *poSourceDS,
|
|
2278
|
+
CSLConstList papszVectorTranslateArguments,
|
|
2279
|
+
char ***ppapszFailureReasons) = nullptr;
|
|
2280
|
+
|
|
2281
|
+
/** Creates a copy from the specified source dataset, using the
|
|
2282
|
+
* non-positional arguments of GDALVectorTranslate() stored
|
|
2283
|
+
* in papszVectorTranslateArguments.
|
|
2284
|
+
*/
|
|
2285
|
+
GDALDataset *(*pfnVectorTranslateFrom)(
|
|
2286
|
+
const char *pszDestName, GDALDataset *poSourceDS,
|
|
2287
|
+
CSLConstList papszVectorTranslateArguments,
|
|
2288
|
+
GDALProgressFunc pfnProgress, void *pProgressData) = nullptr;
|
|
2289
|
+
|
|
2290
|
+
/**
|
|
2291
|
+
* Returns a (possibly null) pointer to the Subdataset informational function
|
|
2292
|
+
* from the subdataset file name.
|
|
2293
|
+
*/
|
|
2294
|
+
GDALSubdatasetInfo *(*pfnGetSubdatasetInfoFunc)(const char *pszFileName) =
|
|
2295
|
+
nullptr;
|
|
2296
|
+
|
|
2297
|
+
//! @endcond
|
|
2298
|
+
|
|
2299
|
+
/* -------------------------------------------------------------------- */
|
|
2300
|
+
/* Helper methods. */
|
|
2301
|
+
/* -------------------------------------------------------------------- */
|
|
2302
|
+
//! @cond Doxygen_Suppress
|
|
2303
|
+
GDALDataset *DefaultCreateCopy(const char *, GDALDataset *, int,
|
|
2304
|
+
CSLConstList papszOptions,
|
|
2305
|
+
GDALProgressFunc pfnProgress,
|
|
2306
|
+
void *pProgressData) CPL_WARN_UNUSED_RESULT;
|
|
2307
|
+
|
|
2308
|
+
static CPLErr DefaultCreateCopyMultiDimensional(
|
|
2309
|
+
GDALDataset *poSrcDS, GDALDataset *poDstDS, bool bStrict,
|
|
2310
|
+
CSLConstList /*papszOptions*/, GDALProgressFunc pfnProgress,
|
|
2311
|
+
void *pProgressData);
|
|
2312
|
+
|
|
2313
|
+
static CPLErr DefaultCopyMasks(GDALDataset *poSrcDS, GDALDataset *poDstDS,
|
|
2314
|
+
int bStrict);
|
|
2315
|
+
static CPLErr DefaultCopyMasks(GDALDataset *poSrcDS, GDALDataset *poDstDS,
|
|
2316
|
+
int bStrict, CSLConstList papszOptions,
|
|
2317
|
+
GDALProgressFunc pfnProgress,
|
|
2318
|
+
void *pProgressData);
|
|
2319
|
+
|
|
2320
|
+
CPLErr QuietDeleteForCreateCopy(const char *pszFilename,
|
|
2321
|
+
GDALDataset *poSrcDS);
|
|
2322
|
+
|
|
2323
|
+
//! @endcond
|
|
2324
|
+
static CPLErr QuietDelete(const char *pszName,
|
|
2325
|
+
CSLConstList papszAllowedDrivers = nullptr);
|
|
2326
|
+
|
|
2327
|
+
//! @cond Doxygen_Suppress
|
|
2328
|
+
static CPLErr DefaultRename(const char *pszNewName, const char *pszOldName);
|
|
2329
|
+
static CPLErr DefaultCopyFiles(const char *pszNewName,
|
|
2330
|
+
const char *pszOldName);
|
|
2331
|
+
static void DefaultCopyMetadata(GDALDataset *poSrcDS, GDALDataset *poDstDS,
|
|
2332
|
+
CSLConstList papszOptions,
|
|
2333
|
+
CSLConstList papszExcludedDomains);
|
|
2334
|
+
|
|
2335
|
+
//! @endcond
|
|
2336
|
+
|
|
2337
|
+
/** Convert a GDALDriver* to a GDALDriverH.
|
|
2338
|
+
* @since GDAL 2.3
|
|
2339
|
+
*/
|
|
2340
|
+
static inline GDALDriverH ToHandle(GDALDriver *poDriver)
|
|
2341
|
+
{
|
|
2342
|
+
return static_cast<GDALDriverH>(poDriver);
|
|
2343
|
+
}
|
|
2344
|
+
|
|
2345
|
+
/** Convert a GDALDriverH to a GDALDriver*.
|
|
2346
|
+
* @since GDAL 2.3
|
|
2347
|
+
*/
|
|
2348
|
+
static inline GDALDriver *FromHandle(GDALDriverH hDriver)
|
|
2349
|
+
{
|
|
2350
|
+
return static_cast<GDALDriver *>(hDriver);
|
|
2351
|
+
}
|
|
2352
|
+
|
|
2353
|
+
private:
|
|
2354
|
+
CPL_DISALLOW_COPY_ASSIGN(GDALDriver)
|
|
2355
|
+
};
|
|
2356
|
+
|
|
2357
|
+
/************************************************************************/
|
|
2358
|
+
/* GDALPluginDriverProxy */
|
|
2359
|
+
/************************************************************************/
|
|
2360
|
+
|
|
2361
|
+
// clang-format off
|
|
2362
|
+
/** Proxy for a plugin driver.
|
|
2363
|
+
*
|
|
2364
|
+
* Such proxy must be registered with
|
|
2365
|
+
* GDALDriverManager::DeclareDeferredPluginDriver().
|
|
2366
|
+
*
|
|
2367
|
+
* If the real driver defines any of the following metadata items, the
|
|
2368
|
+
* proxy driver should also define them with the same value:
|
|
2369
|
+
* <ul>
|
|
2370
|
+
* <li>GDAL_DMD_LONGNAME</li>
|
|
2371
|
+
* <li>GDAL_DMD_EXTENSIONS</li>
|
|
2372
|
+
* <li>GDAL_DMD_EXTENSION</li>
|
|
2373
|
+
* <li>GDAL_DMD_OPENOPTIONLIST</li>
|
|
2374
|
+
* <li>GDAL_DMD_SUBDATASETS</li>
|
|
2375
|
+
* <li>GDAL_DMD_CONNECTION_PREFIX</li>
|
|
2376
|
+
* <li>GDAL_DCAP_RASTER</li>
|
|
2377
|
+
* <li>GDAL_DCAP_MULTIDIM_RASTER</li>
|
|
2378
|
+
* <li>GDAL_DCAP_VECTOR</li>
|
|
2379
|
+
* <li>GDAL_DCAP_GNM</li>
|
|
2380
|
+
* <li>GDAL_DCAP_MULTIPLE_VECTOR_LAYERS</li>
|
|
2381
|
+
* <li>GDAL_DCAP_NONSPATIAL</li>
|
|
2382
|
+
* <li>GDAL_DCAP_VECTOR_TRANSLATE_FROM</li>
|
|
2383
|
+
* </ul>
|
|
2384
|
+
*
|
|
2385
|
+
* The pfnIdentify and pfnGetSubdatasetInfoFunc callbacks, if they are
|
|
2386
|
+
* defined in the real driver, should also be set on the proxy driver.
|
|
2387
|
+
*
|
|
2388
|
+
* Furthermore, the following metadata items must be defined if the real
|
|
2389
|
+
* driver sets the corresponding callback:
|
|
2390
|
+
* <ul>
|
|
2391
|
+
* <li>GDAL_DCAP_OPEN: must be set to YES if the real driver defines pfnOpen</li>
|
|
2392
|
+
* <li>GDAL_DCAP_CREATE: must be set to YES if the real driver defines pfnCreate</li>
|
|
2393
|
+
* <li>GDAL_DCAP_CREATE_MULTIDIMENSIONAL: must be set to YES if the real driver defines pfnCreateMultiDimensional</li>
|
|
2394
|
+
* <li>GDAL_DCAP_CREATECOPY: must be set to YES if the real driver defines pfnCreateCopy</li>
|
|
2395
|
+
* </ul>
|
|
2396
|
+
*
|
|
2397
|
+
* @since 3.9
|
|
2398
|
+
*/
|
|
2399
|
+
// clang-format on
|
|
2400
|
+
|
|
2401
|
+
class GDALPluginDriverProxy : public GDALDriver
|
|
2402
|
+
{
|
|
2403
|
+
const std::string m_osPluginFileName;
|
|
2404
|
+
std::string m_osPluginFullPath{};
|
|
2405
|
+
std::unique_ptr<GDALDriver> m_poRealDriver{};
|
|
2406
|
+
std::set<std::string> m_oSetMetadataItems{};
|
|
2407
|
+
|
|
2408
|
+
GDALDriver *GetRealDriver();
|
|
2409
|
+
|
|
2410
|
+
CPL_DISALLOW_COPY_ASSIGN(GDALPluginDriverProxy)
|
|
2411
|
+
|
|
2412
|
+
protected:
|
|
2413
|
+
friend class GDALDriverManager;
|
|
2414
|
+
|
|
2415
|
+
//! @cond Doxygen_Suppress
|
|
2416
|
+
void SetPluginFullPath(const std::string &osFullPath)
|
|
2417
|
+
{
|
|
2418
|
+
m_osPluginFullPath = osFullPath;
|
|
2419
|
+
}
|
|
2420
|
+
|
|
2421
|
+
//! @endcond
|
|
2422
|
+
|
|
2423
|
+
public:
|
|
2424
|
+
explicit GDALPluginDriverProxy(const std::string &osPluginFileName);
|
|
2425
|
+
|
|
2426
|
+
/** Return the plugin file name (not a full path) */
|
|
2427
|
+
const std::string &GetPluginFileName() const
|
|
2428
|
+
{
|
|
2429
|
+
return m_osPluginFileName;
|
|
2430
|
+
}
|
|
2431
|
+
|
|
2432
|
+
//! @cond Doxygen_Suppress
|
|
2433
|
+
OpenCallback GetOpenCallback() override;
|
|
2434
|
+
|
|
2435
|
+
CreateCallback GetCreateCallback() override;
|
|
2436
|
+
|
|
2437
|
+
CreateMultiDimensionalCallback GetCreateMultiDimensionalCallback() override;
|
|
2438
|
+
|
|
2439
|
+
CreateCopyCallback GetCreateCopyCallback() override;
|
|
2440
|
+
|
|
2441
|
+
DeleteCallback GetDeleteCallback() override;
|
|
2442
|
+
|
|
2443
|
+
RenameCallback GetRenameCallback() override;
|
|
2444
|
+
|
|
2445
|
+
CopyFilesCallback GetCopyFilesCallback() override;
|
|
2446
|
+
//! @endcond
|
|
2447
|
+
|
|
2448
|
+
CPLErr SetMetadataItem(const char *pszName, const char *pszValue,
|
|
2449
|
+
const char *pszDomain = "") override;
|
|
2450
|
+
|
|
2451
|
+
char **GetMetadata(const char *pszDomain) override;
|
|
2452
|
+
|
|
2453
|
+
const char *GetMetadataItem(const char *pszName,
|
|
2454
|
+
const char *pszDomain = "") override;
|
|
2455
|
+
};
|
|
2456
|
+
|
|
2457
|
+
/* ******************************************************************** */
|
|
2458
|
+
/* GDALDriverManager */
|
|
2459
|
+
/* ******************************************************************** */
|
|
2460
|
+
|
|
2461
|
+
/**
|
|
2462
|
+
* Class for managing the registration of file format drivers.
|
|
2463
|
+
*
|
|
2464
|
+
* Use GetGDALDriverManager() to fetch the global singleton instance of
|
|
2465
|
+
* this class.
|
|
2466
|
+
*/
|
|
2467
|
+
|
|
2468
|
+
class CPL_DLL GDALDriverManager : public GDALMajorObject
|
|
2469
|
+
{
|
|
2470
|
+
int nDrivers = 0;
|
|
2471
|
+
GDALDriver **papoDrivers = nullptr;
|
|
2472
|
+
std::map<CPLString, GDALDriver *> oMapNameToDrivers{};
|
|
2473
|
+
std::string m_osPluginPath{};
|
|
2474
|
+
std::string m_osDriversIniPath{};
|
|
2475
|
+
mutable std::string m_osLastTriedDirectory{};
|
|
2476
|
+
std::set<std::string> m_oSetPluginFileNames{};
|
|
2477
|
+
bool m_bInDeferredDriverLoading = false;
|
|
2478
|
+
std::map<std::string, std::unique_ptr<GDALDriver>> m_oMapRealDrivers{};
|
|
2479
|
+
std::vector<std::unique_ptr<GDALDriver>> m_aoHiddenDrivers{};
|
|
2480
|
+
|
|
2481
|
+
GDALDriver *GetDriver_unlocked(int iDriver)
|
|
2482
|
+
{
|
|
2483
|
+
return (iDriver >= 0 && iDriver < nDrivers) ? papoDrivers[iDriver]
|
|
2484
|
+
: nullptr;
|
|
2485
|
+
}
|
|
2486
|
+
|
|
2487
|
+
GDALDriver *GetDriverByName_unlocked(const char *pszName) const
|
|
2488
|
+
{
|
|
2489
|
+
auto oIter = oMapNameToDrivers.find(CPLString(pszName).toupper());
|
|
2490
|
+
return oIter == oMapNameToDrivers.end() ? nullptr : oIter->second;
|
|
2491
|
+
}
|
|
2492
|
+
|
|
2493
|
+
static void CleanupPythonDrivers();
|
|
2494
|
+
|
|
2495
|
+
std::string GetPluginFullPath(const char *pszFilename) const;
|
|
2496
|
+
|
|
2497
|
+
int RegisterDriver(GDALDriver *, bool bHidden);
|
|
2498
|
+
|
|
2499
|
+
CPL_DISALLOW_COPY_ASSIGN(GDALDriverManager)
|
|
2500
|
+
|
|
2501
|
+
protected:
|
|
2502
|
+
friend class GDALPluginDriverProxy;
|
|
2503
|
+
friend GDALDatasetH CPL_STDCALL
|
|
2504
|
+
GDALOpenEx(const char *pszFilename, unsigned int nOpenFlags,
|
|
2505
|
+
const char *const *papszAllowedDrivers,
|
|
2506
|
+
const char *const *papszOpenOptions,
|
|
2507
|
+
const char *const *papszSiblingFiles);
|
|
2508
|
+
|
|
2509
|
+
//! @cond Doxygen_Suppress
|
|
2510
|
+
static char **GetSearchPaths(const char *pszGDAL_DRIVER_PATH);
|
|
2511
|
+
//! @endcond
|
|
2512
|
+
|
|
2513
|
+
public:
|
|
2514
|
+
GDALDriverManager();
|
|
2515
|
+
~GDALDriverManager();
|
|
2516
|
+
|
|
2517
|
+
int GetDriverCount(void) const;
|
|
2518
|
+
GDALDriver *GetDriver(int);
|
|
2519
|
+
GDALDriver *GetDriverByName(const char *);
|
|
2520
|
+
|
|
2521
|
+
int RegisterDriver(GDALDriver *);
|
|
2522
|
+
void DeregisterDriver(GDALDriver *);
|
|
2523
|
+
|
|
2524
|
+
// AutoLoadDrivers is a no-op if compiled with GDAL_NO_AUTOLOAD defined.
|
|
2525
|
+
void AutoLoadDrivers();
|
|
2526
|
+
void AutoSkipDrivers();
|
|
2527
|
+
void ReorderDrivers();
|
|
2528
|
+
static CPLErr LoadPlugin(const char *name);
|
|
2529
|
+
|
|
2530
|
+
static void AutoLoadPythonDrivers();
|
|
2531
|
+
|
|
2532
|
+
void DeclareDeferredPluginDriver(GDALPluginDriverProxy *poProxyDriver);
|
|
2533
|
+
|
|
2534
|
+
//! @cond Doxygen_Suppress
|
|
2535
|
+
int GetDriverCount(bool bIncludeHidden) const;
|
|
2536
|
+
GDALDriver *GetDriver(int iDriver, bool bIncludeHidden);
|
|
2537
|
+
bool IsKnownDriver(const char *pszDriverName) const;
|
|
2538
|
+
//! @endcond
|
|
2539
|
+
};
|
|
2540
|
+
|
|
2541
|
+
CPL_C_START
|
|
2542
|
+
GDALDriverManager CPL_DLL *GetGDALDriverManager(void);
|
|
2543
|
+
CPL_C_END
|
|
2544
|
+
|
|
2545
|
+
/* ******************************************************************** */
|
|
2546
|
+
/* GDALAsyncReader */
|
|
2547
|
+
/* ******************************************************************** */
|
|
2548
|
+
|
|
2549
|
+
/**
|
|
2550
|
+
* Class used as a session object for asynchronous requests. They are
|
|
2551
|
+
* created with GDALDataset::BeginAsyncReader(), and destroyed with
|
|
2552
|
+
* GDALDataset::EndAsyncReader().
|
|
2553
|
+
*/
|
|
2554
|
+
class CPL_DLL GDALAsyncReader
|
|
2555
|
+
{
|
|
2556
|
+
|
|
2557
|
+
CPL_DISALLOW_COPY_ASSIGN(GDALAsyncReader)
|
|
2558
|
+
|
|
2559
|
+
protected:
|
|
2560
|
+
//! @cond Doxygen_Suppress
|
|
2561
|
+
GDALDataset *poDS;
|
|
2562
|
+
int nXOff;
|
|
2563
|
+
int nYOff;
|
|
2564
|
+
int nXSize;
|
|
2565
|
+
int nYSize;
|
|
2566
|
+
void *pBuf;
|
|
2567
|
+
int nBufXSize;
|
|
2568
|
+
int nBufYSize;
|
|
2569
|
+
GDALDataType eBufType;
|
|
2570
|
+
int nBandCount;
|
|
2571
|
+
int *panBandMap;
|
|
2572
|
+
int nPixelSpace;
|
|
2573
|
+
int nLineSpace;
|
|
2574
|
+
int nBandSpace;
|
|
2575
|
+
//! @endcond
|
|
2576
|
+
|
|
2577
|
+
public:
|
|
2578
|
+
GDALAsyncReader();
|
|
2579
|
+
virtual ~GDALAsyncReader();
|
|
2580
|
+
|
|
2581
|
+
/** Return dataset.
|
|
2582
|
+
* @return dataset
|
|
2583
|
+
*/
|
|
2584
|
+
GDALDataset *GetGDALDataset()
|
|
2585
|
+
{
|
|
2586
|
+
return poDS;
|
|
2587
|
+
}
|
|
2588
|
+
|
|
2589
|
+
/** Return x offset.
|
|
2590
|
+
* @return x offset.
|
|
2591
|
+
*/
|
|
2592
|
+
int GetXOffset() const
|
|
2593
|
+
{
|
|
2594
|
+
return nXOff;
|
|
2595
|
+
}
|
|
2596
|
+
|
|
2597
|
+
/** Return y offset.
|
|
2598
|
+
* @return y offset.
|
|
2599
|
+
*/
|
|
2600
|
+
int GetYOffset() const
|
|
2601
|
+
{
|
|
2602
|
+
return nYOff;
|
|
2603
|
+
}
|
|
2604
|
+
|
|
2605
|
+
/** Return width.
|
|
2606
|
+
* @return width
|
|
2607
|
+
*/
|
|
2608
|
+
int GetXSize() const
|
|
2609
|
+
{
|
|
2610
|
+
return nXSize;
|
|
2611
|
+
}
|
|
2612
|
+
|
|
2613
|
+
/** Return height.
|
|
2614
|
+
* @return height
|
|
2615
|
+
*/
|
|
2616
|
+
int GetYSize() const
|
|
2617
|
+
{
|
|
2618
|
+
return nYSize;
|
|
2619
|
+
}
|
|
2620
|
+
|
|
2621
|
+
/** Return buffer.
|
|
2622
|
+
* @return buffer
|
|
2623
|
+
*/
|
|
2624
|
+
void *GetBuffer()
|
|
2625
|
+
{
|
|
2626
|
+
return pBuf;
|
|
2627
|
+
}
|
|
2628
|
+
|
|
2629
|
+
/** Return buffer width.
|
|
2630
|
+
* @return buffer width.
|
|
2631
|
+
*/
|
|
2632
|
+
int GetBufferXSize() const
|
|
2633
|
+
{
|
|
2634
|
+
return nBufXSize;
|
|
2635
|
+
}
|
|
2636
|
+
|
|
2637
|
+
/** Return buffer height.
|
|
2638
|
+
* @return buffer height.
|
|
2639
|
+
*/
|
|
2640
|
+
int GetBufferYSize() const
|
|
2641
|
+
{
|
|
2642
|
+
return nBufYSize;
|
|
2643
|
+
}
|
|
2644
|
+
|
|
2645
|
+
/** Return buffer data type.
|
|
2646
|
+
* @return buffer data type.
|
|
2647
|
+
*/
|
|
2648
|
+
GDALDataType GetBufferType() const
|
|
2649
|
+
{
|
|
2650
|
+
return eBufType;
|
|
2651
|
+
}
|
|
2652
|
+
|
|
2653
|
+
/** Return band count.
|
|
2654
|
+
* @return band count
|
|
2655
|
+
*/
|
|
2656
|
+
int GetBandCount() const
|
|
2657
|
+
{
|
|
2658
|
+
return nBandCount;
|
|
2659
|
+
}
|
|
2660
|
+
|
|
2661
|
+
/** Return band map.
|
|
2662
|
+
* @return band map.
|
|
2663
|
+
*/
|
|
2664
|
+
int *GetBandMap()
|
|
2665
|
+
{
|
|
2666
|
+
return panBandMap;
|
|
2667
|
+
}
|
|
2668
|
+
|
|
2669
|
+
/** Return pixel spacing.
|
|
2670
|
+
* @return pixel spacing.
|
|
2671
|
+
*/
|
|
2672
|
+
int GetPixelSpace() const
|
|
2673
|
+
{
|
|
2674
|
+
return nPixelSpace;
|
|
2675
|
+
}
|
|
2676
|
+
|
|
2677
|
+
/** Return line spacing.
|
|
2678
|
+
* @return line spacing.
|
|
2679
|
+
*/
|
|
2680
|
+
int GetLineSpace() const
|
|
2681
|
+
{
|
|
2682
|
+
return nLineSpace;
|
|
2683
|
+
}
|
|
2684
|
+
|
|
2685
|
+
/** Return band spacing.
|
|
2686
|
+
* @return band spacing.
|
|
2687
|
+
*/
|
|
2688
|
+
int GetBandSpace() const
|
|
2689
|
+
{
|
|
2690
|
+
return nBandSpace;
|
|
2691
|
+
}
|
|
2692
|
+
|
|
2693
|
+
virtual GDALAsyncStatusType
|
|
2694
|
+
GetNextUpdatedRegion(double dfTimeout, int *pnBufXOff, int *pnBufYOff,
|
|
2695
|
+
int *pnBufXSize, int *pnBufYSize) = 0;
|
|
2696
|
+
virtual int LockBuffer(double dfTimeout = -1.0);
|
|
2697
|
+
virtual void UnlockBuffer();
|
|
2698
|
+
};
|
|
2699
|
+
|
|
2700
|
+
/* ******************************************************************** */
|
|
2701
|
+
/* Multidimensional array API */
|
|
2702
|
+
/* ******************************************************************** */
|
|
2703
|
+
|
|
2704
|
+
class GDALMDArray;
|
|
2705
|
+
class GDALAttribute;
|
|
2706
|
+
class GDALDimension;
|
|
2707
|
+
class GDALEDTComponent;
|
|
2708
|
+
|
|
2709
|
+
/* ******************************************************************** */
|
|
2710
|
+
/* GDALExtendedDataType */
|
|
2711
|
+
/* ******************************************************************** */
|
|
2712
|
+
|
|
2713
|
+
/**
|
|
2714
|
+
* Class used to represent potentially complex data types.
|
|
2715
|
+
* Several classes of data types are supported: numeric (based on GDALDataType),
|
|
2716
|
+
* compound or string.
|
|
2717
|
+
*
|
|
2718
|
+
* @since GDAL 3.1
|
|
2719
|
+
*/
|
|
2720
|
+
class CPL_DLL GDALExtendedDataType
|
|
2721
|
+
{
|
|
2722
|
+
public:
|
|
2723
|
+
~GDALExtendedDataType();
|
|
2724
|
+
|
|
2725
|
+
GDALExtendedDataType(const GDALExtendedDataType &);
|
|
2726
|
+
|
|
2727
|
+
GDALExtendedDataType &operator=(const GDALExtendedDataType &);
|
|
2728
|
+
GDALExtendedDataType &operator=(GDALExtendedDataType &&);
|
|
2729
|
+
|
|
2730
|
+
static GDALExtendedDataType Create(GDALDataType eType);
|
|
2731
|
+
static GDALExtendedDataType
|
|
2732
|
+
Create(const std::string &osName, size_t nTotalSize,
|
|
2733
|
+
std::vector<std::unique_ptr<GDALEDTComponent>> &&components);
|
|
2734
|
+
static GDALExtendedDataType
|
|
2735
|
+
CreateString(size_t nMaxStringLength = 0,
|
|
2736
|
+
GDALExtendedDataTypeSubType eSubType = GEDTST_NONE);
|
|
2737
|
+
|
|
2738
|
+
bool operator==(const GDALExtendedDataType &) const;
|
|
2739
|
+
|
|
2740
|
+
/** Non-equality operator */
|
|
2741
|
+
bool operator!=(const GDALExtendedDataType &other) const
|
|
2742
|
+
{
|
|
2743
|
+
return !(operator==(other));
|
|
2744
|
+
}
|
|
2745
|
+
|
|
2746
|
+
/** Return type name.
|
|
2747
|
+
*
|
|
2748
|
+
* This is the same as the C function GDALExtendedDataTypeGetName()
|
|
2749
|
+
*/
|
|
2750
|
+
const std::string &GetName() const
|
|
2751
|
+
{
|
|
2752
|
+
return m_osName;
|
|
2753
|
+
}
|
|
2754
|
+
|
|
2755
|
+
/** Return type class.
|
|
2756
|
+
*
|
|
2757
|
+
* This is the same as the C function GDALExtendedDataTypeGetClass()
|
|
2758
|
+
*/
|
|
2759
|
+
GDALExtendedDataTypeClass GetClass() const
|
|
2760
|
+
{
|
|
2761
|
+
return m_eClass;
|
|
2762
|
+
}
|
|
2763
|
+
|
|
2764
|
+
/** Return numeric data type (only valid when GetClass() == GEDTC_NUMERIC)
|
|
2765
|
+
*
|
|
2766
|
+
* This is the same as the C function
|
|
2767
|
+
* GDALExtendedDataTypeGetNumericDataType()
|
|
2768
|
+
*/
|
|
2769
|
+
GDALDataType GetNumericDataType() const
|
|
2770
|
+
{
|
|
2771
|
+
return m_eNumericDT;
|
|
2772
|
+
}
|
|
2773
|
+
|
|
2774
|
+
/** Return subtype.
|
|
2775
|
+
*
|
|
2776
|
+
* This is the same as the C function GDALExtendedDataTypeGetSubType()
|
|
2777
|
+
*
|
|
2778
|
+
* @since 3.4
|
|
2779
|
+
*/
|
|
2780
|
+
GDALExtendedDataTypeSubType GetSubType() const
|
|
2781
|
+
{
|
|
2782
|
+
return m_eSubType;
|
|
2783
|
+
}
|
|
2784
|
+
|
|
2785
|
+
/** Return the components of the data type (only valid when GetClass() ==
|
|
2786
|
+
* GEDTC_COMPOUND)
|
|
2787
|
+
*
|
|
2788
|
+
* This is the same as the C function GDALExtendedDataTypeGetComponents()
|
|
2789
|
+
*/
|
|
2790
|
+
const std::vector<std::unique_ptr<GDALEDTComponent>> &GetComponents() const
|
|
2791
|
+
{
|
|
2792
|
+
return m_aoComponents;
|
|
2793
|
+
}
|
|
2794
|
+
|
|
2795
|
+
/** Return data type size in bytes.
|
|
2796
|
+
*
|
|
2797
|
+
* For a string, this will be size of a char* pointer.
|
|
2798
|
+
*
|
|
2799
|
+
* This is the same as the C function GDALExtendedDataTypeGetSize()
|
|
2800
|
+
*/
|
|
2801
|
+
size_t GetSize() const
|
|
2802
|
+
{
|
|
2803
|
+
return m_nSize;
|
|
2804
|
+
}
|
|
2805
|
+
|
|
2806
|
+
/** Return the maximum length of a string in bytes.
|
|
2807
|
+
*
|
|
2808
|
+
* 0 indicates unknown/unlimited string.
|
|
2809
|
+
*/
|
|
2810
|
+
size_t GetMaxStringLength() const
|
|
2811
|
+
{
|
|
2812
|
+
return m_nMaxStringLength;
|
|
2813
|
+
}
|
|
2814
|
+
|
|
2815
|
+
bool CanConvertTo(const GDALExtendedDataType &other) const;
|
|
2816
|
+
|
|
2817
|
+
bool NeedsFreeDynamicMemory() const;
|
|
2818
|
+
|
|
2819
|
+
void FreeDynamicMemory(void *pBuffer) const;
|
|
2820
|
+
|
|
2821
|
+
static bool CopyValue(const void *pSrc, const GDALExtendedDataType &srcType,
|
|
2822
|
+
void *pDst, const GDALExtendedDataType &dstType);
|
|
2823
|
+
|
|
2824
|
+
static bool CopyValues(const void *pSrc,
|
|
2825
|
+
const GDALExtendedDataType &srcType,
|
|
2826
|
+
GPtrDiff_t nSrcStrideInElts, void *pDst,
|
|
2827
|
+
const GDALExtendedDataType &dstType,
|
|
2828
|
+
GPtrDiff_t nDstStrideInElts, size_t nValues);
|
|
2829
|
+
|
|
2830
|
+
private:
|
|
2831
|
+
GDALExtendedDataType(size_t nMaxStringLength,
|
|
2832
|
+
GDALExtendedDataTypeSubType eSubType);
|
|
2833
|
+
explicit GDALExtendedDataType(GDALDataType eType);
|
|
2834
|
+
GDALExtendedDataType(
|
|
2835
|
+
const std::string &osName, size_t nTotalSize,
|
|
2836
|
+
std::vector<std::unique_ptr<GDALEDTComponent>> &&components);
|
|
2837
|
+
|
|
2838
|
+
std::string m_osName{};
|
|
2839
|
+
GDALExtendedDataTypeClass m_eClass = GEDTC_NUMERIC;
|
|
2840
|
+
GDALExtendedDataTypeSubType m_eSubType = GEDTST_NONE;
|
|
2841
|
+
GDALDataType m_eNumericDT = GDT_Unknown;
|
|
2842
|
+
std::vector<std::unique_ptr<GDALEDTComponent>> m_aoComponents{};
|
|
2843
|
+
size_t m_nSize = 0;
|
|
2844
|
+
size_t m_nMaxStringLength = 0;
|
|
2845
|
+
};
|
|
2846
|
+
|
|
2847
|
+
/* ******************************************************************** */
|
|
2848
|
+
/* GDALEDTComponent */
|
|
2849
|
+
/* ******************************************************************** */
|
|
2850
|
+
|
|
2851
|
+
/**
|
|
2852
|
+
* Class for a component of a compound extended data type.
|
|
2853
|
+
*
|
|
2854
|
+
* @since GDAL 3.1
|
|
2855
|
+
*/
|
|
2856
|
+
class CPL_DLL GDALEDTComponent
|
|
2857
|
+
{
|
|
2858
|
+
public:
|
|
2859
|
+
~GDALEDTComponent();
|
|
2860
|
+
GDALEDTComponent(const std::string &name, size_t offset,
|
|
2861
|
+
const GDALExtendedDataType &type);
|
|
2862
|
+
GDALEDTComponent(const GDALEDTComponent &);
|
|
2863
|
+
|
|
2864
|
+
bool operator==(const GDALEDTComponent &) const;
|
|
2865
|
+
|
|
2866
|
+
/** Return the name.
|
|
2867
|
+
*
|
|
2868
|
+
* This is the same as the C function GDALEDTComponentGetName().
|
|
2869
|
+
*/
|
|
2870
|
+
const std::string &GetName() const
|
|
2871
|
+
{
|
|
2872
|
+
return m_osName;
|
|
2873
|
+
}
|
|
2874
|
+
|
|
2875
|
+
/** Return the offset (in bytes) of the component in the compound data type.
|
|
2876
|
+
*
|
|
2877
|
+
* This is the same as the C function GDALEDTComponentGetOffset().
|
|
2878
|
+
*/
|
|
2879
|
+
size_t GetOffset() const
|
|
2880
|
+
{
|
|
2881
|
+
return m_nOffset;
|
|
2882
|
+
}
|
|
2883
|
+
|
|
2884
|
+
/** Return the data type of the component.
|
|
2885
|
+
*
|
|
2886
|
+
* This is the same as the C function GDALEDTComponentGetType().
|
|
2887
|
+
*/
|
|
2888
|
+
const GDALExtendedDataType &GetType() const
|
|
2889
|
+
{
|
|
2890
|
+
return m_oType;
|
|
2891
|
+
}
|
|
2892
|
+
|
|
2893
|
+
private:
|
|
2894
|
+
std::string m_osName;
|
|
2895
|
+
size_t m_nOffset;
|
|
2896
|
+
GDALExtendedDataType m_oType;
|
|
2897
|
+
};
|
|
2898
|
+
|
|
2899
|
+
/* ******************************************************************** */
|
|
2900
|
+
/* GDALIHasAttribute */
|
|
2901
|
+
/* ******************************************************************** */
|
|
2902
|
+
|
|
2903
|
+
/**
|
|
2904
|
+
* Interface used to get a single GDALAttribute or a set of GDALAttribute
|
|
2905
|
+
*
|
|
2906
|
+
* @since GDAL 3.1
|
|
2907
|
+
*/
|
|
2908
|
+
class CPL_DLL GDALIHasAttribute
|
|
2909
|
+
{
|
|
2910
|
+
protected:
|
|
2911
|
+
std::shared_ptr<GDALAttribute>
|
|
2912
|
+
GetAttributeFromAttributes(const std::string &osName) const;
|
|
2913
|
+
|
|
2914
|
+
public:
|
|
2915
|
+
virtual ~GDALIHasAttribute();
|
|
2916
|
+
|
|
2917
|
+
virtual std::shared_ptr<GDALAttribute>
|
|
2918
|
+
GetAttribute(const std::string &osName) const;
|
|
2919
|
+
|
|
2920
|
+
virtual std::vector<std::shared_ptr<GDALAttribute>>
|
|
2921
|
+
GetAttributes(CSLConstList papszOptions = nullptr) const;
|
|
2922
|
+
|
|
2923
|
+
virtual std::shared_ptr<GDALAttribute>
|
|
2924
|
+
CreateAttribute(const std::string &osName,
|
|
2925
|
+
const std::vector<GUInt64> &anDimensions,
|
|
2926
|
+
const GDALExtendedDataType &oDataType,
|
|
2927
|
+
CSLConstList papszOptions = nullptr);
|
|
2928
|
+
|
|
2929
|
+
virtual bool DeleteAttribute(const std::string &osName,
|
|
2930
|
+
CSLConstList papszOptions = nullptr);
|
|
2931
|
+
};
|
|
2932
|
+
|
|
2933
|
+
/* ******************************************************************** */
|
|
2934
|
+
/* GDALGroup */
|
|
2935
|
+
/* ******************************************************************** */
|
|
2936
|
+
|
|
2937
|
+
/* clang-format off */
|
|
2938
|
+
/**
|
|
2939
|
+
* Class modeling a named container of GDALAttribute, GDALMDArray, OGRLayer or
|
|
2940
|
+
* other GDALGroup. Hence GDALGroup can describe a hierarchy of objects.
|
|
2941
|
+
*
|
|
2942
|
+
* This is based on the <a href="https://portal.opengeospatial.org/files/81716#_hdf5_group">HDF5 group
|
|
2943
|
+
* concept</a>
|
|
2944
|
+
*
|
|
2945
|
+
* @since GDAL 3.1
|
|
2946
|
+
*/
|
|
2947
|
+
/* clang-format on */
|
|
2948
|
+
|
|
2949
|
+
class CPL_DLL GDALGroup : public GDALIHasAttribute
|
|
2950
|
+
{
|
|
2951
|
+
protected:
|
|
2952
|
+
//! @cond Doxygen_Suppress
|
|
2953
|
+
std::string m_osName{};
|
|
2954
|
+
|
|
2955
|
+
// This is actually a path of the form "/parent_path/{m_osName}"
|
|
2956
|
+
std::string m_osFullName{};
|
|
2957
|
+
|
|
2958
|
+
// Used for example by GDALSubsetGroup to distinguish a derived group
|
|
2959
|
+
//from its original, without altering its name
|
|
2960
|
+
const std::string m_osContext{};
|
|
2961
|
+
|
|
2962
|
+
std::weak_ptr<GDALGroup> m_pSelf{};
|
|
2963
|
+
|
|
2964
|
+
//! Can be set to false by the owing group, when deleting this object
|
|
2965
|
+
bool m_bValid = true;
|
|
2966
|
+
|
|
2967
|
+
GDALGroup(const std::string &osParentName, const std::string &osName,
|
|
2968
|
+
const std::string &osContext = std::string());
|
|
2969
|
+
|
|
2970
|
+
const GDALGroup *
|
|
2971
|
+
GetInnerMostGroup(const std::string &osPathOrArrayOrDim,
|
|
2972
|
+
std::shared_ptr<GDALGroup> &curGroupHolder,
|
|
2973
|
+
std::string &osLastPart) const;
|
|
2974
|
+
|
|
2975
|
+
void BaseRename(const std::string &osNewName);
|
|
2976
|
+
|
|
2977
|
+
bool CheckValidAndErrorOutIfNot() const;
|
|
2978
|
+
|
|
2979
|
+
void SetSelf(const std::shared_ptr<GDALGroup> &self)
|
|
2980
|
+
{
|
|
2981
|
+
m_pSelf = self;
|
|
2982
|
+
}
|
|
2983
|
+
|
|
2984
|
+
virtual void NotifyChildrenOfRenaming()
|
|
2985
|
+
{
|
|
2986
|
+
}
|
|
2987
|
+
|
|
2988
|
+
virtual void NotifyChildrenOfDeletion()
|
|
2989
|
+
{
|
|
2990
|
+
}
|
|
2991
|
+
|
|
2992
|
+
//! @endcond
|
|
2993
|
+
|
|
2994
|
+
public:
|
|
2995
|
+
virtual ~GDALGroup();
|
|
2996
|
+
|
|
2997
|
+
/** Return the name of the group.
|
|
2998
|
+
*
|
|
2999
|
+
* This is the same as the C function GDALGroupGetName().
|
|
3000
|
+
*/
|
|
3001
|
+
const std::string &GetName() const
|
|
3002
|
+
{
|
|
3003
|
+
return m_osName;
|
|
3004
|
+
}
|
|
3005
|
+
|
|
3006
|
+
/** Return the full name of the group.
|
|
3007
|
+
*
|
|
3008
|
+
* This is the same as the C function GDALGroupGetFullName().
|
|
3009
|
+
*/
|
|
3010
|
+
const std::string &GetFullName() const
|
|
3011
|
+
{
|
|
3012
|
+
return m_osFullName;
|
|
3013
|
+
}
|
|
3014
|
+
|
|
3015
|
+
virtual std::vector<std::string>
|
|
3016
|
+
GetMDArrayNames(CSLConstList papszOptions = nullptr) const;
|
|
3017
|
+
virtual std::shared_ptr<GDALMDArray>
|
|
3018
|
+
OpenMDArray(const std::string &osName,
|
|
3019
|
+
CSLConstList papszOptions = nullptr) const;
|
|
3020
|
+
|
|
3021
|
+
virtual std::vector<std::string>
|
|
3022
|
+
GetGroupNames(CSLConstList papszOptions = nullptr) const;
|
|
3023
|
+
virtual std::shared_ptr<GDALGroup>
|
|
3024
|
+
OpenGroup(const std::string &osName,
|
|
3025
|
+
CSLConstList papszOptions = nullptr) const;
|
|
3026
|
+
|
|
3027
|
+
virtual std::vector<std::string>
|
|
3028
|
+
GetVectorLayerNames(CSLConstList papszOptions = nullptr) const;
|
|
3029
|
+
virtual OGRLayer *
|
|
3030
|
+
OpenVectorLayer(const std::string &osName,
|
|
3031
|
+
CSLConstList papszOptions = nullptr) const;
|
|
3032
|
+
|
|
3033
|
+
virtual std::vector<std::shared_ptr<GDALDimension>>
|
|
3034
|
+
GetDimensions(CSLConstList papszOptions = nullptr) const;
|
|
3035
|
+
|
|
3036
|
+
virtual std::shared_ptr<GDALGroup>
|
|
3037
|
+
CreateGroup(const std::string &osName, CSLConstList papszOptions = nullptr);
|
|
3038
|
+
|
|
3039
|
+
virtual bool DeleteGroup(const std::string &osName,
|
|
3040
|
+
CSLConstList papszOptions = nullptr);
|
|
3041
|
+
|
|
3042
|
+
virtual std::shared_ptr<GDALDimension>
|
|
3043
|
+
CreateDimension(const std::string &osName, const std::string &osType,
|
|
3044
|
+
const std::string &osDirection, GUInt64 nSize,
|
|
3045
|
+
CSLConstList papszOptions = nullptr);
|
|
3046
|
+
|
|
3047
|
+
virtual std::shared_ptr<GDALMDArray> CreateMDArray(
|
|
3048
|
+
const std::string &osName,
|
|
3049
|
+
const std::vector<std::shared_ptr<GDALDimension>> &aoDimensions,
|
|
3050
|
+
const GDALExtendedDataType &oDataType,
|
|
3051
|
+
CSLConstList papszOptions = nullptr);
|
|
3052
|
+
|
|
3053
|
+
virtual bool DeleteMDArray(const std::string &osName,
|
|
3054
|
+
CSLConstList papszOptions = nullptr);
|
|
3055
|
+
|
|
3056
|
+
GUInt64 GetTotalCopyCost() const;
|
|
3057
|
+
|
|
3058
|
+
virtual bool CopyFrom(const std::shared_ptr<GDALGroup> &poDstRootGroup,
|
|
3059
|
+
GDALDataset *poSrcDS,
|
|
3060
|
+
const std::shared_ptr<GDALGroup> &poSrcGroup,
|
|
3061
|
+
bool bStrict, GUInt64 &nCurCost,
|
|
3062
|
+
const GUInt64 nTotalCost,
|
|
3063
|
+
GDALProgressFunc pfnProgress, void *pProgressData,
|
|
3064
|
+
CSLConstList papszOptions = nullptr);
|
|
3065
|
+
|
|
3066
|
+
virtual CSLConstList GetStructuralInfo() const;
|
|
3067
|
+
|
|
3068
|
+
std::shared_ptr<GDALMDArray>
|
|
3069
|
+
OpenMDArrayFromFullname(const std::string &osFullName,
|
|
3070
|
+
CSLConstList papszOptions = nullptr) const;
|
|
3071
|
+
|
|
3072
|
+
std::shared_ptr<GDALMDArray>
|
|
3073
|
+
ResolveMDArray(const std::string &osName, const std::string &osStartingPath,
|
|
3074
|
+
CSLConstList papszOptions = nullptr) const;
|
|
3075
|
+
|
|
3076
|
+
std::shared_ptr<GDALGroup>
|
|
3077
|
+
OpenGroupFromFullname(const std::string &osFullName,
|
|
3078
|
+
CSLConstList papszOptions = nullptr) const;
|
|
3079
|
+
|
|
3080
|
+
std::shared_ptr<GDALDimension>
|
|
3081
|
+
OpenDimensionFromFullname(const std::string &osFullName) const;
|
|
3082
|
+
|
|
3083
|
+
virtual void ClearStatistics();
|
|
3084
|
+
|
|
3085
|
+
virtual bool Rename(const std::string &osNewName);
|
|
3086
|
+
|
|
3087
|
+
std::shared_ptr<GDALGroup>
|
|
3088
|
+
SubsetDimensionFromSelection(const std::string &osSelection) const;
|
|
3089
|
+
|
|
3090
|
+
//! @cond Doxygen_Suppress
|
|
3091
|
+
virtual void ParentRenamed(const std::string &osNewParentFullName);
|
|
3092
|
+
|
|
3093
|
+
virtual void Deleted();
|
|
3094
|
+
|
|
3095
|
+
virtual void ParentDeleted();
|
|
3096
|
+
|
|
3097
|
+
const std::string &GetContext() const
|
|
3098
|
+
{
|
|
3099
|
+
return m_osContext;
|
|
3100
|
+
}
|
|
3101
|
+
|
|
3102
|
+
//! @endcond
|
|
3103
|
+
|
|
3104
|
+
//! @cond Doxygen_Suppress
|
|
3105
|
+
static constexpr GUInt64 COPY_COST = 1000;
|
|
3106
|
+
//! @endcond
|
|
3107
|
+
};
|
|
3108
|
+
|
|
3109
|
+
/* ******************************************************************** */
|
|
3110
|
+
/* GDALAbstractMDArray */
|
|
3111
|
+
/* ******************************************************************** */
|
|
3112
|
+
|
|
3113
|
+
/**
|
|
3114
|
+
* Abstract class, implemented by GDALAttribute and GDALMDArray.
|
|
3115
|
+
*
|
|
3116
|
+
* @since GDAL 3.1
|
|
3117
|
+
*/
|
|
3118
|
+
class CPL_DLL GDALAbstractMDArray
|
|
3119
|
+
{
|
|
3120
|
+
protected:
|
|
3121
|
+
//! @cond Doxygen_Suppress
|
|
3122
|
+
std::string m_osName{};
|
|
3123
|
+
|
|
3124
|
+
// This is actually a path of the form "/parent_path/{m_osName}"
|
|
3125
|
+
std::string m_osFullName{};
|
|
3126
|
+
std::weak_ptr<GDALAbstractMDArray> m_pSelf{};
|
|
3127
|
+
|
|
3128
|
+
//! Can be set to false by the owing object, when deleting this object
|
|
3129
|
+
bool m_bValid = true;
|
|
3130
|
+
|
|
3131
|
+
GDALAbstractMDArray(const std::string &osParentName,
|
|
3132
|
+
const std::string &osName);
|
|
3133
|
+
|
|
3134
|
+
void SetSelf(const std::shared_ptr<GDALAbstractMDArray> &self)
|
|
3135
|
+
{
|
|
3136
|
+
m_pSelf = self;
|
|
3137
|
+
}
|
|
3138
|
+
|
|
3139
|
+
bool CheckValidAndErrorOutIfNot() const;
|
|
3140
|
+
|
|
3141
|
+
bool CheckReadWriteParams(const GUInt64 *arrayStartIdx, const size_t *count,
|
|
3142
|
+
const GInt64 *&arrayStep,
|
|
3143
|
+
const GPtrDiff_t *&bufferStride,
|
|
3144
|
+
const GDALExtendedDataType &bufferDataType,
|
|
3145
|
+
const void *buffer,
|
|
3146
|
+
const void *buffer_alloc_start,
|
|
3147
|
+
size_t buffer_alloc_size,
|
|
3148
|
+
std::vector<GInt64> &tmp_arrayStep,
|
|
3149
|
+
std::vector<GPtrDiff_t> &tmp_bufferStride) const;
|
|
3150
|
+
|
|
3151
|
+
virtual bool
|
|
3152
|
+
IRead(const GUInt64 *arrayStartIdx, // array of size GetDimensionCount()
|
|
3153
|
+
const size_t *count, // array of size GetDimensionCount()
|
|
3154
|
+
const GInt64 *arrayStep, // step in elements
|
|
3155
|
+
const GPtrDiff_t *bufferStride, // stride in elements
|
|
3156
|
+
const GDALExtendedDataType &bufferDataType,
|
|
3157
|
+
void *pDstBuffer) const = 0;
|
|
3158
|
+
|
|
3159
|
+
virtual bool
|
|
3160
|
+
IWrite(const GUInt64 *arrayStartIdx, // array of size GetDimensionCount()
|
|
3161
|
+
const size_t *count, // array of size GetDimensionCount()
|
|
3162
|
+
const GInt64 *arrayStep, // step in elements
|
|
3163
|
+
const GPtrDiff_t *bufferStride, // stride in elements
|
|
3164
|
+
const GDALExtendedDataType &bufferDataType, const void *pSrcBuffer);
|
|
3165
|
+
|
|
3166
|
+
void BaseRename(const std::string &osNewName);
|
|
3167
|
+
|
|
3168
|
+
virtual void NotifyChildrenOfRenaming()
|
|
3169
|
+
{
|
|
3170
|
+
}
|
|
3171
|
+
|
|
3172
|
+
virtual void NotifyChildrenOfDeletion()
|
|
3173
|
+
{
|
|
3174
|
+
}
|
|
3175
|
+
|
|
3176
|
+
//! @endcond
|
|
3177
|
+
|
|
3178
|
+
public:
|
|
3179
|
+
virtual ~GDALAbstractMDArray();
|
|
3180
|
+
|
|
3181
|
+
/** Return the name of an array or attribute.
|
|
3182
|
+
*
|
|
3183
|
+
* This is the same as the C function GDALMDArrayGetName() or
|
|
3184
|
+
* GDALAttributeGetName().
|
|
3185
|
+
*/
|
|
3186
|
+
const std::string &GetName() const
|
|
3187
|
+
{
|
|
3188
|
+
return m_osName;
|
|
3189
|
+
}
|
|
3190
|
+
|
|
3191
|
+
/** Return the name of an array or attribute.
|
|
3192
|
+
*
|
|
3193
|
+
* This is the same as the C function GDALMDArrayGetFullName() or
|
|
3194
|
+
* GDALAttributeGetFullName().
|
|
3195
|
+
*/
|
|
3196
|
+
const std::string &GetFullName() const
|
|
3197
|
+
{
|
|
3198
|
+
return m_osFullName;
|
|
3199
|
+
}
|
|
3200
|
+
|
|
3201
|
+
GUInt64 GetTotalElementsCount() const;
|
|
3202
|
+
|
|
3203
|
+
virtual size_t GetDimensionCount() const;
|
|
3204
|
+
|
|
3205
|
+
virtual const std::vector<std::shared_ptr<GDALDimension>> &
|
|
3206
|
+
GetDimensions() const = 0;
|
|
3207
|
+
|
|
3208
|
+
virtual const GDALExtendedDataType &GetDataType() const = 0;
|
|
3209
|
+
|
|
3210
|
+
virtual std::vector<GUInt64> GetBlockSize() const;
|
|
3211
|
+
|
|
3212
|
+
virtual std::vector<size_t>
|
|
3213
|
+
GetProcessingChunkSize(size_t nMaxChunkMemory) const;
|
|
3214
|
+
|
|
3215
|
+
/* clang-format off */
|
|
3216
|
+
/** Type of pfnFunc argument of ProcessPerChunk().
|
|
3217
|
+
* @param array Array on which ProcessPerChunk was called.
|
|
3218
|
+
* @param chunkArrayStartIdx Values representing the starting index to use
|
|
3219
|
+
* in each dimension (in [0, aoDims[i].GetSize()-1] range)
|
|
3220
|
+
* for the current chunk.
|
|
3221
|
+
* Will be nullptr for a zero-dimensional array.
|
|
3222
|
+
* @param chunkCount Values representing the number of values to use in
|
|
3223
|
+
* each dimension for the current chunk.
|
|
3224
|
+
* Will be nullptr for a zero-dimensional array.
|
|
3225
|
+
* @param iCurChunk Number of current chunk being processed.
|
|
3226
|
+
* In [1, nChunkCount] range.
|
|
3227
|
+
* @param nChunkCount Total number of chunks to process.
|
|
3228
|
+
* @param pUserData User data.
|
|
3229
|
+
* @return return true in case of success.
|
|
3230
|
+
*/
|
|
3231
|
+
typedef bool (*FuncProcessPerChunkType)(
|
|
3232
|
+
GDALAbstractMDArray *array,
|
|
3233
|
+
const GUInt64 *chunkArrayStartIdx,
|
|
3234
|
+
const size_t *chunkCount,
|
|
3235
|
+
GUInt64 iCurChunk,
|
|
3236
|
+
GUInt64 nChunkCount,
|
|
3237
|
+
void *pUserData);
|
|
3238
|
+
/* clang-format on */
|
|
3239
|
+
|
|
3240
|
+
virtual bool ProcessPerChunk(const GUInt64 *arrayStartIdx,
|
|
3241
|
+
const GUInt64 *count, const size_t *chunkSize,
|
|
3242
|
+
FuncProcessPerChunkType pfnFunc,
|
|
3243
|
+
void *pUserData);
|
|
3244
|
+
|
|
3245
|
+
virtual bool
|
|
3246
|
+
Read(const GUInt64 *arrayStartIdx, // array of size GetDimensionCount()
|
|
3247
|
+
const size_t *count, // array of size GetDimensionCount()
|
|
3248
|
+
const GInt64 *arrayStep, // step in elements
|
|
3249
|
+
const GPtrDiff_t *bufferStride, // stride in elements
|
|
3250
|
+
const GDALExtendedDataType &bufferDataType, void *pDstBuffer,
|
|
3251
|
+
const void *pDstBufferAllocStart = nullptr,
|
|
3252
|
+
size_t nDstBufferAllocSize = 0) const;
|
|
3253
|
+
|
|
3254
|
+
bool
|
|
3255
|
+
Write(const GUInt64 *arrayStartIdx, // array of size GetDimensionCount()
|
|
3256
|
+
const size_t *count, // array of size GetDimensionCount()
|
|
3257
|
+
const GInt64 *arrayStep, // step in elements
|
|
3258
|
+
const GPtrDiff_t *bufferStride, // stride in elements
|
|
3259
|
+
const GDALExtendedDataType &bufferDataType, const void *pSrcBuffer,
|
|
3260
|
+
const void *pSrcBufferAllocStart = nullptr,
|
|
3261
|
+
size_t nSrcBufferAllocSize = 0);
|
|
3262
|
+
|
|
3263
|
+
virtual bool Rename(const std::string &osNewName);
|
|
3264
|
+
|
|
3265
|
+
//! @cond Doxygen_Suppress
|
|
3266
|
+
virtual void Deleted();
|
|
3267
|
+
|
|
3268
|
+
virtual void ParentDeleted();
|
|
3269
|
+
|
|
3270
|
+
virtual void ParentRenamed(const std::string &osNewParentFullName);
|
|
3271
|
+
//! @endcond
|
|
3272
|
+
};
|
|
3273
|
+
|
|
3274
|
+
/* ******************************************************************** */
|
|
3275
|
+
/* GDALRawResult */
|
|
3276
|
+
/* ******************************************************************** */
|
|
3277
|
+
|
|
3278
|
+
/**
|
|
3279
|
+
* Store the raw result of an attribute value, which might contain dynamically
|
|
3280
|
+
* allocated structures (like pointer to strings).
|
|
3281
|
+
*
|
|
3282
|
+
* @since GDAL 3.1
|
|
3283
|
+
*/
|
|
3284
|
+
class CPL_DLL GDALRawResult
|
|
3285
|
+
{
|
|
3286
|
+
private:
|
|
3287
|
+
GDALExtendedDataType m_dt;
|
|
3288
|
+
size_t m_nEltCount;
|
|
3289
|
+
size_t m_nSize;
|
|
3290
|
+
GByte *m_raw;
|
|
3291
|
+
|
|
3292
|
+
void FreeMe();
|
|
3293
|
+
|
|
3294
|
+
GDALRawResult(const GDALRawResult &) = delete;
|
|
3295
|
+
GDALRawResult &operator=(const GDALRawResult &) = delete;
|
|
3296
|
+
|
|
3297
|
+
protected:
|
|
3298
|
+
friend class GDALAttribute;
|
|
3299
|
+
//! @cond Doxygen_Suppress
|
|
3300
|
+
GDALRawResult(GByte *raw, const GDALExtendedDataType &dt, size_t nEltCount);
|
|
3301
|
+
//! @endcond
|
|
3302
|
+
|
|
3303
|
+
public:
|
|
3304
|
+
~GDALRawResult();
|
|
3305
|
+
GDALRawResult(GDALRawResult &&);
|
|
3306
|
+
GDALRawResult &operator=(GDALRawResult &&);
|
|
3307
|
+
|
|
3308
|
+
/** Return byte at specified index. */
|
|
3309
|
+
const GByte &operator[](size_t idx) const
|
|
3310
|
+
{
|
|
3311
|
+
return m_raw[idx];
|
|
3312
|
+
}
|
|
3313
|
+
|
|
3314
|
+
/** Return pointer to the start of data. */
|
|
3315
|
+
const GByte *data() const
|
|
3316
|
+
{
|
|
3317
|
+
return m_raw;
|
|
3318
|
+
}
|
|
3319
|
+
|
|
3320
|
+
/** Return the size in bytes of the raw result. */
|
|
3321
|
+
size_t size() const
|
|
3322
|
+
{
|
|
3323
|
+
return m_nSize;
|
|
3324
|
+
}
|
|
3325
|
+
|
|
3326
|
+
//! @cond Doxygen_Suppress
|
|
3327
|
+
GByte *StealData();
|
|
3328
|
+
//! @endcond
|
|
3329
|
+
};
|
|
3330
|
+
|
|
3331
|
+
/* ******************************************************************** */
|
|
3332
|
+
/* GDALAttribute */
|
|
3333
|
+
/* ******************************************************************** */
|
|
3334
|
+
|
|
3335
|
+
/* clang-format off */
|
|
3336
|
+
/**
|
|
3337
|
+
* Class modeling an attribute that has a name, a value and a type, and is
|
|
3338
|
+
* typically used to describe a metadata item. The value can be (for the
|
|
3339
|
+
* HDF5 format) in the general case a multidimensional array of "any" type
|
|
3340
|
+
* (in most cases, this will be a single value of string or numeric type)
|
|
3341
|
+
*
|
|
3342
|
+
* This is based on the <a href="https://portal.opengeospatial.org/files/81716#_hdf5_attribute">HDF5
|
|
3343
|
+
* attribute concept</a>
|
|
3344
|
+
*
|
|
3345
|
+
* @since GDAL 3.1
|
|
3346
|
+
*/
|
|
3347
|
+
/* clang-format on */
|
|
3348
|
+
|
|
3349
|
+
class CPL_DLL GDALAttribute : virtual public GDALAbstractMDArray
|
|
3350
|
+
{
|
|
3351
|
+
mutable std::string m_osCachedVal{};
|
|
3352
|
+
|
|
3353
|
+
protected:
|
|
3354
|
+
//! @cond Doxygen_Suppress
|
|
3355
|
+
GDALAttribute(const std::string &osParentName, const std::string &osName);
|
|
3356
|
+
//! @endcond
|
|
3357
|
+
|
|
3358
|
+
public:
|
|
3359
|
+
std::vector<GUInt64> GetDimensionsSize() const;
|
|
3360
|
+
|
|
3361
|
+
GDALRawResult ReadAsRaw() const;
|
|
3362
|
+
const char *ReadAsString() const;
|
|
3363
|
+
int ReadAsInt() const;
|
|
3364
|
+
int64_t ReadAsInt64() const;
|
|
3365
|
+
double ReadAsDouble() const;
|
|
3366
|
+
CPLStringList ReadAsStringArray() const;
|
|
3367
|
+
std::vector<int> ReadAsIntArray() const;
|
|
3368
|
+
std::vector<int64_t> ReadAsInt64Array() const;
|
|
3369
|
+
std::vector<double> ReadAsDoubleArray() const;
|
|
3370
|
+
|
|
3371
|
+
using GDALAbstractMDArray::Write;
|
|
3372
|
+
bool Write(const void *pabyValue, size_t nLen);
|
|
3373
|
+
bool Write(const char *);
|
|
3374
|
+
bool WriteInt(int);
|
|
3375
|
+
bool WriteInt64(int64_t);
|
|
3376
|
+
bool Write(double);
|
|
3377
|
+
bool Write(CSLConstList);
|
|
3378
|
+
bool Write(const int *, size_t);
|
|
3379
|
+
bool Write(const int64_t *, size_t);
|
|
3380
|
+
bool Write(const double *, size_t);
|
|
3381
|
+
|
|
3382
|
+
//! @cond Doxygen_Suppress
|
|
3383
|
+
static constexpr GUInt64 COPY_COST = 100;
|
|
3384
|
+
//! @endcond
|
|
3385
|
+
};
|
|
3386
|
+
|
|
3387
|
+
/************************************************************************/
|
|
3388
|
+
/* GDALAttributeString */
|
|
3389
|
+
/************************************************************************/
|
|
3390
|
+
|
|
3391
|
+
//! @cond Doxygen_Suppress
|
|
3392
|
+
class CPL_DLL GDALAttributeString final : public GDALAttribute
|
|
3393
|
+
{
|
|
3394
|
+
std::vector<std::shared_ptr<GDALDimension>> m_dims{};
|
|
3395
|
+
GDALExtendedDataType m_dt = GDALExtendedDataType::CreateString();
|
|
3396
|
+
std::string m_osValue;
|
|
3397
|
+
|
|
3398
|
+
protected:
|
|
3399
|
+
bool IRead(const GUInt64 *, const size_t *, const GInt64 *,
|
|
3400
|
+
const GPtrDiff_t *, const GDALExtendedDataType &bufferDataType,
|
|
3401
|
+
void *pDstBuffer) const override;
|
|
3402
|
+
|
|
3403
|
+
public:
|
|
3404
|
+
GDALAttributeString(const std::string &osParentName,
|
|
3405
|
+
const std::string &osName, const std::string &osValue,
|
|
3406
|
+
GDALExtendedDataTypeSubType eSubType = GEDTST_NONE);
|
|
3407
|
+
|
|
3408
|
+
const std::vector<std::shared_ptr<GDALDimension>> &
|
|
3409
|
+
GetDimensions() const override;
|
|
3410
|
+
|
|
3411
|
+
const GDALExtendedDataType &GetDataType() const override;
|
|
3412
|
+
};
|
|
3413
|
+
|
|
3414
|
+
//! @endcond
|
|
3415
|
+
|
|
3416
|
+
/************************************************************************/
|
|
3417
|
+
/* GDALAttributeNumeric */
|
|
3418
|
+
/************************************************************************/
|
|
3419
|
+
|
|
3420
|
+
//! @cond Doxygen_Suppress
|
|
3421
|
+
class CPL_DLL GDALAttributeNumeric final : public GDALAttribute
|
|
3422
|
+
{
|
|
3423
|
+
std::vector<std::shared_ptr<GDALDimension>> m_dims{};
|
|
3424
|
+
GDALExtendedDataType m_dt;
|
|
3425
|
+
int m_nValue = 0;
|
|
3426
|
+
double m_dfValue = 0;
|
|
3427
|
+
std::vector<GUInt32> m_anValuesUInt32{};
|
|
3428
|
+
|
|
3429
|
+
protected:
|
|
3430
|
+
bool IRead(const GUInt64 *, const size_t *, const GInt64 *,
|
|
3431
|
+
const GPtrDiff_t *, const GDALExtendedDataType &bufferDataType,
|
|
3432
|
+
void *pDstBuffer) const override;
|
|
3433
|
+
|
|
3434
|
+
public:
|
|
3435
|
+
GDALAttributeNumeric(const std::string &osParentName,
|
|
3436
|
+
const std::string &osName, double dfValue);
|
|
3437
|
+
GDALAttributeNumeric(const std::string &osParentName,
|
|
3438
|
+
const std::string &osName, int nValue);
|
|
3439
|
+
GDALAttributeNumeric(const std::string &osParentName,
|
|
3440
|
+
const std::string &osName,
|
|
3441
|
+
const std::vector<GUInt32> &anValues);
|
|
3442
|
+
|
|
3443
|
+
const std::vector<std::shared_ptr<GDALDimension>> &
|
|
3444
|
+
GetDimensions() const override;
|
|
3445
|
+
|
|
3446
|
+
const GDALExtendedDataType &GetDataType() const override;
|
|
3447
|
+
};
|
|
3448
|
+
|
|
3449
|
+
//! @endcond
|
|
3450
|
+
|
|
3451
|
+
/* ******************************************************************** */
|
|
3452
|
+
/* GDALMDArray */
|
|
3453
|
+
/* ******************************************************************** */
|
|
3454
|
+
|
|
3455
|
+
/* clang-format off */
|
|
3456
|
+
/**
|
|
3457
|
+
* Class modeling a multi-dimensional array. It has a name, values organized
|
|
3458
|
+
* as an array and a list of GDALAttribute.
|
|
3459
|
+
*
|
|
3460
|
+
* This is based on the <a href="https://portal.opengeospatial.org/files/81716#_hdf5_dataset">HDF5
|
|
3461
|
+
* dataset concept</a>
|
|
3462
|
+
*
|
|
3463
|
+
* @since GDAL 3.1
|
|
3464
|
+
*/
|
|
3465
|
+
/* clang-format on */
|
|
3466
|
+
|
|
3467
|
+
class CPL_DLL GDALMDArray : virtual public GDALAbstractMDArray,
|
|
3468
|
+
public GDALIHasAttribute
|
|
3469
|
+
{
|
|
3470
|
+
friend class GDALMDArrayResampled;
|
|
3471
|
+
std::shared_ptr<GDALMDArray>
|
|
3472
|
+
GetView(const std::vector<GUInt64> &indices) const;
|
|
3473
|
+
|
|
3474
|
+
inline std::shared_ptr<GDALMDArray>
|
|
3475
|
+
atInternal(const std::vector<GUInt64> &indices) const
|
|
3476
|
+
{
|
|
3477
|
+
return GetView(indices);
|
|
3478
|
+
}
|
|
3479
|
+
|
|
3480
|
+
template <typename... GUInt64VarArg>
|
|
3481
|
+
// cppcheck-suppress functionStatic
|
|
3482
|
+
inline std::shared_ptr<GDALMDArray>
|
|
3483
|
+
atInternal(std::vector<GUInt64> &indices, GUInt64 idx,
|
|
3484
|
+
GUInt64VarArg... tail) const
|
|
3485
|
+
{
|
|
3486
|
+
indices.push_back(idx);
|
|
3487
|
+
return atInternal(indices, tail...);
|
|
3488
|
+
}
|
|
3489
|
+
|
|
3490
|
+
// Used for example by GDALSubsetGroup to distinguish a derived group
|
|
3491
|
+
//from its original, without altering its name
|
|
3492
|
+
const std::string m_osContext{};
|
|
3493
|
+
|
|
3494
|
+
mutable bool m_bHasTriedCachedArray = false;
|
|
3495
|
+
mutable std::shared_ptr<GDALMDArray> m_poCachedArray{};
|
|
3496
|
+
|
|
3497
|
+
protected:
|
|
3498
|
+
//! @cond Doxygen_Suppress
|
|
3499
|
+
GDALMDArray(const std::string &osParentName, const std::string &osName,
|
|
3500
|
+
const std::string &osContext = std::string());
|
|
3501
|
+
|
|
3502
|
+
virtual bool IAdviseRead(const GUInt64 *arrayStartIdx, const size_t *count,
|
|
3503
|
+
CSLConstList papszOptions) const;
|
|
3504
|
+
|
|
3505
|
+
virtual bool IsCacheable() const
|
|
3506
|
+
{
|
|
3507
|
+
return true;
|
|
3508
|
+
}
|
|
3509
|
+
|
|
3510
|
+
virtual bool SetStatistics(bool bApproxStats, double dfMin, double dfMax,
|
|
3511
|
+
double dfMean, double dfStdDev,
|
|
3512
|
+
GUInt64 nValidCount, CSLConstList papszOptions);
|
|
3513
|
+
|
|
3514
|
+
static std::string MassageName(const std::string &inputName);
|
|
3515
|
+
|
|
3516
|
+
std::shared_ptr<GDALGroup>
|
|
3517
|
+
GetCacheRootGroup(bool bCanCreate, std::string &osCacheFilenameOut) const;
|
|
3518
|
+
|
|
3519
|
+
// Returns if bufferStride values express a transposed view of the array
|
|
3520
|
+
bool IsTransposedRequest(const size_t *count,
|
|
3521
|
+
const GPtrDiff_t *bufferStride) const;
|
|
3522
|
+
|
|
3523
|
+
// Should only be called if IsTransposedRequest() returns true
|
|
3524
|
+
bool ReadForTransposedRequest(const GUInt64 *arrayStartIdx,
|
|
3525
|
+
const size_t *count, const GInt64 *arrayStep,
|
|
3526
|
+
const GPtrDiff_t *bufferStride,
|
|
3527
|
+
const GDALExtendedDataType &bufferDataType,
|
|
3528
|
+
void *pDstBuffer) const;
|
|
3529
|
+
|
|
3530
|
+
bool IsStepOneContiguousRowMajorOrderedSameDataType(
|
|
3531
|
+
const size_t *count, const GInt64 *arrayStep,
|
|
3532
|
+
const GPtrDiff_t *bufferStride,
|
|
3533
|
+
const GDALExtendedDataType &bufferDataType) const;
|
|
3534
|
+
|
|
3535
|
+
// Should only be called if IsStepOneContiguousRowMajorOrderedSameDataType()
|
|
3536
|
+
// returns false
|
|
3537
|
+
bool ReadUsingContiguousIRead(const GUInt64 *arrayStartIdx,
|
|
3538
|
+
const size_t *count, const GInt64 *arrayStep,
|
|
3539
|
+
const GPtrDiff_t *bufferStride,
|
|
3540
|
+
const GDALExtendedDataType &bufferDataType,
|
|
3541
|
+
void *pDstBuffer) const;
|
|
3542
|
+
|
|
3543
|
+
static std::shared_ptr<GDALMDArray> CreateGLTOrthorectified(
|
|
3544
|
+
const std::shared_ptr<GDALMDArray> &poParent,
|
|
3545
|
+
const std::shared_ptr<GDALGroup> &poRootGroup,
|
|
3546
|
+
const std::shared_ptr<GDALMDArray> &poGLTX,
|
|
3547
|
+
const std::shared_ptr<GDALMDArray> &poGLTY, int nGLTIndexOffset,
|
|
3548
|
+
const std::vector<double> &adfGeoTransform, CSLConstList papszOptions);
|
|
3549
|
+
|
|
3550
|
+
//! @endcond
|
|
3551
|
+
|
|
3552
|
+
public:
|
|
3553
|
+
GUInt64 GetTotalCopyCost() const;
|
|
3554
|
+
|
|
3555
|
+
virtual bool CopyFrom(GDALDataset *poSrcDS, const GDALMDArray *poSrcArray,
|
|
3556
|
+
bool bStrict, GUInt64 &nCurCost,
|
|
3557
|
+
const GUInt64 nTotalCost,
|
|
3558
|
+
GDALProgressFunc pfnProgress, void *pProgressData);
|
|
3559
|
+
|
|
3560
|
+
/** Return whether an array is writable. */
|
|
3561
|
+
virtual bool IsWritable() const = 0;
|
|
3562
|
+
|
|
3563
|
+
/** Return the filename that contains that array.
|
|
3564
|
+
*
|
|
3565
|
+
* This is used in particular for caching.
|
|
3566
|
+
*
|
|
3567
|
+
* Might be empty if the array is not linked to a file.
|
|
3568
|
+
*
|
|
3569
|
+
* @since GDAL 3.4
|
|
3570
|
+
*/
|
|
3571
|
+
virtual const std::string &GetFilename() const = 0;
|
|
3572
|
+
|
|
3573
|
+
virtual CSLConstList GetStructuralInfo() const;
|
|
3574
|
+
|
|
3575
|
+
virtual const std::string &GetUnit() const;
|
|
3576
|
+
|
|
3577
|
+
virtual bool SetUnit(const std::string &osUnit);
|
|
3578
|
+
|
|
3579
|
+
virtual bool SetSpatialRef(const OGRSpatialReference *poSRS);
|
|
3580
|
+
|
|
3581
|
+
virtual std::shared_ptr<OGRSpatialReference> GetSpatialRef() const;
|
|
3582
|
+
|
|
3583
|
+
virtual const void *GetRawNoDataValue() const;
|
|
3584
|
+
|
|
3585
|
+
double GetNoDataValueAsDouble(bool *pbHasNoData = nullptr) const;
|
|
3586
|
+
|
|
3587
|
+
int64_t GetNoDataValueAsInt64(bool *pbHasNoData = nullptr) const;
|
|
3588
|
+
|
|
3589
|
+
uint64_t GetNoDataValueAsUInt64(bool *pbHasNoData = nullptr) const;
|
|
3590
|
+
|
|
3591
|
+
virtual bool SetRawNoDataValue(const void *pRawNoData);
|
|
3592
|
+
|
|
3593
|
+
//! @cond Doxygen_Suppress
|
|
3594
|
+
bool SetNoDataValue(int nNoData)
|
|
3595
|
+
{
|
|
3596
|
+
return SetNoDataValue(static_cast<int64_t>(nNoData));
|
|
3597
|
+
}
|
|
3598
|
+
|
|
3599
|
+
//! @endcond
|
|
3600
|
+
|
|
3601
|
+
bool SetNoDataValue(double dfNoData);
|
|
3602
|
+
|
|
3603
|
+
bool SetNoDataValue(int64_t nNoData);
|
|
3604
|
+
|
|
3605
|
+
bool SetNoDataValue(uint64_t nNoData);
|
|
3606
|
+
|
|
3607
|
+
virtual bool Resize(const std::vector<GUInt64> &anNewDimSizes,
|
|
3608
|
+
CSLConstList papszOptions);
|
|
3609
|
+
|
|
3610
|
+
virtual double GetOffset(bool *pbHasOffset = nullptr,
|
|
3611
|
+
GDALDataType *peStorageType = nullptr) const;
|
|
3612
|
+
|
|
3613
|
+
virtual double GetScale(bool *pbHasScale = nullptr,
|
|
3614
|
+
GDALDataType *peStorageType = nullptr) const;
|
|
3615
|
+
|
|
3616
|
+
virtual bool SetOffset(double dfOffset,
|
|
3617
|
+
GDALDataType eStorageType = GDT_Unknown);
|
|
3618
|
+
|
|
3619
|
+
virtual bool SetScale(double dfScale,
|
|
3620
|
+
GDALDataType eStorageType = GDT_Unknown);
|
|
3621
|
+
|
|
3622
|
+
std::shared_ptr<GDALMDArray> GetView(const std::string &viewExpr) const;
|
|
3623
|
+
|
|
3624
|
+
std::shared_ptr<GDALMDArray> operator[](const std::string &fieldName) const;
|
|
3625
|
+
|
|
3626
|
+
/** Return a view of the array using integer indexing.
|
|
3627
|
+
*
|
|
3628
|
+
* Equivalent of GetView("[indices_0,indices_1,.....,indices_last]")
|
|
3629
|
+
*
|
|
3630
|
+
* Example:
|
|
3631
|
+
* \code
|
|
3632
|
+
* ar->at(0,3,2)
|
|
3633
|
+
* \endcode
|
|
3634
|
+
*/
|
|
3635
|
+
// sphinx 4.1.0 / breathe 4.30.0 don't like typename...
|
|
3636
|
+
//! @cond Doxygen_Suppress
|
|
3637
|
+
template <typename... GUInt64VarArg>
|
|
3638
|
+
//! @endcond
|
|
3639
|
+
// cppcheck-suppress functionStatic
|
|
3640
|
+
std::shared_ptr<GDALMDArray> at(GUInt64 idx, GUInt64VarArg... tail) const
|
|
3641
|
+
{
|
|
3642
|
+
std::vector<GUInt64> indices;
|
|
3643
|
+
indices.push_back(idx);
|
|
3644
|
+
return atInternal(indices, tail...);
|
|
3645
|
+
}
|
|
3646
|
+
|
|
3647
|
+
virtual std::shared_ptr<GDALMDArray>
|
|
3648
|
+
Transpose(const std::vector<int> &anMapNewAxisToOldAxis) const;
|
|
3649
|
+
|
|
3650
|
+
std::shared_ptr<GDALMDArray> GetUnscaled(
|
|
3651
|
+
double dfOverriddenScale = std::numeric_limits<double>::quiet_NaN(),
|
|
3652
|
+
double dfOverriddenOffset = std::numeric_limits<double>::quiet_NaN(),
|
|
3653
|
+
double dfOverriddenDstNodata =
|
|
3654
|
+
std::numeric_limits<double>::quiet_NaN()) const;
|
|
3655
|
+
|
|
3656
|
+
virtual std::shared_ptr<GDALMDArray>
|
|
3657
|
+
GetMask(CSLConstList papszOptions) const;
|
|
3658
|
+
|
|
3659
|
+
virtual std::shared_ptr<GDALMDArray>
|
|
3660
|
+
GetResampled(const std::vector<std::shared_ptr<GDALDimension>> &apoNewDims,
|
|
3661
|
+
GDALRIOResampleAlg resampleAlg,
|
|
3662
|
+
const OGRSpatialReference *poTargetSRS,
|
|
3663
|
+
CSLConstList papszOptions) const;
|
|
3664
|
+
|
|
3665
|
+
std::shared_ptr<GDALMDArray>
|
|
3666
|
+
GetGridded(const std::string &osGridOptions,
|
|
3667
|
+
const std::shared_ptr<GDALMDArray> &poXArray = nullptr,
|
|
3668
|
+
const std::shared_ptr<GDALMDArray> &poYArray = nullptr,
|
|
3669
|
+
CSLConstList papszOptions = nullptr) const;
|
|
3670
|
+
|
|
3671
|
+
static std::vector<std::shared_ptr<GDALMDArray>>
|
|
3672
|
+
GetMeshGrid(const std::vector<std::shared_ptr<GDALMDArray>> &apoArrays,
|
|
3673
|
+
CSLConstList papszOptions = nullptr);
|
|
3674
|
+
|
|
3675
|
+
virtual GDALDataset *
|
|
3676
|
+
AsClassicDataset(size_t iXDim, size_t iYDim,
|
|
3677
|
+
const std::shared_ptr<GDALGroup> &poRootGroup = nullptr,
|
|
3678
|
+
CSLConstList papszOptions = nullptr) const;
|
|
3679
|
+
|
|
3680
|
+
virtual CPLErr GetStatistics(bool bApproxOK, bool bForce, double *pdfMin,
|
|
3681
|
+
double *pdfMax, double *pdfMean,
|
|
3682
|
+
double *padfStdDev, GUInt64 *pnValidCount,
|
|
3683
|
+
GDALProgressFunc pfnProgress,
|
|
3684
|
+
void *pProgressData);
|
|
3685
|
+
|
|
3686
|
+
virtual bool ComputeStatistics(bool bApproxOK, double *pdfMin,
|
|
3687
|
+
double *pdfMax, double *pdfMean,
|
|
3688
|
+
double *pdfStdDev, GUInt64 *pnValidCount,
|
|
3689
|
+
GDALProgressFunc, void *pProgressData,
|
|
3690
|
+
CSLConstList papszOptions);
|
|
3691
|
+
|
|
3692
|
+
virtual void ClearStatistics();
|
|
3693
|
+
|
|
3694
|
+
virtual std::vector<std::shared_ptr<GDALMDArray>>
|
|
3695
|
+
GetCoordinateVariables() const;
|
|
3696
|
+
|
|
3697
|
+
bool AdviseRead(const GUInt64 *arrayStartIdx, const size_t *count,
|
|
3698
|
+
CSLConstList papszOptions = nullptr) const;
|
|
3699
|
+
|
|
3700
|
+
bool IsRegularlySpaced(double &dfStart, double &dfIncrement) const;
|
|
3701
|
+
|
|
3702
|
+
bool GuessGeoTransform(size_t nDimX, size_t nDimY, bool bPixelIsPoint,
|
|
3703
|
+
double adfGeoTransform[6]) const;
|
|
3704
|
+
|
|
3705
|
+
bool Cache(CSLConstList papszOptions = nullptr) const;
|
|
3706
|
+
|
|
3707
|
+
bool
|
|
3708
|
+
Read(const GUInt64 *arrayStartIdx, // array of size GetDimensionCount()
|
|
3709
|
+
const size_t *count, // array of size GetDimensionCount()
|
|
3710
|
+
const GInt64 *arrayStep, // step in elements
|
|
3711
|
+
const GPtrDiff_t *bufferStride, // stride in elements
|
|
3712
|
+
const GDALExtendedDataType &bufferDataType, void *pDstBuffer,
|
|
3713
|
+
const void *pDstBufferAllocStart = nullptr,
|
|
3714
|
+
size_t nDstBufferAllocSize = 0) const override final;
|
|
3715
|
+
|
|
3716
|
+
virtual std::shared_ptr<GDALGroup> GetRootGroup() const;
|
|
3717
|
+
|
|
3718
|
+
//! @cond Doxygen_Suppress
|
|
3719
|
+
static constexpr GUInt64 COPY_COST = 1000;
|
|
3720
|
+
|
|
3721
|
+
bool CopyFromAllExceptValues(const GDALMDArray *poSrcArray, bool bStrict,
|
|
3722
|
+
GUInt64 &nCurCost, const GUInt64 nTotalCost,
|
|
3723
|
+
GDALProgressFunc pfnProgress,
|
|
3724
|
+
void *pProgressData);
|
|
3725
|
+
|
|
3726
|
+
struct Range
|
|
3727
|
+
{
|
|
3728
|
+
GUInt64 m_nStartIdx;
|
|
3729
|
+
GInt64 m_nIncr;
|
|
3730
|
+
|
|
3731
|
+
explicit Range(GUInt64 nStartIdx = 0, GInt64 nIncr = 0)
|
|
3732
|
+
: m_nStartIdx(nStartIdx), m_nIncr(nIncr)
|
|
3733
|
+
{
|
|
3734
|
+
}
|
|
3735
|
+
};
|
|
3736
|
+
|
|
3737
|
+
struct ViewSpec
|
|
3738
|
+
{
|
|
3739
|
+
std::string m_osFieldName{};
|
|
3740
|
+
|
|
3741
|
+
// or
|
|
3742
|
+
|
|
3743
|
+
std::vector<size_t>
|
|
3744
|
+
m_mapDimIdxToParentDimIdx{}; // of size m_dims.size()
|
|
3745
|
+
std::vector<Range>
|
|
3746
|
+
m_parentRanges{}; // of size m_poParent->GetDimensionCount()
|
|
3747
|
+
};
|
|
3748
|
+
|
|
3749
|
+
virtual std::shared_ptr<GDALMDArray>
|
|
3750
|
+
GetView(const std::string &viewExpr, bool bRenameDimensions,
|
|
3751
|
+
std::vector<ViewSpec> &viewSpecs) const;
|
|
3752
|
+
|
|
3753
|
+
const std::string &GetContext() const
|
|
3754
|
+
{
|
|
3755
|
+
return m_osContext;
|
|
3756
|
+
}
|
|
3757
|
+
|
|
3758
|
+
//! @endcond
|
|
3759
|
+
};
|
|
3760
|
+
|
|
3761
|
+
//! @cond Doxygen_Suppress
|
|
3762
|
+
bool GDALMDRasterIOFromBand(GDALRasterBand *poBand, GDALRWFlag eRWFlag,
|
|
3763
|
+
size_t iDimX, size_t iDimY,
|
|
3764
|
+
const GUInt64 *arrayStartIdx, const size_t *count,
|
|
3765
|
+
const GInt64 *arrayStep,
|
|
3766
|
+
const GPtrDiff_t *bufferStride,
|
|
3767
|
+
const GDALExtendedDataType &bufferDataType,
|
|
3768
|
+
void *pBuffer);
|
|
3769
|
+
|
|
3770
|
+
//! @endcond
|
|
3771
|
+
|
|
3772
|
+
/************************************************************************/
|
|
3773
|
+
/* GDALMDArrayRegularlySpaced */
|
|
3774
|
+
/************************************************************************/
|
|
3775
|
+
|
|
3776
|
+
//! @cond Doxygen_Suppress
|
|
3777
|
+
class CPL_DLL GDALMDArrayRegularlySpaced : public GDALMDArray
|
|
3778
|
+
{
|
|
3779
|
+
double m_dfStart;
|
|
3780
|
+
double m_dfIncrement;
|
|
3781
|
+
double m_dfOffsetInIncrement;
|
|
3782
|
+
GDALExtendedDataType m_dt = GDALExtendedDataType::Create(GDT_Float64);
|
|
3783
|
+
std::vector<std::shared_ptr<GDALDimension>> m_dims;
|
|
3784
|
+
std::vector<std::shared_ptr<GDALAttribute>> m_attributes{};
|
|
3785
|
+
std::string m_osEmptyFilename{};
|
|
3786
|
+
|
|
3787
|
+
protected:
|
|
3788
|
+
bool IRead(const GUInt64 *, const size_t *, const GInt64 *,
|
|
3789
|
+
const GPtrDiff_t *, const GDALExtendedDataType &bufferDataType,
|
|
3790
|
+
void *pDstBuffer) const override;
|
|
3791
|
+
|
|
3792
|
+
public:
|
|
3793
|
+
GDALMDArrayRegularlySpaced(const std::string &osParentName,
|
|
3794
|
+
const std::string &osName,
|
|
3795
|
+
const std::shared_ptr<GDALDimension> &poDim,
|
|
3796
|
+
double dfStart, double dfIncrement,
|
|
3797
|
+
double dfOffsetInIncrement);
|
|
3798
|
+
|
|
3799
|
+
static std::shared_ptr<GDALMDArrayRegularlySpaced>
|
|
3800
|
+
Create(const std::string &osParentName, const std::string &osName,
|
|
3801
|
+
const std::shared_ptr<GDALDimension> &poDim, double dfStart,
|
|
3802
|
+
double dfIncrement, double dfOffsetInIncrement);
|
|
3803
|
+
|
|
3804
|
+
bool IsWritable() const override
|
|
3805
|
+
{
|
|
3806
|
+
return false;
|
|
3807
|
+
}
|
|
3808
|
+
|
|
3809
|
+
const std::string &GetFilename() const override
|
|
3810
|
+
{
|
|
3811
|
+
return m_osEmptyFilename;
|
|
3812
|
+
}
|
|
3813
|
+
|
|
3814
|
+
const std::vector<std::shared_ptr<GDALDimension>> &
|
|
3815
|
+
GetDimensions() const override;
|
|
3816
|
+
|
|
3817
|
+
const GDALExtendedDataType &GetDataType() const override;
|
|
3818
|
+
|
|
3819
|
+
std::vector<std::shared_ptr<GDALAttribute>>
|
|
3820
|
+
GetAttributes(CSLConstList) const override;
|
|
3821
|
+
|
|
3822
|
+
void AddAttribute(const std::shared_ptr<GDALAttribute> &poAttr);
|
|
3823
|
+
};
|
|
3824
|
+
|
|
3825
|
+
//! @endcond
|
|
3826
|
+
|
|
3827
|
+
/* ******************************************************************** */
|
|
3828
|
+
/* GDALDimension */
|
|
3829
|
+
/* ******************************************************************** */
|
|
3830
|
+
|
|
3831
|
+
/**
|
|
3832
|
+
* Class modeling a a dimension / axis used to index multidimensional arrays.
|
|
3833
|
+
* It has a name, a size (that is the number of values that can be indexed along
|
|
3834
|
+
* the dimension), a type (see GDALDimension::GetType()), a direction
|
|
3835
|
+
* (see GDALDimension::GetDirection()), a unit and can optionally point to a
|
|
3836
|
+
* GDALMDArray variable, typically one-dimensional, describing the values taken
|
|
3837
|
+
* by the dimension. For a georeferenced GDALMDArray and its X dimension, this
|
|
3838
|
+
* will be typically the values of the easting/longitude for each grid point.
|
|
3839
|
+
*
|
|
3840
|
+
* @since GDAL 3.1
|
|
3841
|
+
*/
|
|
3842
|
+
class CPL_DLL GDALDimension
|
|
3843
|
+
{
|
|
3844
|
+
public:
|
|
3845
|
+
//! @cond Doxygen_Suppress
|
|
3846
|
+
GDALDimension(const std::string &osParentName, const std::string &osName,
|
|
3847
|
+
const std::string &osType, const std::string &osDirection,
|
|
3848
|
+
GUInt64 nSize);
|
|
3849
|
+
//! @endcond
|
|
3850
|
+
|
|
3851
|
+
virtual ~GDALDimension();
|
|
3852
|
+
|
|
3853
|
+
/** Return the name.
|
|
3854
|
+
*
|
|
3855
|
+
* This is the same as the C function GDALDimensionGetName()
|
|
3856
|
+
*/
|
|
3857
|
+
const std::string &GetName() const
|
|
3858
|
+
{
|
|
3859
|
+
return m_osName;
|
|
3860
|
+
}
|
|
3861
|
+
|
|
3862
|
+
/** Return the full name.
|
|
3863
|
+
*
|
|
3864
|
+
* This is the same as the C function GDALDimensionGetFullName()
|
|
3865
|
+
*/
|
|
3866
|
+
const std::string &GetFullName() const
|
|
3867
|
+
{
|
|
3868
|
+
return m_osFullName;
|
|
3869
|
+
}
|
|
3870
|
+
|
|
3871
|
+
/** Return the axis type.
|
|
3872
|
+
*
|
|
3873
|
+
* Predefined values are:
|
|
3874
|
+
* HORIZONTAL_X, HORIZONTAL_Y, VERTICAL, TEMPORAL, PARAMETRIC
|
|
3875
|
+
* Other values might be returned. Empty value means unknown.
|
|
3876
|
+
*
|
|
3877
|
+
* This is the same as the C function GDALDimensionGetType()
|
|
3878
|
+
*/
|
|
3879
|
+
const std::string &GetType() const
|
|
3880
|
+
{
|
|
3881
|
+
return m_osType;
|
|
3882
|
+
}
|
|
3883
|
+
|
|
3884
|
+
/** Return the axis direction.
|
|
3885
|
+
*
|
|
3886
|
+
* Predefined values are:
|
|
3887
|
+
* EAST, WEST, SOUTH, NORTH, UP, DOWN, FUTURE, PAST
|
|
3888
|
+
* Other values might be returned. Empty value means unknown.
|
|
3889
|
+
*
|
|
3890
|
+
* This is the same as the C function GDALDimensionGetDirection()
|
|
3891
|
+
*/
|
|
3892
|
+
const std::string &GetDirection() const
|
|
3893
|
+
{
|
|
3894
|
+
return m_osDirection;
|
|
3895
|
+
}
|
|
3896
|
+
|
|
3897
|
+
/** Return the size, that is the number of values along the dimension.
|
|
3898
|
+
*
|
|
3899
|
+
* This is the same as the C function GDALDimensionGetSize()
|
|
3900
|
+
*/
|
|
3901
|
+
GUInt64 GetSize() const
|
|
3902
|
+
{
|
|
3903
|
+
return m_nSize;
|
|
3904
|
+
}
|
|
3905
|
+
|
|
3906
|
+
virtual std::shared_ptr<GDALMDArray> GetIndexingVariable() const;
|
|
3907
|
+
|
|
3908
|
+
virtual bool
|
|
3909
|
+
SetIndexingVariable(std::shared_ptr<GDALMDArray> poIndexingVariable);
|
|
3910
|
+
|
|
3911
|
+
virtual bool Rename(const std::string &osNewName);
|
|
3912
|
+
|
|
3913
|
+
//! @cond Doxygen_Suppress
|
|
3914
|
+
virtual void ParentRenamed(const std::string &osNewParentFullName);
|
|
3915
|
+
|
|
3916
|
+
virtual void ParentDeleted();
|
|
3917
|
+
//! @endcond
|
|
3918
|
+
|
|
3919
|
+
protected:
|
|
3920
|
+
//! @cond Doxygen_Suppress
|
|
3921
|
+
std::string m_osName;
|
|
3922
|
+
std::string m_osFullName;
|
|
3923
|
+
std::string m_osType;
|
|
3924
|
+
std::string m_osDirection;
|
|
3925
|
+
GUInt64 m_nSize;
|
|
3926
|
+
|
|
3927
|
+
void BaseRename(const std::string &osNewName);
|
|
3928
|
+
|
|
3929
|
+
//! @endcond
|
|
3930
|
+
};
|
|
3931
|
+
|
|
3932
|
+
/************************************************************************/
|
|
3933
|
+
/* GDALDimensionWeakIndexingVar() */
|
|
3934
|
+
/************************************************************************/
|
|
3935
|
+
|
|
3936
|
+
//! @cond Doxygen_Suppress
|
|
3937
|
+
class CPL_DLL GDALDimensionWeakIndexingVar : public GDALDimension
|
|
3938
|
+
{
|
|
3939
|
+
std::weak_ptr<GDALMDArray> m_poIndexingVariable{};
|
|
3940
|
+
|
|
3941
|
+
public:
|
|
3942
|
+
GDALDimensionWeakIndexingVar(const std::string &osParentName,
|
|
3943
|
+
const std::string &osName,
|
|
3944
|
+
const std::string &osType,
|
|
3945
|
+
const std::string &osDirection, GUInt64 nSize);
|
|
3946
|
+
|
|
3947
|
+
std::shared_ptr<GDALMDArray> GetIndexingVariable() const override;
|
|
3948
|
+
|
|
3949
|
+
bool SetIndexingVariable(
|
|
3950
|
+
std::shared_ptr<GDALMDArray> poIndexingVariable) override;
|
|
3951
|
+
|
|
3952
|
+
void SetSize(GUInt64 nNewSize);
|
|
3953
|
+
};
|
|
3954
|
+
//! @endcond
|
|
3955
|
+
|
|
3956
|
+
/************************************************************************/
|
|
3957
|
+
/* GDALAntiRecursionGuard */
|
|
3958
|
+
/************************************************************************/
|
|
3959
|
+
|
|
3960
|
+
//! @cond Doxygen_Suppress
|
|
3961
|
+
struct GDALAntiRecursionStruct;
|
|
3962
|
+
|
|
3963
|
+
class GDALAntiRecursionGuard
|
|
3964
|
+
{
|
|
3965
|
+
GDALAntiRecursionStruct *m_psAntiRecursionStruct;
|
|
3966
|
+
std::string m_osIdentifier;
|
|
3967
|
+
int m_nDepth;
|
|
3968
|
+
|
|
3969
|
+
GDALAntiRecursionGuard(const GDALAntiRecursionGuard &) = delete;
|
|
3970
|
+
GDALAntiRecursionGuard &operator=(const GDALAntiRecursionGuard &) = delete;
|
|
3971
|
+
|
|
3972
|
+
public:
|
|
3973
|
+
explicit GDALAntiRecursionGuard(const std::string &osIdentifier);
|
|
3974
|
+
GDALAntiRecursionGuard(const GDALAntiRecursionGuard &other,
|
|
3975
|
+
const std::string &osIdentifier);
|
|
3976
|
+
~GDALAntiRecursionGuard();
|
|
3977
|
+
|
|
3978
|
+
int GetCallDepth() const
|
|
3979
|
+
{
|
|
3980
|
+
return m_nDepth;
|
|
3981
|
+
}
|
|
3982
|
+
};
|
|
3983
|
+
|
|
3984
|
+
//! @endcond
|
|
3985
|
+
|
|
3986
|
+
/************************************************************************/
|
|
3987
|
+
/* Relationships */
|
|
3988
|
+
/************************************************************************/
|
|
3989
|
+
|
|
3990
|
+
/**
|
|
3991
|
+
* Definition of a table relationship.
|
|
3992
|
+
*
|
|
3993
|
+
* GDALRelationship describes the relationship between two tables, including
|
|
3994
|
+
* properties such as the cardinality of the relationship and the participating
|
|
3995
|
+
* tables.
|
|
3996
|
+
*
|
|
3997
|
+
* Not all relationship properties are supported by all data formats.
|
|
3998
|
+
*
|
|
3999
|
+
* @since GDAL 3.6
|
|
4000
|
+
*/
|
|
4001
|
+
class CPL_DLL GDALRelationship
|
|
4002
|
+
{
|
|
4003
|
+
protected:
|
|
4004
|
+
/*! @cond Doxygen_Suppress */
|
|
4005
|
+
std::string m_osName{};
|
|
4006
|
+
std::string m_osLeftTableName{};
|
|
4007
|
+
std::string m_osRightTableName{};
|
|
4008
|
+
GDALRelationshipCardinality m_eCardinality =
|
|
4009
|
+
GDALRelationshipCardinality::GRC_ONE_TO_MANY;
|
|
4010
|
+
std::string m_osMappingTableName{};
|
|
4011
|
+
std::vector<std::string> m_osListLeftTableFields{};
|
|
4012
|
+
std::vector<std::string> m_osListRightTableFields{};
|
|
4013
|
+
std::vector<std::string> m_osListLeftMappingTableFields{};
|
|
4014
|
+
std::vector<std::string> m_osListRightMappingTableFields{};
|
|
4015
|
+
GDALRelationshipType m_eType = GDALRelationshipType::GRT_ASSOCIATION;
|
|
4016
|
+
std::string m_osForwardPathLabel{};
|
|
4017
|
+
std::string m_osBackwardPathLabel{};
|
|
4018
|
+
std::string m_osRelatedTableType{};
|
|
4019
|
+
|
|
4020
|
+
/*! @endcond */
|
|
4021
|
+
|
|
4022
|
+
public:
|
|
4023
|
+
/**
|
|
4024
|
+
* Constructor for a relationship between two tables.
|
|
4025
|
+
* @param osName relationship name
|
|
4026
|
+
* @param osLeftTableName left table name
|
|
4027
|
+
* @param osRightTableName right table name
|
|
4028
|
+
* @param eCardinality cardinality of relationship
|
|
4029
|
+
*/
|
|
4030
|
+
GDALRelationship(const std::string &osName,
|
|
4031
|
+
const std::string &osLeftTableName,
|
|
4032
|
+
const std::string &osRightTableName,
|
|
4033
|
+
GDALRelationshipCardinality eCardinality =
|
|
4034
|
+
GDALRelationshipCardinality::GRC_ONE_TO_MANY)
|
|
4035
|
+
: m_osName(osName), m_osLeftTableName(osLeftTableName),
|
|
4036
|
+
m_osRightTableName(osRightTableName), m_eCardinality(eCardinality)
|
|
4037
|
+
{
|
|
4038
|
+
}
|
|
4039
|
+
|
|
4040
|
+
/** Get the name of the relationship */
|
|
4041
|
+
const std::string &GetName() const
|
|
4042
|
+
{
|
|
4043
|
+
return m_osName;
|
|
4044
|
+
}
|
|
4045
|
+
|
|
4046
|
+
/** Get the cardinality of the relationship */
|
|
4047
|
+
GDALRelationshipCardinality GetCardinality() const
|
|
4048
|
+
{
|
|
4049
|
+
return m_eCardinality;
|
|
4050
|
+
}
|
|
4051
|
+
|
|
4052
|
+
/** Get the name of the left (or base/origin) table in the relationship.
|
|
4053
|
+
*
|
|
4054
|
+
* @see GetRightTableName()
|
|
4055
|
+
*/
|
|
4056
|
+
const std::string &GetLeftTableName() const
|
|
4057
|
+
{
|
|
4058
|
+
return m_osLeftTableName;
|
|
4059
|
+
}
|
|
4060
|
+
|
|
4061
|
+
/** Get the name of the right (or related/destination) table in the
|
|
4062
|
+
* relationship */
|
|
4063
|
+
const std::string &GetRightTableName() const
|
|
4064
|
+
{
|
|
4065
|
+
return m_osRightTableName;
|
|
4066
|
+
}
|
|
4067
|
+
|
|
4068
|
+
/** Get the name of the mapping table for many-to-many relationships.
|
|
4069
|
+
*
|
|
4070
|
+
* @see SetMappingTableName()
|
|
4071
|
+
*/
|
|
4072
|
+
const std::string &GetMappingTableName() const
|
|
4073
|
+
{
|
|
4074
|
+
return m_osMappingTableName;
|
|
4075
|
+
}
|
|
4076
|
+
|
|
4077
|
+
/** Sets the name of the mapping table for many-to-many relationships.
|
|
4078
|
+
*
|
|
4079
|
+
* @see GetMappingTableName()
|
|
4080
|
+
*/
|
|
4081
|
+
void SetMappingTableName(const std::string &osName)
|
|
4082
|
+
{
|
|
4083
|
+
m_osMappingTableName = osName;
|
|
4084
|
+
}
|
|
4085
|
+
|
|
4086
|
+
/** Get the names of the participating fields from the left table in the
|
|
4087
|
+
* relationship.
|
|
4088
|
+
*
|
|
4089
|
+
* @see GetRightTableFields()
|
|
4090
|
+
* @see SetLeftTableFields()
|
|
4091
|
+
*/
|
|
4092
|
+
const std::vector<std::string> &GetLeftTableFields() const
|
|
4093
|
+
{
|
|
4094
|
+
return m_osListLeftTableFields;
|
|
4095
|
+
}
|
|
4096
|
+
|
|
4097
|
+
/** Get the names of the participating fields from the right table in the
|
|
4098
|
+
* relationship.
|
|
4099
|
+
*
|
|
4100
|
+
* @see GetLeftTableFields()
|
|
4101
|
+
* @see SetRightTableFields()
|
|
4102
|
+
*/
|
|
4103
|
+
const std::vector<std::string> &GetRightTableFields() const
|
|
4104
|
+
{
|
|
4105
|
+
return m_osListRightTableFields;
|
|
4106
|
+
}
|
|
4107
|
+
|
|
4108
|
+
/** Sets the names of the participating fields from the left table in the
|
|
4109
|
+
* relationship.
|
|
4110
|
+
*
|
|
4111
|
+
* @see GetLeftTableFields()
|
|
4112
|
+
* @see SetRightTableFields()
|
|
4113
|
+
*/
|
|
4114
|
+
void SetLeftTableFields(const std::vector<std::string> &osListFields)
|
|
4115
|
+
{
|
|
4116
|
+
m_osListLeftTableFields = osListFields;
|
|
4117
|
+
}
|
|
4118
|
+
|
|
4119
|
+
/** Sets the names of the participating fields from the right table in the
|
|
4120
|
+
* relationship.
|
|
4121
|
+
*
|
|
4122
|
+
* @see GetRightTableFields()
|
|
4123
|
+
* @see SetLeftTableFields()
|
|
4124
|
+
*/
|
|
4125
|
+
void SetRightTableFields(const std::vector<std::string> &osListFields)
|
|
4126
|
+
{
|
|
4127
|
+
m_osListRightTableFields = osListFields;
|
|
4128
|
+
}
|
|
4129
|
+
|
|
4130
|
+
/** Get the names of the mapping table fields which correspond to the
|
|
4131
|
+
* participating fields from the left table in the relationship.
|
|
4132
|
+
*
|
|
4133
|
+
* @see GetRightMappingTableFields()
|
|
4134
|
+
* @see SetLeftMappingTableFields()
|
|
4135
|
+
*/
|
|
4136
|
+
const std::vector<std::string> &GetLeftMappingTableFields() const
|
|
4137
|
+
{
|
|
4138
|
+
return m_osListLeftMappingTableFields;
|
|
4139
|
+
}
|
|
4140
|
+
|
|
4141
|
+
/** Get the names of the mapping table fields which correspond to the
|
|
4142
|
+
* participating fields from the right table in the relationship.
|
|
4143
|
+
*
|
|
4144
|
+
* @see GetLeftMappingTableFields()
|
|
4145
|
+
* @see SetRightMappingTableFields()
|
|
4146
|
+
*/
|
|
4147
|
+
const std::vector<std::string> &GetRightMappingTableFields() const
|
|
4148
|
+
{
|
|
4149
|
+
return m_osListRightMappingTableFields;
|
|
4150
|
+
}
|
|
4151
|
+
|
|
4152
|
+
/** Sets the names of the mapping table fields which correspond to the
|
|
4153
|
+
* participating fields from the left table in the relationship.
|
|
4154
|
+
*
|
|
4155
|
+
* @see GetLeftMappingTableFields()
|
|
4156
|
+
* @see SetRightMappingTableFields()
|
|
4157
|
+
*/
|
|
4158
|
+
void SetLeftMappingTableFields(const std::vector<std::string> &osListFields)
|
|
4159
|
+
{
|
|
4160
|
+
m_osListLeftMappingTableFields = osListFields;
|
|
4161
|
+
}
|
|
4162
|
+
|
|
4163
|
+
/** Sets the names of the mapping table fields which correspond to the
|
|
4164
|
+
* participating fields from the right table in the relationship.
|
|
4165
|
+
*
|
|
4166
|
+
* @see GetRightMappingTableFields()
|
|
4167
|
+
* @see SetLeftMappingTableFields()
|
|
4168
|
+
*/
|
|
4169
|
+
void
|
|
4170
|
+
SetRightMappingTableFields(const std::vector<std::string> &osListFields)
|
|
4171
|
+
{
|
|
4172
|
+
m_osListRightMappingTableFields = osListFields;
|
|
4173
|
+
}
|
|
4174
|
+
|
|
4175
|
+
/** Get the type of the relationship.
|
|
4176
|
+
*
|
|
4177
|
+
* @see SetType()
|
|
4178
|
+
*/
|
|
4179
|
+
GDALRelationshipType GetType() const
|
|
4180
|
+
{
|
|
4181
|
+
return m_eType;
|
|
4182
|
+
}
|
|
4183
|
+
|
|
4184
|
+
/** Sets the type of the relationship.
|
|
4185
|
+
*
|
|
4186
|
+
* @see GetType()
|
|
4187
|
+
*/
|
|
4188
|
+
void SetType(GDALRelationshipType eType)
|
|
4189
|
+
{
|
|
4190
|
+
m_eType = eType;
|
|
4191
|
+
}
|
|
4192
|
+
|
|
4193
|
+
/** Get the label of the forward path for the relationship.
|
|
4194
|
+
*
|
|
4195
|
+
* The forward and backward path labels are free-form, user-friendly strings
|
|
4196
|
+
* which can be used to generate descriptions of the relationship between
|
|
4197
|
+
* features from the right and left tables.
|
|
4198
|
+
*
|
|
4199
|
+
* E.g. when the left table contains buildings and the right table contains
|
|
4200
|
+
* furniture, the forward path label could be "contains" and the backward
|
|
4201
|
+
* path label could be "is located within". A client could then generate a
|
|
4202
|
+
* user friendly description string such as "fire hose 1234 is located
|
|
4203
|
+
* within building 15a".
|
|
4204
|
+
*
|
|
4205
|
+
* @see SetForwardPathLabel()
|
|
4206
|
+
* @see GetBackwardPathLabel()
|
|
4207
|
+
*/
|
|
4208
|
+
const std::string &GetForwardPathLabel() const
|
|
4209
|
+
{
|
|
4210
|
+
return m_osForwardPathLabel;
|
|
4211
|
+
}
|
|
4212
|
+
|
|
4213
|
+
/** Sets the label of the forward path for the relationship.
|
|
4214
|
+
*
|
|
4215
|
+
* The forward and backward path labels are free-form, user-friendly strings
|
|
4216
|
+
* which can be used to generate descriptions of the relationship between
|
|
4217
|
+
* features from the right and left tables.
|
|
4218
|
+
*
|
|
4219
|
+
* E.g. when the left table contains buildings and the right table contains
|
|
4220
|
+
* furniture, the forward path label could be "contains" and the backward
|
|
4221
|
+
* path label could be "is located within". A client could then generate a
|
|
4222
|
+
* user friendly description string such as "fire hose 1234 is located
|
|
4223
|
+
* within building 15a".
|
|
4224
|
+
*
|
|
4225
|
+
* @see GetForwardPathLabel()
|
|
4226
|
+
* @see SetBackwardPathLabel()
|
|
4227
|
+
*/
|
|
4228
|
+
void SetForwardPathLabel(const std::string &osLabel)
|
|
4229
|
+
{
|
|
4230
|
+
m_osForwardPathLabel = osLabel;
|
|
4231
|
+
}
|
|
4232
|
+
|
|
4233
|
+
/** Get the label of the backward path for the relationship.
|
|
4234
|
+
*
|
|
4235
|
+
* The forward and backward path labels are free-form, user-friendly strings
|
|
4236
|
+
* which can be used to generate descriptions of the relationship between
|
|
4237
|
+
* features from the right and left tables.
|
|
4238
|
+
*
|
|
4239
|
+
* E.g. when the left table contains buildings and the right table contains
|
|
4240
|
+
* furniture, the forward path label could be "contains" and the backward
|
|
4241
|
+
* path label could be "is located within". A client could then generate a
|
|
4242
|
+
* user friendly description string such as "fire hose 1234 is located
|
|
4243
|
+
* within building 15a".
|
|
4244
|
+
*
|
|
4245
|
+
* @see SetBackwardPathLabel()
|
|
4246
|
+
* @see GetForwardPathLabel()
|
|
4247
|
+
*/
|
|
4248
|
+
const std::string &GetBackwardPathLabel() const
|
|
4249
|
+
{
|
|
4250
|
+
return m_osBackwardPathLabel;
|
|
4251
|
+
}
|
|
4252
|
+
|
|
4253
|
+
/** Sets the label of the backward path for the relationship.
|
|
4254
|
+
*
|
|
4255
|
+
* The forward and backward path labels are free-form, user-friendly strings
|
|
4256
|
+
* which can be used to generate descriptions of the relationship between
|
|
4257
|
+
* features from the right and left tables.
|
|
4258
|
+
*
|
|
4259
|
+
* E.g. when the left table contains buildings and the right table contains
|
|
4260
|
+
* furniture, the forward path label could be "contains" and the backward
|
|
4261
|
+
* path label could be "is located within". A client could then generate a
|
|
4262
|
+
* user friendly description string such as "fire hose 1234 is located
|
|
4263
|
+
* within building 15a".
|
|
4264
|
+
*
|
|
4265
|
+
* @see GetBackwardPathLabel()
|
|
4266
|
+
* @see SetForwardPathLabel()
|
|
4267
|
+
*/
|
|
4268
|
+
void SetBackwardPathLabel(const std::string &osLabel)
|
|
4269
|
+
{
|
|
4270
|
+
m_osBackwardPathLabel = osLabel;
|
|
4271
|
+
}
|
|
4272
|
+
|
|
4273
|
+
/** Get the type string of the related table.
|
|
4274
|
+
*
|
|
4275
|
+
* This a free-form string representing the type of related features, where
|
|
4276
|
+
* the exact interpretation is format dependent. For instance, table types
|
|
4277
|
+
* from GeoPackage relationships will directly reflect the categories from
|
|
4278
|
+
* the GeoPackage related tables extension (i.e. "media", "simple
|
|
4279
|
+
* attributes", "features", "attributes" and "tiles").
|
|
4280
|
+
*
|
|
4281
|
+
* @see SetRelatedTableType()
|
|
4282
|
+
*/
|
|
4283
|
+
const std::string &GetRelatedTableType() const
|
|
4284
|
+
{
|
|
4285
|
+
return m_osRelatedTableType;
|
|
4286
|
+
}
|
|
4287
|
+
|
|
4288
|
+
/** Sets the type string of the related table.
|
|
4289
|
+
*
|
|
4290
|
+
* This a free-form string representing the type of related features, where
|
|
4291
|
+
* the exact interpretation is format dependent. For instance, table types
|
|
4292
|
+
* from GeoPackage relationships will directly reflect the categories from
|
|
4293
|
+
* the GeoPackage related tables extension (i.e. "media", "simple
|
|
4294
|
+
* attributes", "features", "attributes" and "tiles").
|
|
4295
|
+
*
|
|
4296
|
+
* @see GetRelatedTableType()
|
|
4297
|
+
*/
|
|
4298
|
+
void SetRelatedTableType(const std::string &osType)
|
|
4299
|
+
{
|
|
4300
|
+
m_osRelatedTableType = osType;
|
|
4301
|
+
}
|
|
4302
|
+
|
|
4303
|
+
/** Convert a GDALRelationship* to a GDALRelationshipH.
|
|
4304
|
+
*/
|
|
4305
|
+
static inline GDALRelationshipH ToHandle(GDALRelationship *poRelationship)
|
|
4306
|
+
{
|
|
4307
|
+
return static_cast<GDALRelationshipH>(poRelationship);
|
|
4308
|
+
}
|
|
4309
|
+
|
|
4310
|
+
/** Convert a GDALRelationshipH to a GDALRelationship*.
|
|
4311
|
+
*/
|
|
4312
|
+
static inline GDALRelationship *FromHandle(GDALRelationshipH hRelationship)
|
|
4313
|
+
{
|
|
4314
|
+
return static_cast<GDALRelationship *>(hRelationship);
|
|
4315
|
+
}
|
|
4316
|
+
};
|
|
4317
|
+
|
|
4318
|
+
/* ==================================================================== */
|
|
4319
|
+
/* An assortment of overview related stuff. */
|
|
4320
|
+
/* ==================================================================== */
|
|
4321
|
+
|
|
4322
|
+
//! @cond Doxygen_Suppress
|
|
4323
|
+
/* Only exported for drivers as plugin. Signature may change */
|
|
4324
|
+
CPLErr CPL_DLL GDALRegenerateOverviewsMultiBand(
|
|
4325
|
+
int nBands, GDALRasterBand *const *papoSrcBands, int nOverviews,
|
|
4326
|
+
GDALRasterBand *const *const *papapoOverviewBands,
|
|
4327
|
+
const char *pszResampling, GDALProgressFunc pfnProgress,
|
|
4328
|
+
void *pProgressData, CSLConstList papszOptions);
|
|
4329
|
+
|
|
4330
|
+
CPLErr CPL_DLL GDALRegenerateOverviewsMultiBand(
|
|
4331
|
+
const std::vector<GDALRasterBand *> &apoSrcBands,
|
|
4332
|
+
// First level of array is indexed by band (thus aapoOverviewBands.size() must be equal to apoSrcBands.size())
|
|
4333
|
+
// Second level is indexed by overview
|
|
4334
|
+
const std::vector<std::vector<GDALRasterBand *>> &aapoOverviewBands,
|
|
4335
|
+
const char *pszResampling, GDALProgressFunc pfnProgress,
|
|
4336
|
+
void *pProgressData, CSLConstList papszOptions);
|
|
4337
|
+
|
|
4338
|
+
/************************************************************************/
|
|
4339
|
+
/* GDALOverviewResampleArgs */
|
|
4340
|
+
/************************************************************************/
|
|
4341
|
+
|
|
4342
|
+
/** Arguments for overview resampling function. */
|
|
4343
|
+
// Should not contain any dataset/rasterband object, as this might be
|
|
4344
|
+
// read in a worker thread.
|
|
4345
|
+
struct GDALOverviewResampleArgs
|
|
4346
|
+
{
|
|
4347
|
+
//! Datatype of the source band argument
|
|
4348
|
+
GDALDataType eSrcDataType = GDT_Unknown;
|
|
4349
|
+
//! Datatype of the destination/overview band
|
|
4350
|
+
GDALDataType eOvrDataType = GDT_Unknown;
|
|
4351
|
+
//! Width in pixel of the destination/overview band
|
|
4352
|
+
int nOvrXSize = 0;
|
|
4353
|
+
//! Height in pixel of the destination/overview band
|
|
4354
|
+
int nOvrYSize = 0;
|
|
4355
|
+
//! NBITS value of the destination/overview band (or 0 if not set)
|
|
4356
|
+
int nOvrNBITS = 0;
|
|
4357
|
+
//! Factor to convert from destination X to source X
|
|
4358
|
+
// (source width divided by destination width)
|
|
4359
|
+
double dfXRatioDstToSrc = 0;
|
|
4360
|
+
//! Factor to convert from destination Y to source Y
|
|
4361
|
+
// (source height divided by destination height)
|
|
4362
|
+
double dfYRatioDstToSrc = 0;
|
|
4363
|
+
//! Sub-pixel delta to add to get source X
|
|
4364
|
+
double dfSrcXDelta = 0;
|
|
4365
|
+
//! Sub-pixel delta to add to get source Y
|
|
4366
|
+
double dfSrcYDelta = 0;
|
|
4367
|
+
//! Working data type (data type of the pChunk argument)
|
|
4368
|
+
GDALDataType eWrkDataType = GDT_Unknown;
|
|
4369
|
+
//! Array of nChunkXSize * nChunkYSize values of mask, or nullptr
|
|
4370
|
+
const GByte *pabyChunkNodataMask = nullptr;
|
|
4371
|
+
//! X offset of the source chunk in the source band
|
|
4372
|
+
int nChunkXOff = 0;
|
|
4373
|
+
//! Width in pixel of the source chunk in the source band
|
|
4374
|
+
int nChunkXSize = 0;
|
|
4375
|
+
//! Y offset of the source chunk in the source band
|
|
4376
|
+
int nChunkYOff = 0;
|
|
4377
|
+
//! Height in pixel of the source chunk in the source band
|
|
4378
|
+
int nChunkYSize = 0;
|
|
4379
|
+
//! X Offset of the destination chunk in the destination band
|
|
4380
|
+
int nDstXOff = 0;
|
|
4381
|
+
//! X Offset of the end (not included) of the destination chunk in the destination band
|
|
4382
|
+
int nDstXOff2 = 0;
|
|
4383
|
+
//! Y Offset of the destination chunk in the destination band
|
|
4384
|
+
int nDstYOff = 0;
|
|
4385
|
+
//! Y Offset of the end (not included) of the destination chunk in the destination band
|
|
4386
|
+
int nDstYOff2 = 0;
|
|
4387
|
+
//! Resampling method
|
|
4388
|
+
const char *pszResampling = nullptr;
|
|
4389
|
+
//! Whether the source band has a nodata value
|
|
4390
|
+
bool bHasNoData = false;
|
|
4391
|
+
//! Source band nodata value
|
|
4392
|
+
double dfNoDataValue = 0;
|
|
4393
|
+
//! Source color table
|
|
4394
|
+
const GDALColorTable *poColorTable = nullptr;
|
|
4395
|
+
//! Whether a single contributing source pixel at nodata should result
|
|
4396
|
+
// in the target pixel to be at nodata too (only taken into account by
|
|
4397
|
+
// average resampling)
|
|
4398
|
+
bool bPropagateNoData = false;
|
|
4399
|
+
};
|
|
4400
|
+
|
|
4401
|
+
typedef CPLErr (*GDALResampleFunction)(const GDALOverviewResampleArgs &args,
|
|
4402
|
+
const void *pChunk, void **ppDstBuffer,
|
|
4403
|
+
GDALDataType *peDstBufferDataType);
|
|
4404
|
+
|
|
4405
|
+
GDALResampleFunction GDALGetResampleFunction(const char *pszResampling,
|
|
4406
|
+
int *pnRadius);
|
|
4407
|
+
|
|
4408
|
+
std::string CPL_DLL GDALGetNormalizedOvrResampling(const char *pszResampling);
|
|
4409
|
+
|
|
4410
|
+
GDALDataType GDALGetOvrWorkDataType(const char *pszResampling,
|
|
4411
|
+
GDALDataType eSrcDataType);
|
|
4412
|
+
|
|
4413
|
+
CPL_C_START
|
|
4414
|
+
|
|
4415
|
+
CPLErr CPL_DLL
|
|
4416
|
+
HFAAuxBuildOverviews(const char *pszOvrFilename, GDALDataset *poParentDS,
|
|
4417
|
+
GDALDataset **ppoDS, int nBands, const int *panBandList,
|
|
4418
|
+
int nNewOverviews, const int *panNewOverviewList,
|
|
4419
|
+
const char *pszResampling, GDALProgressFunc pfnProgress,
|
|
4420
|
+
void *pProgressData, CSLConstList papszOptions);
|
|
4421
|
+
|
|
4422
|
+
CPLErr CPL_DLL GTIFFBuildOverviews(const char *pszFilename, int nBands,
|
|
4423
|
+
GDALRasterBand *const *papoBandList,
|
|
4424
|
+
int nOverviews, const int *panOverviewList,
|
|
4425
|
+
const char *pszResampling,
|
|
4426
|
+
GDALProgressFunc pfnProgress,
|
|
4427
|
+
void *pProgressData,
|
|
4428
|
+
CSLConstList papszOptions);
|
|
4429
|
+
|
|
4430
|
+
int CPL_DLL GDALBandGetBestOverviewLevel(GDALRasterBand *poBand, int &nXOff,
|
|
4431
|
+
int &nYOff, int &nXSize, int &nYSize,
|
|
4432
|
+
int nBufXSize, int nBufYSize)
|
|
4433
|
+
CPL_WARN_DEPRECATED("Use GDALBandGetBestOverviewLevel2 instead");
|
|
4434
|
+
int CPL_DLL GDALBandGetBestOverviewLevel2(GDALRasterBand *poBand, int &nXOff,
|
|
4435
|
+
int &nYOff, int &nXSize, int &nYSize,
|
|
4436
|
+
int nBufXSize, int nBufYSize,
|
|
4437
|
+
GDALRasterIOExtraArg *psExtraArg);
|
|
4438
|
+
|
|
4439
|
+
int CPL_DLL GDALOvLevelAdjust(int nOvLevel, int nXSize)
|
|
4440
|
+
CPL_WARN_DEPRECATED("Use GDALOvLevelAdjust2 instead");
|
|
4441
|
+
int CPL_DLL GDALOvLevelAdjust2(int nOvLevel, int nXSize, int nYSize);
|
|
4442
|
+
int CPL_DLL GDALComputeOvFactor(int nOvrXSize, int nRasterXSize, int nOvrYSize,
|
|
4443
|
+
int nRasterYSize);
|
|
4444
|
+
|
|
4445
|
+
GDALDataset CPL_DLL *GDALFindAssociatedAuxFile(const char *pszBasefile,
|
|
4446
|
+
GDALAccess eAccess,
|
|
4447
|
+
GDALDataset *poDependentDS);
|
|
4448
|
+
|
|
4449
|
+
/* ==================================================================== */
|
|
4450
|
+
/* Infrastructure to check that dataset characteristics are valid */
|
|
4451
|
+
/* ==================================================================== */
|
|
4452
|
+
|
|
4453
|
+
int CPL_DLL GDALCheckDatasetDimensions(int nXSize, int nYSize);
|
|
4454
|
+
int CPL_DLL GDALCheckBandCount(int nBands, int bIsZeroAllowed);
|
|
4455
|
+
|
|
4456
|
+
/* Internal use only */
|
|
4457
|
+
|
|
4458
|
+
/* CPL_DLL exported, but only for in-tree drivers that can be built as plugins
|
|
4459
|
+
*/
|
|
4460
|
+
int CPL_DLL GDALReadWorldFile2(const char *pszBaseFilename,
|
|
4461
|
+
const char *pszExtension,
|
|
4462
|
+
double *padfGeoTransform,
|
|
4463
|
+
CSLConstList papszSiblingFiles,
|
|
4464
|
+
char **ppszWorldFileNameOut);
|
|
4465
|
+
int CPL_DLL GDALReadTabFile2(const char *pszBaseFilename,
|
|
4466
|
+
double *padfGeoTransform, char **ppszWKT,
|
|
4467
|
+
int *pnGCPCount, GDAL_GCP **ppasGCPs,
|
|
4468
|
+
CSLConstList papszSiblingFiles,
|
|
4469
|
+
char **ppszTabFileNameOut);
|
|
4470
|
+
|
|
4471
|
+
void CPL_DLL GDALCopyRasterIOExtraArg(GDALRasterIOExtraArg *psDestArg,
|
|
4472
|
+
GDALRasterIOExtraArg *psSrcArg);
|
|
4473
|
+
|
|
4474
|
+
CPL_C_END
|
|
4475
|
+
|
|
4476
|
+
std::unique_ptr<GDALDataset> CPL_DLL
|
|
4477
|
+
GDALGetThreadSafeDataset(std::unique_ptr<GDALDataset> poDS, int nScopeFlags);
|
|
4478
|
+
|
|
4479
|
+
GDALDataset CPL_DLL *GDALGetThreadSafeDataset(GDALDataset *poDS,
|
|
4480
|
+
int nScopeFlags);
|
|
4481
|
+
|
|
4482
|
+
void GDALNullifyOpenDatasetsList();
|
|
4483
|
+
CPLMutex **GDALGetphDMMutex();
|
|
4484
|
+
CPLMutex **GDALGetphDLMutex();
|
|
4485
|
+
void GDALNullifyProxyPoolSingleton();
|
|
4486
|
+
void GDALSetResponsiblePIDForCurrentThread(GIntBig responsiblePID);
|
|
4487
|
+
GIntBig GDALGetResponsiblePIDForCurrentThread();
|
|
4488
|
+
|
|
4489
|
+
CPLString GDALFindAssociatedFile(const char *pszBasename, const char *pszExt,
|
|
4490
|
+
CSLConstList papszSiblingFiles, int nFlags);
|
|
4491
|
+
|
|
4492
|
+
CPLErr CPL_DLL EXIFExtractMetadata(char **&papszMetadata, void *fpL,
|
|
4493
|
+
int nOffset, int bSwabflag, int nTIFFHEADER,
|
|
4494
|
+
int &nExifOffset, int &nInterOffset,
|
|
4495
|
+
int &nGPSOffset);
|
|
4496
|
+
|
|
4497
|
+
int GDALValidateOpenOptions(GDALDriverH hDriver,
|
|
4498
|
+
const char *const *papszOptionOptions);
|
|
4499
|
+
int GDALValidateOptions(const char *pszOptionList,
|
|
4500
|
+
const char *const *papszOptionsToValidate,
|
|
4501
|
+
const char *pszErrorMessageOptionType,
|
|
4502
|
+
const char *pszErrorMessageContainerName);
|
|
4503
|
+
|
|
4504
|
+
GDALRIOResampleAlg CPL_DLL
|
|
4505
|
+
GDALRasterIOGetResampleAlg(const char *pszResampling);
|
|
4506
|
+
const char *GDALRasterIOGetResampleAlg(GDALRIOResampleAlg eResampleAlg);
|
|
4507
|
+
|
|
4508
|
+
void GDALRasterIOExtraArgSetResampleAlg(GDALRasterIOExtraArg *psExtraArg,
|
|
4509
|
+
int nXSize, int nYSize, int nBufXSize,
|
|
4510
|
+
int nBufYSize);
|
|
4511
|
+
|
|
4512
|
+
GDALDataset *GDALCreateOverviewDataset(GDALDataset *poDS, int nOvrLevel,
|
|
4513
|
+
bool bThisLevelOnly);
|
|
4514
|
+
|
|
4515
|
+
// Should cover particular cases of #3573, #4183, #4506, #6578
|
|
4516
|
+
// Behavior is undefined if fVal1 or fVal2 are NaN (should be tested before
|
|
4517
|
+
// calling this function)
|
|
4518
|
+
template <class T> inline bool ARE_REAL_EQUAL(T fVal1, T fVal2, int ulp = 2)
|
|
4519
|
+
{
|
|
4520
|
+
return fVal1 == fVal2 || /* Should cover infinity */
|
|
4521
|
+
std::abs(fVal1 - fVal2) < std::numeric_limits<float>::epsilon() *
|
|
4522
|
+
std::abs(fVal1 + fVal2) * ulp;
|
|
4523
|
+
}
|
|
4524
|
+
|
|
4525
|
+
double GDALAdjustNoDataCloseToFloatMax(double dfVal);
|
|
4526
|
+
|
|
4527
|
+
#define DIV_ROUND_UP(a, b) (((a) % (b)) == 0 ? ((a) / (b)) : (((a) / (b)) + 1))
|
|
4528
|
+
|
|
4529
|
+
// Number of data samples that will be used to compute approximate statistics
|
|
4530
|
+
// (minimum value, maximum value, etc.)
|
|
4531
|
+
#define GDALSTAT_APPROX_NUMSAMPLES 2500
|
|
4532
|
+
|
|
4533
|
+
void GDALSerializeGCPListToXML(CPLXMLNode *psParentNode,
|
|
4534
|
+
const std::vector<gdal::GCP> &asGCPs,
|
|
4535
|
+
const OGRSpatialReference *poGCP_SRS);
|
|
4536
|
+
void GDALDeserializeGCPListFromXML(const CPLXMLNode *psGCPList,
|
|
4537
|
+
std::vector<gdal::GCP> &asGCPs,
|
|
4538
|
+
OGRSpatialReference **ppoGCP_SRS);
|
|
4539
|
+
|
|
4540
|
+
void GDALSerializeOpenOptionsToXML(CPLXMLNode *psParentNode,
|
|
4541
|
+
CSLConstList papszOpenOptions);
|
|
4542
|
+
char CPL_DLL **
|
|
4543
|
+
GDALDeserializeOpenOptionsFromXML(const CPLXMLNode *psParentNode);
|
|
4544
|
+
|
|
4545
|
+
int GDALCanFileAcceptSidecarFile(const char *pszFilename);
|
|
4546
|
+
|
|
4547
|
+
bool GDALCanReliablyUseSiblingFileList(const char *pszFilename);
|
|
4548
|
+
|
|
4549
|
+
typedef enum
|
|
4550
|
+
{
|
|
4551
|
+
GSF_UNSIGNED_INT,
|
|
4552
|
+
GSF_SIGNED_INT,
|
|
4553
|
+
GSF_FLOATING_POINT,
|
|
4554
|
+
} GDALBufferSampleFormat;
|
|
4555
|
+
|
|
4556
|
+
bool CPL_DLL GDALBufferHasOnlyNoData(const void *pBuffer, double dfNoDataValue,
|
|
4557
|
+
size_t nWidth, size_t nHeight,
|
|
4558
|
+
size_t nLineStride, size_t nComponents,
|
|
4559
|
+
int nBitsPerSample,
|
|
4560
|
+
GDALBufferSampleFormat nSampleFormat);
|
|
4561
|
+
|
|
4562
|
+
void CPL_DLL GDALCopyNoDataValue(GDALRasterBand *poDstBand,
|
|
4563
|
+
GDALRasterBand *poSrcBand);
|
|
4564
|
+
|
|
4565
|
+
double CPL_DLL GDALGetNoDataValueCastToDouble(int64_t nVal);
|
|
4566
|
+
double CPL_DLL GDALGetNoDataValueCastToDouble(uint64_t nVal);
|
|
4567
|
+
|
|
4568
|
+
// Remove me in GDAL 4.0. See GetMetadataItem() implementation
|
|
4569
|
+
// Internal use in GDAL only !
|
|
4570
|
+
// Declaration copied in swig/include/gdal.i
|
|
4571
|
+
void CPL_DLL GDALEnablePixelTypeSignedByteWarning(GDALRasterBandH hBand,
|
|
4572
|
+
bool b);
|
|
4573
|
+
|
|
4574
|
+
std::string CPL_DLL GDALGetCompressionFormatForJPEG(VSILFILE *fp);
|
|
4575
|
+
std::string CPL_DLL GDALGetCompressionFormatForJPEG(const void *pBuffer,
|
|
4576
|
+
size_t nBufferSize);
|
|
4577
|
+
|
|
4578
|
+
GDALRasterAttributeTable CPL_DLL *GDALCreateRasterAttributeTableFromMDArrays(
|
|
4579
|
+
GDALRATTableType eTableType,
|
|
4580
|
+
const std::vector<std::shared_ptr<GDALMDArray>> &apoArrays,
|
|
4581
|
+
const std::vector<GDALRATFieldUsage> &aeUsages);
|
|
4582
|
+
|
|
4583
|
+
GDALColorInterp CPL_DLL
|
|
4584
|
+
GDALGetColorInterpFromSTACCommonName(const char *pszName);
|
|
4585
|
+
const char CPL_DLL *
|
|
4586
|
+
GDALGetSTACCommonNameFromColorInterp(GDALColorInterp eInterp);
|
|
4587
|
+
|
|
4588
|
+
// Macro used so that Identify and driver metadata methods in drivers built
|
|
4589
|
+
// as plugin can be duplicated in libgdal core and in the driver under different
|
|
4590
|
+
// names
|
|
4591
|
+
#ifdef PLUGIN_FILENAME
|
|
4592
|
+
#define PLUGIN_SYMBOL_NAME(x) GDAL_core_##x
|
|
4593
|
+
#else
|
|
4594
|
+
#define PLUGIN_SYMBOL_NAME(x) GDAL_driver_##x
|
|
4595
|
+
#endif
|
|
4596
|
+
|
|
4597
|
+
//! @endcond
|
|
4598
|
+
|
|
4599
|
+
#endif /* ndef GDAL_PRIV_H_INCLUDED */
|