aboutsummaryrefslogtreecommitdiff
path: root/test/unit/test_c_api.cpp
diff options
context:
space:
mode:
authorEven Rouault <even.rouault@spatialys.com>2018-12-04 23:32:19 +0100
committerEven Rouault <even.rouault@spatialys.com>2018-12-04 23:32:19 +0100
commit419c3850211447b3a435442662f8fa12efd15cca (patch)
tree6345a1a54ad7f5f1642e4ed90b8daf4cadb63bff /test/unit/test_c_api.cpp
parent724342895ee23496b92fc2b2c6e6fbf528cd3ba2 (diff)
downloadPROJ-419c3850211447b3a435442662f8fa12efd15cca.tar.gz
PROJ-419c3850211447b3a435442662f8fa12efd15cca.zip
Add proj_obj_create_vertical_crs() and proj_obj_create_compound_crs()
Diffstat (limited to 'test/unit/test_c_api.cpp')
-rw-r--r--test/unit/test_c_api.cpp43
1 files changed, 43 insertions, 0 deletions
diff --git a/test/unit/test_c_api.cpp b/test/unit/test_c_api.cpp
index bec965ce..57ade07f 100644
--- a/test/unit/test_c_api.cpp
+++ b/test/unit/test_c_api.cpp
@@ -2432,4 +2432,47 @@ TEST_F(CApi, proj_obj_create_projected_crs) {
ASSERT_NE(projCRS, nullptr);
}
+// ---------------------------------------------------------------------------
+
+TEST_F(CApi, proj_obj_create_compound_crs) {
+
+ auto horiz_cs = proj_obj_create_ellipsoidal_2D_cs(
+ m_ctxt, PJ_ELLPS2D_LONGITUDE_LATITUDE, nullptr, 0);
+ ObjectKeeper keeper_horiz_cs(horiz_cs);
+ ASSERT_NE(horiz_cs, nullptr);
+
+ auto horiz_crs = proj_obj_create_geographic_crs(
+ m_ctxt, "WGS 84", "World Geodetic System 1984", "WGS 84", 6378137,
+ 298.257223563, "Greenwich", 0.0, "Degree", 0.0174532925199433,
+ horiz_cs);
+ ObjectKeeper keeper_horiz_crs(horiz_crs);
+ ASSERT_NE(horiz_crs, nullptr);
+
+ auto vert_crs = proj_obj_create_vertical_crs(m_ctxt, "myVertCRS",
+ "myVertDatum", nullptr, 0.0);
+ ObjectKeeper keeper_vert_crs(vert_crs);
+ ASSERT_NE(vert_crs, nullptr);
+
+ EXPECT_EQ(proj_obj_get_name(vert_crs), std::string("myVertCRS"));
+
+ auto compound_crs = proj_obj_create_compound_crs(m_ctxt, "myCompoundCRS",
+ horiz_crs, vert_crs);
+ ObjectKeeper keeper_compound_crss(compound_crs);
+ ASSERT_NE(compound_crs, nullptr);
+
+ EXPECT_EQ(proj_obj_get_name(compound_crs), std::string("myCompoundCRS"));
+
+ auto subcrs_horiz = proj_obj_crs_get_sub_crs(m_ctxt, compound_crs, 0);
+ ASSERT_NE(subcrs_horiz, nullptr);
+ ObjectKeeper keeper_subcrs_horiz(subcrs_horiz);
+ EXPECT_TRUE(
+ proj_obj_is_equivalent_to(subcrs_horiz, horiz_crs, PJ_COMP_STRICT));
+
+ auto subcrs_vert = proj_obj_crs_get_sub_crs(m_ctxt, compound_crs, 1);
+ ASSERT_NE(subcrs_vert, nullptr);
+ ObjectKeeper keeper_subcrs_vert(subcrs_vert);
+ EXPECT_TRUE(
+ proj_obj_is_equivalent_to(subcrs_vert, vert_crs, PJ_COMP_STRICT));
+}
+
} // namespace