]> git.proxmox.com Git - ceph.git/blame - ceph/src/boost/libs/geometry/test/srs/transformation_epsg.cpp
update source to Ceph Pacific 16.2.2
[ceph.git] / ceph / src / boost / libs / geometry / test / srs / transformation_epsg.cpp
CommitLineData
f67539c2
TL
1// Boost.Geometry
2
3// Copyright (c) 2020, Oracle and/or its affiliates.
4// Contributed and/or modified by Adam Wulkiewicz, on behalf of Oracle
5
6// Use, modification and distribution is subject to the Boost Software License,
7// Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
8// http://www.boost.org/LICENSE_1_0.txt)
9
10
11#include <geometry_test_common.hpp>
12
13#include <boost/geometry.hpp>
14#include <boost/geometry/geometries/geometries.hpp>
15#include <boost/geometry/srs/epsg.hpp>
16#include <boost/geometry/srs/transformation.hpp>
17
18#include "check_geometry.hpp"
19
20template <typename T>
21void test_issue_657()
22{
23 using namespace boost::geometry;
24 using namespace boost::geometry::model;
25 using namespace boost::geometry::srs;
26
27 typedef model::point<T, 2, bg::cs::cartesian> point_car;
28 typedef model::point<T, 2, cs::geographic<bg::degree> > point_geo;
29
30 transformation<> tr1((bg::srs::epsg(4326)),
31 (bg::srs::proj4(
32 "+proj=merc +a=6378137 +b=6378137 +lat_ts=0.0 +lon_0=0.0 +x_0=0.0 "
33 "+y_0=0 +k=1.0 +units=m +nadgrids=@null +wktext +no_defs")));
34 transformation<> tr2((bg::srs::epsg(4326)),
35 (bg::srs::epsg(3785)));
36 transformation<bg::srs::static_epsg<4326>,
37 bg::srs::static_epsg<3785> > tr3;
38
39 point_geo pt(-114.7399212, 36.0160698);
40 point_car pt_out(-12772789.6016, 4302832.77709);
41 point_car pt_out1, pt_out2, pt_out3;
42
43 tr1.forward(pt, pt_out1);
44 tr2.forward(pt, pt_out2);
45 tr3.forward(pt, pt_out3);
46
47 test::check_geometry(pt_out1, pt_out, 0.001);
48 test::check_geometry(pt_out2, pt_out, 0.001);
49 test::check_geometry(pt_out3, pt_out, 0.001);
50}
51
52int test_main(int, char*[])
53{
54 test_issue_657<double>();
55
56 return 0;
57}