• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 // Boost.Geometry (aka GGL, Generic Geometry Library)
2 
3 // Copyright (c) 2008-2012 Barend Gehrels, Amsterdam, the Netherlands.
4 
5 // This file was modified by Oracle on 2017.
6 // Modifications copyright (c) 2017, Oracle and/or its affiliates.
7 // Contributed and/or modified by Adam Wulkiewicz, on behalf of Oracle
8 
9 // Use, modification and distribution is subject to the Boost Software License,
10 // Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
11 // http://www.boost.org/LICENSE_1_0.txt)
12 
13 #ifndef BOOST_GEOMETRY_STRATEGIES_TRANSFORM_SRS_TRANSFORMER_HPP
14 #define BOOST_GEOMETRY_STRATEGIES_TRANSFORM_SRS_TRANSFORMER_HPP
15 
16 
17 namespace boost { namespace geometry
18 {
19 
20 namespace strategy { namespace transform
21 {
22 
23 /*!
24     \brief Transformation strategy to do transform using a forward
25            Map Projection or SRS transformation.
26     \ingroup transform
27     \tparam ProjectionOrTransformation SRS projection or transformation type
28  */
29 template
30 <
31     typename ProjectionOrTransformation
32 >
33 class srs_forward_transformer
34 {
35 public:
srs_forward_transformer()36     inline srs_forward_transformer()
37     {}
38 
39     template <typename Parameters>
srs_forward_transformer(Parameters const & parameters)40     inline srs_forward_transformer(Parameters const& parameters)
41         : m_proj_or_transform(parameters)
42     {}
43 
44     template <typename Parameters1, typename Parameters2>
srs_forward_transformer(Parameters1 const & parameters1,Parameters2 const & parameters2)45     inline srs_forward_transformer(Parameters1 const& parameters1, Parameters2 const& parameters2)
46         : m_proj_or_transform(parameters1, parameters2)
47     {}
48 
49     template <typename Geometry1, typename Geometry2>
apply(Geometry1 const & g1,Geometry2 & g2) const50     inline bool apply(Geometry1 const& g1, Geometry2 & g2) const
51     {
52         return m_proj_or_transform.forward(g1, g2);
53     }
54 
55 private:
56     ProjectionOrTransformation m_proj_or_transform;
57 };
58 
59 
60 /*!
61     \brief Transformation strategy to do transform using an inverse
62            Map Projection or SRS transformation.
63     \ingroup transform
64     \tparam ProjectionOrTransformation SRS projection or transformation type
65  */
66 template
67 <
68     typename ProjectionOrTransformation
69 >
70 class srs_inverse_transformer
71 {
72 public:
srs_inverse_transformer()73     inline srs_inverse_transformer()
74     {}
75 
76     template <typename Parameters>
srs_inverse_transformer(Parameters const & parameters)77     inline srs_inverse_transformer(Parameters const& parameters)
78         : m_proj_or_transform(parameters)
79     {}
80 
81     template <typename Parameters1, typename Parameters2>
srs_inverse_transformer(Parameters1 const & parameters1,Parameters2 const & parameters2)82     inline srs_inverse_transformer(Parameters1 const& parameters1, Parameters2 const& parameters2)
83         : m_proj_or_transform(parameters1, parameters2)
84     {}
85 
86     template <typename Geometry1, typename Geometry2>
apply(Geometry1 const & g1,Geometry2 & g2) const87     inline bool apply(Geometry1 const& g1, Geometry2 & g2) const
88     {
89         return m_proj_or_transform.inverse(g1, g2);
90     }
91 
92 private:
93     ProjectionOrTransformation m_proj_or_transform;
94 };
95 
96 
97 }} // namespace strategy::transform
98 
99 }} // namespace boost::geometry
100 
101 
102 #endif // BOOST_GEOMETRY_STRATEGIES_TRANSFORM_SRS_TRANSFORMER_HPP
103