]>
git.proxmox.com Git - ceph.git/blob - ceph/src/boost/libs/geometry/test/srs/srs_transformer.cpp
4 // Copyright (c) 2017-2018, Oracle and/or its affiliates.
5 // Contributed and/or modified by Adam Wulkiewicz, on behalf of Oracle
7 // Use, modification and distribution is subject to the Boost Software License,
8 // Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
9 // http://www.boost.org/LICENSE_1_0.txt)
12 #include <geometry_test_common.hpp>
14 #include <boost/geometry.hpp>
15 #include <boost/geometry/geometries/geometries.hpp>
16 #include <boost/geometry/srs/epsg.hpp>
17 #include <boost/geometry/srs/projection.hpp>
18 #include <boost/geometry/srs/transformation.hpp>
19 #include <boost/geometry/strategies/transform/srs_transformer.hpp>
21 #include <boost/geometry/io/wkt/read.hpp>
23 #include "check_geometry.hpp"
26 int test_main(int, char*[])
28 using namespace boost::geometry
;
29 using namespace boost::geometry::model
;
30 using namespace boost::geometry::srs
;
31 using namespace bg::strategy::transform
;
33 typedef point
<double, 2, cs::geographic
<degree
> > point_ll
;
34 typedef point
<double, 2, cs::cartesian
> point_xy
;
35 //typedef polygon<point_ll> polygon_ll;
36 //typedef polygon<point_xy> polygon_xy;
40 point_ll
pt_ll2(0, 0);
42 point_xy
pt_xy2(0, 0);
44 srs_forward_transformer
<projection
<> > strategy_pf
= proj4("+proj=tmerc +ellps=WGS84 +units=m");
45 srs_inverse_transformer
<projection
<> > strategy_pi
= proj4("+proj=tmerc +ellps=WGS84 +units=m");
46 srs_forward_transformer
<transformation
<> > strategy_tf(proj4("+proj=tmerc +ellps=WGS84 +units=m"),
47 proj4("+proj=tmerc +ellps=clrk66 +units=m"));
48 srs_inverse_transformer
<transformation
<> > strategy_ti(proj4("+proj=tmerc +ellps=WGS84 +units=m"),
49 proj4("+proj=tmerc +ellps=clrk66 +units=m"));
51 bg::transform(pt_ll
, pt_xy
, strategy_pf
);
52 test::check_geometry(pt_xy
, "POINT(111308.33561309829 110591.34223734379)", 0.0001);
54 bg::transform(pt_xy
, pt_ll2
, strategy_pi
);
55 test::check_geometry(pt_ll2
, "POINT(1 1)", 0.0001);
57 bg::transform(pt_xy
, pt_xy2
, strategy_tf
);
58 test::check_geometry(pt_xy2
, "POINT(111309.54843459482 110584.27813586517)", 0.0001);
60 bg::transform(pt_xy2
, pt_xy
, strategy_ti
);
61 test::check_geometry(pt_xy
, "POINT(111308.33561309829 110591.34223734379)", 0.0001);
65 srs_forward_transformer
<projection
<> > strategy_pf
= epsg(2000);
66 srs_inverse_transformer
<projection
<> > strategy_pi
= epsg(2000);
67 srs_forward_transformer
<transformation
<> > strategy_tf(epsg(2000), epsg(2001));
68 srs_inverse_transformer
<transformation
<> > strategy_ti(epsg(2000), epsg(2001));
72 using namespace bg::srs::spar
;
74 srs_forward_transformer
76 projection
<parameters
<proj_tmerc
, ellps_wgs84
> >
78 srs_forward_transformer
80 projection
<parameters
<proj_tmerc
, ellps_wgs84
> >
82 srs_forward_transformer
86 parameters
<proj_tmerc
, ellps_wgs84
>,
87 parameters
<proj_tmerc
, ellps_clrk66
>
90 srs_forward_transformer
94 parameters
<proj_tmerc
, ellps_wgs84
>,
95 parameters
<proj_tmerc
, ellps_clrk66
>
101 srs_forward_transformer
<projection
<static_epsg
<2000> > > strategy_pf
;
102 srs_forward_transformer
<projection
<static_epsg
<2000> > > strategy_pi
;
103 srs_forward_transformer
<transformation
<static_epsg
<2000>, static_epsg
<2001> > > strategy_tf
;
104 srs_forward_transformer
<transformation
<static_epsg
<2000>, static_epsg
<2001> > > strategy_ti
;