From 21ca8666f6bad8d9eab0bcbcf0a020afd1199788 Mon Sep 17 00:00:00 2001 From: Arnaud Botella Date: Thu, 20 Nov 2025 11:47:52 +0100 Subject: [PATCH 1/4] fix(Python): simplify GeographicCoordinateSystemInfo --- bindings/python/src/explicit/geometry/crs.hpp | 25 +++--- .../geometry/geographic_coordinate_system.hpp | 80 +++++++++---------- .../geometry/geographic_coordinate_system.cpp | 28 +++---- 3 files changed, 64 insertions(+), 69 deletions(-) diff --git a/bindings/python/src/explicit/geometry/crs.hpp b/bindings/python/src/explicit/geometry/crs.hpp index a654fc6..b1df4a8 100644 --- a/bindings/python/src/explicit/geometry/crs.hpp +++ b/bindings/python/src/explicit/geometry/crs.hpp @@ -26,21 +26,6 @@ #include #define PYTHON_CRS( dimension ) \ - const auto info##dimension = \ - "GeographicCoordinateSystemInfo" + std::to_string( dimension ) + "D"; \ - pybind11::class_< GeographicCoordinateSystem##dimension##D::Info >( \ - module, info##dimension.c_str() ) \ - .def( pybind11::init< std::string, std::string, std::string >() ) \ - .def( "authority_code", \ - &GeographicCoordinateSystem##dimension##D::Info::authority_code ) \ - .def( "string", \ - &GeographicCoordinateSystem##dimension##D::Info::string ) \ - .def_readwrite( "authority", \ - &GeographicCoordinateSystem##dimension##D::Info::authority ) \ - .def_readwrite( \ - "code", &GeographicCoordinateSystem##dimension##D::Info::code ) \ - .def_readwrite( \ - "name", &GeographicCoordinateSystem##dimension##D::Info::name ); \ const auto name##dimension = \ "GeographicCoordinateSystem" + std::to_string( dimension ) + "D"; \ pybind11::class_< GeographicCoordinateSystem##dimension##D, \ @@ -61,6 +46,16 @@ namespace geode { void define_crs( pybind11::module& module ) { + pybind11::class_< GeographicCoordinateSystemInfo >( + module, "GeographicCoordinateSystemInfo" ) + .def( pybind11::init< std::string, std::string, std::string >() ) + .def( "authority_code", + &GeographicCoordinateSystemInfo::authority_code ) + .def( "string", &GeographicCoordinateSystemInfo::string ) + .def_readwrite( + "authority", &GeographicCoordinateSystemInfo::authority ) + .def_readwrite( "code", &GeographicCoordinateSystemInfo::code ) + .def_readwrite( "name", &GeographicCoordinateSystemInfo::name ); PYTHON_CRS( 2 ); PYTHON_CRS( 3 ); } diff --git a/include/geode/geosciences/explicit/geometry/geographic_coordinate_system.hpp b/include/geode/geosciences/explicit/geometry/geographic_coordinate_system.hpp index bc18903..4bf536d 100644 --- a/include/geode/geosciences/explicit/geometry/geographic_coordinate_system.hpp +++ b/include/geode/geosciences/explicit/geometry/geographic_coordinate_system.hpp @@ -36,60 +36,60 @@ namespace geode namespace geode { - template < index_t dimension > - class GeographicCoordinateSystem - : public AttributeCoordinateReferenceSystem< dimension > + struct GeographicCoordinateSystemInfo { - friend class bitsery::Access; + GeographicCoordinateSystemInfo( + std::string authority_in, std::string code_in, std::string name_in ) + : authority{ std::move( authority_in ) }, + code{ std::move( code_in ) }, + name{ std::move( name_in ) } + { + } + GeographicCoordinateSystemInfo() = default; - public: - struct Info + [[nodiscard]] std::string authority_code() const + { + return absl::StrCat( authority, ":", code ); + } + + [[nodiscard]] std::string string() const + { + return absl::StrCat( "(", authority_code(), " -> ", name, ")" ); + } + + template < typename Archive > + void serialize( Archive& archive ) { - Info( std::string authority_in, - std::string code_in, - std::string name_in ) - : authority{ std::move( authority_in ) }, - code{ std::move( code_in ) }, - name{ std::move( name_in ) } - { - } - Info() = default; - - [[nodiscard]] std::string authority_code() const - { - return absl::StrCat( authority, ":", code ); - } - - [[nodiscard]] std::string string() const - { - return absl::StrCat( "(", authority_code(), " -> ", name, ")" ); - } - - template < typename Archive > - void serialize( Archive& archive ) - { - archive.ext( *this, - Growable< Archive, Info >{ { []( Archive& a, Info& info ) { + archive.ext( *this, + Growable< Archive, GeographicCoordinateSystemInfo >{ + { []( Archive& a, GeographicCoordinateSystemInfo& info ) { a.text1b( info.authority, info.authority.max_size() ); a.text1b( info.code, info.code.max_size() ); a.text1b( info.name, info.name.max_size() ); } } } ); - } + } + + std::string authority; + std::string code; + std::string name; + }; - std::string authority; - std::string code; - std::string name; - }; + template < index_t dimension > + class GeographicCoordinateSystem + : public AttributeCoordinateReferenceSystem< dimension > + { + friend class bitsery::Access; public: - GeographicCoordinateSystem( AttributeManager& manager, Info info ); + GeographicCoordinateSystem( + AttributeManager& manager, GeographicCoordinateSystemInfo info ); ~GeographicCoordinateSystem(); [[nodiscard]] static GeographicCoordinateSystem< dimension > create_from_attribute( const AttributeCoordinateReferenceSystem< dimension >& crs, AttributeManager& manager, - Info info ); + GeographicCoordinateSystemInfo info ); [[nodiscard]] static CRSType type_name_static() { @@ -101,9 +101,9 @@ namespace geode return type_name_static(); } - [[nodiscard]] const Info& info() const; + [[nodiscard]] const GeographicCoordinateSystemInfo& info() const; - [[nodiscard]] static absl::FixedArray< Info > + [[nodiscard]] static absl::FixedArray< GeographicCoordinateSystemInfo > geographic_coordinate_systems(); void import_coordinates( diff --git a/src/geode/geosciences/explicit/geometry/geographic_coordinate_system.cpp b/src/geode/geosciences/explicit/geometry/geographic_coordinate_system.cpp index 946b345..7fff3ef 100644 --- a/src/geode/geosciences/explicit/geometry/geographic_coordinate_system.cpp +++ b/src/geode/geosciences/explicit/geometry/geographic_coordinate_system.cpp @@ -39,11 +39,13 @@ namespace geode friend class bitsery::Access; public: - Impl( Info info ) : info_{ std::move( info ) } {} + Impl( GeographicCoordinateSystemInfo info ) : info_{ std::move( info ) } + { + } Impl() = default; - const Info& info() const + const GeographicCoordinateSystemInfo& info() const { return info_; } @@ -91,29 +93,28 @@ namespace geode } private: - Info info_; + GeographicCoordinateSystemInfo info_; }; template < index_t dimension > - GeographicCoordinateSystem< dimension >::GeographicCoordinateSystem() - { - } + GeographicCoordinateSystem< dimension >::GeographicCoordinateSystem() = + default; template < index_t dimension > GeographicCoordinateSystem< dimension >::GeographicCoordinateSystem( - AttributeManager& manager, Info info ) + AttributeManager& manager, GeographicCoordinateSystemInfo info ) : AttributeCoordinateReferenceSystem< dimension >{ manager, info.name }, impl_{ std::move( info ) } { } template < index_t dimension > - GeographicCoordinateSystem< dimension >::~GeographicCoordinateSystem() - { - } + GeographicCoordinateSystem< dimension >::~GeographicCoordinateSystem() = + default; template < index_t dimension > - auto GeographicCoordinateSystem< dimension >::info() const -> const Info& + const GeographicCoordinateSystemInfo& + GeographicCoordinateSystem< dimension >::info() const { return impl_->info(); } @@ -133,14 +134,13 @@ namespace geode } template < index_t dimension > - auto + absl::FixedArray< GeographicCoordinateSystemInfo > GeographicCoordinateSystem< dimension >::geographic_coordinate_systems() - -> absl::FixedArray< Info > { int nb_crs{ 0 }; auto** gdal_list = OSRGetCRSInfoListFromDatabase( nullptr, nullptr, &nb_crs ); - absl::FixedArray< Info > infos( nb_crs ); + absl::FixedArray< GeographicCoordinateSystemInfo > infos( nb_crs ); for( const auto i : Range{ nb_crs } ) { const auto* gdal_crs = gdal_list[i]; From 295de21b142c6f5251268f1c7ca788dcfef8257e Mon Sep 17 00:00:00 2001 From: BotellaA <3213882+BotellaA@users.noreply.github.com> Date: Thu, 20 Nov 2025 10:48:54 +0000 Subject: [PATCH 2/4] Apply prepare changes --- bindings/python/src/explicit/geometry/crs.hpp | 2 +- commitlint.config.js | 5 +- .../geometry/geographic_coordinate_system.hpp | 1 + .../geographic_coordinate_system_helper.hpp | 24 +++---- .../geographic_coordinate_system_helper.cpp | 62 +++++++++---------- 5 files changed, 48 insertions(+), 46 deletions(-) diff --git a/bindings/python/src/explicit/geometry/crs.hpp b/bindings/python/src/explicit/geometry/crs.hpp index b1df4a8..3af3aa2 100644 --- a/bindings/python/src/explicit/geometry/crs.hpp +++ b/bindings/python/src/explicit/geometry/crs.hpp @@ -32,7 +32,7 @@ CoordinateReferenceSystem##dimension##D >( \ module, name##dimension.c_str() ) \ .def( pybind11::init< AttributeManager&, \ - GeographicCoordinateSystem##dimension##D::Info >() ) \ + GeographicCoordinateSystemInfo >() ) \ .def( "type_name_static", \ &GeographicCoordinateSystem##dimension##D::type_name_static ) \ .def( "info", &GeographicCoordinateSystem##dimension##D::info ) \ diff --git a/commitlint.config.js b/commitlint.config.js index 3a29484..a397334 100644 --- a/commitlint.config.js +++ b/commitlint.config.js @@ -1,4 +1,4 @@ -export default { +const Configuration = { extends: ["@commitlint/config-angular"], rules: { "scope-empty": [2, "never"], @@ -12,5 +12,8 @@ export default { "subject-full-stop": [0], "type-case": [0], "type-empty": [0], + "type-enum": [2, "always", ["feat", "fix", "perf"]], }, } + +export default Configuration diff --git a/include/geode/geosciences/explicit/geometry/geographic_coordinate_system.hpp b/include/geode/geosciences/explicit/geometry/geographic_coordinate_system.hpp index 4bf536d..b396ee0 100644 --- a/include/geode/geosciences/explicit/geometry/geographic_coordinate_system.hpp +++ b/include/geode/geosciences/explicit/geometry/geographic_coordinate_system.hpp @@ -46,6 +46,7 @@ namespace geode { } GeographicCoordinateSystemInfo() = default; + ~GeographicCoordinateSystemInfo() = default; [[nodiscard]] std::string authority_code() const { diff --git a/include/geode/geosciences/explicit/geometry/geographic_coordinate_system_helper.hpp b/include/geode/geosciences/explicit/geometry/geographic_coordinate_system_helper.hpp index 6e05cd4..e74c889 100644 --- a/include/geode/geosciences/explicit/geometry/geographic_coordinate_system_helper.hpp +++ b/include/geode/geosciences/explicit/geometry/geographic_coordinate_system_helper.hpp @@ -49,79 +49,79 @@ namespace geode const EdgedCurve< dimension >& mesh, EdgedCurveBuilder< dimension >& builder, std::string_view crs_name, - typename GeographicCoordinateSystem< dimension >::Info info ); + GeographicCoordinateSystemInfo info ); template < index_t dimension > void assign_point_set_geographic_coordinate_system_info( const PointSet< dimension >& mesh, PointSetBuilder< dimension >& builder, std::string_view crs_name, - typename GeographicCoordinateSystem< dimension >::Info info ); + GeographicCoordinateSystemInfo info ); template < index_t dimension > void assign_solid_mesh_geographic_coordinate_system_info( const SolidMesh< dimension >& mesh, SolidMeshBuilder< dimension >& builder, std::string_view crs_name, - typename GeographicCoordinateSystem< dimension >::Info info ); + GeographicCoordinateSystemInfo info ); template < index_t dimension > void assign_surface_mesh_geographic_coordinate_system_info( const SurfaceMesh< dimension >& mesh, SurfaceMeshBuilder< dimension >& builder, std::string_view crs_name, - typename GeographicCoordinateSystem< dimension >::Info info ); + GeographicCoordinateSystemInfo info ); void opengeode_geosciences_explicit_api assign_brep_geographic_coordinate_system_info( const BRep& brep, BRepBuilder& builder, std::string_view crs_name, - const GeographicCoordinateSystem3D::Info& info ); + const GeographicCoordinateSystemInfo& info ); void opengeode_geosciences_explicit_api assign_section_geographic_coordinate_system_info( const Section& section, SectionBuilder& builder, std::string_view crs_name, - const GeographicCoordinateSystem2D::Info& info ); + const GeographicCoordinateSystemInfo& info ); template < index_t dimension > void convert_edged_curve_coordinate_reference_system( const EdgedCurve< dimension >& mesh, EdgedCurveBuilder< dimension >& builder, std::string_view crs_name, - typename GeographicCoordinateSystem< dimension >::Info info ); + GeographicCoordinateSystemInfo info ); template < index_t dimension > void convert_point_set_coordinate_reference_system( const PointSet< dimension >& mesh, PointSetBuilder< dimension >& builder, std::string_view crs_name, - typename GeographicCoordinateSystem< dimension >::Info info ); + GeographicCoordinateSystemInfo info ); template < index_t dimension > void convert_solid_mesh_coordinate_reference_system( const SolidMesh< dimension >& mesh, SolidMeshBuilder< dimension >& builder, std::string_view crs_name, - typename GeographicCoordinateSystem< dimension >::Info info ); + GeographicCoordinateSystemInfo info ); template < index_t dimension > void convert_surface_mesh_coordinate_reference_system( const SurfaceMesh< dimension >& mesh, SurfaceMeshBuilder< dimension >& builder, std::string_view crs_name, - typename GeographicCoordinateSystem< dimension >::Info info ); + GeographicCoordinateSystemInfo info ); void opengeode_geosciences_explicit_api convert_brep_coordinate_reference_system( const BRep& brep, BRepBuilder& builder, std::string_view crs_name, - const GeographicCoordinateSystem3D::Info& info ); + const GeographicCoordinateSystemInfo& info ); void opengeode_geosciences_explicit_api convert_section_coordinate_reference_system( const Section& section, SectionBuilder& builder, std::string_view crs_name, - const GeographicCoordinateSystem2D::Info& info ); + const GeographicCoordinateSystemInfo& info ); } // namespace geode \ No newline at end of file diff --git a/src/geode/geosciences/explicit/geometry/geographic_coordinate_system_helper.cpp b/src/geode/geosciences/explicit/geometry/geographic_coordinate_system_helper.cpp index a7003d3..96e50c3 100644 --- a/src/geode/geosciences/explicit/geometry/geographic_coordinate_system_helper.cpp +++ b/src/geode/geosciences/explicit/geometry/geographic_coordinate_system_helper.cpp @@ -52,7 +52,7 @@ namespace void convert_coordinate_reference_system( const Mesh& mesh, typename Mesh::Builder& builder, std::string_view crs_name, - typename geode::GeographicCoordinateSystem< Mesh::dim >::Info info ) + geode::GeographicCoordinateSystemInfo info ) { using GeoCRS = typename geode::GeographicCoordinateSystem< Mesh::dim >; const auto& crs_manager = @@ -84,8 +84,7 @@ namespace typename Range, typename GetMeshBuilder > void convert_components_coordinate_reference_system( - const typename geode::GeographicCoordinateSystem< dimension >::Info& - info, + const geode::GeographicCoordinateSystemInfo& info, std::string_view crs_name, Range range, GetMeshBuilder get_mesh_builder ) @@ -104,7 +103,7 @@ namespace const Mesh& mesh, typename Mesh::Builder& builder, std::string_view crs_name, - typename geode::GeographicCoordinateSystem< Mesh::dim >::Info info ) + typename geode::GeographicCoordinateSystemInfo info ) { const auto& crs_manager = mesh.main_coordinate_reference_system_manager(); @@ -129,8 +128,7 @@ namespace typename Range, typename GetMeshBuilder > void convert_components_attribute_to_geographic_coordinate_reference_system( - const typename geode::GeographicCoordinateSystem< dimension >::Info& - info, + const geode::GeographicCoordinateSystemInfo& info, std::string_view crs_name, Range range, GetMeshBuilder get_mesh_builder ) @@ -152,7 +150,7 @@ namespace geode const EdgedCurve< dimension >& mesh, EdgedCurveBuilder< dimension >& builder, std::string_view crs_name, - typename GeographicCoordinateSystem< dimension >::Info info ) + GeographicCoordinateSystemInfo info ) { convert_attribute_to_geographic_coordinate_reference_system( mesh, builder, crs_name, std::move( info ) ); @@ -163,7 +161,7 @@ namespace geode const PointSet< dimension >& mesh, PointSetBuilder< dimension >& builder, std::string_view crs_name, - typename GeographicCoordinateSystem< dimension >::Info info ) + GeographicCoordinateSystemInfo info ) { convert_attribute_to_geographic_coordinate_reference_system( mesh, builder, crs_name, std::move( info ) ); @@ -174,7 +172,7 @@ namespace geode const SolidMesh< dimension >& mesh, SolidMeshBuilder< dimension >& builder, std::string_view crs_name, - typename GeographicCoordinateSystem< dimension >::Info info ) + GeographicCoordinateSystemInfo info ) { convert_attribute_to_geographic_coordinate_reference_system( mesh, builder, crs_name, std::move( info ) ); @@ -185,7 +183,7 @@ namespace geode const SurfaceMesh< dimension >& mesh, SurfaceMeshBuilder< dimension >& builder, std::string_view crs_name, - typename GeographicCoordinateSystem< dimension >::Info info ) + GeographicCoordinateSystemInfo info ) { convert_attribute_to_geographic_coordinate_reference_system( mesh, builder, crs_name, std::move( info ) ); @@ -194,7 +192,7 @@ namespace geode void assign_brep_geographic_coordinate_system_info( const BRep& brep, BRepBuilder& builder, std::string_view crs_name, - const GeographicCoordinateSystem3D::Info& info ) + const GeographicCoordinateSystemInfo& info ) { convert_components_attribute_to_geographic_coordinate_reference_system< 3 >( info, crs_name, brep.corners(), [&builder]( const uuid& id ) { @@ -218,7 +216,7 @@ namespace geode const Section& section, SectionBuilder& builder, std::string_view crs_name, - const GeographicCoordinateSystem2D::Info& info ) + const GeographicCoordinateSystemInfo& info ) { convert_components_attribute_to_geographic_coordinate_reference_system< 2 >( @@ -241,7 +239,7 @@ namespace geode const EdgedCurve< dimension >& mesh, EdgedCurveBuilder< dimension >& builder, std::string_view crs_name, - typename GeographicCoordinateSystem< dimension >::Info info ) + GeographicCoordinateSystemInfo info ) { convert_coordinate_reference_system( mesh, builder, crs_name, std::move( info ) ); @@ -252,7 +250,7 @@ namespace geode const PointSet< dimension >& mesh, PointSetBuilder< dimension >& builder, std::string_view crs_name, - typename GeographicCoordinateSystem< dimension >::Info info ) + GeographicCoordinateSystemInfo info ) { convert_coordinate_reference_system( mesh, builder, crs_name, std::move( info ) ); @@ -263,7 +261,7 @@ namespace geode const SolidMesh< dimension >& mesh, SolidMeshBuilder< dimension >& builder, std::string_view crs_name, - typename GeographicCoordinateSystem< dimension >::Info info ) + GeographicCoordinateSystemInfo info ) { convert_coordinate_reference_system( mesh, builder, crs_name, std::move( info ) ); @@ -274,7 +272,7 @@ namespace geode const SurfaceMesh< dimension >& mesh, SurfaceMeshBuilder< dimension >& builder, std::string_view crs_name, - typename GeographicCoordinateSystem< dimension >::Info info ) + GeographicCoordinateSystemInfo info ) { convert_coordinate_reference_system( mesh, builder, crs_name, std::move( info ) ); @@ -283,7 +281,7 @@ namespace geode void convert_brep_coordinate_reference_system( const BRep& brep, BRepBuilder& builder, std::string_view crs_name, - const GeographicCoordinateSystem3D::Info& info ) + const GeographicCoordinateSystemInfo& info ) { convert_components_coordinate_reference_system< 3 >( info, crs_name, brep.corners(), [&builder]( const uuid& id ) { @@ -306,7 +304,7 @@ namespace geode void convert_section_coordinate_reference_system( const Section& section, SectionBuilder& builder, std::string_view crs_name, - const GeographicCoordinateSystem2D::Info& info ) + const GeographicCoordinateSystemInfo& info ) { convert_components_coordinate_reference_system< 2 >( info, crs_name, section.corners(), [&builder]( const uuid& id ) { @@ -327,79 +325,79 @@ namespace geode const EdgedCurve< 2 >&, EdgedCurveBuilder< 2 >&, std::string_view, - typename GeographicCoordinateSystem< 2 >::Info ); + GeographicCoordinateSystemInfo ); template void opengeode_geosciences_explicit_api assign_point_set_geographic_coordinate_system_info( const PointSet< 2 >&, PointSetBuilder< 2 >&, std::string_view, - typename GeographicCoordinateSystem< 2 >::Info ); + GeographicCoordinateSystemInfo ); template void opengeode_geosciences_explicit_api assign_surface_mesh_geographic_coordinate_system_info( const SurfaceMesh< 2 >&, SurfaceMeshBuilder< 2 >&, std::string_view, - typename GeographicCoordinateSystem< 2 >::Info ); + GeographicCoordinateSystemInfo ); template void opengeode_geosciences_explicit_api convert_edged_curve_coordinate_reference_system( const EdgedCurve< 2 >&, EdgedCurveBuilder< 2 >&, std::string_view, - typename GeographicCoordinateSystem< 2 >::Info ); + GeographicCoordinateSystemInfo ); template void opengeode_geosciences_explicit_api convert_point_set_coordinate_reference_system( const PointSet< 2 >&, PointSetBuilder< 2 >&, std::string_view, - typename GeographicCoordinateSystem< 2 >::Info ); + GeographicCoordinateSystemInfo ); template void opengeode_geosciences_explicit_api convert_surface_mesh_coordinate_reference_system( const SurfaceMesh< 2 >&, SurfaceMeshBuilder< 2 >&, std::string_view, - typename GeographicCoordinateSystem< 2 >::Info ); + GeographicCoordinateSystemInfo ); template void opengeode_geosciences_explicit_api assign_edged_curve_geographic_coordinate_system_info( const EdgedCurve< 3 >&, EdgedCurveBuilder< 3 >&, std::string_view, - typename GeographicCoordinateSystem< 3 >::Info ); + GeographicCoordinateSystemInfo ); template void opengeode_geosciences_explicit_api assign_point_set_geographic_coordinate_system_info( const PointSet< 3 >&, PointSetBuilder< 3 >&, std::string_view, - typename GeographicCoordinateSystem< 3 >::Info ); + GeographicCoordinateSystemInfo ); template void opengeode_geosciences_explicit_api assign_solid_mesh_geographic_coordinate_system_info( const SolidMesh< 3 >&, SolidMeshBuilder< 3 >&, std::string_view, - typename GeographicCoordinateSystem< 3 >::Info ); + GeographicCoordinateSystemInfo ); template void opengeode_geosciences_explicit_api assign_surface_mesh_geographic_coordinate_system_info( const SurfaceMesh< 3 >&, SurfaceMeshBuilder< 3 >&, std::string_view, - typename GeographicCoordinateSystem< 3 >::Info ); + GeographicCoordinateSystemInfo ); template void opengeode_geosciences_explicit_api convert_edged_curve_coordinate_reference_system( const EdgedCurve< 3 >&, EdgedCurveBuilder< 3 >&, std::string_view, - typename GeographicCoordinateSystem< 3 >::Info ); + GeographicCoordinateSystemInfo ); template void opengeode_geosciences_explicit_api convert_point_set_coordinate_reference_system( const PointSet< 3 >&, PointSetBuilder< 3 >&, std::string_view, - typename GeographicCoordinateSystem< 3 >::Info ); + GeographicCoordinateSystemInfo ); template void opengeode_geosciences_explicit_api convert_solid_mesh_coordinate_reference_system( const SolidMesh< 3 >&, SolidMeshBuilder< 3 >&, std::string_view, - typename GeographicCoordinateSystem< 3 >::Info ); + GeographicCoordinateSystemInfo ); template void opengeode_geosciences_explicit_api convert_surface_mesh_coordinate_reference_system( const SurfaceMesh< 3 >&, SurfaceMeshBuilder< 3 >&, std::string_view, - typename GeographicCoordinateSystem< 3 >::Info ); + GeographicCoordinateSystemInfo ); } // namespace geode \ No newline at end of file From 68d86349c60f8290d7483bca019ae036d123b662 Mon Sep 17 00:00:00 2001 From: Arnaud Botella Date: Thu, 20 Nov 2025 14:06:23 +0100 Subject: [PATCH 3/4] fix python --- .../test-py-geographic-coordinate-system.py | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/bindings/python/tests/explicit/test-py-geographic-coordinate-system.py b/bindings/python/tests/explicit/test-py-geographic-coordinate-system.py index 1d34813..8bd8cb2 100644 --- a/bindings/python/tests/explicit/test-py-geographic-coordinate-system.py +++ b/bindings/python/tests/explicit/test-py-geographic-coordinate-system.py @@ -22,14 +22,15 @@ import os import sys import platform + if sys.version_info >= (3, 8, 0) and platform.system() == "Windows": - for path in [x.strip() for x in os.environ['PATH'].split(';') if x]: + for path in [x.strip() for x in os.environ["PATH"].split(";") if x]: os.add_dll_directory(path) import opengeode import opengeode_geosciences_py_explicit as geosciences -if __name__ == '__main__': +if __name__ == "__main__": geosciences.GeosciencesExplicitLibrary.initialize() infos = geosciences.GeographicCoordinateSystem3D.geographic_coordinate_systems() @@ -41,17 +42,20 @@ manager.resize(nb_points) lambert1 = geosciences.GeographicCoordinateSystem3D( - manager, geosciences.GeographicCoordinateSystemInfo3D("EPSG", "27571", "I")) + manager, geosciences.GeographicCoordinateSystemInfo("EPSG", "27571", "I") + ) for p in range(nb_points): lambert1.set_point(p, opengeode.Point3D([p, p, p])) lambert2 = geosciences.GeographicCoordinateSystem3D( - manager, geosciences.GeographicCoordinateSystemInfo3D("EPSG", "27572", "II")) + manager, geosciences.GeographicCoordinateSystemInfo("EPSG", "27572", "II") + ) lambert2.import_coordinates(lambert1) answers = [ opengeode.Point3D([4273.64251995017, 1302920.55457198, 0]), opengeode.Point3D([4274.63159306906, 1302921.55102308, 1]), opengeode.Point3D([4275.62066620018, 1302922.54747419, 2]), - opengeode.Point3D([4276.60973934352, 1302923.5439253, 3])] + opengeode.Point3D([4276.60973934352, 1302923.5439253, 3]), + ] for p in range(nb_points): if not lambert2.point(p).inexact_equal(answers[p]): raise ValueError("[Test] Wrong coordinate conversion") From 5fe0c025fcd7fcaaf537527ee76ade9536e098e7 Mon Sep 17 00:00:00 2001 From: Arnaud Botella Date: Thu, 20 Nov 2025 14:15:01 +0100 Subject: [PATCH 4/4] test --- .../geometry/geographic_coordinate_system.hpp | 16 ++++++---------- .../geometry/geographic_coordinate_system.cpp | 13 +++++++++++++ 2 files changed, 19 insertions(+), 10 deletions(-) diff --git a/include/geode/geosciences/explicit/geometry/geographic_coordinate_system.hpp b/include/geode/geosciences/explicit/geometry/geographic_coordinate_system.hpp index b396ee0..dc62b15 100644 --- a/include/geode/geosciences/explicit/geometry/geographic_coordinate_system.hpp +++ b/include/geode/geosciences/explicit/geometry/geographic_coordinate_system.hpp @@ -36,17 +36,13 @@ namespace geode namespace geode { - struct GeographicCoordinateSystemInfo + struct opengeode_geosciences_explicit_api GeographicCoordinateSystemInfo { - GeographicCoordinateSystemInfo( - std::string authority_in, std::string code_in, std::string name_in ) - : authority{ std::move( authority_in ) }, - code{ std::move( code_in ) }, - name{ std::move( name_in ) } - { - } - GeographicCoordinateSystemInfo() = default; - ~GeographicCoordinateSystemInfo() = default; + GeographicCoordinateSystemInfo( std::string authority_in, + std::string code_in, + std::string name_in ); + GeographicCoordinateSystemInfo(); + ~GeographicCoordinateSystemInfo(); [[nodiscard]] std::string authority_code() const { diff --git a/src/geode/geosciences/explicit/geometry/geographic_coordinate_system.cpp b/src/geode/geosciences/explicit/geometry/geographic_coordinate_system.cpp index 7fff3ef..58979c5 100644 --- a/src/geode/geosciences/explicit/geometry/geographic_coordinate_system.cpp +++ b/src/geode/geosciences/explicit/geometry/geographic_coordinate_system.cpp @@ -33,6 +33,19 @@ namespace geode { + + GeographicCoordinateSystemInfo::GeographicCoordinateSystemInfo( + std::string authority_in, std::string code_in, std::string name_in ) + : authority{ std::move( authority_in ) }, + code{ std::move( code_in ) }, + name{ std::move( name_in ) } + { + } + + GeographicCoordinateSystemInfo::GeographicCoordinateSystemInfo() = default; + + GeographicCoordinateSystemInfo::~GeographicCoordinateSystemInfo() = default; + template < index_t dimension > class GeographicCoordinateSystem< dimension >::Impl {