@cpp.js/package-gdal 1.0.0-beta.22 → 1.0.0

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.
Files changed (255) hide show
  1. package/CHANGELOG.md +38 -0
  2. package/README.md +1 -1
  3. package/cppjs.build.js +1 -0
  4. package/dist/prebuilt/Android-arm64-v8a/include/gdal_version.h +3 -3
  5. package/dist/prebuilt/Android-arm64-v8a/include/ogr_api.h +4 -4
  6. package/dist/prebuilt/Android-arm64-v8a/include/ogr_feature.h +2 -2
  7. package/dist/prebuilt/Android-arm64-v8a/lib/cmake/gdal/GDALConfigVersion.cmake +3 -3
  8. package/dist/prebuilt/Android-arm64-v8a/lib/libgdal.so +0 -0
  9. package/dist/prebuilt/Android-arm64-v8a/lib/pkgconfig/gdal.pc +1 -1
  10. package/dist/prebuilt/Android-arm64-v8a/share/gdal/gdalvrt.xsd +30 -24
  11. package/dist/prebuilt/Android-x86_64/include/cpl_atomic_ops.h +90 -0
  12. package/dist/prebuilt/Android-x86_64/include/cpl_auto_close.h +73 -0
  13. package/dist/prebuilt/Android-x86_64/include/cpl_compressor.h +112 -0
  14. package/dist/prebuilt/Android-x86_64/include/cpl_config.h +215 -0
  15. package/dist/prebuilt/Android-x86_64/include/cpl_config_extras.h +34 -0
  16. package/dist/prebuilt/Android-x86_64/include/cpl_conv.h +417 -0
  17. package/dist/prebuilt/Android-x86_64/include/cpl_csv.h +71 -0
  18. package/dist/prebuilt/Android-x86_64/include/cpl_error.h +344 -0
  19. package/dist/prebuilt/Android-x86_64/include/cpl_hash_set.h +83 -0
  20. package/dist/prebuilt/Android-x86_64/include/cpl_http.h +319 -0
  21. package/dist/prebuilt/Android-x86_64/include/cpl_json.h +301 -0
  22. package/dist/prebuilt/Android-x86_64/include/cpl_list.h +59 -0
  23. package/dist/prebuilt/Android-x86_64/include/cpl_minixml.h +211 -0
  24. package/dist/prebuilt/Android-x86_64/include/cpl_multiproc.h +241 -0
  25. package/dist/prebuilt/Android-x86_64/include/cpl_port.h +1182 -0
  26. package/dist/prebuilt/Android-x86_64/include/cpl_progress.h +49 -0
  27. package/dist/prebuilt/Android-x86_64/include/cpl_quad_tree.h +105 -0
  28. package/dist/prebuilt/Android-x86_64/include/cpl_spawn.h +60 -0
  29. package/dist/prebuilt/Android-x86_64/include/cpl_string.h +863 -0
  30. package/dist/prebuilt/Android-x86_64/include/cpl_time.h +29 -0
  31. package/dist/prebuilt/Android-x86_64/include/cpl_virtualmem.h +365 -0
  32. package/dist/prebuilt/Android-x86_64/include/cpl_vsi.h +830 -0
  33. package/dist/prebuilt/Android-x86_64/include/cpl_vsi_error.h +55 -0
  34. package/dist/prebuilt/Android-x86_64/include/cpl_vsi_virtual.h +580 -0
  35. package/dist/prebuilt/Android-x86_64/include/cplkeywordparser.h +61 -0
  36. package/dist/prebuilt/Android-x86_64/include/gdal.h +2667 -0
  37. package/dist/prebuilt/Android-x86_64/include/gdal_alg.h +717 -0
  38. package/dist/prebuilt/Android-x86_64/include/gdal_alg_priv.h +386 -0
  39. package/dist/prebuilt/Android-x86_64/include/gdal_csv.h +25 -0
  40. package/dist/prebuilt/Android-x86_64/include/gdal_frmts.h +236 -0
  41. package/dist/prebuilt/Android-x86_64/include/gdal_mdreader.h +240 -0
  42. package/dist/prebuilt/Android-x86_64/include/gdal_pam.h +461 -0
  43. package/dist/prebuilt/Android-x86_64/include/gdal_priv.h +4599 -0
  44. package/dist/prebuilt/Android-x86_64/include/gdal_proxy.h +470 -0
  45. package/dist/prebuilt/Android-x86_64/include/gdal_rat.h +390 -0
  46. package/dist/prebuilt/Android-x86_64/include/gdal_simplesurf.h +579 -0
  47. package/dist/prebuilt/Android-x86_64/include/gdal_utils.h +313 -0
  48. package/dist/prebuilt/Android-x86_64/include/gdal_version.h +33 -0
  49. package/dist/prebuilt/Android-x86_64/include/gdal_vrt.h +89 -0
  50. package/dist/prebuilt/Android-x86_64/include/gdalcachedpixelaccessor.h +439 -0
  51. package/dist/prebuilt/Android-x86_64/include/gdalgeorefpamdataset.h +73 -0
  52. package/dist/prebuilt/Android-x86_64/include/gdalgrid.h +102 -0
  53. package/dist/prebuilt/Android-x86_64/include/gdalgrid_priv.h +67 -0
  54. package/dist/prebuilt/Android-x86_64/include/gdaljp2abstractdataset.h +61 -0
  55. package/dist/prebuilt/Android-x86_64/include/gdaljp2metadata.h +237 -0
  56. package/dist/prebuilt/Android-x86_64/include/gdalpansharpen.h +258 -0
  57. package/dist/prebuilt/Android-x86_64/include/gdalsubdatasetinfo.h +104 -0
  58. package/dist/prebuilt/Android-x86_64/include/gdalwarper.h +622 -0
  59. package/dist/prebuilt/Android-x86_64/include/gnm.h +750 -0
  60. package/dist/prebuilt/Android-x86_64/include/gnm_api.h +101 -0
  61. package/dist/prebuilt/Android-x86_64/include/gnmgraph.h +258 -0
  62. package/dist/prebuilt/Android-x86_64/include/memdataset.h +176 -0
  63. package/dist/prebuilt/Android-x86_64/include/ogr_api.h +1024 -0
  64. package/dist/prebuilt/Android-x86_64/include/ogr_core.h +1321 -0
  65. package/dist/prebuilt/Android-x86_64/include/ogr_feature.h +1981 -0
  66. package/dist/prebuilt/Android-x86_64/include/ogr_featurestyle.h +858 -0
  67. package/dist/prebuilt/Android-x86_64/include/ogr_geocoding.h +46 -0
  68. package/dist/prebuilt/Android-x86_64/include/ogr_geomcoordinateprecision.h +79 -0
  69. package/dist/prebuilt/Android-x86_64/include/ogr_geometry.h +4346 -0
  70. package/dist/prebuilt/Android-x86_64/include/ogr_p.h +324 -0
  71. package/dist/prebuilt/Android-x86_64/include/ogr_recordbatch.h +125 -0
  72. package/dist/prebuilt/Android-x86_64/include/ogr_spatialref.h +1007 -0
  73. package/dist/prebuilt/Android-x86_64/include/ogr_srs_api.h +1088 -0
  74. package/dist/prebuilt/Android-x86_64/include/ogr_swq.h +529 -0
  75. package/dist/prebuilt/Android-x86_64/include/ogrsf_frmts.h +746 -0
  76. package/dist/prebuilt/Android-x86_64/include/rawdataset.h +255 -0
  77. package/dist/prebuilt/Android-x86_64/include/vrtdataset.h +2426 -0
  78. package/dist/prebuilt/Android-x86_64/lib/cmake/gdal/GDAL-targets-release.cmake +19 -0
  79. package/dist/prebuilt/Android-x86_64/lib/cmake/gdal/GDAL-targets.cmake +106 -0
  80. package/dist/prebuilt/Android-x86_64/lib/cmake/gdal/GDALConfig.cmake +21 -0
  81. package/dist/prebuilt/Android-x86_64/lib/cmake/gdal/GDALConfigVersion.cmake +85 -0
  82. package/dist/prebuilt/Android-x86_64/lib/gdalplugins/drivers.ini +290 -0
  83. package/dist/prebuilt/Android-x86_64/lib/libgdal.so +0 -0
  84. package/dist/prebuilt/Android-x86_64/lib/pkgconfig/gdal.pc +17 -0
  85. package/dist/prebuilt/Android-x86_64/share/gdal/GDALLogoBW.svg +138 -0
  86. package/dist/prebuilt/Android-x86_64/share/gdal/GDALLogoColor.svg +126 -0
  87. package/dist/prebuilt/Android-x86_64/share/gdal/GDALLogoGS.svg +126 -0
  88. package/dist/prebuilt/Android-x86_64/share/gdal/LICENSE.TXT +467 -0
  89. package/dist/prebuilt/Android-x86_64/share/gdal/MM_m_idofic.csv +321 -0
  90. package/dist/prebuilt/Android-x86_64/share/gdal/cubewerx_extra.wkt +48 -0
  91. package/dist/prebuilt/Android-x86_64/share/gdal/default.rsc +0 -0
  92. package/dist/prebuilt/Android-x86_64/share/gdal/ecw_cs.wkt +1453 -0
  93. package/dist/prebuilt/Android-x86_64/share/gdal/epsg.wkt +1 -0
  94. package/dist/prebuilt/Android-x86_64/share/gdal/esri_StatePlane_extra.wkt +631 -0
  95. package/dist/prebuilt/Android-x86_64/share/gdal/gdalicon.png +0 -0
  96. package/dist/prebuilt/Android-x86_64/share/gdal/gdalinfo_output.schema.json +346 -0
  97. package/dist/prebuilt/Android-x86_64/share/gdal/gdalmdiminfo_output.schema.json +321 -0
  98. package/dist/prebuilt/Android-x86_64/share/gdal/gdaltileindex.xsd +253 -0
  99. package/dist/prebuilt/Android-x86_64/share/gdal/gdalvrt.xsd +887 -0
  100. package/dist/prebuilt/Android-x86_64/share/gdal/gfs.xsd +246 -0
  101. package/dist/prebuilt/Android-x86_64/share/gdal/gml_registry.xml +117 -0
  102. package/dist/prebuilt/Android-x86_64/share/gdal/gml_registry.xsd +66 -0
  103. package/dist/prebuilt/Android-x86_64/share/gdal/grib2_center.csv +251 -0
  104. package/dist/prebuilt/Android-x86_64/share/gdal/grib2_process.csv +102 -0
  105. package/dist/prebuilt/Android-x86_64/share/gdal/grib2_subcenter.csv +63 -0
  106. package/dist/prebuilt/Android-x86_64/share/gdal/grib2_table_4_2_0_0.csv +261 -0
  107. package/dist/prebuilt/Android-x86_64/share/gdal/grib2_table_4_2_0_1.csv +261 -0
  108. package/dist/prebuilt/Android-x86_64/share/gdal/grib2_table_4_2_0_13.csv +261 -0
  109. package/dist/prebuilt/Android-x86_64/share/gdal/grib2_table_4_2_0_14.csv +261 -0
  110. package/dist/prebuilt/Android-x86_64/share/gdal/grib2_table_4_2_0_15.csv +261 -0
  111. package/dist/prebuilt/Android-x86_64/share/gdal/grib2_table_4_2_0_16.csv +261 -0
  112. package/dist/prebuilt/Android-x86_64/share/gdal/grib2_table_4_2_0_17.csv +11 -0
  113. package/dist/prebuilt/Android-x86_64/share/gdal/grib2_table_4_2_0_18.csv +261 -0
  114. package/dist/prebuilt/Android-x86_64/share/gdal/grib2_table_4_2_0_19.csv +261 -0
  115. package/dist/prebuilt/Android-x86_64/share/gdal/grib2_table_4_2_0_190.csv +261 -0
  116. package/dist/prebuilt/Android-x86_64/share/gdal/grib2_table_4_2_0_191.csv +261 -0
  117. package/dist/prebuilt/Android-x86_64/share/gdal/grib2_table_4_2_0_2.csv +261 -0
  118. package/dist/prebuilt/Android-x86_64/share/gdal/grib2_table_4_2_0_20.csv +261 -0
  119. package/dist/prebuilt/Android-x86_64/share/gdal/grib2_table_4_2_0_21.csv +261 -0
  120. package/dist/prebuilt/Android-x86_64/share/gdal/grib2_table_4_2_0_3.csv +261 -0
  121. package/dist/prebuilt/Android-x86_64/share/gdal/grib2_table_4_2_0_4.csv +261 -0
  122. package/dist/prebuilt/Android-x86_64/share/gdal/grib2_table_4_2_0_5.csv +261 -0
  123. package/dist/prebuilt/Android-x86_64/share/gdal/grib2_table_4_2_0_6.csv +261 -0
  124. package/dist/prebuilt/Android-x86_64/share/gdal/grib2_table_4_2_0_7.csv +261 -0
  125. package/dist/prebuilt/Android-x86_64/share/gdal/grib2_table_4_2_10_0.csv +261 -0
  126. package/dist/prebuilt/Android-x86_64/share/gdal/grib2_table_4_2_10_1.csv +261 -0
  127. package/dist/prebuilt/Android-x86_64/share/gdal/grib2_table_4_2_10_191.csv +261 -0
  128. package/dist/prebuilt/Android-x86_64/share/gdal/grib2_table_4_2_10_2.csv +261 -0
  129. package/dist/prebuilt/Android-x86_64/share/gdal/grib2_table_4_2_10_3.csv +261 -0
  130. package/dist/prebuilt/Android-x86_64/share/gdal/grib2_table_4_2_10_4.csv +261 -0
  131. package/dist/prebuilt/Android-x86_64/share/gdal/grib2_table_4_2_1_0.csv +261 -0
  132. package/dist/prebuilt/Android-x86_64/share/gdal/grib2_table_4_2_1_1.csv +261 -0
  133. package/dist/prebuilt/Android-x86_64/share/gdal/grib2_table_4_2_1_2.csv +261 -0
  134. package/dist/prebuilt/Android-x86_64/share/gdal/grib2_table_4_2_20_0.csv +261 -0
  135. package/dist/prebuilt/Android-x86_64/share/gdal/grib2_table_4_2_20_1.csv +261 -0
  136. package/dist/prebuilt/Android-x86_64/share/gdal/grib2_table_4_2_20_2.csv +261 -0
  137. package/dist/prebuilt/Android-x86_64/share/gdal/grib2_table_4_2_2_0.csv +261 -0
  138. package/dist/prebuilt/Android-x86_64/share/gdal/grib2_table_4_2_2_3.csv +261 -0
  139. package/dist/prebuilt/Android-x86_64/share/gdal/grib2_table_4_2_2_4.csv +261 -0
  140. package/dist/prebuilt/Android-x86_64/share/gdal/grib2_table_4_2_2_5.csv +261 -0
  141. package/dist/prebuilt/Android-x86_64/share/gdal/grib2_table_4_2_2_6.csv +261 -0
  142. package/dist/prebuilt/Android-x86_64/share/gdal/grib2_table_4_2_3_0.csv +261 -0
  143. package/dist/prebuilt/Android-x86_64/share/gdal/grib2_table_4_2_3_1.csv +261 -0
  144. package/dist/prebuilt/Android-x86_64/share/gdal/grib2_table_4_2_3_2.csv +28 -0
  145. package/dist/prebuilt/Android-x86_64/share/gdal/grib2_table_4_2_3_3.csv +8 -0
  146. package/dist/prebuilt/Android-x86_64/share/gdal/grib2_table_4_2_3_4.csv +14 -0
  147. package/dist/prebuilt/Android-x86_64/share/gdal/grib2_table_4_2_3_5.csv +11 -0
  148. package/dist/prebuilt/Android-x86_64/share/gdal/grib2_table_4_2_3_6.csv +11 -0
  149. package/dist/prebuilt/Android-x86_64/share/gdal/grib2_table_4_2_4_0.csv +261 -0
  150. package/dist/prebuilt/Android-x86_64/share/gdal/grib2_table_4_2_4_1.csv +261 -0
  151. package/dist/prebuilt/Android-x86_64/share/gdal/grib2_table_4_2_4_10.csv +261 -0
  152. package/dist/prebuilt/Android-x86_64/share/gdal/grib2_table_4_2_4_2.csv +261 -0
  153. package/dist/prebuilt/Android-x86_64/share/gdal/grib2_table_4_2_4_3.csv +261 -0
  154. package/dist/prebuilt/Android-x86_64/share/gdal/grib2_table_4_2_4_4.csv +261 -0
  155. package/dist/prebuilt/Android-x86_64/share/gdal/grib2_table_4_2_4_5.csv +261 -0
  156. package/dist/prebuilt/Android-x86_64/share/gdal/grib2_table_4_2_4_6.csv +261 -0
  157. package/dist/prebuilt/Android-x86_64/share/gdal/grib2_table_4_2_4_7.csv +261 -0
  158. package/dist/prebuilt/Android-x86_64/share/gdal/grib2_table_4_2_4_8.csv +261 -0
  159. package/dist/prebuilt/Android-x86_64/share/gdal/grib2_table_4_2_4_9.csv +261 -0
  160. package/dist/prebuilt/Android-x86_64/share/gdal/grib2_table_4_2_local_Canada.csv +5 -0
  161. package/dist/prebuilt/Android-x86_64/share/gdal/grib2_table_4_2_local_HPC.csv +2 -0
  162. package/dist/prebuilt/Android-x86_64/share/gdal/grib2_table_4_2_local_MRMS.csv +175 -0
  163. package/dist/prebuilt/Android-x86_64/share/gdal/grib2_table_4_2_local_NCEP.csv +401 -0
  164. package/dist/prebuilt/Android-x86_64/share/gdal/grib2_table_4_2_local_NDFD.csv +38 -0
  165. package/dist/prebuilt/Android-x86_64/share/gdal/grib2_table_4_2_local_index.csv +7 -0
  166. package/dist/prebuilt/Android-x86_64/share/gdal/grib2_table_4_5.csv +261 -0
  167. package/dist/prebuilt/Android-x86_64/share/gdal/grib2_table_versions.csv +3 -0
  168. package/dist/prebuilt/Android-x86_64/share/gdal/gt_datum.csv +229 -0
  169. package/dist/prebuilt/Android-x86_64/share/gdal/gt_ellips.csv +24 -0
  170. package/dist/prebuilt/Android-x86_64/share/gdal/header.dxf +1124 -0
  171. package/dist/prebuilt/Android-x86_64/share/gdal/inspire_cp_BasicPropertyUnit.gfs +57 -0
  172. package/dist/prebuilt/Android-x86_64/share/gdal/inspire_cp_CadastralBoundary.gfs +60 -0
  173. package/dist/prebuilt/Android-x86_64/share/gdal/inspire_cp_CadastralParcel.gfs +81 -0
  174. package/dist/prebuilt/Android-x86_64/share/gdal/inspire_cp_CadastralZoning.gfs +161 -0
  175. package/dist/prebuilt/Android-x86_64/share/gdal/jpfgdgml_AdmArea.gfs +59 -0
  176. package/dist/prebuilt/Android-x86_64/share/gdal/jpfgdgml_AdmBdry.gfs +49 -0
  177. package/dist/prebuilt/Android-x86_64/share/gdal/jpfgdgml_AdmPt.gfs +59 -0
  178. package/dist/prebuilt/Android-x86_64/share/gdal/jpfgdgml_BldA.gfs +54 -0
  179. package/dist/prebuilt/Android-x86_64/share/gdal/jpfgdgml_BldL.gfs +54 -0
  180. package/dist/prebuilt/Android-x86_64/share/gdal/jpfgdgml_Cntr.gfs +54 -0
  181. package/dist/prebuilt/Android-x86_64/share/gdal/jpfgdgml_CommBdry.gfs +49 -0
  182. package/dist/prebuilt/Android-x86_64/share/gdal/jpfgdgml_CommPt.gfs +59 -0
  183. package/dist/prebuilt/Android-x86_64/share/gdal/jpfgdgml_Cstline.gfs +54 -0
  184. package/dist/prebuilt/Android-x86_64/share/gdal/jpfgdgml_ElevPt.gfs +54 -0
  185. package/dist/prebuilt/Android-x86_64/share/gdal/jpfgdgml_GCP.gfs +94 -0
  186. package/dist/prebuilt/Android-x86_64/share/gdal/jpfgdgml_LeveeEdge.gfs +49 -0
  187. package/dist/prebuilt/Android-x86_64/share/gdal/jpfgdgml_RailCL.gfs +54 -0
  188. package/dist/prebuilt/Android-x86_64/share/gdal/jpfgdgml_RdASL.gfs +44 -0
  189. package/dist/prebuilt/Android-x86_64/share/gdal/jpfgdgml_RdArea.gfs +54 -0
  190. package/dist/prebuilt/Android-x86_64/share/gdal/jpfgdgml_RdCompt.gfs +59 -0
  191. package/dist/prebuilt/Android-x86_64/share/gdal/jpfgdgml_RdEdg.gfs +59 -0
  192. package/dist/prebuilt/Android-x86_64/share/gdal/jpfgdgml_RdMgtBdry.gfs +49 -0
  193. package/dist/prebuilt/Android-x86_64/share/gdal/jpfgdgml_RdSgmtA.gfs +59 -0
  194. package/dist/prebuilt/Android-x86_64/share/gdal/jpfgdgml_RvrMgtBdry.gfs +49 -0
  195. package/dist/prebuilt/Android-x86_64/share/gdal/jpfgdgml_SBAPt.gfs +49 -0
  196. package/dist/prebuilt/Android-x86_64/share/gdal/jpfgdgml_SBArea.gfs +54 -0
  197. package/dist/prebuilt/Android-x86_64/share/gdal/jpfgdgml_SBBdry.gfs +44 -0
  198. package/dist/prebuilt/Android-x86_64/share/gdal/jpfgdgml_WA.gfs +54 -0
  199. package/dist/prebuilt/Android-x86_64/share/gdal/jpfgdgml_WL.gfs +54 -0
  200. package/dist/prebuilt/Android-x86_64/share/gdal/jpfgdgml_WStrA.gfs +54 -0
  201. package/dist/prebuilt/Android-x86_64/share/gdal/jpfgdgml_WStrL.gfs +54 -0
  202. package/dist/prebuilt/Android-x86_64/share/gdal/nitf_spec.xml +3290 -0
  203. package/dist/prebuilt/Android-x86_64/share/gdal/nitf_spec.xsd +173 -0
  204. package/dist/prebuilt/Android-x86_64/share/gdal/ogrinfo_output.schema.json +528 -0
  205. package/dist/prebuilt/Android-x86_64/share/gdal/ogrvrt.xsd +530 -0
  206. package/dist/prebuilt/Android-x86_64/share/gdal/osmconf.ini +134 -0
  207. package/dist/prebuilt/Android-x86_64/share/gdal/ozi_datum.csv +131 -0
  208. package/dist/prebuilt/Android-x86_64/share/gdal/ozi_ellips.csv +35 -0
  209. package/dist/prebuilt/Android-x86_64/share/gdal/pci_datum.txt +530 -0
  210. package/dist/prebuilt/Android-x86_64/share/gdal/pci_ellips.txt +129 -0
  211. package/dist/prebuilt/Android-x86_64/share/gdal/pdfcomposition.xsd +705 -0
  212. package/dist/prebuilt/Android-x86_64/share/gdal/ruian_vf_ob_v1.gfs +1455 -0
  213. package/dist/prebuilt/Android-x86_64/share/gdal/ruian_vf_st_uvoh_v1.gfs +86 -0
  214. package/dist/prebuilt/Android-x86_64/share/gdal/ruian_vf_st_v1.gfs +1489 -0
  215. package/dist/prebuilt/Android-x86_64/share/gdal/ruian_vf_v1.gfs +2126 -0
  216. package/dist/prebuilt/Android-x86_64/share/gdal/s57agencies.csv +249 -0
  217. package/dist/prebuilt/Android-x86_64/share/gdal/s57attributes.csv +484 -0
  218. package/dist/prebuilt/Android-x86_64/share/gdal/s57expectedinput.csv +1008 -0
  219. package/dist/prebuilt/Android-x86_64/share/gdal/s57objectclasses.csv +287 -0
  220. package/dist/prebuilt/Android-x86_64/share/gdal/seed_2d.dgn +0 -0
  221. package/dist/prebuilt/Android-x86_64/share/gdal/seed_3d.dgn +0 -0
  222. package/dist/prebuilt/Android-x86_64/share/gdal/stateplane.csv +259 -0
  223. package/dist/prebuilt/Android-x86_64/share/gdal/tms_LINZAntarticaMapTileGrid.json +190 -0
  224. package/dist/prebuilt/Android-x86_64/share/gdal/tms_MapML_APSTILE.json +268 -0
  225. package/dist/prebuilt/Android-x86_64/share/gdal/tms_MapML_CBMTILE.json +346 -0
  226. package/dist/prebuilt/Android-x86_64/share/gdal/tms_NZTM2000.json +243 -0
  227. package/dist/prebuilt/Android-x86_64/share/gdal/trailer.dxf +434 -0
  228. package/dist/prebuilt/Android-x86_64/share/gdal/vdv452.xml +351 -0
  229. package/dist/prebuilt/Android-x86_64/share/gdal/vdv452.xsd +47 -0
  230. package/dist/prebuilt/Emscripten-x86_64/include/gdal_version.h +3 -3
  231. package/dist/prebuilt/Emscripten-x86_64/include/ogr_api.h +4 -4
  232. package/dist/prebuilt/Emscripten-x86_64/include/ogr_feature.h +2 -2
  233. package/dist/prebuilt/Emscripten-x86_64/lib/cmake/gdal/GDALConfigVersion.cmake +3 -3
  234. package/dist/prebuilt/Emscripten-x86_64/lib/cmake/gdal/thirdparty/FindDotnet.cmake +33 -36
  235. package/dist/prebuilt/Emscripten-x86_64/lib/libgdal.a +0 -0
  236. package/dist/prebuilt/Emscripten-x86_64/lib/pkgconfig/gdal.pc +1 -1
  237. package/dist/prebuilt/Emscripten-x86_64/share/gdal/gdalvrt.xsd +30 -24
  238. package/dist/prebuilt/iOS-iphoneos/include/gdal_version.h +3 -3
  239. package/dist/prebuilt/iOS-iphoneos/include/ogr_api.h +4 -4
  240. package/dist/prebuilt/iOS-iphoneos/include/ogr_feature.h +2 -2
  241. package/dist/prebuilt/iOS-iphoneos/share/gdal/gdalvrt.xsd +30 -24
  242. package/dist/prebuilt/iOS-iphonesimulator/include/gdal_version.h +3 -3
  243. package/dist/prebuilt/iOS-iphonesimulator/include/ogr_api.h +4 -4
  244. package/dist/prebuilt/iOS-iphonesimulator/include/ogr_feature.h +2 -2
  245. package/dist/prebuilt/iOS-iphonesimulator/share/gdal/gdalvrt.xsd +30 -24
  246. package/gdal.xcframework/ios-arm64_arm64e/Headers/gdal_version.h +3 -3
  247. package/gdal.xcframework/ios-arm64_arm64e/Headers/ogr_api.h +4 -4
  248. package/gdal.xcframework/ios-arm64_arm64e/Headers/ogr_feature.h +2 -2
  249. package/gdal.xcframework/ios-arm64_arm64e/libgdal.a +0 -0
  250. package/gdal.xcframework/ios-arm64_arm64e_x86_64-simulator/Headers/gdal_version.h +3 -3
  251. package/gdal.xcframework/ios-arm64_arm64e_x86_64-simulator/Headers/ogr_api.h +4 -4
  252. package/gdal.xcframework/ios-arm64_arm64e_x86_64-simulator/Headers/ogr_feature.h +2 -2
  253. package/gdal.xcframework/ios-arm64_arm64e_x86_64-simulator/libgdal.a +0 -0
  254. package/package.json +13 -13
  255. package/dist/prebuilt/Emscripten-x86_64/lib/cmake/gdal/packages/FindDB2.cmake +0 -103
@@ -0,0 +1,4346 @@
1
+ /******************************************************************************
2
+ * $Id$
3
+ *
4
+ * Project: OpenGIS Simple Features Reference Implementation
5
+ * Purpose: Classes for manipulating simple features that is not specific
6
+ * to a particular interface technology.
7
+ * Author: Frank Warmerdam, warmerdam@pobox.com
8
+ *
9
+ ******************************************************************************
10
+ * Copyright (c) 1999, Frank Warmerdam
11
+ * Copyright (c) 2008-2014, Even Rouault <even dot rouault at spatialys.com>
12
+ *
13
+ * SPDX-License-Identifier: MIT
14
+ ****************************************************************************/
15
+
16
+ #ifndef OGR_GEOMETRY_H_INCLUDED
17
+ #define OGR_GEOMETRY_H_INCLUDED
18
+
19
+ #include "cpl_conv.h"
20
+ #include "cpl_json.h"
21
+ #include "ogr_core.h"
22
+ #include "ogr_geomcoordinateprecision.h"
23
+ #include "ogr_spatialref.h"
24
+
25
+ #include <climits>
26
+ #include <cmath>
27
+ #include <memory>
28
+
29
+ /**
30
+ * \file ogr_geometry.h
31
+ *
32
+ * Simple feature geometry classes.
33
+ */
34
+
35
+ /*! @cond Doxygen_Suppress */
36
+ #ifndef DEFINEH_OGRGeometryH
37
+ #define DEFINEH_OGRGeometryH
38
+ #ifdef DEBUG
39
+ typedef struct OGRGeometryHS *OGRGeometryH;
40
+ #else
41
+ typedef void *OGRGeometryH;
42
+ #endif
43
+ #endif /* DEFINEH_OGRGeometryH */
44
+ /*! @endcond */
45
+
46
+ /// WKT Output formatting options.
47
+ enum class OGRWktFormat
48
+ {
49
+ F, ///< F-type formatting.
50
+ G, ///< G-type formatting.
51
+ Default ///< Format as F when abs(value) < 1, otherwise as G.
52
+ };
53
+
54
+ /// Options for formatting WKT output
55
+ struct CPL_DLL OGRWktOptions
56
+ {
57
+ public:
58
+ /// Type of WKT output to produce.
59
+ OGRwkbVariant variant = wkbVariantOldOgc;
60
+ /// Precision of output for X,Y coordinates. Interpretation depends on \c format.
61
+ int xyPrecision;
62
+ /// Precision of output for Z coordinates. Interpretation depends on \c format.
63
+ int zPrecision;
64
+ /// Precision of output for M coordinates. Interpretation depends on \c format.
65
+ int mPrecision;
66
+ /// Whether GDAL-special rounding should be applied.
67
+ bool round = getDefaultRound();
68
+ /// Formatting type.
69
+ OGRWktFormat format = OGRWktFormat::Default;
70
+
71
+ /// Constructor.
72
+ OGRWktOptions()
73
+ : xyPrecision(getDefaultPrecision()), zPrecision(xyPrecision),
74
+ mPrecision(zPrecision)
75
+ {
76
+ }
77
+
78
+ /// Copy constructor
79
+ OGRWktOptions(const OGRWktOptions &) = default;
80
+
81
+ private:
82
+ static int getDefaultPrecision();
83
+ static bool getDefaultRound();
84
+ };
85
+
86
+ /**
87
+ * Simple container for a position.
88
+ */
89
+ class OGRRawPoint
90
+ {
91
+ public:
92
+ /** Constructor */
93
+ OGRRawPoint() : x(0.0), y(0.0)
94
+ {
95
+ }
96
+
97
+ /** Constructor */
98
+ OGRRawPoint(double xIn, double yIn) : x(xIn), y(yIn)
99
+ {
100
+ }
101
+
102
+ /** x */
103
+ double x;
104
+ /** y */
105
+ double y;
106
+ };
107
+
108
+ /** GEOS geometry type */
109
+ typedef struct GEOSGeom_t *GEOSGeom;
110
+ /** GEOS context handle type */
111
+ typedef struct GEOSContextHandle_HS *GEOSContextHandle_t;
112
+ /** SFCGAL geometry type */
113
+ typedef void sfcgal_geometry_t;
114
+
115
+ class OGRPoint;
116
+ class OGRCurve;
117
+ class OGRCompoundCurve;
118
+ class OGRSimpleCurve;
119
+ class OGRLinearRing;
120
+ class OGRLineString;
121
+ class OGRCircularString;
122
+ class OGRSurface;
123
+ class OGRCurvePolygon;
124
+ class OGRPolygon;
125
+ class OGRMultiPoint;
126
+ class OGRMultiSurface;
127
+ class OGRMultiPolygon;
128
+ class OGRMultiCurve;
129
+ class OGRMultiLineString;
130
+ class OGRGeometryCollection;
131
+ class OGRTriangle;
132
+ class OGRPolyhedralSurface;
133
+ class OGRTriangulatedSurface;
134
+
135
+ //! @cond Doxygen_Suppress
136
+ typedef OGRLineString *(*OGRCurveCasterToLineString)(OGRCurve *);
137
+ typedef OGRLinearRing *(*OGRCurveCasterToLinearRing)(OGRCurve *);
138
+
139
+ typedef OGRPolygon *(*OGRSurfaceCasterToPolygon)(OGRSurface *);
140
+ typedef OGRCurvePolygon *(*OGRSurfaceCasterToCurvePolygon)(OGRSurface *);
141
+ typedef OGRMultiPolygon *(*OGRPolyhedralSurfaceCastToMultiPolygon)(
142
+ OGRPolyhedralSurface *);
143
+
144
+ //! @endcond
145
+
146
+ /** OGRGeometry visitor interface.
147
+ * @since GDAL 2.3
148
+ */
149
+ class CPL_DLL IOGRGeometryVisitor
150
+ {
151
+ public:
152
+ /** Destructor/ */
153
+ virtual ~IOGRGeometryVisitor() = default;
154
+
155
+ /** Visit OGRPoint. */
156
+ virtual void visit(OGRPoint *) = 0;
157
+ /** Visit OGRLineString. */
158
+ virtual void visit(OGRLineString *) = 0;
159
+ /** Visit OGRLinearRing. */
160
+ virtual void visit(OGRLinearRing *) = 0;
161
+ /** Visit OGRPolygon. */
162
+ virtual void visit(OGRPolygon *) = 0;
163
+ /** Visit OGRMultiPoint. */
164
+ virtual void visit(OGRMultiPoint *) = 0;
165
+ /** Visit OGRMultiLineString. */
166
+ virtual void visit(OGRMultiLineString *) = 0;
167
+ /** Visit OGRMultiPolygon. */
168
+ virtual void visit(OGRMultiPolygon *) = 0;
169
+ /** Visit OGRGeometryCollection. */
170
+ virtual void visit(OGRGeometryCollection *) = 0;
171
+ /** Visit OGRCircularString. */
172
+ virtual void visit(OGRCircularString *) = 0;
173
+ /** Visit OGRCompoundCurve. */
174
+ virtual void visit(OGRCompoundCurve *) = 0;
175
+ /** Visit OGRCurvePolygon. */
176
+ virtual void visit(OGRCurvePolygon *) = 0;
177
+ /** Visit OGRMultiCurve. */
178
+ virtual void visit(OGRMultiCurve *) = 0;
179
+ /** Visit OGRMultiSurface. */
180
+ virtual void visit(OGRMultiSurface *) = 0;
181
+ /** Visit OGRTriangle. */
182
+ virtual void visit(OGRTriangle *) = 0;
183
+ /** Visit OGRPolyhedralSurface. */
184
+ virtual void visit(OGRPolyhedralSurface *) = 0;
185
+ /** Visit OGRTriangulatedSurface. */
186
+ virtual void visit(OGRTriangulatedSurface *) = 0;
187
+ };
188
+
189
+ /** OGRGeometry visitor default implementation.
190
+ *
191
+ * This default implementation will recurse down to calling
192
+ * visit(OGRPoint*) on each point.
193
+ *
194
+ * @since GDAL 2.3
195
+ */
196
+ class CPL_DLL OGRDefaultGeometryVisitor : public IOGRGeometryVisitor
197
+ {
198
+ void _visit(OGRSimpleCurve *poGeom);
199
+
200
+ public:
201
+ void visit(OGRPoint *) override
202
+ {
203
+ }
204
+
205
+ void visit(OGRLineString *) override;
206
+ void visit(OGRLinearRing *) override;
207
+ void visit(OGRPolygon *) override;
208
+ void visit(OGRMultiPoint *) override;
209
+ void visit(OGRMultiLineString *) override;
210
+ void visit(OGRMultiPolygon *) override;
211
+ void visit(OGRGeometryCollection *) override;
212
+ void visit(OGRCircularString *) override;
213
+ void visit(OGRCompoundCurve *) override;
214
+ void visit(OGRCurvePolygon *) override;
215
+ void visit(OGRMultiCurve *) override;
216
+ void visit(OGRMultiSurface *) override;
217
+ void visit(OGRTriangle *) override;
218
+ void visit(OGRPolyhedralSurface *) override;
219
+ void visit(OGRTriangulatedSurface *) override;
220
+ };
221
+
222
+ /** OGRGeometry visitor interface.
223
+ * @since GDAL 2.3
224
+ */
225
+ class CPL_DLL IOGRConstGeometryVisitor
226
+ {
227
+ public:
228
+ /** Destructor/ */
229
+ virtual ~IOGRConstGeometryVisitor() = default;
230
+
231
+ /** Visit OGRPoint. */
232
+ virtual void visit(const OGRPoint *) = 0;
233
+ /** Visit OGRLineString. */
234
+ virtual void visit(const OGRLineString *) = 0;
235
+ /** Visit OGRLinearRing. */
236
+ virtual void visit(const OGRLinearRing *) = 0;
237
+ /** Visit OGRPolygon. */
238
+ virtual void visit(const OGRPolygon *) = 0;
239
+ /** Visit OGRMultiPoint. */
240
+ virtual void visit(const OGRMultiPoint *) = 0;
241
+ /** Visit OGRMultiLineString. */
242
+ virtual void visit(const OGRMultiLineString *) = 0;
243
+ /** Visit OGRMultiPolygon. */
244
+ virtual void visit(const OGRMultiPolygon *) = 0;
245
+ /** Visit OGRGeometryCollection. */
246
+ virtual void visit(const OGRGeometryCollection *) = 0;
247
+ /** Visit OGRCircularString. */
248
+ virtual void visit(const OGRCircularString *) = 0;
249
+ /** Visit OGRCompoundCurve. */
250
+ virtual void visit(const OGRCompoundCurve *) = 0;
251
+ /** Visit OGRCurvePolygon. */
252
+ virtual void visit(const OGRCurvePolygon *) = 0;
253
+ /** Visit OGRMultiCurve. */
254
+ virtual void visit(const OGRMultiCurve *) = 0;
255
+ /** Visit OGRMultiSurface. */
256
+ virtual void visit(const OGRMultiSurface *) = 0;
257
+ /** Visit OGRTriangle. */
258
+ virtual void visit(const OGRTriangle *) = 0;
259
+ /** Visit OGRPolyhedralSurface. */
260
+ virtual void visit(const OGRPolyhedralSurface *) = 0;
261
+ /** Visit OGRTriangulatedSurface. */
262
+ virtual void visit(const OGRTriangulatedSurface *) = 0;
263
+ };
264
+
265
+ /** OGRGeometry visitor default implementation.
266
+ *
267
+ * This default implementation will recurse down to calling
268
+ * visit(const OGRPoint*) on each point.
269
+ *
270
+ * @since GDAL 2.3
271
+ */
272
+ class CPL_DLL OGRDefaultConstGeometryVisitor : public IOGRConstGeometryVisitor
273
+ {
274
+ void _visit(const OGRSimpleCurve *poGeom);
275
+
276
+ public:
277
+ void visit(const OGRPoint *) override
278
+ {
279
+ }
280
+
281
+ void visit(const OGRLineString *) override;
282
+ void visit(const OGRLinearRing *) override;
283
+ void visit(const OGRPolygon *) override;
284
+ void visit(const OGRMultiPoint *) override;
285
+ void visit(const OGRMultiLineString *) override;
286
+ void visit(const OGRMultiPolygon *) override;
287
+ void visit(const OGRGeometryCollection *) override;
288
+ void visit(const OGRCircularString *) override;
289
+ void visit(const OGRCompoundCurve *) override;
290
+ void visit(const OGRCurvePolygon *) override;
291
+ void visit(const OGRMultiCurve *) override;
292
+ void visit(const OGRMultiSurface *) override;
293
+ void visit(const OGRTriangle *) override;
294
+ void visit(const OGRPolyhedralSurface *) override;
295
+ void visit(const OGRTriangulatedSurface *) override;
296
+ };
297
+
298
+ /************************************************************************/
299
+ /* OGRGeomCoordinateBinaryPrecision */
300
+ /************************************************************************/
301
+
302
+ /** Geometry coordinate precision for a binary representation.
303
+ *
304
+ * @since GDAL 3.9
305
+ */
306
+ struct CPL_DLL OGRGeomCoordinateBinaryPrecision
307
+ {
308
+ int nXYBitPrecision =
309
+ INT_MIN; /**< Number of bits needed to achieved XY precision. Typically
310
+ computed with SetFromResolution() */
311
+ int nZBitPrecision =
312
+ INT_MIN; /**< Number of bits needed to achieved Z precision. Typically
313
+ computed with SetFromResolution() */
314
+ int nMBitPrecision =
315
+ INT_MIN; /**< Number of bits needed to achieved M precision. Typically
316
+ computed with SetFromResolution() */
317
+
318
+ void SetFrom(const OGRGeomCoordinatePrecision &);
319
+ };
320
+
321
+ /************************************************************************/
322
+ /* OGRwkbExportOptions */
323
+ /************************************************************************/
324
+
325
+ /** WKB export options.
326
+ *
327
+ * @since GDAL 3.9
328
+ */
329
+ struct CPL_DLL OGRwkbExportOptions
330
+ {
331
+ OGRwkbByteOrder eByteOrder = wkbNDR; /**< Byte order */
332
+ OGRwkbVariant eWkbVariant = wkbVariantOldOgc; /**< WKB variant. */
333
+ OGRGeomCoordinateBinaryPrecision sPrecision{}; /**< Binary precision. */
334
+ };
335
+
336
+ /************************************************************************/
337
+ /* OGRGeometry */
338
+ /************************************************************************/
339
+
340
+ /**
341
+ * Abstract base class for all geometry classes.
342
+ *
343
+ * Some spatial analysis methods require that OGR is built on the GEOS library
344
+ * to work properly. The precise meaning of methods that describe spatial
345
+ * relationships between geometries is described in the SFCOM, or other simple
346
+ * features interface specifications, like "OpenGIS® Implementation
347
+ * Specification for Geographic information - Simple feature access - Part 1:
348
+ * Common architecture":
349
+ * <a href="http://www.opengeospatial.org/standards/sfa">OGC 06-103r4</a>
350
+ *
351
+ * In GDAL 2.0, the hierarchy of classes has been extended with
352
+ * <a href="https://portal.opengeospatial.org/files/?artifact_id=32024">
353
+ * (working draft) ISO SQL/MM Part 3 (ISO/IEC 13249-3)</a> curve geometries :
354
+ * CIRCULARSTRING (OGRCircularString), COMPOUNDCURVE (OGRCompoundCurve),
355
+ * CURVEPOLYGON (OGRCurvePolygon), MULTICURVE (OGRMultiCurve) and
356
+ * MULTISURFACE (OGRMultiSurface).
357
+ *
358
+ */
359
+
360
+ class CPL_DLL OGRGeometry
361
+ {
362
+ private:
363
+ const OGRSpatialReference *poSRS = nullptr; // may be NULL
364
+
365
+ protected:
366
+ //! @cond Doxygen_Suppress
367
+ friend class OGRCurveCollection;
368
+
369
+ unsigned int flags = 0;
370
+
371
+ OGRErr importPreambleFromWkt(const char **ppszInput, int *pbHasZ,
372
+ int *pbHasM, bool *pbIsEmpty);
373
+ OGRErr importCurveCollectionFromWkt(
374
+ const char **ppszInput, int bAllowEmptyComponent, int bAllowLineString,
375
+ int bAllowCurve, int bAllowCompoundCurve,
376
+ OGRErr (*pfnAddCurveDirectly)(OGRGeometry *poSelf, OGRCurve *poCurve));
377
+ OGRErr importPreambleFromWkb(const unsigned char *pabyData, size_t nSize,
378
+ OGRwkbByteOrder &eByteOrder,
379
+ OGRwkbVariant eWkbVariant);
380
+ OGRErr importPreambleOfCollectionFromWkb(const unsigned char *pabyData,
381
+ size_t &nSize, size_t &nDataOffset,
382
+ OGRwkbByteOrder &eByteOrder,
383
+ size_t nMinSubGeomSize,
384
+ int &nGeomCount,
385
+ OGRwkbVariant eWkbVariant);
386
+ OGRErr PointOnSurfaceInternal(OGRPoint *poPoint) const;
387
+ OGRBoolean IsSFCGALCompatible() const;
388
+
389
+ void HomogenizeDimensionalityWith(OGRGeometry *poOtherGeom);
390
+ std::string wktTypeString(OGRwkbVariant variant) const;
391
+
392
+ //! @endcond
393
+
394
+ public:
395
+ /************************************************************************/
396
+ /* Bit flags for OGRGeometry */
397
+ /* The OGR_G_NOT_EMPTY_POINT is used *only* for points. */
398
+ /* Do not use these outside of the core. */
399
+ /* Use Is3D, IsMeasured, set3D, and setMeasured instead */
400
+ /************************************************************************/
401
+
402
+ //! @cond Doxygen_Suppress
403
+ static const unsigned int OGR_G_NOT_EMPTY_POINT = 0x1;
404
+ static const unsigned int OGR_G_3D = 0x2;
405
+ static const unsigned int OGR_G_MEASURED = 0x4;
406
+ //! @endcond
407
+
408
+ OGRGeometry();
409
+ OGRGeometry(const OGRGeometry &other);
410
+ virtual ~OGRGeometry();
411
+
412
+ OGRGeometry &operator=(const OGRGeometry &other);
413
+
414
+ /** Returns if two geometries are equal. */
415
+ bool operator==(const OGRGeometry &other) const
416
+ {
417
+ return CPL_TO_BOOL(Equals(&other));
418
+ }
419
+
420
+ /** Returns if two geometries are different. */
421
+ bool operator!=(const OGRGeometry &other) const
422
+ {
423
+ return !CPL_TO_BOOL(Equals(&other));
424
+ }
425
+
426
+ // Standard IGeometry.
427
+ virtual int getDimension() const = 0;
428
+ virtual int getCoordinateDimension() const;
429
+ int CoordinateDimension() const;
430
+ virtual OGRBoolean IsEmpty() const = 0;
431
+ virtual OGRBoolean IsValid() const;
432
+ virtual OGRGeometry *MakeValid(CSLConstList papszOptions = nullptr) const;
433
+ virtual OGRGeometry *Normalize() const;
434
+ virtual OGRBoolean IsSimple() const;
435
+
436
+ /*! Returns whether the geometry has a Z component. */
437
+ OGRBoolean Is3D() const
438
+ {
439
+ return (flags & OGR_G_3D) != 0;
440
+ }
441
+
442
+ /*! Returns whether the geometry has a M component. */
443
+ OGRBoolean IsMeasured() const
444
+ {
445
+ return (flags & OGR_G_MEASURED) != 0;
446
+ }
447
+
448
+ virtual OGRBoolean IsRing() const;
449
+ virtual void empty() = 0;
450
+ virtual OGRGeometry *clone() const CPL_WARN_UNUSED_RESULT = 0;
451
+ virtual void getEnvelope(OGREnvelope *psEnvelope) const = 0;
452
+ virtual void getEnvelope(OGREnvelope3D *psEnvelope) const = 0;
453
+
454
+ // IWks Interface.
455
+ virtual size_t WkbSize() const = 0;
456
+ OGRErr importFromWkb(const GByte *, size_t = static_cast<size_t>(-1),
457
+ OGRwkbVariant = wkbVariantOldOgc);
458
+ virtual OGRErr importFromWkb(const unsigned char *, size_t, OGRwkbVariant,
459
+ size_t &nBytesConsumedOut) = 0;
460
+ OGRErr exportToWkb(OGRwkbByteOrder, unsigned char *,
461
+ OGRwkbVariant = wkbVariantOldOgc) const;
462
+ virtual OGRErr exportToWkb(unsigned char *,
463
+ const OGRwkbExportOptions * = nullptr) const = 0;
464
+ virtual OGRErr importFromWkt(const char **ppszInput) = 0;
465
+
466
+ #ifndef DOXYGEN_XML
467
+ /** Deprecated.
468
+ * @deprecated in GDAL 2.3
469
+ */
470
+ OGRErr importFromWkt(char **ppszInput)
471
+ /*! @cond Doxygen_Suppress */
472
+ CPL_WARN_DEPRECATED("Use importFromWkt(const char**) instead")
473
+ /*! @endcond */
474
+ {
475
+ return importFromWkt(const_cast<const char **>(ppszInput));
476
+ }
477
+ #endif
478
+
479
+ OGRErr exportToWkt(char **ppszDstText,
480
+ OGRwkbVariant = wkbVariantOldOgc) const;
481
+
482
+ /// Export a WKT geometry.
483
+ /// \param opts Output options.
484
+ /// \param err Pointer to error code, if desired.
485
+ /// \return WKT string representing this geometry.
486
+ virtual std::string exportToWkt(const OGRWktOptions &opts = OGRWktOptions(),
487
+ OGRErr *err = nullptr) const = 0;
488
+
489
+ // Non-standard.
490
+ virtual OGRwkbGeometryType getGeometryType() const = 0;
491
+ OGRwkbGeometryType getIsoGeometryType() const;
492
+ virtual const char *getGeometryName() const = 0;
493
+ void dumpReadable(FILE *, const char * = nullptr,
494
+ CSLConstList papszOptions = nullptr) const;
495
+ std::string dumpReadable(const char * = nullptr,
496
+ CSLConstList papszOptions = nullptr) const;
497
+ virtual void flattenTo2D() = 0;
498
+ virtual char *exportToGML(const char *const *papszOptions = nullptr) const;
499
+ virtual char *exportToKML() const;
500
+ virtual char *exportToJson(CSLConstList papszOptions = nullptr) const;
501
+
502
+ /** Accept a visitor. */
503
+ virtual void accept(IOGRGeometryVisitor *visitor) = 0;
504
+
505
+ /** Accept a visitor. */
506
+ virtual void accept(IOGRConstGeometryVisitor *visitor) const = 0;
507
+
508
+ static GEOSContextHandle_t createGEOSContext();
509
+ static void freeGEOSContext(GEOSContextHandle_t hGEOSCtxt);
510
+ GEOSGeom
511
+ exportToGEOS(GEOSContextHandle_t hGEOSCtxt,
512
+ bool bRemoveEmptyParts = false) const CPL_WARN_UNUSED_RESULT;
513
+ virtual OGRBoolean hasCurveGeometry(int bLookForNonLinear = FALSE) const;
514
+ virtual OGRGeometry *getCurveGeometry(
515
+ const char *const *papszOptions = nullptr) const CPL_WARN_UNUSED_RESULT;
516
+ virtual OGRGeometry *getLinearGeometry(
517
+ double dfMaxAngleStepSizeDegrees = 0,
518
+ const char *const *papszOptions = nullptr) const CPL_WARN_UNUSED_RESULT;
519
+
520
+ void roundCoordinates(const OGRGeomCoordinatePrecision &sPrecision);
521
+ void
522
+ roundCoordinatesIEEE754(const OGRGeomCoordinateBinaryPrecision &options);
523
+
524
+ // SFCGAL interfacing methods.
525
+ //! @cond Doxygen_Suppress
526
+ static sfcgal_geometry_t *OGRexportToSFCGAL(const OGRGeometry *poGeom);
527
+ static OGRGeometry *SFCGALexportToOGR(const sfcgal_geometry_t *_geometry);
528
+ //! @endcond
529
+ virtual void closeRings();
530
+
531
+ virtual bool setCoordinateDimension(int nDimension);
532
+ virtual bool set3D(OGRBoolean bIs3D);
533
+ virtual bool setMeasured(OGRBoolean bIsMeasured);
534
+
535
+ virtual void assignSpatialReference(const OGRSpatialReference *poSR);
536
+
537
+ const OGRSpatialReference *getSpatialReference(void) const
538
+ {
539
+ return poSRS;
540
+ }
541
+
542
+ virtual OGRErr transform(OGRCoordinateTransformation *poCT) = 0;
543
+ OGRErr transformTo(const OGRSpatialReference *poSR);
544
+
545
+ virtual bool segmentize(double dfMaxLength);
546
+
547
+ // ISpatialRelation
548
+ virtual OGRBoolean Intersects(const OGRGeometry *) const;
549
+ virtual OGRBoolean Equals(const OGRGeometry *) const = 0;
550
+ virtual OGRBoolean Disjoint(const OGRGeometry *) const;
551
+ virtual OGRBoolean Touches(const OGRGeometry *) const;
552
+ virtual OGRBoolean Crosses(const OGRGeometry *) const;
553
+ virtual OGRBoolean Within(const OGRGeometry *) const;
554
+ virtual OGRBoolean Contains(const OGRGeometry *) const;
555
+ virtual OGRBoolean Overlaps(const OGRGeometry *) const;
556
+ // virtual OGRBoolean Relate( const OGRGeometry *, const char * ) const;
557
+ // virtual OGRGeometry *LocateAlong( double mValue ) const;
558
+ // virtual OGRGeometry *LocateBetween( double mStart, double mEnd )
559
+ // const;
560
+
561
+ virtual OGRGeometry *Boundary() const CPL_WARN_UNUSED_RESULT;
562
+ virtual double Distance(const OGRGeometry *) const;
563
+ virtual OGRGeometry *ConvexHull() const CPL_WARN_UNUSED_RESULT;
564
+ virtual OGRGeometry *
565
+ ConcaveHull(double dfRatio, bool bAllowHoles) const CPL_WARN_UNUSED_RESULT;
566
+ virtual OGRGeometry *
567
+ Buffer(double dfDist, int nQuadSegs = 30) const CPL_WARN_UNUSED_RESULT;
568
+ virtual OGRGeometry *
569
+ BufferEx(double dfDistance,
570
+ CSLConstList papszOptions) const CPL_WARN_UNUSED_RESULT;
571
+ virtual OGRGeometry *
572
+ Intersection(const OGRGeometry *) const CPL_WARN_UNUSED_RESULT;
573
+ virtual OGRGeometry *
574
+ Union(const OGRGeometry *) const CPL_WARN_UNUSED_RESULT;
575
+ virtual OGRGeometry *UnionCascaded() const CPL_WARN_UNUSED_RESULT;
576
+ OGRGeometry *UnaryUnion() const CPL_WARN_UNUSED_RESULT;
577
+ virtual OGRGeometry *
578
+ Difference(const OGRGeometry *) const CPL_WARN_UNUSED_RESULT;
579
+ virtual OGRGeometry *
580
+ SymDifference(const OGRGeometry *) const CPL_WARN_UNUSED_RESULT;
581
+ virtual OGRErr Centroid(OGRPoint *poPoint) const;
582
+ virtual OGRGeometry *
583
+ Simplify(double dTolerance) const CPL_WARN_UNUSED_RESULT;
584
+ OGRGeometry *
585
+ SimplifyPreserveTopology(double dTolerance) const CPL_WARN_UNUSED_RESULT;
586
+ virtual OGRGeometry *
587
+ DelaunayTriangulation(double dfTolerance,
588
+ int bOnlyEdges) const CPL_WARN_UNUSED_RESULT;
589
+
590
+ virtual OGRGeometry *Polygonize() const CPL_WARN_UNUSED_RESULT;
591
+
592
+ virtual double Distance3D(const OGRGeometry *poOtherGeom) const;
593
+
594
+ OGRGeometry *SetPrecision(double dfGridSize, int nFlags) const;
595
+
596
+ virtual bool hasEmptyParts() const;
597
+ virtual void removeEmptyParts();
598
+
599
+ //! @cond Doxygen_Suppress
600
+ // backward compatibility to non-standard method names.
601
+ OGRBoolean Intersect(OGRGeometry *) const
602
+ CPL_WARN_DEPRECATED("Non standard method. "
603
+ "Use Intersects() instead");
604
+ OGRBoolean Equal(OGRGeometry *) const
605
+ CPL_WARN_DEPRECATED("Non standard method. "
606
+ "Use Equals() instead");
607
+ OGRGeometry *SymmetricDifference(const OGRGeometry *) const
608
+ CPL_WARN_DEPRECATED("Non standard method. "
609
+ "Use SymDifference() instead");
610
+ OGRGeometry *getBoundary() const
611
+ CPL_WARN_DEPRECATED("Non standard method. "
612
+ "Use Boundary() instead");
613
+ //! @endcond
614
+
615
+ //! @cond Doxygen_Suppress
616
+ // Special HACK for DB2 7.2 support
617
+ static int bGenerate_DB2_V72_BYTE_ORDER;
618
+ //! @endcond
619
+
620
+ virtual void swapXY();
621
+
622
+ bool IsRectangle() const;
623
+
624
+ //! @cond Doxygen_Suppress
625
+ static OGRGeometry *CastToIdentity(OGRGeometry *poGeom)
626
+ {
627
+ return poGeom;
628
+ }
629
+
630
+ static OGRGeometry *CastToError(OGRGeometry *poGeom);
631
+
632
+ //! @endcond
633
+
634
+ /** Convert a OGRGeometry* to a OGRGeometryH.
635
+ * @since GDAL 2.3
636
+ */
637
+ static inline OGRGeometryH ToHandle(OGRGeometry *poGeom)
638
+ {
639
+ return reinterpret_cast<OGRGeometryH>(poGeom);
640
+ }
641
+
642
+ /** Convert a OGRGeometryH to a OGRGeometry*.
643
+ * @since GDAL 2.3
644
+ */
645
+ static inline OGRGeometry *FromHandle(OGRGeometryH hGeom)
646
+ {
647
+ return reinterpret_cast<OGRGeometry *>(hGeom);
648
+ }
649
+
650
+ /** Down-cast to OGRPoint*.
651
+ * Implies prior checking that wkbFlatten(getGeometryType()) == wkbPoint.
652
+ * @since GDAL 2.3
653
+ */
654
+ inline OGRPoint *toPoint()
655
+ {
656
+ return cpl::down_cast<OGRPoint *>(this);
657
+ }
658
+
659
+ /** Down-cast to OGRPoint*.
660
+ * Implies prior checking that wkbFlatten(getGeometryType()) == wkbPoint.
661
+ * @since GDAL 2.3
662
+ */
663
+ inline const OGRPoint *toPoint() const
664
+ {
665
+ return cpl::down_cast<const OGRPoint *>(this);
666
+ }
667
+
668
+ /** Down-cast to OGRCurve*.
669
+ * Implies prior checking that OGR_GT_IsSubClass(getGeometryType(),
670
+ * wkbCurve).
671
+ * @since GDAL 2.3
672
+ */
673
+ inline OGRCurve *toCurve()
674
+ {
675
+ return cpl::down_cast<OGRCurve *>(this);
676
+ }
677
+
678
+ /** Down-cast to OGRCurve*.
679
+ * Implies prior checking that OGR_GT_IsSubClass(getGeometryType(),
680
+ * wkbCurve).
681
+ * @since GDAL 2.3
682
+ */
683
+ inline const OGRCurve *toCurve() const
684
+ {
685
+ return cpl::down_cast<const OGRCurve *>(this);
686
+ }
687
+
688
+ /** Down-cast to OGRSimpleCurve*.
689
+ * Implies prior checking that getGeometryType() is wkbLineString,
690
+ * wkbCircularString or a derived type.
691
+ * @since GDAL 2.3
692
+ */
693
+ inline OGRSimpleCurve *toSimpleCurve()
694
+ {
695
+ return cpl::down_cast<OGRSimpleCurve *>(this);
696
+ }
697
+
698
+ /** Down-cast to OGRSimpleCurve*.
699
+ * Implies prior checking that getGeometryType() is wkbLineString,
700
+ * wkbCircularString or a derived type.
701
+ * @since GDAL 2.3
702
+ */
703
+ inline const OGRSimpleCurve *toSimpleCurve() const
704
+ {
705
+ return cpl::down_cast<const OGRSimpleCurve *>(this);
706
+ }
707
+
708
+ /** Down-cast to OGRLineString*.
709
+ * Implies prior checking that wkbFlatten(getGeometryType()) ==
710
+ * wkbLineString.
711
+ * @since GDAL 2.3
712
+ */
713
+ inline OGRLineString *toLineString()
714
+ {
715
+ return cpl::down_cast<OGRLineString *>(this);
716
+ }
717
+
718
+ /** Down-cast to OGRLineString*.
719
+ * Implies prior checking that wkbFlatten(getGeometryType()) ==
720
+ * wkbLineString.
721
+ * @since GDAL 2.3
722
+ */
723
+ inline const OGRLineString *toLineString() const
724
+ {
725
+ return cpl::down_cast<const OGRLineString *>(this);
726
+ }
727
+
728
+ /** Down-cast to OGRLinearRing*.
729
+ * Implies prior checking that EQUAL(getGeometryName(), "LINEARRING").
730
+ * @since GDAL 2.3
731
+ */
732
+ inline OGRLinearRing *toLinearRing()
733
+ {
734
+ return cpl::down_cast<OGRLinearRing *>(this);
735
+ }
736
+
737
+ /** Down-cast to OGRLinearRing*.
738
+ * Implies prior checking that EQUAL(getGeometryName(), "LINEARRING").
739
+ * @since GDAL 2.3
740
+ */
741
+ inline const OGRLinearRing *toLinearRing() const
742
+ {
743
+ return cpl::down_cast<const OGRLinearRing *>(this);
744
+ }
745
+
746
+ /** Down-cast to OGRCircularString*.
747
+ * Implies prior checking that wkbFlatten(getGeometryType()) ==
748
+ * wkbCircularString.
749
+ * @since GDAL 2.3
750
+ */
751
+ inline OGRCircularString *toCircularString()
752
+ {
753
+ return cpl::down_cast<OGRCircularString *>(this);
754
+ }
755
+
756
+ /** Down-cast to OGRCircularString*.
757
+ * Implies prior checking that wkbFlatten(getGeometryType()) ==
758
+ * wkbCircularString.
759
+ * @since GDAL 2.3
760
+ */
761
+ inline const OGRCircularString *toCircularString() const
762
+ {
763
+ return cpl::down_cast<const OGRCircularString *>(this);
764
+ }
765
+
766
+ /** Down-cast to OGRCompoundCurve*.
767
+ * Implies prior checking that wkbFlatten(getGeometryType()) ==
768
+ * wkbCompoundCurve.
769
+ * @since GDAL 2.3
770
+ */
771
+ inline OGRCompoundCurve *toCompoundCurve()
772
+ {
773
+ return cpl::down_cast<OGRCompoundCurve *>(this);
774
+ }
775
+
776
+ /** Down-cast to OGRCompoundCurve*.
777
+ * Implies prior checking that wkbFlatten(getGeometryType()) ==
778
+ * wkbCompoundCurve.
779
+ * @since GDAL 2.3
780
+ */
781
+ inline const OGRCompoundCurve *toCompoundCurve() const
782
+ {
783
+ return cpl::down_cast<const OGRCompoundCurve *>(this);
784
+ }
785
+
786
+ /** Down-cast to OGRSurface*.
787
+ * Implies prior checking that OGR_GT_IsSubClass(getGeometryType(),
788
+ * wkbSurface).
789
+ * @since GDAL 2.3
790
+ */
791
+ inline OGRSurface *toSurface()
792
+ {
793
+ return cpl::down_cast<OGRSurface *>(this);
794
+ }
795
+
796
+ /** Down-cast to OGRSurface*.
797
+ * Implies prior checking that OGR_GT_IsSubClass(getGeometryType(),
798
+ * wkbSurface).
799
+ * @since GDAL 2.3
800
+ */
801
+ inline const OGRSurface *toSurface() const
802
+ {
803
+ return cpl::down_cast<const OGRSurface *>(this);
804
+ }
805
+
806
+ /** Down-cast to OGRPolygon*.
807
+ * Implies prior checking that wkbFlatten(getGeometryType()) == wkbPolygon
808
+ * or wkbTriangle.
809
+ * @since GDAL 2.3
810
+ */
811
+ inline OGRPolygon *toPolygon()
812
+ {
813
+ return cpl::down_cast<OGRPolygon *>(this);
814
+ }
815
+
816
+ /** Down-cast to OGRPolygon*.
817
+ * Implies prior checking that wkbFlatten(getGeometryType()) == wkbPolygon
818
+ * or wkbTriangle.
819
+ * @since GDAL 2.3
820
+ */
821
+ inline const OGRPolygon *toPolygon() const
822
+ {
823
+ return cpl::down_cast<const OGRPolygon *>(this);
824
+ }
825
+
826
+ /** Down-cast to OGRTriangle*.
827
+ * Implies prior checking that wkbFlatten(getGeometryType()) == wkbTriangle.
828
+ * @since GDAL 2.3
829
+ */
830
+ inline OGRTriangle *toTriangle()
831
+ {
832
+ return cpl::down_cast<OGRTriangle *>(this);
833
+ }
834
+
835
+ /** Down-cast to OGRTriangle*.
836
+ * Implies prior checking that wkbFlatten(getGeometryType()) == wkbTriangle.
837
+ * @since GDAL 2.3
838
+ */
839
+ inline const OGRTriangle *toTriangle() const
840
+ {
841
+ return cpl::down_cast<const OGRTriangle *>(this);
842
+ }
843
+
844
+ /** Down-cast to OGRCurvePolygon*.
845
+ * Implies prior checking that wkbFlatten(getGeometryType()) ==
846
+ * wkbCurvePolygon or wkbPolygon or wkbTriangle.
847
+ * @since GDAL 2.3
848
+ */
849
+ inline OGRCurvePolygon *toCurvePolygon()
850
+ {
851
+ return cpl::down_cast<OGRCurvePolygon *>(this);
852
+ }
853
+
854
+ /** Down-cast to OGRCurvePolygon*.
855
+ * Implies prior checking that wkbFlatten(getGeometryType()) ==
856
+ * wkbCurvePolygon or wkbPolygon or wkbTriangle.
857
+ * @since GDAL 2.3
858
+ */
859
+ inline const OGRCurvePolygon *toCurvePolygon() const
860
+ {
861
+ return cpl::down_cast<const OGRCurvePolygon *>(this);
862
+ }
863
+
864
+ /** Down-cast to OGRGeometryCollection*.
865
+ * Implies prior checking that OGR_GT_IsSubClass(getGeometryType(),
866
+ * wkbGeometryCollection).
867
+ * @since GDAL 2.3
868
+ */
869
+ inline OGRGeometryCollection *toGeometryCollection()
870
+ {
871
+ return cpl::down_cast<OGRGeometryCollection *>(this);
872
+ }
873
+
874
+ /** Down-cast to OGRGeometryCollection*.
875
+ * Implies prior checking that OGR_GT_IsSubClass(getGeometryType(),
876
+ * wkbGeometryCollection).
877
+ * @since GDAL 2.3
878
+ */
879
+ inline const OGRGeometryCollection *toGeometryCollection() const
880
+ {
881
+ return cpl::down_cast<const OGRGeometryCollection *>(this);
882
+ }
883
+
884
+ /** Down-cast to OGRMultiPoint*.
885
+ * Implies prior checking that wkbFlatten(getGeometryType()) ==
886
+ * wkbMultiPoint.
887
+ * @since GDAL 2.3
888
+ */
889
+ inline OGRMultiPoint *toMultiPoint()
890
+ {
891
+ return cpl::down_cast<OGRMultiPoint *>(this);
892
+ }
893
+
894
+ /** Down-cast to OGRMultiPoint*.
895
+ * Implies prior checking that wkbFlatten(getGeometryType()) ==
896
+ * wkbMultiPoint.
897
+ * @since GDAL 2.3
898
+ */
899
+ inline const OGRMultiPoint *toMultiPoint() const
900
+ {
901
+ return cpl::down_cast<const OGRMultiPoint *>(this);
902
+ }
903
+
904
+ /** Down-cast to OGRMultiLineString*.
905
+ * Implies prior checking that wkbFlatten(getGeometryType()) ==
906
+ * wkbMultiLineString.
907
+ * @since GDAL 2.3
908
+ */
909
+ inline OGRMultiLineString *toMultiLineString()
910
+ {
911
+ return cpl::down_cast<OGRMultiLineString *>(this);
912
+ }
913
+
914
+ /** Down-cast to OGRMultiLineString*.
915
+ * Implies prior checking that wkbFlatten(getGeometryType()) ==
916
+ * wkbMultiLineString.
917
+ * @since GDAL 2.3
918
+ */
919
+ inline const OGRMultiLineString *toMultiLineString() const
920
+ {
921
+ return cpl::down_cast<const OGRMultiLineString *>(this);
922
+ }
923
+
924
+ /** Down-cast to OGRMultiPolygon*.
925
+ * Implies prior checking that wkbFlatten(getGeometryType()) ==
926
+ * wkbMultiPolygon.
927
+ * @since GDAL 2.3
928
+ */
929
+ inline OGRMultiPolygon *toMultiPolygon()
930
+ {
931
+ return cpl::down_cast<OGRMultiPolygon *>(this);
932
+ }
933
+
934
+ /** Down-cast to OGRMultiPolygon*.
935
+ * Implies prior checking that wkbFlatten(getGeometryType()) ==
936
+ * wkbMultiPolygon.
937
+ * @since GDAL 2.3
938
+ */
939
+ inline const OGRMultiPolygon *toMultiPolygon() const
940
+ {
941
+ return cpl::down_cast<const OGRMultiPolygon *>(this);
942
+ }
943
+
944
+ /** Down-cast to OGRMultiCurve*.
945
+ * Implies prior checking that wkbFlatten(getGeometryType()) ==
946
+ * wkbMultiCurve and derived types.
947
+ * @since GDAL 2.3
948
+ */
949
+ inline OGRMultiCurve *toMultiCurve()
950
+ {
951
+ return cpl::down_cast<OGRMultiCurve *>(this);
952
+ }
953
+
954
+ /** Down-cast to OGRMultiCurve*.
955
+ * Implies prior checking that wkbFlatten(getGeometryType()) ==
956
+ * wkbMultiCurve and derived types.
957
+ * @since GDAL 2.3
958
+ */
959
+ inline const OGRMultiCurve *toMultiCurve() const
960
+ {
961
+ return cpl::down_cast<const OGRMultiCurve *>(this);
962
+ }
963
+
964
+ /** Down-cast to OGRMultiSurface*.
965
+ * Implies prior checking that wkbFlatten(getGeometryType()) ==
966
+ * wkbMultiSurface and derived types.
967
+ * @since GDAL 2.3
968
+ */
969
+ inline OGRMultiSurface *toMultiSurface()
970
+ {
971
+ return cpl::down_cast<OGRMultiSurface *>(this);
972
+ }
973
+
974
+ /** Down-cast to OGRMultiSurface*.
975
+ * Implies prior checking that wkbFlatten(getGeometryType()) ==
976
+ * wkbMultiSurface and derived types.
977
+ * @since GDAL 2.3
978
+ */
979
+ inline const OGRMultiSurface *toMultiSurface() const
980
+ {
981
+ return cpl::down_cast<const OGRMultiSurface *>(this);
982
+ }
983
+
984
+ /** Down-cast to OGRPolyhedralSurface*.
985
+ * Implies prior checking that wkbFlatten(getGeometryType()) ==
986
+ * wkbPolyhedralSurface or wkbTIN.
987
+ * @since GDAL 2.3
988
+ */
989
+ inline OGRPolyhedralSurface *toPolyhedralSurface()
990
+ {
991
+ return cpl::down_cast<OGRPolyhedralSurface *>(this);
992
+ }
993
+
994
+ /** Down-cast to OGRPolyhedralSurface*.
995
+ * Implies prior checking that wkbFlatten(getGeometryType()) ==
996
+ * wkbPolyhedralSurface or wkbTIN.
997
+ * @since GDAL 2.3
998
+ */
999
+ inline const OGRPolyhedralSurface *toPolyhedralSurface() const
1000
+ {
1001
+ return cpl::down_cast<const OGRPolyhedralSurface *>(this);
1002
+ }
1003
+
1004
+ /** Down-cast to OGRTriangulatedSurface*.
1005
+ * Implies prior checking that wkbFlatten(getGeometryType()) == wkbTIN.
1006
+ * @since GDAL 2.3
1007
+ */
1008
+ inline OGRTriangulatedSurface *toTriangulatedSurface()
1009
+ {
1010
+ return cpl::down_cast<OGRTriangulatedSurface *>(this);
1011
+ }
1012
+
1013
+ /** Down-cast to OGRTriangulatedSurface*.
1014
+ * Implies prior checking that wkbFlatten(getGeometryType()) == wkbTIN.
1015
+ * @since GDAL 2.3
1016
+ */
1017
+ inline const OGRTriangulatedSurface *toTriangulatedSurface() const
1018
+ {
1019
+ return cpl::down_cast<const OGRTriangulatedSurface *>(this);
1020
+ }
1021
+ };
1022
+
1023
+ //! @cond Doxygen_Suppress
1024
+ struct CPL_DLL OGRGeometryUniquePtrDeleter
1025
+ {
1026
+ void operator()(OGRGeometry *) const;
1027
+ };
1028
+
1029
+ //! @endcond
1030
+
1031
+ /** Unique pointer type for OGRGeometry.
1032
+ * @since GDAL 2.3
1033
+ */
1034
+ typedef std::unique_ptr<OGRGeometry, OGRGeometryUniquePtrDeleter>
1035
+ OGRGeometryUniquePtr;
1036
+
1037
+ //! @cond Doxygen_Suppress
1038
+ #define OGR_FORBID_DOWNCAST_TO(name) \
1039
+ inline OGR##name *to##name() = delete; \
1040
+ inline const OGR##name *to##name() const = delete;
1041
+
1042
+ #define OGR_FORBID_DOWNCAST_TO_POINT OGR_FORBID_DOWNCAST_TO(Point)
1043
+ #define OGR_FORBID_DOWNCAST_TO_CURVE OGR_FORBID_DOWNCAST_TO(Curve)
1044
+ #define OGR_FORBID_DOWNCAST_TO_SIMPLE_CURVE OGR_FORBID_DOWNCAST_TO(SimpleCurve)
1045
+ #define OGR_FORBID_DOWNCAST_TO_LINESTRING OGR_FORBID_DOWNCAST_TO(LineString)
1046
+ #define OGR_FORBID_DOWNCAST_TO_LINEARRING OGR_FORBID_DOWNCAST_TO(LinearRing)
1047
+ #define OGR_FORBID_DOWNCAST_TO_CIRCULARSTRING \
1048
+ OGR_FORBID_DOWNCAST_TO(CircularString)
1049
+ #define OGR_FORBID_DOWNCAST_TO_COMPOUNDCURVE \
1050
+ OGR_FORBID_DOWNCAST_TO(CompoundCurve)
1051
+ #define OGR_FORBID_DOWNCAST_TO_SURFACE OGR_FORBID_DOWNCAST_TO(Surface)
1052
+ #define OGR_FORBID_DOWNCAST_TO_CURVEPOLYGON OGR_FORBID_DOWNCAST_TO(CurvePolygon)
1053
+ #define OGR_FORBID_DOWNCAST_TO_POLYGON OGR_FORBID_DOWNCAST_TO(Polygon)
1054
+ #define OGR_FORBID_DOWNCAST_TO_TRIANGLE OGR_FORBID_DOWNCAST_TO(Triangle)
1055
+ #define OGR_FORBID_DOWNCAST_TO_MULTIPOINT OGR_FORBID_DOWNCAST_TO(MultiPoint)
1056
+ #define OGR_FORBID_DOWNCAST_TO_MULTICURVE OGR_FORBID_DOWNCAST_TO(MultiCurve)
1057
+ #define OGR_FORBID_DOWNCAST_TO_MULTILINESTRING \
1058
+ OGR_FORBID_DOWNCAST_TO(MultiLineString)
1059
+ #define OGR_FORBID_DOWNCAST_TO_MULTISURFACE OGR_FORBID_DOWNCAST_TO(MultiSurface)
1060
+ #define OGR_FORBID_DOWNCAST_TO_MULTIPOLYGON OGR_FORBID_DOWNCAST_TO(MultiPolygon)
1061
+ #define OGR_FORBID_DOWNCAST_TO_GEOMETRYCOLLECTION \
1062
+ OGR_FORBID_DOWNCAST_TO(GeometryCollection)
1063
+ #define OGR_FORBID_DOWNCAST_TO_POLYHEDRALSURFACE \
1064
+ OGR_FORBID_DOWNCAST_TO(PolyhedralSurface)
1065
+ #define OGR_FORBID_DOWNCAST_TO_TIN OGR_FORBID_DOWNCAST_TO(TriangulatedSurface)
1066
+
1067
+ #define OGR_ALLOW_UPCAST_TO(name) \
1068
+ inline OGR##name *to##name() \
1069
+ { \
1070
+ return this; \
1071
+ } \
1072
+ inline const OGR##name *to##name() const \
1073
+ { \
1074
+ return this; \
1075
+ }
1076
+
1077
+ #ifndef SUPPRESS_OGR_ALLOW_CAST_TO_THIS_WARNING
1078
+ #define CAST_TO_THIS_WARNING CPL_WARN_DEPRECATED("Casting to this is useless")
1079
+ #else
1080
+ #define CAST_TO_THIS_WARNING
1081
+ #endif
1082
+
1083
+ #define OGR_ALLOW_CAST_TO_THIS(name) \
1084
+ inline OGR##name *to##name() CAST_TO_THIS_WARNING \
1085
+ { \
1086
+ return this; \
1087
+ } \
1088
+ inline const OGR##name *to##name() const CAST_TO_THIS_WARNING \
1089
+ { \
1090
+ return this; \
1091
+ }
1092
+
1093
+ #define OGR_FORBID_DOWNCAST_TO_ALL_CURVES \
1094
+ OGR_FORBID_DOWNCAST_TO_CURVE \
1095
+ OGR_FORBID_DOWNCAST_TO_SIMPLE_CURVE \
1096
+ OGR_FORBID_DOWNCAST_TO_LINESTRING \
1097
+ OGR_FORBID_DOWNCAST_TO_LINEARRING \
1098
+ OGR_FORBID_DOWNCAST_TO_CIRCULARSTRING \
1099
+ OGR_FORBID_DOWNCAST_TO_COMPOUNDCURVE
1100
+
1101
+ #define OGR_FORBID_DOWNCAST_TO_ALL_SURFACES \
1102
+ OGR_FORBID_DOWNCAST_TO_SURFACE \
1103
+ OGR_FORBID_DOWNCAST_TO_CURVEPOLYGON \
1104
+ OGR_FORBID_DOWNCAST_TO_POLYGON \
1105
+ OGR_FORBID_DOWNCAST_TO_TRIANGLE \
1106
+ OGR_FORBID_DOWNCAST_TO_POLYHEDRALSURFACE \
1107
+ OGR_FORBID_DOWNCAST_TO_TIN
1108
+
1109
+ #define OGR_FORBID_DOWNCAST_TO_ALL_SINGLES \
1110
+ OGR_FORBID_DOWNCAST_TO_POINT \
1111
+ OGR_FORBID_DOWNCAST_TO_ALL_CURVES \
1112
+ OGR_FORBID_DOWNCAST_TO_ALL_SURFACES
1113
+
1114
+ #define OGR_FORBID_DOWNCAST_TO_ALL_MULTI \
1115
+ OGR_FORBID_DOWNCAST_TO_GEOMETRYCOLLECTION \
1116
+ OGR_FORBID_DOWNCAST_TO_MULTIPOINT \
1117
+ OGR_FORBID_DOWNCAST_TO_MULTICURVE \
1118
+ OGR_FORBID_DOWNCAST_TO_MULTILINESTRING \
1119
+ OGR_FORBID_DOWNCAST_TO_MULTISURFACE \
1120
+ OGR_FORBID_DOWNCAST_TO_MULTIPOLYGON
1121
+
1122
+ //! @endcond
1123
+
1124
+ /************************************************************************/
1125
+ /* OGRPoint */
1126
+ /************************************************************************/
1127
+
1128
+ /**
1129
+ * Point class.
1130
+ *
1131
+ * Implements SFCOM IPoint methods.
1132
+ */
1133
+
1134
+ class CPL_DLL OGRPoint : public OGRGeometry
1135
+ {
1136
+ double x;
1137
+ double y;
1138
+ double z;
1139
+ double m;
1140
+
1141
+ public:
1142
+ OGRPoint();
1143
+ OGRPoint(double x, double y);
1144
+ OGRPoint(double x, double y, double z);
1145
+ OGRPoint(double x, double y, double z, double m);
1146
+ OGRPoint(const OGRPoint &other);
1147
+ static OGRPoint *createXYM(double x, double y, double m);
1148
+
1149
+ OGRPoint &operator=(const OGRPoint &other);
1150
+
1151
+ // IWks Interface
1152
+ size_t WkbSize() const override;
1153
+ OGRErr importFromWkb(const unsigned char *, size_t, OGRwkbVariant,
1154
+ size_t &nBytesConsumedOut) override;
1155
+ OGRErr exportToWkb(unsigned char *,
1156
+ const OGRwkbExportOptions * = nullptr) const override;
1157
+
1158
+ #ifndef DOXYGEN_XML
1159
+ using OGRGeometry::importFromWkt; /** deprecated */
1160
+ #endif
1161
+
1162
+ OGRErr importFromWkt(const char **) override;
1163
+
1164
+ #ifndef DOXYGEN_XML
1165
+ using OGRGeometry::exportToWkt;
1166
+ #endif
1167
+
1168
+ /// Export a point to WKT
1169
+ /// \param opts Output options.
1170
+ /// \param err Pointer to error code, if desired.
1171
+ /// \return WKT string representing this point.
1172
+ virtual std::string exportToWkt(const OGRWktOptions &opts = OGRWktOptions(),
1173
+ OGRErr *err = nullptr) const override;
1174
+
1175
+ // IGeometry
1176
+ virtual int getDimension() const override;
1177
+ virtual OGRPoint *clone() const override;
1178
+ virtual void empty() override;
1179
+ virtual void getEnvelope(OGREnvelope *psEnvelope) const override;
1180
+ virtual void getEnvelope(OGREnvelope3D *psEnvelope) const override;
1181
+
1182
+ virtual OGRBoolean IsEmpty() const override
1183
+ {
1184
+ return !(flags & OGR_G_NOT_EMPTY_POINT);
1185
+ }
1186
+
1187
+ // IPoint
1188
+ /** Return x */
1189
+ double getX() const
1190
+ {
1191
+ return x;
1192
+ }
1193
+
1194
+ /** Return y */
1195
+ double getY() const
1196
+ {
1197
+ return y;
1198
+ }
1199
+
1200
+ /** Return z */
1201
+ double getZ() const
1202
+ {
1203
+ return z;
1204
+ }
1205
+
1206
+ /** Return m */
1207
+ double getM() const
1208
+ {
1209
+ return m;
1210
+ }
1211
+
1212
+ // Non standard
1213
+ virtual bool setCoordinateDimension(int nDimension) override;
1214
+
1215
+ /** Set x
1216
+ * @param xIn x
1217
+ */
1218
+ void setX(double xIn)
1219
+ {
1220
+ x = xIn;
1221
+ if (std::isnan(x) || std::isnan(y))
1222
+ flags &= ~OGR_G_NOT_EMPTY_POINT;
1223
+ else
1224
+ flags |= OGR_G_NOT_EMPTY_POINT;
1225
+ }
1226
+
1227
+ /** Set y
1228
+ * @param yIn y
1229
+ */
1230
+ void setY(double yIn)
1231
+ {
1232
+ y = yIn;
1233
+ if (std::isnan(x) || std::isnan(y))
1234
+ flags &= ~OGR_G_NOT_EMPTY_POINT;
1235
+ else
1236
+ flags |= OGR_G_NOT_EMPTY_POINT;
1237
+ }
1238
+
1239
+ /** Set z
1240
+ * @param zIn z
1241
+ */
1242
+ void setZ(double zIn)
1243
+ {
1244
+ z = zIn;
1245
+ flags |= OGR_G_3D;
1246
+ }
1247
+
1248
+ /** Set m
1249
+ * @param mIn m
1250
+ */
1251
+ void setM(double mIn)
1252
+ {
1253
+ m = mIn;
1254
+ flags |= OGR_G_MEASURED;
1255
+ }
1256
+
1257
+ // ISpatialRelation
1258
+ virtual OGRBoolean Equals(const OGRGeometry *) const override;
1259
+ virtual OGRBoolean Intersects(const OGRGeometry *) const override;
1260
+ virtual OGRBoolean Within(const OGRGeometry *) const override;
1261
+
1262
+ // Non standard from OGRGeometry
1263
+ virtual const char *getGeometryName() const override;
1264
+ virtual OGRwkbGeometryType getGeometryType() const override;
1265
+ virtual OGRErr transform(OGRCoordinateTransformation *poCT) override;
1266
+ virtual void flattenTo2D() override;
1267
+
1268
+ virtual void accept(IOGRGeometryVisitor *visitor) override
1269
+ {
1270
+ visitor->visit(this);
1271
+ }
1272
+
1273
+ virtual void accept(IOGRConstGeometryVisitor *visitor) const override
1274
+ {
1275
+ visitor->visit(this);
1276
+ }
1277
+
1278
+ virtual void swapXY() override;
1279
+
1280
+ OGR_ALLOW_CAST_TO_THIS(Point)
1281
+ OGR_FORBID_DOWNCAST_TO_ALL_CURVES
1282
+ OGR_FORBID_DOWNCAST_TO_ALL_SURFACES
1283
+ OGR_FORBID_DOWNCAST_TO_ALL_MULTI
1284
+ };
1285
+
1286
+ /************************************************************************/
1287
+ /* OGRPointIterator */
1288
+ /************************************************************************/
1289
+
1290
+ /**
1291
+ * Interface for a point iterator.
1292
+ *
1293
+ * @since GDAL 2.0
1294
+ */
1295
+
1296
+ class CPL_DLL OGRPointIterator
1297
+ {
1298
+ public:
1299
+ virtual ~OGRPointIterator();
1300
+ virtual OGRBoolean getNextPoint(OGRPoint *p) = 0;
1301
+
1302
+ static void destroy(OGRPointIterator *);
1303
+ };
1304
+
1305
+ /************************************************************************/
1306
+ /* OGRCurve */
1307
+ /************************************************************************/
1308
+
1309
+ /**
1310
+ * Abstract curve base class for OGRLineString, OGRCircularString and
1311
+ * OGRCompoundCurve
1312
+ */
1313
+
1314
+ class CPL_DLL OGRCurve : public OGRGeometry
1315
+ {
1316
+ protected:
1317
+ //! @cond Doxygen_Suppress
1318
+ OGRCurve() = default;
1319
+ OGRCurve(const OGRCurve &other) = default;
1320
+
1321
+ virtual OGRCurveCasterToLineString GetCasterToLineString() const = 0;
1322
+ virtual OGRCurveCasterToLinearRing GetCasterToLinearRing() const = 0;
1323
+
1324
+ friend class OGRCurvePolygon;
1325
+ friend class OGRCompoundCurve;
1326
+ //! @endcond
1327
+ virtual int ContainsPoint(const OGRPoint *p) const;
1328
+ virtual int IntersectsPoint(const OGRPoint *p) const;
1329
+ virtual double get_AreaOfCurveSegments() const = 0;
1330
+
1331
+ private:
1332
+ class CPL_DLL ConstIterator
1333
+ {
1334
+ struct Private;
1335
+ std::unique_ptr<Private> m_poPrivate;
1336
+
1337
+ public:
1338
+ ConstIterator(const OGRCurve *poSelf, bool bStart);
1339
+ ConstIterator(ConstIterator &&oOther) noexcept;
1340
+ ConstIterator &operator=(ConstIterator &&oOther);
1341
+ ~ConstIterator();
1342
+ const OGRPoint &operator*() const;
1343
+ ConstIterator &operator++();
1344
+ bool operator!=(const ConstIterator &it) const;
1345
+ };
1346
+
1347
+ friend inline ConstIterator begin(const OGRCurve *);
1348
+ friend inline ConstIterator end(const OGRCurve *);
1349
+
1350
+ public:
1351
+ //! @cond Doxygen_Suppress
1352
+ OGRCurve &operator=(const OGRCurve &other);
1353
+ //! @endcond
1354
+
1355
+ /** Type of child elements. */
1356
+ typedef OGRPoint ChildType;
1357
+
1358
+ /** Return begin of a point iterator.
1359
+ *
1360
+ * Using this iterator for standard range-based loops is safe, but
1361
+ * due to implementation limitations, you shouldn't try to access
1362
+ * (dereference) more than one iterator step at a time, since you will get
1363
+ * a reference to the same OGRPoint& object.
1364
+ * @since GDAL 2.3
1365
+ */
1366
+ ConstIterator begin() const;
1367
+ /** Return end of a point iterator. */
1368
+ ConstIterator end() const;
1369
+
1370
+ // IGeometry
1371
+ virtual OGRCurve *clone() const override = 0;
1372
+
1373
+ // ICurve methods
1374
+ virtual double get_Length() const = 0;
1375
+ virtual void StartPoint(OGRPoint *) const = 0;
1376
+ virtual void EndPoint(OGRPoint *) const = 0;
1377
+ virtual int get_IsClosed() const;
1378
+ virtual void Value(double, OGRPoint *) const = 0;
1379
+ virtual OGRLineString *
1380
+ CurveToLine(double dfMaxAngleStepSizeDegrees = 0,
1381
+ const char *const *papszOptions = nullptr) const = 0;
1382
+ virtual int getDimension() const override;
1383
+
1384
+ // non standard
1385
+ virtual int getNumPoints() const = 0;
1386
+ virtual OGRPointIterator *getPointIterator() const = 0;
1387
+ virtual OGRBoolean IsConvex() const;
1388
+ virtual double get_Area() const = 0;
1389
+ virtual double get_GeodesicArea(
1390
+ const OGRSpatialReference *poSRSOverride = nullptr) const = 0;
1391
+ virtual double get_GeodesicLength(
1392
+ const OGRSpatialReference *poSRSOverride = nullptr) const = 0;
1393
+ virtual int isClockwise() const;
1394
+ virtual void reversePoints() = 0;
1395
+
1396
+ /** Down-cast to OGRSimpleCurve*.
1397
+ * Implies prior checking that wkbFlatten(getGeometryType()) ==
1398
+ * wkbLineString or wkbCircularString. */
1399
+ inline OGRSimpleCurve *toSimpleCurve()
1400
+ {
1401
+ return cpl::down_cast<OGRSimpleCurve *>(this);
1402
+ }
1403
+
1404
+ /** Down-cast to OGRSimpleCurve*.
1405
+ * Implies prior checking that wkbFlatten(getGeometryType()) ==
1406
+ * wkbLineString or wkbCircularString. */
1407
+ inline const OGRSimpleCurve *toSimpleCurve() const
1408
+ {
1409
+ return cpl::down_cast<const OGRSimpleCurve *>(this);
1410
+ }
1411
+
1412
+ static OGRCompoundCurve *CastToCompoundCurve(OGRCurve *puCurve);
1413
+ static OGRLineString *CastToLineString(OGRCurve *poCurve);
1414
+ static OGRLinearRing *CastToLinearRing(OGRCurve *poCurve);
1415
+
1416
+ OGR_FORBID_DOWNCAST_TO_POINT
1417
+ OGR_ALLOW_CAST_TO_THIS(Curve)
1418
+ OGR_FORBID_DOWNCAST_TO_ALL_SURFACES
1419
+ OGR_FORBID_DOWNCAST_TO_ALL_MULTI
1420
+ };
1421
+
1422
+ //! @cond Doxygen_Suppress
1423
+ /** @see OGRCurve::begin() const */
1424
+ inline OGRCurve::ConstIterator begin(const OGRCurve *poCurve)
1425
+ {
1426
+ return poCurve->begin();
1427
+ }
1428
+
1429
+ /** @see OGRCurve::end() const */
1430
+ inline OGRCurve::ConstIterator end(const OGRCurve *poCurve)
1431
+ {
1432
+ return poCurve->end();
1433
+ }
1434
+
1435
+ //! @endcond
1436
+
1437
+ /************************************************************************/
1438
+ /* OGRIteratedPoint */
1439
+ /************************************************************************/
1440
+
1441
+ /*!
1442
+ Implementation detail of OGRSimpleCurve::Iterator.
1443
+
1444
+ This class is a simple wrapper over OGRPoint, which shouldn't be directly
1445
+ referenced by the user other than trough auto&& in an iteator
1446
+ over a OGRSimpleCurve.
1447
+
1448
+ Typical usage pattern is:
1449
+ \verbatim
1450
+ for (auto&& p: line)
1451
+ {
1452
+ p.setZ(100);
1453
+ }
1454
+ \endverbatim
1455
+
1456
+ The lifetime of this object is coupled to the one of the curve on which it
1457
+ was returned. It is thus also illegal to modify it once the curve has been
1458
+ deleted.
1459
+
1460
+ @since GDAL 3.6
1461
+ */
1462
+ class CPL_DLL OGRIteratedPoint : public OGRPoint
1463
+ {
1464
+ private:
1465
+ friend class OGRSimpleCurve;
1466
+
1467
+ OGRSimpleCurve *m_poCurve = nullptr;
1468
+ int m_nPos = 0;
1469
+
1470
+ OGRIteratedPoint() = default;
1471
+
1472
+ CPL_DISALLOW_COPY_ASSIGN(OGRIteratedPoint)
1473
+
1474
+ public:
1475
+ /** Set x
1476
+ * @param xIn x
1477
+ */
1478
+ void setX(double xIn);
1479
+ /** Set y
1480
+ * @param yIn y
1481
+ */
1482
+ void setY(double yIn);
1483
+ /** Set z
1484
+ * @param zIn z
1485
+ */
1486
+ void setZ(double zIn);
1487
+ /** Set m
1488
+ * @param mIn m
1489
+ */
1490
+ void setM(double mIn);
1491
+ };
1492
+
1493
+ /************************************************************************/
1494
+ /* OGRSimpleCurve */
1495
+ /************************************************************************/
1496
+
1497
+ /**
1498
+ * Abstract curve base class for OGRLineString and OGRCircularString
1499
+ *
1500
+ * Note: this class does not exist in SQL/MM standard and exists for
1501
+ * implementation convenience.
1502
+ *
1503
+ * @since GDAL 2.0
1504
+ */
1505
+
1506
+ class CPL_DLL OGRSimpleCurve : public OGRCurve
1507
+ {
1508
+ protected:
1509
+ //! @cond Doxygen_Suppress
1510
+ friend class OGRGeometry;
1511
+
1512
+ int nPointCount = 0;
1513
+ int m_nPointCapacity = 0;
1514
+ OGRRawPoint *paoPoints = nullptr;
1515
+ double *padfZ = nullptr;
1516
+ double *padfM = nullptr;
1517
+
1518
+ bool Make3D();
1519
+ void Make2D();
1520
+ void RemoveM();
1521
+ bool AddM();
1522
+
1523
+ OGRErr importFromWKTListOnly(const char **ppszInput, int bHasZ, int bHasM,
1524
+ OGRRawPoint *&paoPointsIn, int &nMaxPoints,
1525
+ double *&padfZIn);
1526
+ //! @endcond
1527
+
1528
+ virtual double get_LinearArea() const;
1529
+
1530
+ /** Constructor */
1531
+ OGRSimpleCurve() = default;
1532
+
1533
+ OGRSimpleCurve(const OGRSimpleCurve &other);
1534
+
1535
+ private:
1536
+ class CPL_DLL Iterator
1537
+ {
1538
+ struct Private;
1539
+ std::unique_ptr<Private> m_poPrivate;
1540
+ void update();
1541
+
1542
+ public:
1543
+ Iterator(OGRSimpleCurve *poSelf, int nPos);
1544
+ Iterator(Iterator &&oOther) noexcept; // declared but not defined.
1545
+ // Needed for gcc 5.4 at least
1546
+ ~Iterator();
1547
+ OGRIteratedPoint &operator*();
1548
+ Iterator &operator++();
1549
+ bool operator!=(const Iterator &it) const;
1550
+ };
1551
+
1552
+ friend inline Iterator begin(OGRSimpleCurve *);
1553
+ friend inline Iterator end(OGRSimpleCurve *);
1554
+
1555
+ class CPL_DLL ConstIterator
1556
+ {
1557
+ struct Private;
1558
+ std::unique_ptr<Private> m_poPrivate;
1559
+
1560
+ public:
1561
+ ConstIterator(const OGRSimpleCurve *poSelf, int nPos);
1562
+ ConstIterator(
1563
+ ConstIterator &&oOther) noexcept; // declared but not defined.
1564
+ // Needed for gcc 5.4 at least
1565
+ ~ConstIterator();
1566
+ const OGRPoint &operator*() const;
1567
+ ConstIterator &operator++();
1568
+ bool operator!=(const ConstIterator &it) const;
1569
+ };
1570
+
1571
+ friend inline ConstIterator begin(const OGRSimpleCurve *);
1572
+ friend inline ConstIterator end(const OGRSimpleCurve *);
1573
+
1574
+ public:
1575
+ ~OGRSimpleCurve() override;
1576
+
1577
+ OGRSimpleCurve &operator=(const OGRSimpleCurve &other);
1578
+
1579
+ /** Type of child elements. */
1580
+ typedef OGRPoint ChildType;
1581
+
1582
+ /** Return begin of point iterator.
1583
+ *
1584
+ * Using this iterator for standard range-based loops is safe, but
1585
+ * due to implementation limitations, you shouldn't try to access
1586
+ * (dereference) more than one iterator step at a time, since you will get
1587
+ * a reference to the same OGRPoint& object.
1588
+ * @since GDAL 2.3
1589
+ */
1590
+ Iterator begin();
1591
+ /** Return end of point iterator. */
1592
+ Iterator end();
1593
+ /** Return begin of point iterator.
1594
+ *
1595
+ * Using this iterator for standard range-based loops is safe, but
1596
+ * due to implementation limitations, you shouldn't try to access
1597
+ * (dereference) more than one iterator step at a time, since you will get
1598
+ * a reference to the same OGRPoint& object.
1599
+ * @since GDAL 2.3
1600
+ */
1601
+ ConstIterator begin() const;
1602
+ /** Return end of point iterator. */
1603
+ ConstIterator end() const;
1604
+
1605
+ // IWks Interface.
1606
+ virtual size_t WkbSize() const override;
1607
+ virtual OGRErr importFromWkb(const unsigned char *, size_t, OGRwkbVariant,
1608
+ size_t &nBytesConsumedOut) override;
1609
+ virtual OGRErr
1610
+ exportToWkb(unsigned char *,
1611
+ const OGRwkbExportOptions * = nullptr) const override;
1612
+
1613
+ #ifndef DOXYGEN_XML
1614
+ using OGRGeometry::importFromWkt; /** deprecated */
1615
+ #endif
1616
+
1617
+ OGRErr importFromWkt(const char **) override;
1618
+
1619
+ #ifndef DOXYGEN_XML
1620
+ using OGRGeometry::exportToWkt;
1621
+ #endif
1622
+
1623
+ /// Export a simple curve to WKT
1624
+ /// \param opts Output options.
1625
+ /// \param err Pointer to error code, if desired.
1626
+ /// \return WKT string representing this simple curve.
1627
+ virtual std::string exportToWkt(const OGRWktOptions &opts = OGRWktOptions(),
1628
+ OGRErr *err = nullptr) const override;
1629
+
1630
+ // IGeometry interface.
1631
+ virtual void empty() override;
1632
+ virtual void getEnvelope(OGREnvelope *psEnvelope) const override;
1633
+ virtual void getEnvelope(OGREnvelope3D *psEnvelope) const override;
1634
+ virtual OGRBoolean IsEmpty() const override;
1635
+ virtual OGRSimpleCurve *clone() const override = 0;
1636
+
1637
+ // ICurve methods.
1638
+ virtual double get_Length() const override;
1639
+ virtual void StartPoint(OGRPoint *) const override;
1640
+ virtual void EndPoint(OGRPoint *) const override;
1641
+ virtual void Value(double, OGRPoint *) const override;
1642
+ virtual double Project(const OGRPoint *) const;
1643
+ virtual OGRLineString *getSubLine(double, double, int) const;
1644
+
1645
+ // ILineString methods.
1646
+ virtual int getNumPoints() const override
1647
+ {
1648
+ return nPointCount;
1649
+ }
1650
+
1651
+ void getPoint(int, OGRPoint *) const;
1652
+
1653
+ double getX(int i) const
1654
+ {
1655
+ return paoPoints[i].x;
1656
+ }
1657
+
1658
+ double getY(int i) const
1659
+ {
1660
+ return paoPoints[i].y;
1661
+ }
1662
+
1663
+ double getZ(int i) const;
1664
+ double getM(int i) const;
1665
+
1666
+ // ISpatialRelation
1667
+ virtual OGRBoolean Equals(const OGRGeometry *) const override;
1668
+
1669
+ // non standard.
1670
+ virtual bool setCoordinateDimension(int nDimension) override;
1671
+ virtual bool set3D(OGRBoolean bIs3D) override;
1672
+ virtual bool setMeasured(OGRBoolean bIsMeasured) override;
1673
+ bool setNumPoints(int nNewPointCount, int bZeroizeNewContent = TRUE);
1674
+ bool setPoint(int, OGRPoint *);
1675
+ bool setPoint(int, double, double);
1676
+ bool setZ(int, double);
1677
+ bool setM(int, double);
1678
+ bool setPoint(int, double, double, double);
1679
+ bool setPointM(int, double, double, double);
1680
+ bool setPoint(int, double, double, double, double);
1681
+ bool setPoints(int, const OGRRawPoint *, const double * = nullptr);
1682
+ bool setPointsM(int, const OGRRawPoint *, const double *);
1683
+ bool setPoints(int, const OGRRawPoint *, const double *, const double *);
1684
+ bool setPoints(int, const double *padfX, const double *padfY,
1685
+ const double *padfZIn = nullptr);
1686
+ bool setPointsM(int, const double *padfX, const double *padfY,
1687
+ const double *padfMIn = nullptr);
1688
+ bool setPoints(int, const double *padfX, const double *padfY,
1689
+ const double *padfZIn, const double *padfMIn);
1690
+ bool addPoint(const OGRPoint *);
1691
+ bool addPoint(double, double);
1692
+ bool addPoint(double, double, double);
1693
+ bool addPointM(double, double, double);
1694
+ bool addPoint(double, double, double, double);
1695
+
1696
+ bool removePoint(int);
1697
+
1698
+ void getPoints(OGRRawPoint *, double * = nullptr) const;
1699
+ void getPoints(void *pabyX, int nXStride, void *pabyY, int nYStride,
1700
+ void *pabyZ = nullptr, int nZStride = 0,
1701
+ void *pabyM = nullptr, int nMStride = 0) const;
1702
+
1703
+ void addSubLineString(const OGRLineString *, int nStartVertex = 0,
1704
+ int nEndVertex = -1);
1705
+ void reversePoints() override;
1706
+ virtual OGRPointIterator *getPointIterator() const override;
1707
+
1708
+ // non-standard from OGRGeometry
1709
+ virtual OGRErr transform(OGRCoordinateTransformation *poCT) override;
1710
+ virtual void flattenTo2D() override;
1711
+ virtual bool segmentize(double dfMaxLength) override;
1712
+
1713
+ virtual void swapXY() override;
1714
+
1715
+ OGR_ALLOW_UPCAST_TO(Curve)
1716
+ OGR_ALLOW_CAST_TO_THIS(SimpleCurve)
1717
+ };
1718
+
1719
+ //! @cond Doxygen_Suppress
1720
+ /** @see OGRSimpleCurve::begin() */
1721
+ inline OGRSimpleCurve::Iterator begin(OGRSimpleCurve *poCurve)
1722
+ {
1723
+ return poCurve->begin();
1724
+ }
1725
+
1726
+ /** @see OGRSimpleCurve::end() */
1727
+ inline OGRSimpleCurve::Iterator end(OGRSimpleCurve *poCurve)
1728
+ {
1729
+ return poCurve->end();
1730
+ }
1731
+
1732
+ /** @see OGRSimpleCurve::begin() const */
1733
+ inline OGRSimpleCurve::ConstIterator begin(const OGRSimpleCurve *poCurve)
1734
+ {
1735
+ return poCurve->begin();
1736
+ }
1737
+
1738
+ /** @see OGRSimpleCurve::end() const */
1739
+ inline OGRSimpleCurve::ConstIterator end(const OGRSimpleCurve *poCurve)
1740
+ {
1741
+ return poCurve->end();
1742
+ }
1743
+
1744
+ //! @endcond
1745
+
1746
+ /************************************************************************/
1747
+ /* OGRLineString */
1748
+ /************************************************************************/
1749
+
1750
+ /**
1751
+ * Concrete representation of a multi-vertex line.
1752
+ *
1753
+ * Note: for implementation convenience, we make it inherit from OGRSimpleCurve
1754
+ * whereas SFSQL and SQL/MM only make it inherits from OGRCurve.
1755
+ */
1756
+
1757
+ class CPL_DLL OGRLineString : public OGRSimpleCurve
1758
+ {
1759
+ // cppcheck-suppress unusedPrivateFunction
1760
+ static OGRLinearRing *CasterToLinearRing(OGRCurve *poCurve);
1761
+
1762
+ protected:
1763
+ //! @cond Doxygen_Suppress
1764
+ static OGRLineString *TransferMembersAndDestroy(OGRLineString *poSrc,
1765
+ OGRLineString *poDst);
1766
+
1767
+ virtual OGRCurveCasterToLineString GetCasterToLineString() const override;
1768
+ virtual OGRCurveCasterToLinearRing GetCasterToLinearRing() const override;
1769
+
1770
+ virtual double get_AreaOfCurveSegments() const override;
1771
+ //! @endcond
1772
+
1773
+ static OGRLinearRing *CastToLinearRing(OGRLineString *poLS);
1774
+
1775
+ public:
1776
+ /** Create an empty line string. */
1777
+ OGRLineString() = default;
1778
+ OGRLineString(const OGRLineString &other);
1779
+
1780
+ OGRLineString &operator=(const OGRLineString &other);
1781
+
1782
+ virtual OGRLineString *clone() const override;
1783
+ virtual OGRLineString *
1784
+ CurveToLine(double dfMaxAngleStepSizeDegrees = 0,
1785
+ const char *const *papszOptions = nullptr) const override;
1786
+ virtual OGRGeometry *
1787
+ getCurveGeometry(const char *const *papszOptions = nullptr) const override;
1788
+ virtual double get_Area() const override;
1789
+ virtual double get_GeodesicArea(
1790
+ const OGRSpatialReference *poSRSOverride = nullptr) const override;
1791
+ virtual double get_GeodesicLength(
1792
+ const OGRSpatialReference *poSRSOverride = nullptr) const override;
1793
+
1794
+ // Non-standard from OGRGeometry.
1795
+ virtual OGRwkbGeometryType getGeometryType() const override;
1796
+ virtual const char *getGeometryName() const override;
1797
+ virtual int isClockwise() const override;
1798
+
1799
+ /** Return pointer of this in upper class */
1800
+ inline OGRSimpleCurve *toUpperClass()
1801
+ {
1802
+ return this;
1803
+ }
1804
+
1805
+ /** Return pointer of this in upper class */
1806
+ inline const OGRSimpleCurve *toUpperClass() const
1807
+ {
1808
+ return this;
1809
+ }
1810
+
1811
+ virtual void accept(IOGRGeometryVisitor *visitor) override
1812
+ {
1813
+ visitor->visit(this);
1814
+ }
1815
+
1816
+ virtual void accept(IOGRConstGeometryVisitor *visitor) const override
1817
+ {
1818
+ visitor->visit(this);
1819
+ }
1820
+
1821
+ OGR_ALLOW_UPCAST_TO(SimpleCurve)
1822
+ OGR_ALLOW_CAST_TO_THIS(LineString)
1823
+ };
1824
+
1825
+ /************************************************************************/
1826
+ /* OGRLinearRing */
1827
+ /************************************************************************/
1828
+
1829
+ /**
1830
+ * Concrete representation of a closed ring.
1831
+ *
1832
+ * This class is functionally equivalent to an OGRLineString, but has a
1833
+ * separate identity to maintain alignment with the OpenGIS simple feature
1834
+ * data model. It exists to serve as a component of an OGRPolygon.
1835
+ *
1836
+ * The OGRLinearRing has no corresponding free standing well known binary
1837
+ * representation, so importFromWkb() and exportToWkb() will not actually
1838
+ * work. There is a non-standard GDAL WKT representation though.
1839
+ *
1840
+ * Because OGRLinearRing is not a "proper" free standing simple features
1841
+ * object, it cannot be directly used on a feature via SetGeometry(), and
1842
+ * cannot generally be used with GEOS for operations like Intersects().
1843
+ * Instead the polygon should be used, or the OGRLinearRing should be
1844
+ * converted to an OGRLineString for such operations.
1845
+ *
1846
+ * Note: this class exists in SFSQL 1.2, but not in ISO SQL/MM Part 3.
1847
+ */
1848
+
1849
+ class CPL_DLL OGRLinearRing : public OGRLineString
1850
+ {
1851
+ static OGRLineString *CasterToLineString(OGRCurve *poCurve);
1852
+
1853
+ // IWks Interface - Note this isn't really a first class object
1854
+ // for the purposes of WKB form. These methods always fail since this
1855
+ // object can't be serialized on its own.
1856
+ virtual size_t WkbSize() const override;
1857
+ virtual OGRErr importFromWkb(const unsigned char *, size_t, OGRwkbVariant,
1858
+ size_t &nBytesConsumedOut) override;
1859
+ OGRErr exportToWkb(unsigned char *,
1860
+ const OGRwkbExportOptions * = nullptr) const override;
1861
+
1862
+ protected:
1863
+ //! @cond Doxygen_Suppress
1864
+ friend class OGRPolygon;
1865
+ friend class OGRTriangle;
1866
+
1867
+ // These are not IWks compatible ... just a convenience for OGRPolygon.
1868
+ virtual size_t _WkbSize(int _flags) const;
1869
+ virtual OGRErr _importFromWkb(OGRwkbByteOrder, int _flags,
1870
+ const unsigned char *, size_t,
1871
+ size_t &nBytesConsumedOut);
1872
+ virtual OGRErr _exportToWkb(int _flags, unsigned char *,
1873
+ const OGRwkbExportOptions *) const;
1874
+
1875
+ virtual OGRCurveCasterToLineString GetCasterToLineString() const override;
1876
+ virtual OGRCurveCasterToLinearRing GetCasterToLinearRing() const override;
1877
+ //! @endcond
1878
+
1879
+ static OGRLineString *CastToLineString(OGRLinearRing *poLR);
1880
+
1881
+ public:
1882
+ /** Constructor */
1883
+ OGRLinearRing() = default;
1884
+ OGRLinearRing(const OGRLinearRing &other);
1885
+ explicit OGRLinearRing(const OGRLinearRing *);
1886
+
1887
+ OGRLinearRing &operator=(const OGRLinearRing &other);
1888
+
1889
+ // Non standard.
1890
+ virtual const char *getGeometryName() const override;
1891
+ virtual OGRLinearRing *clone() const override;
1892
+
1893
+ //! @cond Doxygen_Suppress
1894
+ void reverseWindingOrder()
1895
+ CPL_WARN_DEPRECATED("Use reversePoints() instead");
1896
+ //! @endcond
1897
+
1898
+ virtual void closeRings() override;
1899
+ OGRBoolean isPointInRing(const OGRPoint *pt,
1900
+ int bTestEnvelope = TRUE) const;
1901
+ OGRBoolean isPointOnRingBoundary(const OGRPoint *pt,
1902
+ int bTestEnvelope = TRUE) const;
1903
+ virtual OGRErr transform(OGRCoordinateTransformation *poCT) override;
1904
+
1905
+ /** Return pointer of this in upper class */
1906
+ inline OGRLineString *toUpperClass()
1907
+ {
1908
+ return this;
1909
+ }
1910
+
1911
+ /** Return pointer of this in upper class */
1912
+ inline const OGRLineString *toUpperClass() const
1913
+ {
1914
+ return this;
1915
+ }
1916
+
1917
+ virtual void accept(IOGRGeometryVisitor *visitor) override
1918
+ {
1919
+ visitor->visit(this);
1920
+ }
1921
+
1922
+ virtual void accept(IOGRConstGeometryVisitor *visitor) const override
1923
+ {
1924
+ visitor->visit(this);
1925
+ }
1926
+
1927
+ OGR_ALLOW_UPCAST_TO(LineString)
1928
+ OGR_ALLOW_CAST_TO_THIS(LinearRing)
1929
+ };
1930
+
1931
+ /************************************************************************/
1932
+ /* OGRCircularString */
1933
+ /************************************************************************/
1934
+
1935
+ /**
1936
+ * Concrete representation of a circular string, that is to say a curve made
1937
+ * of one or several arc circles.
1938
+ *
1939
+ * Note: for implementation convenience, we make it inherit from OGRSimpleCurve
1940
+ * whereas SQL/MM only makes it inherits from OGRCurve.
1941
+ *
1942
+ * Compatibility: ISO SQL/MM Part 3.
1943
+ *
1944
+ * @since GDAL 2.0
1945
+ */
1946
+
1947
+ class CPL_DLL OGRCircularString : public OGRSimpleCurve
1948
+ {
1949
+ private:
1950
+ void ExtendEnvelopeWithCircular(OGREnvelope *psEnvelope) const;
1951
+ OGRBoolean IsValidFast() const;
1952
+ int IsFullCircle(double &cx, double &cy, double &square_R) const;
1953
+
1954
+ protected:
1955
+ //! @cond Doxygen_Suppress
1956
+ virtual OGRCurveCasterToLineString GetCasterToLineString() const override;
1957
+ virtual OGRCurveCasterToLinearRing GetCasterToLinearRing() const override;
1958
+ virtual int IntersectsPoint(const OGRPoint *p) const override;
1959
+ virtual int ContainsPoint(const OGRPoint *p) const override;
1960
+ virtual double get_AreaOfCurveSegments() const override;
1961
+ //! @endcond
1962
+
1963
+ public:
1964
+ /** Create an empty circular string. */
1965
+ OGRCircularString() = default;
1966
+
1967
+ OGRCircularString(const OGRCircularString &other);
1968
+
1969
+ OGRCircularString &operator=(const OGRCircularString &other);
1970
+
1971
+ // IWks Interface.
1972
+ virtual OGRErr importFromWkb(const unsigned char *, size_t, OGRwkbVariant,
1973
+ size_t &nBytesConsumedOut) override;
1974
+ OGRErr exportToWkb(unsigned char *,
1975
+ const OGRwkbExportOptions * = nullptr) const override;
1976
+
1977
+ #ifndef DOXYGEN_XML
1978
+ using OGRGeometry::importFromWkt; /** deprecated */
1979
+ #endif
1980
+
1981
+ OGRErr importFromWkt(const char **) override;
1982
+
1983
+ #ifndef DOXYGEN_XML
1984
+ using OGRGeometry::exportToWkt;
1985
+ #endif
1986
+
1987
+ /// Export a circular string to WKT
1988
+ /// \param opts Output options.
1989
+ /// \param err Pointer to error code, if desired.
1990
+ /// \return WKT string representing this circular string.
1991
+ virtual std::string exportToWkt(const OGRWktOptions &opts = OGRWktOptions(),
1992
+ OGRErr *err = nullptr) const override;
1993
+
1994
+ // IGeometry interface.
1995
+ virtual OGRBoolean IsValid() const override;
1996
+ virtual void getEnvelope(OGREnvelope *psEnvelope) const override;
1997
+ virtual void getEnvelope(OGREnvelope3D *psEnvelope) const override;
1998
+ virtual OGRCircularString *clone() const override;
1999
+
2000
+ // ICurve methods.
2001
+ virtual double get_Length() const override;
2002
+ virtual OGRLineString *
2003
+ CurveToLine(double dfMaxAngleStepSizeDegrees = 0,
2004
+ const char *const *papszOptions = nullptr) const override;
2005
+ virtual void Value(double, OGRPoint *) const override;
2006
+ virtual double get_Area() const override;
2007
+ virtual double get_GeodesicArea(
2008
+ const OGRSpatialReference *poSRSOverride = nullptr) const override;
2009
+ virtual double get_GeodesicLength(
2010
+ const OGRSpatialReference *poSRSOverride = nullptr) const override;
2011
+
2012
+ // Non-standard from OGRGeometry.
2013
+ virtual OGRwkbGeometryType getGeometryType() const override;
2014
+ virtual const char *getGeometryName() const override;
2015
+ virtual bool segmentize(double dfMaxLength) override;
2016
+ virtual OGRBoolean
2017
+ hasCurveGeometry(int bLookForNonLinear = FALSE) const override;
2018
+ virtual OGRGeometry *
2019
+ getLinearGeometry(double dfMaxAngleStepSizeDegrees = 0,
2020
+ const char *const *papszOptions = nullptr) const override;
2021
+
2022
+ /** Return pointer of this in upper class */
2023
+ inline OGRSimpleCurve *toUpperClass()
2024
+ {
2025
+ return this;
2026
+ }
2027
+
2028
+ /** Return pointer of this in upper class */
2029
+ inline const OGRSimpleCurve *toUpperClass() const
2030
+ {
2031
+ return this;
2032
+ }
2033
+
2034
+ virtual void accept(IOGRGeometryVisitor *visitor) override
2035
+ {
2036
+ visitor->visit(this);
2037
+ }
2038
+
2039
+ virtual void accept(IOGRConstGeometryVisitor *visitor) const override
2040
+ {
2041
+ visitor->visit(this);
2042
+ }
2043
+
2044
+ OGR_ALLOW_UPCAST_TO(SimpleCurve)
2045
+ OGR_ALLOW_CAST_TO_THIS(CircularString)
2046
+ };
2047
+
2048
+ /************************************************************************/
2049
+ /* OGRCurveCollection */
2050
+ /************************************************************************/
2051
+
2052
+ /**
2053
+ * Utility class to store a collection of curves. Used as a member of
2054
+ * OGRCompoundCurve and OGRCurvePolygon.
2055
+ *
2056
+ * This class is only exported because of linking issues. It should never
2057
+ * be directly used.
2058
+ *
2059
+ * @since GDAL 2.0
2060
+ */
2061
+
2062
+ //! @cond Doxygen_Suppress
2063
+ class CPL_DLL OGRCurveCollection
2064
+ {
2065
+ protected:
2066
+ friend class OGRCompoundCurve;
2067
+ friend class OGRCurvePolygon;
2068
+ friend class OGRPolygon;
2069
+ friend class OGRTriangle;
2070
+
2071
+ int nCurveCount = 0;
2072
+ OGRCurve **papoCurves = nullptr;
2073
+
2074
+ public:
2075
+ OGRCurveCollection() = default;
2076
+ OGRCurveCollection(const OGRCurveCollection &other);
2077
+ ~OGRCurveCollection();
2078
+
2079
+ OGRCurveCollection &operator=(const OGRCurveCollection &other);
2080
+
2081
+ /** Type of child elements. */
2082
+ typedef OGRCurve ChildType;
2083
+
2084
+ /** Return begin of curve iterator.
2085
+ * @since GDAL 2.3
2086
+ */
2087
+ OGRCurve **begin()
2088
+ {
2089
+ return papoCurves;
2090
+ }
2091
+
2092
+ /** Return end of curve iterator. */
2093
+ OGRCurve **end()
2094
+ {
2095
+ return papoCurves + nCurveCount;
2096
+ }
2097
+
2098
+ /** Return begin of curve iterator.
2099
+ * @since GDAL 2.3
2100
+ */
2101
+ const OGRCurve *const *begin() const
2102
+ {
2103
+ return papoCurves;
2104
+ }
2105
+
2106
+ /** Return end of curve iterator. */
2107
+ const OGRCurve *const *end() const
2108
+ {
2109
+ return papoCurves + nCurveCount;
2110
+ }
2111
+
2112
+ void empty(OGRGeometry *poGeom);
2113
+ OGRBoolean IsEmpty() const;
2114
+ void getEnvelope(OGREnvelope *psEnvelope) const;
2115
+ void getEnvelope(OGREnvelope3D *psEnvelope) const;
2116
+
2117
+ OGRErr addCurveDirectly(OGRGeometry *poGeom, OGRCurve *poCurve,
2118
+ int bNeedRealloc);
2119
+ size_t WkbSize() const;
2120
+ OGRErr importPreambleFromWkb(OGRGeometry *poGeom,
2121
+ const unsigned char *pabyData, size_t &nSize,
2122
+ size_t &nDataOffset,
2123
+ OGRwkbByteOrder &eByteOrder,
2124
+ size_t nMinSubGeomSize,
2125
+ OGRwkbVariant eWkbVariant);
2126
+ OGRErr
2127
+ importBodyFromWkb(OGRGeometry *poGeom, const unsigned char *pabyData,
2128
+ size_t nSize, bool bAcceptCompoundCurve,
2129
+ OGRErr (*pfnAddCurveDirectlyFromWkb)(OGRGeometry *poGeom,
2130
+ OGRCurve *poCurve),
2131
+ OGRwkbVariant eWkbVariant, size_t &nBytesConsumedOut);
2132
+ std::string exportToWkt(const OGRGeometry *geom, const OGRWktOptions &opts,
2133
+ OGRErr *err) const;
2134
+ OGRErr exportToWkb(const OGRGeometry *poGeom, unsigned char *,
2135
+ const OGRwkbExportOptions * = nullptr) const;
2136
+ OGRBoolean Equals(const OGRCurveCollection *poOCC) const;
2137
+ bool setCoordinateDimension(OGRGeometry *poGeom, int nNewDimension);
2138
+ bool set3D(OGRGeometry *poGeom, OGRBoolean bIs3D);
2139
+ bool setMeasured(OGRGeometry *poGeom, OGRBoolean bIsMeasured);
2140
+ void assignSpatialReference(OGRGeometry *poGeom,
2141
+ const OGRSpatialReference *poSR);
2142
+ int getNumCurves() const;
2143
+ OGRCurve *getCurve(int);
2144
+ const OGRCurve *getCurve(int) const;
2145
+ OGRCurve *stealCurve(int);
2146
+
2147
+ OGRErr removeCurve(int iIndex, bool bDelete = true);
2148
+
2149
+ bool hasEmptyParts() const;
2150
+ void removeEmptyParts();
2151
+
2152
+ void reversePoints();
2153
+
2154
+ OGRErr transform(OGRGeometry *poGeom, OGRCoordinateTransformation *poCT);
2155
+ void flattenTo2D(OGRGeometry *poGeom);
2156
+ bool segmentize(double dfMaxLength);
2157
+ void swapXY();
2158
+ OGRBoolean hasCurveGeometry(int bLookForNonLinear) const;
2159
+ };
2160
+
2161
+ //! @endcond
2162
+
2163
+ /************************************************************************/
2164
+ /* OGRCompoundCurve */
2165
+ /************************************************************************/
2166
+
2167
+ /**
2168
+ * Concrete representation of a compound curve, made of curves: OGRLineString
2169
+ * and OGRCircularString. Each curve is connected by its first point to
2170
+ * the last point of the previous curve.
2171
+ *
2172
+ * Compatibility: ISO SQL/MM Part 3.
2173
+ *
2174
+ * @since GDAL 2.0
2175
+ */
2176
+
2177
+ class CPL_DLL OGRCompoundCurve : public OGRCurve
2178
+ {
2179
+ private:
2180
+ OGRCurveCollection oCC{};
2181
+
2182
+ OGRErr addCurveDirectlyInternal(OGRCurve *poCurve, double dfToleranceEps,
2183
+ int bNeedRealloc);
2184
+ static OGRErr addCurveDirectlyFromWkt(OGRGeometry *poSelf,
2185
+ OGRCurve *poCurve);
2186
+ static OGRErr addCurveDirectlyFromWkb(OGRGeometry *poSelf,
2187
+ OGRCurve *poCurve);
2188
+ OGRLineString *CurveToLineInternal(double dfMaxAngleStepSizeDegrees,
2189
+ const char *const *papszOptions,
2190
+ int bIsLinearRing) const;
2191
+ // cppcheck-suppress unusedPrivateFunction
2192
+ static OGRLineString *CasterToLineString(OGRCurve *poCurve);
2193
+ // cppcheck-suppress unusedPrivateFunction
2194
+ static OGRLinearRing *CasterToLinearRing(OGRCurve *poCurve);
2195
+
2196
+ protected:
2197
+ //! @cond Doxygen_Suppress
2198
+ static OGRLineString *CastToLineString(OGRCompoundCurve *poCC);
2199
+ static OGRLinearRing *CastToLinearRing(OGRCompoundCurve *poCC);
2200
+
2201
+ virtual OGRCurveCasterToLineString GetCasterToLineString() const override;
2202
+ virtual OGRCurveCasterToLinearRing GetCasterToLinearRing() const override;
2203
+ //! @endcond
2204
+
2205
+ public:
2206
+ /** Create an empty compound curve. */
2207
+ OGRCompoundCurve() = default;
2208
+
2209
+ OGRCompoundCurve(const OGRCompoundCurve &other);
2210
+
2211
+ OGRCompoundCurve &operator=(const OGRCompoundCurve &other);
2212
+
2213
+ /** Type of child elements. */
2214
+ typedef OGRCurve ChildType;
2215
+
2216
+ /** Return begin of curve iterator.
2217
+ * @since GDAL 2.3
2218
+ */
2219
+ ChildType **begin()
2220
+ {
2221
+ return oCC.begin();
2222
+ }
2223
+
2224
+ /** Return end of curve iterator. */
2225
+ ChildType **end()
2226
+ {
2227
+ return oCC.end();
2228
+ }
2229
+
2230
+ /** Return begin of curve iterator.
2231
+ * @since GDAL 2.3
2232
+ */
2233
+ const ChildType *const *begin() const
2234
+ {
2235
+ return oCC.begin();
2236
+ }
2237
+
2238
+ /** Return end of curve iterator. */
2239
+ const ChildType *const *end() const
2240
+ {
2241
+ return oCC.end();
2242
+ }
2243
+
2244
+ // IWks Interface
2245
+ virtual size_t WkbSize() const override;
2246
+ virtual OGRErr importFromWkb(const unsigned char *, size_t, OGRwkbVariant,
2247
+ size_t &nBytesConsumedOut) override;
2248
+ OGRErr exportToWkb(unsigned char *,
2249
+ const OGRwkbExportOptions * = nullptr) const override;
2250
+
2251
+ #ifndef DOXYGEN_XML
2252
+ using OGRGeometry::importFromWkt; /** deprecated */
2253
+ #endif
2254
+
2255
+ OGRErr importFromWkt(const char **) override;
2256
+
2257
+ #ifndef DOXYGEN_XML
2258
+ using OGRGeometry::exportToWkt;
2259
+ #endif
2260
+
2261
+ /// Export a compound curve to WKT
2262
+ /// \param opts Output options.
2263
+ /// \param err Pointer to error code, if desired.
2264
+ /// \return WKT representation of the compound curve.
2265
+ virtual std::string exportToWkt(const OGRWktOptions &opts = OGRWktOptions(),
2266
+ OGRErr *err = nullptr) const override;
2267
+
2268
+ // IGeometry interface.
2269
+ virtual OGRCompoundCurve *clone() const override;
2270
+ virtual void empty() override;
2271
+ virtual void getEnvelope(OGREnvelope *psEnvelope) const override;
2272
+ virtual void getEnvelope(OGREnvelope3D *psEnvelope) const override;
2273
+ virtual OGRBoolean IsEmpty() const override;
2274
+
2275
+ // ICurve methods.
2276
+ virtual double get_Length() const override;
2277
+ virtual void StartPoint(OGRPoint *) const override;
2278
+ virtual void EndPoint(OGRPoint *) const override;
2279
+ virtual void Value(double, OGRPoint *) const override;
2280
+ virtual OGRLineString *
2281
+ CurveToLine(double dfMaxAngleStepSizeDegrees = 0,
2282
+ const char *const *papszOptions = nullptr) const override;
2283
+
2284
+ virtual int getNumPoints() const override;
2285
+ virtual double get_AreaOfCurveSegments() const override;
2286
+ virtual double get_Area() const override;
2287
+ virtual double get_GeodesicArea(
2288
+ const OGRSpatialReference *poSRSOverride = nullptr) const override;
2289
+ virtual double get_GeodesicLength(
2290
+ const OGRSpatialReference *poSRSOverride = nullptr) const override;
2291
+
2292
+ // ISpatialRelation.
2293
+ virtual OGRBoolean Equals(const OGRGeometry *) const override;
2294
+
2295
+ // ICompoundCurve method.
2296
+ int getNumCurves() const;
2297
+ OGRCurve *getCurve(int);
2298
+ const OGRCurve *getCurve(int) const;
2299
+
2300
+ // Non-standard.
2301
+ virtual bool setCoordinateDimension(int nDimension) override;
2302
+ virtual bool set3D(OGRBoolean bIs3D) override;
2303
+ virtual bool setMeasured(OGRBoolean bIsMeasured) override;
2304
+
2305
+ virtual void
2306
+ assignSpatialReference(const OGRSpatialReference *poSR) override;
2307
+
2308
+ /** Default relative tolerance to assume that the end of the previous curve
2309
+ * is equal to the start of the next one.
2310
+ */
2311
+ static constexpr double DEFAULT_TOLERANCE_EPSILON = 1e-14;
2312
+
2313
+ OGRErr addCurve(const OGRCurve *,
2314
+ double dfToleranceEps = DEFAULT_TOLERANCE_EPSILON);
2315
+ OGRErr addCurveDirectly(OGRCurve *,
2316
+ double dfToleranceEps = DEFAULT_TOLERANCE_EPSILON);
2317
+ OGRErr addCurve(std::unique_ptr<OGRCurve>,
2318
+ double dfToleranceEps = DEFAULT_TOLERANCE_EPSILON);
2319
+ OGRCurve *stealCurve(int);
2320
+ virtual OGRPointIterator *getPointIterator() const override;
2321
+ void reversePoints() override;
2322
+
2323
+ // Non-standard from OGRGeometry.
2324
+ virtual OGRwkbGeometryType getGeometryType() const override;
2325
+ virtual const char *getGeometryName() const override;
2326
+ virtual OGRErr transform(OGRCoordinateTransformation *poCT) override;
2327
+ virtual void flattenTo2D() override;
2328
+ virtual bool segmentize(double dfMaxLength) override;
2329
+ virtual OGRBoolean
2330
+ hasCurveGeometry(int bLookForNonLinear = FALSE) const override;
2331
+ virtual OGRGeometry *
2332
+ getLinearGeometry(double dfMaxAngleStepSizeDegrees = 0,
2333
+ const char *const *papszOptions = nullptr) const override;
2334
+
2335
+ virtual void accept(IOGRGeometryVisitor *visitor) override
2336
+ {
2337
+ visitor->visit(this);
2338
+ }
2339
+
2340
+ virtual void accept(IOGRConstGeometryVisitor *visitor) const override
2341
+ {
2342
+ visitor->visit(this);
2343
+ }
2344
+
2345
+ virtual void swapXY() override;
2346
+
2347
+ bool hasEmptyParts() const override;
2348
+ void removeEmptyParts() override;
2349
+
2350
+ OGR_ALLOW_UPCAST_TO(Curve)
2351
+ OGR_ALLOW_CAST_TO_THIS(CompoundCurve)
2352
+ };
2353
+
2354
+ //! @cond Doxygen_Suppress
2355
+ /** @see OGRCompoundCurve::begin() const */
2356
+ inline const OGRCompoundCurve::ChildType *const *
2357
+ begin(const OGRCompoundCurve *poCurve)
2358
+ {
2359
+ return poCurve->begin();
2360
+ }
2361
+
2362
+ /** @see OGRCompoundCurve::end() const */
2363
+ inline const OGRCompoundCurve::ChildType *const *
2364
+ end(const OGRCompoundCurve *poCurve)
2365
+ {
2366
+ return poCurve->end();
2367
+ }
2368
+
2369
+ /** @see OGRCompoundCurve::begin() */
2370
+ inline OGRCompoundCurve::ChildType **begin(OGRCompoundCurve *poCurve)
2371
+ {
2372
+ return poCurve->begin();
2373
+ }
2374
+
2375
+ /** @see OGRCompoundCurve::end() */
2376
+ inline OGRCompoundCurve::ChildType **end(OGRCompoundCurve *poCurve)
2377
+ {
2378
+ return poCurve->end();
2379
+ }
2380
+
2381
+ //! @endcond
2382
+
2383
+ /************************************************************************/
2384
+ /* OGRSurface */
2385
+ /************************************************************************/
2386
+
2387
+ /**
2388
+ * Abstract base class for 2 dimensional objects like polygons or curve
2389
+ * polygons.
2390
+ */
2391
+
2392
+ class CPL_DLL OGRSurface : public OGRGeometry
2393
+ {
2394
+ protected:
2395
+ //! @cond Doxygen_Suppress
2396
+ virtual OGRSurfaceCasterToPolygon GetCasterToPolygon() const = 0;
2397
+ virtual OGRSurfaceCasterToCurvePolygon GetCasterToCurvePolygon() const = 0;
2398
+ //! @endcond
2399
+
2400
+ public:
2401
+ virtual double get_Area() const = 0;
2402
+ virtual double get_GeodesicArea(
2403
+ const OGRSpatialReference *poSRSOverride = nullptr) const = 0;
2404
+ virtual double get_Length() const = 0;
2405
+ virtual double get_GeodesicLength(
2406
+ const OGRSpatialReference *poSRSOverride = nullptr) const = 0;
2407
+
2408
+ virtual OGRErr PointOnSurface(OGRPoint *poPoint) const
2409
+ {
2410
+ return PointOnSurfaceInternal(poPoint);
2411
+ }
2412
+
2413
+ virtual OGRSurface *clone() const override = 0;
2414
+
2415
+ //! @cond Doxygen_Suppress
2416
+ static OGRPolygon *CastToPolygon(OGRSurface *poSurface);
2417
+ static OGRCurvePolygon *CastToCurvePolygon(OGRSurface *poSurface);
2418
+ //! @endcond
2419
+
2420
+ OGR_FORBID_DOWNCAST_TO_POINT
2421
+ OGR_FORBID_DOWNCAST_TO_ALL_CURVES
2422
+ OGR_ALLOW_CAST_TO_THIS(Surface)
2423
+ OGR_FORBID_DOWNCAST_TO_ALL_MULTI
2424
+ };
2425
+
2426
+ /************************************************************************/
2427
+ /* OGRCurvePolygon */
2428
+ /************************************************************************/
2429
+
2430
+ /**
2431
+ * Concrete class representing curve polygons.
2432
+ *
2433
+ * Note that curve polygons consist of one outer (curve) ring, and zero or
2434
+ * more inner rings. A curve polygon cannot represent disconnected
2435
+ * regions (such as multiple islands in a political body). The
2436
+ * OGRMultiSurface must be used for this.
2437
+ *
2438
+ * Compatibility: ISO SQL/MM Part 3.
2439
+ *
2440
+ * @since GDAL 2.0
2441
+ */
2442
+
2443
+ class CPL_DLL OGRCurvePolygon : public OGRSurface
2444
+ {
2445
+ static OGRPolygon *CasterToPolygon(OGRSurface *poSurface);
2446
+
2447
+ private:
2448
+ OGRBoolean IntersectsPoint(const OGRPoint *p) const;
2449
+ OGRBoolean ContainsPoint(const OGRPoint *p) const;
2450
+
2451
+ virtual bool isRingCorrectType(const OGRCurve *poRing) const;
2452
+
2453
+ virtual bool checkRing(const OGRCurve *poNewRing) const;
2454
+ OGRErr addRingDirectlyInternal(OGRCurve *poCurve, int bNeedRealloc);
2455
+ static OGRErr addCurveDirectlyFromWkt(OGRGeometry *poSelf,
2456
+ OGRCurve *poCurve);
2457
+ static OGRErr addCurveDirectlyFromWkb(OGRGeometry *poSelf,
2458
+ OGRCurve *poCurve);
2459
+
2460
+ protected:
2461
+ //! @cond Doxygen_Suppress
2462
+ friend class OGRPolygon;
2463
+ friend class OGRTriangle;
2464
+ OGRCurveCollection oCC{};
2465
+
2466
+ virtual OGRSurfaceCasterToPolygon GetCasterToPolygon() const override;
2467
+ virtual OGRSurfaceCasterToCurvePolygon
2468
+ GetCasterToCurvePolygon() const override;
2469
+
2470
+ //! @endcond
2471
+
2472
+ static OGRPolygon *CastToPolygon(OGRCurvePolygon *poCP);
2473
+
2474
+ public:
2475
+ /** Create an empty curve polygon. */
2476
+ OGRCurvePolygon() = default;
2477
+
2478
+ OGRCurvePolygon(const OGRCurvePolygon &);
2479
+
2480
+ OGRCurvePolygon &operator=(const OGRCurvePolygon &other);
2481
+
2482
+ /** Type of child elements. */
2483
+ typedef OGRCurve ChildType;
2484
+
2485
+ /** Return begin of curve iterator.
2486
+ * @since GDAL 2.3
2487
+ */
2488
+ ChildType **begin()
2489
+ {
2490
+ return oCC.begin();
2491
+ }
2492
+
2493
+ /** Return end of curve iterator. */
2494
+ ChildType **end()
2495
+ {
2496
+ return oCC.end();
2497
+ }
2498
+
2499
+ /** Return begin of curve iterator.
2500
+ * @since GDAL 2.3
2501
+ */
2502
+ const ChildType *const *begin() const
2503
+ {
2504
+ return oCC.begin();
2505
+ }
2506
+
2507
+ /** Return end of curve iterator. */
2508
+ const ChildType *const *end() const
2509
+ {
2510
+ return oCC.end();
2511
+ }
2512
+
2513
+ // Non standard (OGRGeometry).
2514
+ virtual const char *getGeometryName() const override;
2515
+ virtual OGRwkbGeometryType getGeometryType() const override;
2516
+ virtual OGRCurvePolygon *clone() const override;
2517
+ virtual void empty() override;
2518
+ virtual OGRErr transform(OGRCoordinateTransformation *poCT) override;
2519
+ virtual void flattenTo2D() override;
2520
+ virtual OGRBoolean IsEmpty() const override;
2521
+ virtual bool segmentize(double dfMaxLength) override;
2522
+ virtual OGRBoolean
2523
+ hasCurveGeometry(int bLookForNonLinear = FALSE) const override;
2524
+ virtual OGRGeometry *
2525
+ getLinearGeometry(double dfMaxAngleStepSizeDegrees = 0,
2526
+ const char *const *papszOptions = nullptr) const override;
2527
+ virtual double get_GeodesicArea(
2528
+ const OGRSpatialReference *poSRSOverride = nullptr) const override;
2529
+ virtual double get_GeodesicLength(
2530
+ const OGRSpatialReference *poSRSOverride = nullptr) const override;
2531
+
2532
+ // ISurface Interface
2533
+ virtual double get_Area() const override;
2534
+
2535
+ virtual double get_Length() const override;
2536
+
2537
+ // IWks Interface
2538
+ virtual size_t WkbSize() const override;
2539
+ virtual OGRErr importFromWkb(const unsigned char *, size_t, OGRwkbVariant,
2540
+ size_t &nBytesConsumedOut) override;
2541
+ OGRErr exportToWkb(unsigned char *,
2542
+ const OGRwkbExportOptions * = nullptr) const override;
2543
+
2544
+ #ifndef DOXYGEN_XML
2545
+ using OGRGeometry::importFromWkt; /** deprecated */
2546
+ #endif
2547
+
2548
+ OGRErr importFromWkt(const char **) override;
2549
+
2550
+ #ifndef DOXYGEN_XML
2551
+ using OGRGeometry::exportToWkt;
2552
+ #endif
2553
+
2554
+ /// Export a curve polygon to WKT
2555
+ /// \param opts Output options.
2556
+ /// \param err Pointer to error code, if desired.
2557
+ /// \return WKT representation of the curve polygon.
2558
+ virtual std::string exportToWkt(const OGRWktOptions &opts = OGRWktOptions(),
2559
+ OGRErr *err = nullptr) const override;
2560
+
2561
+ // IGeometry
2562
+ virtual int getDimension() const override;
2563
+ virtual void getEnvelope(OGREnvelope *psEnvelope) const override;
2564
+ virtual void getEnvelope(OGREnvelope3D *psEnvelope) const override;
2565
+
2566
+ // ICurvePolygon
2567
+ virtual OGRPolygon *
2568
+ CurvePolyToPoly(double dfMaxAngleStepSizeDegrees = 0,
2569
+ const char *const *papszOptions = nullptr) const;
2570
+
2571
+ // ISpatialRelation
2572
+ virtual OGRBoolean Equals(const OGRGeometry *) const override;
2573
+ virtual OGRBoolean Intersects(const OGRGeometry *) const override;
2574
+ virtual OGRBoolean Contains(const OGRGeometry *) const override;
2575
+
2576
+ // Non standard
2577
+ virtual bool setCoordinateDimension(int nDimension) override;
2578
+ virtual bool set3D(OGRBoolean bIs3D) override;
2579
+ virtual bool setMeasured(OGRBoolean bIsMeasured) override;
2580
+
2581
+ virtual void
2582
+ assignSpatialReference(const OGRSpatialReference *poSR) override;
2583
+
2584
+ virtual OGRErr addRing(const OGRCurve *);
2585
+ virtual OGRErr addRingDirectly(OGRCurve *);
2586
+ OGRErr addRing(std::unique_ptr<OGRCurve>);
2587
+
2588
+ OGRCurve *getExteriorRingCurve();
2589
+ const OGRCurve *getExteriorRingCurve() const;
2590
+ int getNumInteriorRings() const;
2591
+ OGRCurve *getInteriorRingCurve(int);
2592
+ const OGRCurve *getInteriorRingCurve(int) const;
2593
+
2594
+ OGRCurve *stealExteriorRingCurve();
2595
+
2596
+ OGRErr removeRing(int iIndex, bool bDelete = true);
2597
+
2598
+ virtual void accept(IOGRGeometryVisitor *visitor) override
2599
+ {
2600
+ visitor->visit(this);
2601
+ }
2602
+
2603
+ virtual void accept(IOGRConstGeometryVisitor *visitor) const override
2604
+ {
2605
+ visitor->visit(this);
2606
+ }
2607
+
2608
+ virtual void swapXY() override;
2609
+
2610
+ bool hasEmptyParts() const override;
2611
+ void removeEmptyParts() override;
2612
+
2613
+ OGR_ALLOW_UPCAST_TO(Surface)
2614
+ OGR_ALLOW_CAST_TO_THIS(CurvePolygon)
2615
+ };
2616
+
2617
+ //! @cond Doxygen_Suppress
2618
+ /** @see OGRCurvePolygon::begin() const */
2619
+ inline const OGRCurvePolygon::ChildType *const *
2620
+ begin(const OGRCurvePolygon *poGeom)
2621
+ {
2622
+ return poGeom->begin();
2623
+ }
2624
+
2625
+ /** @see OGRCurvePolygon::end() const */
2626
+ inline const OGRCurvePolygon::ChildType *const *
2627
+ end(const OGRCurvePolygon *poGeom)
2628
+ {
2629
+ return poGeom->end();
2630
+ }
2631
+
2632
+ /** @see OGRCurvePolygon::begin() */
2633
+ inline OGRCurvePolygon::ChildType **begin(OGRCurvePolygon *poGeom)
2634
+ {
2635
+ return poGeom->begin();
2636
+ }
2637
+
2638
+ /** @see OGRCurvePolygon::end() */
2639
+ inline OGRCurvePolygon::ChildType **end(OGRCurvePolygon *poGeom)
2640
+ {
2641
+ return poGeom->end();
2642
+ }
2643
+
2644
+ //! @endcond
2645
+
2646
+ /************************************************************************/
2647
+ /* OGRPolygon */
2648
+ /************************************************************************/
2649
+
2650
+ /**
2651
+ * Concrete class representing polygons.
2652
+ *
2653
+ * Note that the OpenGIS simple features polygons consist of one outer ring
2654
+ * (linearring), and zero or more inner rings. A polygon cannot represent
2655
+ * disconnected regions (such as multiple islands in a political body). The
2656
+ * OGRMultiPolygon must be used for this.
2657
+ */
2658
+
2659
+ class CPL_DLL OGRPolygon : public OGRCurvePolygon
2660
+ {
2661
+ static OGRCurvePolygon *CasterToCurvePolygon(OGRSurface *poSurface);
2662
+
2663
+ protected:
2664
+ //! @cond Doxygen_Suppress
2665
+ friend class OGRMultiSurface;
2666
+ friend class OGRPolyhedralSurface;
2667
+ friend class OGRTriangulatedSurface;
2668
+
2669
+ virtual bool isRingCorrectType(const OGRCurve *poRing) const override;
2670
+
2671
+ virtual bool checkRing(const OGRCurve *poNewRing) const override;
2672
+ virtual OGRErr importFromWKTListOnly(const char **ppszInput, int bHasZ,
2673
+ int bHasM, OGRRawPoint *&paoPoints,
2674
+ int &nMaxPoints, double *&padfZ);
2675
+
2676
+ static OGRCurvePolygon *CastToCurvePolygon(OGRPolygon *poPoly);
2677
+
2678
+ virtual OGRSurfaceCasterToPolygon GetCasterToPolygon() const override;
2679
+ virtual OGRSurfaceCasterToCurvePolygon
2680
+ GetCasterToCurvePolygon() const override;
2681
+ //! @endcond
2682
+
2683
+ public:
2684
+ /** Create an empty polygon. */
2685
+ OGRPolygon() = default;
2686
+
2687
+ OGRPolygon(const OGRPolygon &other);
2688
+
2689
+ OGRPolygon &operator=(const OGRPolygon &other);
2690
+
2691
+ /** Type of child elements. */
2692
+ typedef OGRLinearRing ChildType;
2693
+
2694
+ /** Return begin of iterator.
2695
+ * @since GDAL 2.3
2696
+ */
2697
+ ChildType **begin()
2698
+ {
2699
+ return reinterpret_cast<ChildType **>(oCC.begin());
2700
+ }
2701
+
2702
+ /** Return end of iterator */
2703
+ ChildType **end()
2704
+ {
2705
+ return reinterpret_cast<ChildType **>(oCC.end());
2706
+ }
2707
+
2708
+ /** Return begin of iterator.
2709
+ * @since GDAL 2.3
2710
+ */
2711
+ const ChildType *const *begin() const
2712
+ {
2713
+ return reinterpret_cast<const ChildType *const *>(oCC.begin());
2714
+ }
2715
+
2716
+ /** Return end of iterator */
2717
+ const ChildType *const *end() const
2718
+ {
2719
+ return reinterpret_cast<const ChildType *const *>(oCC.end());
2720
+ }
2721
+
2722
+ // Non-standard (OGRGeometry).
2723
+ virtual const char *getGeometryName() const override;
2724
+ virtual OGRwkbGeometryType getGeometryType() const override;
2725
+ virtual OGRPolygon *clone() const override;
2726
+ virtual OGRBoolean
2727
+ hasCurveGeometry(int bLookForNonLinear = FALSE) const override;
2728
+ virtual OGRGeometry *
2729
+ getCurveGeometry(const char *const *papszOptions = nullptr) const override;
2730
+ virtual OGRGeometry *
2731
+ getLinearGeometry(double dfMaxAngleStepSizeDegrees = 0,
2732
+ const char *const *papszOptions = nullptr) const override;
2733
+
2734
+ // IWks Interface.
2735
+ virtual size_t WkbSize() const override;
2736
+ virtual OGRErr importFromWkb(const unsigned char *, size_t, OGRwkbVariant,
2737
+ size_t &nBytesConsumedOut) override;
2738
+ OGRErr exportToWkb(unsigned char *,
2739
+ const OGRwkbExportOptions * = nullptr) const override;
2740
+
2741
+ #ifndef DOXYGEN_XML
2742
+ using OGRGeometry::importFromWkt; /** deprecated */
2743
+ #endif
2744
+
2745
+ OGRErr importFromWkt(const char **) override;
2746
+
2747
+ #ifndef DOXYGEN_XML
2748
+ using OGRGeometry::exportToWkt;
2749
+ #endif
2750
+
2751
+ /// Export a polygon to WKT
2752
+ /// \param opts Output options.
2753
+ /// \param err Pointer to error code, if desired.
2754
+ /// \return WKT representation of the polygon.
2755
+ virtual std::string exportToWkt(const OGRWktOptions &opts = OGRWktOptions(),
2756
+ OGRErr *err = nullptr) const override;
2757
+
2758
+ // ICurvePolygon.
2759
+ virtual OGRPolygon *
2760
+ CurvePolyToPoly(double dfMaxAngleStepSizeDegrees = 0,
2761
+ const char *const *papszOptions = nullptr) const override;
2762
+
2763
+ OGRLinearRing *getExteriorRing();
2764
+ const OGRLinearRing *getExteriorRing() const;
2765
+ virtual OGRLinearRing *getInteriorRing(int);
2766
+ virtual const OGRLinearRing *getInteriorRing(int) const;
2767
+
2768
+ OGRLinearRing *stealExteriorRing();
2769
+ virtual OGRLinearRing *stealInteriorRing(int);
2770
+
2771
+ OGRBoolean IsPointOnSurface(const OGRPoint *) const;
2772
+
2773
+ /** Return pointer of this in upper class */
2774
+ inline OGRCurvePolygon *toUpperClass()
2775
+ {
2776
+ return this;
2777
+ }
2778
+
2779
+ /** Return pointer of this in upper class */
2780
+ inline const OGRCurvePolygon *toUpperClass() const
2781
+ {
2782
+ return this;
2783
+ }
2784
+
2785
+ virtual void accept(IOGRGeometryVisitor *visitor) override
2786
+ {
2787
+ visitor->visit(this);
2788
+ }
2789
+
2790
+ virtual void accept(IOGRConstGeometryVisitor *visitor) const override
2791
+ {
2792
+ visitor->visit(this);
2793
+ }
2794
+
2795
+ virtual void closeRings() override;
2796
+
2797
+ OGR_ALLOW_UPCAST_TO(CurvePolygon)
2798
+ OGR_ALLOW_CAST_TO_THIS(Polygon)
2799
+ };
2800
+
2801
+ //! @cond Doxygen_Suppress
2802
+ /** @see OGRPolygon::begin() const */
2803
+ inline const OGRPolygon::ChildType *const *begin(const OGRPolygon *poGeom)
2804
+ {
2805
+ return poGeom->begin();
2806
+ }
2807
+
2808
+ /** @see OGRPolygon::end() const */
2809
+ inline const OGRPolygon::ChildType *const *end(const OGRPolygon *poGeom)
2810
+ {
2811
+ return poGeom->end();
2812
+ }
2813
+
2814
+ /** @see OGRPolygon::begin() */
2815
+ inline OGRPolygon::ChildType **begin(OGRPolygon *poGeom)
2816
+ {
2817
+ return poGeom->begin();
2818
+ }
2819
+
2820
+ /** @see OGRPolygon::end() */
2821
+ inline OGRPolygon::ChildType **end(OGRPolygon *poGeom)
2822
+ {
2823
+ return poGeom->end();
2824
+ }
2825
+
2826
+ //! @endcond
2827
+
2828
+ /************************************************************************/
2829
+ /* OGRTriangle */
2830
+ /************************************************************************/
2831
+
2832
+ /**
2833
+ * Triangle class.
2834
+ *
2835
+ * @since GDAL 2.2
2836
+ */
2837
+
2838
+ class CPL_DLL OGRTriangle : public OGRPolygon
2839
+ {
2840
+ private:
2841
+ // cppcheck-suppress unusedPrivateFunction
2842
+ static OGRPolygon *CasterToPolygon(OGRSurface *poSurface);
2843
+ bool quickValidityCheck() const;
2844
+
2845
+ protected:
2846
+ //! @cond Doxygen_Suppress
2847
+ virtual OGRSurfaceCasterToPolygon GetCasterToPolygon() const override;
2848
+ virtual OGRErr importFromWKTListOnly(const char **ppszInput, int bHasZ,
2849
+ int bHasM, OGRRawPoint *&paoPoints,
2850
+ int &nMaxPoints,
2851
+ double *&padfZ) override;
2852
+ //! @endcond
2853
+
2854
+ public:
2855
+ /** Constructor. */
2856
+ OGRTriangle() = default;
2857
+ OGRTriangle(const OGRPoint &p, const OGRPoint &q, const OGRPoint &r);
2858
+ OGRTriangle(const OGRTriangle &other);
2859
+ OGRTriangle(const OGRPolygon &other, OGRErr &eErr);
2860
+ OGRTriangle &operator=(const OGRTriangle &other);
2861
+
2862
+ virtual const char *getGeometryName() const override;
2863
+ virtual OGRwkbGeometryType getGeometryType() const override;
2864
+ virtual OGRTriangle *clone() const override;
2865
+
2866
+ // IWks Interface.
2867
+ virtual OGRErr importFromWkb(const unsigned char *, size_t, OGRwkbVariant,
2868
+ size_t &nBytesConsumedOut) override;
2869
+
2870
+ // New methods rewritten from OGRPolygon/OGRCurvePolygon/OGRGeometry.
2871
+ virtual OGRErr addRingDirectly(OGRCurve *poNewRing) override;
2872
+
2873
+ /** Return pointer of this in upper class */
2874
+ inline OGRPolygon *toUpperClass()
2875
+ {
2876
+ return this;
2877
+ }
2878
+
2879
+ /** Return pointer of this in upper class */
2880
+ inline const OGRPolygon *toUpperClass() const
2881
+ {
2882
+ return this;
2883
+ }
2884
+
2885
+ virtual void accept(IOGRGeometryVisitor *visitor) override
2886
+ {
2887
+ visitor->visit(this);
2888
+ }
2889
+
2890
+ virtual void accept(IOGRConstGeometryVisitor *visitor) const override
2891
+ {
2892
+ visitor->visit(this);
2893
+ }
2894
+
2895
+ //! @cond Doxygen_Suppress
2896
+ static OGRGeometry *CastToPolygon(OGRGeometry *poGeom);
2897
+ //! @endcond
2898
+
2899
+ OGR_ALLOW_UPCAST_TO(Polygon)
2900
+ OGR_ALLOW_CAST_TO_THIS(Triangle)
2901
+ };
2902
+
2903
+ /************************************************************************/
2904
+ /* OGRGeometryCollection */
2905
+ /************************************************************************/
2906
+
2907
+ /**
2908
+ * A collection of 1 or more geometry objects.
2909
+ *
2910
+ * All geometries must share a common spatial reference system, and
2911
+ * Subclasses may impose additional restrictions on the contents.
2912
+ */
2913
+
2914
+ class CPL_DLL OGRGeometryCollection : public OGRGeometry
2915
+ {
2916
+ OGRErr importFromWktInternal(const char **ppszInput, int nRecLevel);
2917
+
2918
+ protected:
2919
+ //! @cond Doxygen_Suppress
2920
+ int nGeomCount = 0;
2921
+ OGRGeometry **papoGeoms = nullptr;
2922
+
2923
+ std::string
2924
+ exportToWktInternal(const OGRWktOptions &opts, OGRErr *err,
2925
+ const std::string &exclude = std::string()) const;
2926
+ static OGRGeometryCollection *
2927
+ TransferMembersAndDestroy(OGRGeometryCollection *poSrc,
2928
+ OGRGeometryCollection *poDst);
2929
+
2930
+ OGRErr importFromWkbInternal(const unsigned char *pabyData, size_t nSize,
2931
+ int nRecLevel, OGRwkbVariant,
2932
+ size_t &nBytesConsumedOut);
2933
+ //! @endcond
2934
+ virtual OGRBoolean isCompatibleSubType(OGRwkbGeometryType) const;
2935
+
2936
+ public:
2937
+ /** Create an empty geometry collection. */
2938
+ OGRGeometryCollection() = default;
2939
+
2940
+ OGRGeometryCollection(const OGRGeometryCollection &other);
2941
+ ~OGRGeometryCollection() override;
2942
+
2943
+ OGRGeometryCollection &operator=(const OGRGeometryCollection &other);
2944
+
2945
+ /** Type of child elements. */
2946
+ typedef OGRGeometry ChildType;
2947
+
2948
+ /** Return begin of sub-geometry iterator.
2949
+ * @since GDAL 2.3
2950
+ */
2951
+ ChildType **begin()
2952
+ {
2953
+ return papoGeoms;
2954
+ }
2955
+
2956
+ /** Return end of sub-geometry iterator. */
2957
+ ChildType **end()
2958
+ {
2959
+ return papoGeoms + nGeomCount;
2960
+ }
2961
+
2962
+ /** Return begin of sub-geometry iterator.
2963
+ * @since GDAL 2.3
2964
+ */
2965
+ const ChildType *const *begin() const
2966
+ {
2967
+ return papoGeoms;
2968
+ }
2969
+
2970
+ /** Return end of sub-geometry iterator. */
2971
+ const ChildType *const *end() const
2972
+ {
2973
+ return papoGeoms + nGeomCount;
2974
+ }
2975
+
2976
+ // Non standard (OGRGeometry).
2977
+ virtual const char *getGeometryName() const override;
2978
+ virtual OGRwkbGeometryType getGeometryType() const override;
2979
+ virtual OGRGeometryCollection *clone() const override;
2980
+ virtual void empty() override;
2981
+ virtual OGRErr transform(OGRCoordinateTransformation *poCT) override;
2982
+ virtual void flattenTo2D() override;
2983
+ virtual OGRBoolean IsEmpty() const override;
2984
+ virtual bool segmentize(double dfMaxLength) override;
2985
+ virtual OGRBoolean
2986
+ hasCurveGeometry(int bLookForNonLinear = FALSE) const override;
2987
+ virtual OGRGeometry *
2988
+ getCurveGeometry(const char *const *papszOptions = nullptr) const override;
2989
+ virtual OGRGeometry *
2990
+ getLinearGeometry(double dfMaxAngleStepSizeDegrees = 0,
2991
+ const char *const *papszOptions = nullptr) const override;
2992
+ virtual double
2993
+ get_GeodesicArea(const OGRSpatialReference *poSRSOverride = nullptr) const;
2994
+ virtual double get_GeodesicLength(
2995
+ const OGRSpatialReference *poSRSOverride = nullptr) const;
2996
+
2997
+ // IWks Interface
2998
+ virtual size_t WkbSize() const override;
2999
+ virtual OGRErr importFromWkb(const unsigned char *, size_t, OGRwkbVariant,
3000
+ size_t &nBytesConsumedOut) override;
3001
+ OGRErr exportToWkb(unsigned char *,
3002
+ const OGRwkbExportOptions * = nullptr) const override;
3003
+
3004
+ #ifndef DOXYGEN_XML
3005
+ using OGRGeometry::importFromWkt; /** deprecated */
3006
+ #endif
3007
+
3008
+ OGRErr importFromWkt(const char **) override;
3009
+
3010
+ #ifndef DOXYGEN_XML
3011
+ using OGRGeometry::exportToWkt;
3012
+ #endif
3013
+
3014
+ /// Export a geometry collection to WKT
3015
+ /// \param opts Output options.
3016
+ /// \param err Pointer to error code, if desired.
3017
+ /// \return WKT representation of the geometry collection.
3018
+ virtual std::string exportToWkt(const OGRWktOptions &opts = OGRWktOptions(),
3019
+ OGRErr *err = nullptr) const override;
3020
+
3021
+ virtual double get_Length() const;
3022
+ virtual double get_Area() const;
3023
+
3024
+ // IGeometry methods
3025
+ virtual int getDimension() const override;
3026
+ virtual void getEnvelope(OGREnvelope *psEnvelope) const override;
3027
+ virtual void getEnvelope(OGREnvelope3D *psEnvelope) const override;
3028
+
3029
+ // IGeometryCollection
3030
+ int getNumGeometries() const;
3031
+ OGRGeometry *getGeometryRef(int);
3032
+ const OGRGeometry *getGeometryRef(int) const;
3033
+
3034
+ // ISpatialRelation
3035
+ virtual OGRBoolean Equals(const OGRGeometry *) const override;
3036
+
3037
+ // Non standard
3038
+ virtual bool setCoordinateDimension(int nDimension) override;
3039
+ virtual bool set3D(OGRBoolean bIs3D) override;
3040
+ virtual bool setMeasured(OGRBoolean bIsMeasured) override;
3041
+ virtual OGRErr addGeometry(const OGRGeometry *);
3042
+ virtual OGRErr addGeometryDirectly(OGRGeometry *);
3043
+ OGRErr addGeometry(std::unique_ptr<OGRGeometry> geom);
3044
+ virtual OGRErr removeGeometry(int iIndex, int bDelete = TRUE);
3045
+ std::unique_ptr<OGRGeometry> stealGeometry(int iIndex);
3046
+
3047
+ bool hasEmptyParts() const override;
3048
+ void removeEmptyParts() override;
3049
+
3050
+ virtual void
3051
+ assignSpatialReference(const OGRSpatialReference *poSR) override;
3052
+
3053
+ void closeRings() override;
3054
+
3055
+ virtual void swapXY() override;
3056
+
3057
+ virtual void accept(IOGRGeometryVisitor *visitor) override
3058
+ {
3059
+ visitor->visit(this);
3060
+ }
3061
+
3062
+ virtual void accept(IOGRConstGeometryVisitor *visitor) const override
3063
+ {
3064
+ visitor->visit(this);
3065
+ }
3066
+
3067
+ static OGRGeometryCollection *
3068
+ CastToGeometryCollection(OGRGeometryCollection *poSrc);
3069
+
3070
+ OGR_FORBID_DOWNCAST_TO_POINT
3071
+ OGR_FORBID_DOWNCAST_TO_ALL_CURVES
3072
+ OGR_FORBID_DOWNCAST_TO_ALL_SURFACES
3073
+ OGR_ALLOW_CAST_TO_THIS(GeometryCollection)
3074
+ };
3075
+
3076
+ //! @cond Doxygen_Suppress
3077
+ /** @see OGRGeometryCollection::begin() const */
3078
+ inline const OGRGeometryCollection::ChildType *const *
3079
+ begin(const OGRGeometryCollection *poGeom)
3080
+ {
3081
+ return poGeom->begin();
3082
+ }
3083
+
3084
+ /** @see OGRGeometryCollection::end() const */
3085
+ inline const OGRGeometryCollection::ChildType *const *
3086
+ end(const OGRGeometryCollection *poGeom)
3087
+ {
3088
+ return poGeom->end();
3089
+ }
3090
+
3091
+ /** @see OGRGeometryCollection::begin() */
3092
+ inline OGRGeometryCollection::ChildType **begin(OGRGeometryCollection *poGeom)
3093
+ {
3094
+ return poGeom->begin();
3095
+ }
3096
+
3097
+ /** @see OGRGeometryCollection::end() */
3098
+ inline OGRGeometryCollection::ChildType **end(OGRGeometryCollection *poGeom)
3099
+ {
3100
+ return poGeom->end();
3101
+ }
3102
+
3103
+ //! @endcond
3104
+
3105
+ /************************************************************************/
3106
+ /* OGRMultiSurface */
3107
+ /************************************************************************/
3108
+
3109
+ /**
3110
+ * A collection of non-overlapping OGRSurface.
3111
+ *
3112
+ * @since GDAL 2.0
3113
+ */
3114
+
3115
+ class CPL_DLL OGRMultiSurface : public OGRGeometryCollection
3116
+ {
3117
+ protected:
3118
+ virtual OGRBoolean isCompatibleSubType(OGRwkbGeometryType) const override;
3119
+
3120
+ public:
3121
+ /** Create an empty multi surface collection. */
3122
+ OGRMultiSurface() = default;
3123
+
3124
+ OGRMultiSurface(const OGRMultiSurface &other);
3125
+
3126
+ OGRMultiSurface &operator=(const OGRMultiSurface &other);
3127
+
3128
+ /** Type of child elements. */
3129
+ typedef OGRSurface ChildType;
3130
+
3131
+ /** Return begin of iterator.
3132
+ * @since GDAL 2.3
3133
+ */
3134
+ ChildType **begin()
3135
+ {
3136
+ return reinterpret_cast<ChildType **>(papoGeoms);
3137
+ }
3138
+
3139
+ /** Return end of iterator */
3140
+ ChildType **end()
3141
+ {
3142
+ return reinterpret_cast<ChildType **>(papoGeoms + nGeomCount);
3143
+ }
3144
+
3145
+ /** Return begin of iterator.
3146
+ * @since GDAL 2.3
3147
+ */
3148
+ const ChildType *const *begin() const
3149
+ {
3150
+ return reinterpret_cast<const ChildType *const *>(papoGeoms);
3151
+ }
3152
+
3153
+ /** Return end of iterator */
3154
+ const ChildType *const *end() const
3155
+ {
3156
+ return reinterpret_cast<const ChildType *const *>(papoGeoms +
3157
+ nGeomCount);
3158
+ }
3159
+
3160
+ // Non standard (OGRGeometry).
3161
+ virtual const char *getGeometryName() const override;
3162
+ virtual OGRwkbGeometryType getGeometryType() const override;
3163
+ virtual OGRMultiSurface *clone() const override;
3164
+
3165
+ #ifndef DOXYGEN_XML
3166
+ using OGRGeometry::importFromWkt; /** deprecated */
3167
+ #endif
3168
+
3169
+ OGRErr importFromWkt(const char **) override;
3170
+
3171
+ #ifndef DOXYGEN_XML
3172
+ using OGRGeometry::exportToWkt;
3173
+ #endif
3174
+
3175
+ /// Export a geometry collection to WKT
3176
+ /// \param opts Output options.
3177
+ /// \param err Pointer to error code, if desired.
3178
+ /// \return WKT representation of the geometry collection.
3179
+ virtual std::string exportToWkt(const OGRWktOptions &opts = OGRWktOptions(),
3180
+ OGRErr *err = nullptr) const override;
3181
+
3182
+ // IMultiSurface methods
3183
+ virtual OGRErr PointOnSurface(OGRPoint *poPoint) const;
3184
+
3185
+ // IGeometry methods
3186
+ virtual int getDimension() const override;
3187
+
3188
+ // IGeometryCollection
3189
+ /** See OGRGeometryCollection::getGeometryRef() */
3190
+ OGRSurface *getGeometryRef(int i)
3191
+ {
3192
+ return OGRGeometryCollection::getGeometryRef(i)->toSurface();
3193
+ }
3194
+
3195
+ /** See OGRGeometryCollection::getGeometryRef() */
3196
+ const OGRSurface *getGeometryRef(int i) const
3197
+ {
3198
+ return OGRGeometryCollection::getGeometryRef(i)->toSurface();
3199
+ }
3200
+
3201
+ // Non standard
3202
+ virtual OGRBoolean
3203
+ hasCurveGeometry(int bLookForNonLinear = FALSE) const override;
3204
+
3205
+ /** Return pointer of this in upper class */
3206
+ inline OGRGeometryCollection *toUpperClass()
3207
+ {
3208
+ return this;
3209
+ }
3210
+
3211
+ /** Return pointer of this in upper class */
3212
+ inline const OGRGeometryCollection *toUpperClass() const
3213
+ {
3214
+ return this;
3215
+ }
3216
+
3217
+ virtual void accept(IOGRGeometryVisitor *visitor) override
3218
+ {
3219
+ visitor->visit(this);
3220
+ }
3221
+
3222
+ virtual void accept(IOGRConstGeometryVisitor *visitor) const override
3223
+ {
3224
+ visitor->visit(this);
3225
+ }
3226
+
3227
+ static OGRMultiPolygon *CastToMultiPolygon(OGRMultiSurface *poMS);
3228
+
3229
+ OGR_ALLOW_CAST_TO_THIS(MultiSurface)
3230
+ OGR_ALLOW_UPCAST_TO(GeometryCollection)
3231
+ OGR_FORBID_DOWNCAST_TO_MULTIPOINT
3232
+ OGR_FORBID_DOWNCAST_TO_MULTILINESTRING
3233
+ OGR_FORBID_DOWNCAST_TO_MULTICURVE
3234
+ };
3235
+
3236
+ //! @cond Doxygen_Suppress
3237
+ /** @see OGRMultiSurface::begin() const */
3238
+ inline const OGRMultiSurface::ChildType *const *
3239
+ begin(const OGRMultiSurface *poGeom)
3240
+ {
3241
+ return poGeom->begin();
3242
+ }
3243
+
3244
+ /** @see OGRMultiSurface::end() const */
3245
+ inline const OGRMultiSurface::ChildType *const *
3246
+ end(const OGRMultiSurface *poGeom)
3247
+ {
3248
+ return poGeom->end();
3249
+ }
3250
+
3251
+ /** @see OGRMultiSurface::begin() */
3252
+ inline OGRMultiSurface::ChildType **begin(OGRMultiSurface *poGeom)
3253
+ {
3254
+ return poGeom->begin();
3255
+ }
3256
+
3257
+ /** @see OGRMultiSurface::end() */
3258
+ inline OGRMultiSurface::ChildType **end(OGRMultiSurface *poGeom)
3259
+ {
3260
+ return poGeom->end();
3261
+ }
3262
+
3263
+ //! @endcond
3264
+
3265
+ /************************************************************************/
3266
+ /* OGRMultiPolygon */
3267
+ /************************************************************************/
3268
+
3269
+ /**
3270
+ * A collection of non-overlapping OGRPolygon.
3271
+ */
3272
+
3273
+ class CPL_DLL OGRMultiPolygon : public OGRMultiSurface
3274
+ {
3275
+ protected:
3276
+ virtual OGRBoolean isCompatibleSubType(OGRwkbGeometryType) const override;
3277
+ friend class OGRPolyhedralSurface;
3278
+ friend class OGRTriangulatedSurface;
3279
+
3280
+ private:
3281
+ //! @cond Doxygen_Suppress
3282
+ OGRErr _addGeometryWithExpectedSubGeometryType(
3283
+ const OGRGeometry *poNewGeom, OGRwkbGeometryType eSubGeometryType);
3284
+ OGRErr _addGeometryDirectlyWithExpectedSubGeometryType(
3285
+ OGRGeometry *poNewGeom, OGRwkbGeometryType eSubGeometryType);
3286
+ //! @endcond
3287
+
3288
+ public:
3289
+ /** Create an empty multi polygon collection. */
3290
+ OGRMultiPolygon() = default;
3291
+
3292
+ OGRMultiPolygon(const OGRMultiPolygon &other);
3293
+
3294
+ OGRMultiPolygon &operator=(const OGRMultiPolygon &other);
3295
+
3296
+ /** Type of child elements. */
3297
+ typedef OGRPolygon ChildType;
3298
+
3299
+ /** Return begin of iterator.
3300
+ * @since GDAL 2.3
3301
+ */
3302
+ ChildType **begin()
3303
+ {
3304
+ return reinterpret_cast<ChildType **>(papoGeoms);
3305
+ }
3306
+
3307
+ /** Return end of iterator */
3308
+ ChildType **end()
3309
+ {
3310
+ return reinterpret_cast<ChildType **>(papoGeoms + nGeomCount);
3311
+ }
3312
+
3313
+ /** Return begin of iterator.
3314
+ * @since GDAL 2.3
3315
+ */
3316
+ const ChildType *const *begin() const
3317
+ {
3318
+ return reinterpret_cast<const ChildType *const *>(papoGeoms);
3319
+ }
3320
+
3321
+ /** Return end of iterator */
3322
+ const ChildType *const *end() const
3323
+ {
3324
+ return reinterpret_cast<const ChildType *const *>(papoGeoms +
3325
+ nGeomCount);
3326
+ }
3327
+
3328
+ // IGeometryCollection
3329
+ /** See OGRGeometryCollection::getGeometryRef() */
3330
+ OGRPolygon *getGeometryRef(int i)
3331
+ {
3332
+ return OGRGeometryCollection::getGeometryRef(i)->toPolygon();
3333
+ }
3334
+
3335
+ /** See OGRGeometryCollection::getGeometryRef() */
3336
+ const OGRPolygon *getGeometryRef(int i) const
3337
+ {
3338
+ return OGRGeometryCollection::getGeometryRef(i)->toPolygon();
3339
+ }
3340
+
3341
+ // Non-standard (OGRGeometry).
3342
+ virtual const char *getGeometryName() const override;
3343
+ virtual OGRwkbGeometryType getGeometryType() const override;
3344
+ virtual OGRMultiPolygon *clone() const override;
3345
+
3346
+ #ifndef DOXYGEN_XML
3347
+ using OGRGeometry::exportToWkt;
3348
+ #endif
3349
+
3350
+ virtual OGRErr importFromWkb(const unsigned char *, size_t, OGRwkbVariant,
3351
+ size_t &nBytesConsumedOut) override;
3352
+
3353
+ /// Export a multipolygon to WKT
3354
+ /// \param opts Output options.
3355
+ /// \param err Pointer to error code, if desired.
3356
+ /// \return WKT representation of the multipolygon.
3357
+ virtual std::string exportToWkt(const OGRWktOptions &opts = OGRWktOptions(),
3358
+ OGRErr *err = nullptr) const override;
3359
+
3360
+ // Non standard
3361
+ virtual OGRBoolean
3362
+ hasCurveGeometry(int bLookForNonLinear = FALSE) const override;
3363
+
3364
+ /** Return pointer of this in upper class */
3365
+ inline OGRGeometryCollection *toUpperClass()
3366
+ {
3367
+ return this;
3368
+ }
3369
+
3370
+ /** Return pointer of this in upper class */
3371
+ inline const OGRGeometryCollection *toUpperClass() const
3372
+ {
3373
+ return this;
3374
+ }
3375
+
3376
+ virtual void accept(IOGRGeometryVisitor *visitor) override
3377
+ {
3378
+ visitor->visit(this);
3379
+ }
3380
+
3381
+ virtual void accept(IOGRConstGeometryVisitor *visitor) const override
3382
+ {
3383
+ visitor->visit(this);
3384
+ }
3385
+
3386
+ static OGRMultiSurface *CastToMultiSurface(OGRMultiPolygon *poMP);
3387
+
3388
+ OGR_ALLOW_CAST_TO_THIS(MultiPolygon)
3389
+ OGR_ALLOW_UPCAST_TO(MultiSurface)
3390
+ };
3391
+
3392
+ //! @cond Doxygen_Suppress
3393
+ /** @see OGRMultiPolygon::begin() const */
3394
+ inline const OGRMultiPolygon::ChildType *const *
3395
+ begin(const OGRMultiPolygon *poGeom)
3396
+ {
3397
+ return poGeom->begin();
3398
+ }
3399
+
3400
+ /** @see OGRMultiPolygon::end() const */
3401
+ inline const OGRMultiPolygon::ChildType *const *
3402
+ end(const OGRMultiPolygon *poGeom)
3403
+ {
3404
+ return poGeom->end();
3405
+ }
3406
+
3407
+ /** @see OGRMultiPolygon::begin() */
3408
+ inline OGRMultiPolygon::ChildType **begin(OGRMultiPolygon *poGeom)
3409
+ {
3410
+ return poGeom->begin();
3411
+ }
3412
+
3413
+ /** @see OGRMultiPolygon::end() */
3414
+ inline OGRMultiPolygon::ChildType **end(OGRMultiPolygon *poGeom)
3415
+ {
3416
+ return poGeom->end();
3417
+ }
3418
+
3419
+ //! @endcond
3420
+
3421
+ /************************************************************************/
3422
+ /* OGRPolyhedralSurface */
3423
+ /************************************************************************/
3424
+
3425
+ /**
3426
+ * PolyhedralSurface class.
3427
+ *
3428
+ * @since GDAL 2.2
3429
+ */
3430
+
3431
+ class CPL_DLL OGRPolyhedralSurface : public OGRSurface
3432
+ {
3433
+ protected:
3434
+ //! @cond Doxygen_Suppress
3435
+ friend class OGRTriangulatedSurface;
3436
+ OGRMultiPolygon oMP{};
3437
+ virtual OGRSurfaceCasterToPolygon GetCasterToPolygon() const override;
3438
+ virtual OGRSurfaceCasterToCurvePolygon
3439
+ GetCasterToCurvePolygon() const override;
3440
+ virtual OGRBoolean isCompatibleSubType(OGRwkbGeometryType) const;
3441
+ virtual const char *getSubGeometryName() const;
3442
+ virtual OGRwkbGeometryType getSubGeometryType() const;
3443
+ std::string exportToWktInternal(const OGRWktOptions &opts,
3444
+ OGRErr *err) const;
3445
+
3446
+ virtual OGRPolyhedralSurfaceCastToMultiPolygon
3447
+ GetCasterToMultiPolygon() const;
3448
+ static OGRMultiPolygon *CastToMultiPolygonImpl(OGRPolyhedralSurface *poPS);
3449
+ //! @endcond
3450
+
3451
+ public:
3452
+ /** Create an empty PolyhedralSurface */
3453
+ OGRPolyhedralSurface() = default;
3454
+
3455
+ OGRPolyhedralSurface(const OGRPolyhedralSurface &poGeom);
3456
+
3457
+ OGRPolyhedralSurface &operator=(const OGRPolyhedralSurface &other);
3458
+
3459
+ /** Type of child elements. */
3460
+ typedef OGRPolygon ChildType;
3461
+
3462
+ /** Return begin of iterator.
3463
+ * @since GDAL 2.3
3464
+ */
3465
+ ChildType **begin()
3466
+ {
3467
+ return oMP.begin();
3468
+ }
3469
+
3470
+ /** Return end of iterator */
3471
+ ChildType **end()
3472
+ {
3473
+ return oMP.end();
3474
+ }
3475
+
3476
+ /** Return begin of iterator.
3477
+ * @since GDAL 2.3
3478
+ */
3479
+ const ChildType *const *begin() const
3480
+ {
3481
+ return oMP.begin();
3482
+ }
3483
+
3484
+ /** Return end of iterator */
3485
+ const ChildType *const *end() const
3486
+ {
3487
+ return oMP.end();
3488
+ }
3489
+
3490
+ // IWks Interface.
3491
+ virtual size_t WkbSize() const override;
3492
+ virtual const char *getGeometryName() const override;
3493
+ virtual OGRwkbGeometryType getGeometryType() const override;
3494
+ virtual OGRErr importFromWkb(const unsigned char *, size_t, OGRwkbVariant,
3495
+ size_t &nBytesConsumedOut) override;
3496
+ OGRErr exportToWkb(unsigned char *,
3497
+ const OGRwkbExportOptions * = nullptr) const override;
3498
+
3499
+ #ifndef DOXYGEN_XML
3500
+ using OGRGeometry::importFromWkt; /** deprecated */
3501
+ #endif
3502
+
3503
+ OGRErr importFromWkt(const char **) override;
3504
+
3505
+ #ifndef DOXYGEN_XML
3506
+ using OGRGeometry::exportToWkt;
3507
+ #endif
3508
+
3509
+ /// Export a polyhedral surface to WKT
3510
+ /// \param opts Output options.
3511
+ /// \param err Pointer to error code, if desired.
3512
+ /// \return WKT representation of the polyhedral surface.
3513
+ virtual std::string exportToWkt(const OGRWktOptions &opts = OGRWktOptions(),
3514
+ OGRErr *err = nullptr) const override;
3515
+
3516
+ // IGeometry methods.
3517
+ virtual int getDimension() const override;
3518
+
3519
+ virtual void empty() override;
3520
+
3521
+ virtual OGRPolyhedralSurface *clone() const override;
3522
+ virtual void getEnvelope(OGREnvelope *psEnvelope) const override;
3523
+ virtual void getEnvelope(OGREnvelope3D *psEnvelope) const override;
3524
+
3525
+ virtual void flattenTo2D() override;
3526
+ virtual OGRErr transform(OGRCoordinateTransformation *) override;
3527
+ virtual OGRBoolean Equals(const OGRGeometry *) const override;
3528
+ virtual double get_Area() const override;
3529
+ virtual double get_GeodesicArea(
3530
+ const OGRSpatialReference *poSRSOverride = nullptr) const override;
3531
+ virtual double get_Length() const override;
3532
+ virtual double get_GeodesicLength(
3533
+ const OGRSpatialReference *poSRSOverride = nullptr) const override;
3534
+
3535
+ virtual OGRErr PointOnSurface(OGRPoint *) const override;
3536
+
3537
+ static OGRMultiPolygon *CastToMultiPolygon(OGRPolyhedralSurface *poPS);
3538
+ virtual OGRBoolean
3539
+ hasCurveGeometry(int bLookForNonLinear = FALSE) const override;
3540
+ virtual OGRErr addGeometry(const OGRGeometry *);
3541
+ OGRErr addGeometryDirectly(OGRGeometry *poNewGeom);
3542
+ OGRErr addGeometry(std::unique_ptr<OGRGeometry> poNewGeom);
3543
+
3544
+ int getNumGeometries() const;
3545
+ OGRPolygon *getGeometryRef(int i);
3546
+ const OGRPolygon *getGeometryRef(int i) const;
3547
+
3548
+ virtual OGRBoolean IsEmpty() const override;
3549
+ virtual bool setCoordinateDimension(int nDimension) override;
3550
+ virtual bool set3D(OGRBoolean bIs3D) override;
3551
+ virtual bool setMeasured(OGRBoolean bIsMeasured) override;
3552
+ virtual void swapXY() override;
3553
+ OGRErr removeGeometry(int iIndex, int bDelete = TRUE);
3554
+
3555
+ bool hasEmptyParts() const override;
3556
+ void removeEmptyParts() override;
3557
+
3558
+ virtual void accept(IOGRGeometryVisitor *visitor) override
3559
+ {
3560
+ visitor->visit(this);
3561
+ }
3562
+
3563
+ virtual void accept(IOGRConstGeometryVisitor *visitor) const override
3564
+ {
3565
+ visitor->visit(this);
3566
+ }
3567
+
3568
+ virtual void
3569
+ assignSpatialReference(const OGRSpatialReference *poSR) override;
3570
+
3571
+ OGR_ALLOW_CAST_TO_THIS(PolyhedralSurface)
3572
+ OGR_ALLOW_UPCAST_TO(Surface)
3573
+ };
3574
+
3575
+ //! @cond Doxygen_Suppress
3576
+ /** @see OGRPolyhedralSurface::begin() const */
3577
+ inline const OGRPolyhedralSurface::ChildType *const *
3578
+ begin(const OGRPolyhedralSurface *poGeom)
3579
+ {
3580
+ return poGeom->begin();
3581
+ }
3582
+
3583
+ /** @see OGRPolyhedralSurface::end() const */
3584
+ inline const OGRPolyhedralSurface::ChildType *const *
3585
+ end(const OGRPolyhedralSurface *poGeom)
3586
+ {
3587
+ return poGeom->end();
3588
+ }
3589
+
3590
+ /** @see OGRPolyhedralSurface::begin() */
3591
+ inline OGRPolyhedralSurface::ChildType **begin(OGRPolyhedralSurface *poGeom)
3592
+ {
3593
+ return poGeom->begin();
3594
+ }
3595
+
3596
+ /** @see OGRPolyhedralSurface::end() */
3597
+ inline OGRPolyhedralSurface::ChildType **end(OGRPolyhedralSurface *poGeom)
3598
+ {
3599
+ return poGeom->end();
3600
+ }
3601
+
3602
+ //! @endcond
3603
+
3604
+ /************************************************************************/
3605
+ /* OGRTriangulatedSurface */
3606
+ /************************************************************************/
3607
+
3608
+ /**
3609
+ * TriangulatedSurface class.
3610
+ *
3611
+ * @since GDAL 2.2
3612
+ */
3613
+
3614
+ class CPL_DLL OGRTriangulatedSurface : public OGRPolyhedralSurface
3615
+ {
3616
+ protected:
3617
+ //! @cond Doxygen_Suppress
3618
+ virtual OGRBoolean isCompatibleSubType(OGRwkbGeometryType) const override;
3619
+ virtual const char *getSubGeometryName() const override;
3620
+ virtual OGRwkbGeometryType getSubGeometryType() const override;
3621
+
3622
+ virtual OGRPolyhedralSurfaceCastToMultiPolygon
3623
+ GetCasterToMultiPolygon() const override;
3624
+ static OGRMultiPolygon *CastToMultiPolygonImpl(OGRPolyhedralSurface *poPS);
3625
+ //! @endcond
3626
+
3627
+ public:
3628
+ /** Constructor */
3629
+ OGRTriangulatedSurface() = default;
3630
+
3631
+ OGRTriangulatedSurface(const OGRTriangulatedSurface &other);
3632
+
3633
+ /** Type of child elements. */
3634
+ typedef OGRTriangle ChildType;
3635
+
3636
+ /** Return begin of iterator.
3637
+ * @since GDAL 2.3
3638
+ */
3639
+ ChildType **begin()
3640
+ {
3641
+ return reinterpret_cast<ChildType **>(oMP.begin());
3642
+ }
3643
+
3644
+ /** Return end of iterator */
3645
+ ChildType **end()
3646
+ {
3647
+ return reinterpret_cast<ChildType **>(oMP.end());
3648
+ }
3649
+
3650
+ /** Return begin of iterator.
3651
+ * @since GDAL 2.3
3652
+ */
3653
+ const ChildType *const *begin() const
3654
+ {
3655
+ return reinterpret_cast<const ChildType *const *>(oMP.begin());
3656
+ }
3657
+
3658
+ /** Return end of iterator */
3659
+ const ChildType *const *end() const
3660
+ {
3661
+ return reinterpret_cast<const ChildType *const *>(oMP.end());
3662
+ }
3663
+
3664
+ OGRTriangulatedSurface &operator=(const OGRTriangulatedSurface &other);
3665
+ virtual const char *getGeometryName() const override;
3666
+ virtual OGRwkbGeometryType getGeometryType() const override;
3667
+ virtual OGRTriangulatedSurface *clone() const override;
3668
+
3669
+ /** See OGRPolyhedralSurface::getGeometryRef() */
3670
+ OGRTriangle *getGeometryRef(int i)
3671
+ {
3672
+ return OGRPolyhedralSurface::getGeometryRef(i)->toTriangle();
3673
+ }
3674
+
3675
+ /** See OGRPolyhedralSurface::getGeometryRef() */
3676
+ const OGRTriangle *getGeometryRef(int i) const
3677
+ {
3678
+ return OGRPolyhedralSurface::getGeometryRef(i)->toTriangle();
3679
+ }
3680
+
3681
+ // IWks Interface.
3682
+ virtual OGRErr addGeometry(const OGRGeometry *) override;
3683
+
3684
+ #ifndef DOXYGEN_XML
3685
+ using OGRPolyhedralSurface::addGeometry;
3686
+ #endif
3687
+
3688
+ /** Return pointer of this in upper class */
3689
+ inline OGRPolyhedralSurface *toUpperClass()
3690
+ {
3691
+ return this;
3692
+ }
3693
+
3694
+ /** Return pointer of this in upper class */
3695
+ inline const OGRPolyhedralSurface *toUpperClass() const
3696
+ {
3697
+ return this;
3698
+ }
3699
+
3700
+ virtual void accept(IOGRGeometryVisitor *visitor) override
3701
+ {
3702
+ visitor->visit(this);
3703
+ }
3704
+
3705
+ virtual void accept(IOGRConstGeometryVisitor *visitor) const override
3706
+ {
3707
+ visitor->visit(this);
3708
+ }
3709
+
3710
+ static OGRPolyhedralSurface *
3711
+ CastToPolyhedralSurface(OGRTriangulatedSurface *poTS);
3712
+
3713
+ OGR_ALLOW_CAST_TO_THIS(TriangulatedSurface)
3714
+ OGR_ALLOW_UPCAST_TO(PolyhedralSurface)
3715
+ };
3716
+
3717
+ //! @cond Doxygen_Suppress
3718
+ /** @see OGRTriangulatedSurface::begin() const */
3719
+ inline const OGRTriangulatedSurface::ChildType *const *
3720
+ begin(const OGRTriangulatedSurface *poGeom)
3721
+ {
3722
+ return poGeom->begin();
3723
+ }
3724
+
3725
+ /** @see OGRTriangulatedSurface::end() const */
3726
+ inline const OGRTriangulatedSurface::ChildType *const *
3727
+ end(const OGRTriangulatedSurface *poGeom)
3728
+ {
3729
+ return poGeom->end();
3730
+ }
3731
+
3732
+ /** @see OGRTriangulatedSurface::begin() */
3733
+ inline OGRTriangulatedSurface::ChildType **begin(OGRTriangulatedSurface *poGeom)
3734
+ {
3735
+ return poGeom->begin();
3736
+ }
3737
+
3738
+ /** @see OGRTriangulatedSurface::end() */
3739
+ inline OGRTriangulatedSurface::ChildType **end(OGRTriangulatedSurface *poGeom)
3740
+ {
3741
+ return poGeom->end();
3742
+ }
3743
+
3744
+ //! @endcond
3745
+
3746
+ /************************************************************************/
3747
+ /* OGRMultiPoint */
3748
+ /************************************************************************/
3749
+
3750
+ /**
3751
+ * A collection of OGRPoint.
3752
+ */
3753
+
3754
+ class CPL_DLL OGRMultiPoint : public OGRGeometryCollection
3755
+ {
3756
+ private:
3757
+ OGRErr importFromWkt_Bracketed(const char **, int bHasM, int bHasZ);
3758
+
3759
+ protected:
3760
+ virtual OGRBoolean isCompatibleSubType(OGRwkbGeometryType) const override;
3761
+
3762
+ public:
3763
+ /** Create an empty multi point collection. */
3764
+ OGRMultiPoint() = default;
3765
+
3766
+ OGRMultiPoint(const OGRMultiPoint &other);
3767
+
3768
+ OGRMultiPoint &operator=(const OGRMultiPoint &other);
3769
+
3770
+ /** Type of child elements. */
3771
+ typedef OGRPoint ChildType;
3772
+
3773
+ /** Return begin of iterator.
3774
+ * @since GDAL 2.3
3775
+ */
3776
+ ChildType **begin()
3777
+ {
3778
+ return reinterpret_cast<ChildType **>(papoGeoms);
3779
+ }
3780
+
3781
+ /** Return end of iterator */
3782
+ ChildType **end()
3783
+ {
3784
+ return reinterpret_cast<ChildType **>(papoGeoms + nGeomCount);
3785
+ }
3786
+
3787
+ /** Return begin of iterator.
3788
+ * @since GDAL 2.3
3789
+ */
3790
+ const ChildType *const *begin() const
3791
+ {
3792
+ return reinterpret_cast<const ChildType *const *>(papoGeoms);
3793
+ }
3794
+
3795
+ /** Return end of iterator */
3796
+ const ChildType *const *end() const
3797
+ {
3798
+ return reinterpret_cast<const ChildType *const *>(papoGeoms +
3799
+ nGeomCount);
3800
+ }
3801
+
3802
+ // IGeometryCollection
3803
+ /** See OGRGeometryCollection::getGeometryRef() */
3804
+ OGRPoint *getGeometryRef(int i)
3805
+ {
3806
+ return OGRGeometryCollection::getGeometryRef(i)->toPoint();
3807
+ }
3808
+
3809
+ /** See OGRGeometryCollection::getGeometryRef() */
3810
+ const OGRPoint *getGeometryRef(int i) const
3811
+ {
3812
+ return OGRGeometryCollection::getGeometryRef(i)->toPoint();
3813
+ }
3814
+
3815
+ // Non-standard (OGRGeometry).
3816
+ virtual const char *getGeometryName() const override;
3817
+ virtual OGRwkbGeometryType getGeometryType() const override;
3818
+ virtual OGRMultiPoint *clone() const override;
3819
+
3820
+ #ifndef DOXYGEN_XML
3821
+ using OGRGeometry::importFromWkt; /** deprecated */
3822
+ #endif
3823
+
3824
+ OGRErr importFromWkt(const char **) override;
3825
+
3826
+ #ifndef DOXYGEN_XML
3827
+ using OGRGeometry::exportToWkt;
3828
+ #endif
3829
+
3830
+ /// Export a multipoint to WKT
3831
+ /// \param opts Output options.
3832
+ /// \param err Pointer to error code, if desired.
3833
+ /// \return WKT representation of the multipoint.
3834
+ virtual std::string exportToWkt(const OGRWktOptions &opts = OGRWktOptions(),
3835
+ OGRErr *err = nullptr) const override;
3836
+
3837
+ // IGeometry methods.
3838
+ virtual int getDimension() const override;
3839
+
3840
+ /** Return pointer of this in upper class */
3841
+ inline OGRGeometryCollection *toUpperClass()
3842
+ {
3843
+ return this;
3844
+ }
3845
+
3846
+ /** Return pointer of this in upper class */
3847
+ inline const OGRGeometryCollection *toUpperClass() const
3848
+ {
3849
+ return this;
3850
+ }
3851
+
3852
+ virtual void accept(IOGRGeometryVisitor *visitor) override
3853
+ {
3854
+ visitor->visit(this);
3855
+ }
3856
+
3857
+ virtual void accept(IOGRConstGeometryVisitor *visitor) const override
3858
+ {
3859
+ visitor->visit(this);
3860
+ }
3861
+
3862
+ // Non-standard.
3863
+ virtual OGRBoolean
3864
+ hasCurveGeometry(int bLookForNonLinear = FALSE) const override;
3865
+
3866
+ OGR_ALLOW_CAST_TO_THIS(MultiPoint)
3867
+ OGR_ALLOW_UPCAST_TO(GeometryCollection)
3868
+ OGR_FORBID_DOWNCAST_TO_MULTILINESTRING
3869
+ OGR_FORBID_DOWNCAST_TO_MULTICURVE
3870
+ OGR_FORBID_DOWNCAST_TO_MULTISURFACE
3871
+ OGR_FORBID_DOWNCAST_TO_MULTIPOLYGON
3872
+ };
3873
+
3874
+ //! @cond Doxygen_Suppress
3875
+ /** @see OGRMultiPoint::begin() const */
3876
+ inline const OGRMultiPoint::ChildType *const *begin(const OGRMultiPoint *poGeom)
3877
+ {
3878
+ return poGeom->begin();
3879
+ }
3880
+
3881
+ /** @see OGRMultiPoint::end() const */
3882
+ inline const OGRMultiPoint::ChildType *const *end(const OGRMultiPoint *poGeom)
3883
+ {
3884
+ return poGeom->end();
3885
+ }
3886
+
3887
+ /** @see OGRMultiPoint::begin() */
3888
+ inline OGRMultiPoint::ChildType **begin(OGRMultiPoint *poGeom)
3889
+ {
3890
+ return poGeom->begin();
3891
+ }
3892
+
3893
+ /** @see OGRMultiPoint::end() */
3894
+ inline OGRMultiPoint::ChildType **end(OGRMultiPoint *poGeom)
3895
+ {
3896
+ return poGeom->end();
3897
+ }
3898
+
3899
+ //! @endcond
3900
+
3901
+ /************************************************************************/
3902
+ /* OGRMultiCurve */
3903
+ /************************************************************************/
3904
+
3905
+ /**
3906
+ * A collection of OGRCurve.
3907
+ *
3908
+ * @since GDAL 2.0
3909
+ */
3910
+
3911
+ class CPL_DLL OGRMultiCurve : public OGRGeometryCollection
3912
+ {
3913
+ protected:
3914
+ //! @cond Doxygen_Suppress
3915
+ static OGRErr addCurveDirectlyFromWkt(OGRGeometry *poSelf,
3916
+ OGRCurve *poCurve);
3917
+ //! @endcond
3918
+ virtual OGRBoolean isCompatibleSubType(OGRwkbGeometryType) const override;
3919
+
3920
+ public:
3921
+ /** Create an empty multi curve collection. */
3922
+ OGRMultiCurve() = default;
3923
+
3924
+ OGRMultiCurve(const OGRMultiCurve &other);
3925
+
3926
+ OGRMultiCurve &operator=(const OGRMultiCurve &other);
3927
+
3928
+ /** Type of child elements. */
3929
+ typedef OGRCurve ChildType;
3930
+
3931
+ /** Return begin of iterator.
3932
+ * @since GDAL 2.3
3933
+ */
3934
+ ChildType **begin()
3935
+ {
3936
+ return reinterpret_cast<ChildType **>(papoGeoms);
3937
+ }
3938
+
3939
+ /** Return end of iterator */
3940
+ ChildType **end()
3941
+ {
3942
+ return reinterpret_cast<ChildType **>(papoGeoms + nGeomCount);
3943
+ }
3944
+
3945
+ /** Return begin of iterator.
3946
+ * @since GDAL 2.3
3947
+ */
3948
+ const ChildType *const *begin() const
3949
+ {
3950
+ return reinterpret_cast<const ChildType *const *>(papoGeoms);
3951
+ }
3952
+
3953
+ /** Return end of iterator */
3954
+ const ChildType *const *end() const
3955
+ {
3956
+ return reinterpret_cast<const ChildType *const *>(papoGeoms +
3957
+ nGeomCount);
3958
+ }
3959
+
3960
+ // IGeometryCollection
3961
+ /** See OGRGeometryCollection::getGeometryRef() */
3962
+ OGRCurve *getGeometryRef(int i)
3963
+ {
3964
+ return OGRGeometryCollection::getGeometryRef(i)->toCurve();
3965
+ }
3966
+
3967
+ /** See OGRGeometryCollection::getGeometryRef() */
3968
+ const OGRCurve *getGeometryRef(int i) const
3969
+ {
3970
+ return OGRGeometryCollection::getGeometryRef(i)->toCurve();
3971
+ }
3972
+
3973
+ // Non standard (OGRGeometry).
3974
+ virtual const char *getGeometryName() const override;
3975
+ virtual OGRwkbGeometryType getGeometryType() const override;
3976
+ virtual OGRMultiCurve *clone() const override;
3977
+
3978
+ #ifndef DOXYGEN_XML
3979
+ using OGRGeometry::importFromWkt; /** deprecated */
3980
+ #endif
3981
+
3982
+ OGRErr importFromWkt(const char **) override;
3983
+
3984
+ #ifndef DOXYGEN_XML
3985
+ using OGRGeometry::exportToWkt;
3986
+ #endif
3987
+
3988
+ /// Export a multicurve to WKT
3989
+ /// \param opts Output options.
3990
+ /// \param err Pointer to error code, if desired.
3991
+ /// \return WKT representation of the multicurve.
3992
+ virtual std::string exportToWkt(const OGRWktOptions &opts = OGRWktOptions(),
3993
+ OGRErr *err = nullptr) const override;
3994
+
3995
+ // IGeometry methods.
3996
+ virtual int getDimension() const override;
3997
+
3998
+ // Non-standard.
3999
+ virtual OGRBoolean
4000
+ hasCurveGeometry(int bLookForNonLinear = FALSE) const override;
4001
+
4002
+ /** Return pointer of this in upper class */
4003
+ inline OGRGeometryCollection *toUpperClass()
4004
+ {
4005
+ return this;
4006
+ }
4007
+
4008
+ /** Return pointer of this in upper class */
4009
+ inline const OGRGeometryCollection *toUpperClass() const
4010
+ {
4011
+ return this;
4012
+ }
4013
+
4014
+ virtual void accept(IOGRGeometryVisitor *visitor) override
4015
+ {
4016
+ visitor->visit(this);
4017
+ }
4018
+
4019
+ virtual void accept(IOGRConstGeometryVisitor *visitor) const override
4020
+ {
4021
+ visitor->visit(this);
4022
+ }
4023
+
4024
+ static OGRMultiLineString *CastToMultiLineString(OGRMultiCurve *poMC);
4025
+
4026
+ OGR_ALLOW_CAST_TO_THIS(MultiCurve)
4027
+ OGR_ALLOW_UPCAST_TO(GeometryCollection)
4028
+ OGR_FORBID_DOWNCAST_TO_MULTIPOINT
4029
+ OGR_FORBID_DOWNCAST_TO_MULTISURFACE
4030
+ OGR_FORBID_DOWNCAST_TO_MULTIPOLYGON
4031
+ };
4032
+
4033
+ //! @cond Doxygen_Suppress
4034
+ /** @see OGRMultiCurve::begin() const */
4035
+ inline const OGRMultiCurve::ChildType *const *begin(const OGRMultiCurve *poGeom)
4036
+ {
4037
+ return poGeom->begin();
4038
+ }
4039
+
4040
+ /** @see OGRMultiCurve::end() const */
4041
+ inline const OGRMultiCurve::ChildType *const *end(const OGRMultiCurve *poGeom)
4042
+ {
4043
+ return poGeom->end();
4044
+ }
4045
+
4046
+ /** @see OGRMultiCurve::begin() */
4047
+ inline OGRMultiCurve::ChildType **begin(OGRMultiCurve *poGeom)
4048
+ {
4049
+ return poGeom->begin();
4050
+ }
4051
+
4052
+ /** @see OGRMultiCurve::end() */
4053
+ inline OGRMultiCurve::ChildType **end(OGRMultiCurve *poGeom)
4054
+ {
4055
+ return poGeom->end();
4056
+ }
4057
+
4058
+ //! @endcond
4059
+
4060
+ /************************************************************************/
4061
+ /* OGRMultiLineString */
4062
+ /************************************************************************/
4063
+
4064
+ /**
4065
+ * A collection of OGRLineString.
4066
+ */
4067
+
4068
+ class CPL_DLL OGRMultiLineString : public OGRMultiCurve
4069
+ {
4070
+ protected:
4071
+ virtual OGRBoolean isCompatibleSubType(OGRwkbGeometryType) const override;
4072
+
4073
+ public:
4074
+ /** Create an empty multi line string collection. */
4075
+ OGRMultiLineString() = default;
4076
+
4077
+ OGRMultiLineString(const OGRMultiLineString &other);
4078
+
4079
+ OGRMultiLineString &operator=(const OGRMultiLineString &other);
4080
+
4081
+ /** Type of child elements. */
4082
+ typedef OGRLineString ChildType;
4083
+
4084
+ /** Return begin of iterator.
4085
+ * @since GDAL 2.3
4086
+ */
4087
+ ChildType **begin()
4088
+ {
4089
+ return reinterpret_cast<ChildType **>(papoGeoms);
4090
+ }
4091
+
4092
+ /** Return end of iterator */
4093
+ ChildType **end()
4094
+ {
4095
+ return reinterpret_cast<ChildType **>(papoGeoms + nGeomCount);
4096
+ }
4097
+
4098
+ /** Return begin of iterator.
4099
+ * @since GDAL 2.3
4100
+ */
4101
+ const ChildType *const *begin() const
4102
+ {
4103
+ return reinterpret_cast<const ChildType *const *>(papoGeoms);
4104
+ }
4105
+
4106
+ /** Return end of iterator */
4107
+ const ChildType *const *end() const
4108
+ {
4109
+ return reinterpret_cast<const ChildType *const *>(papoGeoms +
4110
+ nGeomCount);
4111
+ }
4112
+
4113
+ // IGeometryCollection
4114
+ /** See OGRGeometryCollection::getGeometryRef() */
4115
+ OGRLineString *getGeometryRef(int i)
4116
+ {
4117
+ return OGRGeometryCollection::getGeometryRef(i)->toLineString();
4118
+ }
4119
+
4120
+ /** See OGRGeometryCollection::getGeometryRef() */
4121
+ const OGRLineString *getGeometryRef(int i) const
4122
+ {
4123
+ return OGRGeometryCollection::getGeometryRef(i)->toLineString();
4124
+ }
4125
+
4126
+ // Non standard (OGRGeometry).
4127
+ virtual const char *getGeometryName() const override;
4128
+ virtual OGRwkbGeometryType getGeometryType() const override;
4129
+ virtual OGRMultiLineString *clone() const override;
4130
+
4131
+ #ifndef DOXYGEN_XML
4132
+ using OGRGeometry::exportToWkt;
4133
+ #endif
4134
+
4135
+ virtual OGRErr importFromWkb(const unsigned char *, size_t, OGRwkbVariant,
4136
+ size_t &nBytesConsumedOut) override;
4137
+
4138
+ /// Export a multilinestring to WKT
4139
+ /// \param opts Output options.
4140
+ /// \param err Pointer to error code, if desired.
4141
+ /// \return WKT representation of the multilinestring.
4142
+ virtual std::string exportToWkt(const OGRWktOptions &opts = OGRWktOptions(),
4143
+ OGRErr *err = nullptr) const override;
4144
+
4145
+ // Non standard
4146
+ virtual OGRBoolean
4147
+ hasCurveGeometry(int bLookForNonLinear = FALSE) const override;
4148
+
4149
+ /** Return pointer of this in upper class */
4150
+ inline OGRGeometryCollection *toUpperClass()
4151
+ {
4152
+ return this;
4153
+ }
4154
+
4155
+ /** Return pointer of this in upper class */
4156
+ inline const OGRGeometryCollection *toUpperClass() const
4157
+ {
4158
+ return this;
4159
+ }
4160
+
4161
+ virtual void accept(IOGRGeometryVisitor *visitor) override
4162
+ {
4163
+ visitor->visit(this);
4164
+ }
4165
+
4166
+ virtual void accept(IOGRConstGeometryVisitor *visitor) const override
4167
+ {
4168
+ visitor->visit(this);
4169
+ }
4170
+
4171
+ static OGRMultiCurve *CastToMultiCurve(OGRMultiLineString *poMLS);
4172
+
4173
+ OGR_ALLOW_CAST_TO_THIS(MultiLineString)
4174
+ OGR_ALLOW_UPCAST_TO(MultiCurve)
4175
+ OGR_FORBID_DOWNCAST_TO_MULTIPOINT
4176
+ OGR_FORBID_DOWNCAST_TO_MULTISURFACE
4177
+ OGR_FORBID_DOWNCAST_TO_MULTIPOLYGON
4178
+ };
4179
+
4180
+ //! @cond Doxygen_Suppress
4181
+ /** @see OGRMultiLineString::begin() const */
4182
+ inline const OGRMultiLineString::ChildType *const *
4183
+ begin(const OGRMultiLineString *poGeom)
4184
+ {
4185
+ return poGeom->begin();
4186
+ }
4187
+
4188
+ /** @see OGRMultiLineString::end() const */
4189
+ inline const OGRMultiLineString::ChildType *const *
4190
+ end(const OGRMultiLineString *poGeom)
4191
+ {
4192
+ return poGeom->end();
4193
+ }
4194
+
4195
+ /** @see OGRMultiLineString::begin() */
4196
+ inline OGRMultiLineString::ChildType **begin(OGRMultiLineString *poGeom)
4197
+ {
4198
+ return poGeom->begin();
4199
+ }
4200
+
4201
+ /** @see OGRMultiLineString::end() */
4202
+ inline OGRMultiLineString::ChildType **end(OGRMultiLineString *poGeom)
4203
+ {
4204
+ return poGeom->end();
4205
+ }
4206
+
4207
+ //! @endcond
4208
+
4209
+ /************************************************************************/
4210
+ /* OGRGeometryFactory */
4211
+ /************************************************************************/
4212
+
4213
+ /**
4214
+ * Create geometry objects from well known text/binary.
4215
+ */
4216
+
4217
+ class CPL_DLL OGRGeometryFactory
4218
+ {
4219
+ static OGRErr createFromFgfInternal(const unsigned char *pabyData,
4220
+ OGRSpatialReference *poSR,
4221
+ OGRGeometry **ppoReturn, int nBytes,
4222
+ int *pnBytesConsumed, int nRecLevel);
4223
+
4224
+ public:
4225
+ static OGRErr createFromWkb(const void *, const OGRSpatialReference *,
4226
+ OGRGeometry **,
4227
+ size_t = static_cast<size_t>(-1),
4228
+ OGRwkbVariant = wkbVariantOldOgc);
4229
+ static OGRErr createFromWkb(const void *pabyData,
4230
+ const OGRSpatialReference *, OGRGeometry **,
4231
+ size_t nSize, OGRwkbVariant eVariant,
4232
+ size_t &nBytesConsumedOut);
4233
+ static OGRErr createFromWkt(const char *, const OGRSpatialReference *,
4234
+ OGRGeometry **);
4235
+ static OGRErr createFromWkt(const char **, const OGRSpatialReference *,
4236
+ OGRGeometry **);
4237
+
4238
+ /** Deprecated.
4239
+ * @deprecated in GDAL 2.3
4240
+ */
4241
+ static OGRErr createFromWkt(char **ppszInput,
4242
+ const OGRSpatialReference *poSRS,
4243
+ OGRGeometry **ppoGeom)
4244
+ CPL_WARN_DEPRECATED("Use createFromWkt(const char**, ...) instead")
4245
+ {
4246
+ return createFromWkt(const_cast<const char **>(ppszInput), poSRS,
4247
+ ppoGeom);
4248
+ }
4249
+
4250
+ static OGRErr createFromFgf(const void *, OGRSpatialReference *,
4251
+ OGRGeometry **, int = -1, int * = nullptr);
4252
+ static OGRGeometry *createFromGML(const char *);
4253
+ static OGRGeometry *createFromGEOS(GEOSContextHandle_t hGEOSCtxt, GEOSGeom);
4254
+ static OGRGeometry *createFromGeoJson(const char *, int = -1);
4255
+ static OGRGeometry *createFromGeoJson(const CPLJSONObject &oJSONObject);
4256
+
4257
+ static void destroyGeometry(OGRGeometry *);
4258
+ static OGRGeometry *createGeometry(OGRwkbGeometryType);
4259
+
4260
+ static OGRGeometry *forceToPolygon(OGRGeometry *);
4261
+ static OGRGeometry *forceToLineString(OGRGeometry *,
4262
+ bool bOnlyInOrder = true);
4263
+ static OGRGeometry *forceToMultiPolygon(OGRGeometry *);
4264
+ static OGRGeometry *forceToMultiPoint(OGRGeometry *);
4265
+ static OGRGeometry *forceToMultiLineString(OGRGeometry *);
4266
+
4267
+ static OGRGeometry *forceTo(OGRGeometry *poGeom,
4268
+ OGRwkbGeometryType eTargetType,
4269
+ const char *const *papszOptions = nullptr);
4270
+
4271
+ static OGRGeometry *removeLowerDimensionSubGeoms(const OGRGeometry *poGeom);
4272
+
4273
+ static OGRGeometry *organizePolygons(OGRGeometry **papoPolygons,
4274
+ int nPolygonCount,
4275
+ int *pbResultValidGeometry,
4276
+ const char **papszOptions = nullptr);
4277
+ static bool haveGEOS();
4278
+
4279
+ /** Opaque class used as argument to transformWithOptions() */
4280
+ class CPL_DLL TransformWithOptionsCache
4281
+ {
4282
+ friend class OGRGeometryFactory;
4283
+ struct Private;
4284
+ std::unique_ptr<Private> d;
4285
+
4286
+ public:
4287
+ TransformWithOptionsCache();
4288
+ ~TransformWithOptionsCache();
4289
+ };
4290
+
4291
+ //! @cond Doxygen_Suppress
4292
+ static bool isTransformWithOptionsRegularTransform(
4293
+ const OGRSpatialReference *poSourceCRS,
4294
+ const OGRSpatialReference *poTargetCRS, CSLConstList papszOptions);
4295
+ //! @endcond
4296
+
4297
+ static OGRGeometry *transformWithOptions(
4298
+ const OGRGeometry *poSrcGeom, OGRCoordinateTransformation *poCT,
4299
+ char **papszOptions,
4300
+ const TransformWithOptionsCache &cache = TransformWithOptionsCache());
4301
+
4302
+ static OGRGeometry *
4303
+ approximateArcAngles(double dfX, double dfY, double dfZ,
4304
+ double dfPrimaryRadius, double dfSecondaryAxis,
4305
+ double dfRotation, double dfStartAngle,
4306
+ double dfEndAngle, double dfMaxAngleStepSizeDegrees,
4307
+ const bool bUseMaxGap = false);
4308
+
4309
+ static int GetCurveParameters(double x0, double y0, double x1, double y1,
4310
+ double x2, double y2, double &R, double &cx,
4311
+ double &cy, double &alpha0, double &alpha1,
4312
+ double &alpha2);
4313
+ static OGRLineString *
4314
+ curveToLineString(double x0, double y0, double z0, double x1, double y1,
4315
+ double z1, double x2, double y2, double z2, int bHasZ,
4316
+ double dfMaxAngleStepSizeDegrees,
4317
+ const char *const *papszOptions = nullptr);
4318
+ static OGRCurve *
4319
+ curveFromLineString(const OGRLineString *poLS,
4320
+ const char *const *papszOptions = nullptr);
4321
+ };
4322
+
4323
+ OGRwkbGeometryType CPL_DLL OGRFromOGCGeomType(const char *pszGeomType);
4324
+ const char CPL_DLL *OGRToOGCGeomType(OGRwkbGeometryType eGeomType,
4325
+ bool bCamelCase = false,
4326
+ bool bAddZM = false,
4327
+ bool bSpaceBeforeZM = false);
4328
+
4329
+ //! @cond Doxygen_Suppress
4330
+ typedef struct _OGRPreparedGeometry OGRPreparedGeometry;
4331
+
4332
+ struct CPL_DLL OGRPreparedGeometryUniquePtrDeleter
4333
+ {
4334
+ void operator()(OGRPreparedGeometry *) const;
4335
+ };
4336
+
4337
+ //! @endcond
4338
+
4339
+ /** Unique pointer type for OGRPreparedGeometry.
4340
+ * @since GDAL 2.3
4341
+ */
4342
+ typedef std::unique_ptr<OGRPreparedGeometry,
4343
+ OGRPreparedGeometryUniquePtrDeleter>
4344
+ OGRPreparedGeometryUniquePtr;
4345
+
4346
+ #endif /* ndef OGR_GEOMETRY_H_INCLUDED */