mirror of
https://github.com/boostorg/geometry.git
synced 2026-01-31 08:12:13 +00:00
Merge branch 'develop' into feature/relate
Conflicts: doc/release_notes.qbk
This commit is contained in:
@@ -28,6 +28,8 @@
|
||||
* The support for C++11 `std::initializer_list` in geometries models.
|
||||
* Disjoint and intersects support the following geometry combinations: multipoint/linestring, multipoint/multilinestring.
|
||||
* Added relate() and relation() algorithms.
|
||||
* Intersection has been implemented for combinations of pointlike and linear geometries
|
||||
* Added implementation for difference(pointlike, linear)
|
||||
|
||||
[*Improvements]
|
||||
|
||||
|
||||
@@ -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 ]
|
||||
;
|
||||
|
||||
@@ -132,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");
|
||||
@@ -149,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");
|
||||
@@ -256,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");
|
||||
|
||||
134
extensions/test/gis/projections/projections_combined.cpp
Normal file
134
extensions/test/gis/projections/projections_combined.cpp
Normal 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;
|
||||
}
|
||||
385
extensions/test/gis/projections/projections_static.cpp
Normal file
385
extensions/test/gis/projections/projections_static.cpp
Normal file
@@ -0,0 +1,385 @@
|
||||
// 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::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::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_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;
|
||||
}
|
||||
@@ -383,6 +383,7 @@ inline void buffer_point(Point const& point, Collection& collection,
|
||||
std::vector<OutputPointType> range_out;
|
||||
point_strategy.apply(point, distance_strategy, range_out);
|
||||
collection.add_piece(strategy::buffer::buffered_point, range_out, false);
|
||||
collection.set_piece_center(point);
|
||||
collection.finish_ring();
|
||||
}
|
||||
|
||||
@@ -613,15 +614,18 @@ struct buffer_inserter<linestring_tag, Linestring, Polygon>
|
||||
|
||||
output_point_type first_p2, last_p1, last_p2;
|
||||
|
||||
detail::buffer::buffer_range<output_ring_type>::iterate(collection,
|
||||
bool result = detail::buffer::buffer_range<output_ring_type>::iterate(collection,
|
||||
begin, end, side,
|
||||
distance_strategy, side_strategy, join_strategy, end_strategy, robust_policy,
|
||||
first_p1, first_p2, last_p1, last_p2);
|
||||
|
||||
std::vector<output_point_type> range_out;
|
||||
end_strategy.apply(penultimate_point, last_p2, ultimate_point, reverse_p1, side, distance_strategy, range_out);
|
||||
collection.add_endcap(end_strategy, range_out, ultimate_point);
|
||||
return true;
|
||||
if (result)
|
||||
{
|
||||
std::vector<output_point_type> range_out;
|
||||
end_strategy.apply(penultimate_point, last_p2, ultimate_point, reverse_p1, side, distance_strategy, range_out);
|
||||
collection.add_endcap(end_strategy, range_out, ultimate_point);
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
template
|
||||
@@ -910,7 +914,7 @@ inline void buffer_inserter(GeometryInput const& geometry_input, OutputIterator
|
||||
collection.reverse();
|
||||
}
|
||||
|
||||
if (distance_strategy.negative() && areal)
|
||||
if (BOOST_GEOMETRY_CONDITION(distance_strategy.negative() && areal))
|
||||
{
|
||||
collection.discard_nonintersecting_deflated_rings();
|
||||
}
|
||||
|
||||
@@ -9,6 +9,7 @@
|
||||
#ifndef BOOST_GEOMETRY_ALGORITHMS_DETAIL_BUFFER_BUFFER_POLICIES_HPP
|
||||
#define BOOST_GEOMETRY_ALGORITHMS_DETAIL_BUFFER_BUFFER_POLICIES_HPP
|
||||
|
||||
#define BOOST_GEOMETRY_BUFFER_USE_SIDE_OF_INTERSECTION
|
||||
|
||||
#include <cstddef>
|
||||
|
||||
@@ -122,6 +123,10 @@ struct buffer_turn_info
|
||||
|
||||
intersection_location_type location;
|
||||
|
||||
#if defined(BOOST_GEOMETRY_BUFFER_USE_SIDE_OF_INTERSECTION)
|
||||
robust_point_type rob_pi, rob_pj, rob_qi, rob_qj;
|
||||
#endif
|
||||
|
||||
int count_within;
|
||||
|
||||
bool within_original;
|
||||
@@ -130,7 +135,9 @@ struct buffer_turn_info
|
||||
|
||||
int count_on_offsetted;
|
||||
int count_on_helper;
|
||||
#if ! defined(BOOST_GEOMETRY_BUFFER_USE_SIDE_OF_INTERSECTION)
|
||||
int count_within_near_offsetted;
|
||||
#endif
|
||||
|
||||
bool remove_on_multi;
|
||||
|
||||
@@ -147,7 +154,9 @@ struct buffer_turn_info
|
||||
, count_in_original(0)
|
||||
, count_on_offsetted(0)
|
||||
, count_on_helper(0)
|
||||
#if ! defined(BOOST_GEOMETRY_BUFFER_USE_SIDE_OF_INTERSECTION)
|
||||
, count_within_near_offsetted(0)
|
||||
#endif
|
||||
, remove_on_multi(false)
|
||||
, count_on_occupied(0)
|
||||
, count_on_multi(0)
|
||||
|
||||
@@ -19,8 +19,10 @@
|
||||
#include <boost/geometry/core/coordinate_type.hpp>
|
||||
#include <boost/geometry/core/point_type.hpp>
|
||||
|
||||
#include <boost/geometry/algorithms/comparable_distance.hpp>
|
||||
#include <boost/geometry/algorithms/covered_by.hpp>
|
||||
#include <boost/geometry/algorithms/envelope.hpp>
|
||||
#include <boost/geometry/algorithms/is_convex.hpp>
|
||||
|
||||
#include <boost/geometry/strategies/buffer.hpp>
|
||||
|
||||
@@ -126,6 +128,11 @@ struct buffered_piece_collection
|
||||
typedef geometry::model::ring<robust_point_type> robust_ring_type;
|
||||
typedef geometry::model::box<robust_point_type> robust_box_type;
|
||||
|
||||
typedef typename default_comparable_distance_result
|
||||
<
|
||||
robust_point_type
|
||||
>::type robust_comparable_radius_type;
|
||||
|
||||
typedef typename strategy::side::services::default_strategy
|
||||
<
|
||||
typename cs_tag<point_type>::type
|
||||
@@ -191,13 +198,13 @@ struct buffered_piece_collection
|
||||
std::vector<point_type> helper_points; // 4 points for side, 3 points for join - 0 points for flat-end
|
||||
#endif
|
||||
|
||||
bool is_convex;
|
||||
bool is_monotonic_increasing[2]; // 0=x, 1=y
|
||||
bool is_monotonic_decreasing[2]; // 0=x, 1=y
|
||||
|
||||
// Monotonic sections of pieces around points
|
||||
std::vector<section_type> sections;
|
||||
|
||||
|
||||
// Robust representations
|
||||
// 3: complete ring
|
||||
robust_ring_type robust_ring;
|
||||
@@ -206,6 +213,27 @@ struct buffered_piece_collection
|
||||
robust_box_type robust_offsetted_envelope;
|
||||
|
||||
std::vector<robust_turn> robust_turns; // Used only in insert_rescaled_piece_turns - we might use a map instead
|
||||
|
||||
robust_point_type robust_center;
|
||||
robust_comparable_radius_type robust_min_comparable_radius;
|
||||
robust_comparable_radius_type robust_max_comparable_radius;
|
||||
|
||||
piece()
|
||||
: type(strategy::buffer::piece_type_unknown)
|
||||
, index(-1)
|
||||
, left_index(-1)
|
||||
, right_index(-1)
|
||||
, last_segment_index(-1)
|
||||
, offsetted_count(-1)
|
||||
, is_convex(false)
|
||||
, robust_min_comparable_radius(0)
|
||||
, robust_max_comparable_radius(0)
|
||||
{
|
||||
is_monotonic_increasing[0] = false;
|
||||
is_monotonic_increasing[1] = false;
|
||||
is_monotonic_decreasing[0] = false;
|
||||
is_monotonic_decreasing[1] = false;
|
||||
}
|
||||
};
|
||||
|
||||
struct robust_original
|
||||
@@ -444,6 +472,7 @@ struct buffered_piece_collection
|
||||
{
|
||||
it->location = inside_buffer;
|
||||
}
|
||||
#if ! defined(BOOST_GEOMETRY_BUFFER_USE_SIDE_OF_INTERSECTION)
|
||||
if (it->count_within_near_offsetted > 0)
|
||||
{
|
||||
// Within can have in rare cases a rounding issue. We don't discard this
|
||||
@@ -451,6 +480,7 @@ struct buffered_piece_collection
|
||||
// will never start a new ring from this type of points.
|
||||
it->selectable_start = false;
|
||||
}
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
||||
@@ -544,6 +574,7 @@ struct buffered_piece_collection
|
||||
}
|
||||
}
|
||||
|
||||
#if ! defined(BOOST_GEOMETRY_BUFFER_USE_SIDE_OF_INTERSECTION)
|
||||
// Insert all rescaled turn-points into these rings, to form a
|
||||
// reliable integer-based ring. All turns can be compared (inside) to this
|
||||
// rings to see if they are inside.
|
||||
@@ -582,6 +613,7 @@ struct buffered_piece_collection
|
||||
}
|
||||
|
||||
BOOST_ASSERT(assert_indices_in_robust_rings());
|
||||
#endif
|
||||
}
|
||||
|
||||
template <std::size_t Dimension>
|
||||
@@ -606,6 +638,8 @@ struct buffered_piece_collection
|
||||
pc.is_monotonic_decreasing[0] = true;
|
||||
pc.is_monotonic_decreasing[1] = true;
|
||||
|
||||
pc.is_convex = geometry::is_convex(pc.robust_ring);
|
||||
|
||||
if (pc.offsetted_count < 2)
|
||||
{
|
||||
return;
|
||||
@@ -621,7 +655,6 @@ struct buffered_piece_collection
|
||||
current = next;
|
||||
++next;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
void determine_properties()
|
||||
@@ -658,7 +691,31 @@ struct buffered_piece_collection
|
||||
geometry::sectionalize<false, dimensions>(pc.robust_ring,
|
||||
detail::no_rescale_policy(), pc.sections);
|
||||
|
||||
// TODO (next phase) determine min/max radius
|
||||
// Determine min/max radius
|
||||
typedef geometry::model::referring_segment<robust_point_type const>
|
||||
robust_segment_type;
|
||||
|
||||
typename robust_ring_type::const_iterator current = pc.robust_ring.begin();
|
||||
typename robust_ring_type::const_iterator next = current + 1;
|
||||
|
||||
for (int i = 1; i < pc.offsetted_count; i++)
|
||||
{
|
||||
robust_segment_type s(*current, *next);
|
||||
robust_comparable_radius_type const d
|
||||
= geometry::comparable_distance(pc.robust_center, s);
|
||||
|
||||
if (i == 1 || d < pc.robust_min_comparable_radius)
|
||||
{
|
||||
pc.robust_min_comparable_radius = d;
|
||||
}
|
||||
if (i == 1 || d > pc.robust_max_comparable_radius)
|
||||
{
|
||||
pc.robust_max_comparable_radius = d;
|
||||
}
|
||||
|
||||
current = next;
|
||||
++next;
|
||||
}
|
||||
}
|
||||
|
||||
inline void prepare_buffered_point_pieces()
|
||||
@@ -772,6 +829,13 @@ struct buffered_piece_collection
|
||||
}
|
||||
}
|
||||
|
||||
inline void set_piece_center(point_type const& center)
|
||||
{
|
||||
BOOST_ASSERT(! m_pieces.empty());
|
||||
geometry::recalculate(m_pieces.back().robust_center, center,
|
||||
m_robust_policy);
|
||||
}
|
||||
|
||||
inline void finish_ring(bool is_interior = false, bool has_interiors = false)
|
||||
{
|
||||
if (m_first_piece_index == -1)
|
||||
@@ -1286,8 +1350,12 @@ struct buffered_piece_collection
|
||||
if (! it->has_intersections()
|
||||
&& ! it->is_untouched_outside_original)
|
||||
{
|
||||
ring_identifier id(0, index, -1);
|
||||
selected[id] = properties(*it);
|
||||
properties p = properties(*it);
|
||||
if (p.valid)
|
||||
{
|
||||
ring_identifier id(0, index, -1);
|
||||
selected[id] = p;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1298,8 +1366,12 @@ struct buffered_piece_collection
|
||||
it != boost::end(traversed_rings);
|
||||
++it, ++index)
|
||||
{
|
||||
ring_identifier id(2, index, -1);
|
||||
selected[id] = properties(*it);
|
||||
properties p = properties(*it);
|
||||
if (p.valid)
|
||||
{
|
||||
ring_identifier id(2, index, -1);
|
||||
selected[id] = p;
|
||||
}
|
||||
}
|
||||
|
||||
detail::overlay::assign_parents(offsetted_rings, traversed_rings, selected, true);
|
||||
|
||||
@@ -17,6 +17,7 @@
|
||||
#include <boost/geometry/algorithms/detail/overlay/segment_identifier.hpp>
|
||||
#include <boost/geometry/algorithms/detail/overlay/get_turn_info.hpp>
|
||||
#include <boost/geometry/algorithms/detail/sections/section_functions.hpp>
|
||||
#include <boost/geometry/algorithms/detail/buffer/buffer_policies.hpp>
|
||||
|
||||
|
||||
namespace boost { namespace geometry
|
||||
@@ -28,6 +29,34 @@ namespace detail { namespace buffer
|
||||
{
|
||||
|
||||
|
||||
#if defined(BOOST_GEOMETRY_BUFFER_USE_SIDE_OF_INTERSECTION)
|
||||
struct buffer_assign_turn
|
||||
{
|
||||
static bool const include_no_turn = false;
|
||||
static bool const include_degenerate = false;
|
||||
static bool const include_opposite = false;
|
||||
|
||||
template
|
||||
<
|
||||
typename Info,
|
||||
typename Point1,
|
||||
typename Point2,
|
||||
typename IntersectionInfo
|
||||
>
|
||||
static inline void apply(Info& info,
|
||||
Point1 const& /*p1*/,
|
||||
Point2 const& /*p2*/,
|
||||
IntersectionInfo const& iinfo)
|
||||
{
|
||||
info.rob_pi = iinfo.rpi();
|
||||
info.rob_pj = iinfo.rpj();
|
||||
info.rob_qi = iinfo.rqi();
|
||||
info.rob_qj = iinfo.rqj();
|
||||
}
|
||||
|
||||
};
|
||||
#endif
|
||||
|
||||
template
|
||||
<
|
||||
typename Pieces,
|
||||
@@ -204,7 +233,11 @@ class piece_turn_visitor
|
||||
// and iterating in sync with them...
|
||||
typedef detail::overlay::get_turn_info
|
||||
<
|
||||
#if defined(BOOST_GEOMETRY_BUFFER_USE_SIDE_OF_INTERSECTION)
|
||||
buffer_assign_turn
|
||||
#else
|
||||
detail::overlay::assign_null_policy
|
||||
#endif
|
||||
> turn_policy;
|
||||
|
||||
turn_policy::apply(*prev1, *it1, *next1,
|
||||
|
||||
@@ -25,6 +25,11 @@
|
||||
#include <boost/geometry/algorithms/detail/overlay/get_turn_info.hpp>
|
||||
#include <boost/geometry/policies/compare.hpp>
|
||||
#include <boost/geometry/strategies/buffer.hpp>
|
||||
#include <boost/geometry/algorithms/detail/buffer/buffer_policies.hpp>
|
||||
|
||||
#if defined(BOOST_GEOMETRY_BUFFER_USE_SIDE_OF_INTERSECTION)
|
||||
#include <boost/geometry/strategies/cartesian/side_of_intersection.hpp>
|
||||
#endif
|
||||
|
||||
|
||||
namespace boost { namespace geometry
|
||||
@@ -89,8 +94,10 @@ enum analyse_result
|
||||
analyse_disjoint,
|
||||
analyse_within,
|
||||
analyse_on_original_boundary,
|
||||
analyse_on_offsetted,
|
||||
analyse_near_offsetted
|
||||
analyse_on_offsetted
|
||||
#if ! defined(BOOST_GEOMETRY_BUFFER_USE_SIDE_OF_INTERSECTION)
|
||||
, analyse_near_offsetted
|
||||
#endif
|
||||
};
|
||||
|
||||
template <typename Point>
|
||||
@@ -112,6 +119,31 @@ inline analyse_result check_segment(Point const& previous,
|
||||
Point const& current, Turn const& turn,
|
||||
bool from_monotonic)
|
||||
{
|
||||
|
||||
#if defined(BOOST_GEOMETRY_BUFFER_USE_SIDE_OF_INTERSECTION)
|
||||
typedef geometry::model::referring_segment<Point const> segment_type;
|
||||
segment_type const p(turn.rob_pi, turn.rob_pj);
|
||||
segment_type const q(turn.rob_qi, turn.rob_qj);
|
||||
segment_type const r(previous, current);
|
||||
int const side = strategy::side::side_of_intersection::apply(p, q, r,
|
||||
turn.robust_point);
|
||||
|
||||
if (side == 0)
|
||||
{
|
||||
return analyse_on_offsetted;
|
||||
}
|
||||
if (side == -1 && from_monotonic)
|
||||
{
|
||||
return analyse_within;
|
||||
}
|
||||
if (side == 1 && from_monotonic)
|
||||
{
|
||||
return analyse_disjoint;
|
||||
}
|
||||
return analyse_continue;
|
||||
|
||||
#else
|
||||
|
||||
typedef typename strategy::side::services::default_strategy
|
||||
<
|
||||
typename cs_tag<Point>::type
|
||||
@@ -156,6 +188,7 @@ inline analyse_result check_segment(Point const& previous,
|
||||
|
||||
// Not monotonic, on left or right side: continue analysing
|
||||
return analyse_continue;
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
@@ -169,14 +202,22 @@ public :
|
||||
typedef typename Turn::robust_point_type point_type;
|
||||
typedef typename geometry::coordinate_type<point_type>::type coordinate_type;
|
||||
|
||||
coordinate_type const point_y = geometry::get<1>(turn.robust_point);
|
||||
|
||||
#if defined(BOOST_GEOMETRY_BUFFER_USE_SIDE_OF_INTERSECTION)
|
||||
typedef geometry::model::referring_segment<point_type const> segment_type;
|
||||
segment_type const p(turn.rob_pi, turn.rob_pj);
|
||||
segment_type const q(turn.rob_qi, turn.rob_qj);
|
||||
#else
|
||||
typedef strategy::within::winding<point_type> strategy_type;
|
||||
|
||||
typename strategy_type::state_type state;
|
||||
strategy_type strategy;
|
||||
boost::ignore_unused(strategy);
|
||||
|
||||
#endif
|
||||
|
||||
BOOST_ASSERT(! piece.sections.empty());
|
||||
|
||||
coordinate_type const point_y = geometry::get<1>(turn.robust_point);
|
||||
|
||||
for (std::size_t s = 0; s < piece.sections.size(); s++)
|
||||
{
|
||||
section_type const& section = piece.sections[s];
|
||||
@@ -191,6 +232,38 @@ public :
|
||||
point_type const& previous = piece.robust_ring[i - 1];
|
||||
point_type const& current = piece.robust_ring[i];
|
||||
|
||||
#if defined(BOOST_GEOMETRY_BUFFER_USE_SIDE_OF_INTERSECTION)
|
||||
|
||||
// First check if it is in range - if it is not, the
|
||||
// expensive side_of_intersection does not need to be
|
||||
// applied
|
||||
coordinate_type y1 = geometry::get<1>(previous);
|
||||
coordinate_type y2 = geometry::get<1>(current);
|
||||
|
||||
if (y1 > y2)
|
||||
{
|
||||
std::swap(y1, y2);
|
||||
}
|
||||
|
||||
if (point_y >= y1 - 1 && point_y <= y2 + 1)
|
||||
{
|
||||
segment_type const r(previous, current);
|
||||
int const side = strategy::side::side_of_intersection::apply(p, q, r,
|
||||
turn.robust_point);
|
||||
|
||||
// Sections are monotonic in y-dimension
|
||||
if (side == 1)
|
||||
{
|
||||
// Left on segment
|
||||
return analyse_disjoint;
|
||||
}
|
||||
else if (side == 0)
|
||||
{
|
||||
// Collinear - TODO: check if really on segment
|
||||
return analyse_on_offsetted;
|
||||
}
|
||||
}
|
||||
#else
|
||||
analyse_result code = check_segment(previous, current, turn, false);
|
||||
if (code != analyse_continue)
|
||||
{
|
||||
@@ -200,10 +273,15 @@ public :
|
||||
// Get the state (to determine it is within), we don't have
|
||||
// to cover the on-segment case (covered above)
|
||||
strategy.apply(turn.robust_point, previous, current, state);
|
||||
#endif
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#if defined(BOOST_GEOMETRY_BUFFER_USE_SIDE_OF_INTERSECTION)
|
||||
// It is nowhere outside, and not on segment, so it is within
|
||||
return analyse_within;
|
||||
#else
|
||||
int const code = strategy.result(state);
|
||||
if (code == 1)
|
||||
{
|
||||
@@ -216,6 +294,7 @@ public :
|
||||
|
||||
// Should normally not occur - on-segment is covered
|
||||
return analyse_unknown;
|
||||
#endif
|
||||
}
|
||||
|
||||
};
|
||||
@@ -228,6 +307,49 @@ class analyse_turn_wrt_piece
|
||||
bool is_original,
|
||||
Point const& offsetted)
|
||||
{
|
||||
boost::ignore_unused(offsetted);
|
||||
#if defined(BOOST_GEOMETRY_BUFFER_USE_SIDE_OF_INTERSECTION)
|
||||
typedef geometry::model::referring_segment<Point const> segment_type;
|
||||
segment_type const p(turn.rob_pi, turn.rob_pj);
|
||||
segment_type const q(turn.rob_qi, turn.rob_qj);
|
||||
segment_type const r(s1, s2);
|
||||
int const side = strategy::side::side_of_intersection::apply(p, q, r,
|
||||
turn.robust_point);
|
||||
|
||||
if (side == 1)
|
||||
{
|
||||
// left of segment
|
||||
return analyse_disjoint;
|
||||
}
|
||||
else if (side == 0)
|
||||
{
|
||||
// If is collinear, either on segment or before/after
|
||||
typedef geometry::model::box<Point> box_type;
|
||||
|
||||
box_type box;
|
||||
geometry::assign_inverse(box);
|
||||
geometry::expand(box, s1);
|
||||
geometry::expand(box, s2);
|
||||
|
||||
if (geometry::covered_by(turn.robust_point, box))
|
||||
{
|
||||
// Points on helper-segments are considered as within
|
||||
// Points on original boundary are processed differently
|
||||
return is_original
|
||||
? analyse_on_original_boundary
|
||||
: analyse_within;
|
||||
}
|
||||
|
||||
// It is collinear but not on the segment. Because these
|
||||
// segments are convex, it is outside
|
||||
// Unless the offsetted ring is collinear or concave w.r.t.
|
||||
// helper-segment but that scenario is not yet supported
|
||||
return analyse_disjoint;
|
||||
}
|
||||
|
||||
// right of segment
|
||||
return analyse_continue;
|
||||
#else
|
||||
typedef typename strategy::side::services::default_strategy
|
||||
<
|
||||
typename cs_tag<Point>::type
|
||||
@@ -276,6 +398,7 @@ class analyse_turn_wrt_piece
|
||||
|
||||
// right of segment
|
||||
return analyse_continue;
|
||||
#endif
|
||||
}
|
||||
|
||||
template <typename Turn, typename Piece>
|
||||
@@ -492,6 +615,60 @@ class turn_in_piece_visitor
|
||||
return false;
|
||||
}
|
||||
|
||||
#if defined(BOOST_GEOMETRY_BUFFER_USE_SIDE_OF_INTERSECTION)
|
||||
template <typename Turn, typename Piece>
|
||||
static inline int turn_in_convex_piece(Turn const& turn,
|
||||
Piece const& piece)
|
||||
{
|
||||
typedef typename Turn::robust_point_type point_type;
|
||||
typedef typename Piece::piece_robust_ring_type ring_type;
|
||||
typedef geometry::model::referring_segment<point_type const> segment;
|
||||
|
||||
segment const p(turn.rob_pi, turn.rob_pj);
|
||||
segment const q(turn.rob_qi, turn.rob_qj);
|
||||
|
||||
typedef typename boost::range_iterator<ring_type const>::type iterator_type;
|
||||
iterator_type it = boost::begin(piece.robust_ring);
|
||||
iterator_type end = boost::end(piece.robust_ring);
|
||||
|
||||
// A robust ring is always closed, and always clockwise
|
||||
for (iterator_type previous = it++; it != end; ++previous, ++it)
|
||||
{
|
||||
geometry::equal_to<point_type> comparator;
|
||||
if (comparator(*previous, *it))
|
||||
{
|
||||
// Points are the same
|
||||
continue;
|
||||
}
|
||||
|
||||
segment r(*previous, *it);
|
||||
|
||||
int const side = strategy::side::side_of_intersection::apply(p, q, r,
|
||||
turn.robust_point);
|
||||
|
||||
if (side == 1)
|
||||
{
|
||||
// IP is left of segment, so it is outside
|
||||
return -1; // outside
|
||||
}
|
||||
else if (side == 0)
|
||||
{
|
||||
// IP is collinear with segment. TODO: we should analyze this further
|
||||
// For now we use the fallback point
|
||||
if (in_box(*previous, *it, turn.robust_point))
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
return -1; // outside
|
||||
}
|
||||
}
|
||||
}
|
||||
return 1; // inside
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
public:
|
||||
|
||||
@@ -530,12 +707,37 @@ public:
|
||||
}
|
||||
|
||||
// TODO: mutable_piece to make some on-demand preparations in analyse
|
||||
Turn& mutable_turn = m_turns[turn.turn_index];
|
||||
|
||||
if (piece.type == geometry::strategy::buffer::buffered_point)
|
||||
{
|
||||
// Optimization for buffer around points: if distance from center
|
||||
// is not between min/max radius, the result is clear
|
||||
typedef typename default_comparable_distance_result
|
||||
<
|
||||
typename Turn::robust_point_type
|
||||
>::type distance_type;
|
||||
|
||||
distance_type const cd
|
||||
= geometry::comparable_distance(piece.robust_center,
|
||||
turn.robust_point);
|
||||
|
||||
if (cd < piece.robust_min_comparable_radius)
|
||||
{
|
||||
mutable_turn.count_within++;
|
||||
return;
|
||||
}
|
||||
if (cd > piece.robust_max_comparable_radius)
|
||||
{
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
analyse_result analyse_code =
|
||||
piece.type == geometry::strategy::buffer::buffered_point
|
||||
? analyse_turn_wrt_point_piece::apply(turn, piece)
|
||||
: analyse_turn_wrt_piece::apply(turn, piece);
|
||||
|
||||
Turn& mutable_turn = m_turns[turn.turn_index];
|
||||
switch(analyse_code)
|
||||
{
|
||||
case analyse_disjoint :
|
||||
@@ -549,16 +751,32 @@ public:
|
||||
case analyse_within :
|
||||
mutable_turn.count_within++;
|
||||
return;
|
||||
#if ! defined(BOOST_GEOMETRY_BUFFER_USE_SIDE_OF_INTERSECTION)
|
||||
case analyse_near_offsetted :
|
||||
mutable_turn.count_within_near_offsetted++;
|
||||
return;
|
||||
#endif
|
||||
default :
|
||||
break;
|
||||
}
|
||||
|
||||
// TODO: this point_in_geometry is a performance-bottleneck here and
|
||||
// will be replaced completely by extending analyse_piece functionality
|
||||
#if defined(BOOST_GEOMETRY_BUFFER_USE_SIDE_OF_INTERSECTION)
|
||||
// We don't know (yet)
|
||||
int geometry_code = 0;
|
||||
if (piece.is_convex)
|
||||
{
|
||||
geometry_code = turn_in_convex_piece(turn, piece);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
// TODO: this point_in_geometry is a performance-bottleneck here and
|
||||
// will be replaced completely by extending analyse_piece functionality
|
||||
geometry_code = detail::within::point_in_geometry(turn.robust_point, piece.robust_ring);
|
||||
}
|
||||
#else
|
||||
int geometry_code = detail::within::point_in_geometry(turn.robust_point, piece.robust_ring);
|
||||
#endif
|
||||
|
||||
if (geometry_code == 1)
|
||||
{
|
||||
|
||||
@@ -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
|
||||
@@ -23,11 +23,19 @@
|
||||
|
||||
#include <cstddef>
|
||||
|
||||
#include <boost/type_traits/is_same.hpp>
|
||||
|
||||
#include <boost/geometry/core/access.hpp>
|
||||
#include <boost/geometry/core/coordinate_dimension.hpp>
|
||||
#include <boost/geometry/core/radian_access.hpp>
|
||||
#include <boost/geometry/core/coordinate_system.hpp>
|
||||
#include <boost/geometry/core/coordinate_type.hpp>
|
||||
#include <boost/geometry/core/cs.hpp>
|
||||
#include <boost/geometry/core/tags.hpp>
|
||||
|
||||
#include <boost/geometry/util/condition.hpp>
|
||||
#include <boost/geometry/util/math.hpp>
|
||||
#include <boost/geometry/util/normalize_spheroidal_coordinates.hpp>
|
||||
#include <boost/geometry/util/select_most_precise.hpp>
|
||||
|
||||
#include <boost/geometry/algorithms/dispatch/disjoint.hpp>
|
||||
|
||||
@@ -40,12 +48,103 @@ namespace boost { namespace geometry
|
||||
namespace detail { namespace disjoint
|
||||
{
|
||||
|
||||
|
||||
class point_point_on_spheroid
|
||||
{
|
||||
private:
|
||||
template
|
||||
<
|
||||
typename Units,
|
||||
typename CoordinateType1,
|
||||
typename CoordinateType2
|
||||
>
|
||||
static inline bool apply_same_units(CoordinateType1& lon1,
|
||||
CoordinateType1& lat1,
|
||||
CoordinateType2& lon2,
|
||||
CoordinateType2& lat2)
|
||||
{
|
||||
math::normalize_spheroidal_coordinates<Units>(lon1, lat1);
|
||||
math::normalize_spheroidal_coordinates<Units>(lon2, lat2);
|
||||
|
||||
return ! math::equals(lat1, lat2) || ! math::equals(lon1, lon2);
|
||||
}
|
||||
|
||||
public:
|
||||
template <typename Point1, typename Point2>
|
||||
static inline bool apply(Point1 const& p1, Point2 const& p2)
|
||||
{
|
||||
typedef typename coordinate_type<Point1>::type coordinate_type1;
|
||||
typedef typename coordinate_type<Point2>::type coordinate_type2;
|
||||
|
||||
typedef typename coordinate_system<Point1>::type::units units1;
|
||||
typedef typename coordinate_system<Point2>::type::units units2;
|
||||
|
||||
if (BOOST_GEOMETRY_CONDITION((boost::is_same<units1, units2>::value)))
|
||||
{
|
||||
coordinate_type1 lon1 = geometry::get<0>(p1);
|
||||
coordinate_type1 lat1 = geometry::get<1>(p1);
|
||||
coordinate_type2 lon2 = geometry::get<0>(p2);
|
||||
coordinate_type2 lat2 = geometry::get<1>(p2);
|
||||
|
||||
return apply_same_units<units1>(lon1, lat1, lon2, lat2);
|
||||
}
|
||||
|
||||
typedef typename geometry::select_most_precise
|
||||
<
|
||||
typename fp_coordinate_type<Point1>::type,
|
||||
typename fp_coordinate_type<Point2>::type
|
||||
>::type calculation_type;
|
||||
|
||||
calculation_type lon1 = get_as_radian<0>(p1);
|
||||
calculation_type lat1 = get_as_radian<1>(p1);
|
||||
|
||||
calculation_type lon2 = get_as_radian<0>(p2);
|
||||
calculation_type lat2 = get_as_radian<1>(p2);
|
||||
|
||||
return apply_same_units<radian>(lon1, lat1, lon2, lat2);
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
template
|
||||
<
|
||||
typename Point1, typename Point2,
|
||||
std::size_t Dimension, std::size_t DimensionCount,
|
||||
typename CSTag1 = typename cs_tag<Point1>::type,
|
||||
typename CSTag2 = CSTag1
|
||||
>
|
||||
struct point_point
|
||||
: point_point<Point1, Point2, Dimension, DimensionCount, cartesian_tag>
|
||||
{};
|
||||
|
||||
template
|
||||
<
|
||||
typename Point1, typename Point2,
|
||||
std::size_t Dimension, std::size_t DimensionCount
|
||||
>
|
||||
struct point_point
|
||||
<
|
||||
Point1, Point2, Dimension, DimensionCount, spherical_equatorial_tag
|
||||
> : point_point_on_spheroid
|
||||
{};
|
||||
|
||||
template
|
||||
<
|
||||
typename Point1, typename Point2,
|
||||
std::size_t Dimension, std::size_t DimensionCount
|
||||
>
|
||||
struct point_point
|
||||
<
|
||||
Point1, Point2, Dimension, DimensionCount, geographic_tag
|
||||
> : point_point_on_spheroid
|
||||
{};
|
||||
|
||||
template
|
||||
<
|
||||
typename Point1, typename Point2,
|
||||
std::size_t Dimension, std::size_t DimensionCount
|
||||
>
|
||||
struct point_point<Point1, Point2, Dimension, DimensionCount, cartesian_tag>
|
||||
{
|
||||
static inline bool apply(Point1 const& p1, Point2 const& p2)
|
||||
{
|
||||
@@ -61,9 +160,11 @@ struct point_point
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
template <typename Point1, typename Point2, std::size_t DimensionCount>
|
||||
struct point_point<Point1, Point2, DimensionCount, DimensionCount>
|
||||
struct point_point
|
||||
<
|
||||
Point1, Point2, DimensionCount, DimensionCount, cartesian_tag
|
||||
>
|
||||
{
|
||||
static inline bool apply(Point1 const& , Point2 const& )
|
||||
{
|
||||
|
||||
@@ -1,6 +1,11 @@
|
||||
// Boost.Geometry (aka GGL, Generic Geometry Library)
|
||||
|
||||
// Copyright (c) 2007-2012 Barend Gehrels, Amsterdam, the Netherlands.
|
||||
// Copyright (c) 2007-2015 Barend Gehrels, Amsterdam, the Netherlands.
|
||||
|
||||
// This file was modified by Oracle on 2015.
|
||||
// Modifications copyright (c) 2015 Oracle and/or its affiliates.
|
||||
|
||||
// Contributed and/or modified by Menelaos Karavelas, on behalf of Oracle
|
||||
|
||||
// Use, modification and distribution is subject to the Boost Software License,
|
||||
// Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
|
||||
@@ -160,10 +165,12 @@ template
|
||||
typename OutputLinestring,
|
||||
typename OutputIterator,
|
||||
typename Range,
|
||||
typename RobustPolicy,
|
||||
typename Box,
|
||||
typename Strategy
|
||||
>
|
||||
OutputIterator clip_range_with_box(Box const& b, Range const& range,
|
||||
RobustPolicy const&,
|
||||
OutputIterator out, Strategy const& strategy)
|
||||
{
|
||||
if (boost::begin(range) == boost::end(range))
|
||||
|
||||
@@ -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>
|
||||
@@ -409,13 +410,13 @@ struct intersection_insert
|
||||
template <typename RobustPolicy, typename OutputIterator, typename Strategy>
|
||||
static inline OutputIterator apply(Linestring const& linestring,
|
||||
Box const& box,
|
||||
RobustPolicy const& ,
|
||||
RobustPolicy const& robust_policy,
|
||||
OutputIterator out, Strategy const& )
|
||||
{
|
||||
typedef typename point_type<GeometryOut>::type point_type;
|
||||
strategy::intersection::liang_barsky<Box, point_type> lb_strategy;
|
||||
return detail::intersection::clip_range_with_box
|
||||
<GeometryOut>(box, linestring, out, lb_strategy);
|
||||
<GeometryOut>(box, linestring, robust_policy, out, lb_strategy);
|
||||
}
|
||||
};
|
||||
|
||||
@@ -487,7 +488,7 @@ struct intersection_insert
|
||||
template <typename RobustPolicy, typename OutputIterator, typename Strategy>
|
||||
static inline OutputIterator apply(Segment const& segment,
|
||||
Box const& box,
|
||||
RobustPolicy const& ,// TODO: propagate to clip_range_with_box
|
||||
RobustPolicy const& robust_policy,
|
||||
OutputIterator out, Strategy const& )
|
||||
{
|
||||
geometry::segment_view<Segment> range(segment);
|
||||
@@ -495,7 +496,7 @@ struct intersection_insert
|
||||
typedef typename point_type<GeometryOut>::type point_type;
|
||||
strategy::intersection::liang_barsky<Box, point_type> lb_strategy;
|
||||
return detail::intersection::clip_range_with_box
|
||||
<GeometryOut>(box, range, out, lb_strategy);
|
||||
<GeometryOut>(box, range, robust_policy, out, lb_strategy);
|
||||
}
|
||||
};
|
||||
|
||||
@@ -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
|
||||
|
||||
|
||||
@@ -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
|
||||
@@ -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());
|
||||
|
||||
@@ -29,6 +29,8 @@ struct ring_properties
|
||||
typedef Point point_type;
|
||||
typedef typename default_area_result<Point>::type area_type;
|
||||
|
||||
bool valid;
|
||||
|
||||
// Filled by "select_rings"
|
||||
Point point;
|
||||
area_type area;
|
||||
@@ -43,7 +45,8 @@ struct ring_properties
|
||||
std::vector<ring_identifier> children;
|
||||
|
||||
inline ring_properties()
|
||||
: area(area_type())
|
||||
: valid(false)
|
||||
, area(area_type())
|
||||
, reversed(false)
|
||||
, discarded(false)
|
||||
, parent_area(-1)
|
||||
@@ -59,7 +62,7 @@ struct ring_properties
|
||||
// We should take a point somewhere in the middle of the ring,
|
||||
// to avoid taking a point on a (self)tangency,
|
||||
// in cases where multiple points come together
|
||||
geometry::point_on_border(this->point, ring_or_box, true);
|
||||
valid = geometry::point_on_border(this->point, ring_or_box, true);
|
||||
}
|
||||
|
||||
inline area_type get_area() const
|
||||
|
||||
@@ -14,6 +14,10 @@
|
||||
#ifndef BOOST_GEOMETRY_ALGORITHMS_DETAIL_RELATE_LESS_HPP
|
||||
#define BOOST_GEOMETRY_ALGORITHMS_DETAIL_RELATE_LESS_HPP
|
||||
|
||||
#include <boost/geometry/core/coordinate_dimension.hpp>
|
||||
#include <boost/geometry/core/coordinate_type.hpp>
|
||||
#include <boost/geometry/util/math.hpp>
|
||||
|
||||
namespace boost { namespace geometry
|
||||
{
|
||||
|
||||
|
||||
160
include/boost/geometry/algorithms/is_convex.hpp
Normal file
160
include/boost/geometry/algorithms/is_convex.hpp
Normal file
@@ -0,0 +1,160 @@
|
||||
// Boost.Geometry (aka GGL, Generic Geometry Library)
|
||||
|
||||
// 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)
|
||||
|
||||
#ifndef BOOST_GEOMETRY_ALGORITHMS_IS_CONVEX_HPP
|
||||
#define BOOST_GEOMETRY_ALGORITHMS_IS_CONVEX_HPP
|
||||
|
||||
|
||||
#include <boost/geometry/core/access.hpp>
|
||||
#include <boost/geometry/core/closure.hpp>
|
||||
#include <boost/geometry/core/cs.hpp>
|
||||
#include <boost/geometry/core/coordinate_dimension.hpp>
|
||||
#include <boost/geometry/core/point_type.hpp>
|
||||
#include <boost/geometry/algorithms/detail/equals/point_point.hpp>
|
||||
#include <boost/geometry/iterators/ever_circling_iterator.hpp>
|
||||
#include <boost/geometry/strategies/side.hpp>
|
||||
#include <boost/geometry/strategies/cartesian/side_by_triangle.hpp>
|
||||
#include <boost/geometry/views/detail/normalized_view.hpp>
|
||||
|
||||
namespace boost { namespace geometry
|
||||
{
|
||||
|
||||
|
||||
#ifndef DOXYGEN_NO_DETAIL
|
||||
namespace detail { namespace is_convex
|
||||
{
|
||||
|
||||
struct ring_is_convex
|
||||
{
|
||||
template <typename Ring>
|
||||
static inline bool apply(Ring const& ring)
|
||||
{
|
||||
typedef typename geometry::point_type<Ring>::type point_type;
|
||||
typedef typename strategy::side::services::default_strategy
|
||||
<
|
||||
typename cs_tag<point_type>::type
|
||||
>::type side_strategy_type;
|
||||
|
||||
std::size_t n = boost::size(ring);
|
||||
if (boost::size(ring) < core_detail::closure::minimum_ring_size
|
||||
<
|
||||
geometry::closure<Ring>::value
|
||||
>::value)
|
||||
{
|
||||
// (Too) small rings are considered as non-concave, is convex
|
||||
return true;
|
||||
}
|
||||
|
||||
// Walk in clockwise direction, consider ring as closed
|
||||
// (though closure is not important in this algorithm - any dupped
|
||||
// point is skipped)
|
||||
typedef detail::normalized_view<Ring const> view_type;
|
||||
view_type view(ring);
|
||||
|
||||
typedef geometry::ever_circling_range_iterator<view_type const> it_type;
|
||||
it_type previous(view);
|
||||
it_type current(view);
|
||||
current++;
|
||||
|
||||
std::size_t index = 1;
|
||||
while (equals::equals_point_point(*current, *previous) && index < n)
|
||||
{
|
||||
current++;
|
||||
index++;
|
||||
}
|
||||
|
||||
if (index == n)
|
||||
{
|
||||
// All points are apparently equal
|
||||
return true;
|
||||
}
|
||||
|
||||
it_type next = current;
|
||||
next++;
|
||||
while (equals::equals_point_point(*current, *next))
|
||||
{
|
||||
next++;
|
||||
}
|
||||
|
||||
// We have now three different points on the ring
|
||||
// Walk through all points, use a counter because of the ever-circling
|
||||
// iterator
|
||||
for (std::size_t i = 0; i < n; i++)
|
||||
{
|
||||
int const side = side_strategy_type::apply(*previous, *current, *next);
|
||||
if (side == 1)
|
||||
{
|
||||
// Next is on the left side of clockwise ring:
|
||||
// the piece is not convex
|
||||
return false;
|
||||
}
|
||||
|
||||
previous = current;
|
||||
current = next;
|
||||
|
||||
// Advance next to next different point
|
||||
// (because there are non-equal points, this loop is not infinite)
|
||||
next++;
|
||||
while (equals::equals_point_point(*current, *next))
|
||||
{
|
||||
next++;
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
}} // namespace detail::is_convex
|
||||
#endif // DOXYGEN_NO_DETAIL
|
||||
|
||||
|
||||
#ifndef DOXYGEN_NO_DISPATCH
|
||||
namespace dispatch
|
||||
{
|
||||
|
||||
template
|
||||
<
|
||||
typename Geometry,
|
||||
typename Tag = typename tag<Geometry>::type
|
||||
>
|
||||
struct is_convex : not_implemented<Tag>
|
||||
{};
|
||||
|
||||
template <typename Box>
|
||||
struct is_convex<Box, box_tag>
|
||||
{
|
||||
static inline bool apply(Box const& )
|
||||
{
|
||||
// Any box is convex (TODO: consider spherical boxes)
|
||||
return true;
|
||||
}
|
||||
};
|
||||
|
||||
template <typename Box>
|
||||
struct is_convex<Box, ring_tag> : detail::is_convex::ring_is_convex
|
||||
{};
|
||||
|
||||
|
||||
} // namespace dispatch
|
||||
#endif // DOXYGEN_NO_DISPATCH
|
||||
|
||||
// TODO: variants
|
||||
|
||||
// TODO: documentation / qbk
|
||||
template<typename Geometry>
|
||||
inline bool is_convex(Geometry const& geometry)
|
||||
{
|
||||
return dispatch::is_convex<Geometry>::apply(geometry);
|
||||
}
|
||||
|
||||
|
||||
}} // namespace boost::geometry
|
||||
|
||||
|
||||
#endif // BOOST_GEOMETRY_ALGORITHMS_IS_CONVEX_HPP
|
||||
@@ -1,8 +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) 2007-2015 Barend Gehrels, Amsterdam, the Netherlands.
|
||||
// Copyright (c) 2008-2015 Bruno Lalande, Paris, France.
|
||||
// Copyright (c) 2009-2015 Mateusz Loskot, London, UK.
|
||||
|
||||
// This file was modified by Oracle on 2015.
|
||||
// Modifications copyright (c) 2015, Oracle and/or its affiliates.
|
||||
|
||||
// Contributed and/or modified by Menelaos Karavelas, on behalf of Oracle
|
||||
|
||||
// Parts of Boost.Geometry are redesigned from Geodan's Geographic Library
|
||||
// (geolib/GGL), copyright (c) 1995-2010 Geodan, Amsterdam, the Netherlands.
|
||||
@@ -47,7 +52,8 @@ struct degree_radian_converter
|
||||
return boost::numeric_cast
|
||||
<
|
||||
coordinate_type
|
||||
>(geometry::get<Dimension>(geometry) * geometry::math::d2r);
|
||||
>(geometry::get<Dimension>(geometry)
|
||||
* math::d2r<coordinate_type>());
|
||||
}
|
||||
|
||||
static inline void set(Geometry& geometry, coordinate_type const& radians)
|
||||
@@ -55,7 +61,7 @@ struct degree_radian_converter
|
||||
geometry::set<Dimension>(geometry, boost::numeric_cast
|
||||
<
|
||||
coordinate_type
|
||||
>(radians * geometry::math::r2d));
|
||||
>(radians * math::r2d<coordinate_type>()));
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
@@ -237,13 +237,16 @@ namespace strategy
|
||||
// Assign last one, if any
|
||||
process(dms, value, has_value);
|
||||
|
||||
double const d2r = math::d2r<double>();
|
||||
double const r2d = math::r2d<double>();
|
||||
|
||||
return dms_result(factor *
|
||||
(in_radian && as_radian
|
||||
? dms.dms[0]
|
||||
: in_radian && ! as_radian
|
||||
? dms.dms[0] * math::r2d
|
||||
? dms.dms[0] * r2d
|
||||
: ! in_radian && as_radian
|
||||
? dms.dms[0] * math::d2r + dms.dms[1] * math::d2r / 60.0 + dms.dms[2] * math::d2r / 3600.0
|
||||
? dms.dms[0] * d2r + dms.dms[1] * d2r / 60.0 + dms.dms[2] * d2r / 3600.0
|
||||
: dms.dms[0] + dms.dms[1] / 60.0 + dms.dms[2] / 3600.0)
|
||||
, axis);
|
||||
}
|
||||
|
||||
@@ -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,7 +79,7 @@
|
||||
#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>
|
||||
@@ -161,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);
|
||||
@@ -174,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);
|
||||
|
||||
@@ -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?
|
||||
}
|
||||
|
||||
|
||||
@@ -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
|
||||
{
|
||||
|
||||
@@ -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)
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -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 */
|
||||
|
||||
@@ -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)
|
||||
|
||||
@@ -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)
|
||||
{
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -38,23 +38,24 @@
|
||||
// DEALINGS IN THE SOFTWARE.
|
||||
|
||||
|
||||
#include <boost/core/ignore_unused.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;
|
||||
@@ -69,19 +70,14 @@ namespace boost { namespace geometry { namespace projections
|
||||
double dd;
|
||||
double n2;
|
||||
double rho0;
|
||||
double rho;
|
||||
double phi1;
|
||||
double phi2;
|
||||
double en[EN_SIZE];
|
||||
int ellips;
|
||||
};
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
/* determine latitude angle phi-1 */
|
||||
inline double
|
||||
static double
|
||||
phi1_(double qs, double Te, double Tone_es) {
|
||||
int i;
|
||||
double Phi, sinpi, cospi, con, com, dphi;
|
||||
@@ -112,7 +108,7 @@ namespace boost { namespace geometry { namespace projections
|
||||
typedef double geographic_type;
|
||||
typedef double cartesian_type;
|
||||
|
||||
mutable par_aea m_proj_parm;
|
||||
par_aea m_proj_parm;
|
||||
|
||||
inline base_aea_ellipsoid(const Parameters& par)
|
||||
: base_t_fi<base_aea_ellipsoid<Geographic, Cartesian, Parameters>,
|
||||
@@ -120,22 +116,24 @@ 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
|
||||
{
|
||||
if ((this->m_proj_parm.rho = this->m_proj_parm.c - (this->m_proj_parm.ellips ? this->m_proj_parm.n * pj_qsfn(sin(lp_lat),
|
||||
double rho = 0.0;
|
||||
if ((rho = this->m_proj_parm.c - (this->m_proj_parm.ellips ? this->m_proj_parm.n * pj_qsfn(sin(lp_lat),
|
||||
this->m_par.e, this->m_par.one_es) : this->m_proj_parm.n2 * sin(lp_lat))) < 0.) throw proj_exception();
|
||||
this->m_proj_parm.rho = this->m_proj_parm.dd * sqrt(this->m_proj_parm.rho);
|
||||
xy_x = this->m_proj_parm.rho * sin( lp_lon *= this->m_proj_parm.n );
|
||||
xy_y = this->m_proj_parm.rho0 - this->m_proj_parm.rho * cos(lp_lon);
|
||||
rho = this->m_proj_parm.dd * sqrt(rho);
|
||||
xy_x = rho * sin( lp_lon *= this->m_proj_parm.n );
|
||||
xy_y = this->m_proj_parm.rho0 - rho * cos(lp_lon);
|
||||
}
|
||||
|
||||
inline void inv(cartesian_type& xy_x, cartesian_type& xy_y, geographic_type& lp_lon, geographic_type& lp_lat) const
|
||||
{
|
||||
if( (this->m_proj_parm.rho = boost::math::hypot(xy_x, xy_y = this->m_proj_parm.rho0 - xy_y)) != 0.0 ) {
|
||||
double rho = 0.0;
|
||||
if( (rho = boost::math::hypot(xy_x, xy_y = this->m_proj_parm.rho0 - xy_y)) != 0.0 ) {
|
||||
if (this->m_proj_parm.n < 0.) {
|
||||
this->m_proj_parm.rho = -this->m_proj_parm.rho;
|
||||
rho = -rho;
|
||||
xy_x = -xy_x;
|
||||
xy_y = -xy_y;
|
||||
}
|
||||
lp_lat = this->m_proj_parm.rho / this->m_proj_parm.dd;
|
||||
lp_lat = rho / this->m_proj_parm.dd;
|
||||
if (this->m_proj_parm.ellips) {
|
||||
lp_lat = (this->m_proj_parm.c - lp_lat * lp_lat) / this->m_proj_parm.n;
|
||||
if (fabs(this->m_proj_parm.ec - fabs(lp_lat)) > TOL7) {
|
||||
@@ -153,26 +151,33 @@ namespace boost { namespace geometry { namespace projections
|
||||
lp_lat = this->m_proj_parm.n > 0. ? HALFPI : - HALFPI;
|
||||
}
|
||||
}
|
||||
|
||||
private :
|
||||
inline void ignore_unused()
|
||||
{
|
||||
boost::ignore_unused(phi1_);
|
||||
}
|
||||
};
|
||||
|
||||
template <typename Parameters>
|
||||
void setup(Parameters& par, par_aea& proj_parm)
|
||||
{
|
||||
boost::ignore_unused(par);
|
||||
boost::ignore_unused(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);
|
||||
@@ -192,8 +197,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;
|
||||
}
|
||||
|
||||
|
||||
@@ -228,7 +231,9 @@ namespace boost { namespace geometry { namespace projections
|
||||
- Conic
|
||||
- Spheroid
|
||||
- Ellipsoid
|
||||
- lat_1= lat_2=
|
||||
\par Projection parameters
|
||||
- lat_1: Latitude of first standard parallel (degrees)
|
||||
- lat_2: Latitude of second standard parallel (degrees)
|
||||
\par Example
|
||||
\image html ex_aea.gif
|
||||
*/
|
||||
@@ -251,7 +256,9 @@ namespace boost { namespace geometry { namespace projections
|
||||
- Conic
|
||||
- Spheroid
|
||||
- Ellipsoid
|
||||
- lat_1= south
|
||||
\par Projection parameters
|
||||
- lat_1: Latitude of first standard parallel (degrees)
|
||||
- south: Denotes southern hemisphere UTM zone (boolean)
|
||||
\par Example
|
||||
\image html ex_leac.gif
|
||||
*/
|
||||
|
||||
@@ -46,12 +46,13 @@
|
||||
#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;
|
||||
@@ -72,11 +73,6 @@ namespace boost { namespace geometry { namespace projections
|
||||
int mode;
|
||||
};
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
// template class, using CRTP to implement forward/inverse
|
||||
template <typename Geographic, typename Cartesian, typename Parameters>
|
||||
struct base_aeqd_ellipsoid : public base_t_fi<base_aeqd_ellipsoid<Geographic, Cartesian, Parameters>,
|
||||
@@ -319,14 +315,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:
|
||||
@@ -337,15 +329,11 @@ 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;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -363,7 +351,9 @@ namespace boost { namespace geometry { namespace projections
|
||||
- Azimuthal
|
||||
- Spheroid
|
||||
- Ellipsoid
|
||||
- lat_0 guam
|
||||
\par Projection parameters
|
||||
- lat_0: Latitude of origin (degrees)
|
||||
- guam (boolean)
|
||||
\par Example
|
||||
\image html ex_aeqd.gif
|
||||
*/
|
||||
@@ -386,7 +376,9 @@ namespace boost { namespace geometry { namespace projections
|
||||
- Azimuthal
|
||||
- Spheroid
|
||||
- Ellipsoid
|
||||
- lat_0 guam
|
||||
\par Projection parameters
|
||||
- lat_0: Latitude of origin (degrees)
|
||||
- guam (boolean)
|
||||
\par Example
|
||||
\image html ex_aeqd.gif
|
||||
*/
|
||||
@@ -409,7 +401,9 @@ namespace boost { namespace geometry { namespace projections
|
||||
- Azimuthal
|
||||
- Spheroid
|
||||
- Ellipsoid
|
||||
- lat_0 guam
|
||||
\par Projection parameters
|
||||
- lat_0: Latitude of origin (degrees)
|
||||
- guam (boolean)
|
||||
\par Example
|
||||
\image html ex_aeqd.gif
|
||||
*/
|
||||
@@ -433,12 +427,14 @@ namespace boost { namespace geometry { namespace projections
|
||||
public :
|
||||
virtual projection<Geographic, Cartesian>* create_new(const Parameters& par) const
|
||||
{
|
||||
if (! par.es)
|
||||
return new base_v_fi<aeqd_spheroid<Geographic, Cartesian, Parameters>, Geographic, Cartesian, Parameters>(par);
|
||||
else if (pj_param(par.params, "bguam").i)
|
||||
bool const guam = pj_param(par.params, "bguam").i;
|
||||
|
||||
if (par.es && ! guam)
|
||||
return new base_v_fi<aeqd_ellipsoid<Geographic, Cartesian, Parameters>, Geographic, Cartesian, Parameters>(par);
|
||||
else if (par.es && guam)
|
||||
return new base_v_fi<aeqd_guam<Geographic, Cartesian, Parameters>, Geographic, Cartesian, Parameters>(par);
|
||||
else
|
||||
return new base_v_fi<aeqd_ellipsoid<Geographic, Cartesian, Parameters>, Geographic, Cartesian, Parameters>(par);
|
||||
return new base_v_fi<aeqd_spheroid<Geographic, Cartesian, Parameters>, Geographic, Cartesian, Parameters>(par);
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
@@ -38,8 +38,6 @@
|
||||
// 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>
|
||||
@@ -48,7 +46,9 @@
|
||||
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;
|
||||
@@ -65,10 +65,6 @@ namespace boost { namespace geometry { namespace projections
|
||||
int no_cut; /* do not cut at hemisphere limit */
|
||||
};
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
// template class, using CRTP to implement forward/inverse
|
||||
template <typename Geographic, typename Cartesian, typename Parameters>
|
||||
struct base_airy_spheroid : public base_t_f<base_airy_spheroid<Geographic, Cartesian, Parameters>,
|
||||
@@ -135,6 +131,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)
|
||||
@@ -160,7 +157,6 @@ namespace boost { namespace geometry { namespace projections
|
||||
proj_parm.cosph0 = cos(par.phi0);
|
||||
}
|
||||
}
|
||||
// par.fwd = s_forward;
|
||||
par.es = 0.;
|
||||
}
|
||||
|
||||
@@ -177,7 +173,9 @@ namespace boost { namespace geometry { namespace projections
|
||||
- Miscellaneous
|
||||
- Spheroid
|
||||
- no inverse
|
||||
- no_cut lat_b=
|
||||
\par Projection parameters
|
||||
- no_cut: Do not cut at hemisphere limit (boolean)
|
||||
- lat_b (degrees)
|
||||
\par Example
|
||||
\image html ex_airy.gif
|
||||
*/
|
||||
|
||||
@@ -39,7 +39,6 @@
|
||||
|
||||
|
||||
#include <boost/core/ignore_unused.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>
|
||||
@@ -49,7 +48,8 @@
|
||||
namespace boost { namespace geometry { namespace projections
|
||||
{
|
||||
#ifndef DOXYGEN_NO_DETAIL
|
||||
namespace detail { namespace aitoff{
|
||||
namespace detail { namespace aitoff
|
||||
{
|
||||
|
||||
struct par_aitoff
|
||||
{
|
||||
@@ -57,11 +57,6 @@ namespace boost { namespace geometry { namespace projections
|
||||
int mode;
|
||||
};
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
// template class, using CRTP to implement forward/inverse
|
||||
template <typename Geographic, typename Cartesian, typename Parameters>
|
||||
struct base_aitoff_spheroid : public base_t_fi<base_aitoff_spheroid<Geographic, Cartesian, Parameters>,
|
||||
@@ -90,9 +85,7 @@ namespace boost { namespace geometry { namespace projections
|
||||
xy_x = (xy_x + lp_lon * this->m_proj_parm.cosphi1) * 0.5;
|
||||
xy_y = (xy_y + lp_lat) * 0.5;
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
/***********************************************************************************
|
||||
*
|
||||
* Inverse functions added by Drazen Tutic and Lovro Gradiser based on paper:
|
||||
@@ -114,7 +107,6 @@ 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
|
||||
{
|
||||
int iter, MAXITER = 10, round = 0, MAXROUND = 20;
|
||||
@@ -171,19 +163,13 @@ namespace boost { namespace geometry { namespace projections
|
||||
} 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);
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
template <typename Parameters>
|
||||
void setup(Parameters& par, par_aitoff& proj_parm)
|
||||
{
|
||||
boost::ignore_unused(par);
|
||||
boost::ignore_unused(proj_parm);
|
||||
// par.inv = s_inverse;
|
||||
// par.fwd = s_forward;
|
||||
par.es = 0.;
|
||||
}
|
||||
|
||||
@@ -244,7 +230,8 @@ namespace boost { namespace geometry { namespace projections
|
||||
\par Projection characteristics
|
||||
- Miscellaneous
|
||||
- Spheroid
|
||||
- lat_1
|
||||
\par Projection parameters
|
||||
- lat_1: Latitude of first standard parallel (degrees)
|
||||
\par Example
|
||||
\image html ex_wintri.gif
|
||||
*/
|
||||
|
||||
@@ -38,8 +38,6 @@
|
||||
// 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>
|
||||
@@ -48,9 +46,10 @@
|
||||
namespace boost { namespace geometry { namespace projections
|
||||
{
|
||||
#ifndef DOXYGEN_NO_DETAIL
|
||||
namespace detail { namespace august{
|
||||
static const double M = 1.333333333333333;
|
||||
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>
|
||||
@@ -84,8 +83,6 @@ namespace boost { namespace geometry { namespace projections
|
||||
template <typename Parameters>
|
||||
void setup_august(Parameters& par)
|
||||
{
|
||||
// par.inv = 0;
|
||||
// par.fwd = s_forward;
|
||||
par.es = 0.;
|
||||
}
|
||||
|
||||
|
||||
@@ -38,8 +38,6 @@
|
||||
// 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>
|
||||
@@ -48,7 +46,9 @@
|
||||
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;
|
||||
|
||||
@@ -97,7 +97,6 @@ namespace boost { namespace geometry { namespace projections
|
||||
{
|
||||
proj_parm.bacn = proj_parm.ortl = 0;
|
||||
par.es = 0.;
|
||||
// par.fwd = s_forward;
|
||||
}
|
||||
|
||||
// Ortelius Oval
|
||||
@@ -107,7 +106,6 @@ namespace boost { namespace geometry { namespace projections
|
||||
proj_parm.bacn = 0;
|
||||
proj_parm.ortl = 1;
|
||||
par.es = 0.;
|
||||
// par.fwd = s_forward;
|
||||
}
|
||||
|
||||
// Bacon Globular
|
||||
@@ -117,7 +115,6 @@ namespace boost { namespace geometry { namespace projections
|
||||
proj_parm.bacn = 1;
|
||||
proj_parm.ortl = 0;
|
||||
par.es = 0.;
|
||||
// par.fwd = s_forward;
|
||||
}
|
||||
|
||||
}} // namespace detail::bacon
|
||||
|
||||
@@ -48,7 +48,9 @@
|
||||
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;
|
||||
@@ -197,8 +199,6 @@ 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.;
|
||||
}
|
||||
|
||||
@@ -214,6 +214,8 @@ namespace boost { namespace geometry { namespace projections
|
||||
\par Projection characteristics
|
||||
- Conic
|
||||
- Spheroid
|
||||
\par Projection parameters
|
||||
- ns (boolean)
|
||||
\par Example
|
||||
\image html ex_bipc.gif
|
||||
*/
|
||||
|
||||
@@ -38,8 +38,6 @@
|
||||
// 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>
|
||||
@@ -48,7 +46,9 @@
|
||||
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;
|
||||
@@ -57,7 +57,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>,
|
||||
@@ -99,7 +98,6 @@ namespace boost { namespace geometry { namespace projections
|
||||
void setup_boggs(Parameters& par)
|
||||
{
|
||||
par.es = 0.;
|
||||
// par.fwd = s_forward;
|
||||
}
|
||||
|
||||
}} // namespace detail::boggs
|
||||
|
||||
@@ -49,7 +49,9 @@
|
||||
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
|
||||
@@ -148,6 +150,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) {
|
||||
@@ -155,15 +158,11 @@ 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;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -180,7 +179,8 @@ namespace boost { namespace geometry { namespace projections
|
||||
- Conic
|
||||
- Spheroid
|
||||
- Ellipsoid
|
||||
- lat_1=
|
||||
\par Projection parameters
|
||||
- lat_1: Latitude of first standard parallel (degrees)
|
||||
\par Example
|
||||
\image html ex_bonne.gif
|
||||
*/
|
||||
@@ -203,7 +203,8 @@ namespace boost { namespace geometry { namespace projections
|
||||
- Conic
|
||||
- Spheroid
|
||||
- Ellipsoid
|
||||
- lat_1=
|
||||
\par Projection parameters
|
||||
- lat_1: Latitude of first standard parallel (degrees)
|
||||
\par Example
|
||||
\image html ex_bonne.gif
|
||||
*/
|
||||
|
||||
@@ -38,8 +38,6 @@
|
||||
// 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>
|
||||
@@ -51,7 +49,9 @@
|
||||
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;
|
||||
@@ -62,15 +62,6 @@ namespace boost { namespace geometry { namespace projections
|
||||
struct par_cass
|
||||
{
|
||||
double m0;
|
||||
double n;
|
||||
double t;
|
||||
double a1;
|
||||
double c;
|
||||
double r;
|
||||
double dd;
|
||||
double d2;
|
||||
double a2;
|
||||
double tn;
|
||||
double en[EN_SIZE];
|
||||
};
|
||||
|
||||
@@ -83,7 +74,7 @@ namespace boost { namespace geometry { namespace projections
|
||||
typedef double geographic_type;
|
||||
typedef double cartesian_type;
|
||||
|
||||
mutable par_cass m_proj_parm;
|
||||
par_cass m_proj_parm;
|
||||
|
||||
inline base_cass_ellipsoid(const Parameters& par)
|
||||
: base_t_fi<base_cass_ellipsoid<Geographic, Cartesian, Parameters>,
|
||||
@@ -91,16 +82,18 @@ 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_y = pj_mlfn(lp_lat, this->m_proj_parm.n = sin(lp_lat), this->m_proj_parm.c = cos(lp_lat), this->m_proj_parm.en);
|
||||
this->m_proj_parm.n = 1./sqrt(1. - this->m_par.es * this->m_proj_parm.n * this->m_proj_parm.n);
|
||||
this->m_proj_parm.tn = tan(lp_lat); this->m_proj_parm.t = this->m_proj_parm.tn * this->m_proj_parm.tn;
|
||||
this->m_proj_parm.a1 = lp_lon * this->m_proj_parm.c;
|
||||
this->m_proj_parm.c *= this->m_par.es * this->m_proj_parm.c / (1 - this->m_par.es);
|
||||
this->m_proj_parm.a2 = this->m_proj_parm.a1 * this->m_proj_parm.a1;
|
||||
xy_x = this->m_proj_parm.n * this->m_proj_parm.a1 * (1. - this->m_proj_parm.a2 * this->m_proj_parm.t *
|
||||
(C1 - (8. - this->m_proj_parm.t + 8. * this->m_proj_parm.c) * this->m_proj_parm.a2 * C2));
|
||||
xy_y -= this->m_proj_parm.m0 - this->m_proj_parm.n * this->m_proj_parm.tn * this->m_proj_parm.a2 *
|
||||
(.5 + (5. - this->m_proj_parm.t + 6. * this->m_proj_parm.c) * this->m_proj_parm.a2 * C3);
|
||||
double n = sin(lp_lat);
|
||||
double c = cos(lp_lat);
|
||||
xy_y = pj_mlfn(lp_lat, n, c, this->m_proj_parm.en);
|
||||
n = 1./sqrt(1. - this->m_par.es * n * n);
|
||||
double tn = tan(lp_lat); double t = tn * tn;
|
||||
double a1 = lp_lon * c;
|
||||
c *= this->m_par.es * c / (1 - this->m_par.es);
|
||||
double a2 = a1 * a1;
|
||||
xy_x = n * a1 * (1. - a2 * t *
|
||||
(C1 - (8. - t + 8. * c) * a2 * C2));
|
||||
xy_y -= this->m_proj_parm.m0 - n * tn * a2 *
|
||||
(.5 + (5. - t + 6. * c) * a2 * C3);
|
||||
}
|
||||
|
||||
inline void inv(cartesian_type& xy_x, cartesian_type& xy_y, geographic_type& lp_lon, geographic_type& lp_lat) const
|
||||
@@ -108,17 +101,17 @@ namespace boost { namespace geometry { namespace projections
|
||||
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);
|
||||
this->m_proj_parm.r = 1. / (1. - this->m_par.es * this->m_proj_parm.n * this->m_proj_parm.n);
|
||||
this->m_proj_parm.n = sqrt(this->m_proj_parm.r);
|
||||
this->m_proj_parm.r *= (1. - this->m_par.es) * this->m_proj_parm.n;
|
||||
this->m_proj_parm.dd = xy_x / this->m_proj_parm.n;
|
||||
this->m_proj_parm.d2 = this->m_proj_parm.dd * this->m_proj_parm.dd;
|
||||
lp_lat = ph1 - (this->m_proj_parm.n * this->m_proj_parm.tn / this->m_proj_parm.r) * this->m_proj_parm.d2 *
|
||||
(.5 - (1. + 3. * this->m_proj_parm.t) * this->m_proj_parm.d2 * C3);
|
||||
lp_lon = this->m_proj_parm.dd * (1. + this->m_proj_parm.t * this->m_proj_parm.d2 *
|
||||
(-C4 + (1. + 3. * this->m_proj_parm.t) * this->m_proj_parm.d2 * C5)) / cos(ph1);
|
||||
double tn = tan(ph1); double t = tn * tn;
|
||||
double n = sin(ph1);
|
||||
double r = 1. / (1. - this->m_par.es * n * n);
|
||||
n = sqrt(r);
|
||||
r *= (1. - this->m_par.es) * n;
|
||||
double dd = xy_x / n;
|
||||
double d2 = dd * dd;
|
||||
lp_lat = ph1 - (n * tn / r) * d2 *
|
||||
(.5 - (1. + 3. * t) * d2 * C3);
|
||||
lp_lon = dd * (1. + t * d2 *
|
||||
(-C4 + (1. + 3. * t) * d2 * C5)) / cos(ph1);
|
||||
}
|
||||
};
|
||||
|
||||
@@ -131,7 +124,7 @@ namespace boost { namespace geometry { namespace projections
|
||||
typedef double geographic_type;
|
||||
typedef double cartesian_type;
|
||||
|
||||
mutable par_cass m_proj_parm;
|
||||
par_cass m_proj_parm;
|
||||
|
||||
inline base_cass_spheroid(const Parameters& par)
|
||||
: base_t_fi<base_cass_spheroid<Geographic, Cartesian, Parameters>,
|
||||
@@ -145,8 +138,9 @@ 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
|
||||
{
|
||||
lp_lat = asin(sin(this->m_proj_parm.dd = xy_y + this->m_par.phi0) * cos(xy_x));
|
||||
lp_lon = atan2(tan(xy_x), cos(this->m_proj_parm.dd));
|
||||
double dd = xy_y + this->m_par.phi0;
|
||||
lp_lat = asin(sin(dd) * cos(xy_x));
|
||||
lp_lon = atan2(tan(xy_x), cos(dd));
|
||||
}
|
||||
};
|
||||
|
||||
@@ -155,13 +149,9 @@ 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;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -38,8 +38,6 @@
|
||||
// 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>
|
||||
@@ -48,7 +46,9 @@
|
||||
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
|
||||
@@ -90,8 +90,6 @@ 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
|
||||
|
||||
@@ -38,19 +38,19 @@
|
||||
// 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
|
||||
@@ -127,6 +127,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);
|
||||
@@ -134,13 +135,9 @@ 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;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -157,7 +154,8 @@ namespace boost { namespace geometry { namespace projections
|
||||
- Cylindrical
|
||||
- Spheroid
|
||||
- Ellipsoid
|
||||
- lat_ts=
|
||||
\par Projection parameters
|
||||
- lat_ts: Latitude of true scale (degrees)
|
||||
\par Example
|
||||
\image html ex_cea.gif
|
||||
*/
|
||||
@@ -180,7 +178,8 @@ namespace boost { namespace geometry { namespace projections
|
||||
- Cylindrical
|
||||
- Spheroid
|
||||
- Ellipsoid
|
||||
- lat_ts=
|
||||
\par Projection parameters
|
||||
- lat_ts: Latitude of true scale (degrees)
|
||||
\par Example
|
||||
\image html ex_cea.gif
|
||||
*/
|
||||
|
||||
@@ -40,8 +40,6 @@
|
||||
|
||||
#include <cstdio>
|
||||
|
||||
#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>
|
||||
@@ -51,12 +49,15 @@
|
||||
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
|
||||
{
|
||||
@@ -64,13 +65,14 @@ 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 */
|
||||
|
||||
static 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;
|
||||
@@ -89,7 +91,7 @@ namespace boost { namespace geometry { namespace projections
|
||||
v.r = v.Az = 0.;
|
||||
return v;
|
||||
}
|
||||
inline double /* law of cosines */
|
||||
static double /* law of cosines */
|
||||
lc(double b,double c,double a) {
|
||||
return aacos(.5 * (b * b + c * c - a * a) / (b * c));
|
||||
}
|
||||
@@ -158,9 +160,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);
|
||||
@@ -169,9 +170,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);
|
||||
@@ -186,7 +185,6 @@ 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
|
||||
@@ -202,7 +200,13 @@ namespace boost { namespace geometry { namespace projections
|
||||
- Miscellaneous
|
||||
- Spheroid
|
||||
- no inverse
|
||||
- lat_1= lon_1= lat_2= lon_2= lat_3= lon_3=
|
||||
\par Projection parameters
|
||||
- lat_1: Latitude of control point 1 (degrees)
|
||||
- lon_1: Longitude of control point 1 (degrees)
|
||||
- lat_2: Latitude of control point 2 (degrees)
|
||||
- lon_2: Longitude of control point 2 (degrees)
|
||||
- lat_3: Latitude of control point 3 (degrees)
|
||||
- lon_3: Longitude of control point 3 (degrees)
|
||||
\par Example
|
||||
\image html ex_chamb.gif
|
||||
*/
|
||||
|
||||
@@ -38,8 +38,6 @@
|
||||
// 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>
|
||||
@@ -48,12 +46,13 @@
|
||||
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>,
|
||||
@@ -97,8 +96,6 @@ 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
|
||||
|
||||
@@ -38,8 +38,6 @@
|
||||
// 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>
|
||||
@@ -48,14 +46,15 @@
|
||||
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>,
|
||||
@@ -89,8 +88,6 @@ 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
|
||||
|
||||
@@ -38,8 +38,6 @@
|
||||
// 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>
|
||||
@@ -48,14 +46,15 @@
|
||||
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>,
|
||||
@@ -85,7 +84,6 @@ namespace boost { namespace geometry { namespace projections
|
||||
void setup_denoy(Parameters& par)
|
||||
{
|
||||
par.es = 0.;
|
||||
// par.fwd = s_forward;
|
||||
}
|
||||
|
||||
}} // namespace detail::denoy
|
||||
|
||||
@@ -38,8 +38,6 @@
|
||||
// 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>
|
||||
@@ -48,11 +46,12 @@
|
||||
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>,
|
||||
@@ -85,8 +84,6 @@ 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
|
||||
|
||||
@@ -38,8 +38,6 @@
|
||||
// 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>
|
||||
@@ -48,13 +46,14 @@
|
||||
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>,
|
||||
@@ -96,8 +95,6 @@ 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
|
||||
|
||||
@@ -39,7 +39,6 @@
|
||||
|
||||
|
||||
#include <boost/core/ignore_unused.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>
|
||||
@@ -49,7 +48,8 @@
|
||||
namespace boost { namespace geometry { namespace projections
|
||||
{
|
||||
#ifndef DOXYGEN_NO_DETAIL
|
||||
namespace detail { namespace eck3{
|
||||
namespace detail { namespace eck3
|
||||
{
|
||||
|
||||
struct par_eck3
|
||||
{
|
||||
@@ -87,11 +87,8 @@ namespace boost { namespace geometry { namespace projections
|
||||
template <typename Parameters>
|
||||
void setup(Parameters& par, par_eck3& proj_parm)
|
||||
{
|
||||
boost::ignore_unused(par);
|
||||
boost::ignore_unused(proj_parm);
|
||||
par.es = 0.;
|
||||
// par.inv = s_inverse;
|
||||
// par.fwd = s_forward;
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -38,17 +38,18 @@
|
||||
// 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;
|
||||
@@ -57,7 +58,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>,
|
||||
@@ -112,8 +112,6 @@ 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
|
||||
|
||||
@@ -38,8 +38,6 @@
|
||||
// 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>
|
||||
@@ -48,13 +46,14 @@
|
||||
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>,
|
||||
@@ -86,8 +85,6 @@ 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
|
||||
|
||||
@@ -38,8 +38,6 @@
|
||||
// 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>
|
||||
@@ -48,7 +46,8 @@
|
||||
namespace boost { namespace geometry { namespace projections
|
||||
{
|
||||
#ifndef DOXYGEN_NO_DETAIL
|
||||
namespace detail { namespace eqc{
|
||||
namespace detail { namespace eqc
|
||||
{
|
||||
|
||||
struct par_eqc
|
||||
{
|
||||
@@ -88,8 +87,6 @@ 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.;
|
||||
}
|
||||
|
||||
@@ -105,8 +102,9 @@ namespace boost { namespace geometry { namespace projections
|
||||
\par Projection characteristics
|
||||
- Cylindrical
|
||||
- Spheroid
|
||||
- lat_ts=[
|
||||
- lat_0=0]
|
||||
\par Projection parameters
|
||||
- lat_ts: Latitude of true scale (degrees)
|
||||
- lat_0: Latitude of origin
|
||||
\par Example
|
||||
\image html ex_eqc.gif
|
||||
*/
|
||||
|
||||
@@ -44,13 +44,15 @@
|
||||
#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
|
||||
@@ -58,7 +60,6 @@ namespace boost { namespace geometry { namespace projections
|
||||
double phi1;
|
||||
double phi2;
|
||||
double n;
|
||||
double rho;
|
||||
double rho0;
|
||||
double c;
|
||||
double en[EN_SIZE];
|
||||
@@ -74,7 +75,7 @@ namespace boost { namespace geometry { namespace projections
|
||||
typedef double geographic_type;
|
||||
typedef double cartesian_type;
|
||||
|
||||
mutable par_eqdc m_proj_parm;
|
||||
par_eqdc m_proj_parm;
|
||||
|
||||
inline base_eqdc_ellipsoid(const Parameters& par)
|
||||
: base_t_fi<base_eqdc_ellipsoid<Geographic, Cartesian, Parameters>,
|
||||
@@ -82,21 +83,23 @@ 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
|
||||
{
|
||||
this->m_proj_parm.rho = this->m_proj_parm.c - (this->m_proj_parm.ellips ? pj_mlfn(lp_lat, sin(lp_lat),
|
||||
double rho = 0.0;
|
||||
rho = this->m_proj_parm.c - (this->m_proj_parm.ellips ? pj_mlfn(lp_lat, sin(lp_lat),
|
||||
cos(lp_lat), this->m_proj_parm.en) : lp_lat);
|
||||
xy_x = this->m_proj_parm.rho * sin( lp_lon *= this->m_proj_parm.n );
|
||||
xy_y = this->m_proj_parm.rho0 - this->m_proj_parm.rho * cos(lp_lon);
|
||||
xy_x = rho * sin( lp_lon *= this->m_proj_parm.n );
|
||||
xy_y = this->m_proj_parm.rho0 - rho * cos(lp_lon);
|
||||
}
|
||||
|
||||
inline void inv(cartesian_type& xy_x, cartesian_type& xy_y, geographic_type& lp_lon, geographic_type& lp_lat) const
|
||||
{
|
||||
if ((this->m_proj_parm.rho = boost::math::hypot(xy_x, xy_y = this->m_proj_parm.rho0 - xy_y)) != 0.0 ) {
|
||||
double rho = 0.0;
|
||||
if ((rho = boost::math::hypot(xy_x, xy_y = this->m_proj_parm.rho0 - xy_y)) != 0.0 ) {
|
||||
if (this->m_proj_parm.n < 0.) {
|
||||
this->m_proj_parm.rho = -this->m_proj_parm.rho;
|
||||
rho = -rho;
|
||||
xy_x = -xy_x;
|
||||
xy_y = -xy_y;
|
||||
}
|
||||
lp_lat = this->m_proj_parm.c - this->m_proj_parm.rho;
|
||||
lp_lat = this->m_proj_parm.c - rho;
|
||||
if (this->m_proj_parm.ellips)
|
||||
lp_lat = pj_inv_mlfn(lp_lat, this->m_par.es, this->m_proj_parm.en);
|
||||
lp_lon = atan2(xy_x, xy_y) / this->m_proj_parm.n;
|
||||
@@ -127,16 +130,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 */
|
||||
@@ -154,9 +159,6 @@ 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
|
||||
@@ -172,7 +174,9 @@ namespace boost { namespace geometry { namespace projections
|
||||
- Conic
|
||||
- Spheroid
|
||||
- Ellipsoid
|
||||
- lat_1= lat_2=
|
||||
\par Projection parameters
|
||||
- lat_1: Latitude of first standard parallel (degrees)
|
||||
- lat_2: Latitude of second standard parallel (degrees)
|
||||
\par Example
|
||||
\image html ex_eqdc.gif
|
||||
*/
|
||||
|
||||
@@ -0,0 +1,359 @@
|
||||
#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
|
||||
*/
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
static 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;
|
||||
}
|
||||
|
||||
static double
|
||||
asinhy(double x) { /* Compute asinh(x) accurately */
|
||||
double y = fabs(x); /* Enforce odd parity */
|
||||
y = log1py(y * (1 + y/(boost::math::hypot(1.0, y) + 1)));
|
||||
return x < 0 ? -y : y;
|
||||
}
|
||||
|
||||
static 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));
|
||||
}
|
||||
|
||||
static 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);
|
||||
}
|
||||
static 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
|
||||
\par Projection parameters
|
||||
- lat_ts: Latitude of true scale
|
||||
- lat_0: Latitude of origin
|
||||
\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
|
||||
|
||||
@@ -38,8 +38,6 @@
|
||||
// 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>
|
||||
@@ -48,9 +46,10 @@
|
||||
namespace boost { namespace geometry { namespace projections
|
||||
{
|
||||
#ifndef DOXYGEN_NO_DETAIL
|
||||
namespace detail { namespace fahey{
|
||||
static const double TOL = 1e-6;
|
||||
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>
|
||||
@@ -85,8 +84,6 @@ 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
|
||||
|
||||
@@ -38,17 +38,18 @@
|
||||
// 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;
|
||||
|
||||
@@ -112,8 +113,6 @@ 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
|
||||
@@ -128,6 +127,8 @@ namespace boost { namespace geometry { namespace projections
|
||||
\par Projection characteristics
|
||||
- Pseudocylindrical
|
||||
- Spheroid
|
||||
\par Projection parameters
|
||||
- n (real)
|
||||
\par Example
|
||||
\image html ex_fouc_s.gif
|
||||
*/
|
||||
|
||||
@@ -38,8 +38,6 @@
|
||||
// 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>
|
||||
@@ -48,13 +46,14 @@
|
||||
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>,
|
||||
@@ -87,8 +86,6 @@ 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
|
||||
|
||||
@@ -38,8 +38,6 @@
|
||||
// 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>
|
||||
@@ -48,12 +46,8 @@
|
||||
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>
|
||||
@@ -89,8 +83,6 @@ namespace boost { namespace geometry { namespace projections
|
||||
par.is_geocent = 1;
|
||||
par.x0 = 0.0;
|
||||
par.y0 = 0.0;
|
||||
// par.inv = inverse;
|
||||
// par.fwd = forward;
|
||||
}
|
||||
|
||||
}} // namespace detail::geocent
|
||||
@@ -102,7 +94,6 @@ namespace boost { namespace geometry { namespace projections
|
||||
\tparam Geographic latlong point type
|
||||
\tparam Cartesian xy point type
|
||||
\tparam Parameters parameter type
|
||||
\par Projection characteristics
|
||||
\par Example
|
||||
\image html ex_geocent.gif
|
||||
*/
|
||||
|
||||
@@ -48,7 +48,8 @@
|
||||
namespace boost { namespace geometry { namespace projections
|
||||
{
|
||||
#ifndef DOXYGEN_NO_DETAIL
|
||||
namespace detail { namespace geos{
|
||||
namespace detail { namespace geos
|
||||
{
|
||||
|
||||
struct par_geos
|
||||
{
|
||||
@@ -63,8 +64,6 @@ namespace boost { namespace geometry { namespace projections
|
||||
int flip_axis;
|
||||
};
|
||||
|
||||
|
||||
|
||||
// template class, using CRTP to implement forward/inverse
|
||||
template <typename Geographic, typename Cartesian, typename Parameters>
|
||||
struct base_geos_ellipsoid : public base_t_fi<base_geos_ellipsoid<Geographic, Cartesian, Parameters>,
|
||||
@@ -241,12 +240,8 @@ 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;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -263,7 +258,9 @@ namespace boost { namespace geometry { namespace projections
|
||||
- Azimuthal
|
||||
- Spheroid
|
||||
- Ellipsoid
|
||||
- h=
|
||||
\par Projection parameters
|
||||
- h: Height (real)
|
||||
- sweep: Sweep axis ('x' or 'y') (string)
|
||||
\par Example
|
||||
\image html ex_geos.gif
|
||||
*/
|
||||
@@ -286,7 +283,9 @@ namespace boost { namespace geometry { namespace projections
|
||||
- Azimuthal
|
||||
- Spheroid
|
||||
- Ellipsoid
|
||||
- h=
|
||||
\par Projection parameters
|
||||
- h: Height (real)
|
||||
- sweep: Sweep axis ('x' or 'y') (string)
|
||||
\par Example
|
||||
\image html ex_geos.gif
|
||||
*/
|
||||
|
||||
@@ -38,8 +38,6 @@
|
||||
// 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>
|
||||
@@ -48,12 +46,13 @@
|
||||
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>,
|
||||
@@ -84,8 +83,6 @@ namespace boost { namespace geometry { namespace projections
|
||||
void setup_gins8(Parameters& par)
|
||||
{
|
||||
par.es = 0.;
|
||||
// par.inv = 0;
|
||||
// par.fwd = s_forward;
|
||||
}
|
||||
|
||||
}} // namespace detail::gins8
|
||||
|
||||
@@ -38,19 +38,19 @@
|
||||
// DEALINGS IN THE SOFTWARE.
|
||||
|
||||
|
||||
#include <boost/core/ignore_unused.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;
|
||||
@@ -60,6 +60,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
|
||||
@@ -95,7 +96,6 @@ namespace boost { namespace geometry { namespace projections
|
||||
} else if ((s - EPS10) < HALFPI)
|
||||
lp_lon = 0.;
|
||||
else throw proj_exception();;
|
||||
return;
|
||||
}
|
||||
/* General spherical sinusoidals */
|
||||
};
|
||||
@@ -149,12 +149,8 @@ namespace boost { namespace geometry { namespace projections
|
||||
template <typename Parameters>
|
||||
void setup(Parameters& par, par_gn_sinu& proj_parm)
|
||||
{
|
||||
boost::ignore_unused(par);
|
||||
boost::ignore_unused(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;
|
||||
}
|
||||
|
||||
|
||||
@@ -174,11 +170,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.;
|
||||
@@ -207,6 +201,30 @@ namespace boost { namespace geometry { namespace projections
|
||||
}} // namespace detail::gn_sinu
|
||||
#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
|
||||
\par Projection parameters
|
||||
- m (real)
|
||||
- n (real)
|
||||
\par Example
|
||||
\image html ex_gn_sinu.gif
|
||||
*/
|
||||
template <typename Geographic, typename Cartesian, typename Parameters = parameters>
|
||||
struct gn_sinu_spheroid : public detail::gn_sinu::base_gn_sinu_spheroid<Geographic, Cartesian, Parameters>
|
||||
{
|
||||
inline gn_sinu_spheroid(const Parameters& par) : detail::gn_sinu::base_gn_sinu_spheroid<Geographic, Cartesian, Parameters>(par)
|
||||
{
|
||||
detail::gn_sinu::setup_gn_sinu(this->m_par, this->m_proj_parm);
|
||||
}
|
||||
};
|
||||
|
||||
/*!
|
||||
\brief Sinusoidal (Sanson-Flamsteed) projection
|
||||
\ingroup projections
|
||||
@@ -229,28 +247,6 @@ namespace boost { namespace geometry { namespace projections
|
||||
}
|
||||
};
|
||||
|
||||
/*!
|
||||
\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_spheroid : public detail::gn_sinu::base_gn_sinu_spheroid<Geographic, Cartesian, Parameters>
|
||||
{
|
||||
inline gn_sinu_spheroid(const Parameters& par) : detail::gn_sinu::base_gn_sinu_spheroid<Geographic, Cartesian, Parameters>(par)
|
||||
{
|
||||
detail::gn_sinu::setup_gn_sinu(this->m_par, this->m_proj_parm);
|
||||
}
|
||||
};
|
||||
|
||||
/*!
|
||||
\brief Sinusoidal (Sanson-Flamsteed) projection
|
||||
\ingroup projections
|
||||
|
||||
@@ -48,7 +48,9 @@
|
||||
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;
|
||||
@@ -171,8 +173,6 @@ 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.;
|
||||
}
|
||||
|
||||
|
||||
@@ -38,19 +38,19 @@
|
||||
// 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;
|
||||
|
||||
@@ -104,8 +104,6 @@ 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
|
||||
|
||||
@@ -38,19 +38,18 @@
|
||||
// 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
|
||||
{
|
||||
@@ -63,7 +62,6 @@ namespace boost { namespace geometry { namespace projections
|
||||
double YS;
|
||||
};
|
||||
|
||||
|
||||
// template class, using CRTP to implement forward/inverse
|
||||
template <typename Geographic, typename Cartesian, typename Parameters>
|
||||
struct base_gstmerc_spheroid : public base_t_fi<base_gstmerc_spheroid<Geographic, Cartesian, Parameters>,
|
||||
@@ -113,14 +111,9 @@ 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
|
||||
@@ -136,7 +129,10 @@ namespace boost { namespace geometry { namespace projections
|
||||
- Cylindrical
|
||||
- Spheroid
|
||||
- Ellipsoid
|
||||
- lat_0= lon_0= k_0=
|
||||
\par Projection parameters
|
||||
- lat_0: Latitude of origin
|
||||
- lon_0: Central meridian
|
||||
- k_0: Scale factor
|
||||
\par Example
|
||||
\image html ex_gstmerc.gif
|
||||
*/
|
||||
|
||||
@@ -38,8 +38,6 @@
|
||||
// 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>
|
||||
@@ -48,7 +46,8 @@
|
||||
namespace boost { namespace geometry { namespace projections
|
||||
{
|
||||
#ifndef DOXYGEN_NO_DETAIL
|
||||
namespace detail { namespace hammer{
|
||||
namespace detail { namespace hammer
|
||||
{
|
||||
|
||||
struct par_hammer
|
||||
{
|
||||
@@ -96,7 +95,6 @@ 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
|
||||
@@ -112,7 +110,9 @@ namespace boost { namespace geometry { namespace projections
|
||||
- Miscellaneous
|
||||
- Spheroid
|
||||
- no inverse
|
||||
- W= M=
|
||||
\par Projection parameters
|
||||
- W (real)
|
||||
- M (real)
|
||||
\par Example
|
||||
\image html ex_hammer.gif
|
||||
*/
|
||||
|
||||
@@ -38,8 +38,6 @@
|
||||
// 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>
|
||||
@@ -48,7 +46,9 @@
|
||||
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;
|
||||
@@ -63,7 +63,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>,
|
||||
@@ -118,8 +117,6 @@ 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
|
||||
|
||||
305
include/boost/geometry/extensions/gis/projections/proj/igh.hpp
Normal file
305
include/boost/geometry/extensions/gis/projections/proj/igh.hpp
Normal file
@@ -0,0 +1,305 @@
|
||||
#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) pj_errno = -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
|
||||
|
||||
@@ -38,8 +38,6 @@
|
||||
// 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>
|
||||
@@ -49,11 +47,13 @@
|
||||
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
|
||||
{
|
||||
@@ -62,8 +62,9 @@ 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
|
||||
static int
|
||||
phi12(Parameters& par, par_imw_p& proj_parm, double *del, double *sig) {
|
||||
int err = 0;
|
||||
|
||||
@@ -80,9 +81,9 @@ 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;
|
||||
static 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;
|
||||
@@ -127,10 +128,9 @@ 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) {
|
||||
static 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);
|
||||
@@ -140,7 +140,6 @@ namespace boost { namespace geometry { namespace projections
|
||||
*x = *R * sin(F);
|
||||
}
|
||||
|
||||
|
||||
// template class, using CRTP to implement forward/inverse
|
||||
template <typename Geographic, typename Cartesian, typename Parameters>
|
||||
struct base_imw_p_ellipsoid : public base_t_fi<base_imw_p_ellipsoid<Geographic, Cartesian, Parameters>,
|
||||
@@ -159,13 +158,13 @@ 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;
|
||||
@@ -184,7 +183,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 */
|
||||
@@ -225,8 +225,6 @@ 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
|
||||
@@ -239,9 +237,12 @@ namespace boost { namespace geometry { namespace projections
|
||||
\tparam Cartesian xy point type
|
||||
\tparam Parameters parameter type
|
||||
\par Projection characteristics
|
||||
- Mod Polyconic
|
||||
- Mod. Polyconic
|
||||
- Ellipsoid
|
||||
- lat_1= and lat_2= [lon_1=]
|
||||
\par Projection parameters
|
||||
- lat_1: Latitude of first standard parallel
|
||||
- lat_2: Latitude of second standard parallel
|
||||
- lon_1 (degrees)
|
||||
\par Example
|
||||
\image html ex_imw_p.gif
|
||||
*/
|
||||
|
||||
1169
include/boost/geometry/extensions/gis/projections/proj/isea.hpp
Normal file
1169
include/boost/geometry/extensions/gis/projections/proj/isea.hpp
Normal file
File diff suppressed because it is too large
Load Diff
@@ -38,8 +38,6 @@
|
||||
// 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>
|
||||
@@ -48,17 +46,14 @@
|
||||
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
|
||||
@@ -82,9 +77,6 @@ namespace boost { namespace geometry { namespace projections
|
||||
|
||||
**/
|
||||
|
||||
|
||||
|
||||
|
||||
// template class, using CRTP to implement forward/inverse
|
||||
template <typename Geographic, typename Cartesian, typename Parameters>
|
||||
struct base_krovak_ellipsoid : public base_t_fi<base_krovak_ellipsoid<Geographic, Cartesian, Parameters>,
|
||||
@@ -161,13 +153,8 @@ namespace boost { namespace geometry { namespace projections
|
||||
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 */
|
||||
@@ -247,10 +234,7 @@ namespace boost { namespace geometry { namespace projections
|
||||
while (ok==0);
|
||||
|
||||
lp_lon -= this->m_par.lam0;
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
// Krovak
|
||||
@@ -260,25 +244,29 @@ 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
|
||||
@@ -292,7 +280,12 @@ namespace boost { namespace geometry { namespace projections
|
||||
\tparam Parameters parameter type
|
||||
\par Projection characteristics
|
||||
- Pseudocylindrical
|
||||
- Ellps
|
||||
- Ellipsoid
|
||||
\par Projection parameters
|
||||
- lat_ts: Latitude of true scale (degrees)
|
||||
- lat_0: Latitude of origin
|
||||
- lon_0: Central meridian
|
||||
- k: Scale factor on the pseudo standard parallel
|
||||
\par Example
|
||||
\image html ex_krovak.gif
|
||||
*/
|
||||
|
||||
@@ -38,8 +38,6 @@
|
||||
// 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>
|
||||
@@ -48,7 +46,9 @@
|
||||
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
|
||||
@@ -157,6 +157,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);
|
||||
@@ -175,8 +176,6 @@ 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
|
||||
@@ -192,6 +191,9 @@ namespace boost { namespace geometry { namespace projections
|
||||
- Cylindrical
|
||||
- Spheroid
|
||||
- Special for Madagascar
|
||||
\par Projection parameters
|
||||
- no_rot: No rotation (boolean)
|
||||
- azi: Azimuth (or Gamma) (degrees)
|
||||
\par Example
|
||||
\image html ex_labrd.gif
|
||||
*/
|
||||
|
||||
@@ -44,13 +44,15 @@
|
||||
#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;
|
||||
@@ -269,6 +271,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)
|
||||
@@ -277,6 +280,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);
|
||||
@@ -302,15 +306,11 @@ 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;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -38,8 +38,6 @@
|
||||
// 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>
|
||||
@@ -48,7 +46,9 @@
|
||||
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
|
||||
@@ -96,13 +96,13 @@ 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
|
||||
@@ -118,7 +118,9 @@ namespace boost { namespace geometry { namespace projections
|
||||
- Miscellaneous
|
||||
- Spheroid
|
||||
- no inverse
|
||||
- W=
|
||||
\par Projection parameters
|
||||
- W (real)
|
||||
- lat_1: Latitude of first standard parallel (degrees)
|
||||
\par Example
|
||||
\image html ex_lagrng.gif
|
||||
*/
|
||||
|
||||
@@ -38,8 +38,6 @@
|
||||
// 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>
|
||||
@@ -48,9 +46,10 @@
|
||||
namespace boost { namespace geometry { namespace projections
|
||||
{
|
||||
#ifndef DOXYGEN_NO_DETAIL
|
||||
namespace detail { namespace larr{
|
||||
static const double SIXTH = .16666666666666666;
|
||||
namespace detail { namespace larr
|
||||
{
|
||||
|
||||
static const double SIXTH = .16666666666666666;
|
||||
|
||||
// template class, using CRTP to implement forward/inverse
|
||||
template <typename Geographic, typename Cartesian, typename Parameters>
|
||||
@@ -77,8 +76,6 @@ namespace boost { namespace geometry { namespace projections
|
||||
template <typename Parameters>
|
||||
void setup_larr(Parameters& par)
|
||||
{
|
||||
// par.fwd = s_forward;
|
||||
// par.inv = 0;
|
||||
par.es = 0.;
|
||||
}
|
||||
|
||||
|
||||
@@ -38,8 +38,6 @@
|
||||
// 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>
|
||||
@@ -48,7 +46,9 @@
|
||||
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;
|
||||
@@ -60,7 +60,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>,
|
||||
@@ -91,8 +90,6 @@ namespace boost { namespace geometry { namespace projections
|
||||
template <typename Parameters>
|
||||
void setup_lask(Parameters& par)
|
||||
{
|
||||
// par.fwd = s_forward;
|
||||
// par.inv = 0;
|
||||
par.es = 0.;
|
||||
}
|
||||
|
||||
|
||||
@@ -38,8 +38,6 @@
|
||||
// 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>
|
||||
@@ -50,12 +48,11 @@
|
||||
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>
|
||||
struct base_latlong_other : public base_t_fi<base_latlong_other<Geographic, Cartesian, Parameters>,
|
||||
@@ -72,14 +69,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;
|
||||
}
|
||||
@@ -92,8 +87,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)
|
||||
@@ -103,8 +96,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)
|
||||
@@ -114,8 +105,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)
|
||||
@@ -125,8 +114,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;
|
||||
}
|
||||
|
||||
}} // namespace detail::latlong
|
||||
@@ -138,7 +125,6 @@ namespace boost { namespace geometry { namespace projections
|
||||
\tparam Geographic latlong point type
|
||||
\tparam Cartesian xy point type
|
||||
\tparam Parameters parameter type
|
||||
\par Projection characteristics
|
||||
\par Example
|
||||
\image html ex_lonlat.gif
|
||||
*/
|
||||
@@ -157,7 +143,6 @@ namespace boost { namespace geometry { namespace projections
|
||||
\tparam Geographic latlong point type
|
||||
\tparam Cartesian xy point type
|
||||
\tparam Parameters parameter type
|
||||
\par Projection characteristics
|
||||
\par Example
|
||||
\image html ex_latlon.gif
|
||||
*/
|
||||
@@ -176,7 +161,6 @@ namespace boost { namespace geometry { namespace projections
|
||||
\tparam Geographic latlong point type
|
||||
\tparam Cartesian xy point type
|
||||
\tparam Parameters parameter type
|
||||
\par Projection characteristics
|
||||
\par Example
|
||||
\image html ex_latlong.gif
|
||||
*/
|
||||
@@ -195,7 +179,6 @@ namespace boost { namespace geometry { namespace projections
|
||||
\tparam Geographic latlong point type
|
||||
\tparam Cartesian xy point type
|
||||
\tparam Parameters parameter type
|
||||
\par Projection characteristics
|
||||
\par Example
|
||||
\image html ex_longlat.gif
|
||||
*/
|
||||
|
||||
@@ -45,15 +45,17 @@
|
||||
#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_tsfn.hpp>
|
||||
#include <boost/geometry/extensions/gis/projections/impl/pj_phi2.hpp>
|
||||
#include <boost/geometry/extensions/gis/projections/impl/pj_tsfn.hpp>
|
||||
|
||||
#include <boost/geometry/extensions/gis/projections/epsg_traits.hpp>
|
||||
|
||||
namespace boost { namespace geometry { namespace projections
|
||||
{
|
||||
#ifndef DOXYGEN_NO_DETAIL
|
||||
namespace detail { namespace lcc{
|
||||
namespace detail { namespace lcc
|
||||
{
|
||||
|
||||
static const double EPS10 = 1.e-10;
|
||||
|
||||
struct par_lcc
|
||||
@@ -75,7 +77,7 @@ namespace boost { namespace geometry { namespace projections
|
||||
typedef double geographic_type;
|
||||
typedef double cartesian_type;
|
||||
|
||||
mutable par_lcc m_proj_parm;
|
||||
par_lcc m_proj_parm;
|
||||
|
||||
inline base_lcc_ellipsoid(const Parameters& par)
|
||||
: base_t_fi<base_lcc_ellipsoid<Geographic, Cartesian, Parameters>,
|
||||
@@ -143,6 +145,7 @@ namespace boost { namespace geometry { namespace projections
|
||||
{
|
||||
double cosphi, sinphi;
|
||||
int secant;
|
||||
|
||||
proj_parm.phi1 = pj_param(par.params, "rlat_1").f;
|
||||
if (pj_param(par.params, "tlat_2").i)
|
||||
proj_parm.phi2 = pj_param(par.params, "rlat_2").f;
|
||||
@@ -157,6 +160,7 @@ namespace boost { namespace geometry { namespace projections
|
||||
secant = fabs(proj_parm.phi1 - proj_parm.phi2) >= EPS10;
|
||||
if( (proj_parm.ellips = (par.es != 0.)) ) {
|
||||
double ml1, m1;
|
||||
|
||||
par.e = sqrt(par.es);
|
||||
m1 = pj_msfn(sinphi, cosphi, par.es);
|
||||
ml1 = pj_tsfn(proj_parm.phi1, sinphi, par.e);
|
||||
@@ -177,9 +181,6 @@ namespace boost { namespace geometry { namespace projections
|
||||
proj_parm.rho0 = (fabs(fabs(par.phi0) - HALFPI) < EPS10) ? 0. :
|
||||
proj_parm.c * pow(tan(FORTPI + .5 * par.phi0), -proj_parm.n);
|
||||
}
|
||||
// par.inv = e_inverse;
|
||||
// par.fwd = e_forward;
|
||||
// par.spc = fac;
|
||||
}
|
||||
|
||||
}} // namespace detail::lcc
|
||||
@@ -195,7 +196,10 @@ namespace boost { namespace geometry { namespace projections
|
||||
- Conic
|
||||
- Spheroid
|
||||
- Ellipsoid
|
||||
- lat_1= and lat_2= or lat_0
|
||||
\par Projection parameters
|
||||
- lat_1: Latitude of first standard parallel (degrees)
|
||||
- lat_2: Latitude of second standard parallel (degrees)
|
||||
- lat_0: Latitude of origin
|
||||
\par Example
|
||||
\image html ex_lcc.gif
|
||||
*/
|
||||
|
||||
@@ -38,7 +38,7 @@
|
||||
// DEALINGS IN THE SOFTWARE.
|
||||
|
||||
|
||||
#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>
|
||||
@@ -49,7 +49,9 @@
|
||||
namespace boost { namespace geometry { namespace projections
|
||||
{
|
||||
#ifndef DOXYGEN_NO_DETAIL
|
||||
namespace detail { namespace lcca{
|
||||
namespace detail { namespace lcca
|
||||
{
|
||||
|
||||
static const int MAX_ITER = 10;
|
||||
static const double DEL_TOL = 1e-12;
|
||||
|
||||
@@ -60,12 +62,11 @@ namespace boost { namespace geometry { namespace projections
|
||||
double C;
|
||||
};
|
||||
|
||||
|
||||
inline double /* func to compute dr */
|
||||
static double /* func to compute dr */
|
||||
fS(double S, double C) {
|
||||
return(S * ( 1. + S * S * C));
|
||||
}
|
||||
inline double /* deriv of fs */
|
||||
static double /* deriv of fs */
|
||||
fSp(double S, double C) {
|
||||
return(1. + 3.* S * S * C);
|
||||
}
|
||||
@@ -114,6 +115,13 @@ namespace boost { namespace geometry { namespace projections
|
||||
if (!i) throw proj_exception();
|
||||
lp_lat = pj_inv_mlfn(S + this->m_proj_parm.M0, this->m_par.es, this->m_proj_parm.en);
|
||||
}
|
||||
|
||||
private :
|
||||
inline void ignore_unused()
|
||||
{
|
||||
boost::ignore_unused(fSp);
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
// Lambert Conformal Conic Alternative
|
||||
@@ -121,8 +129,8 @@ namespace boost { namespace geometry { namespace projections
|
||||
void setup_lcca(Parameters& par, par_lcca& proj_parm)
|
||||
{
|
||||
double s2p0, N0, R0, tan0, tan20;
|
||||
boost::ignore_unused(tan20);
|
||||
pj_enfn(par.es, proj_parm.en);
|
||||
|
||||
if (!pj_enfn(par.es, proj_parm.en)) throw proj_exception(0);
|
||||
if (!pj_param(par.params, "tlat_0").i) throw proj_exception(50);
|
||||
if (par.phi0 == 0.) throw proj_exception(51);
|
||||
proj_parm.l = sin(par.phi0);
|
||||
@@ -135,8 +143,7 @@ namespace boost { namespace geometry { namespace projections
|
||||
tan20 = tan0 * tan0;
|
||||
proj_parm.r0 = N0 / tan0;
|
||||
proj_parm.C = 1. / (6. * R0 * N0);
|
||||
// par.inv = e_inverse;
|
||||
// par.fwd = e_forward;
|
||||
boost::ignore_unused(tan20);
|
||||
}
|
||||
|
||||
}} // namespace detail::lcca
|
||||
@@ -152,7 +159,8 @@ namespace boost { namespace geometry { namespace projections
|
||||
- Conic
|
||||
- Spheroid
|
||||
- Ellipsoid
|
||||
- lat_0=
|
||||
\par Projection parameters
|
||||
- lat_0: Latitude of origin
|
||||
\par Example
|
||||
\image html ex_lcca.gif
|
||||
*/
|
||||
|
||||
@@ -38,8 +38,6 @@
|
||||
// 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>
|
||||
@@ -48,7 +46,9 @@
|
||||
namespace boost { namespace geometry { namespace projections
|
||||
{
|
||||
#ifndef DOXYGEN_NO_DETAIL
|
||||
namespace detail { namespace loxim{
|
||||
namespace detail { namespace loxim
|
||||
{
|
||||
|
||||
static const double EPS = 1e-8;
|
||||
|
||||
struct par_loxim
|
||||
@@ -108,8 +108,6 @@ namespace boost { namespace geometry { namespace projections
|
||||
proj_parm.phi1 = pj_param(par.params, "rlat_1").f;
|
||||
if ((proj_parm.cosphi1 = cos(proj_parm.phi1)) < EPS) throw proj_exception(-22);
|
||||
proj_parm.tanphi1 = tan(FORTPI + 0.5 * proj_parm.phi1);
|
||||
// par.inv = s_inverse;
|
||||
// par.fwd = s_forward;
|
||||
par.es = 0.;
|
||||
}
|
||||
|
||||
@@ -125,6 +123,8 @@ namespace boost { namespace geometry { namespace projections
|
||||
\par Projection characteristics
|
||||
- Pseudocylindrical
|
||||
- Spheroid
|
||||
\par Projection parameters
|
||||
- lat_1: Latitude of first standard parallel (degrees)
|
||||
\par Example
|
||||
\image html ex_loxim.gif
|
||||
*/
|
||||
|
||||
@@ -38,17 +38,18 @@
|
||||
// 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 lsat{
|
||||
namespace detail { namespace lsat
|
||||
{
|
||||
|
||||
static const double TOL = 1e-7;
|
||||
static const double PI_HALFPI = 4.71238898038468985766;
|
||||
static const double TWOPI_HALFPI = 7.85398163397448309610;
|
||||
@@ -58,9 +59,10 @@ namespace boost { namespace geometry { namespace projections
|
||||
double a2, a4, b, c1, c3;
|
||||
double q, t, u, w, p22, sa, ca, xj, rlm, rlm2;
|
||||
};
|
||||
|
||||
/* based upon Snyder and Linck, USGS-NMD */
|
||||
template <typename Parameters>
|
||||
inline void
|
||||
static void
|
||||
seraz0(double lam, double mult, Parameters& par, par_lsat& proj_parm) {
|
||||
double sdsq, h, s, fc, sd, sq, d__1;
|
||||
|
||||
@@ -198,6 +200,7 @@ namespace boost { namespace geometry { namespace projections
|
||||
{
|
||||
int land, path;
|
||||
double lam, alf, esc, ess;
|
||||
|
||||
land = pj_param(par.params, "ilsat").i;
|
||||
if (land <= 0 || land > 5) throw proj_exception(-28);
|
||||
path = pj_param(par.params, "ipath").i;
|
||||
@@ -228,13 +231,9 @@ namespace boost { namespace geometry { namespace projections
|
||||
proj_parm.rlm2 = proj_parm.rlm + TWOPI;
|
||||
proj_parm.a2 = proj_parm.a4 = proj_parm.b = proj_parm.c1 = proj_parm.c3 = 0.;
|
||||
seraz0(0., 1., par, proj_parm);
|
||||
for (lam = 9.;
|
||||
lam <= 81.0001;
|
||||
lam += 18.)
|
||||
for (lam = 9.; lam <= 81.0001; lam += 18.)
|
||||
seraz0(lam, 4., par, proj_parm);
|
||||
for (lam = 18;
|
||||
lam <= 72.0001;
|
||||
lam += 18.)
|
||||
for (lam = 18; lam <= 72.0001; lam += 18.)
|
||||
seraz0(lam, 2., par, proj_parm);
|
||||
seraz0(90., 1., par, proj_parm);
|
||||
proj_parm.a2 /= 30.;
|
||||
@@ -242,8 +241,6 @@ namespace boost { namespace geometry { namespace projections
|
||||
proj_parm.b /= 30.;
|
||||
proj_parm.c1 /= 15.;
|
||||
proj_parm.c3 /= 45.;
|
||||
// par.inv = e_inverse;
|
||||
// par.fwd = e_forward;
|
||||
}
|
||||
|
||||
}} // namespace detail::lsat
|
||||
@@ -259,7 +256,9 @@ namespace boost { namespace geometry { namespace projections
|
||||
- Cylindrical
|
||||
- Spheroid
|
||||
- Ellipsoid
|
||||
- lsat= path=
|
||||
\par Projection parameters
|
||||
- lsat (integer)
|
||||
- path (integer)
|
||||
\par Example
|
||||
\image html ex_lsat.gif
|
||||
*/
|
||||
|
||||
@@ -38,17 +38,18 @@
|
||||
// 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 mbt_fps{
|
||||
namespace detail { namespace mbt_fps
|
||||
{
|
||||
|
||||
static const int MAX_ITER = 10;
|
||||
static const double LOOP_TOL = 1e-7;
|
||||
static const double C1 = 0.45503;
|
||||
@@ -58,7 +59,6 @@ namespace boost { namespace geometry { namespace projections
|
||||
static const double C_y = 1.44492;
|
||||
static const double C1_2 = 0.33333333333333333333333333;
|
||||
|
||||
|
||||
// template class, using CRTP to implement forward/inverse
|
||||
template <typename Geographic, typename Cartesian, typename Parameters>
|
||||
struct base_mbt_fps_spheroid : public base_t_fi<base_mbt_fps_spheroid<Geographic, Cartesian, Parameters>,
|
||||
@@ -106,8 +106,6 @@ namespace boost { namespace geometry { namespace projections
|
||||
void setup_mbt_fps(Parameters& par)
|
||||
{
|
||||
par.es = 0;
|
||||
// par.inv = s_inverse;
|
||||
// par.fwd = s_forward;
|
||||
}
|
||||
|
||||
}} // namespace detail::mbt_fps
|
||||
|
||||
@@ -38,8 +38,6 @@
|
||||
// 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>
|
||||
@@ -48,7 +46,9 @@
|
||||
namespace boost { namespace geometry { namespace projections
|
||||
{
|
||||
#ifndef DOXYGEN_NO_DETAIL
|
||||
namespace detail { namespace mbtfpp{
|
||||
namespace detail { namespace mbtfpp
|
||||
{
|
||||
|
||||
static const double CS_ = .95257934441568037152;
|
||||
static const double FXC = .92582009977255146156;
|
||||
static const double FYC = 3.40168025708304504493;
|
||||
@@ -56,7 +56,6 @@ namespace boost { namespace geometry { namespace projections
|
||||
static const double C13 = .33333333333333333333;
|
||||
static const double ONEEPS = 1.0000001;
|
||||
|
||||
|
||||
// template class, using CRTP to implement forward/inverse
|
||||
template <typename Geographic, typename Cartesian, typename Parameters>
|
||||
struct base_mbtfpp_spheroid : public base_t_fi<base_mbtfpp_spheroid<Geographic, Cartesian, Parameters>,
|
||||
@@ -100,8 +99,6 @@ namespace boost { namespace geometry { namespace projections
|
||||
void setup_mbtfpp(Parameters& par)
|
||||
{
|
||||
par.es = 0.;
|
||||
// par.inv = s_inverse;
|
||||
// par.fwd = s_forward;
|
||||
}
|
||||
|
||||
}} // namespace detail::mbtfpp
|
||||
|
||||
@@ -38,8 +38,6 @@
|
||||
// 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>
|
||||
@@ -48,7 +46,9 @@
|
||||
namespace boost { namespace geometry { namespace projections
|
||||
{
|
||||
#ifndef DOXYGEN_NO_DETAIL
|
||||
namespace detail { namespace mbtfpq{
|
||||
namespace detail { namespace mbtfpq
|
||||
{
|
||||
|
||||
static const int NITER = 20;
|
||||
static const double EPS = 1e-7;
|
||||
static const double ONETOL = 1.000001;
|
||||
@@ -59,7 +59,6 @@ namespace boost { namespace geometry { namespace projections
|
||||
static const double FXC = 0.31245971410378249250;
|
||||
static const double RXC = 3.20041258076506210122;
|
||||
|
||||
|
||||
// template class, using CRTP to implement forward/inverse
|
||||
template <typename Geographic, typename Cartesian, typename Parameters>
|
||||
struct base_mbtfpq_spheroid : public base_t_fi<base_mbtfpq_spheroid<Geographic, Cartesian, Parameters>,
|
||||
@@ -115,8 +114,6 @@ namespace boost { namespace geometry { namespace projections
|
||||
void setup_mbtfpq(Parameters& par)
|
||||
{
|
||||
par.es = 0.;
|
||||
// par.inv = s_inverse;
|
||||
// par.fwd = s_forward;
|
||||
}
|
||||
|
||||
}} // namespace detail::mbtfpq
|
||||
|
||||
@@ -38,22 +38,21 @@
|
||||
// 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_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 merc{
|
||||
static const double EPS10 = 1.e-10;
|
||||
namespace detail { namespace merc
|
||||
{
|
||||
|
||||
static const double EPS10 = 1.e-10;
|
||||
|
||||
// template class, using CRTP to implement forward/inverse
|
||||
template <typename Geographic, typename Cartesian, typename Parameters>
|
||||
@@ -117,6 +116,7 @@ namespace boost { namespace geometry { namespace projections
|
||||
{
|
||||
double phits=0.0;
|
||||
int is_phits;
|
||||
|
||||
if( (is_phits = pj_param(par.params, "tlat_ts").i) ) {
|
||||
phits = fabs(pj_param(par.params, "rlat_ts").f);
|
||||
if (phits >= HALFPI) throw proj_exception(-24);
|
||||
@@ -124,13 +124,9 @@ namespace boost { namespace geometry { namespace projections
|
||||
if (par.es) { /* ellipsoid */
|
||||
if (is_phits)
|
||||
par.k0 = pj_msfn(sin(phits), cos(phits), par.es);
|
||||
// par.inv = e_inverse;
|
||||
// par.fwd = e_forward;
|
||||
} else { /* sphere */
|
||||
if (is_phits)
|
||||
par.k0 = cos(phits);
|
||||
// par.inv = s_inverse;
|
||||
// par.fwd = s_forward;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -147,7 +143,8 @@ namespace boost { namespace geometry { namespace projections
|
||||
- Cylindrical
|
||||
- Spheroid
|
||||
- Ellipsoid
|
||||
- lat_ts=
|
||||
\par Projection parameters
|
||||
- lat_ts: Latitude of true scale (degrees)
|
||||
\par Example
|
||||
\image html ex_merc.gif
|
||||
*/
|
||||
@@ -170,7 +167,8 @@ namespace boost { namespace geometry { namespace projections
|
||||
- Cylindrical
|
||||
- Spheroid
|
||||
- Ellipsoid
|
||||
- lat_ts=
|
||||
\par Projection parameters
|
||||
- lat_ts: Latitude of true scale (degrees)
|
||||
\par Example
|
||||
\image html ex_merc.gif
|
||||
*/
|
||||
|
||||
@@ -38,8 +38,6 @@
|
||||
// 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>
|
||||
@@ -48,8 +46,8 @@
|
||||
namespace boost { namespace geometry { namespace projections
|
||||
{
|
||||
#ifndef DOXYGEN_NO_DETAIL
|
||||
namespace detail { namespace mill{
|
||||
|
||||
namespace detail { namespace mill
|
||||
{
|
||||
|
||||
// template class, using CRTP to implement forward/inverse
|
||||
template <typename Geographic, typename Cartesian, typename Parameters>
|
||||
@@ -83,8 +81,6 @@ namespace boost { namespace geometry { namespace projections
|
||||
void setup_mill(Parameters& par)
|
||||
{
|
||||
par.es = 0.;
|
||||
// par.inv = s_inverse;
|
||||
// par.fwd = s_forward;
|
||||
}
|
||||
|
||||
}} // namespace detail::mill
|
||||
|
||||
@@ -38,19 +38,21 @@
|
||||
// DEALINGS IN THE SOFTWARE.
|
||||
|
||||
|
||||
#include <boost/core/ignore_unused.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_zpoly1.hpp>
|
||||
|
||||
namespace boost { namespace geometry { namespace projections
|
||||
{
|
||||
#ifndef DOXYGEN_NO_DETAIL
|
||||
namespace detail { namespace mod_ster{
|
||||
namespace detail { namespace mod_ster
|
||||
{
|
||||
|
||||
static const double EPSLN = 1e-10;
|
||||
|
||||
struct par_mod_ster
|
||||
@@ -59,8 +61,8 @@ namespace boost { namespace geometry { namespace projections
|
||||
double cchio, schio;
|
||||
int n;
|
||||
};
|
||||
/* based upon Snyder and Linck, USGS-NMD */
|
||||
|
||||
/* based upon Snyder and Linck, USGS-NMD */
|
||||
|
||||
// template class, using CRTP to implement forward/inverse
|
||||
template <typename Geographic, typename Cartesian, typename Parameters>
|
||||
@@ -150,9 +152,8 @@ namespace boost { namespace geometry { namespace projections
|
||||
template <typename Parameters>
|
||||
void setup(Parameters& par, par_mod_ster& proj_parm) /* general initialization */
|
||||
{
|
||||
boost::ignore_unused(par);
|
||||
boost::ignore_unused(proj_parm);
|
||||
double esphi, chio;
|
||||
|
||||
if (par.es) {
|
||||
esphi = par.e * sin(par.phi0);
|
||||
chio = 2. * atan(tan((HALFPI + par.phi0) * .5) *
|
||||
@@ -161,8 +162,6 @@ namespace boost { namespace geometry { namespace projections
|
||||
chio = par.phi0;
|
||||
proj_parm.schio = sin(chio);
|
||||
proj_parm.cchio = cos(chio);
|
||||
// par.inv = e_inverse;
|
||||
// par.fwd = e_forward;
|
||||
}
|
||||
|
||||
|
||||
@@ -176,6 +175,7 @@ namespace boost { namespace geometry { namespace projections
|
||||
{0., 0.},
|
||||
{0.019430, 0.}
|
||||
};
|
||||
|
||||
proj_parm.n = 2;
|
||||
par.lam0 = DEG_TO_RAD * 20.;
|
||||
par.phi0 = DEG_TO_RAD * 18.;
|
||||
@@ -194,6 +194,7 @@ namespace boost { namespace geometry { namespace projections
|
||||
{0., 0.},
|
||||
{-0.0088162, -0.00617325}
|
||||
};
|
||||
|
||||
proj_parm.n = 2;
|
||||
par.lam0 = DEG_TO_RAD * -165.;
|
||||
par.phi0 = DEG_TO_RAD * -10.;
|
||||
@@ -214,6 +215,7 @@ namespace boost { namespace geometry { namespace projections
|
||||
{0., 0.},
|
||||
{0.075528, 0.}
|
||||
};
|
||||
|
||||
proj_parm.n = 4;
|
||||
par.lam0 = DEG_TO_RAD * -96.;
|
||||
par.phi0 = DEG_TO_RAD * -39.;
|
||||
@@ -243,6 +245,7 @@ namespace boost { namespace geometry { namespace projections
|
||||
{.0636871, -.1408027},
|
||||
{.3660976, -.2937382}
|
||||
};
|
||||
|
||||
proj_parm.n = 5;
|
||||
par.lam0 = DEG_TO_RAD * -152.;
|
||||
par.phi0 = DEG_TO_RAD * 64.;
|
||||
@@ -286,6 +289,7 @@ namespace boost { namespace geometry { namespace projections
|
||||
{-.0216473, .0776645},
|
||||
{-.0225161, .0853673}
|
||||
};
|
||||
|
||||
proj_parm.n = 9;
|
||||
par.lam0 = DEG_TO_RAD * -120.;
|
||||
par.phi0 = DEG_TO_RAD * 45.;
|
||||
@@ -310,7 +314,7 @@ namespace boost { namespace geometry { namespace projections
|
||||
\tparam Cartesian xy point type
|
||||
\tparam Parameters parameter type
|
||||
\par Projection characteristics
|
||||
- Azi(mod)
|
||||
- Azimuthal (mod)
|
||||
\par Example
|
||||
\image html ex_mil_os.gif
|
||||
*/
|
||||
@@ -330,7 +334,7 @@ namespace boost { namespace geometry { namespace projections
|
||||
\tparam Cartesian xy point type
|
||||
\tparam Parameters parameter type
|
||||
\par Projection characteristics
|
||||
- Azi(mod)
|
||||
- Azimuthal (mod)
|
||||
\par Example
|
||||
\image html ex_lee_os.gif
|
||||
*/
|
||||
@@ -350,7 +354,7 @@ namespace boost { namespace geometry { namespace projections
|
||||
\tparam Cartesian xy point type
|
||||
\tparam Parameters parameter type
|
||||
\par Projection characteristics
|
||||
- Azi(mod)
|
||||
- Azimuthal (mod)
|
||||
\par Example
|
||||
\image html ex_gs48.gif
|
||||
*/
|
||||
@@ -370,7 +374,7 @@ namespace boost { namespace geometry { namespace projections
|
||||
\tparam Cartesian xy point type
|
||||
\tparam Parameters parameter type
|
||||
\par Projection characteristics
|
||||
- Azi(mod)
|
||||
- Azimuthal (mod)
|
||||
\par Example
|
||||
\image html ex_alsk.gif
|
||||
*/
|
||||
@@ -390,7 +394,7 @@ namespace boost { namespace geometry { namespace projections
|
||||
\tparam Cartesian xy point type
|
||||
\tparam Parameters parameter type
|
||||
\par Projection characteristics
|
||||
- Azi(mod)
|
||||
- Azimuthal (mod)
|
||||
\par Example
|
||||
\image html ex_gs50.gif
|
||||
*/
|
||||
|
||||
@@ -38,9 +38,6 @@
|
||||
// DEALINGS IN THE SOFTWARE.
|
||||
|
||||
|
||||
#include <boost/core/ignore_unused.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>
|
||||
@@ -50,7 +47,9 @@
|
||||
namespace boost { namespace geometry { namespace projections
|
||||
{
|
||||
#ifndef DOXYGEN_NO_DETAIL
|
||||
namespace detail { namespace moll{
|
||||
namespace detail { namespace moll
|
||||
{
|
||||
|
||||
static const int MAX_ITER = 10;
|
||||
static const double LOOP_TOL = 1e-7;
|
||||
|
||||
@@ -106,17 +105,14 @@ namespace boost { namespace geometry { namespace projections
|
||||
template <typename Parameters>
|
||||
void setup(Parameters& par, par_moll& proj_parm, double p)
|
||||
{
|
||||
boost::ignore_unused(par);
|
||||
boost::ignore_unused(proj_parm);
|
||||
double r, sp, p2 = p + p;
|
||||
|
||||
par.es = 0;
|
||||
sp = sin(p);
|
||||
r = sqrt(TWOPI * sp / (p2 + sin(p2)));
|
||||
proj_parm.C_x = 2. * r / PI;
|
||||
proj_parm.C_y = r / sp;
|
||||
proj_parm.C_p = p2 + sin(p2);
|
||||
// par.inv = s_inverse;
|
||||
// par.fwd = s_forward;
|
||||
}
|
||||
|
||||
|
||||
@@ -142,8 +138,6 @@ namespace boost { namespace geometry { namespace projections
|
||||
proj_parm.C_x = 0.90977;
|
||||
proj_parm.C_y = 1.65014;
|
||||
proj_parm.C_p = 3.00896;
|
||||
// par.inv = s_inverse;
|
||||
// par.fwd = s_forward;
|
||||
}
|
||||
|
||||
}} // namespace detail::moll
|
||||
|
||||
@@ -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,9 @@
|
||||
namespace boost { namespace geometry { namespace projections
|
||||
{
|
||||
#ifndef DOXYGEN_NO_DETAIL
|
||||
namespace detail { namespace natearth{
|
||||
namespace detail { namespace natearth
|
||||
{
|
||||
|
||||
static const double A0 = 0.8707;
|
||||
static const double A1 = -0.131979;
|
||||
static const double A2 = -0.013791;
|
||||
@@ -64,9 +67,6 @@ namespace boost { namespace geometry { namespace projections
|
||||
static const double EPS = 1e-11;
|
||||
static const double MAX_Y = (0.8707 * 0.52 * PI);
|
||||
|
||||
|
||||
|
||||
|
||||
// template class, using CRTP to implement forward/inverse
|
||||
template <typename Geographic, typename Cartesian, typename Parameters>
|
||||
struct base_natearth_spheroid : public base_t_fi<base_natearth_spheroid<Geographic, Cartesian, Parameters>,
|
||||
@@ -84,7 +84,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 phi2, phi4;
|
||||
|
||||
|
||||
phi2 = lp_lat * lp_lat;
|
||||
phi4 = phi2 * phi2;
|
||||
xy_x = lp_lon * (A0 + phi2 * (A1 + phi2 * (A2 + phi4 * phi2 * (A3 + phi2 * A4))));
|
||||
@@ -94,14 +94,14 @@ 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 yc, tol, y2, y4, f, fder;
|
||||
|
||||
|
||||
/* make sure y is inside valid range */
|
||||
if (xy_y > MAX_Y) {
|
||||
xy_y = MAX_Y;
|
||||
} else if (xy_y < -MAX_Y) {
|
||||
xy_y = -MAX_Y;
|
||||
}
|
||||
|
||||
|
||||
/* latitude */
|
||||
yc = xy_y;
|
||||
for (;;) { /* Newton-Raphson */
|
||||
@@ -115,11 +115,10 @@ namespace boost { namespace geometry { namespace projections
|
||||
}
|
||||
}
|
||||
lp_lat = yc;
|
||||
|
||||
|
||||
/* longitude */
|
||||
y2 = yc * yc;
|
||||
lp_lon = xy_x / (A0 + y2 * (A1 + y2 * (A2 + y2 * y2 * y2 * (A3 + y2 * A4))));
|
||||
|
||||
}
|
||||
};
|
||||
|
||||
@@ -128,12 +127,10 @@ namespace boost { namespace geometry { namespace projections
|
||||
void setup_natearth(Parameters& par)
|
||||
{
|
||||
par.es = 0;
|
||||
// par.inv = s_inverse;
|
||||
// par.fwd = s_forward;
|
||||
}
|
||||
|
||||
}} // namespace detail::natearth
|
||||
#endif // doxygen
|
||||
#endif // doxygen
|
||||
|
||||
/*!
|
||||
\brief Natural Earth projection
|
||||
@@ -177,7 +174,7 @@ namespace boost { namespace geometry { namespace projections
|
||||
factory.add_to_factory("natearth", new natearth_entry<Geographic, Cartesian, Parameters>);
|
||||
}
|
||||
|
||||
} // namespace detail
|
||||
} // namespace detail
|
||||
#endif // doxygen
|
||||
|
||||
}}} // namespace boost::geometry::projections
|
||||
|
||||
@@ -38,21 +38,21 @@
|
||||
// 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 nell{
|
||||
namespace detail { namespace nell
|
||||
{
|
||||
|
||||
static const int MAX_ITER = 10;
|
||||
static const double LOOP_TOL = 1e-7;
|
||||
|
||||
|
||||
// template class, using CRTP to implement forward/inverse
|
||||
template <typename Geographic, typename Cartesian, typename Parameters>
|
||||
struct base_nell_spheroid : public base_t_fi<base_nell_spheroid<Geographic, Cartesian, Parameters>,
|
||||
@@ -97,8 +97,6 @@ namespace boost { namespace geometry { namespace projections
|
||||
void setup_nell(Parameters& par)
|
||||
{
|
||||
par.es = 0;
|
||||
// par.inv = s_inverse;
|
||||
// par.fwd = s_forward;
|
||||
}
|
||||
|
||||
}} // namespace detail::nell
|
||||
|
||||
@@ -38,8 +38,6 @@
|
||||
// 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>
|
||||
@@ -48,11 +46,12 @@
|
||||
namespace boost { namespace geometry { namespace projections
|
||||
{
|
||||
#ifndef DOXYGEN_NO_DETAIL
|
||||
namespace detail { namespace nell_h{
|
||||
namespace detail { namespace nell_h
|
||||
{
|
||||
|
||||
static const int NITER = 9;
|
||||
static const double EPS = 1e-7;
|
||||
|
||||
|
||||
// template class, using CRTP to implement forward/inverse
|
||||
template <typename Geographic, typename Cartesian, typename Parameters>
|
||||
struct base_nell_h_spheroid : public base_t_fi<base_nell_h_spheroid<Geographic, Cartesian, Parameters>,
|
||||
@@ -98,8 +97,6 @@ namespace boost { namespace geometry { namespace projections
|
||||
void setup_nell_h(Parameters& par)
|
||||
{
|
||||
par.es = 0.;
|
||||
// par.inv = s_inverse;
|
||||
// par.fwd = s_forward;
|
||||
}
|
||||
|
||||
}} // namespace detail::nell_h
|
||||
|
||||
@@ -38,8 +38,6 @@
|
||||
// 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>
|
||||
@@ -48,9 +46,10 @@
|
||||
namespace boost { namespace geometry { namespace projections
|
||||
{
|
||||
#ifndef DOXYGEN_NO_DETAIL
|
||||
namespace detail { namespace nocol{
|
||||
static const double EPS = 1e-10;
|
||||
namespace detail { namespace nocol
|
||||
{
|
||||
|
||||
static const double EPS = 1e-10;
|
||||
|
||||
// template class, using CRTP to implement forward/inverse
|
||||
template <typename Geographic, typename Cartesian, typename Parameters>
|
||||
@@ -105,7 +104,6 @@ namespace boost { namespace geometry { namespace projections
|
||||
void setup_nicol(Parameters& par)
|
||||
{
|
||||
par.es = 0.;
|
||||
// par.fwd = s_forward;
|
||||
}
|
||||
|
||||
}} // namespace detail::nocol
|
||||
|
||||
@@ -38,7 +38,6 @@
|
||||
// DEALINGS IN THE SOFTWARE.
|
||||
|
||||
|
||||
#include <boost/core/ignore_unused.hpp>
|
||||
#include <boost/math/special_functions/hypot.hpp>
|
||||
|
||||
#include <boost/geometry/extensions/gis/projections/impl/base_static.hpp>
|
||||
@@ -49,7 +48,9 @@
|
||||
namespace boost { namespace geometry { namespace projections
|
||||
{
|
||||
#ifndef DOXYGEN_NO_DETAIL
|
||||
namespace detail { namespace nsper{
|
||||
namespace detail { namespace nsper
|
||||
{
|
||||
|
||||
static const double EPS10 = 1.e-10;
|
||||
static const int N_POLE = 0;
|
||||
static const int S_POLE = 1;
|
||||
@@ -185,8 +186,6 @@ namespace boost { namespace geometry { namespace projections
|
||||
template <typename Parameters>
|
||||
void setup(Parameters& par, par_nsper& proj_parm)
|
||||
{
|
||||
boost::ignore_unused(par);
|
||||
boost::ignore_unused(proj_parm);
|
||||
if ((proj_parm.height = pj_param(par.params, "dh").f) <= 0.) throw proj_exception(-30);
|
||||
if (fabs(fabs(par.phi0) - HALFPI) < EPS10)
|
||||
proj_parm.mode = par.phi0 < 0. ? S_POLE : N_POLE;
|
||||
@@ -197,14 +196,11 @@ namespace boost { namespace geometry { namespace projections
|
||||
proj_parm.sinph0 = sin(par.phi0);
|
||||
proj_parm.cosph0 = cos(par.phi0);
|
||||
}
|
||||
proj_parm.pn1 = proj_parm.height / par.a;
|
||||
/* normalize by radius */
|
||||
proj_parm.pn1 = proj_parm.height / par.a; /* normalize by radius */
|
||||
proj_parm.p = 1. + proj_parm.pn1;
|
||||
proj_parm.rp = 1. / proj_parm.p;
|
||||
proj_parm.h = 1. / proj_parm.pn1;
|
||||
proj_parm.pfact = (proj_parm.p + 1.) * proj_parm.h;
|
||||
// par.inv = s_inverse;
|
||||
// par.fwd = s_forward;
|
||||
par.es = 0.;
|
||||
}
|
||||
|
||||
@@ -222,13 +218,12 @@ namespace boost { namespace geometry { namespace projections
|
||||
void setup_tpers(Parameters& par, par_nsper& proj_parm)
|
||||
{
|
||||
double omega, gamma;
|
||||
|
||||
omega = pj_param(par.params, "dtilt").f * DEG_TO_RAD;
|
||||
gamma = pj_param(par.params, "dazi").f * DEG_TO_RAD;
|
||||
proj_parm.tilt = 1;
|
||||
proj_parm.cg = cos(gamma);
|
||||
proj_parm.sg = sin(gamma);
|
||||
proj_parm.cw = cos(omega);
|
||||
proj_parm.sw = sin(omega);
|
||||
proj_parm.cg = cos(gamma); proj_parm.sg = sin(gamma);
|
||||
proj_parm.cw = cos(omega); proj_parm.sw = sin(omega);
|
||||
setup(par, proj_parm);
|
||||
}
|
||||
|
||||
@@ -244,7 +239,8 @@ namespace boost { namespace geometry { namespace projections
|
||||
\par Projection characteristics
|
||||
- Azimuthal
|
||||
- Spheroid
|
||||
- h=
|
||||
\par Projection parameters
|
||||
- h: Height
|
||||
\par Example
|
||||
\image html ex_nsper.gif
|
||||
*/
|
||||
@@ -266,7 +262,10 @@ namespace boost { namespace geometry { namespace projections
|
||||
\par Projection characteristics
|
||||
- Azimuthal
|
||||
- Spheroid
|
||||
- tilt= azi= h=
|
||||
\par Projection parameters
|
||||
- tilt: Tilt, or Omega (real)
|
||||
- azi: Azimuth (or Gamma) (real)
|
||||
- h: Height
|
||||
\par Example
|
||||
\image html ex_tpers.gif
|
||||
*/
|
||||
|
||||
@@ -38,17 +38,18 @@
|
||||
// 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_zpoly1.hpp>
|
||||
|
||||
namespace boost { namespace geometry { namespace projections
|
||||
{
|
||||
#ifndef DOXYGEN_NO_DETAIL
|
||||
namespace detail { namespace nzmg{
|
||||
namespace detail { namespace nzmg
|
||||
{
|
||||
|
||||
static const double EPSLN = 1e-10;
|
||||
static const double SEC5_TO_RAD = 0.4848136811095359935899141023;
|
||||
static const double RAD_TO_SEC5 = 2.062648062470963551564733573;
|
||||
@@ -56,10 +57,6 @@ namespace boost { namespace geometry { namespace projections
|
||||
static const int Ntpsi = 9;
|
||||
static const int Ntphi = 8;
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
static COMPLEX
|
||||
bf[] = {
|
||||
{.7557853228, 0.0},
|
||||
@@ -142,8 +139,6 @@ namespace boost { namespace geometry { namespace projections
|
||||
par.phi0 = DEG_TO_RAD * -41.;
|
||||
par.x0 = 2510000.;
|
||||
par.y0 = 6023150.;
|
||||
// par.inv = e_inverse;
|
||||
// par.fwd = e_forward;
|
||||
}
|
||||
|
||||
}} // namespace detail::nzmg
|
||||
@@ -156,7 +151,7 @@ namespace boost { namespace geometry { namespace projections
|
||||
\tparam Cartesian xy point type
|
||||
\tparam Parameters parameter type
|
||||
\par Projection characteristics
|
||||
- fixed Earth
|
||||
- Fixed Earth
|
||||
\par Example
|
||||
\image html ex_nzmg.gif
|
||||
*/
|
||||
|
||||
@@ -39,12 +39,12 @@
|
||||
|
||||
|
||||
#include <boost/shared_ptr.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>
|
||||
|
||||
namespace boost { namespace geometry { namespace projections
|
||||
{
|
||||
@@ -52,7 +52,9 @@ namespace boost { namespace geometry { namespace projections
|
||||
template <typename Geographic, typename Cartesian, typename Parameters> class factory;
|
||||
|
||||
#ifndef DOXYGEN_NO_DETAIL
|
||||
namespace detail { namespace ob_tran{
|
||||
namespace detail { namespace ob_tran
|
||||
{
|
||||
|
||||
static const double TOL = 1e-10;
|
||||
|
||||
template <typename Geographic, typename Cartesian>
|
||||
@@ -83,7 +85,6 @@ namespace boost { namespace geometry { namespace projections
|
||||
double coslam, sinphi, cosphi;
|
||||
|
||||
|
||||
|
||||
coslam = cos(lp_lon);
|
||||
sinphi = sin(lp_lat);
|
||||
cosphi = cos(lp_lat);
|
||||
@@ -129,7 +130,6 @@ namespace boost { namespace geometry { namespace projections
|
||||
double cosphi, coslam;
|
||||
|
||||
|
||||
|
||||
cosphi = cos(lp_lat);
|
||||
coslam = cos(lp_lon);
|
||||
lp_lon = adjlon(aatan2(cosphi * sin(lp_lon), sin(lp_lat)) + this->m_proj_parm.lamp);
|
||||
@@ -155,14 +155,13 @@ namespace boost { namespace geometry { namespace projections
|
||||
template <typename Geographic, typename Cartesian, typename Parameters>
|
||||
double setup_ob_tran(Parameters& par, par_ob_tran<Geographic, Cartesian>& proj_parm, bool create = true)
|
||||
{
|
||||
int i;
|
||||
double phip;
|
||||
|
||||
|
||||
Parameters pj;
|
||||
|
||||
/* get name of projection to be translated */
|
||||
pj.name = pj_param(par.params, "so_proj").s;
|
||||
/* copy existing header into new */
|
||||
par.es = 0.;
|
||||
/* force to spherical */
|
||||
par.es = 0.; /* force to spherical */
|
||||
pj.params = par.params;
|
||||
pj.over = par.over;
|
||||
pj.geoc = par.geoc;
|
||||
@@ -177,16 +176,16 @@ namespace boost { namespace geometry { namespace projections
|
||||
/* force spherical earth */
|
||||
pj.one_es = pj.rone_es = 1.;
|
||||
pj.es = pj.e = 0.;
|
||||
pj.name = pj_param(par.params, "so_proj").s;
|
||||
|
||||
factory<Geographic, Cartesian, Parameters> fac;
|
||||
if (create)
|
||||
{
|
||||
factory<Geographic, Cartesian, Parameters> fac;
|
||||
proj_parm.link.reset(fac.create_new(pj));
|
||||
if (! proj_parm.link.get()) throw proj_exception(-26);
|
||||
}
|
||||
if (pj_param(par.params, "to_alpha").i) {
|
||||
double lamc, phic, alpha;
|
||||
|
||||
lamc = pj_param(par.params, "ro_lon_c").f;
|
||||
phic = pj_param(par.params, "ro_lat_c").f;
|
||||
alpha = pj_param(par.params, "ro_alpha").f;
|
||||
@@ -204,6 +203,7 @@ namespace boost { namespace geometry { namespace projections
|
||||
phip = pj_param(par.params, "ro_lat_p").f;
|
||||
} else { /* specified new "equator" points */
|
||||
double lam1, lam2, phi1, phi2, con;
|
||||
|
||||
lam1 = pj_param(par.params, "ro_lon_1").f;
|
||||
phi1 = pj_param(par.params, "ro_lat_1").f;
|
||||
lam2 = pj_param(par.params, "ro_lon_2").f;
|
||||
@@ -221,13 +221,8 @@ namespace boost { namespace geometry { namespace projections
|
||||
if (fabs(phip) > TOL) { /* oblique */
|
||||
proj_parm.cphip = cos(phip);
|
||||
proj_parm.sphip = sin(phip);
|
||||
// par.fwd = o_forward;
|
||||
// par.inv = pj.inv ? o_inverse : 0;
|
||||
} else { /* transverse */
|
||||
// par.fwd = t_forward;
|
||||
// par.inv = pj.inv ? t_inverse : 0;
|
||||
}
|
||||
boost::ignore_unused(i);
|
||||
// return phip to choose model
|
||||
return phip;
|
||||
}
|
||||
@@ -244,10 +239,19 @@ namespace boost { namespace geometry { namespace projections
|
||||
\par Projection characteristics
|
||||
- Miscellaneous
|
||||
- Spheroid
|
||||
- o_proj= plus parameters for projection
|
||||
- o_lat_p= o_lon_p= (new pole) or
|
||||
- o_alpha= o_lon_c= o_lat_c= or
|
||||
- o_lon_1= o_lat_1= o_lon_2= o_lat_2=
|
||||
\par Projection parameters
|
||||
- o_proj (string)
|
||||
- Plus projection parameters
|
||||
- o_lat_p (degrees)
|
||||
- o_lon_p (degrees)
|
||||
- New pole
|
||||
- o_alpha: Alpha (degrees)
|
||||
- o_lon_c (degrees)
|
||||
- o_lat_c (degrees)
|
||||
- o_lon_1 (degrees)
|
||||
- o_lat_1: Latitude of first standard parallel (degrees)
|
||||
- o_lon_2 (degrees)
|
||||
- o_lat_2: Latitude of second standard parallel (degrees)
|
||||
\par Example
|
||||
\image html ex_ob_tran.gif
|
||||
*/
|
||||
@@ -269,10 +273,19 @@ namespace boost { namespace geometry { namespace projections
|
||||
\par Projection characteristics
|
||||
- Miscellaneous
|
||||
- Spheroid
|
||||
- o_proj= plus parameters for projection
|
||||
- o_lat_p= o_lon_p= (new pole) or
|
||||
- o_alpha= o_lon_c= o_lat_c= or
|
||||
- o_lon_1= o_lat_1= o_lon_2= o_lat_2=
|
||||
\par Projection parameters
|
||||
- o_proj (string)
|
||||
- Plus projection parameters
|
||||
- o_lat_p (degrees)
|
||||
- o_lon_p (degrees)
|
||||
- New pole
|
||||
- o_alpha: Alpha (degrees)
|
||||
- o_lon_c (degrees)
|
||||
- o_lat_c (degrees)
|
||||
- o_lon_1 (degrees)
|
||||
- o_lat_1: Latitude of first standard parallel (degrees)
|
||||
- o_lon_2 (degrees)
|
||||
- o_lat_2: Latitude of second standard parallel (degrees)
|
||||
\par Example
|
||||
\image html ex_ob_tran.gif
|
||||
*/
|
||||
@@ -299,6 +312,7 @@ namespace boost { namespace geometry { namespace projections
|
||||
detail::ob_tran::par_ob_tran<Geographic, Cartesian> proj_parm;
|
||||
Parameters p = par;
|
||||
double phip = setup_ob_tran(p, proj_parm, false);
|
||||
|
||||
if (fabs(phip) > detail::ob_tran::TOL)
|
||||
return new base_v_fi<ob_tran_oblique<Geographic, Cartesian, Parameters>, Geographic, Cartesian, Parameters>(par);
|
||||
else
|
||||
|
||||
@@ -38,8 +38,6 @@
|
||||
// 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>
|
||||
@@ -48,7 +46,8 @@
|
||||
namespace boost { namespace geometry { namespace projections
|
||||
{
|
||||
#ifndef DOXYGEN_NO_DETAIL
|
||||
namespace detail { namespace ocea{
|
||||
namespace detail { namespace ocea
|
||||
{
|
||||
|
||||
struct par_ocea
|
||||
{
|
||||
@@ -109,6 +108,7 @@ namespace boost { namespace geometry { namespace projections
|
||||
void setup_ocea(Parameters& par, par_ocea& proj_parm)
|
||||
{
|
||||
double phi_0=0.0, phi_1, phi_2, lam_1, lam_2, lonz, alpha;
|
||||
|
||||
proj_parm.rok = par.a / par.k0;
|
||||
proj_parm.rtk = par.a * par.k0;
|
||||
if ( pj_param(par.params, "talpha").i) {
|
||||
@@ -132,8 +132,6 @@ namespace boost { namespace geometry { namespace projections
|
||||
proj_parm.sinphi = sin(proj_parm.sinphi);
|
||||
proj_parm.cosgam = cos(proj_parm.singam);
|
||||
proj_parm.singam = sin(proj_parm.singam);
|
||||
// par.inv = s_inverse;
|
||||
// par.fwd = s_forward;
|
||||
par.es = 0.;
|
||||
}
|
||||
|
||||
@@ -148,8 +146,14 @@ namespace boost { namespace geometry { namespace projections
|
||||
\tparam Parameters parameter type
|
||||
\par Projection characteristics
|
||||
- Cylindrical
|
||||
- Sph lonc= alpha= or
|
||||
- lat_1= lat_2= lon_1= lon_2=
|
||||
- Spheroid
|
||||
\par Projection parameters
|
||||
- lonc: Longitude (only used if alpha (or gamma) is specified) (degrees)
|
||||
- alpha: Alpha (degrees)
|
||||
- lat_1: Latitude of first standard parallel (degrees)
|
||||
- lat_2: Latitude of second standard parallel (degrees)
|
||||
- lon_1 (degrees)
|
||||
- lon_2 (degrees)
|
||||
\par Example
|
||||
\image html ex_ocea.gif
|
||||
*/
|
||||
|
||||
@@ -44,11 +44,13 @@
|
||||
#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 oea{
|
||||
namespace detail { namespace oea
|
||||
{
|
||||
|
||||
struct par_oea
|
||||
{
|
||||
@@ -123,8 +125,6 @@ namespace boost { namespace geometry { namespace projections
|
||||
proj_parm.two_r_m = 2. * proj_parm.rm;
|
||||
proj_parm.hm = 0.5 * proj_parm.m;
|
||||
proj_parm.hn = 0.5 * proj_parm.n;
|
||||
// par.fwd = s_forward;
|
||||
// par.inv = s_inverse;
|
||||
par.es = 0.;
|
||||
}
|
||||
}
|
||||
@@ -141,7 +141,10 @@ namespace boost { namespace geometry { namespace projections
|
||||
\par Projection characteristics
|
||||
- Miscellaneous
|
||||
- Spheroid
|
||||
- n= m= theta=
|
||||
\par Projection parameters
|
||||
- n (real)
|
||||
- m (real)
|
||||
- theta: Theta (degrees)
|
||||
\par Example
|
||||
\image html ex_oea.gif
|
||||
*/
|
||||
|
||||
@@ -38,26 +38,22 @@
|
||||
// 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 omerc{
|
||||
namespace detail { namespace omerc
|
||||
{
|
||||
|
||||
static const double TOL = 1.e-7;
|
||||
static const double EPS = 1.e-10;
|
||||
|
||||
inline double TSFN0(double x)
|
||||
{return tan(.5 * (HALFPI - (x))); }
|
||||
|
||||
|
||||
struct par_omerc
|
||||
{
|
||||
double A, B, E, AB, ArB, BrA, rB, singam, cosgam, sinrot, cosrot;
|
||||
@@ -65,8 +61,6 @@ namespace boost { namespace geometry { namespace projections
|
||||
int no_rot;
|
||||
};
|
||||
|
||||
|
||||
|
||||
// template class, using CRTP to implement forward/inverse
|
||||
template <typename Geographic, typename Cartesian, typename Parameters>
|
||||
struct base_omerc_ellipsoid : public base_t_fi<base_omerc_ellipsoid<Geographic, Cartesian, Parameters>,
|
||||
@@ -152,6 +146,7 @@ namespace boost { namespace geometry { namespace projections
|
||||
double con, com, cosph0, D, F, H, L, sinph0, p, J, gamma=0,
|
||||
gamma0, lamc=0, lam1=0, lam2=0, phi1=0, phi2=0, alpha_c;
|
||||
int alp, gam, no_off = 0;
|
||||
|
||||
proj_parm.no_rot = pj_param(par.params, "tno_rot").i;
|
||||
if ((alp = pj_param(par.params, "talpha").i) != 0)
|
||||
alpha_c = pj_param(par.params, "ralpha").f;
|
||||
@@ -250,8 +245,6 @@ namespace boost { namespace geometry { namespace projections
|
||||
F = 0.5 * gamma0;
|
||||
proj_parm.v_pole_n = proj_parm.ArB * log(tan(FORTPI - F));
|
||||
proj_parm.v_pole_s = proj_parm.ArB * log(tan(FORTPI + F));
|
||||
// par.inv = e_inverse;
|
||||
// par.fwd = e_forward;
|
||||
}
|
||||
|
||||
}} // namespace detail::omerc
|
||||
@@ -266,9 +259,18 @@ namespace boost { namespace geometry { namespace projections
|
||||
\par Projection characteristics
|
||||
- Cylindrical
|
||||
- Spheroid
|
||||
- Ell no_rot
|
||||
- alpha= [gamma=] [no_off] lonc= or
|
||||
- lon_1= lat_1= lon_2= lat_2=
|
||||
- Ellipsoid
|
||||
\par Projection parameters
|
||||
- no_rot: No rotation
|
||||
- alpha: Alpha (degrees)
|
||||
- gamma: Gamma (degrees)
|
||||
- no_off: Only for compatibility with libproj, proj4 (string)
|
||||
- lonc: Longitude (only used if alpha (or gamma) is specified) (degrees)
|
||||
- lon_1 (degrees)
|
||||
- lat_1: Latitude of first standard parallel (degrees)
|
||||
- lon_2 (degrees)
|
||||
- lat_2: Latitude of second standard parallel (degrees)
|
||||
- no_uoff (string)
|
||||
\par Example
|
||||
\image html ex_omerc.gif
|
||||
*/
|
||||
|
||||
@@ -48,7 +48,9 @@
|
||||
namespace boost { namespace geometry { namespace projections
|
||||
{
|
||||
#ifndef DOXYGEN_NO_DETAIL
|
||||
namespace detail { namespace ortho{
|
||||
namespace detail { namespace ortho
|
||||
{
|
||||
|
||||
static const double EPS10 = 1.e-10;
|
||||
static const int N_POLE = 0;
|
||||
static const int S_POLE = 1;
|
||||
@@ -101,10 +103,8 @@ namespace boost { namespace geometry { namespace projections
|
||||
break;
|
||||
}
|
||||
xy_x = cosphi * sin(lp_lon);
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
inline void inv(cartesian_type& xy_x, cartesian_type& xy_y, geographic_type& lp_lon, geographic_type& lp_lat) const
|
||||
{
|
||||
double rh, cosc, sinc;
|
||||
@@ -146,9 +146,7 @@ namespace boost { namespace geometry { namespace projections
|
||||
? (xy_x == 0. ? 0. : xy_x < 0. ? -HALFPI : HALFPI)
|
||||
: atan2(xy_x, xy_y);
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
// Orthographic
|
||||
@@ -163,8 +161,6 @@ namespace boost { namespace geometry { namespace projections
|
||||
proj_parm.cosph0 = cos(par.phi0);
|
||||
} else
|
||||
proj_parm.mode = EQUIT;
|
||||
// par.inv = s_inverse;
|
||||
// par.fwd = s_forward;
|
||||
par.es = 0.;
|
||||
}
|
||||
|
||||
|
||||
@@ -38,19 +38,19 @@
|
||||
// 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 poly{
|
||||
namespace detail { namespace poly
|
||||
{
|
||||
|
||||
static const double TOL = 1e-10;
|
||||
static const double CONV = 1e-10;
|
||||
static const int N_ITER = 10;
|
||||
@@ -178,14 +178,10 @@ namespace boost { namespace geometry { namespace projections
|
||||
void setup_poly(Parameters& par, par_poly& 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.ml0 = pj_mlfn(par.phi0, sin(par.phi0), cos(par.phi0), proj_parm.en);
|
||||
// par.inv = e_inverse;
|
||||
// par.fwd = e_forward;
|
||||
} else {
|
||||
proj_parm.ml0 = -par.phi0;
|
||||
// par.inv = s_inverse;
|
||||
// par.fwd = s_forward;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -38,17 +38,18 @@
|
||||
// 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 putp2{
|
||||
namespace detail { namespace putp2
|
||||
{
|
||||
|
||||
static const double C_x = 1.89490;
|
||||
static const double C_y = 1.71848;
|
||||
static const double C_p = 0.6141848493043784;
|
||||
@@ -56,7 +57,6 @@ namespace boost { namespace geometry { namespace projections
|
||||
static const int NITER = 10;
|
||||
static const double PI_DIV_3 = 1.0471975511965977;
|
||||
|
||||
|
||||
// template class, using CRTP to implement forward/inverse
|
||||
template <typename Geographic, typename Cartesian, typename Parameters>
|
||||
struct base_putp2_spheroid : public base_t_fi<base_putp2_spheroid<Geographic, Cartesian, Parameters>,
|
||||
@@ -108,8 +108,6 @@ namespace boost { namespace geometry { namespace projections
|
||||
void setup_putp2(Parameters& par)
|
||||
{
|
||||
par.es = 0.;
|
||||
// par.inv = s_inverse;
|
||||
// par.fwd = s_forward;
|
||||
}
|
||||
|
||||
}} // namespace detail::putp2
|
||||
|
||||
@@ -39,7 +39,6 @@
|
||||
|
||||
|
||||
#include <boost/core/ignore_unused.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>
|
||||
@@ -49,7 +48,9 @@
|
||||
namespace boost { namespace geometry { namespace projections
|
||||
{
|
||||
#ifndef DOXYGEN_NO_DETAIL
|
||||
namespace detail { namespace putp3{
|
||||
namespace detail { namespace putp3
|
||||
{
|
||||
|
||||
static const double C = 0.79788456;
|
||||
static const double RPISQ = 0.1013211836;
|
||||
|
||||
@@ -89,11 +90,8 @@ namespace boost { namespace geometry { namespace projections
|
||||
template <typename Parameters>
|
||||
void setup(Parameters& par, par_putp3& proj_parm)
|
||||
{
|
||||
boost::ignore_unused(par);
|
||||
boost::ignore_unused(proj_parm);
|
||||
par.es = 0.;
|
||||
// par.inv = s_inverse;
|
||||
// par.fwd = s_forward;
|
||||
}
|
||||
|
||||
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user