~ubuntu-branches/ubuntu/saucy/merkaartor/saucy

« back to all changes in this revision

Viewing changes to include/ggl/extensions/gis/projections/proj/urm5.hpp

Tags: upstream-0.15.3+svn20934
ImportĀ upstreamĀ versionĀ 0.15.3+svn20934

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
#ifndef GGL_PROJECTIONS_URM5_HPP
2
 
#define GGL_PROJECTIONS_URM5_HPP
3
 
 
4
 
// Generic Geometry Library - projections (based on PROJ4)
5
 
// This file is automatically generated. DO NOT EDIT.
6
 
 
7
 
// Copyright Barend Gehrels (1995-2009), Geodan Holding B.V. Amsterdam, the Netherlands.
8
 
// Copyright Bruno Lalande (2008-2009)
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
 
// This file is converted from PROJ4, http://trac.osgeo.org/proj
14
 
// PROJ4 is originally written by Gerald Evenden (then of the USGS)
15
 
// PROJ4 is maintained by Frank Warmerdam
16
 
// PROJ4 is converted to Geometry Library by Barend Gehrels (Geodan, Amsterdam)
17
 
 
18
 
// Original copyright notice:
19
 
 
20
 
// Permission is hereby granted, free of charge, to any person obtaining a
21
 
// copy of this software and associated documentation files (the "Software"),
22
 
// to deal in the Software without restriction, including without limitation
23
 
// the rights to use, copy, modify, merge, publish, distribute, sublicense,
24
 
// and/or sell copies of the Software, and to permit persons to whom the
25
 
// Software is furnished to do so, subject to the following conditions:
26
 
 
27
 
// The above copyright notice and this permission notice shall be included
28
 
// in all copies or substantial portions of the Software.
29
 
 
30
 
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
31
 
// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
32
 
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
33
 
// THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
34
 
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
35
 
// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
36
 
// DEALINGS IN THE SOFTWARE.
37
 
 
38
 
#include <boost/math/special_functions/hypot.hpp>
39
 
 
40
 
#include <ggl/extensions/gis/projections/impl/base_static.hpp>
41
 
#include <ggl/extensions/gis/projections/impl/base_dynamic.hpp>
42
 
#include <ggl/extensions/gis/projections/impl/projects.hpp>
43
 
#include <ggl/extensions/gis/projections/impl/factory_entry.hpp>
44
 
 
45
 
namespace ggl { namespace projection
46
 
{
47
 
    #ifndef DOXYGEN_NO_DETAIL
48
 
    namespace detail { namespace urm5{ 
49
 
 
50
 
            struct par_urm5
51
 
            {
52
 
                double m, rmn, q3, n;
53
 
            };
54
 
 
55
 
            // template class, using CRTP to implement forward/inverse
56
 
            template <typename Geographic, typename Cartesian, typename Parameters>
57
 
            struct base_urm5_spheroid : public base_t_f<base_urm5_spheroid<Geographic, Cartesian, Parameters>,
58
 
                     Geographic, Cartesian, Parameters>
59
 
            {
60
 
 
61
 
                 typedef double geographic_type;
62
 
                 typedef double cartesian_type;
63
 
 
64
 
                par_urm5 m_proj_parm;
65
 
 
66
 
                inline base_urm5_spheroid(const Parameters& par)
67
 
                    : base_t_f<base_urm5_spheroid<Geographic, Cartesian, Parameters>,
68
 
                     Geographic, Cartesian, Parameters>(*this, par) {}
69
 
 
70
 
                inline void fwd(geographic_type& lp_lon, geographic_type& lp_lat, cartesian_type& xy_x, cartesian_type& xy_y) const
71
 
                {
72
 
                    double t;
73
 
                
74
 
                    t = lp_lat = aasin(this->m_proj_parm.n * sin(lp_lat));
75
 
                    xy_x = this->m_proj_parm.m * lp_lon * cos(lp_lat);
76
 
                    t *= t;
77
 
                    xy_y = lp_lat * (1. + t * this->m_proj_parm.q3) * this->m_proj_parm.rmn;
78
 
                }
79
 
            };
80
 
 
81
 
            // Urmaev V
82
 
            template <typename Parameters>
83
 
            void setup_urm5(Parameters& par, par_urm5& proj_parm)
84
 
            {
85
 
                double alpha, t;
86
 
                proj_parm.n = pj_param(par.params, "dn").f;
87
 
                proj_parm.q3 = pj_param(par.params, "dq").f / 3.;
88
 
                alpha = pj_param(par.params, "ralpha").f;
89
 
                t = proj_parm.n * sin(alpha);
90
 
                proj_parm.m = cos(alpha) / sqrt(1. - t * t);
91
 
                proj_parm.rmn = 1. / (proj_parm.m * proj_parm.n);
92
 
                par.es = 0.;
93
 
                // par.inv = 0;
94
 
                // par.fwd = s_forward;
95
 
            }
96
 
 
97
 
        }} // namespace detail::urm5
98
 
    #endif // doxygen 
99
 
 
100
 
    /*!
101
 
        \brief Urmaev V projection
102
 
        \ingroup projections
103
 
        \tparam Geographic latlong point type
104
 
        \tparam Cartesian xy point type
105
 
        \tparam Parameters parameter type
106
 
        \par Projection characteristics
107
 
         - Pseudocylindrical
108
 
         - Spheroid
109
 
         - n= q= alphi=
110
 
        \par Example
111
 
        \image html ex_urm5.gif
112
 
    */
113
 
    template <typename Geographic, typename Cartesian, typename Parameters = parameters>
114
 
    struct urm5_spheroid : public detail::urm5::base_urm5_spheroid<Geographic, Cartesian, Parameters>
115
 
    {
116
 
        inline urm5_spheroid(const Parameters& par) : detail::urm5::base_urm5_spheroid<Geographic, Cartesian, Parameters>(par)
117
 
        {
118
 
            detail::urm5::setup_urm5(this->m_par, this->m_proj_parm);
119
 
        }
120
 
    };
121
 
 
122
 
    #ifndef DOXYGEN_NO_DETAIL
123
 
    namespace detail
124
 
    {
125
 
 
126
 
        // Factory entry(s)
127
 
        template <typename Geographic, typename Cartesian, typename Parameters>
128
 
        class urm5_entry : public detail::factory_entry<Geographic, Cartesian, Parameters>
129
 
        {
130
 
            public :
131
 
                virtual projection<Geographic, Cartesian>* create_new(const Parameters& par) const
132
 
                {
133
 
                    return new base_v_f<urm5_spheroid<Geographic, Cartesian, Parameters>, Geographic, Cartesian, Parameters>(par);
134
 
                }
135
 
        };
136
 
 
137
 
        template <typename Geographic, typename Cartesian, typename Parameters>
138
 
        inline void urm5_init(detail::base_factory<Geographic, Cartesian, Parameters>& factory)
139
 
        {
140
 
            factory.add_to_factory("urm5", new urm5_entry<Geographic, Cartesian, Parameters>);
141
 
        }
142
 
 
143
 
    } // namespace detail 
144
 
    #endif // doxygen
145
 
 
146
 
}} // namespace ggl::projection
147
 
 
148
 
#endif // GGL_PROJECTIONS_URM5_HPP
149