// Boost.Geometry // Unit Test // Copyright (c) 2017-2018, Oracle and/or its affiliates. // Contributed and/or modified by Adam Wulkiewicz, on behalf of Oracle // Use, modification and distribution is subject to the Boost Software License, // Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at // http://www.boost.org/LICENSE_1_0.txt) #include #include #include #include #include #include #include #include "check_geometry.hpp" int test_main(int, char*[]) { using namespace boost::geometry; using namespace boost::geometry::model; using namespace boost::geometry::srs; typedef point > point_ll; typedef point point_xy; { using namespace boost::geometry::srs::spar; point_ll pt_ll(1, 1); point_ll pt_ll2(0, 0); point_xy pt_xy(0, 0); projection > prj; prj.forward(pt_ll, pt_xy); test::check_geometry(pt_xy, "POINT(111308.33561309829 110591.34223734379)", 0.001); prj.inverse(pt_xy, pt_ll2); test::check_geometry(pt_ll2, "POINT(1 1)", 0.001); } { using namespace boost::geometry::srs::spar; projection > prj1; projection > prj2; projection > prj3; projection, y_0<> > > prj4 = parameters, y_0<> >( proj_tmerc(), ellps_wgs84(), x_0<>(0), y_0<>(0)); typedef spheroid sph; typedef ellps ell; typedef proj_tmerc prj; projection > prj5 = parameters(ell(sph(1000, 999))); } { point_ll pt_ll(1, 1); point_ll pt_ll2(0, 0); point_xy pt_xy(0, 0); projection > prj; prj.forward(pt_ll, pt_xy); test::check_geometry(pt_xy, "POINT(9413505.3284665551 237337.74515944949)", 0.001); prj.inverse(pt_xy, pt_ll2); // TODO: investigate this wierd result test::check_geometry(pt_ll2, "POINT(-2.4463131191981073 1.5066638962045082)", 0.001); projection > prj2; projection > prj3; } // compile-time errors { point_ll pt_ll(1, 1); point_xy pt_xy(0, 0); //projection > prj1; //projection prj2; projection > prj3; //prj3.inverse(pt_xy, pt_ll); } return 0; }