| 34 | #include <geode/tests/common.hpp> |
| 35 | |
| 36 | void test() |
| 37 | { |
| 38 | geode::OpenGeodeMeshLibrary::initialize(); |
| 39 | geode::CoordinateReferenceSystemManager3D crs_manager; |
| 40 | geode::CoordinateReferenceSystemManagerBuilder3D crs_manager_builder{ |
| 41 | crs_manager |
| 42 | }; |
| 43 | geode::AttributeManager att_manager; |
| 44 | att_manager.resize( 42 ); |
| 45 | const auto crs_name = "test"; |
| 46 | crs_manager_builder.register_coordinate_reference_system( crs_name, |
| 47 | std::make_shared< geode::AttributeCoordinateReferenceSystem3D >( |
| 48 | att_manager ) ); |
| 49 | geode::OpenGeodeMeshException::test( |
| 50 | crs_manager.nb_coordinate_reference_systems() == 1, |
| 51 | "Wrong number of CRS" ); |
| 52 | geode::OpenGeodeMeshException::test( |
| 53 | crs_manager.coordinate_reference_system_exists( crs_name ), |
| 54 | "CRS should exist" ); |
| 55 | geode::OpenGeodeMeshException::test( |
| 56 | !crs_manager.coordinate_reference_system_exists( "not a good test" ), |
| 57 | "CRS should not exist" ); |
| 58 | auto& crs = crs_manager_builder.coordinate_reference_system( crs_name ); |
| 59 | const geode::Point3D test_point{ { 12, 12, 12 } }; |
| 60 | crs.set_point( 0, test_point ); |
| 61 | crs_manager_builder.set_active_coordinate_reference_system( crs_name ); |
| 62 | const auto& const_crs = crs_manager.active_coordinate_reference_system(); |
| 63 | geode::OpenGeodeMeshException::test( |
| 64 | const_crs.point( 0 ) == test_point, "Wrong CRS point value" ); |
| 65 | geode::OpenGeodeMeshException::test( |
| 66 | const_crs.point( 1 ) != test_point, "Wrong CRS point value" ); |
| 67 | |
| 68 | const auto crs_name2 = "test2"; |
| 69 | crs_manager_builder.register_coordinate_reference_system( crs_name2, |
| 70 | std::make_shared< geode::AttributeCoordinateReferenceSystem3D >( |
| 71 | att_manager, "another crs" ) ); |
| 72 | geode::OpenGeodeMeshException::test( |
| 73 | crs_manager.nb_coordinate_reference_systems() == 2, |
| 74 | "Wrong number of CRS" ); |
| 75 | } |
| 76 | |
| 77 | OPENGEODE_TEST( "coordinate-reference-manager" ) |
nothing calls this directly
no test coverage detected