Merge branch 'develop' into feature/buffer

This commit is contained in:
Barend Gehrels
2015-05-05 10:08:49 +02:00
177 changed files with 8061 additions and 1458 deletions

View File

@@ -89,6 +89,7 @@ ALIASES = qbk{1}="\xmlonly <qbk>\1</qbk> \endxmlonly" \
param_x="First coordinate (usually x-coordinate)" \
param_y="Second coordinate (usually y-coordinate)" \
param_z="Third coordinate (usually z-coordinate)" \
constructor_default_no_init="Default constructor, no initialization" \
constructor_default{1}="Default constructor, creating an empty \1" \
constructor_begin_end{1}="Constructor with begin and end, filling the \1" \
constructor_initializer_list{1}="Constructor taking std::initializer_list, filling the \1" \

View File

@@ -82,7 +82,17 @@
[import src/examples/core/tag.cpp]
[import src/examples/core/tag_cast.cpp]
[import src/examples/geometries/box.cpp]
[import src/examples/geometries/linestring.cpp]
[import src/examples/geometries/multi_linestring.cpp]
[import src/examples/geometries/multi_point.cpp]
[import src/examples/geometries/multi_polygon.cpp]
[import src/examples/geometries/point_xy.cpp]
[import src/examples/geometries/point.cpp]
[import src/examples/geometries/polygon.cpp]
[import src/examples/geometries/ring.cpp]
[import src/examples/geometries/segment.cpp]
[import src/examples/geometries/adapted/c_array.cpp]
[import src/examples/geometries/adapted/boost_array.cpp]
[import src/examples/geometries/adapted/boost_fusion.cpp]

View File

@@ -0,0 +1,16 @@
[/============================================================================
Boost.Geometry (aka GGL, Generic Geometry Library)
Copyright (c) 2009-2012 Barend Gehrels, Amsterdam, the Netherlands.
Copyright (c) 2009-2012 Mateusz Loskot, London, UK.
Copyright (c) 2009-2012 Bruno Lalande, Paris, France.
Copyright (c) 2015 Adam Wulkiewicz, Lodz, Poland.
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)
=============================================================================/]
[heading Examples]
[box]
[box_output]

View File

@@ -0,0 +1,16 @@
[/============================================================================
Boost.Geometry (aka GGL, Generic Geometry Library)
Copyright (c) 2009-2012 Barend Gehrels, Amsterdam, the Netherlands.
Copyright (c) 2009-2012 Mateusz Loskot, London, UK.
Copyright (c) 2009-2012 Bruno Lalande, Paris, France.
Copyright (c) 2015 Adam Wulkiewicz, Lodz, Poland.
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)
=============================================================================/]
[heading Examples]
[linestring]
[linestring_output]

View File

@@ -0,0 +1,16 @@
[/============================================================================
Boost.Geometry (aka GGL, Generic Geometry Library)
Copyright (c) 2009-2012 Barend Gehrels, Amsterdam, the Netherlands.
Copyright (c) 2009-2012 Mateusz Loskot, London, UK.
Copyright (c) 2009-2012 Bruno Lalande, Paris, France.
Copyright (c) 2015 Adam Wulkiewicz, Lodz, Poland.
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)
=============================================================================/]
[heading Examples]
[multi_linestring]
[multi_linestring_output]

View File

@@ -0,0 +1,16 @@
[/============================================================================
Boost.Geometry (aka GGL, Generic Geometry Library)
Copyright (c) 2009-2012 Barend Gehrels, Amsterdam, the Netherlands.
Copyright (c) 2009-2012 Mateusz Loskot, London, UK.
Copyright (c) 2009-2012 Bruno Lalande, Paris, France.
Copyright (c) 2015 Adam Wulkiewicz, Lodz, Poland.
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)
=============================================================================/]
[heading Examples]
[multi_point]
[multi_point_output]

View File

@@ -0,0 +1,16 @@
[/============================================================================
Boost.Geometry (aka GGL, Generic Geometry Library)
Copyright (c) 2009-2012 Barend Gehrels, Amsterdam, the Netherlands.
Copyright (c) 2009-2012 Mateusz Loskot, London, UK.
Copyright (c) 2009-2012 Bruno Lalande, Paris, France.
Copyright (c) 2015 Adam Wulkiewicz, Lodz, Poland.
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)
=============================================================================/]
[heading Examples]
[multi_polygon]
[multi_polygon_output]

View File

@@ -0,0 +1,18 @@
[/============================================================================
Boost.Geometry (aka GGL, Generic Geometry Library)
Copyright (c) 2009-2012 Barend Gehrels, Amsterdam, the Netherlands.
Copyright (c) 2009-2012 Mateusz Loskot, London, UK.
Copyright (c) 2009-2012 Bruno Lalande, Paris, France.
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)
=============================================================================/]
[heading Examples]
[point_xy]
[point_xy_output]
[include reference/geometries/point_assign_warning.qbk]

View File

@@ -0,0 +1,16 @@
[/============================================================================
Boost.Geometry (aka GGL, Generic Geometry Library)
Copyright (c) 2009-2012 Barend Gehrels, Amsterdam, the Netherlands.
Copyright (c) 2009-2012 Mateusz Loskot, London, UK.
Copyright (c) 2009-2012 Bruno Lalande, Paris, France.
Copyright (c) 2015 Adam Wulkiewicz, Lodz, Poland.
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)
=============================================================================/]
[heading Examples]
[polygon]
[polygon_output]

View File

@@ -0,0 +1,16 @@
[/============================================================================
Boost.Geometry (aka GGL, Generic Geometry Library)
Copyright (c) 2009-2012 Barend Gehrels, Amsterdam, the Netherlands.
Copyright (c) 2009-2012 Mateusz Loskot, London, UK.
Copyright (c) 2009-2012 Bruno Lalande, Paris, France.
Copyright (c) 2015 Adam Wulkiewicz, Lodz, Poland.
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)
=============================================================================/]
[heading Examples]
[ring]
[ring_output]

View File

@@ -0,0 +1,16 @@
[/============================================================================
Boost.Geometry (aka GGL, Generic Geometry Library)
Copyright (c) 2009-2012 Barend Gehrels, Amsterdam, the Netherlands.
Copyright (c) 2009-2012 Mateusz Loskot, London, UK.
Copyright (c) 2009-2012 Bruno Lalande, Paris, France.
Copyright (c) 2015 Adam Wulkiewicz, Lodz, Poland.
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)
=============================================================================/]
[heading Examples]
[segment]
[segment_output]

View File

@@ -4,11 +4,11 @@
[[Point][ [$img/ok.png] ][ [$img/ok.png] ][ [$img/ok.png] ][ [$img/ok.png] ][ [$img/ok.png] ][ [$img/ok.png] ][ [$img/ok.png] ][ [$img/ok.png] ][ [$img/ok.png] ][ [$img/ok.png] ]]
[[Segment][ [$img/ok.png] ][ [$img/ok.png] ][ [$img/ok.png] ][ [$img/ok.png] ][ [$img/ok.png] ][ [$img/ok.png] ][ [$img/ok.png] ][ [$img/ok.png] ][ [$img/ok.png] ][ [$img/ok.png] ]]
[[Box][ [$img/ok.png] ][ [$img/ok.png] ][ [$img/ok.png] ][ [$img/ok.png] ][ [$img/ok.png] ][ [$img/ok.png] ][ [$img/ok.png] ][ [$img/ok.png] ][ [$img/ok.png] ][ [$img/ok.png] ]]
[[Linestring][ [$img/ok.png] ][ [$img/ok.png] ][ [$img/ok.png] ][ [$img/ok.png] ][ [$img/ok.png] ][ [$img/ok.png] ][ [$img/nyi.png] ][ [$img/ok.png] ][ [$img/ok.png] ][ [$img/ok.png] ]]
[[Linestring][ [$img/ok.png] ][ [$img/ok.png] ][ [$img/ok.png] ][ [$img/ok.png] ][ [$img/ok.png] ][ [$img/ok.png] ][ [$img/ok.png] ][ [$img/ok.png] ][ [$img/ok.png] ][ [$img/ok.png] ]]
[[Ring][ [$img/ok.png] ][ [$img/ok.png] ][ [$img/ok.png] ][ [$img/ok.png] ][ [$img/ok.png] ][ [$img/ok.png] ][ [$img/nyi.png] ][ [$img/ok.png] ][ [$img/ok.png] ][ [$img/ok.png] ]]
[[Polygon][ [$img/ok.png] ][ [$img/ok.png] ][ [$img/ok.png] ][ [$img/ok.png] ][ [$img/ok.png] ][ [$img/ok.png] ][ [$img/nyi.png] ][ [$img/ok.png] ][ [$img/ok.png] ][ [$img/ok.png] ]]
[[MultiPoint][ [$img/ok.png] ][ [$img/ok.png] ][ [$img/ok.png] ][ [$img/nyi.png] ][ [$img/nyi.png] ][ [$img/nyi.png] ][ [$img/ok.png] ][ [$img/nyi.png] ][ [$img/nyi.png] ][ [$img/nyi.png] ]]
[[MultiLinestring][ [$img/ok.png] ][ [$img/ok.png] ][ [$img/ok.png] ][ [$img/ok.png] ][ [$img/ok.png] ][ [$img/ok.png] ][ [$img/nyi.png] ][ [$img/ok.png] ][ [$img/ok.png] ][ [$img/ok.png] ]]
[[MultiPoint][ [$img/ok.png] ][ [$img/ok.png] ][ [$img/ok.png] ][ [$img/ok.png] ][ [$img/nyi.png] ][ [$img/nyi.png] ][ [$img/ok.png] ][ [$img/ok.png] ][ [$img/nyi.png] ][ [$img/nyi.png] ]]
[[MultiLinestring][ [$img/ok.png] ][ [$img/ok.png] ][ [$img/ok.png] ][ [$img/ok.png] ][ [$img/ok.png] ][ [$img/ok.png] ][ [$img/ok.png] ][ [$img/ok.png] ][ [$img/ok.png] ][ [$img/ok.png] ]]
[[MultiPolygon][ [$img/ok.png] ][ [$img/ok.png] ][ [$img/ok.png] ][ [$img/ok.png] ][ [$img/ok.png] ][ [$img/ok.png] ][ [$img/nyi.png] ][ [$img/ok.png] ][ [$img/ok.png] ][ [$img/ok.png] ]]
[[Variant][ [$img/ok.png] ][ [$img/ok.png] ][ [$img/ok.png] ][ [$img/ok.png] ][ [$img/ok.png] ][ [$img/ok.png] ][ [$img/nyi.png] ][ [$img/ok.png] ][ [$img/ok.png] ][ [$img/ok.png] ]]
]

View File

@@ -25,6 +25,8 @@
[*Additional functionality]
* Added rtree const_iterator, begin(), end() and the support for Boost.Range.
* The support for C++11 `std::initializer_list` in geometries models.
* Disjoint and intersects support the following geometry combinations: multipoint/linestring, multipoint/multilinestring
[*Improvements]
@@ -33,6 +35,7 @@
[*Solved tickets]
* [@https://svn.boost.org/trac/boost/ticket/11113 11113] Support easy enumeration of all elements with BOOST_FOREACH
* [@https://svn.boost.org/trac/boost/ticket/11236 11236] Invalid result of centroid() for integer coordinate type
[/=================]
[heading Boost 1.58]

View File

@@ -13,7 +13,16 @@ project boost-geometry-doc-src-example-geometries
: # requirements
;
exe box : box.cpp ;
exe linestring : linestring.cpp ;
exe point : point.cpp ;
exe point_xy : point_xy.cpp ;
exe polygon : polygon.cpp ;
exe multi_linestring : multi_linestring.cpp ;
exe multi_point : multi_point.cpp ;
exe multi_polygon : multi_polygon.cpp ;
exe ring : ring.cpp ;
exe segment : segment.cpp ;
build-project adapted ;
build-project register ;

View File

@@ -0,0 +1,58 @@
// Boost.Geometry
// QuickBook Example
// Copyright (c) 2011-2012 Barend Gehrels, Amsterdam, the Netherlands.
// Copyright (c) 2015 Adam Wulkiewicz, Lodz, Poland.
// 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)
//[box
//` Declaration and use of the Boost.Geometry model::box, modelling the Box Concept
#include <iostream>
#include <boost/geometry.hpp>
namespace bg = boost::geometry;
int main()
{
typedef bg::model::point<double, 2, bg::cs::cartesian> point_t;
typedef bg::model::box<point_t> box_t;
box_t box1; /*< Default-construct a box. >*/
box_t box2(point_t(0.0, 0.0), point_t(5.0, 5.0)); /*< Construct, assigning min and max corner point. >*/
#ifndef BOOST_NO_CXX11_UNIFIED_INITIALIZATION_SYNTAX
box_t box3{{0.0, 0.0}, {5.0, 5.0}}; /*< Construct, using C++11 unified initialization syntax. >*/
#endif
bg::set<bg::min_corner, 0>(box1, 1.0); /*< Set a coordinate, generic. >*/
bg::set<bg::min_corner, 1>(box1, 2.0);
box1.max_corner().set<0>(3.0); /*< Set a coordinate, class-specific ([*Note]: prefer `bg::set()`). >*/
box1.max_corner().set<1>(4.0);
double min_x = bg::get<bg::min_corner, 0>(box1); /*< Get a coordinate, generic. >*/
double min_y = bg::get<bg::min_corner, 1>(box1);
double max_x = box1.max_corner().get<0>(); /*< Get a coordinate, class-specific ([*Note]: prefer `bg::get()`). >*/
double max_y = box1.max_corner().get<1>();
std::cout << min_x << ", " << min_y << ", " << max_x << ", " << max_y << std::endl;
return 0;
}
//]
//[box_output
/*`
Output:
[pre
1, 2, 3, 4
]
*/
//]

View File

@@ -0,0 +1,55 @@
// Boost.Geometry
// QuickBook Example
// Copyright (c) 2011-2012 Barend Gehrels, Amsterdam, the Netherlands.
// Copyright (c) 2015 Adam Wulkiewicz, Lodz, Poland.
// 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)
//[linestring
//` Declaration and use of the Boost.Geometry model::linestring, modelling the Linestring Concept
#include <iostream>
#include <boost/geometry.hpp>
#include <boost/geometry/geometries/geometries.hpp>
namespace bg = boost::geometry;
int main()
{
typedef bg::model::point<double, 2, bg::cs::cartesian> point_t;
typedef bg::model::linestring<point_t> linestring_t;
linestring_t ls1; /*< Default-construct a linestring. >*/
#if !defined(BOOST_NO_CXX11_UNIFIED_INITIALIZATION_SYNTAX) \
&& !defined(BOOST_NO_CXX11_HDR_INITIALIZER_LIST)
linestring_t ls2{{0.0, 0.0}, {1.0, 0.0}, {1.0, 2.0}}; /*< Construct a linestring containing three points, using C++11 unified initialization syntax. >*/
#endif
bg::append(ls1, point_t(0.0, 0.0)); /*< Append point. >*/
bg::append(ls1, point_t(1.0, 0.0));
bg::append(ls1, point_t(1.0, 2.0));
double l = bg::length(ls1);
std::cout << l << std::endl;
return 0;
}
//]
//[linestring_output
/*`
Output:
[pre
3
]
*/
//]

View File

@@ -0,0 +1,62 @@
// Boost.Geometry
// QuickBook Example
// Copyright (c) 2011-2012 Barend Gehrels, Amsterdam, the Netherlands.
// Copyright (c) 2015 Adam Wulkiewicz, Lodz, Poland.
// 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)
//[multi_linestring
//` Declaration and use of the Boost.Geometry model::multi_linestring, modelling the MultiLinestring Concept
#include <iostream>
#include <boost/geometry.hpp>
#include <boost/geometry/geometries/geometries.hpp>
namespace bg = boost::geometry;
int main()
{
typedef bg::model::point<double, 2, bg::cs::cartesian> point_t;
typedef bg::model::linestring<point_t> linestring_t;
typedef bg::model::multi_linestring<linestring_t> mlinestring_t;
mlinestring_t mls1; /*< Default-construct a multi_linestring. >*/
#if !defined(BOOST_NO_CXX11_UNIFIED_INITIALIZATION_SYNTAX) \
&& !defined(BOOST_NO_CXX11_HDR_INITIALIZER_LIST)
mlinestring_t mls2{{{0.0, 0.0}, {0.0, 1.0}, {2.0, 1.0}},
{{1.0, 0.0}, {2.0, 0.0}}}; /*< Construct a multi_linestring containing two linestrings, using C++11 unified initialization syntax. >*/
#endif
mls1.resize(2); /*< Resize a multi_linestring, store two linestrings. >*/
bg::append(mls1[0], point_t(0.0, 0.0)); /*< Append point to the first linestring. >*/
bg::append(mls1[0], point_t(0.0, 1.0));
bg::append(mls1[0], point_t(2.0, 1.0));
bg::append(mls1[1], point_t(1.0, 0.0)); /*< Append point to the second linestring. >*/
bg::append(mls1[1], point_t(2.0, 0.0));
double l = bg::length(mls1);
std::cout << l << std::endl;
return 0;
}
//]
//[multi_linestring_output
/*`
Output:
[pre
4
]
*/
//]

View File

@@ -0,0 +1,55 @@
// Boost.Geometry
// QuickBook Example
// Copyright (c) 2011-2012 Barend Gehrels, Amsterdam, the Netherlands.
// Copyright (c) 2015 Adam Wulkiewicz, Lodz, Poland.
// 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)
//[multi_point
//` Declaration and use of the Boost.Geometry model::multi_point, modelling the MultiPoint Concept
#include <iostream>
#include <boost/geometry.hpp>
#include <boost/geometry/geometries/geometries.hpp>
namespace bg = boost::geometry;
int main()
{
typedef bg::model::point<double, 2, bg::cs::cartesian> point_t;
typedef bg::model::multi_point<point_t> mpoint_t;
mpoint_t mpt1; /*< Default-construct a multi_point. >*/
#if !defined(BOOST_NO_CXX11_UNIFIED_INITIALIZATION_SYNTAX) \
&& !defined(BOOST_NO_CXX11_HDR_INITIALIZER_LIST)
mpoint_t mpt2{{{0.0, 0.0}, {1.0, 1.0}, {2.0, 2.0}}}; /*< Construct a multi_point containing three points, using C++11 unified initialization syntax. >*/
#endif
bg::append(mpt1, point_t(0.0, 0.0)); /*< Append point to the multi_point. >*/
bg::append(mpt1, point_t(1.0, 1.0));
bg::append(mpt1, point_t(2.0, 2.0));
std::size_t count = bg::num_points(mpt1);
std::cout << count << std::endl;
return 0;
}
//]
//[multi_point_output
/*`
Output:
[pre
3
]
*/
//]

View File

@@ -0,0 +1,75 @@
// Boost.Geometry
// QuickBook Example
// Copyright (c) 2011-2012 Barend Gehrels, Amsterdam, the Netherlands.
// Copyright (c) 2015 Adam Wulkiewicz, Lodz, Poland.
// 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)
//[multi_polygon
//` Declaration and use of the Boost.Geometry model::multi_polygon, modelling the MultiPolygon Concept
#include <iostream>
#include <boost/geometry.hpp>
#include <boost/geometry/geometries/geometries.hpp>
namespace bg = boost::geometry;
int main()
{
typedef bg::model::point<double, 2, bg::cs::cartesian> point_t;
typedef bg::model::polygon<point_t> polygon_t; /*< Default parameters, clockwise, closed polygon. >*/
typedef bg::model::multi_polygon<polygon_t> mpolygon_t; /*< Clockwise, closed multi_polygon. >*/
mpolygon_t mpoly1; /*< Default-construct a multi_polygon. >*/
#if !defined(BOOST_NO_CXX11_UNIFIED_INITIALIZATION_SYNTAX) \
&& !defined(BOOST_NO_CXX11_HDR_INITIALIZER_LIST)
mpolygon_t mpoly2{{{{0.0, 0.0}, {0.0, 5.0}, {5.0, 5.0}, {5.0, 0.0}, {0.0, 0.0}},
{{1.0, 1.0}, {4.0, 1.0}, {4.0, 4.0}, {1.0, 4.0}, {1.0, 1.0}}},
{{{5.0, 5.0}, {5.0, 6.0}, {6.0, 6.0}, {6.0, 5.0}, {5.0, 5.0}}}}; /*< Construct a multi_polygon containing two polygons, using C++11 unified initialization syntax. >*/
#endif
mpoly1.resize(2); /*< Resize a multi_polygon, store two polygons. >*/
bg::append(mpoly1[0].outer(), point_t(0.0, 0.0)); /*< Append point to the exterior ring of the first polygon. >*/
bg::append(mpoly1[0].outer(), point_t(0.0, 5.0));
bg::append(mpoly1[0].outer(), point_t(5.0, 5.0));
bg::append(mpoly1[0].outer(), point_t(5.0, 0.0));
bg::append(mpoly1[0].outer(), point_t(0.0, 0.0));
mpoly1[0].inners().resize(1); /*< Resize a container of interior rings of the first polygon. >*/
bg::append(mpoly1[0].inners()[0], point_t(1.0, 1.0)); /*< Append point to the interior ring of the first polygon. >*/
bg::append(mpoly1[0].inners()[0], point_t(4.0, 1.0));
bg::append(mpoly1[0].inners()[0], point_t(4.0, 4.0));
bg::append(mpoly1[0].inners()[0], point_t(1.0, 4.0));
bg::append(mpoly1[0].inners()[0], point_t(1.0, 1.0));
bg::append(mpoly1[1].outer(), point_t(5.0, 5.0)); /*< Append point to the exterior ring of the second polygon. >*/
bg::append(mpoly1[1].outer(), point_t(5.0, 6.0));
bg::append(mpoly1[1].outer(), point_t(6.0, 6.0));
bg::append(mpoly1[1].outer(), point_t(6.0, 5.0));
bg::append(mpoly1[1].outer(), point_t(5.0, 5.0));
double a = bg::area(mpoly1);
std::cout << a << std::endl;
return 0;
}
//]
//[multi_polygon_output
/*`
Output:
[pre
17
]
*/
//]

View File

@@ -19,11 +19,12 @@ int main()
{
bg::model::point<double, 2, bg::cs::cartesian> point1;
bg::model::point<double, 3, bg::cs::cartesian> point2(1.0, 2.0, 3.0); /*< Construct, assigning three coordinates >*/
point1.set<0>(1.0); /*< Set a coordinate. [*Note]: prefer using `bg::set<0>(point1, 1.0);` >*/
point1.set<1>(2.0);
double x = point1.get<0>(); /*< Get a coordinate. [*Note]: prefer using `x = bg::get<0>(point1);` >*/
double y = point1.get<1>();
bg::set<0>(point1, 1.0); /*< Set a coordinate, generic. >*/
point1.set<1>(2.0); /*< Set a coordinate, class-specific ([*Note]: prefer `bg::set()`). >*/
double x = bg::get<0>(point1); /*< Get a coordinate, generic. >*/
double y = point1.get<1>(); /*< Get a coordinate, class-specific ([*Note]: prefer `bg::get()`). >*/
std::cout << x << ", " << y << std::endl;
return 0;

View File

@@ -0,0 +1,44 @@
// Boost.Geometry (aka GGL, Generic Geometry Library)
// QuickBook Example
// Copyright (c) 2011-2012 Barend Gehrels, Amsterdam, the Netherlands.
// 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)
//[point_xy
//` Declaration and use of the Boost.Geometry model::d2::point_xy, modelling the Point Concept
#include <iostream>
#include <boost/geometry.hpp>
#include <boost/geometry/geometries/point_xy.hpp>
namespace bg = boost::geometry;
int main()
{
bg::model::d2::point_xy<double> point1;
bg::model::d2::point_xy<double> point2(1.0, 2.0); /*< Construct, assigning coordinates. >*/
bg::set<0>(point1, 1.0); /*< Set a coordinate, generic. >*/
point1.y(2.0); /*< Set a coordinate, class-specific ([*Note]: prefer `bg::set()`). >*/
double x = bg::get<0>(point1); /*< Get a coordinate, generic. >*/
double y = point1.y(); /*< Get a coordinate, class-specific ([*Note]: prefer `bg::get()`). >*/
std::cout << x << ", " << y << std::endl;
return 0;
}
//]
//[point_xy_output
/*`
Output:
[pre
1, 2
]
*/
//]

View File

@@ -0,0 +1,65 @@
// Boost.Geometry
// QuickBook Example
// Copyright (c) 2011-2012 Barend Gehrels, Amsterdam, the Netherlands.
// Copyright (c) 2015 Adam Wulkiewicz, Lodz, Poland.
// 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)
//[polygon
//` Declaration and use of the Boost.Geometry model::polygon, modelling the Polygon Concept
#include <iostream>
#include <boost/geometry.hpp>
#include <boost/geometry/geometries/geometries.hpp>
namespace bg = boost::geometry;
int main()
{
typedef bg::model::point<double, 2, bg::cs::cartesian> point_t;
typedef bg::model::polygon<point_t> polygon_t; /*< Default parameters, clockwise, closed polygon. >*/
polygon_t poly1; /*< Default-construct a polygon. >*/
#if !defined(BOOST_NO_CXX11_UNIFIED_INITIALIZATION_SYNTAX) \
&& !defined(BOOST_NO_CXX11_HDR_INITIALIZER_LIST)
polygon_t polygon2{{{0.0, 0.0}, {0.0, 5.0}, {5.0, 5.0}, {5.0, 0.0}, {0.0, 0.0}},
{{1.0, 1.0}, {4.0, 1.0}, {4.0, 4.0}, {1.0, 4.0}, {1.0, 1.0}}}; /*< Construct a polygon containing an exterior and interior ring, using C++11 unified initialization syntax. >*/
#endif
bg::append(poly1.outer(), point_t(0.0, 0.0)); /*< Append point to the exterior ring. >*/
bg::append(poly1.outer(), point_t(0.0, 5.0));
bg::append(poly1.outer(), point_t(5.0, 5.0));
bg::append(poly1.outer(), point_t(5.0, 0.0));
bg::append(poly1.outer(), point_t(0.0, 0.0));
poly1.inners().resize(1); /*< Resize a container of interior rings. >*/
bg::append(poly1.inners()[0], point_t(1.0, 1.0)); /*< Append point to the interior ring. >*/
bg::append(poly1.inners()[0], point_t(4.0, 1.0));
bg::append(poly1.inners()[0], point_t(4.0, 4.0));
bg::append(poly1.inners()[0], point_t(1.0, 4.0));
bg::append(poly1.inners()[0], point_t(1.0, 1.0));
double a = bg::area(poly1);
std::cout << a << std::endl;
return 0;
}
//]
//[polygon_output
/*`
Output:
[pre
16
]
*/
//]

View File

@@ -0,0 +1,57 @@
// Boost.Geometry
// QuickBook Example
// Copyright (c) 2011-2012 Barend Gehrels, Amsterdam, the Netherlands.
// Copyright (c) 2015 Adam Wulkiewicz, Lodz, Poland.
// 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)
//[ring
//` Declaration and use of the Boost.Geometry model::ring, modelling the Ring Concept
#include <iostream>
#include <boost/geometry.hpp>
#include <boost/geometry/geometries/geometries.hpp>
namespace bg = boost::geometry;
int main()
{
typedef bg::model::point<double, 2, bg::cs::cartesian> point_t;
typedef bg::model::ring<point_t> ring_t; /*< Default parameters, clockwise, closed ring. >*/
ring_t ring1; /*< Default-construct a ring. >*/
#if !defined(BOOST_NO_CXX11_UNIFIED_INITIALIZATION_SYNTAX) \
&& !defined(BOOST_NO_CXX11_HDR_INITIALIZER_LIST)
ring_t ring2{{0.0, 0.0}, {0.0, 5.0}, {5.0, 5.0}, {5.0, 0.0}, {0.0, 0.0}}; /*< Construct a ring containing four points plus one closing point, using C++11 unified initialization syntax. >*/
#endif
bg::append(ring1, point_t(0.0, 0.0)); /*< Append point. >*/
bg::append(ring1, point_t(0.0, 5.0));
bg::append(ring1, point_t(5.0, 5.0));
bg::append(ring1, point_t(5.0, 0.0));
bg::append(ring1, point_t(0.0, 0.0));
double a = bg::area(ring1);
std::cout << a << std::endl;
return 0;
}
//]
//[ring_output
/*`
Output:
[pre
25
]
*/
//]

View File

@@ -0,0 +1,59 @@
// Boost.Geometry
// QuickBook Example
// Copyright (c) 2011-2012 Barend Gehrels, Amsterdam, the Netherlands.
// Copyright (c) 2015 Adam Wulkiewicz, Lodz, Poland.
// 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)
//[segment
//` Declaration and use of the Boost.Geometry model::segment, modelling the Segment Concept
#include <iostream>
#include <boost/geometry.hpp>
#include <boost/geometry/geometries/geometries.hpp>
namespace bg = boost::geometry;
int main()
{
typedef bg::model::point<double, 2, bg::cs::cartesian> point_t;
typedef bg::model::segment<point_t> segment_t;
segment_t seg1; /*< Default-construct a segment. >*/
segment_t seg2(point_t(0.0, 0.0), point_t(5.0, 5.0)); /*< Construct, assigning the first and the second point. >*/
#ifndef BOOST_NO_CXX11_UNIFIED_INITIALIZATION_SYNTAX
segment_t seg3{{0.0, 0.0}, {5.0, 5.0}}; /*< Construct, using C++11 unified initialization syntax. >*/
#endif
bg::set<0, 0>(seg1, 1.0); /*< Set a coordinate. >*/
bg::set<0, 1>(seg1, 2.0);
bg::set<1, 0>(seg1, 3.0);
bg::set<1, 1>(seg1, 4.0);
double x0 = bg::get<0, 0>(seg1); /*< Get a coordinate. >*/
double y0 = bg::get<0, 1>(seg1);
double x1 = bg::get<1, 0>(seg1);
double y1 = bg::get<1, 1>(seg1);
std::cout << x0 << ", " << y0 << ", " << x1 << ", " << y1 << std::endl;
return 0;
}
//]
//[segment_output
/*`
Output:
[pre
1, 2, 3, 4
]
*/
//]

View File

@@ -3,11 +3,13 @@
# Copyright (c) 2007-2012 Barend Gehrels, Amsterdam, the Netherlands.
# Copyright (c) 2008-2012 Bruno Lalande, Paris, France.
# Copyright (c) 2009-2012 Mateusz Loskot, London, UK.
# Copyright (c) 2015 Adam Wulkiewicz, Lodz, Poland.
#
# 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)
build-project io ;
build-project latlong ;
build-project projections ;

View File

@@ -0,0 +1,13 @@
# Boost.Geometry (aka GGL, Generic Geometry Library)
#
# Copyright (c) 2007-2012 Barend Gehrels, Amsterdam, the Netherlands.
# Copyright (c) 2008-2012 Bruno Lalande, Paris, France.
# Copyright (c) 2009-2012 Mateusz Loskot, London, UK.
# Copyright (c) 2015 Adam Wulkiewicz, Lodz, Poland.
#
# 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)
build-project wkb ;

View File

@@ -0,0 +1,17 @@
# Boost.Geometry (aka GGL, Generic Geometry Library)
#
# Copyright (c) 2007-2012 Barend Gehrels, Amsterdam, the Netherlands.
# Copyright (c) 2008-2012 Bruno Lalande, Paris, France.
# Copyright (c) 2009-2012 Mateusz Loskot, London, UK.
# Copyright (c) 2015 Adam Wulkiewicz, Lodz, Poland.
#
# 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)
test-suite boost-geometry-extensions-gis-io-wkb
:
[ run read_wkb.cpp ]
[ run write_wkb.cpp ]
;

View File

@@ -15,6 +15,7 @@
#include <boost/test/included/unit_test.hpp>
#include <boost/test/floating_point_comparison.hpp>
#include <boost/cstdint.hpp>
#include <boost/geometry/strategies/strategies.hpp>
#include <boost/geometry/algorithms/equals.hpp>
#include <boost/geometry/geometries/geometries.hpp>
@@ -22,6 +23,10 @@
#include <boost/geometry/extensions/gis/io/wkb/read_wkb.hpp>
#include <boost/geometry/extensions/gis/io/wkb/utility.hpp>
#include <boost/geometry/io/wkt/wkt.hpp>
#include <boost/geometry/io/wkt/write.hpp>
#include <boost/assign/list_of.hpp>
namespace bg = boost::geometry;
namespace { // anonymous
@@ -34,11 +39,11 @@ void test_geometry_wrong_wkb(std::string const& wkbhex, std::string const& wkt)
byte_vector wkb;
BOOST_CHECK( bg::hex2wkb(wkbhex, std::back_inserter(wkb)) );
Geometry g_wkb;
std::cout << bg::read_wkb(wkb.begin(), wkb.end(), g_wkb) << std::endl;
BOOST_MESSAGE("read_wkb: " << bg::read_wkb(wkb.begin(), wkb.end(), g_wkb));
}
template <typename Geometry, bool IsEqual>
void test_geometry_equals(std::string const& wkbhex, std::string const& wkt)
void test_geometry_equals_old(std::string const& wkbhex, std::string const& wkt)
{
byte_vector wkb;
BOOST_CHECK( bg::hex2wkb(wkbhex, std::back_inserter(wkb)) );
@@ -47,9 +52,25 @@ void test_geometry_equals(std::string const& wkbhex, std::string const& wkt)
Geometry g_expected;
bg::read_wkt(wkt, g_expected);
BOOST_CHECK( bg::equals(g_wkb, g_expected) == IsEqual );
}
template <typename Geometry, bool IsEqual>
void test_geometry_equals(Geometry const& g_expected, std::string const& wkbhex)
{
byte_vector wkb;
BOOST_CHECK( bg::hex2wkb(wkbhex, std::back_inserter(wkb)));
Geometry g_wkb;
bg::read_wkb(wkb.begin(), wkb.end(), g_wkb);
BOOST_CHECK_MESSAGE( bg::equals(g_wkb, g_expected) == IsEqual,
"{bg::equals(g_wkb, g_expected) == IsEqual} failed for" <<
" EXPECTED: " << bg::wkt(g_expected) <<
", ACTUAL : " << bg::wkt(g_wkb) );
}
//template <typename P, bool Result>
//void test_polygon_wkt(std::string const& wkt)
//{
@@ -64,45 +85,190 @@ void test_geometry_equals(std::string const& wkbhex, std::string const& wkt)
int test_main(int, char* [])
{
typedef bg::model::point<double, 2, bg::cs::cartesian> point_type;
typedef bg::model::linestring<point_type> linestring_type;
{
typedef bg::model::point<double, 2, bg::cs::cartesian> point_type;
typedef bg::model::point<double, 3, bg::cs::cartesian> point3d_type;
//
// POINT
//
//
// POINT
//
test_geometry_equals<point_type, true>(
"01010000005839B4C876BEF33F83C0CAA145B61640", "POINT (1.234 5.678)");
test_geometry_equals_old<point_type, true>(
"01010000005839B4C876BEF33F83C0CAA145B61640", "POINT (1.234 5.678)");
// XYZ - POINT(1.234 5.678 99) - Z coordinate ignored
test_geometry_equals<point_type, true>(
"01010000805839B4C876BEF33F83C0CAA145B616400000000000C05840", "POINT(1.234 5.678)");
test_geometry_equals_old<point3d_type, true>(
"01E90300005839B4C876BEF33F83C0CAA145B616404F401361C3332240", "POINT(1.234 5.678 9.1011)");
// SRID=32632;POINT(1.234 5.678) - PostGIS EWKT
test_geometry_equals<point_type, false>(
"0101000020787F00005839B4C876BEF33F83C0CAA145B61640", "POINT (1.234 5.678)");
// // XYZ - POINT(1.234 5.678 99) - Z coordinate ignored
// test_geometry_equals<point_type, true>(
// "01010000805839B4C876BEF33F83C0CAA145B616400000000000C05840", "POINT(1.234 5.678)");
//
// // SRID=32632;POINT(1.234 5.678) - PostGIS EWKT
// test_geometry_equals<point_type, false>(
// "0101000020787F00005839B4C876BEF33F83C0CAA145B61640", "POINT (1.234 5.678)");
//
// // SRID=4326;POINT(1.234 5.678 99) - PostGIS EWKT
// test_geometry_equals<point_type, false>(
// "01010000A0E61000005839B4C876BEF33F83C0CAA145B616400000000000C05840", "POINT(1.234 5.678)");
//
// // POINTM(1.234 5.678 99) - XYM with M compound ignored
// test_geometry_equals<point_type, true>(
// "01010000405839B4C876BEF33F83C0CAA145B616400000000000C05840", "POINT (1.234 5.678)");
//
// // SRID=32632;POINTM(1.234 5.678 99)
// test_geometry_equals<point_type, false>(
// "0101000060787F00005839B4C876BEF33F83C0CAA145B616400000000000C05840", "POINT (1.234 5.678)");
//
// // POINT(1.234 5.678 15 79) - XYZM - Z and M compounds ignored
// test_geometry_equals<point_type, true>(
// "01010000C05839B4C876BEF33F83C0CAA145B616400000000000002E400000000000C05340",
// "POINT (1.234 5.678)");
//
// // SRID=4326;POINT(1.234 5.678 15 79) - XYZM + SRID
// test_geometry_equals<point_type, false>(
// "01010000E0E61000005839B4C876BEF33F83C0CAA145B616400000000000002E400000000000C05340",
// "POINT (1.234 5.678)");
// SRID=4326;POINT(1.234 5.678 99) - PostGIS EWKT
test_geometry_equals<point_type, false>(
"01010000A0E61000005839B4C876BEF33F83C0CAA145B616400000000000C05840", "POINT(1.234 5.678)");
}
// POINTM(1.234 5.678 99) - XYM with M compound ignored
test_geometry_equals<point_type, true>(
"01010000405839B4C876BEF33F83C0CAA145B616400000000000C05840", "POINT (1.234 5.678)");
{
typedef bg::model::point<double, 2, bg::cs::cartesian> point_type;
typedef bg::model::point<double, 3, bg::cs::cartesian> point3d_type;
// SRID=32632;POINTM(1.234 5.678 99)
test_geometry_equals<point_type, false>(
"0101000060787F00005839B4C876BEF33F83C0CAA145B616400000000000C05840", "POINT (1.234 5.678)");
typedef bg::model::linestring<point_type> linestring_type;
//typedef bg::model::linestring<point3d_type> linestring3d_type;
// POINT(1.234 5.678 15 79) - XYZM - Z and M compounds ignored
test_geometry_equals<point_type, true>(
"01010000C05839B4C876BEF33F83C0CAA145B616400000000000002E400000000000C05340",
"POINT (1.234 5.678)");
typedef bg::model::polygon<point_type> polygon_type;
//typedef bg::model::polygon<point3d_type> polygon3d_type;
// SRID=4326;POINT(1.234 5.678 15 79) - XYZM + SRID
test_geometry_equals<point_type, false>(
"01010000E0E61000005839B4C876BEF33F83C0CAA145B616400000000000002E400000000000C05340",
"POINT (1.234 5.678)");
//
// POINT
//
{
point_type point(1.0, 2.0);
test_geometry_equals<point_type, true>
(
point,
"0101000000000000000000F03F0000000000000040"
);
}
{
point3d_type point(1.0, 2.0, 3.0);
test_geometry_equals<point3d_type, true>
(
point,
"01E9030000000000000000F03F00000000000000400000000000000840"
);
}
//
// LINESTRING
//
{
linestring_type linestring;
bg::append(linestring,
boost::assign::list_of
(point_type(1.0, 2.0))
(point_type(2.0, 3.0))
(point_type(4.0, 5.0))
);
test_geometry_equals<linestring_type, true>
(
linestring,
"010200000003000000000000000000F03F00000000000000400000000000000040000000000000084000000000000010400000000000001440"
);
}
// {
// linestring3d_type linestring;
//
// bg::append(linestring,
// boost::assign::list_of
// (point3d_type(1.0, 2.0, 3.0))
// (point3d_type(2.0, 3.0, 4.0))
// (point3d_type(4.0, 5.0, 6.0))
// );
//
// test_geometry_equals<linestring3d_type, true>
// (
// linestring,
// "01EA03000003000000000000000000F03F00000000000000400000000000000840000000000000004000000000000008400000000000001040000000000000104000000000000014400000000000001840"
// );
// }
//
// POLYGON
//
{
polygon_type polygon;
bg::append(polygon,
boost::assign::list_of
(point_type(50.0, 50.0))
(point_type(50.0, 100.0))
(point_type(100.0, 100.0))
(point_type(100.0, 50.0))
(point_type(50.0, 50.0))
);
test_geometry_equals<polygon_type, true>
(
polygon,
"010300000001000000050000000000000000004940000000000000494000000000000049400000000000005940000000000000594000000000000059400000000000005940000000000000494000000000000049400000000000004940"
);
}
// {
// polygon3d_type polygon;
//
// bg::append(polygon, boost::assign::list_of(point3d_type(50.0, 50.0, 5.0))(point3d_type(50.0, 100.0, 10.0))(point3d_type(100.0, 100.0, 5.0))(point3d_type(100.0, 50.0, 10.0))(point3d_type(50.0, 50.0, 5.0)));
//
// test_geometry_equals<polygon3d_type, true>
// (
// polygon,
// "01EB0300000100000005000000000000000000494000000000000049400000000000001440000000000000494000000000000059400000000000002440000000000000594000000000000059400000000000001440000000000000594000000000000049400000000000002440000000000000494000000000000049400000000000001440"
// );
// }
{
polygon_type polygon;
bg::append(polygon,
boost::assign::list_of
(point_type(35, 10))
(point_type(45, 45))
(point_type(15, 40))
(point_type(10, 20))
(point_type(35, 10))
);
// Create an interior ring (append does not do this automatically)
boost::geometry::interior_rings(polygon).resize(1);
bg::append(polygon,
boost::assign::list_of
(point_type(20, 30))
(point_type(35, 35))
(point_type(30, 20))
(point_type(20, 30))
, 0);
test_geometry_equals<polygon_type, true>
(
polygon,
"0103000000020000000500000000000000008041400000000000002440000000000080464000000000008046400000000000002E40000000000000444000000000000024400000000000003440000000000080414000000000000024400400000000000000000034400000000000003E40000000000080414000000000008041400000000000003E40000000000000344000000000000034400000000000003E40"
);
}
}
return 0;
}

View File

@@ -0,0 +1,195 @@
// Boost.Geometry (aka GGL, Generic Geometry Library)
// Unit Test
// Copyright (c) 2009-2012 Mateusz Loskot, London, UK.
// 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 <iterator>
#include <string>
#include <vector>
#include <iostream>
#include <boost/test/included/test_exec_monitor.hpp>
#include <boost/test/included/unit_test.hpp>
#include <boost/test/floating_point_comparison.hpp>
#include <boost/cstdint.hpp>
#include <boost/geometry/strategies/strategies.hpp>
#include <boost/geometry/algorithms/equals.hpp>
#include <boost/geometry/geometries/geometries.hpp>
#include <boost/geometry/io/wkt/read.hpp>
#include <boost/geometry/extensions/gis/io/wkb/write_wkb.hpp>
#include <boost/geometry/extensions/gis/io/wkb/utility.hpp>
#include <boost/geometry/io/wkt/wkt.hpp>
#include <boost/range/algorithm_ext/push_back.hpp>
#include <boost/assign/list_of.hpp>
namespace bg = boost::geometry;
namespace { // anonymous
template <typename Geometry, bool IsEqual>
void test_geometry_equals(Geometry const& geometry, std::string const& wkbhex)
{
std::string wkb_out;
bg::write_wkb(geometry, std::back_inserter(wkb_out));
std::string hex_out;
BOOST_CHECK( bg::wkb2hex(wkb_out.begin(), wkb_out.end(), hex_out) );
BOOST_CHECK_EQUAL( wkbhex, hex_out);
}
} // namespace anonymous
int test_main(int, char* [])
{
typedef bg::model::point<double, 2, bg::cs::cartesian> point_type;
typedef bg::model::point<double, 3, bg::cs::cartesian> point3d_type;
typedef bg::model::linestring<point_type> linestring_type;
typedef bg::model::linestring<point3d_type> linestring3d_type;
typedef bg::model::polygon<point_type> polygon_type;
typedef bg::model::polygon<point3d_type> polygon3d_type;
//
// POINT
//
{
point_type point(1.0, 2.0);
test_geometry_equals<point_type, true>
(
point,
"0101000000000000000000F03F0000000000000040"
);
}
{
point3d_type point(1.0, 2.0, 3.0);
test_geometry_equals<point3d_type, true>
(
point,
"01E9030000000000000000F03F00000000000000400000000000000840"
);
}
//
// LINESTRING
//
{
linestring_type linestring;
bg::append(linestring,
boost::assign::list_of
(point_type(1.0, 2.0))
(point_type(2.0, 3.0))
(point_type(4.0, 5.0))
);
test_geometry_equals<linestring_type, true>
(
linestring,
"010200000003000000000000000000F03F00000000000000400000000000000040000000000000084000000000000010400000000000001440"
);
}
{
linestring3d_type linestring;
bg::append(linestring,
boost::assign::list_of
(point3d_type(1.0, 2.0, 3.0))
(point3d_type(2.0, 3.0, 4.0))
(point3d_type(4.0, 5.0, 6.0))
);
test_geometry_equals<linestring3d_type, true>
(
linestring,
"01EA03000003000000000000000000F03F00000000000000400000000000000840000000000000004000000000000008400000000000001040000000000000104000000000000014400000000000001840"
);
}
//
// POLYGON
//
{
polygon_type polygon;
bg::append(polygon,
boost::assign::list_of
(point_type(50.0, 50.0))
(point_type(50.0, 100.0))
(point_type(100.0, 100.0))
(point_type(100.0, 50.0))
(point_type(50.0, 50.0))
);
test_geometry_equals<polygon_type, true>
(
polygon,
"010300000001000000050000000000000000004940000000000000494000000000000049400000000000005940000000000000594000000000000059400000000000005940000000000000494000000000000049400000000000004940"
);
}
{
polygon3d_type polygon;
bg::append(polygon,
boost::assign::list_of
(point3d_type(50.0, 50.0, 5.0))
(point3d_type(50.0, 100.0, 10.0))
(point3d_type(100.0, 100.0, 5.0))
(point3d_type(100.0, 50.0, 10.0))
(point3d_type(50.0, 50.0, 5.0))
);
test_geometry_equals<polygon3d_type, true>
(
polygon,
"01EB0300000100000005000000000000000000494000000000000049400000000000001440000000000000494000000000000059400000000000002440000000000000594000000000000059400000000000001440000000000000594000000000000049400000000000002440000000000000494000000000000049400000000000001440"
);
}
{
polygon_type polygon;
bg::append(polygon,
boost::assign::list_of
(point_type(35, 10))
(point_type(45, 45))
(point_type(15, 40))
(point_type(10, 20))
(point_type(35, 10))
);
// Create an interior ring (append does not do this automatically)
boost::geometry::interior_rings(polygon).resize(1);
bg::append(polygon,
boost::assign::list_of
(point_type(20, 30))
(point_type(35, 35))
(point_type(30, 20))
(point_type(20, 30))
, 0);
test_geometry_equals<polygon_type, true>
(
polygon,
"0103000000020000000500000000000000008041400000000000002440000000000080464000000000008046400000000000002E40000000000000444000000000000024400000000000003440000000000080414000000000000024400400000000000000000034400000000000003E40000000000080414000000000008041400000000000003E40000000000000344000000000000034400000000000003E40"
);
}
return 0;
}

View File

@@ -12,5 +12,7 @@ test-suite boost-geometry-extensions-gis-projections
:
[ run projection.cpp ]
[ run projections.cpp ]
[ run projections_combined.cpp ]
[ run projections_static.cpp ]
[ run projection_epsg.cpp ]
;

View File

@@ -42,16 +42,8 @@
inline void check(double v, double ve, std::string const& name, std::string const& axis)
{
//BOOST_CHECK_CLOSE(v, ve, 0.001);
// Instead of (non-existing) BOOST_CHECK_CLOSE_MESSAGE(v, ve, 0.001, bla bla)
if (! boost::test_tools::check_is_close(v, ve, boost::test_tools::fpc::percent_tolerance(0.001)))
{
std::ostringstream out;
out << "\n" << name << " " << axis << " -> " << v << " != " << ve;
BOOST_ERROR(out.str());
}
// (non-existing) BOOST_CHECK_CLOSE_MESSAGE(v, ve, 0.001, "\n" << name << " " << axis << " -> " << v << " != " << ve);
BOOST_CHECK_CLOSE(v, ve, 0.001);
}
template <typename P>
@@ -140,6 +132,7 @@ void test_all()
test_forward<P>("eck6", 4.897000, 52.371000, 342737.885307, 6363364.830847, "+proj=eck6 +ellps=WGS84 +units=m");
test_forward<P>("eqc", 4.897000, 52.371000, 545131.546415, 5829913.052335, "+proj=eqc +ellps=WGS84 +units=m");
test_forward<P>("eqdc", 4.897000, 52.371000, 307874.536263, 5810915.646438, "+proj=eqdc +ellps=WGS84 +units=m +lat_1=60 +lat_2=0");
test_forward<P>("etmerc", 4.897000, 52.371000, 333425.492123, 5815921.814393, "+proj=etmerc +ellps=WGS84 +units=m");
test_forward<P>("euler", 4.897000, 52.371000, 338753.024859, 5836825.984893, "+proj=euler +ellps=WGS84 +units=m +lat_1=60 +lat_2=0");
test_forward<P>("fahey", 4.897000, 52.371000, 388824.354103, 5705638.873094, "+proj=fahey +ellps=WGS84 +units=m");
test_forward<P>("fouc", 4.897000, 52.371000, 268017.369817, 6272855.564674, "+proj=fouc +ellps=WGS84 +units=m");
@@ -157,6 +150,7 @@ void test_all()
test_forward<P>("hammer", 4.897000, 52.371000, 370843.923425, 5630047.232233, "+proj=hammer +ellps=WGS84 +units=m");
test_forward<P>("hatano", 4.897000, 52.371000, 383644.128560, 6290117.704632, "+proj=hatano +ellps=WGS84 +units=m");
test_forward<P>("imw_p", 4.897000, 52.371000, 318784.808056, 3594184.939568, "+proj=imw_p +ellps=WGS84 +units=m +lat_1=20n +lat_2=60n +lon_1=5");
test_forward<P>("isea", 4.897000, 52.371000, -413613.639976, 9218173.701546, "+proj=isea +ellps=WGS84 +units=m");
test_forward<P>("kav5", 4.897000, 52.371000, 383646.088858, 5997047.888175, "+proj=kav5 +ellps=WGS84 +units=m");
test_forward<P>("kav7", 4.897000, 52.371000, 407769.043907, 5829913.052335, "+proj=kav7 +ellps=WGS84 +units=m");
test_forward<P>("krovak", 14.416667, 50.083333, -743286.779768, -1043498.912060, "+proj=krovak +ellps=WGS84 +units=m");
@@ -199,6 +193,7 @@ void test_all()
test_forward<P>("ortel", 4.897000, 52.371000, 360906.947408, 5829913.052335, "+proj=ortel +ellps=WGS84 +units=m");
test_forward<P>("ortho", 4.897000, 52.371000, 332422.874291, 5051361.531375, "+proj=ortho +ellps=WGS84 +units=m");
test_forward<P>("pconic", -70.400000, -23.650000, -2240096.398139, -6940342.146955, "+proj=pconic +ellps=WGS84 +units=m +lat_1=20n +lat_2=60n +lon_0=60W");
test_forward<P>("qsc", 4.897000, 52.371000, 543871.545186, 7341888.620371, "+proj=qsc +ellps=WGS84 +units=m");
test_forward<P>("poly", 4.897000, 52.371000, 333274.269648, 5815908.957562, "+proj=poly +ellps=WGS84 +units=m");
test_forward<P>("putp1", 4.897000, 52.371000, 375730.931178, 5523551.121434, "+proj=putp1 +ellps=WGS84 +units=m");
test_forward<P>("putp2", 4.897000, 52.371000, 351480.997939, 5942668.547355, "+proj=putp2 +ellps=WGS84 +units=m");
@@ -210,7 +205,7 @@ void test_all()
test_forward<P>("putp6", 4.897000, 52.371000, 324931.055842, 5842588.644796, "+proj=putp6 +ellps=WGS84 +units=m");
test_forward<P>("putp6p", 4.897000, 52.371000, 338623.512107, 6396742.919679, "+proj=putp6p +ellps=WGS84 +units=m");
test_forward<P>("qua_aut", 4.897000, 52.371000, 370892.621714, 5629072.862494, "+proj=qua_aut +ellps=WGS84 +units=m");
test_forward<P>("robin", 4.897000, 52.371000, 394576.507489, 5571243.439235, "+proj=robin +ellps=WGS84 +units=m");
test_forward<P>("robin", 4.897000, 52.371000, 394576.507489, 5570940.631371, "+proj=robin +ellps=WGS84 +units=m");
test_forward<P>("rouss", 4.897000, 52.371000, 412826.227669, 6248368.849775, "+proj=rouss +ellps=WGS84 +units=m");
test_forward<P>("rpoly", 4.897000, 52.371000, 332447.130797, 5841164.662431, "+proj=rpoly +ellps=WGS84 +units=m");
test_forward<P>("sinu", 4.897000, 52.371000, 333528.909809, 5804625.044313, "+proj=sinu +ellps=WGS84 +units=m");
@@ -246,6 +241,7 @@ void test_all()
test_inverse<P>("aea", 334609.583974, 5218502.503686, 4.897000, 52.371000, "+proj=aea +ellps=WGS84 +units=m +lat_1=55 +lat_2=65");
test_inverse<P>("aeqd", 384923.723428, 5809986.497118, 4.898398, 52.378890, "+proj=aeqd +ellps=WGS84 +units=m"); // F/I: 883.080918
test_inverse<P>("aitoff", 384096.182830, 5831239.274680, 4.897000, 52.371000, "+proj=aitoff +ellps=WGS84 +units=m");
test_inverse<P>("alsk", 7002185.416415, -3700467.546545, -84.389819, 33.754911, "+proj=alsk +ellps=WGS84 +units=m +lon_0=-150W"); // F/I: 19.398478
test_inverse<P>("bipc", 3693973.674143, -8459972.647559, 4.897000, 52.371000, "+proj=bipc +ellps=WGS84 +units=m");
test_inverse<P>("bonne", 333291.091896, 274683.016972, 4.897000, 52.371000, "+proj=bonne +ellps=WGS84 +units=m +lat_1=50");
@@ -262,6 +258,7 @@ void test_all()
test_inverse<P>("eck6", 342737.885307, 6363364.830847, 4.897000, 52.371000, "+proj=eck6 +ellps=WGS84 +units=m");
test_inverse<P>("eqc", 545131.546415, 5829913.052335, 4.897000, 52.371000, "+proj=eqc +ellps=WGS84 +units=m");
test_inverse<P>("eqdc", 307874.536263, 5810915.646438, 4.897000, 52.371000, "+proj=eqdc +ellps=WGS84 +units=m +lat_1=60 +lat_2=0");
test_inverse<P>("etmerc", 333425.492123, 5815921.814393, 4.897000, 52.371000, "+proj=etmerc +ellps=WGS84 +units=m");
test_inverse<P>("euler", 338753.024859, 5836825.984893, 4.897000, 52.371000, "+proj=euler +ellps=WGS84 +units=m +lat_1=60 +lat_2=0");
test_inverse<P>("fahey", 388824.354103, 5705638.873094, 4.897000, 52.371000, "+proj=fahey +ellps=WGS84 +units=m");
test_inverse<P>("fouc", 268017.369817, 6272855.564674, 4.897000, 52.371000, "+proj=fouc +ellps=WGS84 +units=m");
@@ -314,6 +311,7 @@ void test_all()
test_inverse<P>("omerc", 1009705.329154, 5829437.254923, 4.897000, 52.371000, "+proj=omerc +ellps=WGS84 +units=m +lat_1=20n +lat_2=60n +lon_1=1e +lon_2=30e");
test_inverse<P>("ortho", 332422.874291, 5051361.531375, 4.897000, 52.371000, "+proj=ortho +ellps=WGS84 +units=m");
test_inverse<P>("pconic", -2240096.398139, -6940342.146955, -70.400000, -23.650000, "+proj=pconic +ellps=WGS84 +units=m +lat_1=20n +lat_2=60n +lon_0=60W"); // F/I: 4424863.377843
test_inverse<P>("qsc", 543871.545186, 7341888.620371, 4.897000, 52.371000, "+proj=qsc +ellps=WGS84 +units=m");
test_inverse<P>("poly", 333274.269648, 5815908.957562, 4.897000, 52.371000, "+proj=poly +ellps=WGS84 +units=m");
test_inverse<P>("putp1", 375730.931178, 5523551.121434, 4.897000, 52.371000, "+proj=putp1 +ellps=WGS84 +units=m");
test_inverse<P>("putp2", 351480.997939, 5942668.547355, 4.897000, 52.371000, "+proj=putp2 +ellps=WGS84 +units=m");
@@ -325,7 +323,7 @@ void test_all()
test_inverse<P>("putp6", 324931.055842, 5842588.644796, 4.897000, 52.371000, "+proj=putp6 +ellps=WGS84 +units=m");
test_inverse<P>("putp6p", 338623.512107, 6396742.919679, 4.897000, 52.371000, "+proj=putp6p +ellps=WGS84 +units=m");
test_inverse<P>("qua_aut", 370892.621714, 5629072.862494, 4.897000, 52.371000, "+proj=qua_aut +ellps=WGS84 +units=m");
test_inverse<P>("robin", 394576.507489, 5571243.439235, 4.897000, 52.371000, "+proj=robin +ellps=WGS84 +units=m");
test_inverse<P>("robin", 394576.507489, 5570940.631371, 4.897000, 52.371000, "+proj=robin +ellps=WGS84 +units=m");
test_inverse<P>("rouss", 412826.227669, 6248368.849775, 4.959853, 52.433747, "+proj=rouss +ellps=WGS84 +units=m"); // F/I: 8188.459174
test_inverse<P>("sinu", 333528.909809, 5804625.044313, 4.897000, 52.371000, "+proj=sinu +ellps=WGS84 +units=m");
test_inverse<P>("somerc", 545131.546415, 6833623.829215, 4.897000, 52.371000, "+proj=somerc +ellps=WGS84 +units=m");

View File

@@ -0,0 +1,134 @@
// Boost.Geometry (aka GGL, Generic Geometry Library)
// Unit Test
// Copyright (c) 2015 Barend Gehrels, Amsterdam, the Netherlands.
// 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)
#if defined(_MSC_VER)
#pragma warning( disable : 4305 ) // truncation double -> float
#endif // defined(_MSC_VER)
#include <geometry_test_common.hpp>
#include <boost/geometry/extensions/gis/projections/parameters.hpp>
#include <boost/geometry/extensions/gis/projections/projection.hpp>
#include <boost/geometry/extensions/gis/projections/factory.hpp>
#include <boost/geometry/extensions/gis/projections/proj/igh.hpp>
#include <boost/geometry/extensions/gis/projections/proj/ob_tran.hpp>
#include <boost/geometry/core/coordinate_type.hpp>
#include <boost/geometry/algorithms/make.hpp>
#include <boost/geometry.hpp>
#include <boost/geometry/geometries/geometries.hpp>
#include <boost/geometry/geometries/point_xy.hpp>
#include <boost/geometry/extensions/gis/latlong/point_ll.hpp>
template <template <typename, typename, typename> class Projection, typename GeoPoint>
void test_forward(GeoPoint const& geo_point1, GeoPoint const& geo_point2,
std::string const& parameters, int deviation = 1)
{
typedef typename bg::coordinate_type<GeoPoint>::type coordinate_type;
typedef bg::model::d2::point_xy<coordinate_type> cartesian_point_type;
typedef Projection<GeoPoint, cartesian_point_type, bg::projections::parameters> projection_type;
// TEMPORARY (will replaced by the internal name of the projection - this is ugly and does not work for Windows or many other compilers)
std::string name = typeid(projection_type).name();
boost::replace_all(name, "N5boost8geometry11projections", "");
boost::replace_all(name, "INS0_5model2ll5pointINS0_6degreeEdNS0_2cs10geographicELm2EEENS3_2d28point_xyIdNS7_9cartesianEEENS1_10parametersEEE", "");
boost::replace_all(name, "11", "");
boost::replace_all(name, "12", "");
boost::replace_all(name, "13", "");
boost::replace_all(name, "14", "");
boost::replace_all(name, "15", "");
boost::replace_all(name, "16", "");
boost::replace_all(name, "17", "");
boost::replace_all(name, "18", "");
try
{
bg::projections::parameters par = bg::projections::detail::pj_init_plus(parameters);
projection_type prj(par);
cartesian_point_type xy1, xy2;
prj.forward(geo_point1, xy1);
prj.forward(geo_point2, xy2);
// Calculate distances in KM
int const distance_expected = static_cast<int>(bg::distance(geo_point1, geo_point2) / 1000.0);
int const distance_found = static_cast<int>(bg::distance(xy1, xy2) / 1000.0);
int const difference = std::abs(distance_expected - distance_found);
BOOST_CHECK_MESSAGE(difference <= 1 || difference == deviation,
" projection: " << name
<< " distance found: " << distance_found
<< " expected: " << distance_expected);
// For debug:
// std::cout << name << " " << distance_expected
// << " " << distance_found
// << " " << (difference > 1 && difference != deviation ? " *** WRONG ***" : "")
// << " " << difference
// << std::endl;
}
catch(bg::projections::proj_exception const& e)
{
std::cout << "Exception in " << name << " : " << e.code() << std::endl;
}
catch(...)
{
std::cout << "Exception (unknown) in " << name << std::endl;
}
}
template <typename T>
void test_all()
{
typedef bg::model::ll::point<bg::degree, T> geo_point_type;
geo_point_type amsterdam = bg::make<geo_point_type>(4.8925, 52.3731);
geo_point_type utrecht = bg::make<geo_point_type>(5.1213, 52.0907);
geo_point_type anchorage = bg::make<geo_point_type>(-149.90, 61.22);
geo_point_type juneau = bg::make<geo_point_type>(-134.42, 58.30);
geo_point_type auckland = bg::make<geo_point_type>(174.74, -36.84);
geo_point_type wellington = bg::make<geo_point_type>(177.78, -41.29);
geo_point_type aspen = bg::make<geo_point_type>(-106.84, 39.19);
geo_point_type denver = bg::make<geo_point_type>(-104.88, 39.76);
// IGH (internally using moll/sinu)
test_forward<bg::projections::igh_spheroid>(amsterdam, utrecht, "+ellps=sphere +units=m", 5);
test_forward<bg::projections::igh_spheroid>(aspen, denver, "+ellps=sphere +units=m", 3);
test_forward<bg::projections::igh_spheroid>(auckland, wellington, "+ellps=sphere +units=m", 152);
test_forward<bg::projections::igh_spheroid>(anchorage, juneau, "+ellps=sphere +units=m", 28);
// Using moll
test_forward<bg::projections::ob_tran_oblique>(amsterdam, utrecht, "+ellps=WGS84 +units=m +o_proj=moll +o_lat_p=10 +o_lon_p=90 +o_lon_o=11.50", 4);
test_forward<bg::projections::ob_tran_transverse>(amsterdam, utrecht, "+ellps=WGS84 +units=m +o_proj=moll +o_lat_p=10 +o_lon_p=90 +o_lon_o=11.50", 5);
test_forward<bg::projections::ob_tran_oblique>(aspen, denver, "+ellps=WGS84 +units=m +o_proj=moll +o_lat_p=10 +o_lon_p=90 +o_lon_o=11.50", 19);
test_forward<bg::projections::ob_tran_transverse>(aspen, denver, "+ellps=WGS84 +units=m +o_proj=moll +o_lat_p=10 +o_lon_p=90 +o_lon_o=11.50", 19);
// Using sinu
test_forward<bg::projections::ob_tran_oblique>(amsterdam, utrecht, "+ellps=WGS84 +units=m +o_proj=sinu +o_lat_p=10 +o_lon_p=90 +o_lon_o=11.50", 5);
test_forward<bg::projections::ob_tran_transverse>(amsterdam, utrecht, "+ellps=WGS84 +units=m +o_proj=sinu +o_lat_p=10 +o_lon_p=90 +o_lon_o=11.50", 4);
test_forward<bg::projections::ob_tran_oblique>(aspen, denver, "+ellps=WGS84 +units=m +o_proj=sinu +o_lat_p=10 +o_lon_p=90 +o_lon_o=11.50", 14);
test_forward<bg::projections::ob_tran_transverse>(aspen, denver, "+ellps=WGS84 +units=m +o_proj=sinu +o_lat_p=10 +o_lon_p=90 +o_lon_o=11.50", 6);
}
int test_main(int, char* [])
{
test_all<double>();
return 0;
}

View File

@@ -0,0 +1,388 @@
// Boost.Geometry (aka GGL, Generic Geometry Library)
// Unit Test
// Copyright (c) 2015 Barend Gehrels, Amsterdam, the Netherlands.
// 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)
#if defined(_MSC_VER)
#pragma warning( disable : 4305 ) // truncation double -> float
#endif // defined(_MSC_VER)
#include <geometry_test_common.hpp>
#include <boost/geometry/extensions/gis/projections/parameters.hpp>
#include <boost/geometry/extensions/gis/projections/projection.hpp>
#include <boost/geometry/extensions/gis/projections/proj/aea.hpp>
#include <boost/geometry/extensions/gis/projections/proj/aeqd.hpp>
#include <boost/geometry/extensions/gis/projections/proj/airy.hpp>
#include <boost/geometry/extensions/gis/projections/proj/aitoff.hpp>
#include <boost/geometry/extensions/gis/projections/proj/august.hpp>
#include <boost/geometry/extensions/gis/projections/proj/bacon.hpp>
#include <boost/geometry/extensions/gis/projections/proj/bipc.hpp>
#include <boost/geometry/extensions/gis/projections/proj/boggs.hpp>
#include <boost/geometry/extensions/gis/projections/proj/bonne.hpp>
#include <boost/geometry/extensions/gis/projections/proj/cass.hpp>
#include <boost/geometry/extensions/gis/projections/proj/cc.hpp>
#include <boost/geometry/extensions/gis/projections/proj/cea.hpp>
#include <boost/geometry/extensions/gis/projections/proj/chamb.hpp>
#include <boost/geometry/extensions/gis/projections/proj/collg.hpp>
#include <boost/geometry/extensions/gis/projections/proj/crast.hpp>
#include <boost/geometry/extensions/gis/projections/proj/denoy.hpp>
#include <boost/geometry/extensions/gis/projections/proj/eck1.hpp>
#include <boost/geometry/extensions/gis/projections/proj/eck2.hpp>
#include <boost/geometry/extensions/gis/projections/proj/eck3.hpp>
#include <boost/geometry/extensions/gis/projections/proj/eck4.hpp>
#include <boost/geometry/extensions/gis/projections/proj/eck5.hpp>
#include <boost/geometry/extensions/gis/projections/proj/eqc.hpp>
#include <boost/geometry/extensions/gis/projections/proj/eqdc.hpp>
#include <boost/geometry/extensions/gis/projections/proj/etmerc.hpp>
#include <boost/geometry/extensions/gis/projections/proj/fahey.hpp>
#include <boost/geometry/extensions/gis/projections/proj/fouc_s.hpp>
#include <boost/geometry/extensions/gis/projections/proj/gall.hpp>
#include <boost/geometry/extensions/gis/projections/proj/geocent.hpp>
#include <boost/geometry/extensions/gis/projections/proj/geos.hpp>
#include <boost/geometry/extensions/gis/projections/proj/gins8.hpp>
#include <boost/geometry/extensions/gis/projections/proj/gn_sinu.hpp>
#include <boost/geometry/extensions/gis/projections/proj/gnom.hpp>
#include <boost/geometry/extensions/gis/projections/proj/goode.hpp>
#include <boost/geometry/extensions/gis/projections/proj/gstmerc.hpp>
#include <boost/geometry/extensions/gis/projections/proj/hammer.hpp>
#include <boost/geometry/extensions/gis/projections/proj/hatano.hpp>
#include <boost/geometry/extensions/gis/projections/proj/krovak.hpp>
//#include <boost/geometry/extensions/gis/projections/proj/igh.hpp> -> in combined
#include <boost/geometry/extensions/gis/projections/proj/imw_p.hpp>
#include <boost/geometry/extensions/gis/projections/proj/isea.hpp>
#include <boost/geometry/extensions/gis/projections/proj/laea.hpp>
#include <boost/geometry/extensions/gis/projections/proj/labrd.hpp>
#include <boost/geometry/extensions/gis/projections/proj/lagrng.hpp>
#include <boost/geometry/extensions/gis/projections/proj/larr.hpp>
#include <boost/geometry/extensions/gis/projections/proj/lask.hpp>
#include <boost/geometry/extensions/gis/projections/proj/latlong.hpp>
#include <boost/geometry/extensions/gis/projections/proj/lcc.hpp>
#include <boost/geometry/extensions/gis/projections/proj/lcca.hpp>
#include <boost/geometry/extensions/gis/projections/proj/loxim.hpp>
#include <boost/geometry/extensions/gis/projections/proj/lsat.hpp>
#include <boost/geometry/extensions/gis/projections/proj/mbtfpp.hpp>
#include <boost/geometry/extensions/gis/projections/proj/mbtfpq.hpp>
#include <boost/geometry/extensions/gis/projections/proj/mbt_fps.hpp>
#include <boost/geometry/extensions/gis/projections/proj/merc.hpp>
#include <boost/geometry/extensions/gis/projections/proj/mill.hpp>
#include <boost/geometry/extensions/gis/projections/proj/mod_ster.hpp>
#include <boost/geometry/extensions/gis/projections/proj/moll.hpp>
#include <boost/geometry/extensions/gis/projections/proj/natearth.hpp>
#include <boost/geometry/extensions/gis/projections/proj/nell.hpp>
#include <boost/geometry/extensions/gis/projections/proj/nell_h.hpp>
#include <boost/geometry/extensions/gis/projections/proj/nocol.hpp>
#include <boost/geometry/extensions/gis/projections/proj/nsper.hpp>
#include <boost/geometry/extensions/gis/projections/proj/nzmg.hpp>
//#include <boost/geometry/extensions/gis/projections/proj/ob_tran.hpp> -> in combined
#include <boost/geometry/extensions/gis/projections/proj/ocea.hpp>
#include <boost/geometry/extensions/gis/projections/proj/oea.hpp>
#include <boost/geometry/extensions/gis/projections/proj/omerc.hpp>
#include <boost/geometry/extensions/gis/projections/proj/ortho.hpp>
#include <boost/geometry/extensions/gis/projections/proj/qsc.hpp>
#include <boost/geometry/extensions/gis/projections/proj/poly.hpp>
#include <boost/geometry/extensions/gis/projections/proj/putp2.hpp>
#include <boost/geometry/extensions/gis/projections/proj/putp3.hpp>
#include <boost/geometry/extensions/gis/projections/proj/putp4p.hpp>
#include <boost/geometry/extensions/gis/projections/proj/putp5.hpp>
#include <boost/geometry/extensions/gis/projections/proj/putp6.hpp>
#include <boost/geometry/extensions/gis/projections/proj/robin.hpp>
#include <boost/geometry/extensions/gis/projections/proj/rouss.hpp>
#include <boost/geometry/extensions/gis/projections/proj/rpoly.hpp>
#include <boost/geometry/extensions/gis/projections/proj/sconics.hpp>
#include <boost/geometry/extensions/gis/projections/proj/somerc.hpp>
#include <boost/geometry/extensions/gis/projections/proj/stere.hpp>
#include <boost/geometry/extensions/gis/projections/proj/sterea.hpp>
#include <boost/geometry/extensions/gis/projections/proj/sts.hpp>
#include <boost/geometry/extensions/gis/projections/proj/tcc.hpp>
#include <boost/geometry/extensions/gis/projections/proj/tcea.hpp>
#include <boost/geometry/extensions/gis/projections/proj/tmerc.hpp>
#include <boost/geometry/extensions/gis/projections/proj/tpeqd.hpp>
#include <boost/geometry/extensions/gis/projections/proj/urm5.hpp>
#include <boost/geometry/extensions/gis/projections/proj/urmfps.hpp>
#include <boost/geometry/extensions/gis/projections/proj/vandg.hpp>
#include <boost/geometry/extensions/gis/projections/proj/vandg2.hpp>
#include <boost/geometry/extensions/gis/projections/proj/vandg4.hpp>
#include <boost/geometry/extensions/gis/projections/proj/wag2.hpp>
#include <boost/geometry/extensions/gis/projections/proj/wag3.hpp>
#include <boost/geometry/extensions/gis/projections/proj/wag7.hpp>
#include <boost/geometry/extensions/gis/projections/proj/wink1.hpp>
#include <boost/geometry/extensions/gis/projections/proj/wink2.hpp>
#include <boost/geometry/core/coordinate_type.hpp>
#include <boost/geometry/algorithms/make.hpp>
#include <boost/geometry.hpp>
#include <boost/geometry/geometries/geometries.hpp>
#include <boost/geometry/geometries/point_xy.hpp>
#include <boost/geometry/extensions/gis/latlong/point_ll.hpp>
template <template <typename, typename, typename> class Projection, typename GeoPoint>
void test_forward(GeoPoint const& geo_point1, GeoPoint const& geo_point2,
std::string const& parameters, int deviation = 1)
{
typedef typename bg::coordinate_type<GeoPoint>::type coordinate_type;
typedef bg::model::d2::point_xy<coordinate_type> cartesian_point_type;
typedef Projection<GeoPoint, cartesian_point_type, bg::projections::parameters> projection_type;
// TEMPORARY (will replaced by the internal name of the projection - this is ugly and does not work for Windows or many other compilers)
std::string name = typeid(projection_type).name();
boost::replace_all(name, "N5boost8geometry11projections", "");
boost::replace_all(name, "INS0_5model2ll5pointINS0_6degreeEdNS0_2cs10geographicELm2EEENS3_2d28point_xyIdNS7_9cartesianEEENS1_10parametersEEE", "");
boost::replace_all(name, "11", "");
boost::replace_all(name, "12", "");
boost::replace_all(name, "13", "");
boost::replace_all(name, "14", "");
boost::replace_all(name, "15", "");
boost::replace_all(name, "16", "");
boost::replace_all(name, "17", "");
boost::replace_all(name, "18", "");
try
{
bg::projections::parameters par = bg::projections::detail::pj_init_plus(parameters);
projection_type prj(par);
cartesian_point_type xy1, xy2;
prj.forward(geo_point1, xy1);
prj.forward(geo_point2, xy2);
// Calculate distances in KM
int const distance_expected = static_cast<int>(bg::distance(geo_point1, geo_point2) / 1000.0);
int const distance_found = static_cast<int>(bg::distance(xy1, xy2) / 1000.0);
int const difference = std::abs(distance_expected - distance_found);
BOOST_CHECK_MESSAGE(difference <= 1 || difference == deviation,
" projection: " << name
<< " distance found: " << distance_found
<< " expected: " << distance_expected);
// For debug:
// std::cout << name << " " << distance_expected
// << " " << distance_found
// << " " << (difference > 1 && difference != deviation ? " *** WRONG ***" : "")
// << " " << difference
// << std::endl;
}
catch(bg::projections::proj_exception const& e)
{
std::cout << "Exception in " << name << " : " << e.code() << std::endl;
}
catch(...)
{
std::cout << "Exception (unknown) in " << name << std::endl;
}
}
template <typename T>
void test_all()
{
typedef bg::model::ll::point<bg::degree, T> geo_point_type;
geo_point_type amsterdam = bg::make<geo_point_type>(4.8925, 52.3731);
geo_point_type utrecht = bg::make<geo_point_type>(5.1213, 52.0907);
test_forward<bg::projections::aea_ellipsoid>(amsterdam, utrecht, "+ellps=WGS84 +units=m +lat_1=55 +lat_2=65");
test_forward<bg::projections::aeqd_ellipsoid>(amsterdam, utrecht, "+ellps=WGS84 +units=m");
test_forward<bg::projections::aeqd_spheroid>(amsterdam, utrecht, "+ellps=WGS84 +units=m");
test_forward<bg::projections::airy_spheroid>(amsterdam, utrecht, "+ellps=WGS84 +units=m", 4);
test_forward<bg::projections::aitoff_spheroid>(amsterdam, utrecht, "+ellps=WGS84 +units=m", 2);
test_forward<bg::projections::apian_spheroid>(amsterdam, utrecht, "+ellps=WGS84 +units=m +lon_0=11d32'00E");
test_forward<bg::projections::august_spheroid>(amsterdam, utrecht, "+ellps=WGS84 +units=m", 14);
test_forward<bg::projections::bacon_spheroid>(amsterdam, utrecht, "+ellps=WGS84 +units=m +lon_0=11d32'00E", 5);
test_forward<bg::projections::bipc_spheroid>(amsterdam, utrecht, "+ellps=WGS84 +units=m", 7);
test_forward<bg::projections::boggs_spheroid>(amsterdam, utrecht, "+ellps=WGS84 +units=m +lon_0=11d32'00E", 2);
test_forward<bg::projections::bonne_ellipsoid>(amsterdam, utrecht, "+ellps=WGS84 +units=m +lat_1=50");
test_forward<bg::projections::bonne_spheroid>(amsterdam, utrecht, "+ellps=WGS84 +units=m +lat_1=50", 33);
test_forward<bg::projections::cass_ellipsoid>(amsterdam, utrecht, "+ellps=WGS84 +units=m");
test_forward<bg::projections::cass_spheroid>(amsterdam, utrecht, "+ellps=WGS84 +units=m");
test_forward<bg::projections::cc_spheroid>(amsterdam, utrecht, "+ellps=WGS84 +units=m", 52);
test_forward<bg::projections::cea_ellipsoid>(amsterdam, utrecht, "+ellps=WGS84 +units=m +lon_0=11d32'00E", 4);
test_forward<bg::projections::cea_spheroid>(amsterdam, utrecht, "+ellps=WGS84 +units=m +lon_0=11d32'00E", 4);
test_forward<bg::projections::chamb_spheroid>(amsterdam, utrecht, "+ellps=WGS84 +units=m +lat_1=52 +lon_1=5 +lat_2=30 +lon_2=80 +lat_3=20 +lon_3=-50", 2);
test_forward<bg::projections::collg_spheroid>(amsterdam, utrecht, "+ellps=WGS84 +units=m", 5);
test_forward<bg::projections::crast_spheroid>(amsterdam, utrecht, "+ellps=WGS84 +units=m");
test_forward<bg::projections::denoy_spheroid>(amsterdam, utrecht, "+ellps=WGS84 +units=m", 2);
test_forward<bg::projections::eck1_spheroid>(amsterdam, utrecht, "+ellps=WGS84 +units=m", 2);
test_forward<bg::projections::eck2_spheroid>(amsterdam, utrecht, "+ellps=WGS84 +units=m");
test_forward<bg::projections::eck3_spheroid>(amsterdam, utrecht, "+ellps=WGS84 +units=m", 2);
test_forward<bg::projections::eck4_spheroid>(amsterdam, utrecht, "+ellps=WGS84 +units=m", 2);
test_forward<bg::projections::eck5_spheroid>(amsterdam, utrecht, "+ellps=WGS84 +units=m", 2);
test_forward<bg::projections::eck6_spheroid>(amsterdam, utrecht, "+ellps=WGS84 +units=m");
test_forward<bg::projections::eck6_ellipsoid>(amsterdam, utrecht, "+ellps=WGS84 +units=m", 18);
test_forward<bg::projections::eqc_spheroid>(amsterdam, utrecht, "+ellps=WGS84 +units=m", 5);
test_forward<bg::projections::eqdc_ellipsoid>(amsterdam, utrecht, "+ellps=WGS84 +units=m +lat_1=60 +lat_2=0");
test_forward<bg::projections::etmerc_ellipsoid>(amsterdam, utrecht, "+ellps=WGS84 +units=m");
test_forward<bg::projections::euler_spheroid>(amsterdam, utrecht, "+ellps=WGS84 +units=m +lat_1=60 +lat_2=0");
test_forward<bg::projections::fahey_spheroid>(amsterdam, utrecht, "+ellps=WGS84 +units=m", 5);
test_forward<bg::projections::fouc_spheroid>(amsterdam, utrecht, "+ellps=WGS84 +units=m", 6);
test_forward<bg::projections::fouc_s_spheroid>(amsterdam, utrecht, "+ellps=WGS84 +units=m", 4);
test_forward<bg::projections::gall_spheroid>(amsterdam, utrecht, "+ellps=WGS84 +units=m", 2);
test_forward<bg::projections::geocent_other>(amsterdam, utrecht, "+ellps=WGS84 +units=m", 5);
test_forward<bg::projections::geos_spheroid>(amsterdam, utrecht, "+ellps=WGS84 +units=m +h=40000000", 13);
test_forward<bg::projections::gins8_spheroid>(amsterdam, utrecht, "+ellps=WGS84 +units=m", 7);
test_forward<bg::projections::gn_sinu_spheroid>(amsterdam, utrecht, "+ellps=WGS84 +units=m +m=0.5 +n=1.785");
test_forward<bg::projections::gn_sinu_ellipsoid>(amsterdam, utrecht, "+ellps=WGS84 +units=m +m=0.5 +n=1.785", 18);
test_forward<bg::projections::gnom_spheroid>(amsterdam, utrecht, "+ellps=WGS84 +units=m", 50);
test_forward<bg::projections::goode_spheroid>(amsterdam, utrecht, "+ellps=WGS84 +units=m");
test_forward<bg::projections::gstmerc_spheroid>(amsterdam, utrecht, "+ellps=WGS84 +units=m");
test_forward<bg::projections::hammer_spheroid>(amsterdam, utrecht, "+ellps=WGS84 +units=m");
test_forward<bg::projections::hatano_spheroid>(amsterdam, utrecht, "+ellps=WGS84 +units=m", 2);
test_forward<bg::projections::imw_p_ellipsoid>(amsterdam, utrecht, "+ellps=WGS84 +units=m +lat_1=20n +lat_2=60n +lon_1=5");
test_forward<bg::projections::isea_spheroid>(amsterdam, utrecht, "+ellps=WGS84 +units=m", 2);
test_forward<bg::projections::kav5_spheroid>(amsterdam, utrecht, "+ellps=WGS84 +units=m", 2);
test_forward<bg::projections::kav7_spheroid>(amsterdam, utrecht, "+ellps=WGS84 +units=m", 2);
test_forward<bg::projections::krovak_ellipsoid>(amsterdam, utrecht, "+ellps=WGS84 +units=m");
test_forward<bg::projections::laea_spheroid>(amsterdam, utrecht, "+ellps=WGS84 +units=m", 2);
test_forward<bg::projections::lagrng_spheroid>(amsterdam, utrecht, "+ellps=WGS84 +units=m +W=1", 8);
test_forward<bg::projections::larr_spheroid>(amsterdam, utrecht, "+ellps=WGS84 +units=m", 13);
test_forward<bg::projections::lask_spheroid>(amsterdam, utrecht, "+ellps=WGS84 +units=m", 5);
test_forward<bg::projections::lcc_ellipsoid>(amsterdam, utrecht, "+ellps=WGS84 +units=m +lat_1=20n +lat_2=60n", 2);
test_forward<bg::projections::lcca_ellipsoid>(amsterdam, utrecht, "+ellps=WGS84 +units=m +lat_0=30n +lat_1=55n +lat_2=60n", 2);
test_forward<bg::projections::leac_ellipsoid>(amsterdam, utrecht, "+ellps=WGS84 +units=m", 8);
test_forward<bg::projections::loxim_spheroid>(amsterdam, utrecht, "+ellps=WGS84 +units=m", 3);
test_forward<bg::projections::lsat_ellipsoid>(amsterdam, utrecht, "+ellps=WGS84 +units=m +lsat=1 +path=1", 3);
test_forward<bg::projections::mbt_fps_spheroid>(amsterdam, utrecht, "+ellps=WGS84 +units=m", 2);
test_forward<bg::projections::mbt_s_spheroid>(amsterdam, utrecht, "+ellps=WGS84 +units=m", 2);
test_forward<bg::projections::mbtfpp_spheroid>(amsterdam, utrecht, "+ellps=WGS84 +units=m");
test_forward<bg::projections::mbtfpq_spheroid>(amsterdam, utrecht, "+ellps=WGS84 +units=m", 2);
test_forward<bg::projections::mbtfps_ellipsoid>(amsterdam, utrecht, "+ellps=WGS84 +units=m", 18);
test_forward<bg::projections::mbtfps_spheroid>(amsterdam, utrecht, "+ellps=WGS84 +units=m");
test_forward<bg::projections::merc_ellipsoid>(amsterdam, utrecht, "+ellps=WGS84 +units=m", 22);
test_forward<bg::projections::merc_spheroid>(amsterdam, utrecht, "+ellps=WGS84 +units=m", 22);
test_forward<bg::projections::mil_os_ellipsoid>(amsterdam, utrecht, "+ellps=WGS84 +units=m");
test_forward<bg::projections::mill_spheroid>(amsterdam, utrecht, "+ellps=WGS84 +units=m", 14);
test_forward<bg::projections::moll_spheroid>(amsterdam, utrecht, "+ellps=WGS84 +units=m");
test_forward<bg::projections::murd1_spheroid>(amsterdam, utrecht, "+ellps=WGS84 +units=m +lat_1=20n +lat_2=60n");
test_forward<bg::projections::murd2_spheroid>(amsterdam, utrecht, "+ellps=WGS84 +units=m +lat_1=20n +lat_2=60n");
test_forward<bg::projections::murd3_spheroid>(amsterdam, utrecht, "+ellps=WGS84 +units=m +lat_1=20n +lat_2=60n");
test_forward<bg::projections::natearth_spheroid>(amsterdam, utrecht, "+ellps=WGS84 +units=m");
test_forward<bg::projections::nell_spheroid>(amsterdam, utrecht, "+ellps=WGS84 +units=m", 4);
test_forward<bg::projections::nell_h_spheroid>(amsterdam, utrecht, "+ellps=WGS84 +units=m", 3);
test_forward<bg::projections::nicol_spheroid>(amsterdam, utrecht, "+ellps=WGS84 +units=m");
test_forward<bg::projections::oea_spheroid>(amsterdam, utrecht, "+ellps=WGS84 +units=m +lat_1=20n +lat_2=60n +lon_1=1e +lon_2=30e +m=1 +n=1", 4);
test_forward<bg::projections::omerc_ellipsoid>(amsterdam, utrecht, "+ellps=WGS84 +units=m +lat_1=20n +lat_2=60n +lon_1=1e +lon_2=30e");
test_forward<bg::projections::ortel_spheroid>(amsterdam, utrecht, "+ellps=WGS84 +units=m");
test_forward<bg::projections::ortho_spheroid>(amsterdam, utrecht, "+ellps=WGS84 +units=m", 9);
test_forward<bg::projections::pconic_spheroid>(amsterdam, utrecht, "+ellps=WGS84 +units=m +lat_1=20n +lat_2=60n +lon_0=10E");
test_forward<bg::projections::qsc_ellipsoid>(amsterdam, utrecht, "+ellps=WGS84 +units=m", 10);
test_forward<bg::projections::poly_spheroid>(amsterdam, utrecht, "+ellps=WGS84 +units=m");
test_forward<bg::projections::putp1_spheroid>(amsterdam, utrecht, "+ellps=WGS84 +units=m");
test_forward<bg::projections::putp2_spheroid>(amsterdam, utrecht, "+ellps=WGS84 +units=m");
test_forward<bg::projections::putp3_spheroid>(amsterdam, utrecht, "+ellps=WGS84 +units=m", 6);
test_forward<bg::projections::putp3p_spheroid>(amsterdam, utrecht, "+ellps=WGS84 +units=m", 5);
test_forward<bg::projections::putp4p_spheroid>(amsterdam, utrecht, "+ellps=WGS84 +units=m");
test_forward<bg::projections::putp5_spheroid>(amsterdam, utrecht, "+ellps=WGS84 +units=m");
test_forward<bg::projections::putp5p_spheroid>(amsterdam, utrecht, "+ellps=WGS84 +units=m", 3);
test_forward<bg::projections::putp6_spheroid>(amsterdam, utrecht, "+ellps=WGS84 +units=m");
test_forward<bg::projections::putp6p_spheroid>(amsterdam, utrecht, "+ellps=WGS84 +units=m");
test_forward<bg::projections::qua_aut_spheroid>(amsterdam, utrecht, "+ellps=WGS84 +units=m");
test_forward<bg::projections::robin_spheroid>(amsterdam, utrecht, "+ellps=WGS84 +units=m");
test_forward<bg::projections::rouss_ellipsoid>(amsterdam, utrecht, "+ellps=WGS84 +units=m", 8);
test_forward<bg::projections::rpoly_spheroid>(amsterdam, utrecht, "+ellps=WGS84 +units=m");
test_forward<bg::projections::sinu_ellipsoid>(amsterdam, utrecht, "+ellps=WGS84 +units=m");
test_forward<bg::projections::sinu_spheroid>(amsterdam, utrecht, "+ellps=sphere +units=m");
test_forward<bg::projections::somerc_ellipsoid>(amsterdam, utrecht, "+ellps=WGS84 +units=m", 22);
test_forward<bg::projections::stere_spheroid>(amsterdam, utrecht, "+ellps=WGS84 +units=m +lat_ts=50n", 8);
test_forward<bg::projections::sterea_ellipsoid>(amsterdam, utrecht, "+lat_0=52.15616055555555 +lon_0=5.38763888888889 +k=0.9999079 +x_0=155000 +y_0=463000 +ellps=bessel +units=m");
test_forward<bg::projections::tcc_spheroid>(amsterdam, utrecht, "+ellps=WGS84 +units=m");
test_forward<bg::projections::tcea_spheroid>(amsterdam, utrecht, "+ellps=WGS84 +units=m");
test_forward<bg::projections::tissot_spheroid>(amsterdam, utrecht, "+ellps=WGS84 +units=m +lat_1=20n +lat_2=60n", 2);
test_forward<bg::projections::tmerc_spheroid>(amsterdam, utrecht, "+ellps=sphere +units=m");
test_forward<bg::projections::tmerc_ellipsoid>(amsterdam, utrecht, "+ellps=WGS84 +units=m");
test_forward<bg::projections::tpeqd_spheroid>(amsterdam, utrecht, "+ellps=WGS84 +units=m +lat_1=20n +lat_2=60n +lon_1=0 +lon_2=30e");
test_forward<bg::projections::tpers_spheroid>(amsterdam, utrecht, "+ellps=WGS84 +units=m +tilt=50 +azi=20 +h=40000000", 14);
test_forward<bg::projections::ups_spheroid>(amsterdam, utrecht, "+ellps=WGS84 +units=m", 3);
test_forward<bg::projections::ups_ellipsoid>(amsterdam, utrecht, "+ellps=WGS84 +units=m", 3);
test_forward<bg::projections::urm5_spheroid>(amsterdam, utrecht, "+ellps=WGS84 +units=m +n=.3 +q=.3 +alpha=10", 4);
test_forward<bg::projections::urmfps_spheroid>(amsterdam, utrecht, "+ellps=WGS84 +units=m +n=0.50", 4);
test_forward<bg::projections::utm_spheroid>(amsterdam, utrecht, "+ellps=sphere +units=m +lon_0=11d32'00E");
test_forward<bg::projections::utm_ellipsoid>(amsterdam, utrecht, "+ellps=WGS84 +units=m +lon_0=11d32'00E");
test_forward<bg::projections::vandg_spheroid>(amsterdam, utrecht, "+ellps=WGS84 +units=m", 13);
test_forward<bg::projections::vandg2_spheroid>(amsterdam, utrecht, "+ellps=WGS84 +units=m", 13);
test_forward<bg::projections::vandg3_spheroid>(amsterdam, utrecht, "+ellps=WGS84 +units=m", 13);
test_forward<bg::projections::vandg4_spheroid>(amsterdam, utrecht, "+ellps=WGS84 +units=m");
test_forward<bg::projections::vitk1_spheroid>(amsterdam, utrecht, "+ellps=WGS84 +units=m +lat_1=20n +lat_2=60n");
test_forward<bg::projections::wag1_spheroid>(amsterdam, utrecht, "+ellps=WGS84 +units=m");
test_forward<bg::projections::wag2_spheroid>(amsterdam, utrecht, "+ellps=WGS84 +units=m");
test_forward<bg::projections::wag3_spheroid>(amsterdam, utrecht, "+ellps=WGS84 +units=m", 3);
test_forward<bg::projections::wag4_spheroid>(amsterdam, utrecht, "+ellps=WGS84 +units=m", 2);
test_forward<bg::projections::wag5_spheroid>(amsterdam, utrecht, "+ellps=WGS84 +units=m");
test_forward<bg::projections::wag6_spheroid>(amsterdam, utrecht, "+ellps=WGS84 +units=m");
test_forward<bg::projections::wag7_spheroid>(amsterdam, utrecht, "+ellps=WGS84 +units=m", 2);
test_forward<bg::projections::weren_spheroid>(amsterdam, utrecht, "+ellps=WGS84 +units=m", 4);
test_forward<bg::projections::wink1_spheroid>(amsterdam, utrecht, "+ellps=WGS84 +units=m", 3);
test_forward<bg::projections::wink2_spheroid>(amsterdam, utrecht, "+ellps=WGS84 +units=m", 4);
test_forward<bg::projections::wintri_spheroid>(amsterdam, utrecht, "+ellps=WGS84 +units=m");
// We SKIP ob_tran because it internally requires the factory and is, in that sense, not a static test
// test_forward<bg::projections::ob_tran_oblique>(amsterdam, utrecht, "+ellps=WGS84 +units=m +o_proj=moll +o_lat_p=10 +o_lon_p=90 +o_lon_o=11.50");
// test_forward<bg::projections::ob_tran_transverse>(amsterdam, utrecht, "+ellps=WGS84 +units=m +o_proj=moll +o_lat_p=10 +o_lon_p=90 +o_lon_o=11.50");
// TODO: wrong projections or parameters or input points
// test_forward<bg::projections::ocea_spheroid>(auckland, wellington, "+ellps=sphere +units=m +lat_1=20s +lat_2=60s +lon_1=165e +lon_2=175e"); => distance is very large
// test_forward<bg::projections::nsper_spheroid>(amsterdam, utrecht, "+ellps=WGS84 +units=m +a=10 +h=40000000"); => distance is 0
// test_forward<bg::projections::lee_os_ellipsoid>(amsterdam, utrecht, "+ellps=WGS84 +units=m"); => distance is 407
// Alaska
{
geo_point_type anchorage = bg::make<geo_point_type>(-149.90, 61.22);
geo_point_type juneau = bg::make<geo_point_type>(-134.42, 58.30);
test_forward<bg::projections::alsk_ellipsoid>(anchorage, juneau, "+ellps=WGS84 +units=m +lon_0=-150W", 1);
}
// New Zealand
{
geo_point_type auckland = bg::make<geo_point_type>(174.74, -36.84);
geo_point_type wellington = bg::make<geo_point_type>(177.78, -41.29);
test_forward<bg::projections::nzmg_ellipsoid>(auckland, wellington, "+ellps=WGS84 +units=m", 0);
}
// US
{
geo_point_type aspen = bg::make<geo_point_type>(-106.84, 39.19);
geo_point_type denver = bg::make<geo_point_type>(-104.88, 39.76);
// TODO: test_forward<bg::projections::gs48_ellipsoid>(aspen, denver, "+ellps=WGS84 +units=m +lon1=-48");=> distance is > 1000
test_forward<bg::projections::gs50_ellipsoid>(aspen, denver, "+ellps=WGS84 +units=m +lon1=-50", 2);
}
}
int test_main(int, char* [])
{
test_all<double>();
return 0;
}

View File

@@ -1,6 +1,6 @@
// Boost.Geometry (aka GGL, Generic Geometry Library)
// Copyright (c) 2014, Oracle and/or its affiliates.
// Copyright (c) 2014-2015, Oracle and/or its affiliates.
// Contributed and/or modified by Menelaos Karavelas, on behalf of Oracle
@@ -16,7 +16,17 @@
#include <boost/assert.hpp>
#include <boost/range.hpp>
#include <boost/geometry/core/tags.hpp>
#include <boost/geometry/geometries/box.hpp>
#include <boost/geometry/iterators/segment_iterator.hpp>
#include <boost/geometry/algorithms/envelope.hpp>
#include <boost/geometry/algorithms/expand.hpp>
#include <boost/geometry/algorithms/detail/check_iterator_range.hpp>
#include <boost/geometry/algorithms/detail/partition.hpp>
#include <boost/geometry/algorithms/detail/disjoint/multirange_geometry.hpp>
#include <boost/geometry/algorithms/detail/disjoint/point_point.hpp>
#include <boost/geometry/algorithms/detail/disjoint/point_geometry.hpp>
@@ -33,7 +43,8 @@ namespace boost { namespace geometry
namespace detail { namespace disjoint
{
template<typename MultiPoint1, typename MultiPoint2>
template <typename MultiPoint1, typename MultiPoint2>
class multipoint_multipoint
{
private:
@@ -90,6 +101,98 @@ public:
};
template <typename MultiPoint, typename Linear>
class multipoint_linear
{
private:
// structs for partition -- start
struct expand_box
{
template <typename Box, typename Geometry>
static inline void apply(Box& total, Geometry const& geometry)
{
geometry::expand(total, geometry::return_envelope<Box>(geometry));
}
};
struct overlaps_box
{
template <typename Box, typename Geometry>
static inline bool apply(Box const& box, Geometry const& geometry)
{
return ! dispatch::disjoint<Geometry, Box>::apply(geometry, box);
}
};
class item_visitor_type
{
public:
item_visitor_type() : m_intersection_found(false) {}
template <typename Item1, typename Item2>
inline void apply(Item1 const& item1, Item2 const& item2)
{
if (! m_intersection_found
&& ! dispatch::disjoint<Item1, Item2>::apply(item1, item2))
{
m_intersection_found = true;
}
}
inline bool intersection_found() const { return m_intersection_found; }
private:
bool m_intersection_found;
};
// structs for partition -- end
class segment_range
{
public:
typedef geometry::segment_iterator<Linear const> const_iterator;
typedef const_iterator iterator;
segment_range(Linear const& linear)
: m_linear(linear)
{}
const_iterator begin() const
{
return geometry::segments_begin(m_linear);
}
const_iterator end() const
{
return geometry::segments_end(m_linear);
}
private:
Linear const& m_linear;
};
public:
static inline bool apply(MultiPoint const& multipoint, Linear const& linear)
{
item_visitor_type visitor;
geometry::partition
<
geometry::model::box<typename point_type<MultiPoint>::type>,
expand_box,
overlaps_box
>::apply(multipoint, segment_range(linear), visitor);
return ! visitor.intersection_found();
}
static inline bool apply(Linear const& linear, MultiPoint const& multipoint)
{
return apply(multipoint, linear);
}
};
}} // namespace detail::disjoint
#endif // DOXYGEN_NO_DETAIL
@@ -101,7 +204,7 @@ namespace dispatch
{
template<typename Point, typename MultiPoint, std::size_t DimensionCount>
template <typename Point, typename MultiPoint, std::size_t DimensionCount>
struct disjoint
<
Point, MultiPoint, DimensionCount, point_tag, multi_point_tag, false
@@ -109,7 +212,7 @@ struct disjoint
{};
template<typename MultiPoint, typename Segment, std::size_t DimensionCount>
template <typename MultiPoint, typename Segment, std::size_t DimensionCount>
struct disjoint
<
MultiPoint, Segment, DimensionCount, multi_point_tag, segment_tag, false
@@ -117,7 +220,7 @@ struct disjoint
{};
template<typename MultiPoint, typename Box, std::size_t DimensionCount>
template <typename MultiPoint, typename Box, std::size_t DimensionCount>
struct disjoint
<
MultiPoint, Box, DimensionCount, multi_point_tag, box_tag, false
@@ -125,7 +228,12 @@ struct disjoint
{};
template<typename MultiPoint1, typename MultiPoint2, std::size_t DimensionCount>
template
<
typename MultiPoint1,
typename MultiPoint2,
std::size_t DimensionCount
>
struct disjoint
<
MultiPoint1, MultiPoint2, DimensionCount,
@@ -151,6 +259,22 @@ struct disjoint
};
template <typename Linear, typename MultiPoint, std::size_t DimensionCount>
struct disjoint
<
Linear, MultiPoint, DimensionCount, linear_tag, multi_point_tag, false
> : detail::disjoint::multipoint_linear<MultiPoint, Linear>
{};
template <typename MultiPoint, typename Linear, std::size_t DimensionCount>
struct disjoint
<
MultiPoint, Linear, DimensionCount, multi_point_tag, linear_tag, false
> : detail::disjoint::multipoint_linear<MultiPoint, Linear>
{};
} // namespace dispatch
#endif // DOXYGEN_NO_DISPATCH

View File

@@ -1,12 +1,12 @@
// Boost.Geometry (aka GGL, Generic Geometry Library)
// Copyright (c) 2007-2014 Barend Gehrels, Amsterdam, the Netherlands.
// Copyright (c) 2008-2014 Bruno Lalande, Paris, France.
// Copyright (c) 2009-2014 Mateusz Loskot, London, UK.
// Copyright (c) 2013-2014 Adam Wulkiewicz, Lodz, Poland.
// Copyright (c) 2007-2015 Barend Gehrels, Amsterdam, the Netherlands.
// Copyright (c) 2008-2015 Bruno Lalande, Paris, France.
// Copyright (c) 2009-2015 Mateusz Loskot, London, UK.
// Copyright (c) 2013-2015 Adam Wulkiewicz, Lodz, Poland.
// This file was modified by Oracle on 2013-2014.
// Modifications copyright (c) 2013-2014, Oracle and/or its affiliates.
// This file was modified by Oracle on 2013, 2014, 2015.
// Modifications copyright (c) 2013-2015, Oracle and/or its affiliates.
// Contributed and/or modified by Adam Wulkiewicz, on behalf of Oracle
// Contributed and/or modified by Menelaos Karavelas, on behalf of Oracle
@@ -21,8 +21,6 @@
#ifndef BOOST_GEOMETRY_ALGORITHMS_DETAIL_DISJOINT_POINT_GEOMETRY_HPP
#define BOOST_GEOMETRY_ALGORITHMS_DETAIL_DISJOINT_POINT_GEOMETRY_HPP
#include <boost/geometry/geometries/segment.hpp>
#include <boost/geometry/algorithms/covered_by.hpp>
#include <boost/geometry/algorithms/detail/disjoint/linear_linear.hpp>
@@ -39,24 +37,13 @@ namespace detail { namespace disjoint
{
template<typename Point, typename Geometry>
struct disjoint_point_linear
{
static inline
bool apply(Point const& pt, Geometry const& g)
{
return !geometry::covered_by(pt, g);
}
};
template <typename Geometry1, typename Geometry2>
struct reverse_covered_by
{
template <typename Geometry1, typename Geometry2>
static inline
bool apply(Geometry1 const& geometry1, Geometry2 const& geometry2)
{
return !geometry::covered_by(geometry1, geometry2);
return ! geometry::covered_by(geometry1, geometry2);
}
};
@@ -74,30 +61,20 @@ namespace dispatch
template<typename Point, typename Linear, std::size_t DimensionCount>
struct disjoint<Point, Linear, DimensionCount, point_tag, linear_tag, false>
: public detail::disjoint::disjoint_point_linear<Point, Linear>
: detail::disjoint::reverse_covered_by
{};
template <typename Point, typename Areal, std::size_t DimensionCount>
struct disjoint<Point, Areal, DimensionCount, point_tag, areal_tag, false>
: detail::disjoint::reverse_covered_by<Point, Areal>
: detail::disjoint::reverse_covered_by
{};
template<typename Point, typename Segment, std::size_t DimensionCount>
struct disjoint<Point, Segment, DimensionCount, point_tag, segment_tag, false>
{
static inline bool apply(Point const& point, Segment const& segment)
{
typedef geometry::model::referring_segment<Point const> other_segment;
other_segment other(point, point);
return detail::disjoint::disjoint_segment
<
Segment, other_segment
>::apply(segment, other);
}
};
: detail::disjoint::reverse_covered_by
{};
} // namespace dispatch

View File

@@ -1,9 +1,9 @@
// Boost.Geometry (aka GGL, Generic Geometry Library)
// Copyright (c) 2007-2014 Barend Gehrels, Amsterdam, the Netherlands.
// Copyright (c) 2007-2015 Barend Gehrels, Amsterdam, the Netherlands.
// This file was modified by Oracle on 2014.
// Modifications copyright (c) 2014 Oracle and/or its affiliates.
// This file was modified by Oracle on 2014, 2015.
// Modifications copyright (c) 2014-2015 Oracle and/or its affiliates.
// Contributed and/or modified by Menelaos Karavelas, on behalf of Oracle
@@ -42,6 +42,7 @@
#include <boost/geometry/algorithms/detail/overlay/linear_linear.hpp>
#include <boost/geometry/algorithms/detail/overlay/pointlike_pointlike.hpp>
#include <boost/geometry/algorithms/detail/overlay/pointlike_linear.hpp>
#if defined(BOOST_GEOMETRY_DEBUG_FOLLOW)
#include <boost/geometry/algorithms/detail/overlay/debug_turn_info.hpp>
@@ -700,6 +701,79 @@ struct intersection_insert
{};
// dispatch for difference/intersection of pointlike-linear geometries
template
<
typename Point, typename Linear, typename PointOut,
overlay_type OverlayType,
bool Reverse1, bool Reverse2, bool ReverseOut,
typename Tag
>
struct intersection_insert
<
Point, Linear, PointOut, OverlayType,
Reverse1, Reverse2, ReverseOut,
point_tag, Tag, point_tag,
false, false, false
> : detail_dispatch::overlay::pointlike_linear_point
<
Point, Linear, PointOut, OverlayType,
point_tag, typename tag_cast<Tag, segment_tag, linear_tag>::type
>
{};
template
<
typename MultiPoint, typename Linear, typename PointOut,
overlay_type OverlayType,
bool Reverse1, bool Reverse2, bool ReverseOut,
typename Tag
>
struct intersection_insert
<
MultiPoint, Linear, PointOut, OverlayType,
Reverse1, Reverse2, ReverseOut,
multi_point_tag, Tag, point_tag,
false, false, false
> : detail_dispatch::overlay::pointlike_linear_point
<
MultiPoint, Linear, PointOut, OverlayType,
multi_point_tag,
typename tag_cast<Tag, segment_tag, linear_tag>::type
>
{};
template
<
typename Linestring, typename MultiPoint, typename PointOut,
bool Reverse1, bool Reverse2, bool ReverseOut
>
struct intersection_insert
<
Linestring, MultiPoint, PointOut, overlay_intersection,
Reverse1, Reverse2, ReverseOut,
linestring_tag, multi_point_tag, point_tag,
false, false, false
>
{
template <typename RobustPolicy, typename OutputIterator, typename Strategy>
static inline OutputIterator apply(Linestring const& linestring,
MultiPoint const& multipoint,
RobustPolicy const& robust_policy,
OutputIterator out,
Strategy const& strategy)
{
return detail_dispatch::overlay::pointlike_linear_point
<
MultiPoint, Linestring, PointOut, overlay_intersection,
multi_point_tag, linear_tag
>::apply(multipoint, linestring, robust_policy, out, strategy);
}
};
} // namespace dispatch
#endif // DOXYGEN_NO_DISPATCH

View File

@@ -0,0 +1,344 @@
// Boost.Geometry (aka GGL, Generic Geometry Library)
// Copyright (c) 2015, Oracle and/or its affiliates.
// Licensed under the Boost Software License version 1.0.
// http://www.boost.org/users/license.html
// Contributed and/or modified by Menelaos Karavelas, on behalf of Oracle
#ifndef BOOST_GEOMETRY_ALGORITHMS_DETAIL_OVERLAY_POINTLIKE_LINEAR_HPP
#define BOOST_GEOMETRY_ALGORITHMS_DETAIL_OVERLAY_POINTLIKE_LINEAR_HPP
#include <iterator>
#include <vector>
#include <boost/assert.hpp>
#include <boost/range.hpp>
#include <boost/geometry/core/tags.hpp>
#include <boost/geometry/geometries/box.hpp>
#include <boost/geometry/iterators/segment_iterator.hpp>
#include <boost/geometry/algorithms/disjoint.hpp>
#include <boost/geometry/algorithms/envelope.hpp>
#include <boost/geometry/algorithms/expand.hpp>
#include <boost/geometry/algorithms/not_implemented.hpp>
#include <boost/geometry/algorithms/detail/not.hpp>
#include <boost/geometry/algorithms/detail/partition.hpp>
#include <boost/geometry/algorithms/detail/relate/less.hpp>
#include <boost/geometry/algorithms/detail/disjoint/point_geometry.hpp>
#include <boost/geometry/algorithms/detail/equals/point_point.hpp>
#include <boost/geometry/algorithms/detail/overlay/overlay_type.hpp>
#include <boost/geometry/algorithms/detail/overlay/pointlike_pointlike.hpp>
namespace boost { namespace geometry
{
#ifndef DOXYGEN_NO_DETAIL
namespace detail { namespace overlay
{
// action struct for pointlike-linear difference/intersection
// it works the same as its pointlike-pointlike counterpart, hence the
// derivation
template <typename PointOut, overlay_type OverlayType>
struct action_selector_pl_l
: action_selector_pl_pl<PointOut, OverlayType>
{};
// difference/intersection of point-linear
template
<
typename Point,
typename Linear,
typename PointOut,
overlay_type OverlayType,
typename Policy
>
struct point_linear_point
{
template <typename RobustPolicy, typename OutputIterator, typename Strategy>
static inline OutputIterator apply(Point const& point,
Linear const& linear,
RobustPolicy const&,
OutputIterator oit,
Strategy const&)
{
action_selector_pl_l
<
PointOut, OverlayType
>::apply(point, Policy::apply(point, linear), oit);
return oit;
}
};
// difference/intersection of multipoint-segment
template
<
typename MultiPoint,
typename Segment,
typename PointOut,
overlay_type OverlayType,
typename Policy
>
struct multipoint_segment_point
{
template <typename RobustPolicy, typename OutputIterator, typename Strategy>
static inline OutputIterator apply(MultiPoint const& multipoint,
Segment const& segment,
RobustPolicy const&,
OutputIterator oit,
Strategy const&)
{
for (typename boost::range_iterator<MultiPoint const>::type
it = boost::begin(multipoint);
it != boost::end(multipoint);
++it)
{
action_selector_pl_l
<
PointOut, OverlayType
>::apply(*it, Policy::apply(*it, segment), oit);
}
return oit;
}
};
// difference/intersection of multipoint-linear
template
<
typename MultiPoint,
typename Linear,
typename PointOut,
overlay_type OverlayType,
typename Policy
>
class multipoint_linear_point
{
private:
// structs for partition -- start
struct expand_box
{
template <typename Box, typename Geometry>
static inline void apply(Box& total, Geometry const& geometry)
{
geometry::expand(total, geometry::return_envelope<Box>(geometry));
}
};
struct overlaps_box
{
template <typename Box, typename Geometry>
static inline bool apply(Box const& box, Geometry const& geometry)
{
return ! geometry::disjoint(geometry, box);
}
};
template <typename OutputIterator>
class item_visitor_type
{
public:
item_visitor_type(OutputIterator& oit) : m_oit(oit) {}
template <typename Item1, typename Item2>
inline void apply(Item1 const& item1, Item2 const& item2)
{
action_selector_pl_l
<
PointOut, overlay_intersection
>::apply(item1, Policy::apply(item1, item2), m_oit);
}
private:
OutputIterator& m_oit;
};
// structs for partition -- end
class segment_range
{
public:
typedef geometry::segment_iterator<Linear const> const_iterator;
typedef const_iterator iterator;
segment_range(Linear const& linear)
: m_linear(linear)
{}
const_iterator begin() const
{
return geometry::segments_begin(m_linear);
}
const_iterator end() const
{
return geometry::segments_end(m_linear);
}
private:
Linear const& m_linear;
};
template <typename OutputIterator>
static inline OutputIterator get_common_points(MultiPoint const& multipoint,
Linear const& linear,
OutputIterator oit)
{
item_visitor_type<OutputIterator> item_visitor(oit);
segment_range rng(linear);
geometry::partition
<
geometry::model::box
<
typename boost::range_value<MultiPoint>::type
>,
expand_box,
overlaps_box
>::apply(multipoint, rng, item_visitor);
return oit;
}
public:
template <typename RobustPolicy, typename OutputIterator, typename Strategy>
static inline OutputIterator apply(MultiPoint const& multipoint,
Linear const& linear,
RobustPolicy const& robust_policy,
OutputIterator oit,
Strategy const& strategy)
{
typedef std::vector
<
typename boost::range_value<MultiPoint>::type
> point_vector_type;
point_vector_type common_points;
// compute the common points
get_common_points(multipoint, linear,
std::back_inserter(common_points));
return multipoint_multipoint_point
<
MultiPoint, point_vector_type, PointOut, OverlayType
>::apply(multipoint, common_points, robust_policy, oit, strategy);
}
};
}} // namespace detail::overlay
#endif // DOXYGEN_NO_DETAIL
#ifndef DOXYGEN_NO_DISPATCH
namespace detail_dispatch { namespace overlay
{
// dispatch struct for pointlike-linear difference/intersection computation
template
<
typename PointLike,
typename Linear,
typename PointOut,
overlay_type OverlayType,
typename Tag1,
typename Tag2
>
struct pointlike_linear_point
: not_implemented<PointLike, Linear, PointOut>
{};
template
<
typename Point,
typename Linear,
typename PointOut,
overlay_type OverlayType
>
struct pointlike_linear_point
<
Point, Linear, PointOut, OverlayType, point_tag, linear_tag
> : detail::overlay::point_linear_point
<
Point, Linear, PointOut, OverlayType,
detail::not_<detail::disjoint::reverse_covered_by>
>
{};
template
<
typename Point,
typename Segment,
typename PointOut,
overlay_type OverlayType
>
struct pointlike_linear_point
<
Point, Segment, PointOut, OverlayType, point_tag, segment_tag
> : detail::overlay::point_linear_point
<
Point, Segment, PointOut, OverlayType,
detail::not_<detail::disjoint::reverse_covered_by>
>
{};
template
<
typename MultiPoint,
typename Linear,
typename PointOut,
overlay_type OverlayType
>
struct pointlike_linear_point
<
MultiPoint, Linear, PointOut, OverlayType, multi_point_tag, linear_tag
> : detail::overlay::multipoint_linear_point
<
MultiPoint, Linear, PointOut, OverlayType,
detail::not_<detail::disjoint::reverse_covered_by>
>
{};
template
<
typename MultiPoint,
typename Segment,
typename PointOut,
overlay_type OverlayType
>
struct pointlike_linear_point
<
MultiPoint, Segment, PointOut, OverlayType, multi_point_tag, segment_tag
> : detail::overlay::multipoint_segment_point
<
MultiPoint, Segment, PointOut, OverlayType,
detail::not_<detail::disjoint::reverse_covered_by>
>
{};
}} // namespace detail_dispatch::overlay
#endif // DOXYGEN_NO_DISPATCH
}} // namespace boost::geometry
#endif // BOOST_GEOMETRY_ALGORITHMS_DETAIL_OVERLAY_POINTLIKE_LINEAR_HPP

View File

@@ -1,6 +1,6 @@
// Boost.Geometry (aka GGL, Generic Geometry Library)
// Copyright (c) 2014, Oracle and/or its affiliates.
// Copyright (c) 2014-2015, Oracle and/or its affiliates.
// Licensed under the Boost Software License version 1.0.
// http://www.boost.org/users/license.html
@@ -264,7 +264,7 @@ struct multipoint_multipoint_point
>::apply(multipoint2, multipoint1, robust_policy, oit, strategy);
}
std::vector<typename point_type<MultiPoint2>::type>
std::vector<typename boost::range_value<MultiPoint2>::type>
points2(boost::begin(multipoint2), boost::end(multipoint2));
std::sort(points2.begin(), points2.end(), detail::relate::less());

View File

@@ -22,6 +22,7 @@
#include <boost/geometry/core/coordinate_type.hpp>
#include <boost/geometry/geometries/concepts/point_concept.hpp>
#include <boost/geometry/util/for_each_coordinate.hpp>
#include <boost/geometry/util/select_most_precise.hpp>
namespace boost { namespace geometry
@@ -32,80 +33,94 @@ namespace detail
{
template <typename P>
template <typename Point>
struct param
{
typedef typename boost::call_traits
<
typename coordinate_type<P>::type
typename coordinate_type<Point>::type
>::param_type type;
};
template <typename C, template <typename> class Function>
template <typename Value, template <typename> class Function>
struct value_operation
{
C m_value;
Value m_value;
inline value_operation(C const &value)
inline value_operation(Value const &value)
: m_value(value)
{}
template <typename P, int I>
inline void apply(P& point) const
template <typename PointDst, std::size_t Index>
inline void apply(PointDst& point_dst) const
{
set<I>(point, Function<C>()(get<I>(point), m_value));
set<Index>(point_dst,
Function
<
typename geometry::select_most_precise
<
Value,
typename geometry::coordinate_type<PointDst>::type
>::type
>()(get<Index>(point_dst), m_value));
}
};
template <typename PointSrc, template <typename> class Function>
struct point_operation
{
typedef typename coordinate_type<PointSrc>::type coordinate_type;
PointSrc const& m_source_point;
PointSrc const& m_point_src;
inline point_operation(PointSrc const& point)
: m_source_point(point)
: m_point_src(point)
{}
template <typename PointDst, int I>
inline void apply(PointDst& dest_point) const
template <typename PointDst, std::size_t Index>
inline void apply(PointDst& point_dst) const
{
set<I>(dest_point,
Function<coordinate_type>()(get<I>(dest_point), get<I>(m_source_point)));
set<Index>(point_dst,
Function
<
typename geometry::select_most_precise
<
typename geometry::coordinate_type<PointSrc>::type,
typename geometry::coordinate_type<PointDst>::type
>::type
>()(get<Index>(point_dst), get<Index>(m_point_src)));
}
};
template <typename C>
template <typename Value>
struct value_assignment
{
C m_value;
Value m_value;
inline value_assignment(C const &value)
inline value_assignment(Value const &value)
: m_value(value)
{}
template <typename P, int I>
inline void apply(P& point) const
template <typename PointDst, std::size_t Index>
inline void apply(PointDst& point_dst) const
{
set<I>(point, m_value);
set<Index>(point_dst, m_value);
}
};
template <typename PointSrc>
struct point_assignment
{
PointSrc const& m_source_point;
PointSrc const& m_point_src;
inline point_assignment(PointSrc const& point)
: m_source_point(point)
: m_point_src(point)
{}
template <typename PointDst, int I>
inline void apply(PointDst& dest_point) const
template <typename PointDst, std::size_t Index>
inline void apply(PointDst& point_dst) const
{
set<I>(dest_point, get<I>(m_source_point));
set<Index>(point_dst, get<Index>(m_point_src));
}
};
@@ -126,7 +141,12 @@ inline void add_value(Point& p, typename detail::param<Point>::type value)
{
BOOST_CONCEPT_ASSERT( (concept::Point<Point>) );
for_each_coordinate(p, detail::value_operation<typename coordinate_type<Point>::type, std::plus>(value));
for_each_coordinate(p,
detail::value_operation
<
typename coordinate_type<Point>::type,
std::plus
>(value));
}
/*!
@@ -161,7 +181,12 @@ inline void subtract_value(Point& p, typename detail::param<Point>::type value)
{
BOOST_CONCEPT_ASSERT( (concept::Point<Point>) );
for_each_coordinate(p, detail::value_operation<typename coordinate_type<Point>::type, std::minus>(value));
for_each_coordinate(p,
detail::value_operation
<
typename coordinate_type<Point>::type,
std::minus
>(value));
}
/*!
@@ -196,7 +221,12 @@ inline void multiply_value(Point& p, typename detail::param<Point>::type value)
{
BOOST_CONCEPT_ASSERT( (concept::Point<Point>) );
for_each_coordinate(p, detail::value_operation<typename coordinate_type<Point>::type, std::multiplies>(value));
for_each_coordinate(p,
detail::value_operation
<
typename coordinate_type<Point>::type,
std::multiplies
>(value));
}
/*!
@@ -232,7 +262,12 @@ inline void divide_value(Point& p, typename detail::param<Point>::type value)
{
BOOST_CONCEPT_ASSERT( (concept::Point<Point>) );
for_each_coordinate(p, detail::value_operation<typename coordinate_type<Point>::type, std::divides>(value));
for_each_coordinate(p,
detail::value_operation
<
typename coordinate_type<Point>::type,
std::divides
>(value));
}
/*!
@@ -267,7 +302,11 @@ inline void assign_value(Point& p, typename detail::param<Point>::type value)
{
BOOST_CONCEPT_ASSERT( (concept::Point<Point>) );
for_each_coordinate(p, detail::value_assignment<typename coordinate_type<Point>::type>(value));
for_each_coordinate(p,
detail::value_assignment
<
typename coordinate_type<Point>::type
>(value));
}
/*!

View File

@@ -184,6 +184,18 @@ namespace detail
// 1) lexical cast -> stack overflow and
// 2) because it is implemented as a function, generic implementation not possible
// Partial specialization for ttmath
template <ttmath::uint Exponent, ttmath::uint Mantissa>
struct define_half_pi<ttmath::Big<Exponent, Mantissa> >
{
static inline ttmath::Big<Exponent, Mantissa> apply()
{
static ttmath::Big<Exponent, Mantissa> const half_pi(
"1.57079632679489661923132169163975144209858469968755291048747229615390820314310449931401741267105853399107404325664115332354692230477529111586267970406424055872514205135096926055277982231147447746519098");
return half_pi;
}
};
// Partial specialization for ttmath
template <ttmath::uint Exponent, ttmath::uint Mantissa>
struct define_pi<ttmath::Big<Exponent, Mantissa> >
@@ -196,11 +208,33 @@ namespace detail
}
};
// Partial specialization for ttmath
template <ttmath::uint Exponent, ttmath::uint Mantissa>
struct define_two_pi<ttmath::Big<Exponent, Mantissa> >
{
static inline ttmath::Big<Exponent, Mantissa> apply()
{
static ttmath::Big<Exponent, Mantissa> const two_pi(
"6.28318530717958647692528676655900576839433879875021164194988918461563281257241799725606965068423413596429617302656461329418768921910116446345071881625696223490056820540387704221111928924589790986076392");
return two_pi;
}
};
template <>
struct define_half_pi<ttmath_big>
: public define_half_pi<ttmath::Big<1,4> >
{};
template <>
struct define_pi<ttmath_big>
: public define_pi<ttmath::Big<1,4> >
{};
template <>
struct define_two_pi<ttmath_big>
: public define_two_pi<ttmath::Big<1,4> >
{};
template <ttmath::uint Exponent, ttmath::uint Mantissa>
struct equals_with_epsilon<ttmath::Big<Exponent, Mantissa>, false>
{

View File

@@ -62,7 +62,7 @@ struct byte_order_type
};
};
struct geometry_type
struct geometry_type_ogc
{
enum enum_t
{
@@ -78,9 +78,99 @@ struct geometry_type
};
};
}} // namespace detail::endian
struct geometry_type_ewkt
{
enum enum_t
{
point = 1,
linestring = 2,
polygon = 3,
// TODO: Not implemented
//multipoint = 4,
//multilinestring = 5,
//multipolygon = 6,
//collection = 7
pointz = 1001,
linestringz = 1002,
polygonz = 1003
};
};
struct ogc_policy
{
};
struct ewkt_policy
{
};
template
<
typename Geometry,
geometry_type_ogc::enum_t OgcType,
std::size_t Dim = dimension<Geometry>::value
>
struct geometry_type_impl
{
static bool check(boost::uint32_t value)
{
return value == get();
}
static boost::uint32_t get()
{
return OgcType;
}
};
template
<
typename Geometry,
geometry_type_ogc::enum_t OgcType
>
struct geometry_type_impl<Geometry, OgcType, 3>
{
static bool check(boost::uint32_t value)
{
return value == get();
}
static boost::uint32_t get()
{
return 1000 + OgcType;
}
};
template
<
typename Geometry,
typename CheckPolicy = ogc_policy,
typename Tag = typename tag<Geometry>::type
>
struct geometry_type : not_implemented<Tag>
{
};
template <typename Geometry, typename CheckPolicy>
struct geometry_type<Geometry, CheckPolicy, point_tag>
: geometry_type_impl<Geometry, geometry_type_ogc::point>
{};
template <typename Geometry, typename CheckPolicy>
struct geometry_type<Geometry, CheckPolicy, linestring_tag>
: geometry_type_impl<Geometry, geometry_type_ogc::linestring>
{};
template <typename Geometry, typename CheckPolicy>
struct geometry_type<Geometry, CheckPolicy, polygon_tag>
: geometry_type_impl<Geometry, geometry_type_ogc::polygon>
{};
}} // namespace detail::wkb
#endif // DOXYGEN_NO_IMPL
}} // namespace boost::geometry
#endif // BOOST_GEOMETRY_IO_WKB_DETAIL_OGC_HPP

View File

@@ -9,9 +9,9 @@
#ifndef BOOST_GEOMETRY_IO_WKB_DETAIL_PARSER_HPP
#define BOOST_GEOMETRY_IO_WKB_DETAIL_PARSER_HPP
#include <algorithm>
#include <cassert>
#include <cstddef>
#include <algorithm>
#include <iterator>
#include <limits>
@@ -101,33 +101,30 @@ struct byte_order_parser
}
};
template <typename Geometry>
struct geometry_type_parser
{
template <typename Iterator>
static bool parse(Iterator& it, Iterator end, geometry_type::enum_t& type,
byte_order_type::enum_t order)
static bool parse(Iterator& it, Iterator end,
byte_order_type::enum_t order)
{
boost::uint32_t value;
if (value_parser<boost::uint32_t>::parse(it, end, value, order))
{
// TODO: Refine the test when multi* geometries are supported
boost::uint32_t id = value & 0xff;
if (geometry_type::polygon >= id)
{
type = geometry_type::enum_t(id);
return true;
}
return geometry_type<Geometry>::check(value);
}
return false;
}
};
template <typename P, int I, int N>
template <typename P,
std::size_t I = 0,
std::size_t N = dimension<P>::value>
struct parsing_assigner
{
template <typename Iterator>
static void run(Iterator& it, Iterator end, P& point, byte_order_type::enum_t order)
static void run(Iterator& it, Iterator end, P& point,
byte_order_type::enum_t order)
{
typedef typename coordinate_type<P>::type coordinate_type;
@@ -150,17 +147,14 @@ struct parsing_assigner
}
};
template <typename P, int N>
template <typename P, std::size_t N>
struct parsing_assigner<P, N, N>
{
template <typename Iterator>
static void run(Iterator& it, Iterator end, P& point, byte_order_type::enum_t order)
static void run(Iterator& /*it*/, Iterator /*end*/, P& /*point*/,
byte_order_type::enum_t /*order*/)
{
// terminate
boost::ignore_unused_variable_warning(it);
boost::ignore_unused_variable_warning(end);
boost::ignore_unused_variable_warning(point);
boost::ignore_unused_variable_warning(order);
}
};
@@ -168,16 +162,14 @@ template <typename P>
struct point_parser
{
template <typename Iterator>
static bool parse(Iterator& it, Iterator end, P& point, byte_order_type::enum_t order)
static bool parse(Iterator& it, Iterator end, P& point,
byte_order_type::enum_t order)
{
// TODO: mloskot - Add assert on point dimension, 2d only
geometry_type::enum_t type;
if (geometry_type_parser::parse(it, end, type, order))
if (geometry_type_parser<P>::parse(it, end, order))
{
if (geometry_type::point == type && it != end)
if (it != end)
{
parsing_assigner<P, 0, dimension<P>::value>::run(it, end, point, order);
parsing_assigner<P>::run(it, end, point, order);
}
return true;
}
@@ -189,7 +181,8 @@ template <typename C>
struct point_container_parser
{
template <typename Iterator>
static bool parse(Iterator& it, Iterator end, C& container, byte_order_type::enum_t order)
static bool parse(Iterator& it, Iterator end, C& container,
byte_order_type::enum_t order)
{
typedef typename point_type<C>::type point_type;
@@ -208,15 +201,13 @@ struct point_container_parser
if (std::distance(it, end) >= (container_size * point_size))
{
point_type point_buffer;
std::back_insert_iterator<C> output(std::back_inserter(container));
// Read coordinates into point and append point to line (ring)
size_type points_parsed = 0;
while (points_parsed < container_size && it != end)
{
parsing_assigner<point_type, 0, dimension<point_type>::value>::run(it, end, point_buffer, order);
output = point_buffer;
++output;
parsing_assigner<point_type>::run(it, end, point_buffer, order);
boost::geometry::append(container, point_buffer);
++points_parsed;
}
@@ -225,6 +216,10 @@ struct point_container_parser
return false;
}
}
else
{
return false;
}
return true;
}
@@ -234,17 +229,10 @@ template <typename L>
struct linestring_parser
{
template <typename Iterator>
static bool parse(Iterator& it, Iterator end, L& linestring, byte_order_type::enum_t order)
static bool parse(Iterator& it, Iterator end, L& linestring,
byte_order_type::enum_t order)
{
typedef typename point_type<L>::type point_type;
geometry_type::enum_t type;
if (!geometry_type_parser::parse(it, end, type, order))
{
return false;
}
if (geometry_type::linestring != type)
if (!geometry_type_parser<L>::parse(it, end, order))
{
return false;
}
@@ -258,17 +246,16 @@ template <typename Polygon>
struct polygon_parser
{
template <typename Iterator>
static bool parse(Iterator& it, Iterator end, Polygon& polygon, byte_order_type::enum_t order)
static bool parse(Iterator& it, Iterator end, Polygon& polygon,
byte_order_type::enum_t order)
{
geometry_type::enum_t type;
if (!geometry_type_parser::parse(it, end, type, order))
if (!geometry_type_parser<Polygon>::parse(it, end, order))
{
return false;
}
boost::uint32_t num_rings(0);
if (geometry_type::polygon != type ||
!value_parser<boost::uint32_t>::parse(it, end, num_rings, order))
if (!value_parser<boost::uint32_t>::parse(it, end, num_rings, order))
{
return false;
}
@@ -276,7 +263,7 @@ struct polygon_parser
typedef typename ring_type<Polygon>::type ring_type;
std::size_t rings_parsed = 0;
while (rings_parsed < num_rings && it != end) //while (rings_parsed < num_rings && it != end)
while (rings_parsed < num_rings && it != end)
{
if (0 == rings_parsed)
{
@@ -311,6 +298,4 @@ struct polygon_parser
#endif // DOXYGEN_NO_IMPL
}} // namespace boost::geometry
#endif // BOOST_GEOMETRY_IO_WKB_DETAIL_PARSER_HPP

View File

@@ -0,0 +1,234 @@
// Boost.Geometry
//
// Copyright (c) 2015 Mats Taraldsvik.
//
// 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)
#ifndef BOOST_GEOMETRY_IO_WKB_DETAIL_WRITER_HPP
#define BOOST_GEOMETRY_IO_WKB_DETAIL_WRITER_HPP
#include <algorithm>
#include <cassert>
#include <cstddef>
#include <iterator>
#include <limits>
#include <boost/concept_check.hpp>
#include <boost/cstdint.hpp>
#include <boost/range.hpp>
#include <boost/static_assert.hpp>
#include <boost/type_traits/is_integral.hpp>
#include <boost/type_traits/is_same.hpp>
#include <boost/geometry/core/access.hpp>
#include <boost/geometry/core/coordinate_dimension.hpp>
#include <boost/geometry/core/coordinate_type.hpp>
#include <boost/geometry/core/exterior_ring.hpp>
#include <boost/geometry/core/interior_rings.hpp>
#include <boost/geometry/extensions/gis/io/wkb/detail/endian.hpp>
#include <boost/geometry/extensions/gis/io/wkb/detail/ogc.hpp>
namespace boost { namespace geometry
{
#ifndef DOXYGEN_NO_DETAIL
namespace detail { namespace wkb
{
template <typename T>
struct value_writer
{
typedef T value_type;
template <typename OutputIterator>
static bool write(T const& value,
OutputIterator& iter,
byte_order_type::enum_t byte_order)
{
endian::endian_value<T> parsed_value(value);
// if (byte_order_type::xdr == byte_order)
// {
// parsed_value.template store<endian::big_endian_tag>(iter);
// }
// else if (byte_order_type::ndr == byte_order)
// {
// parsed_value.template store<endian::little_endian_tag>(iter);
// }
// else
// {
parsed_value.template store<endian::native_endian_tag>(iter);
// }
return true;
}
};
template
<
typename Point,
std::size_t I = 0,
std::size_t N = dimension<Point>::value
>
struct writer_assigner
{
template <typename OutputIterator>
static void run(Point const& point,
OutputIterator& iter,
byte_order_type::enum_t byte_order)
{
// NOTE: coordinates of any type are converted to double
value_writer<double>::write(geometry::get<I>(point),
iter,
byte_order);
writer_assigner<Point, I+1, N>::run(point, iter, byte_order);
}
};
template <typename Point, std::size_t N>
struct writer_assigner<Point, N, N>
{
template <typename OutputIterator>
static void run(Point const& /*point*/,
OutputIterator& /*iter*/,
byte_order_type::enum_t /*byte_order*/)
{
// terminate
}
};
template <typename Point>
struct point_writer
{
template <typename OutputIterator>
static bool write(Point const& point,
OutputIterator& iter,
byte_order_type::enum_t byte_order)
{
// write endian type
value_writer<uint8_t>::write(byte_order, iter, byte_order);
// write geometry type
uint32_t type = geometry_type<Point>::get();
value_writer<uint32_t>::write(type, iter, byte_order);
// write point's x, y, z
writer_assigner<Point>::run(point, iter, byte_order);
return true;
}
};
template <typename Linestring>
struct linestring_writer
{
template <typename OutputIterator>
static bool write(Linestring const& linestring,
OutputIterator& iter,
byte_order_type::enum_t byte_order)
{
// write endian type
value_writer<uint8_t>::write(byte_order, iter, byte_order);
// write geometry type
uint32_t type = geometry_type<Linestring>::get();
value_writer<uint32_t>::write(type, iter, byte_order);
// write num points
uint32_t num_points = boost::size(linestring);
value_writer<uint32_t>::write(num_points, iter, byte_order);
for(typename boost::range_iterator<Linestring const>::type
point_iter = boost::begin(linestring);
point_iter != boost::end(linestring);
++point_iter)
{
// write point's x, y, z
writer_assigner<typename point_type<Linestring>::type>
::run(*point_iter, iter, byte_order);
}
return true;
}
};
template <typename Polygon>
struct polygon_writer
{
template <typename OutputIterator>
static bool write(Polygon const& polygon,
OutputIterator& iter,
byte_order_type::enum_t byte_order)
{
// write endian type
value_writer<uint8_t>::write(byte_order, iter, byte_order);
// write geometry type
uint32_t type = geometry_type<Polygon>::get();
value_writer<uint32_t>::write(type, iter, byte_order);
// write num rings
uint32_t num_rings = 1 + geometry::num_interior_rings(polygon);
value_writer<uint32_t>::write(num_rings, iter, byte_order);
// write exterior ring
typedef typename geometry::ring_type<Polygon const>::type
ring_type;
typename geometry::ring_return_type<Polygon const>::type
exterior_ring = geometry::exterior_ring(polygon);
value_writer<uint32_t>::write(geometry::num_points(exterior_ring),
iter,
byte_order);
for(typename boost::range_iterator<ring_type const>::type
point_iter = boost::begin(exterior_ring);
point_iter != boost::end(exterior_ring);
++point_iter)
{
// write point's x, y, z
writer_assigner<typename point_type<Polygon>::type>
::run(*point_iter, iter, byte_order);
}
// write interor rings
typedef typename geometry::interior_type<Polygon const>::type
interior_rings_type;
typename geometry::interior_return_type<Polygon const>::type
interior_rings = geometry::interior_rings(polygon);
for(typename boost::range_iterator<interior_rings_type const>::type
ring_iter = boost::begin(interior_rings);
ring_iter != boost::end(interior_rings);
++ring_iter)
{
value_writer<uint32_t>::write(geometry::num_points(*ring_iter),
iter,
byte_order);
for(typename boost::range_iterator<ring_type const>::type
point_iter = boost::begin(*ring_iter);
point_iter != boost::end(*ring_iter);
++point_iter)
{
// write point's x, y, z
writer_assigner<typename point_type<Polygon>::type>
::run(*point_iter, iter, byte_order);
}
}
return true;
}
};
}} // namespace detail::wkb
#endif // DOXYGEN_NO_IMPL
}} // namespace boost::geometry
#endif // BOOST_GEOMETRY_IO_WKB_DETAIL_WRITER_HPP

View File

@@ -83,7 +83,10 @@ bool wkb2hex(Iterator begin, Iterator end, std::string& hex)
// Poor-man validation, no performance penalty expected
// because begin/end always are random access iterators.
return hex.size() == (2 * std::distance(begin, end));
typename std::iterator_traits<Iterator>::difference_type
diff = std::distance(begin, end);
BOOST_ASSERT(diff > 0);
return hex.size() == 2 * std::string::size_type(diff);
}

View File

@@ -0,0 +1,128 @@
// Boost.Geometry
//
// Copyright (c) 2015 Mats Taraldsvik.
//
// 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)
#ifndef BOOST_GEOMETRY_IO_WKB_WRITE_WKB_HPP
#define BOOST_GEOMETRY_IO_WKB_WRITE_WKB_HPP
#include <iterator>
#include <boost/type_traits/is_convertible.hpp>
#include <boost/static_assert.hpp>
#include <boost/geometry/core/tags.hpp>
#include <boost/geometry/extensions/gis/io/wkb/detail/writer.hpp>
namespace boost { namespace geometry
{
#ifndef DOXYGEN_NO_DISPATCH
namespace dispatch
{
template <typename Tag, typename G>
struct write_wkb
{
};
template <typename G>
struct write_wkb<point_tag, G>
{
template <typename OutputIterator>
static inline bool write(const G& geometry, OutputIterator iter,
detail::wkb::byte_order_type::enum_t byte_order)
{
return detail::wkb::point_writer<G>::write(geometry, iter, byte_order);
}
};
template <typename G>
struct write_wkb<linestring_tag, G>
{
template <typename OutputIterator>
static inline bool write(const G& geometry, OutputIterator iter,
detail::wkb::byte_order_type::enum_t byte_order)
{
return detail::wkb::linestring_writer<G>::write(geometry, iter, byte_order);
}
};
template <typename G>
struct write_wkb<polygon_tag, G>
{
template <typename OutputIterator>
static inline bool write(const G& geometry, OutputIterator iter,
detail::wkb::byte_order_type::enum_t byte_order)
{
return detail::wkb::polygon_writer<G>::write(geometry, iter, byte_order);
}
};
} // namespace dispatch
#endif // DOXYGEN_NO_DISPATCH
template <typename G, typename OutputIterator>
inline bool write_wkb(const G& geometry, OutputIterator iter)
{
// The WKB is written to an OutputIterator.
BOOST_STATIC_ASSERT((
boost::is_convertible
<
typename std::iterator_traits<OutputIterator>::iterator_category,
const std::output_iterator_tag&
>::value));
// Will write in the native byte order
#ifdef BOOST_BIG_ENDIAN
detail::wkb::byte_order_type::enum_t byte_order = detail::wkb::byte_order_type::xdr;
#else
detail::wkb::byte_order_type::enum_t byte_order = detail::wkb::byte_order_type::ndr;
#endif
if
(!dispatch::write_wkb
<
typename tag<G>::type,
G
>::write(geometry, iter, byte_order))
{
return false;
}
return true;
}
// template <typename G, typename OutputIterator>
// inline bool write_wkb(G& geometry, OutputIterator iter,
// detail::wkb::byte_order_type::enum_t source_byte_order,
// detail::wkb::byte_order_type::enum_t target_byte_order)
// {
// // The WKB is written to an OutputIterator.
// BOOST_STATIC_ASSERT((
// boost::is_convertible
// <
// typename std::iterator_traits<OutputIterator>::iterator_category,
// const std::output_iterator_tag&
// >::value));
//
// if
// (
// !dispatch::write_wkb
// <
// typename tag<G>::type,
// G
// >::write(geometry, iter, byte_order)
// )
// {
// return false;
// }
//
// return true;
// }
}} // namespace boost::geometry
#endif // BOOST_GEOMETRY_IO_WKB_WRITE_WKB_HPP

View File

@@ -28,7 +28,7 @@
#include <boost/geometry/extensions/gis/projections/proj/cass.hpp>
#include <boost/geometry/extensions/gis/projections/proj/cc.hpp>
#include <boost/geometry/extensions/gis/projections/proj/cea.hpp>
#include <boost/geometry/extensions/gis/projections/proj/chamb.hpp> // control points XY
#include <boost/geometry/extensions/gis/projections/proj/chamb.hpp>
#include <boost/geometry/extensions/gis/projections/proj/collg.hpp>
#include <boost/geometry/extensions/gis/projections/proj/crast.hpp>
#include <boost/geometry/extensions/gis/projections/proj/denoy.hpp>
@@ -39,6 +39,7 @@
#include <boost/geometry/extensions/gis/projections/proj/eck5.hpp>
#include <boost/geometry/extensions/gis/projections/proj/eqc.hpp>
#include <boost/geometry/extensions/gis/projections/proj/eqdc.hpp>
#include <boost/geometry/extensions/gis/projections/proj/etmerc.hpp>
#include <boost/geometry/extensions/gis/projections/proj/fahey.hpp>
#include <boost/geometry/extensions/gis/projections/proj/fouc_s.hpp>
#include <boost/geometry/extensions/gis/projections/proj/gall.hpp>
@@ -47,12 +48,14 @@
#include <boost/geometry/extensions/gis/projections/proj/gins8.hpp>
#include <boost/geometry/extensions/gis/projections/proj/gn_sinu.hpp>
#include <boost/geometry/extensions/gis/projections/proj/gnom.hpp>
#include <boost/geometry/extensions/gis/projections/proj/goode.hpp> // includes two other projections
#include <boost/geometry/extensions/gis/projections/proj/goode.hpp>
#include <boost/geometry/extensions/gis/projections/proj/gstmerc.hpp>
#include <boost/geometry/extensions/gis/projections/proj/hammer.hpp>
#include <boost/geometry/extensions/gis/projections/proj/hatano.hpp>
#include <boost/geometry/extensions/gis/projections/proj/krovak.hpp>
#include <boost/geometry/extensions/gis/projections/proj/imw_p.hpp> // xy functions after inverse
#include <boost/geometry/extensions/gis/projections/proj/igh.hpp>
#include <boost/geometry/extensions/gis/projections/proj/imw_p.hpp>
#include <boost/geometry/extensions/gis/projections/proj/isea.hpp>
#include <boost/geometry/extensions/gis/projections/proj/laea.hpp>
#include <boost/geometry/extensions/gis/projections/proj/labrd.hpp>
#include <boost/geometry/extensions/gis/projections/proj/lagrng.hpp>
@@ -76,11 +79,12 @@
#include <boost/geometry/extensions/gis/projections/proj/nocol.hpp>
#include <boost/geometry/extensions/gis/projections/proj/nsper.hpp>
#include <boost/geometry/extensions/gis/projections/proj/nzmg.hpp>
#include <boost/geometry/extensions/gis/projections/proj/ob_tran.hpp> // includes other projection
#include <boost/geometry/extensions/gis/projections/proj/ob_tran.hpp>
#include <boost/geometry/extensions/gis/projections/proj/ocea.hpp>
#include <boost/geometry/extensions/gis/projections/proj/oea.hpp>
#include <boost/geometry/extensions/gis/projections/proj/omerc.hpp>
#include <boost/geometry/extensions/gis/projections/proj/ortho.hpp>
#include <boost/geometry/extensions/gis/projections/proj/qsc.hpp>
#include <boost/geometry/extensions/gis/projections/proj/poly.hpp>
#include <boost/geometry/extensions/gis/projections/proj/putp2.hpp>
#include <boost/geometry/extensions/gis/projections/proj/putp3.hpp>
@@ -160,6 +164,7 @@ public:
detail::eck5_init(*this);
detail::eqc_init(*this);
detail::eqdc_init(*this);
detail::etmerc_init(*this);
detail::fahey_init(*this);
detail::fouc_s_init(*this);
detail::gall_init(*this);
@@ -173,7 +178,9 @@ public:
detail::hammer_init(*this);
detail::hatano_init(*this);
detail::krovak_init(*this);
detail::igh_init(*this);
detail::imw_p_init(*this);
detail::isea_init(*this);
detail::labrd_init(*this);
detail::laea_init(*this);
detail::lagrng_init(*this);
@@ -202,6 +209,7 @@ public:
detail::oea_init(*this);
detail::omerc_init(*this);
detail::ortho_init(*this);
detail::qsc_init(*this);
detail::poly_init(*this);
detail::putp2_init(*this);
detail::putp3_init(*this);

View File

@@ -11,7 +11,6 @@
#include <string>
#include <boost/concept_check.hpp>
#include <boost/geometry/extensions/gis/projections/projection.hpp>
@@ -35,7 +34,9 @@ public:
base_v_f(P const& params) : m_proj(params) {}
virtual P params() const {return m_proj.params();}
virtual P const& params() const { return m_proj.params(); }
virtual P& mutable_params() { return m_proj.mutable_params(); }
virtual bool forward(LL const& ll, XY& xy) const
{
@@ -47,20 +48,13 @@ public:
m_proj.fwd(lp_lon, lp_lat, xy_x, xy_y);
}
virtual bool inverse(XY const& xy, LL& ll) const
virtual bool inverse(XY const& , LL& ) const
{
boost::ignore_unused_variable_warning(xy);
boost::ignore_unused_variable_warning(ll);
// exception?
return false;
}
virtual void inv(XY_T& xy_x, XY_T& xy_y, LL_T& lp_lon, LL_T& lp_lat) const
virtual void inv(XY_T& , XY_T& , LL_T& , LL_T& ) const
{
boost::ignore_unused_variable_warning(xy_x);
boost::ignore_unused_variable_warning(xy_y);
boost::ignore_unused_variable_warning(lp_lon);
boost::ignore_unused_variable_warning(lp_lat);
// exception?
}

View File

@@ -41,7 +41,9 @@ public:
: m_par(params), m_prj(prj)
{}
inline P params() const {return m_par;}
inline P const& params() const { return m_par; }
inline P& mutable_params() { return m_par; }
inline bool forward(LL const& lp, XY& xy) const
{

View File

@@ -53,7 +53,7 @@ static const double P20 = .01641501294219154443;
static const int APA_SIZE = 3;
/* determine latitude from authalic latitude */
inline void pj_authset(double es, double* APA)
inline bool pj_authset(double es, double* APA)
{
BOOST_ASSERT(0 != APA);
@@ -70,6 +70,7 @@ inline void pj_authset(double es, double* APA)
APA[1] += t * P11;
APA[2] = t * P20;
}
return true;
}
inline double pj_authlat(double beta, const double* APA)

View File

@@ -71,7 +71,7 @@ namespace detail
/* large enough to hold projection specific parameters. */
/************************************************************************/
template <typename R>
parameters pj_init(R const& arguments, bool use_defaults = true)
inline parameters pj_init(R const& arguments, bool use_defaults = true)
{
parameters pin;
for (std::vector<std::string>::const_iterator it = boost::begin(arguments);

View File

@@ -56,7 +56,7 @@ namespace inv
/* inverse projection entry */
template <typename PRJ, typename LL, typename XY, typename PAR>
void pj_inv(PRJ const& prj, PAR const& par, XY const& xy, LL& ll)
inline void pj_inv(PRJ const& prj, PAR const& par, XY const& xy, LL& ll)
{
/* can't do as much preliminary checking as with forward */
/* descale and de-offset */

View File

@@ -65,7 +65,7 @@ static const double EPS = 1e-11;
static const int MAX_ITER = 10;
static const int EN_SIZE = 5;
inline void pj_enfn(double es, double* en)
inline bool pj_enfn(double es, double* en)
{
double t; //, *en;
@@ -78,6 +78,7 @@ inline void pj_enfn(double es, double* en)
en[4] = t * es * C88;
}
// return en;
return true;
}
inline double pj_mlfn(double phi, double sphi, double cphi, const double *en)

View File

@@ -53,7 +53,7 @@ namespace detail
double b[MDIST_MAX_ITER];
};
inline void proj_mdist_ini(double es, MDIST& b)
inline bool proj_mdist_ini(double es, MDIST& b)
{
double numf, numfi, twon1, denf, denfi, ens, T, twon;
double den, El, Es;
@@ -97,6 +97,7 @@ namespace detail
numfi += 2.;
denfi += 2.;
}
return true;
}
inline double proj_mdist(double phi, double sphi, double cphi, const MDIST& b)
{

View File

@@ -39,7 +39,6 @@
#include <string>
#include <vector>
#include <boost/concept_check.hpp>
#include <boost/math/constants/constants.hpp>
namespace boost { namespace geometry { namespace projections
@@ -176,9 +175,12 @@ class proj_exception
public:
proj_exception(int code = 0)
: m_code(code)
{
boost::ignore_unused_variable_warning(code);
}
int code() const { return m_code; }
private :
int m_code;
};
}}} // namespace boost::geometry::projections

View File

@@ -4,7 +4,7 @@
// Boost.Geometry - extensions-gis-projections (based on PROJ4)
// This file is automatically generated. DO NOT EDIT.
// Copyright (c) 2008-2012 Barend Gehrels, Amsterdam, the Netherlands.
// Copyright (c) 2008-2015 Barend Gehrels, Amsterdam, the Netherlands.
// Use, modification and distribution is subject to the Boost Software License,
// Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
@@ -15,6 +15,8 @@
// PROJ4 is maintained by Frank Warmerdam
// PROJ4 is converted to Boost.Geometry by Barend Gehrels
// Last updated version of proj: 4.9.1
// Original copyright notice:
// Permission is hereby granted, free of charge, to any person obtaining a
@@ -35,23 +37,23 @@
// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
// DEALINGS IN THE SOFTWARE.
#include <boost/concept_check.hpp>
#include <boost/math/special_functions/hypot.hpp>
#include <boost/geometry/extensions/gis/projections/impl/base_static.hpp>
#include <boost/geometry/extensions/gis/projections/impl/base_dynamic.hpp>
#include <boost/geometry/extensions/gis/projections/impl/projects.hpp>
#include <boost/geometry/extensions/gis/projections/impl/factory_entry.hpp>
#include <boost/geometry/extensions/gis/projections/impl/pj_mlfn.hpp>
#include <boost/geometry/extensions/gis/projections/impl/pj_msfn.hpp>
#include <boost/geometry/extensions/gis/projections/impl/pj_qsfn.hpp>
#include <boost/geometry/extensions/gis/projections/impl/pj_mlfn.hpp>
#include <boost/geometry/extensions/gis/projections/epsg_traits.hpp>
namespace boost { namespace geometry { namespace projections
{
#ifndef DOXYGEN_NO_DETAIL
namespace detail { namespace aea{
namespace detail { namespace aea{
static const double EPS10 = 1.e-10;
static const double TOL7 = 1.e-7;
static const int N_ITER = 15;
@@ -72,17 +74,13 @@ namespace boost { namespace geometry { namespace projections
double en[EN_SIZE];
int ellips;
};
/* determine latitude angle phi-1 */
inline double
phi1_(double qs, double Te, double Tone_es) {
int i;
double Phi, sinpi, cospi, con, com, dphi;
Phi = asin (.5 * qs);
if (Te < EPSILON)
return( Phi );
@@ -155,21 +153,22 @@ namespace boost { namespace geometry { namespace projections
template <typename Parameters>
void setup(Parameters& par, par_aea& proj_parm)
{
boost::ignore_unused_variable_warning(par);
boost::ignore_unused_variable_warning(proj_parm);
double cosphi, sinphi;
int secant;
if (fabs(proj_parm.phi1 + proj_parm.phi2) < EPS10) throw proj_exception(-21);
proj_parm.n = sinphi = sin(proj_parm.phi1);
cosphi = cos(proj_parm.phi1);
secant = fabs(proj_parm.phi1 - proj_parm.phi2) >= EPS10;
if( (proj_parm.ellips = (par.es > 0.))) {
double ml1, m1;
pj_enfn(par.es, proj_parm.en);
if (!pj_enfn(par.es, proj_parm.en)) throw proj_exception(0);
m1 = pj_msfn(sinphi, cosphi, par.es);
ml1 = pj_qsfn(sinphi, par.e, par.one_es);
if (secant) { /* secant cone */
double ml2, m2;
sinphi = sin(proj_parm.phi2);
cosphi = cos(proj_parm.phi2);
m2 = pj_msfn(sinphi, cosphi, par.es);
@@ -189,8 +188,6 @@ namespace boost { namespace geometry { namespace projections
proj_parm.dd = 1. / proj_parm.n;
proj_parm.rho0 = proj_parm.dd * sqrt(proj_parm.c - proj_parm.n2 * sin(par.phi0));
}
// par.inv = e_inverse;
// par.fwd = e_forward;
}
@@ -213,7 +210,7 @@ namespace boost { namespace geometry { namespace projections
}
}} // namespace detail::aea
#endif // doxygen
#endif // doxygen
/*!
\brief Albers Equal Area projection
@@ -293,7 +290,7 @@ namespace boost { namespace geometry { namespace projections
factory.add_to_factory("leac", new leac_entry<Geographic, Cartesian, Parameters>);
}
} // namespace detail
} // namespace detail
// Create EPSG specializations
// (Proof of Concept, only for some)

View File

@@ -4,7 +4,7 @@
// Boost.Geometry - extensions-gis-projections (based on PROJ4)
// This file is automatically generated. DO NOT EDIT.
// Copyright (c) 2008-2012 Barend Gehrels, Amsterdam, the Netherlands.
// Copyright (c) 2008-2015 Barend Gehrels, Amsterdam, the Netherlands.
// Use, modification and distribution is subject to the Boost Software License,
// Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
@@ -15,6 +15,8 @@
// PROJ4 is maintained by Frank Warmerdam
// PROJ4 is converted to Boost.Geometry by Barend Gehrels
// Last updated version of proj: 4.9.1
// Original copyright notice:
// Permission is hereby granted, free of charge, to any person obtaining a
@@ -35,6 +37,7 @@
// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
// DEALINGS IN THE SOFTWARE.
#include <boost/math/special_functions/hypot.hpp>
#include <boost/geometry/extensions/gis/projections/impl/base_static.hpp>
@@ -43,12 +46,11 @@
#include <boost/geometry/extensions/gis/projections/impl/factory_entry.hpp>
#include <boost/geometry/extensions/gis/projections/impl/aasincos.hpp>
#include <boost/geometry/extensions/gis/projections/impl/pj_mlfn.hpp>
#include <boost/geometry/extensions/gis/projections/impl/proj_mdist.hpp>
namespace boost { namespace geometry { namespace projections
{
#ifndef DOXYGEN_NO_DETAIL
namespace detail { namespace aeqd{
namespace detail { namespace aeqd{
static const double EPS10 = 1.e-10;
static const double TOL = 1.e-14;
static const int N_POLE = 0;
@@ -68,11 +70,6 @@ namespace boost { namespace geometry { namespace projections
double G;
int mode;
};
// template class, using CRTP to implement forward/inverse
template <typename Geographic, typename Cartesian, typename Parameters>
@@ -92,7 +89,7 @@ namespace boost { namespace geometry { namespace projections
inline void fwd(geographic_type& lp_lon, geographic_type& lp_lat, cartesian_type& xy_x, cartesian_type& xy_y) const
{
double coslam, cosphi, sinphi, rho, s, H, H2, c, Az, t, ct, st, cA, sA;
coslam = cos(lp_lon);
cosphi = cos(lp_lat);
sinphi = sin(lp_lat);
@@ -115,7 +112,7 @@ namespace boost { namespace geometry { namespace projections
ct = cos(t); st = sin(t);
Az = atan2(sin(lp_lon) * ct, this->m_proj_parm.cosph0 * st - this->m_proj_parm.sinph0 * coslam * ct);
cA = cos(Az); sA = sin(Az);
s = aasin( fabs(sA) < TOL ?
s = aasin(fabs(sA) < TOL ?
(this->m_proj_parm.cosph0 * st - this->m_proj_parm.sinph0 * coslam * ct) / cA :
sin(lp_lon) * ct / sA );
H = this->m_proj_parm.He * cA;
@@ -133,7 +130,7 @@ namespace boost { namespace geometry { namespace projections
inline void inv(cartesian_type& xy_x, cartesian_type& xy_y, geographic_type& lp_lon, geographic_type& lp_lat) const
{
double c, Az, cosAz, A, B, D, E, F, psi, t;
if ((c = boost::math::hypot(xy_x, xy_y)) < EPS10) {
lp_lat = this->m_par.phi0;
lp_lon = 0.;
@@ -183,7 +180,7 @@ namespace boost { namespace geometry { namespace projections
inline void fwd(geographic_type& lp_lon, geographic_type& lp_lat, cartesian_type& xy_x, cartesian_type& xy_y) const
{
double cosphi, sinphi, t;
cosphi = cos(lp_lat);
sinphi = sin(lp_lat);
t = 1. / sqrt(1. - this->m_par.es * sinphi * sinphi);
@@ -196,7 +193,7 @@ namespace boost { namespace geometry { namespace projections
{
double x2, t;
int i;
x2 = 0.5 * xy_x * xy_x;
lp_lat = this->m_par.phi0;
for (i = 0; i < 3; ++i) {
@@ -226,7 +223,7 @@ namespace boost { namespace geometry { namespace projections
inline void fwd(geographic_type& lp_lon, geographic_type& lp_lat, cartesian_type& xy_x, cartesian_type& xy_y) const
{
double coslam, cosphi, sinphi;
sinphi = sin(lp_lat);
cosphi = cos(lp_lat);
coslam = cos(lp_lon);
@@ -239,7 +236,7 @@ namespace boost { namespace geometry { namespace projections
oblcon:
if (fabs(fabs(xy_y) - 1.) < TOL)
if (xy_y < 0.)
throw proj_exception();
throw proj_exception();
else
xy_x = xy_y = 0.;
else {
@@ -264,7 +261,7 @@ namespace boost { namespace geometry { namespace projections
inline void inv(cartesian_type& xy_x, cartesian_type& xy_y, geographic_type& lp_lon, geographic_type& lp_lat) const
{
double cosc, c_rh, sinc;
if ((c_rh = boost::math::hypot(xy_x, xy_y)) > PI) {
if (c_rh - EPS10 > PI) throw proj_exception();;
c_rh = PI;
@@ -286,7 +283,7 @@ namespace boost { namespace geometry { namespace projections
xy_y = (cosc - this->m_proj_parm.sinph0 * sin(lp_lat)) * c_rh;
xy_x *= sinc * this->m_proj_parm.cosph0;
}
lp_lon = xy_y == 0. ? 0. : atan2(xy_x, xy_y);
lp_lon = atan2(xy_x, xy_y);
} else if (this->m_proj_parm.mode == N_POLE) {
lp_lat = HALFPI - c_rh;
lp_lon = atan2(xy_x, -xy_y);
@@ -316,14 +313,10 @@ namespace boost { namespace geometry { namespace projections
proj_parm.cosph0 = cos(par.phi0);
}
if (! par.es) {
// par.inv = s_inverse;
// par.fwd = s_forward;
} else {
pj_enfn(par.es, proj_parm.en);
if (!pj_enfn(par.es, proj_parm.en)) throw proj_exception(0);
if (pj_param(par.params, "bguam").i) {
proj_parm.M1 = pj_mlfn(par.phi0, proj_parm.sinph0, proj_parm.cosph0, proj_parm.en);
// par.inv = e_guam_inv;
// par.fwd = e_guam_fwd;
} else {
switch (proj_parm.mode) {
case N_POLE:
@@ -334,21 +327,17 @@ namespace boost { namespace geometry { namespace projections
break;
case EQUIT:
case OBLIQ:
// par.inv = e_inverse;
// par.fwd = e_forward;
proj_parm.N1 = 1. / sqrt(1. - par.es * proj_parm.sinph0 * proj_parm.sinph0);
proj_parm.G = proj_parm.sinph0 * (proj_parm.He = par.e / sqrt(par.one_es));
proj_parm.He *= proj_parm.cosph0;
break;
}
// par.inv = e_inverse;
// par.fwd = e_forward;
}
}
}
}} // namespace detail::aeqd
#endif // doxygen
#endif // doxygen
/*!
\brief Azimuthal Equidistant projection
@@ -445,7 +434,7 @@ namespace boost { namespace geometry { namespace projections
factory.add_to_factory("aeqd", new aeqd_entry<Geographic, Cartesian, Parameters>);
}
} // namespace detail
} // namespace detail
#endif // doxygen
}}} // namespace boost::geometry::projections

View File

@@ -4,7 +4,7 @@
// Boost.Geometry - extensions-gis-projections (based on PROJ4)
// This file is automatically generated. DO NOT EDIT.
// Copyright (c) 2008-2012 Barend Gehrels, Amsterdam, the Netherlands.
// Copyright (c) 2008-2015 Barend Gehrels, Amsterdam, the Netherlands.
// Use, modification and distribution is subject to the Boost Software License,
// Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
@@ -15,6 +15,8 @@
// PROJ4 is maintained by Frank Warmerdam
// PROJ4 is converted to Boost.Geometry by Barend Gehrels
// Last updated version of proj: 4.9.1
// Original copyright notice:
// Permission is hereby granted, free of charge, to any person obtaining a
@@ -35,7 +37,6 @@
// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
// DEALINGS IN THE SOFTWARE.
#include <boost/math/special_functions/hypot.hpp>
#include <boost/geometry/extensions/gis/projections/impl/base_static.hpp>
#include <boost/geometry/extensions/gis/projections/impl/base_dynamic.hpp>
@@ -45,7 +46,7 @@
namespace boost { namespace geometry { namespace projections
{
#ifndef DOXYGEN_NO_DETAIL
namespace detail { namespace airy{
namespace detail { namespace airy{
static const double EPS = 1.e-10;
static const int N_POLE = 0;
static const int S_POLE = 1;
@@ -61,10 +62,6 @@ namespace boost { namespace geometry { namespace projections
int mode;
int no_cut; /* do not cut at hemisphere limit */
};
// template class, using CRTP to implement forward/inverse
template <typename Geographic, typename Cartesian, typename Parameters>
@@ -84,7 +81,7 @@ namespace boost { namespace geometry { namespace projections
inline void fwd(geographic_type& lp_lon, geographic_type& lp_lat, cartesian_type& xy_x, cartesian_type& xy_y) const
{
double sinlam, coslam, cosphi, sinphi, t, s, Krho, cosz;
sinlam = sin(lp_lon);
coslam = cos(lp_lon);
switch (this->m_proj_parm.mode) {
@@ -132,6 +129,7 @@ namespace boost { namespace geometry { namespace projections
void setup_airy(Parameters& par, par_airy& proj_parm)
{
double beta;
proj_parm.no_cut = pj_param(par.params, "bno_cut").i;
beta = 0.5 * (HALFPI - pj_param(par.params, "rlat_b").f);
if (fabs(beta) < EPS)
@@ -157,12 +155,11 @@ namespace boost { namespace geometry { namespace projections
proj_parm.cosph0 = cos(par.phi0);
}
}
// par.fwd = s_forward;
par.es = 0.;
}
}} // namespace detail::airy
#endif // doxygen
#endif // doxygen
/*!
\brief Airy projection
@@ -208,7 +205,7 @@ namespace boost { namespace geometry { namespace projections
factory.add_to_factory("airy", new airy_entry<Geographic, Cartesian, Parameters>);
}
} // namespace detail
} // namespace detail
#endif // doxygen
}}} // namespace boost::geometry::projections

View File

@@ -4,7 +4,7 @@
// Boost.Geometry - extensions-gis-projections (based on PROJ4)
// This file is automatically generated. DO NOT EDIT.
// Copyright (c) 2008-2012 Barend Gehrels, Amsterdam, the Netherlands.
// Copyright (c) 2008-2015 Barend Gehrels, Amsterdam, the Netherlands.
// Use, modification and distribution is subject to the Boost Software License,
// Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
@@ -15,6 +15,8 @@
// PROJ4 is maintained by Frank Warmerdam
// PROJ4 is converted to Boost.Geometry by Barend Gehrels
// Last updated version of proj: 4.9.1
// Original copyright notice:
// Permission is hereby granted, free of charge, to any person obtaining a
@@ -35,8 +37,8 @@
// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
// DEALINGS IN THE SOFTWARE.
#include <boost/concept_check.hpp>
#include <boost/math/special_functions/hypot.hpp>
#include <boost/core/ignore_unused.hpp>
#include <boost/geometry/extensions/gis/projections/impl/base_static.hpp>
#include <boost/geometry/extensions/gis/projections/impl/base_dynamic.hpp>
@@ -46,21 +48,17 @@
namespace boost { namespace geometry { namespace projections
{
#ifndef DOXYGEN_NO_DETAIL
namespace detail { namespace aitoff{
namespace detail { namespace aitoff{
struct par_aitoff
{
double cosphi1;
int mode;
};
// template class, using CRTP to implement forward/inverse
template <typename Geographic, typename Cartesian, typename Parameters>
struct base_aitoff_spheroid : public base_t_f<base_aitoff_spheroid<Geographic, Cartesian, Parameters>,
struct base_aitoff_spheroid : public base_t_fi<base_aitoff_spheroid<Geographic, Cartesian, Parameters>,
Geographic, Cartesian, Parameters>
{
@@ -70,13 +68,13 @@ namespace boost { namespace geometry { namespace projections
par_aitoff m_proj_parm;
inline base_aitoff_spheroid(const Parameters& par)
: base_t_f<base_aitoff_spheroid<Geographic, Cartesian, Parameters>,
: base_t_fi<base_aitoff_spheroid<Geographic, Cartesian, Parameters>,
Geographic, Cartesian, Parameters>(*this, par) {}
inline void fwd(geographic_type& lp_lon, geographic_type& lp_lat, cartesian_type& xy_x, cartesian_type& xy_y) const
{
double c, d;
if((d = acos(cos(lp_lat) * cos(c = 0.5 * lp_lon)))) {/* basic Aitoff */
xy_x = 2. * d * cos(lp_lat) * sin(c) * (xy_y = 1. / sin(d));
xy_y *= d * sin(lp_lat);
@@ -87,15 +85,90 @@ namespace boost { namespace geometry { namespace projections
xy_y = (xy_y + lp_lat) * 0.5;
}
}
/***********************************************************************************
*
* Inverse functions added by Drazen Tutic and Lovro Gradiser based on paper:
*
* I.Özbug Biklirici and Cengizhan Ipbüker. A General Algorithm for the Inverse
* Transformation of Map Projections Using Jacobian Matrices. In Proceedings of the
* Third International Symposium Mathematical & Computational Applications,
* pages 175{182, Turkey, September 2002.
*
* Expected accuracy is defined by EPSILON = 1e-12. Should be appropriate for
* most applications of Aitoff and Winkel Tripel projections.
*
* Longitudes of 180W and 180E can be mixed in solution obtained.
*
* Inverse for Aitoff projection in poles is undefined, longitude value of 0 is assumed.
*
* Contact : dtutic@geof.hr
* Date: 2015-02-16
*
************************************************************************************/
inline void inv(cartesian_type& xy_x, cartesian_type& xy_y, geographic_type& lp_lon, geographic_type& lp_lat) const
{
int iter, MAXITER = 10, round = 0, MAXROUND = 20;
double EPSILON = 1e-12, D, C, f1, f2, f1p, f1l, f2p, f2l, dp, dl, sl, sp, cp, cl, x, y;
if ((fabs(xy_x) < EPSILON) && (fabs(xy_y) < EPSILON )) { lp_lat = 0.; lp_lon = 0.; return; }
/* intial values for Newton-Raphson method */
lp_lat = xy_y; lp_lon = xy_x;
do {
iter = 0;
do {
sl = sin(lp_lon * 0.5); cl = cos(lp_lon * 0.5);
sp = sin(lp_lat); cp = cos(lp_lat);
D = cp * cl;
C = 1. - D * D;
D = acos(D) / pow(C, 1.5);
f1 = 2. * D * C * cp * sl;
f2 = D * C * sp;
f1p = 2.* (sl * cl * sp * cp / C - D * sp * sl);
f1l = cp * cp * sl * sl / C + D * cp * cl * sp * sp;
f2p = sp * sp * cl / C + D * sl * sl * cp;
f2l = 0.5 * (sp * cp * sl / C - D * sp * cp * cp * sl * cl);
if (this->m_proj_parm.mode) { /* Winkel Tripel */
f1 = 0.5 * (f1 + lp_lon * this->m_proj_parm.cosphi1);
f2 = 0.5 * (f2 + lp_lat);
f1p *= 0.5;
f1l = 0.5 * (f1l + this->m_proj_parm.cosphi1);
f2p = 0.5 * (f2p + 1.);
f2l *= 0.5;
}
f1 -= xy_x; f2 -= xy_y;
dl = (f2 * f1p - f1 * f2p) / (dp = f1p * f2l - f2p * f1l);
dp = (f1 * f2l - f2 * f1l) / dp;
while (dl > boost::math::constants::pi<double>()) dl -= boost::math::constants::pi<double>(); /* set to interval [-boost::math::constants::pi<double>(), boost::math::constants::pi<double>()] */
while (dl < -boost::math::constants::pi<double>()) dl += boost::math::constants::pi<double>(); /* set to interval [-boost::math::constants::pi<double>(), boost::math::constants::pi<double>()] */
lp_lat -= dp; lp_lon -= dl;
} while ((fabs(dp) > EPSILON || fabs(dl) > EPSILON) && (iter++ < MAXITER));
if (lp_lat > (2.0 * boost::math::constants::pi<double>())) lp_lat -= 2.*(lp_lat-(2.0 * boost::math::constants::pi<double>())); /* correct if symmetrical solution for Aitoff */
if (lp_lat < -(2.0 * boost::math::constants::pi<double>())) lp_lat -= 2.*(lp_lat+(2.0 * boost::math::constants::pi<double>())); /* correct if symmetrical solution for Aitoff */
if ((fabs(fabs(lp_lat) - (2.0 * boost::math::constants::pi<double>())) < EPSILON) && (!this->m_proj_parm.mode)) lp_lon = 0.; /* if pole in Aitoff, return longitude of 0 */
/* calculate x,y coordinates with solution obtained */
if((D = acos(cos(lp_lat) * cos(C = 0.5 * lp_lon)))) {/* Aitoff */
x = 2. * D * cos(lp_lat) * sin(C) * (y = 1. / sin(D));
y *= D * sin(lp_lat);
} else
x = y = 0.;
if (this->m_proj_parm.mode) { /* Winkel Tripel */
x = (x + lp_lon * this->m_proj_parm.cosphi1) * 0.5;
y = (y + lp_lat) * 0.5;
}
/* if too far from given values of x,y, repeat with better approximation of phi,lam */
} while (((fabs(xy_x-x) > EPSILON) || (fabs(xy_y-y) > EPSILON)) && (round++ < MAXROUND));
if (iter == MAXITER && round == MAXROUND) fprintf(stderr, "Warning: Accuracy of 1e-12 not reached. Last increments: dlat=%e and dlon=%e\n", dp, dl);
}
};
template <typename Parameters>
void setup(Parameters& par, par_aitoff& proj_parm)
{
boost::ignore_unused_variable_warning(par);
boost::ignore_unused_variable_warning(proj_parm);
// par.inv = 0;
// par.fwd = s_forward;
boost::ignore_unused(proj_parm);
par.es = 0.;
}
@@ -124,7 +197,7 @@ namespace boost { namespace geometry { namespace projections
}
}} // namespace detail::aitoff
#endif // doxygen
#endif // doxygen
/*!
\brief Aitoff projection
@@ -180,7 +253,7 @@ namespace boost { namespace geometry { namespace projections
public :
virtual projection<Geographic, Cartesian>* create_new(const Parameters& par) const
{
return new base_v_f<aitoff_spheroid<Geographic, Cartesian, Parameters>, Geographic, Cartesian, Parameters>(par);
return new base_v_fi<aitoff_spheroid<Geographic, Cartesian, Parameters>, Geographic, Cartesian, Parameters>(par);
}
};
@@ -190,7 +263,7 @@ namespace boost { namespace geometry { namespace projections
public :
virtual projection<Geographic, Cartesian>* create_new(const Parameters& par) const
{
return new base_v_f<wintri_spheroid<Geographic, Cartesian, Parameters>, Geographic, Cartesian, Parameters>(par);
return new base_v_fi<wintri_spheroid<Geographic, Cartesian, Parameters>, Geographic, Cartesian, Parameters>(par);
}
};
@@ -201,7 +274,7 @@ namespace boost { namespace geometry { namespace projections
factory.add_to_factory("wintri", new wintri_entry<Geographic, Cartesian, Parameters>);
}
} // namespace detail
} // namespace detail
#endif // doxygen
}}} // namespace boost::geometry::projections

View File

@@ -4,7 +4,7 @@
// Boost.Geometry - extensions-gis-projections (based on PROJ4)
// This file is automatically generated. DO NOT EDIT.
// Copyright (c) 2008-2012 Barend Gehrels, Amsterdam, the Netherlands.
// Copyright (c) 2008-2015 Barend Gehrels, Amsterdam, the Netherlands.
// Use, modification and distribution is subject to the Boost Software License,
// Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
@@ -15,6 +15,8 @@
// PROJ4 is maintained by Frank Warmerdam
// PROJ4 is converted to Boost.Geometry by Barend Gehrels
// Last updated version of proj: 4.9.1
// Original copyright notice:
// Permission is hereby granted, free of charge, to any person obtaining a
@@ -35,7 +37,6 @@
// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
// DEALINGS IN THE SOFTWARE.
#include <boost/math/special_functions/hypot.hpp>
#include <boost/geometry/extensions/gis/projections/impl/base_static.hpp>
#include <boost/geometry/extensions/gis/projections/impl/base_dynamic.hpp>
@@ -45,10 +46,9 @@
namespace boost { namespace geometry { namespace projections
{
#ifndef DOXYGEN_NO_DETAIL
namespace detail { namespace august{
namespace detail { namespace august{
static const double M = 1.333333333333333;
// template class, using CRTP to implement forward/inverse
template <typename Geographic, typename Cartesian, typename Parameters>
struct base_august_spheroid : public base_t_f<base_august_spheroid<Geographic, Cartesian, Parameters>,
@@ -66,7 +66,7 @@ namespace boost { namespace geometry { namespace projections
inline void fwd(geographic_type& lp_lon, geographic_type& lp_lat, cartesian_type& xy_x, cartesian_type& xy_y) const
{
double t, c1, c, x1, x12, y1, y12;
t = tan(.5 * lp_lat);
c1 = sqrt(1. - t * t);
c = 1. + c1 * cos(lp_lon *= .5);
@@ -81,13 +81,11 @@ namespace boost { namespace geometry { namespace projections
template <typename Parameters>
void setup_august(Parameters& par)
{
// par.inv = 0;
// par.fwd = s_forward;
par.es = 0.;
}
}} // namespace detail::august
#endif // doxygen
#endif // doxygen
/*!
\brief August Epicycloidal projection
@@ -132,7 +130,7 @@ namespace boost { namespace geometry { namespace projections
factory.add_to_factory("august", new august_entry<Geographic, Cartesian, Parameters>);
}
} // namespace detail
} // namespace detail
#endif // doxygen
}}} // namespace boost::geometry::projections

View File

@@ -4,7 +4,7 @@
// Boost.Geometry - extensions-gis-projections (based on PROJ4)
// This file is automatically generated. DO NOT EDIT.
// Copyright (c) 2008-2012 Barend Gehrels, Amsterdam, the Netherlands.
// Copyright (c) 2008-2015 Barend Gehrels, Amsterdam, the Netherlands.
// Use, modification and distribution is subject to the Boost Software License,
// Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
@@ -15,6 +15,8 @@
// PROJ4 is maintained by Frank Warmerdam
// PROJ4 is converted to Boost.Geometry by Barend Gehrels
// Last updated version of proj: 4.9.1
// Original copyright notice:
// Permission is hereby granted, free of charge, to any person obtaining a
@@ -35,7 +37,6 @@
// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
// DEALINGS IN THE SOFTWARE.
#include <boost/math/special_functions/hypot.hpp>
#include <boost/geometry/extensions/gis/projections/impl/base_static.hpp>
#include <boost/geometry/extensions/gis/projections/impl/base_dynamic.hpp>
@@ -45,7 +46,7 @@
namespace boost { namespace geometry { namespace projections
{
#ifndef DOXYGEN_NO_DETAIL
namespace detail { namespace bacon{
namespace detail { namespace bacon{
static const double HLFPI2 = 2.46740110027233965467;
static const double EPS = 1e-10;
@@ -73,7 +74,7 @@ namespace boost { namespace geometry { namespace projections
inline void fwd(geographic_type& lp_lon, geographic_type& lp_lat, cartesian_type& xy_x, cartesian_type& xy_y) const
{
double ax, f;
xy_y = this->m_proj_parm.bacn ? HALFPI * sin(lp_lat) : lp_lat;
if ((ax = fabs(lp_lon)) >= EPS) {
if (this->m_proj_parm.ortl && ax >= HALFPI)
@@ -94,7 +95,6 @@ namespace boost { namespace geometry { namespace projections
{
proj_parm.bacn = proj_parm.ortl = 0;
par.es = 0.;
// par.fwd = s_forward;
}
// Ortelius Oval
@@ -104,7 +104,6 @@ namespace boost { namespace geometry { namespace projections
proj_parm.bacn = 0;
proj_parm.ortl = 1;
par.es = 0.;
// par.fwd = s_forward;
}
// Bacon Globular
@@ -114,11 +113,10 @@ namespace boost { namespace geometry { namespace projections
proj_parm.bacn = 1;
proj_parm.ortl = 0;
par.es = 0.;
// par.fwd = s_forward;
}
}} // namespace detail::bacon
#endif // doxygen
#endif // doxygen
/*!
\brief Apian Globular I projection
@@ -229,7 +227,7 @@ namespace boost { namespace geometry { namespace projections
factory.add_to_factory("bacon", new bacon_entry<Geographic, Cartesian, Parameters>);
}
} // namespace detail
} // namespace detail
#endif // doxygen
}}} // namespace boost::geometry::projections

View File

@@ -4,7 +4,7 @@
// Boost.Geometry - extensions-gis-projections (based on PROJ4)
// This file is automatically generated. DO NOT EDIT.
// Copyright (c) 2008-2012 Barend Gehrels, Amsterdam, the Netherlands.
// Copyright (c) 2008-2015 Barend Gehrels, Amsterdam, the Netherlands.
// Use, modification and distribution is subject to the Boost Software License,
// Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
@@ -15,6 +15,8 @@
// PROJ4 is maintained by Frank Warmerdam
// PROJ4 is converted to Boost.Geometry by Barend Gehrels
// Last updated version of proj: 4.9.1
// Original copyright notice:
// Permission is hereby granted, free of charge, to any person obtaining a
@@ -35,6 +37,7 @@
// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
// DEALINGS IN THE SOFTWARE.
#include <boost/math/special_functions/hypot.hpp>
#include <boost/geometry/extensions/gis/projections/impl/base_static.hpp>
@@ -45,7 +48,7 @@
namespace boost { namespace geometry { namespace projections
{
#ifndef DOXYGEN_NO_DETAIL
namespace detail { namespace bipc{
namespace detail { namespace bipc{
static const double EPS = 1e-10;
static const double EPS10 = 1e-10;
static const double ONEEPS = 1.000000001;
@@ -90,7 +93,7 @@ namespace boost { namespace geometry { namespace projections
{
double cphi, sphi, tphi, t, al, Az, z, Av, cdlam, sdlam, r;
int tag;
cphi = cos(lp_lat);
sphi = sin(lp_lat);
cdlam = cos(sdlam = lamB - lp_lon);
@@ -140,8 +143,8 @@ namespace boost { namespace geometry { namespace projections
xy_y += (tag ? -r : r) * cos(t);
if (this->m_proj_parm.noskew) {
t = xy_x;
xy_x = -xy_x * cAzc - xy_y * sAzc;
xy_y = -xy_y * cAzc + t * sAzc;
xy_x = -xy_x * cAzc - xy_y * sAzc;
xy_y = -xy_y * cAzc + t * sAzc;
}
}
@@ -149,11 +152,11 @@ namespace boost { namespace geometry { namespace projections
{
double t, r, rp, rl, al, z, fAz, Az, s, c, Av;
int neg, i;
if (this->m_proj_parm.noskew) {
t = xy_x;
xy_x = -xy_x * cAzc + xy_y * sAzc;
xy_y = -xy_y * cAzc - t * sAzc;
xy_x = -xy_x * cAzc + xy_y * sAzc;
xy_y = -xy_y * cAzc - t * sAzc;
}
if( (neg = (xy_x < 0.)) ) {
xy_y = rhoc - xy_y;
@@ -194,13 +197,11 @@ namespace boost { namespace geometry { namespace projections
void setup_bipc(Parameters& par, par_bipc& proj_parm)
{
proj_parm.noskew = pj_param(par.params, "bns").i;
// par.inv = s_inverse;
// par.fwd = s_forward;
par.es = 0.;
}
}} // namespace detail::bipc
#endif // doxygen
#endif // doxygen
/*!
\brief Bipolar conic of western hemisphere projection
@@ -244,7 +245,7 @@ namespace boost { namespace geometry { namespace projections
factory.add_to_factory("bipc", new bipc_entry<Geographic, Cartesian, Parameters>);
}
} // namespace detail
} // namespace detail
#endif // doxygen
}}} // namespace boost::geometry::projections

View File

@@ -4,7 +4,7 @@
// Boost.Geometry - extensions-gis-projections (based on PROJ4)
// This file is automatically generated. DO NOT EDIT.
// Copyright (c) 2008-2012 Barend Gehrels, Amsterdam, the Netherlands.
// Copyright (c) 2008-2015 Barend Gehrels, Amsterdam, the Netherlands.
// Use, modification and distribution is subject to the Boost Software License,
// Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
@@ -15,6 +15,8 @@
// PROJ4 is maintained by Frank Warmerdam
// PROJ4 is converted to Boost.Geometry by Barend Gehrels
// Last updated version of proj: 4.9.1
// Original copyright notice:
// Permission is hereby granted, free of charge, to any person obtaining a
@@ -35,7 +37,6 @@
// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
// DEALINGS IN THE SOFTWARE.
#include <boost/math/special_functions/hypot.hpp>
#include <boost/geometry/extensions/gis/projections/impl/base_static.hpp>
#include <boost/geometry/extensions/gis/projections/impl/base_dynamic.hpp>
@@ -45,7 +46,7 @@
namespace boost { namespace geometry { namespace projections
{
#ifndef DOXYGEN_NO_DETAIL
namespace detail { namespace boggs{
namespace detail { namespace boggs{
static const int NITER = 20;
static const double EPS = 1e-7;
static const double ONETOL = 1.000001;
@@ -54,7 +55,6 @@ namespace boost { namespace geometry { namespace projections
static const double FYC = 0.49931;
static const double FYC2 = 1.41421356237309504880;
// template class, using CRTP to implement forward/inverse
template <typename Geographic, typename Cartesian, typename Parameters>
struct base_boggs_spheroid : public base_t_f<base_boggs_spheroid<Geographic, Cartesian, Parameters>,
@@ -73,7 +73,7 @@ namespace boost { namespace geometry { namespace projections
{
double theta, th1, c;
int i;
theta = lp_lat;
if (fabs(fabs(lp_lat) - HALFPI) < EPS)
xy_x = 0.;
@@ -96,11 +96,10 @@ namespace boost { namespace geometry { namespace projections
void setup_boggs(Parameters& par)
{
par.es = 0.;
// par.fwd = s_forward;
}
}} // namespace detail::boggs
#endif // doxygen
#endif // doxygen
/*!
\brief Boggs Eumorphic projection
@@ -145,7 +144,7 @@ namespace boost { namespace geometry { namespace projections
factory.add_to_factory("boggs", new boggs_entry<Geographic, Cartesian, Parameters>);
}
} // namespace detail
} // namespace detail
#endif // doxygen
}}} // namespace boost::geometry::projections

View File

@@ -4,7 +4,7 @@
// Boost.Geometry - extensions-gis-projections (based on PROJ4)
// This file is automatically generated. DO NOT EDIT.
// Copyright (c) 2008-2012 Barend Gehrels, Amsterdam, the Netherlands.
// Copyright (c) 2008-2015 Barend Gehrels, Amsterdam, the Netherlands.
// Use, modification and distribution is subject to the Boost Software License,
// Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
@@ -15,6 +15,8 @@
// PROJ4 is maintained by Frank Warmerdam
// PROJ4 is converted to Boost.Geometry by Barend Gehrels
// Last updated version of proj: 4.9.1
// Original copyright notice:
// Permission is hereby granted, free of charge, to any person obtaining a
@@ -35,6 +37,7 @@
// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
// DEALINGS IN THE SOFTWARE.
#include <boost/math/special_functions/hypot.hpp>
#include <boost/geometry/extensions/gis/projections/impl/base_static.hpp>
@@ -46,7 +49,7 @@
namespace boost { namespace geometry { namespace projections
{
#ifndef DOXYGEN_NO_DETAIL
namespace detail { namespace bonne{
namespace detail { namespace bonne{
static const double EPS10 = 1e-10;
struct par_bonne
@@ -76,7 +79,7 @@ namespace boost { namespace geometry { namespace projections
inline void fwd(geographic_type& lp_lon, geographic_type& lp_lat, cartesian_type& xy_x, cartesian_type& xy_y) const
{
double rh, E, c;
rh = this->m_proj_parm.am1 + this->m_proj_parm.m1 - pj_mlfn(lp_lat, E = sin(lp_lat), c = cos(lp_lat), this->m_proj_parm.en);
E = c * lp_lon / (rh * sqrt(1. - this->m_par.es * E * E));
xy_x = rh * sin(E);
@@ -86,7 +89,7 @@ namespace boost { namespace geometry { namespace projections
inline void inv(cartesian_type& xy_x, cartesian_type& xy_y, geographic_type& lp_lon, geographic_type& lp_lat) const
{
double s, rh;
rh = boost::math::hypot(xy_x, xy_y = this->m_proj_parm.am1 - xy_y);
lp_lat = pj_inv_mlfn(this->m_proj_parm.am1 + this->m_proj_parm.m1 - rh, this->m_par.es, this->m_proj_parm.en);
if ((s = fabs(lp_lat)) < HALFPI) {
@@ -117,7 +120,7 @@ namespace boost { namespace geometry { namespace projections
inline void fwd(geographic_type& lp_lon, geographic_type& lp_lat, cartesian_type& xy_x, cartesian_type& xy_y) const
{
double E, rh;
rh = this->m_proj_parm.cphi1 + this->m_proj_parm.phi1 - lp_lat;
if (fabs(rh) > EPS10) {
xy_x = rh * sin(E = lp_lon * cos(lp_lat) / rh);
@@ -129,7 +132,7 @@ namespace boost { namespace geometry { namespace projections
inline void inv(cartesian_type& xy_x, cartesian_type& xy_y, geographic_type& lp_lon, geographic_type& lp_lat) const
{
double rh;
rh = boost::math::hypot(xy_x, xy_y = this->m_proj_parm.cphi1 - xy_y);
lp_lat = this->m_proj_parm.cphi1 + this->m_proj_parm.phi1 - rh;
if (fabs(lp_lat) > HALFPI) throw proj_exception();;
@@ -145,6 +148,7 @@ namespace boost { namespace geometry { namespace projections
void setup_bonne(Parameters& par, par_bonne& proj_parm)
{
double c;
proj_parm.phi1 = pj_param(par.params, "rlat_1").f;
if (fabs(proj_parm.phi1) < EPS10) throw proj_exception(-23);
if (par.es) {
@@ -152,20 +156,16 @@ namespace boost { namespace geometry { namespace projections
proj_parm.m1 = pj_mlfn(proj_parm.phi1, proj_parm.am1 = sin(proj_parm.phi1),
c = cos(proj_parm.phi1), proj_parm.en);
proj_parm.am1 = c / (sqrt(1. - par.es * proj_parm.am1 * proj_parm.am1) * proj_parm.am1);
// par.inv = e_inverse;
// par.fwd = e_forward;
} else {
if (fabs(proj_parm.phi1) + EPS10 >= HALFPI)
proj_parm.cphi1 = 0.;
else
proj_parm.cphi1 = 1. / tan(proj_parm.phi1);
// par.inv = s_inverse;
// par.fwd = s_forward;
}
}
}} // namespace detail::bonne
#endif // doxygen
#endif // doxygen
/*!
\brief Bonne (Werner lat_1=90) projection
@@ -237,7 +237,7 @@ namespace boost { namespace geometry { namespace projections
factory.add_to_factory("bonne", new bonne_entry<Geographic, Cartesian, Parameters>);
}
} // namespace detail
} // namespace detail
#endif // doxygen
}}} // namespace boost::geometry::projections

View File

@@ -4,7 +4,7 @@
// Boost.Geometry - extensions-gis-projections (based on PROJ4)
// This file is automatically generated. DO NOT EDIT.
// Copyright (c) 2008-2012 Barend Gehrels, Amsterdam, the Netherlands.
// Copyright (c) 2008-2015 Barend Gehrels, Amsterdam, the Netherlands.
// Use, modification and distribution is subject to the Boost Software License,
// Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
@@ -15,6 +15,8 @@
// PROJ4 is maintained by Frank Warmerdam
// PROJ4 is converted to Boost.Geometry by Barend Gehrels
// Last updated version of proj: 4.9.1
// Original copyright notice:
// Permission is hereby granted, free of charge, to any person obtaining a
@@ -35,7 +37,6 @@
// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
// DEALINGS IN THE SOFTWARE.
#include <boost/math/special_functions/hypot.hpp>
#include <boost/geometry/extensions/gis/projections/impl/base_static.hpp>
#include <boost/geometry/extensions/gis/projections/impl/base_dynamic.hpp>
@@ -48,7 +49,7 @@
namespace boost { namespace geometry { namespace projections
{
#ifndef DOXYGEN_NO_DETAIL
namespace detail { namespace cass{
namespace detail { namespace cass{
static const double EPS10 = 1e-10;
static const double C1 = .16666666666666666666;
static const double C2 = .00833333333333333333;
@@ -103,7 +104,7 @@ namespace boost { namespace geometry { namespace projections
inline void inv(cartesian_type& xy_x, cartesian_type& xy_y, geographic_type& lp_lon, geographic_type& lp_lat) const
{
double ph1;
ph1 = pj_inv_mlfn(this->m_proj_parm.m0 + xy_y, this->m_par.es, this->m_proj_parm.en);
this->m_proj_parm.tn = tan(ph1); this->m_proj_parm.t = this->m_proj_parm.tn * this->m_proj_parm.tn;
this->m_proj_parm.n = sin(ph1);
@@ -152,18 +153,14 @@ namespace boost { namespace geometry { namespace projections
void setup_cass(Parameters& par, par_cass& proj_parm)
{
if (par.es) {
pj_enfn(par.es, proj_parm.en);
if (!pj_enfn(par.es, proj_parm.en)) throw proj_exception(0);
proj_parm.m0 = pj_mlfn(par.phi0, sin(par.phi0), cos(par.phi0), proj_parm.en);
// par.inv = e_inverse;
// par.fwd = e_forward;
} else {
// par.inv = s_inverse;
// par.fwd = s_forward;
}
}
}} // namespace detail::cass
#endif // doxygen
#endif // doxygen
/*!
\brief Cassini projection
@@ -233,7 +230,7 @@ namespace boost { namespace geometry { namespace projections
factory.add_to_factory("cass", new cass_entry<Geographic, Cartesian, Parameters>);
}
} // namespace detail
} // namespace detail
// Create EPSG specializations
// (Proof of Concept, only for some)

View File

@@ -4,7 +4,7 @@
// Boost.Geometry - extensions-gis-projections (based on PROJ4)
// This file is automatically generated. DO NOT EDIT.
// Copyright (c) 2008-2012 Barend Gehrels, Amsterdam, the Netherlands.
// Copyright (c) 2008-2015 Barend Gehrels, Amsterdam, the Netherlands.
// Use, modification and distribution is subject to the Boost Software License,
// Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
@@ -15,6 +15,8 @@
// PROJ4 is maintained by Frank Warmerdam
// PROJ4 is converted to Boost.Geometry by Barend Gehrels
// Last updated version of proj: 4.9.1
// Original copyright notice:
// Permission is hereby granted, free of charge, to any person obtaining a
@@ -35,7 +37,6 @@
// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
// DEALINGS IN THE SOFTWARE.
#include <boost/math/special_functions/hypot.hpp>
#include <boost/geometry/extensions/gis/projections/impl/base_static.hpp>
#include <boost/geometry/extensions/gis/projections/impl/base_dynamic.hpp>
@@ -45,7 +46,7 @@
namespace boost { namespace geometry { namespace projections
{
#ifndef DOXYGEN_NO_DETAIL
namespace detail { namespace cc{
namespace detail { namespace cc{
static const double EPS10 = 1.e-10;
struct par_cc
@@ -87,12 +88,10 @@ namespace boost { namespace geometry { namespace projections
void setup_cc(Parameters& par, par_cc& proj_parm)
{
par.es = 0.;
// par.inv = s_inverse;
// par.fwd = s_forward;
}
}} // namespace detail::cc
#endif // doxygen
#endif // doxygen
/*!
\brief Central Cylindrical projection
@@ -136,7 +135,7 @@ namespace boost { namespace geometry { namespace projections
factory.add_to_factory("cc", new cc_entry<Geographic, Cartesian, Parameters>);
}
} // namespace detail
} // namespace detail
#endif // doxygen
}}} // namespace boost::geometry::projections

View File

@@ -4,7 +4,7 @@
// Boost.Geometry - extensions-gis-projections (based on PROJ4)
// This file is automatically generated. DO NOT EDIT.
// Copyright (c) 2008-2012 Barend Gehrels, Amsterdam, the Netherlands.
// Copyright (c) 2008-2015 Barend Gehrels, Amsterdam, the Netherlands.
// Use, modification and distribution is subject to the Boost Software License,
// Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
@@ -15,6 +15,8 @@
// PROJ4 is maintained by Frank Warmerdam
// PROJ4 is converted to Boost.Geometry by Barend Gehrels
// Last updated version of proj: 4.9.1
// Original copyright notice:
// Permission is hereby granted, free of charge, to any person obtaining a
@@ -35,19 +37,18 @@
// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
// DEALINGS IN THE SOFTWARE.
#include <boost/math/special_functions/hypot.hpp>
#include <boost/geometry/extensions/gis/projections/impl/base_static.hpp>
#include <boost/geometry/extensions/gis/projections/impl/base_dynamic.hpp>
#include <boost/geometry/extensions/gis/projections/impl/projects.hpp>
#include <boost/geometry/extensions/gis/projections/impl/factory_entry.hpp>
#include <boost/geometry/extensions/gis/projections/impl/pj_qsfn.hpp>
#include <boost/geometry/extensions/gis/projections/impl/pj_auth.hpp>
#include <boost/geometry/extensions/gis/projections/impl/pj_qsfn.hpp>
namespace boost { namespace geometry { namespace projections
{
#ifndef DOXYGEN_NO_DETAIL
namespace detail { namespace cea{
namespace detail { namespace cea{
static const double EPS = 1e-10;
struct par_cea
@@ -108,7 +109,7 @@ namespace boost { namespace geometry { namespace projections
inline void inv(cartesian_type& xy_x, cartesian_type& xy_y, geographic_type& lp_lon, geographic_type& lp_lat) const
{
double t;
if ((t = fabs(xy_y *= this->m_par.k0)) - EPS <= 1.) {
if (t >= 1.)
lp_lat = xy_y < 0. ? -HALFPI : HALFPI;
@@ -124,6 +125,7 @@ namespace boost { namespace geometry { namespace projections
void setup_cea(Parameters& par, par_cea& proj_parm)
{
double t = 0;
if (pj_param(par.params, "tlat_ts").i &&
(par.k0 = cos(t = pj_param(par.params, "rlat_ts").f)) < 0.)
throw proj_exception(-24);
@@ -131,18 +133,14 @@ namespace boost { namespace geometry { namespace projections
t = sin(t);
par.k0 /= sqrt(1. - par.es * t * t);
par.e = sqrt(par.es);
pj_authset(par.es, proj_parm.apa);
if (!pj_authset(par.es, proj_parm.apa)) throw proj_exception(0);
proj_parm.qp = pj_qsfn(1., par.e, par.one_es);
// par.inv = e_inverse;
// par.fwd = e_forward;
} else {
// par.inv = s_inverse;
// par.fwd = s_forward;
}
}
}} // namespace detail::cea
#endif // doxygen
#endif // doxygen
/*!
\brief Equal Area Cylindrical projection
@@ -214,7 +212,7 @@ namespace boost { namespace geometry { namespace projections
factory.add_to_factory("cea", new cea_entry<Geographic, Cartesian, Parameters>);
}
} // namespace detail
} // namespace detail
#endif // doxygen
}}} // namespace boost::geometry::projections

View File

@@ -4,7 +4,7 @@
// Boost.Geometry - extensions-gis-projections (based on PROJ4)
// This file is automatically generated. DO NOT EDIT.
// Copyright (c) 2008-2012 Barend Gehrels, Amsterdam, the Netherlands.
// Copyright (c) 2008-2015 Barend Gehrels, Amsterdam, the Netherlands.
// Use, modification and distribution is subject to the Boost Software License,
// Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
@@ -15,6 +15,8 @@
// PROJ4 is maintained by Frank Warmerdam
// PROJ4 is converted to Boost.Geometry by Barend Gehrels
// Last updated version of proj: 4.9.1
// Original copyright notice:
// Permission is hereby granted, free of charge, to any person obtaining a
@@ -35,9 +37,8 @@
// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
// DEALINGS IN THE SOFTWARE.
#include <cstdio>
#include <boost/math/special_functions/hypot.hpp>
#include <cstdio>
#include <boost/geometry/extensions/gis/projections/impl/base_static.hpp>
#include <boost/geometry/extensions/gis/projections/impl/base_dynamic.hpp>
@@ -48,12 +49,13 @@
namespace boost { namespace geometry { namespace projections
{
#ifndef DOXYGEN_NO_DETAIL
namespace detail { namespace chamb{
namespace detail { namespace chamb{
static const double THIRD = 0.333333333333333333;
static const double TOL = 1e-9;
// specific for 'chamb'
struct VECT { double r, Az; };
struct CXY { double x, y; }; // x/y for chamb
struct XY { double x, y; };
struct par_chamb
{
@@ -61,17 +63,18 @@ namespace boost { namespace geometry { namespace projections
double phi, lam;
double cosphi, sinphi;
VECT v;
CXY p;
XY p;
double Az;
} c[3];
CXY p;
XY p;
double beta_0, beta_1, beta_2;
};
inline VECT /* distance and azimuth from point 1 to point 2 */
vect(double dphi, double c1, double s1, double c2, double s2, double dlam) {
VECT v;
double cdl, dp, dl;
cdl = cos(dlam);
if (fabs(dphi) > 1. || fabs(dlam) > 1.)
v.r = aacos(s1 * s2 + c1 * c2 * cdl);
@@ -111,7 +114,7 @@ namespace boost { namespace geometry { namespace projections
double sinphi, cosphi, a;
VECT v[3];
int i, j;
sinphi = sin(lp_lat);
cosphi = cos(lp_lat);
for (i = 0; i < 3; ++i) { /* dist/azimiths from control */
@@ -155,9 +158,8 @@ namespace boost { namespace geometry { namespace projections
{
int i, j;
char line[10];
for (i = 0;
i < 3;
++i) { /* get control point locations */
for (i = 0; i < 3; ++i) { /* get control point locations */
(void)sprintf(line, "rlat_%d", i+1);
proj_parm.c[i].phi = pj_param(par.params, line).f;
(void)sprintf(line, "rlon_%d", i+1);
@@ -166,9 +168,7 @@ namespace boost { namespace geometry { namespace projections
proj_parm.c[i].cosphi = cos(proj_parm.c[i].phi);
proj_parm.c[i].sinphi = sin(proj_parm.c[i].phi);
}
for (i = 0;
i < 3;
++i) { /* inter ctl pt. distances and azimuths */
for (i = 0; i < 3; ++i) { /* inter ctl pt. distances and azimuths */
j = i == 2 ? 0 : i + 1;
proj_parm.c[i].v = vect(proj_parm.c[j].phi - proj_parm.c[i].phi, proj_parm.c[i].cosphi, proj_parm.c[i].sinphi,
proj_parm.c[j].cosphi, proj_parm.c[j].sinphi, proj_parm.c[j].lam - proj_parm.c[i].lam);
@@ -183,11 +183,10 @@ namespace boost { namespace geometry { namespace projections
proj_parm.c[0].p.x = - (proj_parm.c[1].p.x = 0.5 * proj_parm.c[0].v.r);
proj_parm.p.x = proj_parm.c[2].p.x = proj_parm.c[0].p.x + proj_parm.c[2].v.r * cos(proj_parm.beta_0);
par.es = 0.;
// par.fwd = s_forward;
}
}} // namespace detail::chamb
#endif // doxygen
#endif // doxygen
/*!
\brief Chamberlin Trimetric projection
@@ -233,7 +232,7 @@ namespace boost { namespace geometry { namespace projections
factory.add_to_factory("chamb", new chamb_entry<Geographic, Cartesian, Parameters>);
}
} // namespace detail
} // namespace detail
#endif // doxygen
}}} // namespace boost::geometry::projections

View File

@@ -4,7 +4,7 @@
// Boost.Geometry - extensions-gis-projections (based on PROJ4)
// This file is automatically generated. DO NOT EDIT.
// Copyright (c) 2008-2012 Barend Gehrels, Amsterdam, the Netherlands.
// Copyright (c) 2008-2015 Barend Gehrels, Amsterdam, the Netherlands.
// Use, modification and distribution is subject to the Boost Software License,
// Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
@@ -15,6 +15,8 @@
// PROJ4 is maintained by Frank Warmerdam
// PROJ4 is converted to Boost.Geometry by Barend Gehrels
// Last updated version of proj: 4.9.1
// Original copyright notice:
// Permission is hereby granted, free of charge, to any person obtaining a
@@ -35,7 +37,6 @@
// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
// DEALINGS IN THE SOFTWARE.
#include <boost/math/special_functions/hypot.hpp>
#include <boost/geometry/extensions/gis/projections/impl/base_static.hpp>
#include <boost/geometry/extensions/gis/projections/impl/base_dynamic.hpp>
@@ -45,12 +46,11 @@
namespace boost { namespace geometry { namespace projections
{
#ifndef DOXYGEN_NO_DETAIL
namespace detail { namespace collg{
namespace detail { namespace collg{
static const double FXC = 1.12837916709551257390;
static const double FYC = 1.77245385090551602729;
static const double ONEEPS = 1.0000001;
// template class, using CRTP to implement forward/inverse
template <typename Geographic, typename Cartesian, typename Parameters>
struct base_collg_spheroid : public base_t_fi<base_collg_spheroid<Geographic, Cartesian, Parameters>,
@@ -94,12 +94,10 @@ namespace boost { namespace geometry { namespace projections
void setup_collg(Parameters& par)
{
par.es = 0.;
// par.inv = s_inverse;
// par.fwd = s_forward;
}
}} // namespace detail::collg
#endif // doxygen
#endif // doxygen
/*!
\brief Collignon projection
@@ -143,7 +141,7 @@ namespace boost { namespace geometry { namespace projections
factory.add_to_factory("collg", new collg_entry<Geographic, Cartesian, Parameters>);
}
} // namespace detail
} // namespace detail
#endif // doxygen
}}} // namespace boost::geometry::projections

View File

@@ -4,7 +4,7 @@
// Boost.Geometry - extensions-gis-projections (based on PROJ4)
// This file is automatically generated. DO NOT EDIT.
// Copyright (c) 2008-2012 Barend Gehrels, Amsterdam, the Netherlands.
// Copyright (c) 2008-2015 Barend Gehrels, Amsterdam, the Netherlands.
// Use, modification and distribution is subject to the Boost Software License,
// Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
@@ -15,6 +15,8 @@
// PROJ4 is maintained by Frank Warmerdam
// PROJ4 is converted to Boost.Geometry by Barend Gehrels
// Last updated version of proj: 4.9.1
// Original copyright notice:
// Permission is hereby granted, free of charge, to any person obtaining a
@@ -35,7 +37,6 @@
// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
// DEALINGS IN THE SOFTWARE.
#include <boost/math/special_functions/hypot.hpp>
#include <boost/geometry/extensions/gis/projections/impl/base_static.hpp>
#include <boost/geometry/extensions/gis/projections/impl/base_dynamic.hpp>
@@ -45,14 +46,13 @@
namespace boost { namespace geometry { namespace projections
{
#ifndef DOXYGEN_NO_DETAIL
namespace detail { namespace crast{
namespace detail { namespace crast{
static const double XM = 0.97720502380583984317;
static const double RXM = 1.02332670794648848847;
static const double YM = 3.06998012383946546542;
static const double RYM = 0.32573500793527994772;
static const double THIRD = 0.333333333333333333;
// template class, using CRTP to implement forward/inverse
template <typename Geographic, typename Cartesian, typename Parameters>
struct base_crast_spheroid : public base_t_fi<base_crast_spheroid<Geographic, Cartesian, Parameters>,
@@ -86,12 +86,10 @@ namespace boost { namespace geometry { namespace projections
void setup_crast(Parameters& par)
{
par.es = 0.;
// par.inv = s_inverse;
// par.fwd = s_forward;
}
}} // namespace detail::crast
#endif // doxygen
#endif // doxygen
/*!
\brief Craster Parabolic (Putnins P4) projection
@@ -135,7 +133,7 @@ namespace boost { namespace geometry { namespace projections
factory.add_to_factory("crast", new crast_entry<Geographic, Cartesian, Parameters>);
}
} // namespace detail
} // namespace detail
#endif // doxygen
}}} // namespace boost::geometry::projections

View File

@@ -4,7 +4,7 @@
// Boost.Geometry - extensions-gis-projections (based on PROJ4)
// This file is automatically generated. DO NOT EDIT.
// Copyright (c) 2008-2012 Barend Gehrels, Amsterdam, the Netherlands.
// Copyright (c) 2008-2015 Barend Gehrels, Amsterdam, the Netherlands.
// Use, modification and distribution is subject to the Boost Software License,
// Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
@@ -15,6 +15,8 @@
// PROJ4 is maintained by Frank Warmerdam
// PROJ4 is converted to Boost.Geometry by Barend Gehrels
// Last updated version of proj: 4.9.1
// Original copyright notice:
// Permission is hereby granted, free of charge, to any person obtaining a
@@ -35,7 +37,6 @@
// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
// DEALINGS IN THE SOFTWARE.
#include <boost/math/special_functions/hypot.hpp>
#include <boost/geometry/extensions/gis/projections/impl/base_static.hpp>
#include <boost/geometry/extensions/gis/projections/impl/base_dynamic.hpp>
@@ -45,14 +46,13 @@
namespace boost { namespace geometry { namespace projections
{
#ifndef DOXYGEN_NO_DETAIL
namespace detail { namespace denoy{
namespace detail { namespace denoy{
static const double C0 = 0.95;
static const double C1 = -.08333333333333333333;
static const double C3 = .00166666666666666666;
static const double D1 = 0.9;
static const double D5 = 0.03;
// template class, using CRTP to implement forward/inverse
template <typename Geographic, typename Cartesian, typename Parameters>
struct base_denoy_spheroid : public base_t_f<base_denoy_spheroid<Geographic, Cartesian, Parameters>,
@@ -82,11 +82,10 @@ namespace boost { namespace geometry { namespace projections
void setup_denoy(Parameters& par)
{
par.es = 0.;
// par.fwd = s_forward;
}
}} // namespace detail::denoy
#endif // doxygen
#endif // doxygen
/*!
\brief Denoyer Semi-Elliptical projection
@@ -131,7 +130,7 @@ namespace boost { namespace geometry { namespace projections
factory.add_to_factory("denoy", new denoy_entry<Geographic, Cartesian, Parameters>);
}
} // namespace detail
} // namespace detail
#endif // doxygen
}}} // namespace boost::geometry::projections

View File

@@ -4,7 +4,7 @@
// Boost.Geometry - extensions-gis-projections (based on PROJ4)
// This file is automatically generated. DO NOT EDIT.
// Copyright (c) 2008-2012 Barend Gehrels, Amsterdam, the Netherlands.
// Copyright (c) 2008-2015 Barend Gehrels, Amsterdam, the Netherlands.
// Use, modification and distribution is subject to the Boost Software License,
// Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
@@ -15,6 +15,8 @@
// PROJ4 is maintained by Frank Warmerdam
// PROJ4 is converted to Boost.Geometry by Barend Gehrels
// Last updated version of proj: 4.9.1
// Original copyright notice:
// Permission is hereby granted, free of charge, to any person obtaining a
@@ -35,7 +37,6 @@
// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
// DEALINGS IN THE SOFTWARE.
#include <boost/math/special_functions/hypot.hpp>
#include <boost/geometry/extensions/gis/projections/impl/base_static.hpp>
#include <boost/geometry/extensions/gis/projections/impl/base_dynamic.hpp>
@@ -45,11 +46,10 @@
namespace boost { namespace geometry { namespace projections
{
#ifndef DOXYGEN_NO_DETAIL
namespace detail { namespace eck1{
namespace detail { namespace eck1{
static const double FC = .92131773192356127802;
static const double RP = .31830988618379067154;
// template class, using CRTP to implement forward/inverse
template <typename Geographic, typename Cartesian, typename Parameters>
struct base_eck1_spheroid : public base_t_fi<base_eck1_spheroid<Geographic, Cartesian, Parameters>,
@@ -82,12 +82,10 @@ namespace boost { namespace geometry { namespace projections
void setup_eck1(Parameters& par)
{
par.es = 0.;
// par.inv = s_inverse;
// par.fwd = s_forward;
}
}} // namespace detail::eck1
#endif // doxygen
#endif // doxygen
/*!
\brief Eckert I projection
@@ -131,7 +129,7 @@ namespace boost { namespace geometry { namespace projections
factory.add_to_factory("eck1", new eck1_entry<Geographic, Cartesian, Parameters>);
}
} // namespace detail
} // namespace detail
#endif // doxygen
}}} // namespace boost::geometry::projections

View File

@@ -4,7 +4,7 @@
// Boost.Geometry - extensions-gis-projections (based on PROJ4)
// This file is automatically generated. DO NOT EDIT.
// Copyright (c) 2008-2012 Barend Gehrels, Amsterdam, the Netherlands.
// Copyright (c) 2008-2015 Barend Gehrels, Amsterdam, the Netherlands.
// Use, modification and distribution is subject to the Boost Software License,
// Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
@@ -15,6 +15,8 @@
// PROJ4 is maintained by Frank Warmerdam
// PROJ4 is converted to Boost.Geometry by Barend Gehrels
// Last updated version of proj: 4.9.1
// Original copyright notice:
// Permission is hereby granted, free of charge, to any person obtaining a
@@ -35,7 +37,6 @@
// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
// DEALINGS IN THE SOFTWARE.
#include <boost/math/special_functions/hypot.hpp>
#include <boost/geometry/extensions/gis/projections/impl/base_static.hpp>
#include <boost/geometry/extensions/gis/projections/impl/base_dynamic.hpp>
@@ -45,13 +46,12 @@
namespace boost { namespace geometry { namespace projections
{
#ifndef DOXYGEN_NO_DETAIL
namespace detail { namespace eck2{
namespace detail { namespace eck2{
static const double FXC = 0.46065886596178063902;
static const double FYC = 1.44720250911653531871;
static const double C13 = 0.33333333333333333333;
static const double ONEEPS = 1.0000001;
// template class, using CRTP to implement forward/inverse
template <typename Geographic, typename Cartesian, typename Parameters>
struct base_eck2_spheroid : public base_t_fi<base_eck2_spheroid<Geographic, Cartesian, Parameters>,
@@ -93,12 +93,10 @@ namespace boost { namespace geometry { namespace projections
void setup_eck2(Parameters& par)
{
par.es = 0.;
// par.inv = s_inverse;
// par.fwd = s_forward;
}
}} // namespace detail::eck2
#endif // doxygen
#endif // doxygen
/*!
\brief Eckert II projection
@@ -142,7 +140,7 @@ namespace boost { namespace geometry { namespace projections
factory.add_to_factory("eck2", new eck2_entry<Geographic, Cartesian, Parameters>);
}
} // namespace detail
} // namespace detail
#endif // doxygen
}}} // namespace boost::geometry::projections

View File

@@ -4,7 +4,7 @@
// Boost.Geometry - extensions-gis-projections (based on PROJ4)
// This file is automatically generated. DO NOT EDIT.
// Copyright (c) 2008-2012 Barend Gehrels, Amsterdam, the Netherlands.
// Copyright (c) 2008-2015 Barend Gehrels, Amsterdam, the Netherlands.
// Use, modification and distribution is subject to the Boost Software License,
// Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
@@ -15,6 +15,8 @@
// PROJ4 is maintained by Frank Warmerdam
// PROJ4 is converted to Boost.Geometry by Barend Gehrels
// Last updated version of proj: 4.9.1
// Original copyright notice:
// Permission is hereby granted, free of charge, to any person obtaining a
@@ -35,8 +37,8 @@
// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
// DEALINGS IN THE SOFTWARE.
#include <boost/concept_check.hpp>
#include <boost/math/special_functions/hypot.hpp>
#include <boost/core/ignore_unused.hpp>
#include <boost/geometry/extensions/gis/projections/impl/base_static.hpp>
#include <boost/geometry/extensions/gis/projections/impl/base_dynamic.hpp>
@@ -46,7 +48,7 @@
namespace boost { namespace geometry { namespace projections
{
#ifndef DOXYGEN_NO_DETAIL
namespace detail { namespace eck3{
namespace detail { namespace eck3{
struct par_eck3
{
@@ -84,11 +86,8 @@ namespace boost { namespace geometry { namespace projections
template <typename Parameters>
void setup(Parameters& par, par_eck3& proj_parm)
{
boost::ignore_unused_variable_warning(par);
boost::ignore_unused_variable_warning(proj_parm);
boost::ignore_unused(proj_parm);
par.es = 0.;
// par.inv = s_inverse;
// par.fwd = s_forward;
}
@@ -137,7 +136,7 @@ namespace boost { namespace geometry { namespace projections
}
}} // namespace detail::eck3
#endif // doxygen
#endif // doxygen
/*!
\brief Eckert III projection
@@ -277,7 +276,7 @@ namespace boost { namespace geometry { namespace projections
factory.add_to_factory("kav7", new kav7_entry<Geographic, Cartesian, Parameters>);
}
} // namespace detail
} // namespace detail
#endif // doxygen
}}} // namespace boost::geometry::projections

View File

@@ -4,7 +4,7 @@
// Boost.Geometry - extensions-gis-projections (based on PROJ4)
// This file is automatically generated. DO NOT EDIT.
// Copyright (c) 2008-2012 Barend Gehrels, Amsterdam, the Netherlands.
// Copyright (c) 2008-2015 Barend Gehrels, Amsterdam, the Netherlands.
// Use, modification and distribution is subject to the Boost Software License,
// Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
@@ -15,6 +15,8 @@
// PROJ4 is maintained by Frank Warmerdam
// PROJ4 is converted to Boost.Geometry by Barend Gehrels
// Last updated version of proj: 4.9.1
// Original copyright notice:
// Permission is hereby granted, free of charge, to any person obtaining a
@@ -35,17 +37,17 @@
// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
// DEALINGS IN THE SOFTWARE.
#include <boost/math/special_functions/hypot.hpp>
#include <boost/geometry/extensions/gis/projections/impl/base_static.hpp>
#include <boost/geometry/extensions/gis/projections/impl/base_dynamic.hpp>
#include <boost/geometry/extensions/gis/projections/impl/projects.hpp>
#include <boost/geometry/extensions/gis/projections/impl/factory_entry.hpp>
#include <boost/geometry/extensions/gis/projections/impl/aasincos.hpp>
namespace boost { namespace geometry { namespace projections
{
#ifndef DOXYGEN_NO_DETAIL
namespace detail { namespace eck4{
namespace detail { namespace eck4{
static const double C_x = .42223820031577120149;
static const double C_y = 1.32650042817700232218;
static const double RC_y = .75386330736002178205;
@@ -54,7 +56,6 @@ namespace boost { namespace geometry { namespace projections
static const double EPS = 1e-7;
static const int NITER = 6;
// template class, using CRTP to implement forward/inverse
template <typename Geographic, typename Cartesian, typename Parameters>
struct base_eck4_spheroid : public base_t_fi<base_eck4_spheroid<Geographic, Cartesian, Parameters>,
@@ -73,7 +74,7 @@ namespace boost { namespace geometry { namespace projections
{
double p, V, s, c;
int i;
p = C_p * sin(lp_lat);
V = lp_lat * lp_lat;
lp_lat *= 0.895168 + V * ( 0.0218849 + V * 0.00826809 );
@@ -97,7 +98,7 @@ namespace boost { namespace geometry { namespace projections
inline void inv(cartesian_type& xy_x, cartesian_type& xy_y, geographic_type& lp_lon, geographic_type& lp_lat) const
{
double c;
lp_lat = aasin(xy_y / C_y);
lp_lon = xy_x / (C_x * (1. + (c = cos(lp_lat))));
lp_lat = aasin((lp_lat + sin(lp_lat) * (c + 2.)) / C_p);
@@ -109,12 +110,10 @@ namespace boost { namespace geometry { namespace projections
void setup_eck4(Parameters& par)
{
par.es = 0.;
// par.inv = s_inverse;
// par.fwd = s_forward;
}
}} // namespace detail::eck4
#endif // doxygen
#endif // doxygen
/*!
\brief Eckert IV projection
@@ -158,7 +157,7 @@ namespace boost { namespace geometry { namespace projections
factory.add_to_factory("eck4", new eck4_entry<Geographic, Cartesian, Parameters>);
}
} // namespace detail
} // namespace detail
#endif // doxygen
}}} // namespace boost::geometry::projections

View File

@@ -4,7 +4,7 @@
// Boost.Geometry - extensions-gis-projections (based on PROJ4)
// This file is automatically generated. DO NOT EDIT.
// Copyright (c) 2008-2012 Barend Gehrels, Amsterdam, the Netherlands.
// Copyright (c) 2008-2015 Barend Gehrels, Amsterdam, the Netherlands.
// Use, modification and distribution is subject to the Boost Software License,
// Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
@@ -15,6 +15,8 @@
// PROJ4 is maintained by Frank Warmerdam
// PROJ4 is converted to Boost.Geometry by Barend Gehrels
// Last updated version of proj: 4.9.1
// Original copyright notice:
// Permission is hereby granted, free of charge, to any person obtaining a
@@ -35,7 +37,6 @@
// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
// DEALINGS IN THE SOFTWARE.
#include <boost/math/special_functions/hypot.hpp>
#include <boost/geometry/extensions/gis/projections/impl/base_static.hpp>
#include <boost/geometry/extensions/gis/projections/impl/base_dynamic.hpp>
@@ -45,13 +46,12 @@
namespace boost { namespace geometry { namespace projections
{
#ifndef DOXYGEN_NO_DETAIL
namespace detail { namespace eck5{
namespace detail { namespace eck5{
static const double XF = 0.44101277172455148219;
static const double RXF = 2.26750802723822639137;
static const double YF = 0.88202554344910296438;
static const double RYF = 1.13375401361911319568;
// template class, using CRTP to implement forward/inverse
template <typename Geographic, typename Cartesian, typename Parameters>
struct base_eck5_spheroid : public base_t_fi<base_eck5_spheroid<Geographic, Cartesian, Parameters>,
@@ -83,12 +83,10 @@ namespace boost { namespace geometry { namespace projections
void setup_eck5(Parameters& par)
{
par.es = 0.;
// par.inv = s_inverse;
// par.fwd = s_forward;
}
}} // namespace detail::eck5
#endif // doxygen
#endif // doxygen
/*!
\brief Eckert V projection
@@ -132,7 +130,7 @@ namespace boost { namespace geometry { namespace projections
factory.add_to_factory("eck5", new eck5_entry<Geographic, Cartesian, Parameters>);
}
} // namespace detail
} // namespace detail
#endif // doxygen
}}} // namespace boost::geometry::projections

View File

@@ -4,7 +4,7 @@
// Boost.Geometry - extensions-gis-projections (based on PROJ4)
// This file is automatically generated. DO NOT EDIT.
// Copyright (c) 2008-2012 Barend Gehrels, Amsterdam, the Netherlands.
// Copyright (c) 2008-2015 Barend Gehrels, Amsterdam, the Netherlands.
// Use, modification and distribution is subject to the Boost Software License,
// Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
@@ -15,6 +15,8 @@
// PROJ4 is maintained by Frank Warmerdam
// PROJ4 is converted to Boost.Geometry by Barend Gehrels
// Last updated version of proj: 4.9.1
// Original copyright notice:
// Permission is hereby granted, free of charge, to any person obtaining a
@@ -35,7 +37,6 @@
// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
// DEALINGS IN THE SOFTWARE.
#include <boost/math/special_functions/hypot.hpp>
#include <boost/geometry/extensions/gis/projections/impl/base_static.hpp>
#include <boost/geometry/extensions/gis/projections/impl/base_dynamic.hpp>
@@ -45,7 +46,7 @@
namespace boost { namespace geometry { namespace projections
{
#ifndef DOXYGEN_NO_DETAIL
namespace detail { namespace eqc{
namespace detail { namespace eqc{
struct par_eqc
{
@@ -85,13 +86,11 @@ namespace boost { namespace geometry { namespace projections
void setup_eqc(Parameters& par, par_eqc& proj_parm)
{
if ((proj_parm.rc = cos(pj_param(par.params, "rlat_ts").f)) <= 0.) throw proj_exception(-24);
// par.inv = s_inverse;
// par.fwd = s_forward;
par.es = 0.;
}
}} // namespace detail::eqc
#endif // doxygen
#endif // doxygen
/*!
\brief Equidistant Cylindrical (Plate Caree) projection
@@ -137,7 +136,7 @@ namespace boost { namespace geometry { namespace projections
factory.add_to_factory("eqc", new eqc_entry<Geographic, Cartesian, Parameters>);
}
} // namespace detail
} // namespace detail
#endif // doxygen
}}} // namespace boost::geometry::projections

View File

@@ -4,7 +4,7 @@
// Boost.Geometry - extensions-gis-projections (based on PROJ4)
// This file is automatically generated. DO NOT EDIT.
// Copyright (c) 2008-2012 Barend Gehrels, Amsterdam, the Netherlands.
// Copyright (c) 2008-2015 Barend Gehrels, Amsterdam, the Netherlands.
// Use, modification and distribution is subject to the Boost Software License,
// Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
@@ -15,6 +15,8 @@
// PROJ4 is maintained by Frank Warmerdam
// PROJ4 is converted to Boost.Geometry by Barend Gehrels
// Last updated version of proj: 4.9.1
// Original copyright notice:
// Permission is hereby granted, free of charge, to any person obtaining a
@@ -35,19 +37,20 @@
// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
// DEALINGS IN THE SOFTWARE.
#include <boost/math/special_functions/hypot.hpp>
#include <boost/geometry/extensions/gis/projections/impl/base_static.hpp>
#include <boost/geometry/extensions/gis/projections/impl/base_dynamic.hpp>
#include <boost/geometry/extensions/gis/projections/impl/projects.hpp>
#include <boost/geometry/extensions/gis/projections/impl/factory_entry.hpp>
#include <boost/geometry/extensions/gis/projections/impl/pj_msfn.hpp>
#include <boost/geometry/extensions/gis/projections/impl/pj_mlfn.hpp>
#include <boost/geometry/extensions/gis/projections/impl/pj_msfn.hpp>
namespace boost { namespace geometry { namespace projections
{
#ifndef DOXYGEN_NO_DETAIL
namespace detail { namespace eqdc{
namespace detail { namespace eqdc{
static const double EPS10 = 1.e-10;
struct par_eqdc
@@ -107,7 +110,7 @@ namespace boost { namespace geometry { namespace projections
inline void fac(Geographic lp, Factors &fac) const
{
double sinphi, cosphi;
sinphi = sin(lp_lat);
cosphi = cos(lp_lat);
this->m_fac.code |= IS_ANAL_HK;
@@ -124,16 +127,18 @@ namespace boost { namespace geometry { namespace projections
{
double cosphi, sinphi;
int secant;
proj_parm.phi1 = pj_param(par.params, "rlat_1").f;
proj_parm.phi2 = pj_param(par.params, "rlat_2").f;
if (fabs(proj_parm.phi1 + proj_parm.phi2) < EPS10) throw proj_exception(-21);
pj_enfn(par.es, proj_parm.en);
if (!pj_enfn(par.es, proj_parm.en))
throw proj_exception(0);
proj_parm.n = sinphi = sin(proj_parm.phi1);
cosphi = cos(proj_parm.phi1);
secant = fabs(proj_parm.phi1 - proj_parm.phi2) >= EPS10;
if( (proj_parm.ellips = (par.es > 0.)) ) {
double ml1, m1;
m1 = pj_msfn(sinphi, cosphi, par.es);
ml1 = pj_mlfn(proj_parm.phi1, sinphi, cosphi, proj_parm.en);
if (secant) { /* secant cone */
@@ -151,13 +156,10 @@ namespace boost { namespace geometry { namespace projections
proj_parm.c = proj_parm.phi1 + cos(proj_parm.phi1) / proj_parm.n;
proj_parm.rho0 = proj_parm.c - par.phi0;
}
// par.inv = e_inverse;
// par.fwd = e_forward;
// par.spc = fac;
}
}} // namespace detail::eqdc
#endif // doxygen
#endif // doxygen
/*!
\brief Equidistant Conic projection
@@ -203,7 +205,7 @@ namespace boost { namespace geometry { namespace projections
factory.add_to_factory("eqdc", new eqdc_entry<Geographic, Cartesian, Parameters>);
}
} // namespace detail
} // namespace detail
#endif // doxygen
}}} // namespace boost::geometry::projections

View File

@@ -0,0 +1,356 @@
#ifndef BOOST_GEOMETRY_PROJECTIONS_ETMERC_HPP
#define BOOST_GEOMETRY_PROJECTIONS_ETMERC_HPP
// Boost.Geometry - extensions-gis-projections (based on PROJ4)
// This file is automatically generated. DO NOT EDIT.
// Copyright (c) 2008-2015 Barend Gehrels, Amsterdam, the Netherlands.
// 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)
// This file is converted from PROJ4, http://trac.osgeo.org/proj
// PROJ4 is originally written by Gerald Evenden (then of the USGS)
// PROJ4 is maintained by Frank Warmerdam
// PROJ4 is converted to Boost.Geometry by Barend Gehrels
// Last updated version of proj: 4.9.1
// Original copyright notice:
// Permission is hereby granted, free of charge, to any person obtaining a
// copy of this software and associated documentation files (the "Software"),
// to deal in the Software without restriction, including without limitation
// the rights to use, copy, modify, merge, publish, distribute, sublicense,
// and/or sell copies of the Software, and to permit persons to whom the
// Software is furnished to do so, subject to the following conditions:
// The above copyright notice and this permission notice shall be included
// in all copies or substantial portions of the Software.
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
// THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
// DEALINGS IN THE SOFTWARE.
#include <boost/math/special_functions/hypot.hpp>
#include <boost/geometry/extensions/gis/projections/impl/base_static.hpp>
#include <boost/geometry/extensions/gis/projections/impl/base_dynamic.hpp>
#include <boost/geometry/extensions/gis/projections/impl/projects.hpp>
#include <boost/geometry/extensions/gis/projections/impl/factory_entry.hpp>
namespace boost { namespace geometry { namespace projections
{
#ifndef DOXYGEN_NO_DETAIL
namespace detail { namespace etmerc{
static const int PROJ_ETMERC_ORDER = 6;
struct par_etmerc
{
double Qn; /* Merid. quad., scaled to the projection */
double Zb; /* Radius vector in polar coord. systems */
double cgb[6]; /* Constants for Gauss -> Geo lat */
double cbg[6]; /* Constants for Geo lat -> Gauss */
double utg[6]; /* Constants for transv. merc. -> geo */
double gtu[6]; /* Constants for geo -> transv. merc. */
};
/* The code in this file is largly based upon procedures:
*
* Written by: Knud Poder and Karsten Engsager
*
* Based on math from: R.Koenig and K.H. Weise, "Mathematische
* Grundlagen der hoeheren Geodaesie und Kartographie,
* Springer-Verlag, Berlin/Goettingen" Heidelberg, 1951.
*
* Modified and used here by permission of Reference Networks
* Division, Kort og Matrikelstyrelsen (KMS), Copenhagen, Denmark
*/
inline double
log1py(double x) { /* Compute log(1+x) accurately */
volatile double
y = 1 + x,
z = y - 1;
/* Here's the explanation for this magic: y = 1 + z, exactly, and z
* approx x, thus log(y)/z (which is nearly constant near z = 0) returns
* a good approximation to the true log(1 + x)/x. The multiplication x *
* (log(y)/z) introduces little additional error. */
return z == 0 ? x : x * log(y) / z;
}
inline double
asinhy(double x) { /* Compute asinh(x) accurately */
double y = fabs(x); /* Enforce odd parity */
y = log1py(y * (1 + y/(hypot(1.0, y) + 1)));
return x < 0 ? -y : y;
}
inline double
gatg(const double *p1, int len_p1, double B) {
const double *p;
double h = 0, h1, h2 = 0, cos_2B;
cos_2B = 2*cos(2*B);
for (p = p1 + len_p1, h1 = *--p; p - p1; h2 = h1, h1 = h)
h = -h2 + cos_2B*h1 + *--p;
return (B + h*sin(2*B));
}
inline double
clenS(const double *a, int size, double arg_r, double arg_i, double *R, double *I) {
double r, i, hr, hr1, hr2, hi, hi1, hi2;
double sin_arg_r, cos_arg_r, sinh_arg_i, cosh_arg_i;
/* arguments */
const double* p = a + size;
sin_arg_r = sin(arg_r);
cos_arg_r = cos(arg_r);
sinh_arg_i = sinh(arg_i);
cosh_arg_i = cosh(arg_i);
r = 2*cos_arg_r*cosh_arg_i;
i = -2*sin_arg_r*sinh_arg_i;
/* summation loop */
for (hi1 = hr1 = hi = 0, hr = *--p; a - p;) {
hr2 = hr1;
hi2 = hi1;
hr1 = hr;
hi1 = hi;
hr = -hr2 + r*hr1 - i*hi1 + *--p;
hi = -hi2 + i*hr1 + r*hi1;
}
r = sin_arg_r*cosh_arg_i;
i = cos_arg_r*sinh_arg_i;
*R = r*hr - i*hi;
*I = r*hi + i*hr;
return(*R);
}
inline double
clens(const double *a, int size, double arg_r) {
double r, hr, hr1, hr2, cos_arg_r;
const double* p = a + size;
cos_arg_r = cos(arg_r);
r = 2*cos_arg_r;
/* summation loop */
for (hr1 = 0, hr = *--p; a - p;) {
hr2 = hr1;
hr1 = hr;
hr = -hr2 + r*hr1 + *--p;
}
return(sin(arg_r)*hr);
}
// template class, using CRTP to implement forward/inverse
template <typename Geographic, typename Cartesian, typename Parameters>
struct base_etmerc_ellipsoid : public base_t_fi<base_etmerc_ellipsoid<Geographic, Cartesian, Parameters>,
Geographic, Cartesian, Parameters>
{
typedef double geographic_type;
typedef double cartesian_type;
par_etmerc m_proj_parm;
inline base_etmerc_ellipsoid(const Parameters& par)
: base_t_fi<base_etmerc_ellipsoid<Geographic, Cartesian, Parameters>,
Geographic, Cartesian, Parameters>(*this, par) {}
inline void fwd(geographic_type& lp_lon, geographic_type& lp_lat, cartesian_type& xy_x, cartesian_type& xy_y) const
{
double sin_Cn, cos_Cn, cos_Ce, sin_Ce, dCn, dCe;
double Cn = lp_lat, Ce = lp_lon;
/* ell. LAT, LNG -> Gaussian LAT, LNG */
Cn = gatg(this->m_proj_parm.cbg, PROJ_ETMERC_ORDER, Cn);
/* Gaussian LAT, LNG -> compl. sph. LAT */
sin_Cn = sin(Cn);
cos_Cn = cos(Cn);
sin_Ce = sin(Ce);
cos_Ce = cos(Ce);
Cn = atan2(sin_Cn, cos_Ce*cos_Cn);
Ce = atan2(sin_Ce*cos_Cn, boost::math::hypot(sin_Cn, cos_Cn*cos_Ce));
/* compl. sph. N, E -> ell. norm. N, E */
Ce = asinhy(tan(Ce)); /* Replaces: Ce = log(tan(FORTPI + Ce*0.5)); */
Cn += clenS(this->m_proj_parm.gtu, PROJ_ETMERC_ORDER, 2*Cn, 2*Ce, &dCn, &dCe);
Ce += dCe;
if (fabs(Ce) <= 2.623395162778) {
xy_y = this->m_proj_parm.Qn * Cn + this->m_proj_parm.Zb; /* Northing */
xy_x = this->m_proj_parm.Qn * Ce; /* Easting */
} else
xy_x = xy_y = HUGE_VAL;
}
inline void inv(cartesian_type& xy_x, cartesian_type& xy_y, geographic_type& lp_lon, geographic_type& lp_lat) const
{
double sin_Cn, cos_Cn, cos_Ce, sin_Ce, dCn, dCe;
double Cn = xy_y, Ce = xy_x;
/* normalize N, E */
Cn = (Cn - this->m_proj_parm.Zb)/this->m_proj_parm.Qn;
Ce = Ce/this->m_proj_parm.Qn;
if (fabs(Ce) <= 2.623395162778) { /* 150 degrees */
/* norm. N, E -> compl. sph. LAT, LNG */
Cn += clenS(this->m_proj_parm.utg, PROJ_ETMERC_ORDER, 2*Cn, 2*Ce, &dCn, &dCe);
Ce += dCe;
Ce = atan(sinh(Ce)); /* Replaces: Ce = 2*(atan(exp(Ce)) - FORTPI); */
/* compl. sph. LAT -> Gaussian LAT, LNG */
sin_Cn = sin(Cn);
cos_Cn = cos(Cn);
sin_Ce = sin(Ce);
cos_Ce = cos(Ce);
Ce = atan2(sin_Ce, cos_Ce*cos_Cn);
Cn = atan2(sin_Cn*cos_Ce, boost::math::hypot(sin_Ce, cos_Ce*cos_Cn));
/* Gaussian LAT, LNG -> ell. LAT, LNG */
lp_lat = gatg(this->m_proj_parm.cgb, PROJ_ETMERC_ORDER, Cn);
lp_lon = Ce;
}
else
lp_lat = lp_lon = HUGE_VAL;
}
};
// Extended Transverse Mercator
template <typename Parameters>
void setup_etmerc(Parameters& par, par_etmerc& proj_parm)
{
double f, n, np, Z;
if (par.es <= 0) throw proj_exception(-34);
f = par.es / (1 + sqrt(1 - par.es)); /* Replaces: f = 1 - sqrt(1-par.es); */
/* third flattening */
np = n = f/(2 - f);
/* COEF. OF TRIG SERIES GEO <-> GAUSS */
/* cgb := Gaussian -> Geodetic, KW p190 - 191 (61) - (62) */
/* cbg := Geodetic -> Gaussian, KW p186 - 187 (51) - (52) */
/* PROJ_ETMERC_ORDER = 6th degree : Engsager and Poder: ICC2007 */
proj_parm.cgb[0] = n*( 2 + n*(-2/3.0 + n*(-2 + n*(116/45.0 + n*(26/45.0 +
n*(-2854/675.0 ))))));
proj_parm.cbg[0] = n*(-2 + n*( 2/3.0 + n*( 4/3.0 + n*(-82/45.0 + n*(32/45.0 +
n*( 4642/4725.0))))));
np *= n;
proj_parm.cgb[1] = np*(7/3.0 + n*( -8/5.0 + n*(-227/45.0 + n*(2704/315.0 +
n*( 2323/945.0)))));
proj_parm.cbg[1] = np*(5/3.0 + n*(-16/15.0 + n*( -13/9.0 + n*( 904/315.0 +
n*(-1522/945.0)))));
np *= n;
/* n^5 coeff corrected from 1262/105 -> -1262/105 */
proj_parm.cgb[2] = np*( 56/15.0 + n*(-136/35.0 + n*(-1262/105.0 +
n*( 73814/2835.0))));
proj_parm.cbg[2] = np*(-26/15.0 + n*( 34/21.0 + n*( 8/5.0 +
n*(-12686/2835.0))));
np *= n;
/* n^5 coeff corrected from 322/35 -> 332/35 */
proj_parm.cgb[3] = np*(4279/630.0 + n*(-332/35.0 + n*(-399572/14175.0)));
proj_parm.cbg[3] = np*(1237/630.0 + n*( -12/5.0 + n*( -24832/14175.0)));
np *= n;
proj_parm.cgb[4] = np*(4174/315.0 + n*(-144838/6237.0 ));
proj_parm.cbg[4] = np*(-734/315.0 + n*( 109598/31185.0));
np *= n;
proj_parm.cgb[5] = np*(601676/22275.0 );
proj_parm.cbg[5] = np*(444337/155925.0);
/* Constants of the projections */
/* Transverse Mercator (UTM, ITM, etc) */
np = n*n;
/* Norm. mer. quad, K&W p.50 (96), p.19 (38b), p.5 (2) */
proj_parm.Qn = par.k0/(1 + n) * (1 + np*(1/4.0 + np*(1/64.0 + np/256.0)));
/* coef of trig series */
/* utg := ell. N, E -> sph. N, E, KW p194 (65) */
/* gtu := sph. N, E -> ell. N, E, KW p196 (69) */
proj_parm.utg[0] = n*(-0.5 + n*( 2/3.0 + n*(-37/96.0 + n*( 1/360.0 +
n*( 81/512.0 + n*(-96199/604800.0))))));
proj_parm.gtu[0] = n*( 0.5 + n*(-2/3.0 + n*( 5/16.0 + n*(41/180.0 +
n*(-127/288.0 + n*( 7891/37800.0 ))))));
proj_parm.utg[1] = np*(-1/48.0 + n*(-1/15.0 + n*(437/1440.0 + n*(-46/105.0 +
n*( 1118711/3870720.0)))));
proj_parm.gtu[1] = np*(13/48.0 + n*(-3/5.0 + n*(557/1440.0 + n*(281/630.0 +
n*(-1983433/1935360.0)))));
np *= n;
proj_parm.utg[2] = np*(-17/480.0 + n*( 37/840.0 + n*( 209/4480.0 +
n*( -5569/90720.0 ))));
proj_parm.gtu[2] = np*( 61/240.0 + n*(-103/140.0 + n*(15061/26880.0 +
n*(167603/181440.0))));
np *= n;
proj_parm.utg[3] = np*(-4397/161280.0 + n*( 11/504.0 + n*( 830251/7257600.0)));
proj_parm.gtu[3] = np*(49561/161280.0 + n*(-179/168.0 + n*(6601661/7257600.0)));
np *= n;
proj_parm.utg[4] = np*(-4583/161280.0 + n*( 108847/3991680.0));
proj_parm.gtu[4] = np*(34729/80640.0 + n*(-3418889/1995840.0));
np *= n;
proj_parm.utg[5] = np*(-20648693/638668800.0);
proj_parm.gtu[5] = np*(212378941/319334400.0);
/* Gaussian latitude value of the origin latitude */
Z = gatg(proj_parm.cbg, PROJ_ETMERC_ORDER, par.phi0);
/* Origin northing minus true northing at the origin latitude */
/* i.e. true northing = N - proj_parm.Zb */
proj_parm.Zb = - proj_parm.Qn*(Z + clens(proj_parm.gtu, PROJ_ETMERC_ORDER, 2*Z));
}
}} // namespace detail::etmerc
#endif // doxygen
/*!
\brief Extended Transverse Mercator projection
\ingroup projections
\tparam Geographic latlong point type
\tparam Cartesian xy point type
\tparam Parameters parameter type
\par Projection characteristics
- Cylindrical
- Spheroid
- lat_ts=(0)
- lat_0=(0)
\par Example
\image html ex_etmerc.gif
*/
template <typename Geographic, typename Cartesian, typename Parameters = parameters>
struct etmerc_ellipsoid : public detail::etmerc::base_etmerc_ellipsoid<Geographic, Cartesian, Parameters>
{
inline etmerc_ellipsoid(const Parameters& par) : detail::etmerc::base_etmerc_ellipsoid<Geographic, Cartesian, Parameters>(par)
{
detail::etmerc::setup_etmerc(this->m_par, this->m_proj_parm);
}
};
#ifndef DOXYGEN_NO_DETAIL
namespace detail
{
// Factory entry(s)
template <typename Geographic, typename Cartesian, typename Parameters>
class etmerc_entry : public detail::factory_entry<Geographic, Cartesian, Parameters>
{
public :
virtual projection<Geographic, Cartesian>* create_new(const Parameters& par) const
{
return new base_v_fi<etmerc_ellipsoid<Geographic, Cartesian, Parameters>, Geographic, Cartesian, Parameters>(par);
}
};
template <typename Geographic, typename Cartesian, typename Parameters>
inline void etmerc_init(detail::base_factory<Geographic, Cartesian, Parameters>& factory)
{
factory.add_to_factory("etmerc", new etmerc_entry<Geographic, Cartesian, Parameters>);
}
} // namespace detail
#endif // doxygen
}}} // namespace boost::geometry::projections
#endif // BOOST_GEOMETRY_PROJECTIONS_ETMERC_HPP

View File

@@ -4,7 +4,7 @@
// Boost.Geometry - extensions-gis-projections (based on PROJ4)
// This file is automatically generated. DO NOT EDIT.
// Copyright (c) 2008-2012 Barend Gehrels, Amsterdam, the Netherlands.
// Copyright (c) 2008-2015 Barend Gehrels, Amsterdam, the Netherlands.
// Use, modification and distribution is subject to the Boost Software License,
// Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
@@ -15,6 +15,8 @@
// PROJ4 is maintained by Frank Warmerdam
// PROJ4 is converted to Boost.Geometry by Barend Gehrels
// Last updated version of proj: 4.9.1
// Original copyright notice:
// Permission is hereby granted, free of charge, to any person obtaining a
@@ -35,7 +37,6 @@
// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
// DEALINGS IN THE SOFTWARE.
#include <boost/math/special_functions/hypot.hpp>
#include <boost/geometry/extensions/gis/projections/impl/base_static.hpp>
#include <boost/geometry/extensions/gis/projections/impl/base_dynamic.hpp>
@@ -45,10 +46,9 @@
namespace boost { namespace geometry { namespace projections
{
#ifndef DOXYGEN_NO_DETAIL
namespace detail { namespace fahey{
namespace detail { namespace fahey{
static const double TOL = 1e-6;
// template class, using CRTP to implement forward/inverse
template <typename Geographic, typename Cartesian, typename Parameters>
struct base_fahey_spheroid : public base_t_fi<base_fahey_spheroid<Geographic, Cartesian, Parameters>,
@@ -82,12 +82,10 @@ namespace boost { namespace geometry { namespace projections
void setup_fahey(Parameters& par)
{
par.es = 0.;
// par.inv = s_inverse;
// par.fwd = s_forward;
}
}} // namespace detail::fahey
#endif // doxygen
#endif // doxygen
/*!
\brief Fahey projection
@@ -131,7 +129,7 @@ namespace boost { namespace geometry { namespace projections
factory.add_to_factory("fahey", new fahey_entry<Geographic, Cartesian, Parameters>);
}
} // namespace detail
} // namespace detail
#endif // doxygen
}}} // namespace boost::geometry::projections

View File

@@ -4,7 +4,7 @@
// Boost.Geometry - extensions-gis-projections (based on PROJ4)
// This file is automatically generated. DO NOT EDIT.
// Copyright (c) 2008-2012 Barend Gehrels, Amsterdam, the Netherlands.
// Copyright (c) 2008-2015 Barend Gehrels, Amsterdam, the Netherlands.
// Use, modification and distribution is subject to the Boost Software License,
// Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
@@ -15,6 +15,8 @@
// PROJ4 is maintained by Frank Warmerdam
// PROJ4 is converted to Boost.Geometry by Barend Gehrels
// Last updated version of proj: 4.9.1
// Original copyright notice:
// Permission is hereby granted, free of charge, to any person obtaining a
@@ -35,17 +37,17 @@
// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
// DEALINGS IN THE SOFTWARE.
#include <boost/math/special_functions/hypot.hpp>
#include <boost/geometry/extensions/gis/projections/impl/base_static.hpp>
#include <boost/geometry/extensions/gis/projections/impl/base_dynamic.hpp>
#include <boost/geometry/extensions/gis/projections/impl/projects.hpp>
#include <boost/geometry/extensions/gis/projections/impl/factory_entry.hpp>
#include <boost/geometry/extensions/gis/projections/impl/aasincos.hpp>
namespace boost { namespace geometry { namespace projections
{
#ifndef DOXYGEN_NO_DETAIL
namespace detail { namespace fouc_s{
namespace detail { namespace fouc_s{
static const int MAX_ITER = 10;
static const double LOOP_TOL = 1e-7;
@@ -72,7 +74,7 @@ namespace boost { namespace geometry { namespace projections
inline void fwd(geographic_type& lp_lon, geographic_type& lp_lat, cartesian_type& xy_x, cartesian_type& xy_y) const
{
double t;
t = cos(lp_lat);
xy_x = lp_lon * t / (this->m_proj_parm.n + this->m_proj_parm.n1 * t);
xy_y = this->m_proj_parm.n * lp_lat + this->m_proj_parm.n1 * sin(lp_lat);
@@ -82,7 +84,7 @@ namespace boost { namespace geometry { namespace projections
{
double V;
int i;
if (this->m_proj_parm.n) {
lp_lat = xy_y;
for (i = MAX_ITER; i ; --i) {
@@ -109,12 +111,10 @@ namespace boost { namespace geometry { namespace projections
throw proj_exception(-99);
proj_parm.n1 = 1. - proj_parm.n;
par.es = 0;
// par.inv = s_inverse;
// par.fwd = s_forward;
}
}} // namespace detail::fouc_s
#endif // doxygen
#endif // doxygen
/*!
\brief Foucaut Sinusoidal projection
@@ -158,7 +158,7 @@ namespace boost { namespace geometry { namespace projections
factory.add_to_factory("fouc_s", new fouc_s_entry<Geographic, Cartesian, Parameters>);
}
} // namespace detail
} // namespace detail
#endif // doxygen
}}} // namespace boost::geometry::projections

View File

@@ -4,7 +4,7 @@
// Boost.Geometry - extensions-gis-projections (based on PROJ4)
// This file is automatically generated. DO NOT EDIT.
// Copyright (c) 2008-2012 Barend Gehrels, Amsterdam, the Netherlands.
// Copyright (c) 2008-2015 Barend Gehrels, Amsterdam, the Netherlands.
// Use, modification and distribution is subject to the Boost Software License,
// Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
@@ -15,6 +15,8 @@
// PROJ4 is maintained by Frank Warmerdam
// PROJ4 is converted to Boost.Geometry by Barend Gehrels
// Last updated version of proj: 4.9.1
// Original copyright notice:
// Permission is hereby granted, free of charge, to any person obtaining a
@@ -35,7 +37,6 @@
// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
// DEALINGS IN THE SOFTWARE.
#include <boost/math/special_functions/hypot.hpp>
#include <boost/geometry/extensions/gis/projections/impl/base_static.hpp>
#include <boost/geometry/extensions/gis/projections/impl/base_dynamic.hpp>
@@ -45,13 +46,12 @@
namespace boost { namespace geometry { namespace projections
{
#ifndef DOXYGEN_NO_DETAIL
namespace detail { namespace gall{
namespace detail { namespace gall{
static const double YF = 1.70710678118654752440;
static const double XF = 0.70710678118654752440;
static const double RYF = 0.58578643762690495119;
static const double RXF = 1.41421356237309504880;
// template class, using CRTP to implement forward/inverse
template <typename Geographic, typename Cartesian, typename Parameters>
struct base_gall_spheroid : public base_t_fi<base_gall_spheroid<Geographic, Cartesian, Parameters>,
@@ -84,12 +84,10 @@ namespace boost { namespace geometry { namespace projections
void setup_gall(Parameters& par)
{
par.es = 0.;
// par.inv = s_inverse;
// par.fwd = s_forward;
}
}} // namespace detail::gall
#endif // doxygen
#endif // doxygen
/*!
\brief Gall (Gall Stereographic) projection
@@ -133,7 +131,7 @@ namespace boost { namespace geometry { namespace projections
factory.add_to_factory("gall", new gall_entry<Geographic, Cartesian, Parameters>);
}
} // namespace detail
} // namespace detail
#endif // doxygen
}}} // namespace boost::geometry::projections

View File

@@ -4,7 +4,7 @@
// Boost.Geometry - extensions-gis-projections (based on PROJ4)
// This file is automatically generated. DO NOT EDIT.
// Copyright (c) 2008-2012 Barend Gehrels, Amsterdam, the Netherlands.
// Copyright (c) 2008-2015 Barend Gehrels, Amsterdam, the Netherlands.
// Use, modification and distribution is subject to the Boost Software License,
// Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
@@ -15,6 +15,8 @@
// PROJ4 is maintained by Frank Warmerdam
// PROJ4 is converted to Boost.Geometry by Barend Gehrels
// Last updated version of proj: 4.9.1
// Original copyright notice:
// Permission is hereby granted, free of charge, to any person obtaining a
@@ -35,7 +37,6 @@
// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
// DEALINGS IN THE SOFTWARE.
#include <boost/math/special_functions/hypot.hpp>
#include <boost/geometry/extensions/gis/projections/impl/base_static.hpp>
#include <boost/geometry/extensions/gis/projections/impl/base_dynamic.hpp>
@@ -45,12 +46,7 @@
namespace boost { namespace geometry { namespace projections
{
#ifndef DOXYGEN_NO_DETAIL
namespace detail { namespace geocent{
namespace detail { namespace geocent{
// template class, using CRTP to implement forward/inverse
template <typename Geographic, typename Cartesian, typename Parameters>
@@ -84,15 +80,12 @@ namespace boost { namespace geometry { namespace projections
void setup_geocent(Parameters& par)
{
par.is_geocent = 1;
par.x0 = 0.0;
par.y0 = 0.0;
// par.inv = inverse;
// par.fwd = forward;
}
}} // namespace detail::geocent
#endif // doxygen
#endif // doxygen
/*!
\brief Geocentric projection
@@ -134,7 +127,7 @@ namespace boost { namespace geometry { namespace projections
factory.add_to_factory("geocent", new geocent_entry<Geographic, Cartesian, Parameters>);
}
} // namespace detail
} // namespace detail
#endif // doxygen
}}} // namespace boost::geometry::projections

View File

@@ -4,7 +4,7 @@
// Boost.Geometry - extensions-gis-projections (based on PROJ4)
// This file is automatically generated. DO NOT EDIT.
// Copyright (c) 2008-2012 Barend Gehrels, Amsterdam, the Netherlands.
// Copyright (c) 2008-2015 Barend Gehrels, Amsterdam, the Netherlands.
// Use, modification and distribution is subject to the Boost Software License,
// Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
@@ -15,6 +15,8 @@
// PROJ4 is maintained by Frank Warmerdam
// PROJ4 is converted to Boost.Geometry by Barend Gehrels
// Last updated version of proj: 4.9.1
// Original copyright notice:
// Permission is hereby granted, free of charge, to any person obtaining a
@@ -35,6 +37,7 @@
// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
// DEALINGS IN THE SOFTWARE.
#include <boost/math/special_functions/hypot.hpp>
#include <boost/geometry/extensions/gis/projections/impl/base_static.hpp>
@@ -45,7 +48,7 @@
namespace boost { namespace geometry { namespace projections
{
#ifndef DOXYGEN_NO_DETAIL
namespace detail { namespace geos{
namespace detail { namespace geos{
struct par_geos
{
@@ -59,8 +62,6 @@ namespace boost { namespace geometry { namespace projections
std::string sweep_axis;
int flip_axis;
};
// template class, using CRTP to implement forward/inverse
template <typename Geographic, typename Cartesian, typename Parameters>
@@ -80,7 +81,7 @@ namespace boost { namespace geometry { namespace projections
inline void fwd(geographic_type& lp_lon, geographic_type& lp_lat, cartesian_type& xy_x, cartesian_type& xy_y) const
{
double r, Vx, Vy, Vz, tmp;
/* Calculation of geocentric latitude. */
lp_lat = atan (this->m_proj_parm.radius_p2 * tan (lp_lat));
/* Calculation of the three components of the vector from satellite to
@@ -109,7 +110,7 @@ namespace boost { namespace geometry { namespace projections
inline void inv(cartesian_type& xy_x, cartesian_type& xy_y, geographic_type& lp_lon, geographic_type& lp_lat) const
{
double Vx, Vy, Vz, a, b, det, k;
/* Setting three components of vector from satellite to position.*/
Vx = -1.0;
if(this->m_proj_parm.flip_axis)
@@ -157,7 +158,7 @@ namespace boost { namespace geometry { namespace projections
inline void fwd(geographic_type& lp_lon, geographic_type& lp_lat, cartesian_type& xy_x, cartesian_type& xy_y) const
{
double Vx, Vy, Vz, tmp;
/* Calculation of the three components of the vector from satellite to
** position on earth surface (lon,lat).*/
tmp = cos(lp_lat);
@@ -183,7 +184,7 @@ namespace boost { namespace geometry { namespace projections
inline void inv(cartesian_type& xy_x, cartesian_type& xy_y, geographic_type& lp_lon, geographic_type& lp_lat) const
{
double Vx, Vy, Vz, a, b, det, k;
/* Setting three components of vector from satellite to position.*/
Vx = -1.0;
if(this->m_proj_parm.flip_axis)
@@ -226,7 +227,7 @@ namespace boost { namespace geometry { namespace projections
(proj_parm.sweep_axis[0] != 'x' &&
proj_parm.sweep_axis[0] != 'y'))
throw proj_exception(-49);
if (proj_parm.sweep_axis[0] == 'y')
if (proj_parm.sweep_axis[0] == 'x')
proj_parm.flip_axis = 1;
else
proj_parm.flip_axis = 0;
@@ -238,17 +239,13 @@ namespace boost { namespace geometry { namespace projections
proj_parm.radius_p = sqrt (par.one_es);
proj_parm.radius_p2 = par.one_es;
proj_parm.radius_p_inv2 = par.rone_es;
// par.inv = e_inverse;
// par.fwd = e_forward;
} else {
proj_parm.radius_p = proj_parm.radius_p2 = proj_parm.radius_p_inv2 = 1.0;
// par.inv = s_inverse;
// par.fwd = s_forward;
}
}
}} // namespace detail::geos
#endif // doxygen
#endif // doxygen
/*!
\brief Geostationary Satellite View projection
@@ -320,7 +317,7 @@ namespace boost { namespace geometry { namespace projections
factory.add_to_factory("geos", new geos_entry<Geographic, Cartesian, Parameters>);
}
} // namespace detail
} // namespace detail
#endif // doxygen
}}} // namespace boost::geometry::projections

View File

@@ -4,7 +4,7 @@
// Boost.Geometry - extensions-gis-projections (based on PROJ4)
// This file is automatically generated. DO NOT EDIT.
// Copyright (c) 2008-2012 Barend Gehrels, Amsterdam, the Netherlands.
// Copyright (c) 2008-2015 Barend Gehrels, Amsterdam, the Netherlands.
// Use, modification and distribution is subject to the Boost Software License,
// Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
@@ -15,6 +15,8 @@
// PROJ4 is maintained by Frank Warmerdam
// PROJ4 is converted to Boost.Geometry by Barend Gehrels
// Last updated version of proj: 4.9.1
// Original copyright notice:
// Permission is hereby granted, free of charge, to any person obtaining a
@@ -35,7 +37,6 @@
// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
// DEALINGS IN THE SOFTWARE.
#include <boost/math/special_functions/hypot.hpp>
#include <boost/geometry/extensions/gis/projections/impl/base_static.hpp>
#include <boost/geometry/extensions/gis/projections/impl/base_dynamic.hpp>
@@ -45,12 +46,11 @@
namespace boost { namespace geometry { namespace projections
{
#ifndef DOXYGEN_NO_DETAIL
namespace detail { namespace gins8{
namespace detail { namespace gins8{
static const double Cl = 0.000952426;
static const double Cp = 0.162388;
static const double C12 = 0.08333333333333333;
// template class, using CRTP to implement forward/inverse
template <typename Geographic, typename Cartesian, typename Parameters>
struct base_gins8_spheroid : public base_t_f<base_gins8_spheroid<Geographic, Cartesian, Parameters>,
@@ -68,7 +68,7 @@ namespace boost { namespace geometry { namespace projections
inline void fwd(geographic_type& lp_lon, geographic_type& lp_lat, cartesian_type& xy_x, cartesian_type& xy_y) const
{
double t = lp_lat * lp_lat;
xy_y = lp_lat * (1. + t * C12);
xy_x = lp_lon * (1. - Cp * t);
t = lp_lon * lp_lon;
@@ -81,12 +81,10 @@ namespace boost { namespace geometry { namespace projections
void setup_gins8(Parameters& par)
{
par.es = 0.;
// par.inv = 0;
// par.fwd = s_forward;
}
}} // namespace detail::gins8
#endif // doxygen
#endif // doxygen
/*!
\brief Ginsburg VIII (TsNIIGAiK) projection
@@ -131,7 +129,7 @@ namespace boost { namespace geometry { namespace projections
factory.add_to_factory("gins8", new gins8_entry<Geographic, Cartesian, Parameters>);
}
} // namespace detail
} // namespace detail
#endif // doxygen
}}} // namespace boost::geometry::projections

View File

@@ -4,7 +4,7 @@
// Boost.Geometry - extensions-gis-projections (based on PROJ4)
// This file is automatically generated. DO NOT EDIT.
// Copyright (c) 2008-2012 Barend Gehrels, Amsterdam, the Netherlands.
// Copyright (c) 2008-2015 Barend Gehrels, Amsterdam, the Netherlands.
// Use, modification and distribution is subject to the Boost Software License,
// Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
@@ -15,6 +15,8 @@
// PROJ4 is maintained by Frank Warmerdam
// PROJ4 is converted to Boost.Geometry by Barend Gehrels
// Last updated version of proj: 4.9.1
// Original copyright notice:
// Permission is hereby granted, free of charge, to any person obtaining a
@@ -35,19 +37,18 @@
// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
// DEALINGS IN THE SOFTWARE.
#include <boost/concept_check.hpp>
#include <boost/math/special_functions/hypot.hpp>
#include <boost/geometry/extensions/gis/projections/impl/base_static.hpp>
#include <boost/geometry/extensions/gis/projections/impl/base_dynamic.hpp>
#include <boost/geometry/extensions/gis/projections/impl/projects.hpp>
#include <boost/geometry/extensions/gis/projections/impl/factory_entry.hpp>
#include <boost/geometry/extensions/gis/projections/impl/aasincos.hpp>
#include <boost/geometry/extensions/gis/projections/impl/pj_mlfn.hpp>
namespace boost { namespace geometry { namespace projections
{
#ifndef DOXYGEN_NO_DETAIL
namespace detail { namespace gn_sinu{
namespace detail { namespace gn_sinu{
static const double EPS10 = 1e-10;
static const int MAX_ITER = 8;
static const double LOOP_TOL = 1e-7;
@@ -57,6 +58,7 @@ namespace boost { namespace geometry { namespace projections
double en[EN_SIZE];
double m, n, C_x, C_y;
};
/* Ellipsoidal Sinusoidal only */
// template class, using CRTP to implement forward/inverse
@@ -77,7 +79,7 @@ namespace boost { namespace geometry { namespace projections
inline void fwd(geographic_type& lp_lon, geographic_type& lp_lat, cartesian_type& xy_x, cartesian_type& xy_y) const
{
double s, c;
xy_y = pj_mlfn(lp_lat, s = sin(lp_lat), c = cos(lp_lat), this->m_proj_parm.en);
xy_x = lp_lon * c / sqrt(1. - this->m_par.es * s * s);
}
@@ -85,14 +87,13 @@ namespace boost { namespace geometry { namespace projections
inline void inv(cartesian_type& xy_x, cartesian_type& xy_y, geographic_type& lp_lon, geographic_type& lp_lat) const
{
double s;
if ((s = fabs(lp_lat = pj_inv_mlfn(xy_y, this->m_par.es, this->m_proj_parm.en))) < HALFPI) {
s = sin(lp_lat);
lp_lon = xy_x * sqrt(1. - this->m_par.es * s * s) / cos(lp_lat);
} else if ((s - EPS10) < HALFPI)
lp_lon = 0.;
else throw proj_exception();;
return;
}
/* General spherical sinusoidals */
};
@@ -119,7 +120,7 @@ namespace boost { namespace geometry { namespace projections
else {
double k, V;
int i;
k = this->m_proj_parm.n * sin(lp_lat);
for (i = MAX_ITER; i ; --i) {
lp_lat -= V = (this->m_proj_parm.m * lp_lat + sin(lp_lat) - k) /
@@ -146,12 +147,8 @@ namespace boost { namespace geometry { namespace projections
template <typename Parameters>
void setup(Parameters& par, par_gn_sinu& proj_parm)
{
boost::ignore_unused_variable_warning(par);
boost::ignore_unused_variable_warning(proj_parm);
par.es = 0;
proj_parm.C_x = (proj_parm.C_y = sqrt((proj_parm.m + 1.) / proj_parm.n))/(proj_parm.m + 1.);
// par.inv = s_inverse;
// par.fwd = s_forward;
}
@@ -171,11 +168,9 @@ namespace boost { namespace geometry { namespace projections
template <typename Parameters>
void setup_sinu(Parameters& par, par_gn_sinu& proj_parm)
{
pj_enfn(par.es, proj_parm.en);
if (!pj_enfn(par.es, proj_parm.en))
throw proj_exception(0);
if (par.es) {
// par.inv = e_inverse;
// par.fwd = e_forward;
} else {
proj_parm.n = 1.;
proj_parm.m = 0.;
@@ -202,7 +197,29 @@ namespace boost { namespace geometry { namespace projections
}
}} // namespace detail::gn_sinu
#endif // doxygen
#endif // doxygen
/*!
\brief General Sinusoidal Series projection
\ingroup projections
\tparam Geographic latlong point type
\tparam Cartesian xy point type
\tparam Parameters parameter type
\par Projection characteristics
- Pseudocylindrical
- Spheroid
- m= n=
\par Example
\image html ex_gn_sinu.gif
*/
template <typename Geographic, typename Cartesian, typename Parameters = parameters>
struct gn_sinu_ellipsoid : public detail::gn_sinu::base_gn_sinu_ellipsoid<Geographic, Cartesian, Parameters>
{
inline gn_sinu_ellipsoid(const Parameters& par) : detail::gn_sinu::base_gn_sinu_ellipsoid<Geographic, Cartesian, Parameters>(par)
{
detail::gn_sinu::setup_gn_sinu(this->m_par, this->m_proj_parm);
}
};
/*!
\brief Sinusoidal (Sanson-Flamsteed) projection
@@ -226,6 +243,48 @@ namespace boost { namespace geometry { namespace projections
}
};
/*!
\brief Eckert VI projection
\ingroup projections
\tparam Geographic latlong point type
\tparam Cartesian xy point type
\tparam Parameters parameter type
\par Projection characteristics
- Pseudocylindrical
- Spheroid
\par Example
\image html ex_eck6.gif
*/
template <typename Geographic, typename Cartesian, typename Parameters = parameters>
struct eck6_ellipsoid : public detail::gn_sinu::base_gn_sinu_ellipsoid<Geographic, Cartesian, Parameters>
{
inline eck6_ellipsoid(const Parameters& par) : detail::gn_sinu::base_gn_sinu_ellipsoid<Geographic, Cartesian, Parameters>(par)
{
detail::gn_sinu::setup_eck6(this->m_par, this->m_proj_parm);
}
};
/*!
\brief McBryde-Thomas Flat-Polar Sinusoidal projection
\ingroup projections
\tparam Geographic latlong point type
\tparam Cartesian xy point type
\tparam Parameters parameter type
\par Projection characteristics
- Pseudocylindrical
- Spheroid
\par Example
\image html ex_mbtfps.gif
*/
template <typename Geographic, typename Cartesian, typename Parameters = parameters>
struct mbtfps_ellipsoid : public detail::gn_sinu::base_gn_sinu_ellipsoid<Geographic, Cartesian, Parameters>
{
inline mbtfps_ellipsoid(const Parameters& par) : detail::gn_sinu::base_gn_sinu_ellipsoid<Geographic, Cartesian, Parameters>(par)
{
detail::gn_sinu::setup_mbtfps(this->m_par, this->m_proj_parm);
}
};
/*!
\brief General Sinusoidal Series projection
\ingroup projections
@@ -369,7 +428,7 @@ namespace boost { namespace geometry { namespace projections
factory.add_to_factory("mbtfps", new mbtfps_entry<Geographic, Cartesian, Parameters>);
}
} // namespace detail
} // namespace detail
#endif // doxygen
}}} // namespace boost::geometry::projections

View File

@@ -4,7 +4,7 @@
// Boost.Geometry - extensions-gis-projections (based on PROJ4)
// This file is automatically generated. DO NOT EDIT.
// Copyright (c) 2008-2012 Barend Gehrels, Amsterdam, the Netherlands.
// Copyright (c) 2008-2015 Barend Gehrels, Amsterdam, the Netherlands.
// Use, modification and distribution is subject to the Boost Software License,
// Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
@@ -15,6 +15,8 @@
// PROJ4 is maintained by Frank Warmerdam
// PROJ4 is converted to Boost.Geometry by Barend Gehrels
// Last updated version of proj: 4.9.1
// Original copyright notice:
// Permission is hereby granted, free of charge, to any person obtaining a
@@ -35,6 +37,7 @@
// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
// DEALINGS IN THE SOFTWARE.
#include <boost/math/special_functions/hypot.hpp>
#include <boost/geometry/extensions/gis/projections/impl/base_static.hpp>
@@ -45,7 +48,7 @@
namespace boost { namespace geometry { namespace projections
{
#ifndef DOXYGEN_NO_DETAIL
namespace detail { namespace gnom{
namespace detail { namespace gnom{
static const double EPS10 = 1.e-10;
static const int N_POLE = 0;
static const int S_POLE = 1;
@@ -77,7 +80,7 @@ namespace boost { namespace geometry { namespace projections
inline void fwd(geographic_type& lp_lon, geographic_type& lp_lat, cartesian_type& xy_x, cartesian_type& xy_y) const
{
double coslam, cosphi, sinphi;
sinphi = sin(lp_lat);
cosphi = cos(lp_lat);
coslam = cos(lp_lon);
@@ -115,7 +118,7 @@ namespace boost { namespace geometry { namespace projections
inline void inv(cartesian_type& xy_x, cartesian_type& xy_y, geographic_type& lp_lon, geographic_type& lp_lat) const
{
double rh, cosz, sinz;
rh = boost::math::hypot(xy_x, xy_y);
sinz = sin(lp_lat = atan(rh));
cosz = sqrt(1. - sinz * sinz);
@@ -168,13 +171,11 @@ namespace boost { namespace geometry { namespace projections
proj_parm.sinph0 = sin(par.phi0);
proj_parm.cosph0 = cos(par.phi0);
}
// par.inv = s_inverse;
// par.fwd = s_forward;
par.es = 0.;
}
}} // namespace detail::gnom
#endif // doxygen
#endif // doxygen
/*!
\brief Gnomonic projection
@@ -218,7 +219,7 @@ namespace boost { namespace geometry { namespace projections
factory.add_to_factory("gnom", new gnom_entry<Geographic, Cartesian, Parameters>);
}
} // namespace detail
} // namespace detail
#endif // doxygen
}}} // namespace boost::geometry::projections

View File

@@ -4,7 +4,7 @@
// Boost.Geometry - extensions-gis-projections (based on PROJ4)
// This file is automatically generated. DO NOT EDIT.
// Copyright (c) 2008-2012 Barend Gehrels, Amsterdam, the Netherlands.
// Copyright (c) 2008-2015 Barend Gehrels, Amsterdam, the Netherlands.
// Use, modification and distribution is subject to the Boost Software License,
// Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
@@ -15,6 +15,8 @@
// PROJ4 is maintained by Frank Warmerdam
// PROJ4 is converted to Boost.Geometry by Barend Gehrels
// Last updated version of proj: 4.9.1
// Original copyright notice:
// Permission is hereby granted, free of charge, to any person obtaining a
@@ -35,20 +37,18 @@
// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
// DEALINGS IN THE SOFTWARE.
#include <boost/math/special_functions/hypot.hpp>
#include <boost/geometry/extensions/gis/projections/impl/base_static.hpp>
#include <boost/geometry/extensions/gis/projections/impl/base_dynamic.hpp>
#include <boost/geometry/extensions/gis/projections/impl/projects.hpp>
#include <boost/geometry/extensions/gis/projections/impl/factory_entry.hpp>
#include <boost/geometry/extensions/gis/projections/proj/moll.hpp>
#include <boost/geometry/extensions/gis/projections/proj/gn_sinu.hpp>
#include <boost/geometry/extensions/gis/projections/proj/moll.hpp>
namespace boost { namespace geometry { namespace projections
{
#ifndef DOXYGEN_NO_DETAIL
namespace detail { namespace goode{
namespace detail { namespace goode{
static const double Y_COR = 0.05280;
static const double PHI_LIM = .71093078197902358062;
@@ -102,12 +102,10 @@ namespace boost { namespace geometry { namespace projections
void setup_goode(Parameters& par, par_goode<Geographic, Cartesian, Parameters>& proj_parm)
{
par.es = 0.;
// par.fwd = s_forward;
// par.inv = s_inverse;
}
}} // namespace detail::goode
#endif // doxygen
#endif // doxygen
/*!
\brief Goode Homolosine projection
@@ -151,7 +149,7 @@ namespace boost { namespace geometry { namespace projections
factory.add_to_factory("goode", new goode_entry<Geographic, Cartesian, Parameters>);
}
} // namespace detail
} // namespace detail
#endif // doxygen
}}} // namespace boost::geometry::projections

View File

@@ -4,7 +4,7 @@
// Boost.Geometry - extensions-gis-projections (based on PROJ4)
// This file is automatically generated. DO NOT EDIT.
// Copyright (c) 2008-2012 Barend Gehrels, Amsterdam, the Netherlands.
// Copyright (c) 2008-2015 Barend Gehrels, Amsterdam, the Netherlands.
// Use, modification and distribution is subject to the Boost Software License,
// Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
@@ -15,6 +15,8 @@
// PROJ4 is maintained by Frank Warmerdam
// PROJ4 is converted to Boost.Geometry by Barend Gehrels
// Last updated version of proj: 4.9.1
// Original copyright notice:
// Permission is hereby granted, free of charge, to any person obtaining a
@@ -35,19 +37,18 @@
// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
// DEALINGS IN THE SOFTWARE.
#include <boost/math/special_functions/hypot.hpp>
#include <boost/geometry/extensions/gis/projections/impl/base_static.hpp>
#include <boost/geometry/extensions/gis/projections/impl/base_dynamic.hpp>
#include <boost/geometry/extensions/gis/projections/impl/projects.hpp>
#include <boost/geometry/extensions/gis/projections/impl/factory_entry.hpp>
#include <boost/geometry/extensions/gis/projections/impl/pj_tsfn.hpp>
#include <boost/geometry/extensions/gis/projections/impl/pj_phi2.hpp>
#include <boost/geometry/extensions/gis/projections/impl/pj_tsfn.hpp>
namespace boost { namespace geometry { namespace projections
{
#ifndef DOXYGEN_NO_DETAIL
namespace detail { namespace gstmerc{
namespace detail { namespace gstmerc{
struct par_gstmerc
{
@@ -59,7 +60,6 @@ namespace boost { namespace geometry { namespace projections
double XS;
double YS;
};
// template class, using CRTP to implement forward/inverse
template <typename Geographic, typename Cartesian, typename Parameters>
@@ -110,18 +110,13 @@ namespace boost { namespace geometry { namespace projections
proj_parm.c= log(pj_tsfn(-1.0*proj_parm.phic,0.0,0.0))
-proj_parm.n1*log(pj_tsfn(-1.0*par.phi0,-1.0*sin(par.phi0),par.e));
proj_parm.n2= par.k0*par.a*sqrt(1.0-par.es)/(1.0-par.es*sin(par.phi0)*sin(par.phi0));
proj_parm.XS= 0;
/* -par.x0 */
proj_parm.YS= -1.0*proj_parm.n2*proj_parm.phic;
/* -par.y0 */
// par.inv= s_inverse;
// par.fwd= s_forward;
/*fprintf(stderr,"a (m) =%16.4f\ne =%16.13f\nl0(rad)=%16.13f\np0(rad)=%16.13f\nk0 =%16.4f\nX0 (m)=%16.4f\nY0 (m)=%16.4f\n\nlC(rad)=%16.13f\npC(rad)=%16.13f\nc =%16.13f\nn1 =%16.13f\nn2 (m) =%16.4f\nXS (m) =%16.4f\nYS (m) =%16.4f\n", par.a, par.e, par.lam0, par.phi0, par.k0, par.x0, par.y0, proj_parm.lamc, proj_parm.phic, proj_parm.c, proj_parm.n1, proj_parm.n2, proj_parm.XS +par.x0, proj_parm.YS + par.y0);
*/
proj_parm.XS= 0;/* -par.x0 */
proj_parm.YS= -1.0*proj_parm.n2*proj_parm.phic;/* -par.y0 */
/*fprintf(stderr,"a (m) =%16.4f\ne =%16.13f\nl0(rad)=%16.13f\np0(rad)=%16.13f\nk0 =%16.4f\nX0 (m)=%16.4f\nY0 (m)=%16.4f\n\nlC(rad)=%16.13f\npC(rad)=%16.13f\nc =%16.13f\nn1 =%16.13f\nn2 (m) =%16.4f\nXS (m) =%16.4f\nYS (m) =%16.4f\n", par.a, par.e, par.lam0, par.phi0, par.k0, par.x0, par.y0, proj_parm.lamc, proj_parm.phic, proj_parm.c, proj_parm.n1, proj_parm.n2, proj_parm.XS +par.x0, proj_parm.YS + par.y0);*/
}
}} // namespace detail::gstmerc
#endif // doxygen
#endif // doxygen
/*!
\brief Gauss-Schreiber Transverse Mercator (aka Gauss-Laborde Reunion) projection
@@ -167,7 +162,7 @@ namespace boost { namespace geometry { namespace projections
factory.add_to_factory("gstmerc", new gstmerc_entry<Geographic, Cartesian, Parameters>);
}
} // namespace detail
} // namespace detail
#endif // doxygen
}}} // namespace boost::geometry::projections

View File

@@ -4,7 +4,7 @@
// Boost.Geometry - extensions-gis-projections (based on PROJ4)
// This file is automatically generated. DO NOT EDIT.
// Copyright (c) 2008-2012 Barend Gehrels, Amsterdam, the Netherlands.
// Copyright (c) 2008-2015 Barend Gehrels, Amsterdam, the Netherlands.
// Use, modification and distribution is subject to the Boost Software License,
// Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
@@ -15,6 +15,8 @@
// PROJ4 is maintained by Frank Warmerdam
// PROJ4 is converted to Boost.Geometry by Barend Gehrels
// Last updated version of proj: 4.9.1
// Original copyright notice:
// Permission is hereby granted, free of charge, to any person obtaining a
@@ -35,7 +37,6 @@
// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
// DEALINGS IN THE SOFTWARE.
#include <boost/math/special_functions/hypot.hpp>
#include <boost/geometry/extensions/gis/projections/impl/base_static.hpp>
#include <boost/geometry/extensions/gis/projections/impl/base_dynamic.hpp>
@@ -45,7 +46,7 @@
namespace boost { namespace geometry { namespace projections
{
#ifndef DOXYGEN_NO_DETAIL
namespace detail { namespace hammer{
namespace detail { namespace hammer{
struct par_hammer
{
@@ -71,7 +72,7 @@ namespace boost { namespace geometry { namespace projections
inline void fwd(geographic_type& lp_lon, geographic_type& lp_lat, cartesian_type& xy_x, cartesian_type& xy_y) const
{
double cosphi, d;
d = sqrt(2./(1. + (cosphi = cos(lp_lat)) * cos(lp_lon *= this->m_proj_parm.w)));
xy_x = this->m_proj_parm.m * d * cosphi * sin(lp_lon);
xy_y = this->m_proj_parm.rm * d * sin(lp_lat);
@@ -93,11 +94,10 @@ namespace boost { namespace geometry { namespace projections
proj_parm.rm = 1. / proj_parm.m;
proj_parm.m /= proj_parm.w;
par.es = 0.;
// par.fwd = s_forward;
}
}} // namespace detail::hammer
#endif // doxygen
#endif // doxygen
/*!
\brief Hammer & Eckert-Greifendorff projection
@@ -143,7 +143,7 @@ namespace boost { namespace geometry { namespace projections
factory.add_to_factory("hammer", new hammer_entry<Geographic, Cartesian, Parameters>);
}
} // namespace detail
} // namespace detail
#endif // doxygen
}}} // namespace boost::geometry::projections

View File

@@ -4,7 +4,7 @@
// Boost.Geometry - extensions-gis-projections (based on PROJ4)
// This file is automatically generated. DO NOT EDIT.
// Copyright (c) 2008-2012 Barend Gehrels, Amsterdam, the Netherlands.
// Copyright (c) 2008-2015 Barend Gehrels, Amsterdam, the Netherlands.
// Use, modification and distribution is subject to the Boost Software License,
// Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
@@ -15,6 +15,8 @@
// PROJ4 is maintained by Frank Warmerdam
// PROJ4 is converted to Boost.Geometry by Barend Gehrels
// Last updated version of proj: 4.9.1
// Original copyright notice:
// Permission is hereby granted, free of charge, to any person obtaining a
@@ -35,7 +37,6 @@
// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
// DEALINGS IN THE SOFTWARE.
#include <boost/math/special_functions/hypot.hpp>
#include <boost/geometry/extensions/gis/projections/impl/base_static.hpp>
#include <boost/geometry/extensions/gis/projections/impl/base_dynamic.hpp>
@@ -45,7 +46,7 @@
namespace boost { namespace geometry { namespace projections
{
#ifndef DOXYGEN_NO_DETAIL
namespace detail { namespace hatano{
namespace detail { namespace hatano{
static const int NITER = 20;
static const double EPS = 1e-7;
static const double ONETOL = 1.000001;
@@ -60,7 +61,6 @@ namespace boost { namespace geometry { namespace projections
static const double FXC = 0.85;
static const double RXC = 1.17647058823529411764;
// template class, using CRTP to implement forward/inverse
template <typename Geographic, typename Cartesian, typename Parameters>
struct base_hatano_spheroid : public base_t_fi<base_hatano_spheroid<Geographic, Cartesian, Parameters>,
@@ -79,7 +79,7 @@ namespace boost { namespace geometry { namespace projections
{
double th1, c;
int i;
c = sin(lp_lat) * (lp_lat < 0. ? CS_ : CN_);
for (i = NITER; i; --i) {
lp_lat -= th1 = (lp_lat + sin(lp_lat) - c) / (1. + cos(lp_lat));
@@ -92,7 +92,7 @@ namespace boost { namespace geometry { namespace projections
inline void inv(cartesian_type& xy_x, cartesian_type& xy_y, geographic_type& lp_lon, geographic_type& lp_lat) const
{
double th;
th = xy_y * ( xy_y < 0. ? RYCS : RYCN);
if (fabs(th) > 1.)
if (fabs(th) > ONETOL) throw proj_exception();
@@ -115,12 +115,10 @@ namespace boost { namespace geometry { namespace projections
void setup_hatano(Parameters& par)
{
par.es = 0.;
// par.inv = s_inverse;
// par.fwd = s_forward;
}
}} // namespace detail::hatano
#endif // doxygen
#endif // doxygen
/*!
\brief Hatano Asymmetrical Equal Area projection
@@ -164,7 +162,7 @@ namespace boost { namespace geometry { namespace projections
factory.add_to_factory("hatano", new hatano_entry<Geographic, Cartesian, Parameters>);
}
} // namespace detail
} // namespace detail
#endif // doxygen
}}} // namespace boost::geometry::projections

View File

@@ -0,0 +1,304 @@
#ifndef BOOST_GEOMETRY_PROJECTIONS_IGH_HPP
#define BOOST_GEOMETRY_PROJECTIONS_IGH_HPP
// Boost.Geometry - extensions-gis-projections (based on PROJ4)
// This file is automatically generated. DO NOT EDIT.
// Copyright (c) 2008-2015 Barend Gehrels, Amsterdam, the Netherlands.
// 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)
// This file is converted from PROJ4, http://trac.osgeo.org/proj
// PROJ4 is originally written by Gerald Evenden (then of the USGS)
// PROJ4 is maintained by Frank Warmerdam
// PROJ4 is converted to Boost.Geometry by Barend Gehrels
// Last updated version of proj: 4.9.1
// Original copyright notice:
// Permission is hereby granted, free of charge, to any person obtaining a
// copy of this software and associated documentation files (the "Software"),
// to deal in the Software without restriction, including without limitation
// the rights to use, copy, modify, merge, publish, distribute, sublicense,
// and/or sell copies of the Software, and to permit persons to whom the
// Software is furnished to do so, subject to the following conditions:
// The above copyright notice and this permission notice shall be included
// in all copies or substantial portions of the Software.
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
// THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
// DEALINGS IN THE SOFTWARE.
#include <boost/shared_ptr.hpp>
#include <boost/geometry/extensions/gis/projections/impl/base_static.hpp>
#include <boost/geometry/extensions/gis/projections/impl/base_dynamic.hpp>
#include <boost/geometry/extensions/gis/projections/impl/projects.hpp>
#include <boost/geometry/extensions/gis/projections/impl/factory_entry.hpp>
#include <boost/geometry/extensions/gis/projections/proj/gn_sinu.hpp>
#include <boost/geometry/extensions/gis/projections/proj/moll.hpp>
namespace boost { namespace geometry { namespace projections
{
#ifndef DOXYGEN_NO_DETAIL
namespace detail { namespace igh{
template <typename Geographic, typename Cartesian>
struct par_igh
{
boost::shared_ptr<projection<Geographic, Cartesian> > pj[12];
double dy0;
};
static const double d4044118 = (40 + 44/60. + 11.8/3600.) * DEG_TO_RAD; // 40d 44' 11.8" [degrees]
static const double d10 = 10 * DEG_TO_RAD;
static const double d20 = 20 * DEG_TO_RAD;
static const double d30 = 30 * DEG_TO_RAD;
static const double d40 = 40 * DEG_TO_RAD;
static const double d50 = 50 * DEG_TO_RAD;
static const double d60 = 60 * DEG_TO_RAD;
static const double d80 = 80 * DEG_TO_RAD;
static const double d90 = 90 * DEG_TO_RAD;
static const double d100 = 100 * DEG_TO_RAD;
static const double d140 = 140 * DEG_TO_RAD;
static const double d160 = 160 * DEG_TO_RAD;
static const double d180 = 180 * DEG_TO_RAD;
static const double EPSLN = 1.e-10; // allow a little 'slack' on zone edge positions
// Converted from #define SETUP(n, proj, x_0, y_0, lon_0)
template <template <typename, typename, typename> class Entry, typename Parameters, typename Geographic, typename Cartesian>
inline void do_setup(int n, Parameters const& par, par_igh<Geographic, Cartesian>& proj_parm, double x_0, double y_0, double lon_0)
{
Entry<Geographic, Cartesian, Parameters> entry;
proj_parm.pj[n-1].reset(entry.create_new(par));
proj_parm.pj[n-1]->mutable_params().x0 = x_0;
proj_parm.pj[n-1]->mutable_params().y0 = y_0;
proj_parm.pj[n-1]->mutable_params().lam0 = lon_0;
}
// template class, using CRTP to implement forward/inverse
template <typename Geographic, typename Cartesian, typename Parameters>
struct base_igh_spheroid : public base_t_fi<base_igh_spheroid<Geographic, Cartesian, Parameters>,
Geographic, Cartesian, Parameters>
{
typedef double geographic_type;
typedef double cartesian_type;
par_igh<Geographic, Cartesian> m_proj_parm;
inline base_igh_spheroid(const Parameters& par)
: base_t_fi<base_igh_spheroid<Geographic, Cartesian, Parameters>,
Geographic, Cartesian, Parameters>(*this, par) {}
inline void fwd(geographic_type& lp_lon, geographic_type& lp_lat, cartesian_type& xy_x, cartesian_type& xy_y) const
{
int z;
if (lp_lat >= d4044118) { // 1|2
z = (lp_lon <= -d40 ? 1: 2);
}
else if (lp_lat >= 0) { // 3|4
z = (lp_lon <= -d40 ? 3: 4);
}
else if (lp_lat >= -d4044118) { // 5|6|7|8
if (lp_lon <= -d100) z = 5; // 5
else if (lp_lon <= -d20) z = 6; // 6
else if (lp_lon <= d80) z = 7; // 7
else z = 8; // 8
}
else { // 9|10|11|12
if (lp_lon <= -d100) z = 9; // 9
else if (lp_lon <= -d20) z = 10; // 10
else if (lp_lon <= d80) z = 11; // 11
else z = 12; // 12
}
lp_lon -= this->m_proj_parm.pj[z-1]->params().lam0;
this->m_proj_parm.pj[z-1]->fwd(lp_lon, lp_lat, xy_x, xy_y);
xy_x += this->m_proj_parm.pj[z-1]->params().x0;
xy_y += this->m_proj_parm.pj[z-1]->params().y0;
}
inline void inv(cartesian_type& xy_x, cartesian_type& xy_y, geographic_type& lp_lon, geographic_type& lp_lat) const
{
const double y90 = this->m_proj_parm.dy0 + sqrt(2); // lt=90 corresponds to y=y0+sqrt(2)
int z = 0;
if (xy_y > y90+EPSLN || xy_y < -y90+EPSLN) // 0
z = 0;
else if (xy_y >= d4044118) // 1|2
z = (xy_x <= -d40? 1: 2);
else if (xy_y >= 0) // 3|4
z = (xy_x <= -d40? 3: 4);
else if (xy_y >= -d4044118) { // 5|6|7|8
if (xy_x <= -d100) z = 5; // 5
else if (xy_x <= -d20) z = 6; // 6
else if (xy_x <= d80) z = 7; // 7
else z = 8; // 8
}
else { // 9|10|11|12
if (xy_x <= -d100) z = 9; // 9
else if (xy_x <= -d20) z = 10; // 10
else if (xy_x <= d80) z = 11; // 11
else z = 12; // 12
}
if (z)
{
int ok = 0;
xy_x -= this->m_proj_parm.pj[z-1]->params().x0;
xy_y -= this->m_proj_parm.pj[z-1]->params().y0;
this->m_proj_parm.pj[z-1]->inv(xy_x, xy_y, lp_lon, lp_lat);
lp_lon += this->m_proj_parm.pj[z-1]->params().lam0;
switch (z) {
case 1: ok = (lp_lon >= -d180-EPSLN && lp_lon <= -d40+EPSLN) ||
((lp_lon >= -d40-EPSLN && lp_lon <= -d10+EPSLN) &&
(lp_lat >= d60-EPSLN && lp_lat <= d90+EPSLN)); break;
case 2: ok = (lp_lon >= -d40-EPSLN && lp_lon <= d180+EPSLN) ||
((lp_lon >= -d180-EPSLN && lp_lon <= -d160+EPSLN) &&
(lp_lat >= d50-EPSLN && lp_lat <= d90+EPSLN)) ||
((lp_lon >= -d50-EPSLN && lp_lon <= -d40+EPSLN) &&
(lp_lat >= d60-EPSLN && lp_lat <= d90+EPSLN)); break;
case 3: ok = (lp_lon >= -d180-EPSLN && lp_lon <= -d40+EPSLN); break;
case 4: ok = (lp_lon >= -d40-EPSLN && lp_lon <= d180+EPSLN); break;
case 5: ok = (lp_lon >= -d180-EPSLN && lp_lon <= -d100+EPSLN); break;
case 6: ok = (lp_lon >= -d100-EPSLN && lp_lon <= -d20+EPSLN); break;
case 7: ok = (lp_lon >= -d20-EPSLN && lp_lon <= d80+EPSLN); break;
case 8: ok = (lp_lon >= d80-EPSLN && lp_lon <= d180+EPSLN); break;
case 9: ok = (lp_lon >= -d180-EPSLN && lp_lon <= -d100+EPSLN); break;
case 10: ok = (lp_lon >= -d100-EPSLN && lp_lon <= -d20+EPSLN); break;
case 11: ok = (lp_lon >= -d20-EPSLN && lp_lon <= d80+EPSLN); break;
case 12: ok = (lp_lon >= d80-EPSLN && lp_lon <= d180+EPSLN); break;
}
z = (!ok? 0: z); // projectable?
}
// if (!z) throw proj_exception( -15); // invalid x or y
if (!z) lp_lon = HUGE_VAL;
if (!z) lp_lat = HUGE_VAL;
}
};
// Interrupted Goode Homolosine
template <typename Geographic, typename Cartesian, typename Parameters>
void setup_igh(Parameters& par, par_igh<Geographic, Cartesian>& proj_parm)
{
/*
Zones:
-180 -40 180
+--------------+-------------------------+ Zones 1,2,9,10,11 & 12:
|1 |2 | Mollweide projection
| | |
+--------------+-------------------------+ Zones 3,4,5,6,7 & 8:
|3 |4 | Sinusoidal projection
| | |
0 +-------+------+-+-----------+-----------+
|5 |6 |7 |8 |
| | | | |
+-------+--------+-----------+-----------+
|9 |10 |11 |12 |
| | | | |
+-------+--------+-----------+-----------+
-180 -100 -20 80 180
*/
double lp_lam = 0, lp_phi = d4044118;
double xy1_x, xy1_y;
double xy3_x, xy3_y;
// sinusoidal zones
do_setup<sinu_entry>(3, par, proj_parm, -d100, 0, -d100);
do_setup<sinu_entry>(4, par, proj_parm, d30, 0, d30);
do_setup<sinu_entry>(5, par, proj_parm, -d160, 0, -d160);
do_setup<sinu_entry>(6, par, proj_parm, -d60, 0, -d60);
do_setup<sinu_entry>(7, par, proj_parm, d20, 0, d20);
do_setup<sinu_entry>(8, par, proj_parm, d140, 0, d140);
// mollweide zones
do_setup<moll_entry>(1, par, proj_parm, -d100, 0, -d100);
// y0 ?
proj_parm.pj[0]->fwd(lp_lam, lp_phi, xy1_x, xy1_y); // zone 1
proj_parm.pj[2]->fwd(lp_lam, lp_phi, xy3_x, xy3_y); // zone 3
// y0 + xy1_y = xy3_y for lt = 40d44'11.8"
proj_parm.dy0 = xy3_y - xy1_y;
proj_parm.pj[0]->mutable_params().y0 = proj_parm.dy0;
// mollweide zones (cont'd)
do_setup<moll_entry>( 2, par, proj_parm, d30, proj_parm.dy0, d30);
do_setup<moll_entry>( 9, par, proj_parm, -d160, -proj_parm.dy0, -d160);
do_setup<moll_entry>(10, par, proj_parm, -d60, -proj_parm.dy0, -d60);
do_setup<moll_entry>(11, par, proj_parm, d20, -proj_parm.dy0, d20);
do_setup<moll_entry>(12, par, proj_parm, d140, -proj_parm.dy0, d140);
par.es = 0.;
}
}} // namespace detail::igh
#endif // doxygen
/*!
\brief Interrupted Goode Homolosine projection
\ingroup projections
\tparam Geographic latlong point type
\tparam Cartesian xy point type
\tparam Parameters parameter type
\par Projection characteristics
- Pseudocylindrical
- Spheroid
\par Example
\image html ex_igh.gif
*/
template <typename Geographic, typename Cartesian, typename Parameters = parameters>
struct igh_spheroid : public detail::igh::base_igh_spheroid<Geographic, Cartesian, Parameters>
{
inline igh_spheroid(const Parameters& par) : detail::igh::base_igh_spheroid<Geographic, Cartesian, Parameters>(par)
{
detail::igh::setup_igh(this->m_par, this->m_proj_parm);
}
};
#ifndef DOXYGEN_NO_DETAIL
namespace detail
{
// Factory entry(s)
template <typename Geographic, typename Cartesian, typename Parameters>
class igh_entry : public detail::factory_entry<Geographic, Cartesian, Parameters>
{
public :
virtual projection<Geographic, Cartesian>* create_new(const Parameters& par) const
{
return new base_v_fi<igh_spheroid<Geographic, Cartesian, Parameters>, Geographic, Cartesian, Parameters>(par);
}
};
template <typename Geographic, typename Cartesian, typename Parameters>
inline void igh_init(detail::base_factory<Geographic, Cartesian, Parameters>& factory)
{
factory.add_to_factory("igh", new igh_entry<Geographic, Cartesian, Parameters>);
}
} // namespace detail
#endif // doxygen
}}} // namespace boost::geometry::projections
#endif // BOOST_GEOMETRY_PROJECTIONS_IGH_HPP

View File

@@ -4,7 +4,7 @@
// Boost.Geometry - extensions-gis-projections (based on PROJ4)
// This file is automatically generated. DO NOT EDIT.
// Copyright (c) 2008-2012 Barend Gehrels, Amsterdam, the Netherlands.
// Copyright (c) 2008-2015 Barend Gehrels, Amsterdam, the Netherlands.
// Use, modification and distribution is subject to the Boost Software License,
// Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
@@ -15,6 +15,8 @@
// PROJ4 is maintained by Frank Warmerdam
// PROJ4 is converted to Boost.Geometry by Barend Gehrels
// Last updated version of proj: 4.9.1
// Original copyright notice:
// Permission is hereby granted, free of charge, to any person obtaining a
@@ -35,7 +37,6 @@
// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
// DEALINGS IN THE SOFTWARE.
#include <boost/math/special_functions/hypot.hpp>
#include <boost/geometry/extensions/gis/projections/impl/base_static.hpp>
#include <boost/geometry/extensions/gis/projections/impl/base_dynamic.hpp>
@@ -46,11 +47,11 @@
namespace boost { namespace geometry { namespace projections
{
#ifndef DOXYGEN_NO_DETAIL
namespace detail { namespace imw_p{
namespace detail { namespace imw_p{
static const double TOL = 1e-10;
static const double EPS = 1e-10;
struct PXY { double x, y; }; // x/y projection specific
struct XY { double x, y; }; // specific for IMW_P
struct par_imw_p
{
@@ -59,11 +60,12 @@ namespace boost { namespace geometry { namespace projections
double en[EN_SIZE];
int mode; /* = 0, phi_1 and phi_2 != 0, = 1, phi_1 = 0, = -1 phi_2 = 0 */
};
template <typename Parameters>
inline int
phi12(Parameters& par, par_imw_p& proj_parm, double *del, double *sig) {
int err = 0;
if (!pj_param(par.params, "tlat_1").i ||
!pj_param(par.params, "tlat_2").i) {
err = -41;
@@ -77,16 +79,16 @@ namespace boost { namespace geometry { namespace projections
return err;
}
template <typename Parameters>
inline PXY
loc_for(double const& lp_lam, double const& lp_phi, const Parameters& par, par_imw_p const& proj_parm, double *yc) {
PXY xy;
inline XY
loc_for(double const& lp_lam, double const& lp_phi, Parameters const& par, par_imw_p const& proj_parm, double *yc) {
XY xy;
if (! lp_phi) {
xy.x = lp_lam;
xy.y = 0.;
} else {
double xa, ya, xb, yb, xc, D, B, m, sp, t, R, C;
sp = sin(lp_phi);
m = pj_mlfn(lp_phi, sp, cos(lp_phi), proj_parm.en);
xa = proj_parm.Pp + proj_parm.Qp * m;
@@ -124,19 +126,17 @@ namespace boost { namespace geometry { namespace projections
}
return (xy);
}
template <typename Parameters>
inline void
xy(Parameters& par, par_imw_p& proj_parm, double phi, double *x, double *y, double *sp, double *R) {
inline void
xy(Parameters const& par, par_imw_p const& proj_parm, double phi, double *x, double *y, double *sp, double *R) {
double F;
*sp = sin(phi);
*R = 1./(tan(phi) * sqrt(1. - par.es * *sp * *sp ));
F = proj_parm.lam_1 * *sp;
*y = *R * (1 - cos(F));
*x = *R * sin(F);
}
// template class, using CRTP to implement forward/inverse
template <typename Geographic, typename Cartesian, typename Parameters>
@@ -156,15 +156,15 @@ namespace boost { namespace geometry { namespace projections
inline void fwd(geographic_type& lp_lon, geographic_type& lp_lat, cartesian_type& xy_x, cartesian_type& xy_y) const
{
double yc = 0;
PXY xy = loc_for(lp_lon, lp_lat, this->m_par, m_proj_parm, &yc);
XY xy = loc_for(lp_lon, lp_lat, this->m_par, m_proj_parm, &yc);
xy_x = xy.x; xy_y = xy.y;
}
inline void inv(cartesian_type& xy_x, cartesian_type& xy_y, geographic_type& lp_lon, geographic_type& lp_lat) const
{
PXY t;
XY t;
double yc = 0;
lp_lat = this->m_proj_parm.phi_2;
lp_lon = xy_x / cos(lp_lat);
do {
@@ -181,7 +181,8 @@ namespace boost { namespace geometry { namespace projections
{
double del, sig, s, t, x1, x2, T2, y1, m1, m2, y2;
int i;
pj_enfn(par.es, proj_parm.en);
if (!pj_enfn(par.es, proj_parm.en)) throw proj_exception(0);
if( (i = phi12(par, proj_parm, &del, &sig)) != 0)
throw proj_exception(i);
if (proj_parm.phi_2 < proj_parm.phi_1) { /* make sure proj_parm.phi_1 most southerly */
@@ -222,12 +223,10 @@ namespace boost { namespace geometry { namespace projections
proj_parm.Q = (y2 - y1) * t;
proj_parm.Pp = (m2 * x1 - m1 * x2) * t;
proj_parm.Qp = (x2 - x1) * t;
// par.fwd = e_forward;
// par.inv = e_inverse;
}
}} // namespace detail::imw_p
#endif // doxygen
#endif // doxygen
/*!
\brief International Map of the World Polyconic projection
@@ -272,7 +271,7 @@ namespace boost { namespace geometry { namespace projections
factory.add_to_factory("imw_p", new imw_p_entry<Geographic, Cartesian, Parameters>);
}
} // namespace detail
} // namespace detail
#endif // doxygen
}}} // namespace boost::geometry::projections

File diff suppressed because it is too large Load Diff

View File

@@ -4,7 +4,7 @@
// Boost.Geometry - extensions-gis-projections (based on PROJ4)
// This file is automatically generated. DO NOT EDIT.
// Copyright (c) 2008-2012 Barend Gehrels, Amsterdam, the Netherlands.
// Copyright (c) 2008-2015 Barend Gehrels, Amsterdam, the Netherlands.
// Use, modification and distribution is subject to the Boost Software License,
// Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
@@ -15,6 +15,8 @@
// PROJ4 is maintained by Frank Warmerdam
// PROJ4 is converted to Boost.Geometry by Barend Gehrels
// Last updated version of proj: 4.9.1
// Original copyright notice:
// Permission is hereby granted, free of charge, to any person obtaining a
@@ -35,7 +37,6 @@
// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
// DEALINGS IN THE SOFTWARE.
#include <boost/math/special_functions/hypot.hpp>
#include <boost/geometry/extensions/gis/projections/impl/base_static.hpp>
#include <boost/geometry/extensions/gis/projections/impl/base_dynamic.hpp>
@@ -45,42 +46,35 @@
namespace boost { namespace geometry { namespace projections
{
#ifndef DOXYGEN_NO_DETAIL
namespace detail { namespace krovak{
namespace detail { namespace krovak{
struct par_krovak
{
double C_x;
};
/**
NOTES: According to EPSG the full Krovak projection method should have
the following parameters. Within PROJ.4 the azimuth, and pseudo
standard parallel are hardcoded in the algorithm and can't be
standard parallel are hardcoded in the algorithm and can't be
altered from outside. The others all have defaults to match the
common usage with Krovak projection.
lat_0 = latitude of centre of the projection
lon_0 = longitude of centre of the projection
** = azimuth (true) of the centre line passing through the centre of the projection
** = latitude of pseudo standard parallel
k = scale factor on the pseudo standard parallel
x_0 = False Easting of the centre of the projection at the apex of the cone
y_0 = False Northing of the centre of the projection at the apex of the cone
**/
// template class, using CRTP to implement forward/inverse
template <typename Geographic, typename Cartesian, typename Parameters>
@@ -100,17 +94,17 @@ namespace boost { namespace geometry { namespace projections
inline void fwd(geographic_type& lp_lon, geographic_type& lp_lat, cartesian_type& xy_x, cartesian_type& xy_y) const
{
/* calculate xy from lat/lon */
/* Constants, identical to inverse transform function */
double s45, s90, e2, e, alfa, uq, u0, g, k, k1, n0, ro0, ad, a, s0, n;
double gfi, u, fi0, deltav, s, d, eps, ro;
s45 = 0.785398163397448; /* 45 DEG */
s90 = 2 * s45;
fi0 = this->m_par.phi0; /* Latitude of projection centre 49 DEG 30' */
/* Ellipsoid is used as Parameter in for.c and inv.c, therefore a must
/* Ellipsoid is used as Parameter in for.c and inv.c, therefore a must
be set to 1 here.
Ellipsoid Bessel 1841 a = 6377397.155m 1/f = 299.1528128,
e2=0.006674372230614;
@@ -119,67 +113,62 @@ namespace boost { namespace geometry { namespace projections
/* e2 = this->m_par.es;*/ /* 0.006674372230614; */
e2 = 0.006674372230614;
e = sqrt(e2);
alfa = sqrt(1. + (e2 * pow(cos(fi0), 4)) / (1. - e2));
uq = 1.04216856380474; /* DU(2, 59, 42, 42.69689) */
u0 = asin(sin(fi0) / alfa);
g = pow( (1. + e * sin(fi0)) / (1. - e * sin(fi0)) , alfa * e / 2. );
k = tan( u0 / 2. + s45) / pow (tan(fi0 / 2. + s45) , alfa) * g;
k1 = this->m_par.k0;
n0 = a * sqrt(1. - e2) / (1. - e2 * pow(sin(fi0), 2));
s0 = 1.37008346281555; /* Latitude of pseudo standard parallel 78 DEG 30'00" N */
n = sin(s0);
ro0 = k1 * n0 / tan(s0);
ad = s90 - uq;
/* Transformation */
gfi =pow ( ((1. + e * sin(lp_lat)) /
(1. - e * sin(lp_lat))) , (alfa * e / 2.));
u= 2. * (atan(k * pow( tan(lp_lat / 2. + s45), alfa) / gfi)-s45);
deltav = - lp_lon * alfa;
s = asin(cos(ad) * sin(u) + sin(ad) * cos(u) * cos(deltav));
d = asin(cos(u) * sin(deltav) / cos(s));
eps = n * d;
ro = ro0 * pow(tan(s0 / 2. + s45) , n) / pow(tan(s / 2. + s45) , n) ;
/* x and y are reverted! */
xy_y = ro * cos(eps) / a;
xy_x = ro * sin(eps) / a;
if( !pj_param(this->m_par.params, "tczech").i )
{
xy_y *= -1.0;
xy_x *= -1.0;
}
return;
}
inline void inv(cartesian_type& xy_x, cartesian_type& xy_y, geographic_type& lp_lon, geographic_type& lp_lat) const
{
/* calculate lat/lon from xy */
/* Constants, identisch wie in der Umkehrfunktion */
double s45, s90, fi0, e2, e, alfa, uq, u0, g, k, k1, n0, ro0, ad, a, s0, n;
double u, deltav, s, d, eps, ro, fi1, xy0;
int ok;
s45 = 0.785398163397448; /* 45 DEG */
s90 = 2 * s45;
fi0 = this->m_par.phi0; /* Latitude of projection centre 49 DEG 30' */
/* Ellipsoid is used as Parameter in for.c and inv.c, therefore a must
/* Ellipsoid is used as Parameter in for.c and inv.c, therefore a must
be set to 1 here.
Ellipsoid Bessel 1841 a = 6377397.155m 1/f = 299.1528128,
e2=0.006674372230614;
@@ -188,47 +177,47 @@ namespace boost { namespace geometry { namespace projections
/* e2 = this->m_par.es; */ /* 0.006674372230614; */
e2 = 0.006674372230614;
e = sqrt(e2);
alfa = sqrt(1. + (e2 * pow(cos(fi0), 4)) / (1. - e2));
uq = 1.04216856380474; /* DU(2, 59, 42, 42.69689) */
u0 = asin(sin(fi0) / alfa);
g = pow( (1. + e * sin(fi0)) / (1. - e * sin(fi0)) , alfa * e / 2. );
k = tan( u0 / 2. + s45) / pow (tan(fi0 / 2. + s45) , alfa) * g;
k1 = this->m_par.k0;
n0 = a * sqrt(1. - e2) / (1. - e2 * pow(sin(fi0), 2));
s0 = 1.37008346281555; /* Latitude of pseudo standard parallel 78 DEG 30'00" N */
n = sin(s0);
ro0 = k1 * n0 / tan(s0);
ad = s90 - uq;
/* Transformation */
/* revert y, x*/
xy0=xy_x;
xy_x=xy_y;
xy_y=xy0;
if( !pj_param(this->m_par.params, "tczech").i )
{
xy_x *= -1.0;
xy_y *= -1.0;
}
ro = sqrt(xy_x * xy_x + xy_y * xy_y);
eps = atan2(xy_y, xy_x);
d = eps / sin(s0);
s = 2. * (atan( pow(ro0 / ro, 1. / n) * tan(s0 / 2. + s45)) - s45);
u = asin(cos(ad) * sin(s) - sin(ad) * cos(s) * cos(d));
deltav = asin(cos(s) * sin(d) / cos(u));
lp_lon = this->m_par.lam0 - deltav / alfa;
/* ITERATION FOR lp_lat */
fi1 = u;
ok = 0;
do
{
@@ -236,18 +225,15 @@ namespace boost { namespace geometry { namespace projections
pow( tan(u / 2. + s45) , 1. / alfa) *
pow( (1. + e * sin(fi1)) / (1. - e * sin(fi1)) , e / 2.)
) - s45);
if (fabs(fi1 - lp_lat) < 0.000000000000001) ok=1;
fi1 = lp_lat;
}
while (ok==0);
lp_lon -= this->m_par.lam0;
return;
}
};
// Krovak
@@ -257,32 +243,33 @@ namespace boost { namespace geometry { namespace projections
double ts;
/* read some Parameters,
* here Latitude Truescale */
ts = pj_param(par.params, "rlat_ts").f;
proj_parm.C_x = ts;
/* we want Bessel as fixed ellipsoid */
par.a = 6377397.155;
par.e = sqrt(par.es = 0.006674372230614);
/* if latitude of projection center is not set, use 49d30'N */
if (!pj_param(par.params, "tlat_0").i)
par.phi0 = 0.863937979737193;
/* if center long is not set use 42d30'E of Ferro - 17d40' for Ferro */
/* that will correspond to using longitudes relative to greenwich */
/* as input and output, instead of lat/long relative to Ferro */
if (!pj_param(par.params, "tlon_0").i)
par.lam0 = 0.7417649320975901 - 0.308341501185665;
/* if scale not set default to 0.9999 */
if (!pj_param(par.params, "tk").i)
par.k0 = 0.9999;
/* always the same */
// par.inv = e_inverse;
// par.fwd = e_forward;
}
}} // namespace detail::krovak
#endif // doxygen
#endif // doxygen
/*!
\brief Krovak projection
@@ -326,7 +313,7 @@ namespace boost { namespace geometry { namespace projections
factory.add_to_factory("krovak", new krovak_entry<Geographic, Cartesian, Parameters>);
}
} // namespace detail
} // namespace detail
#endif // doxygen
}}} // namespace boost::geometry::projections

View File

@@ -4,7 +4,7 @@
// Boost.Geometry - extensions-gis-projections (based on PROJ4)
// This file is automatically generated. DO NOT EDIT.
// Copyright (c) 2008-2012 Barend Gehrels, Amsterdam, the Netherlands.
// Copyright (c) 2008-2015 Barend Gehrels, Amsterdam, the Netherlands.
// Use, modification and distribution is subject to the Boost Software License,
// Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
@@ -15,6 +15,8 @@
// PROJ4 is maintained by Frank Warmerdam
// PROJ4 is converted to Boost.Geometry by Barend Gehrels
// Last updated version of proj: 4.9.1
// Original copyright notice:
// Permission is hereby granted, free of charge, to any person obtaining a
@@ -35,7 +37,6 @@
// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
// DEALINGS IN THE SOFTWARE.
#include <boost/math/special_functions/hypot.hpp>
#include <boost/geometry/extensions/gis/projections/impl/base_static.hpp>
#include <boost/geometry/extensions/gis/projections/impl/base_dynamic.hpp>
@@ -45,7 +46,7 @@
namespace boost { namespace geometry { namespace projections
{
#ifndef DOXYGEN_NO_DETAIL
namespace detail { namespace labrd{
namespace detail { namespace labrd{
static const double EPS = 1.e-10;
struct par_labrd
@@ -73,7 +74,7 @@ namespace boost { namespace geometry { namespace projections
{
double V1, V2, ps, sinps, cosps, sinps2, cosps2, I1, I2, I3, I4, I5, I6,
x2, y2, t;
V1 = this->m_proj_parm.A * log( tan(FORTPI + .5 * lp_lat) );
t = this->m_par.e * sin(lp_lat);
V2 = .5 * this->m_par.e * this->m_proj_parm.A * log ((1. + t)/(1. - t));
@@ -104,7 +105,7 @@ namespace boost { namespace geometry { namespace projections
double x2, y2, V1, V2, V3, V4, t, t2, ps, pe, tpe, s,
I7, I8, I9, I10, I11, d, Re;
int i;
x2 = xy_x * xy_x;
y2 = xy_y * xy_y;
V1 = 3. * xy_x * y2 - xy_x * x2;
@@ -154,6 +155,7 @@ namespace boost { namespace geometry { namespace projections
void setup_labrd(Parameters& par, par_labrd& proj_parm)
{
double Az, sinp, R, N, t;
proj_parm.rot = pj_param(par.params, "bno_rot").i == 0;
Az = pj_param(par.params, "razi").f;
sinp = sin(par.phi0);
@@ -172,12 +174,10 @@ namespace boost { namespace geometry { namespace projections
proj_parm.Cb *= sin(t);
proj_parm.Cc = 3. * (proj_parm.Ca * proj_parm.Ca - proj_parm.Cb * proj_parm.Cb);
proj_parm.Cd = 6. * proj_parm.Ca * proj_parm.Cb;
// par.inv = e_inverse;
// par.fwd = e_forward;
}
}} // namespace detail::labrd
#endif // doxygen
#endif // doxygen
/*!
\brief Laborde projection
@@ -222,7 +222,7 @@ namespace boost { namespace geometry { namespace projections
factory.add_to_factory("labrd", new labrd_entry<Geographic, Cartesian, Parameters>);
}
} // namespace detail
} // namespace detail
#endif // doxygen
}}} // namespace boost::geometry::projections

View File

@@ -4,7 +4,7 @@
// Boost.Geometry - extensions-gis-projections (based on PROJ4)
// This file is automatically generated. DO NOT EDIT.
// Copyright (c) 2008-2012 Barend Gehrels, Amsterdam, the Netherlands.
// Copyright (c) 2008-2015 Barend Gehrels, Amsterdam, the Netherlands.
// Use, modification and distribution is subject to the Boost Software License,
// Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
@@ -15,6 +15,8 @@
// PROJ4 is maintained by Frank Warmerdam
// PROJ4 is converted to Boost.Geometry by Barend Gehrels
// Last updated version of proj: 4.9.1
// Original copyright notice:
// Permission is hereby granted, free of charge, to any person obtaining a
@@ -35,19 +37,20 @@
// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
// DEALINGS IN THE SOFTWARE.
#include <boost/math/special_functions/hypot.hpp>
#include <boost/geometry/extensions/gis/projections/impl/base_static.hpp>
#include <boost/geometry/extensions/gis/projections/impl/base_dynamic.hpp>
#include <boost/geometry/extensions/gis/projections/impl/projects.hpp>
#include <boost/geometry/extensions/gis/projections/impl/factory_entry.hpp>
#include <boost/geometry/extensions/gis/projections/impl/pj_qsfn.hpp>
#include <boost/geometry/extensions/gis/projections/impl/pj_auth.hpp>
#include <boost/geometry/extensions/gis/projections/impl/pj_qsfn.hpp>
namespace boost { namespace geometry { namespace projections
{
#ifndef DOXYGEN_NO_DETAIL
namespace detail { namespace laea{
namespace detail { namespace laea{
static const double EPS10 = 1.e-10;
static const int NITER = 20;
static const double CONV = 1.e-10;
@@ -88,7 +91,7 @@ namespace boost { namespace geometry { namespace projections
inline void fwd(geographic_type& lp_lon, geographic_type& lp_lat, cartesian_type& xy_x, cartesian_type& xy_y) const
{
double coslam, sinlam, sinphi, q, sinb=0.0, cosb=0.0, b=0.0;
coslam = cos(lp_lon);
sinlam = sin(lp_lon);
sinphi = sin(lp_lat);
@@ -121,7 +124,7 @@ namespace boost { namespace geometry { namespace projections
goto eqcon;
break;
case EQUIT:
xy_y = (b = sqrt(2. / (1. + cosb * coslam))) * sinb * this->m_proj_parm.ymf;
xy_y = (b = sqrt(2. / (1. + cosb * coslam))) * sinb * this->m_proj_parm.ymf;
eqcon:
xy_x = this->m_proj_parm.xmf * b * cosb * sinlam;
break;
@@ -139,7 +142,7 @@ namespace boost { namespace geometry { namespace projections
inline void inv(cartesian_type& xy_x, cartesian_type& xy_y, geographic_type& lp_lon, geographic_type& lp_lat) const
{
double cCe, sCe, q, rho, ab=0.0;
switch (this->m_proj_parm.mode) {
case EQUIT:
case OBLIQ:
@@ -197,7 +200,7 @@ namespace boost { namespace geometry { namespace projections
inline void fwd(geographic_type& lp_lon, geographic_type& lp_lat, cartesian_type& xy_x, cartesian_type& xy_y) const
{
double coslam, cosphi, sinphi;
sinphi = sin(lp_lat);
cosphi = cos(lp_lat);
coslam = cos(lp_lon);
@@ -228,7 +231,7 @@ namespace boost { namespace geometry { namespace projections
inline void inv(cartesian_type& xy_x, cartesian_type& xy_y, geographic_type& lp_lon, geographic_type& lp_lat) const
{
double cosz=0.0, rh, sinz=0.0;
rh = boost::math::hypot(xy_x, xy_y);
if ((lp_lat = rh * .5 ) > 1.) throw proj_exception();;
lp_lat = 2. * asin(lp_lat);
@@ -266,6 +269,7 @@ namespace boost { namespace geometry { namespace projections
void setup_laea(Parameters& par, par_laea& proj_parm)
{
double t;
if (fabs((t = fabs(par.phi0)) - HALFPI) < EPS10)
proj_parm.mode = par.phi0 < 0. ? S_POLE : N_POLE;
else if (fabs(t) < EPS10)
@@ -274,6 +278,7 @@ namespace boost { namespace geometry { namespace projections
proj_parm.mode = OBLIQ;
if (par.es) {
double sinphi;
par.e = sqrt(par.es);
proj_parm.qp = pj_qsfn(1., par.e, par.one_es);
proj_parm.mmf = .5 / (1. - par.es);
@@ -299,20 +304,16 @@ namespace boost { namespace geometry { namespace projections
proj_parm.xmf *= proj_parm.dd;
break;
}
// par.inv = e_inverse;
// par.fwd = e_forward;
} else {
if (proj_parm.mode == OBLIQ) {
proj_parm.sinb1 = sin(par.phi0);
proj_parm.cosb1 = cos(par.phi0);
}
// par.inv = s_inverse;
// par.fwd = s_forward;
}
}
}} // namespace detail::laea
#endif // doxygen
#endif // doxygen
/*!
\brief Lambert Azimuthal Equal Area projection
@@ -382,7 +383,7 @@ namespace boost { namespace geometry { namespace projections
factory.add_to_factory("laea", new laea_entry<Geographic, Cartesian, Parameters>);
}
} // namespace detail
} // namespace detail
#endif // doxygen
}}} // namespace boost::geometry::projections

View File

@@ -4,7 +4,7 @@
// Boost.Geometry - extensions-gis-projections (based on PROJ4)
// This file is automatically generated. DO NOT EDIT.
// Copyright (c) 2008-2012 Barend Gehrels, Amsterdam, the Netherlands.
// Copyright (c) 2008-2015 Barend Gehrels, Amsterdam, the Netherlands.
// Use, modification and distribution is subject to the Boost Software License,
// Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
@@ -15,6 +15,8 @@
// PROJ4 is maintained by Frank Warmerdam
// PROJ4 is converted to Boost.Geometry by Barend Gehrels
// Last updated version of proj: 4.9.1
// Original copyright notice:
// Permission is hereby granted, free of charge, to any person obtaining a
@@ -35,7 +37,6 @@
// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
// DEALINGS IN THE SOFTWARE.
#include <boost/math/special_functions/hypot.hpp>
#include <boost/geometry/extensions/gis/projections/impl/base_static.hpp>
#include <boost/geometry/extensions/gis/projections/impl/base_dynamic.hpp>
@@ -45,7 +46,7 @@
namespace boost { namespace geometry { namespace projections
{
#ifndef DOXYGEN_NO_DETAIL
namespace detail { namespace lagrng{
namespace detail { namespace lagrng{
static const double TOL = 1e-10;
struct par_lagrng
@@ -73,7 +74,7 @@ namespace boost { namespace geometry { namespace projections
inline void fwd(geographic_type& lp_lon, geographic_type& lp_lat, cartesian_type& xy_x, cartesian_type& xy_y) const
{
double v, c;
if (fabs(fabs(lp_lat) - HALFPI) < TOL) {
xy_x = 0;
xy_y = lp_lat < 0 ? -2. : 2.;
@@ -93,17 +94,17 @@ namespace boost { namespace geometry { namespace projections
void setup_lagrng(Parameters& par, par_lagrng& proj_parm)
{
double phi1;
if ((proj_parm.rw = pj_param(par.params, "dW").f) <= 0) throw proj_exception(-27);
proj_parm.hrw = 0.5 * (proj_parm.rw = 1. / proj_parm.rw);
phi1 = pj_param(par.params, "rlat_1").f;
if (fabs(fabs(phi1 = sin(phi1)) - 1.) < TOL) throw proj_exception(-22);
proj_parm.a1 = pow((1. - phi1)/(1. + phi1), proj_parm.hrw);
par.es = 0.;
// par.fwd = s_forward;
}
}} // namespace detail::lagrng
#endif // doxygen
#endif // doxygen
/*!
\brief Lagrange projection
@@ -149,7 +150,7 @@ namespace boost { namespace geometry { namespace projections
factory.add_to_factory("lagrng", new lagrng_entry<Geographic, Cartesian, Parameters>);
}
} // namespace detail
} // namespace detail
#endif // doxygen
}}} // namespace boost::geometry::projections

View File

@@ -4,7 +4,7 @@
// Boost.Geometry - extensions-gis-projections (based on PROJ4)
// This file is automatically generated. DO NOT EDIT.
// Copyright (c) 2008-2012 Barend Gehrels, Amsterdam, the Netherlands.
// Copyright (c) 2008-2015 Barend Gehrels, Amsterdam, the Netherlands.
// Use, modification and distribution is subject to the Boost Software License,
// Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
@@ -15,6 +15,8 @@
// PROJ4 is maintained by Frank Warmerdam
// PROJ4 is converted to Boost.Geometry by Barend Gehrels
// Last updated version of proj: 4.9.1
// Original copyright notice:
// Permission is hereby granted, free of charge, to any person obtaining a
@@ -35,7 +37,6 @@
// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
// DEALINGS IN THE SOFTWARE.
#include <boost/math/special_functions/hypot.hpp>
#include <boost/geometry/extensions/gis/projections/impl/base_static.hpp>
#include <boost/geometry/extensions/gis/projections/impl/base_dynamic.hpp>
@@ -45,10 +46,9 @@
namespace boost { namespace geometry { namespace projections
{
#ifndef DOXYGEN_NO_DETAIL
namespace detail { namespace larr{
namespace detail { namespace larr{
static const double SIXTH = .16666666666666666;
// template class, using CRTP to implement forward/inverse
template <typename Geographic, typename Cartesian, typename Parameters>
struct base_larr_spheroid : public base_t_f<base_larr_spheroid<Geographic, Cartesian, Parameters>,
@@ -74,13 +74,11 @@ namespace boost { namespace geometry { namespace projections
template <typename Parameters>
void setup_larr(Parameters& par)
{
// par.fwd = s_forward;
// par.inv = 0;
par.es = 0.;
}
}} // namespace detail::larr
#endif // doxygen
#endif // doxygen
/*!
\brief Larrivee projection
@@ -125,7 +123,7 @@ namespace boost { namespace geometry { namespace projections
factory.add_to_factory("larr", new larr_entry<Geographic, Cartesian, Parameters>);
}
} // namespace detail
} // namespace detail
#endif // doxygen
}}} // namespace boost::geometry::projections

View File

@@ -4,7 +4,7 @@
// Boost.Geometry - extensions-gis-projections (based on PROJ4)
// This file is automatically generated. DO NOT EDIT.
// Copyright (c) 2008-2012 Barend Gehrels, Amsterdam, the Netherlands.
// Copyright (c) 2008-2015 Barend Gehrels, Amsterdam, the Netherlands.
// Use, modification and distribution is subject to the Boost Software License,
// Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
@@ -15,6 +15,8 @@
// PROJ4 is maintained by Frank Warmerdam
// PROJ4 is converted to Boost.Geometry by Barend Gehrels
// Last updated version of proj: 4.9.1
// Original copyright notice:
// Permission is hereby granted, free of charge, to any person obtaining a
@@ -35,7 +37,6 @@
// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
// DEALINGS IN THE SOFTWARE.
#include <boost/math/special_functions/hypot.hpp>
#include <boost/geometry/extensions/gis/projections/impl/base_static.hpp>
#include <boost/geometry/extensions/gis/projections/impl/base_dynamic.hpp>
@@ -45,7 +46,7 @@
namespace boost { namespace geometry { namespace projections
{
#ifndef DOXYGEN_NO_DETAIL
namespace detail { namespace lask{
namespace detail { namespace lask{
static const double a10 = 0.975534;
static const double a12 = -0.119161;
static const double a32 = -0.0143059;
@@ -57,7 +58,6 @@ namespace boost { namespace geometry { namespace projections
static const double b23 = -0.0285500;
static const double b05 = -0.0491032;
// template class, using CRTP to implement forward/inverse
template <typename Geographic, typename Cartesian, typename Parameters>
struct base_lask_spheroid : public base_t_f<base_lask_spheroid<Geographic, Cartesian, Parameters>,
@@ -75,7 +75,7 @@ namespace boost { namespace geometry { namespace projections
inline void fwd(geographic_type& lp_lon, geographic_type& lp_lat, cartesian_type& xy_x, cartesian_type& xy_y) const
{
double l2, p2;
l2 = lp_lon * lp_lon;
p2 = lp_lat * lp_lat;
xy_x = lp_lon * (a10 + p2 * (a12 + l2 * a32 + p2 * a14));
@@ -88,13 +88,11 @@ namespace boost { namespace geometry { namespace projections
template <typename Parameters>
void setup_lask(Parameters& par)
{
// par.fwd = s_forward;
// par.inv = 0;
par.es = 0.;
}
}} // namespace detail::lask
#endif // doxygen
#endif // doxygen
/*!
\brief Laskowski projection
@@ -139,7 +137,7 @@ namespace boost { namespace geometry { namespace projections
factory.add_to_factory("lask", new lask_entry<Geographic, Cartesian, Parameters>);
}
} // namespace detail
} // namespace detail
#endif // doxygen
}}} // namespace boost::geometry::projections

View File

@@ -4,7 +4,7 @@
// Boost.Geometry - extensions-gis-projections (based on PROJ4)
// This file is automatically generated. DO NOT EDIT.
// Copyright (c) 2008-2012 Barend Gehrels, Amsterdam, the Netherlands.
// Copyright (c) 2008-2015 Barend Gehrels, Amsterdam, the Netherlands.
// Use, modification and distribution is subject to the Boost Software License,
// Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
@@ -15,6 +15,8 @@
// PROJ4 is maintained by Frank Warmerdam
// PROJ4 is converted to Boost.Geometry by Barend Gehrels
// Last updated version of proj: 4.9.1
// Original copyright notice:
// Permission is hereby granted, free of charge, to any person obtaining a
@@ -35,7 +37,6 @@
// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
// DEALINGS IN THE SOFTWARE.
#include <boost/math/special_functions/hypot.hpp>
#include <boost/geometry/extensions/gis/projections/impl/base_static.hpp>
#include <boost/geometry/extensions/gis/projections/impl/base_dynamic.hpp>
@@ -47,11 +48,9 @@
namespace boost { namespace geometry { namespace projections
{
#ifndef DOXYGEN_NO_DETAIL
namespace detail { namespace latlong{
namespace detail { namespace latlong{
/* very loosely based upon DMA code by Bradford W. Drew */
// template class, using CRTP to implement forward/inverse
template <typename Geographic, typename Cartesian, typename Parameters>
@@ -69,14 +68,12 @@ namespace boost { namespace geometry { namespace projections
inline void fwd(geographic_type& lp_lon, geographic_type& lp_lat, cartesian_type& xy_x, cartesian_type& xy_y) const
{
xy_x = lp_lon / this->m_par.a;
xy_y = lp_lat / this->m_par.a;
}
inline void inv(cartesian_type& xy_x, cartesian_type& xy_y, geographic_type& lp_lon, geographic_type& lp_lat) const
{
lp_lat = xy_y * this->m_par.a;
lp_lon = xy_x * this->m_par.a;
}
@@ -89,8 +86,6 @@ namespace boost { namespace geometry { namespace projections
par.is_latlong = 1;
par.x0 = 0.0;
par.y0 = 0.0;
// par.inv = inverse;
// par.fwd = forward;
}
// Lat/long (Geodetic alias)
@@ -100,8 +95,6 @@ namespace boost { namespace geometry { namespace projections
par.is_latlong = 1;
par.x0 = 0.0;
par.y0 = 0.0;
// par.inv = inverse;
// par.fwd = forward;
}
// Lat/long (Geodetic alias)
@@ -111,8 +104,6 @@ namespace boost { namespace geometry { namespace projections
par.is_latlong = 1;
par.x0 = 0.0;
par.y0 = 0.0;
// par.inv = inverse;
// par.fwd = forward;
}
// Lat/long (Geodetic alias)
@@ -122,12 +113,10 @@ namespace boost { namespace geometry { namespace projections
par.is_latlong = 1;
par.x0 = 0.0;
par.y0 = 0.0;
// par.inv = inverse;
// par.fwd = forward;
}
}} // namespace detail::latlong
#endif // doxygen
#endif // doxygen
/*!
\brief Lat/long (Geodetic) projection
@@ -259,7 +248,7 @@ namespace boost { namespace geometry { namespace projections
factory.add_to_factory("longlat", new longlat_entry<Geographic, Cartesian, Parameters>);
}
} // namespace detail
} // namespace detail
// Create EPSG specializations
// (Proof of Concept, only for some)

Some files were not shown because too many files have changed in this diff Show More