|
Boost-Commit : |
Subject: [Boost-commit] svn:boost r77209 - sandbox/geometry/other/programs/proj4_to_boost_geometry
From: barend.gehrels_at_[hidden]
Date: 2012-03-04 06:46:11
Author: barendgehrels
Date: 2012-03-04 06:46:10 EST (Sun, 04 Mar 2012)
New Revision: 77209
URL: http://svn.boost.org/trac/boost/changeset/77209
Log:
[geometry] Update proj4 conversion program including update to newest version, namespace change, patch of Kris
Text files modified:
sandbox/geometry/other/programs/proj4_to_boost_geometry/convert_proj4.bat | 14 +++
sandbox/geometry/other/programs/proj4_to_boost_geometry/proj4_to_boost_geometry.cpp | 141 ++++++++++++++++++---------------------
sandbox/geometry/other/programs/proj4_to_boost_geometry/proj4_to_boost_geometry.vcproj | 2
sandbox/geometry/other/programs/proj4_to_boost_geometry/proj4_to_boost_geometry_copyright_header.txt | 6
4 files changed, 80 insertions(+), 83 deletions(-)
Modified: sandbox/geometry/other/programs/proj4_to_boost_geometry/convert_proj4.bat
==============================================================================
--- sandbox/geometry/other/programs/proj4_to_boost_geometry/convert_proj4.bat (original)
+++ sandbox/geometry/other/programs/proj4_to_boost_geometry/convert_proj4.bat 2012-03-04 06:46:10 EST (Sun, 04 Mar 2012)
@@ -5,11 +5,11 @@
:: Please note that proj-4.7.0 has still an error in pconics, which is
:: solved in the trunk of proj. So take that trunk somewhere.
-set proj4=c:\svn\other\osgeo_proj4\src
+set proj4=c:\_svn\osgeo\proj_trunk\proj\src
:: This is the path where Boost.Geometry extensions gis projections proj lives:
-set bg_proj=../../../boost/geometry/extensions/gis/projections/proj
-:: set bg_proj=t
+:: set bg_proj=../../../boost/geometry/extensions/gis/projections/proj
+set bg_proj=t
set converter=release\proj4_to_boost_geometry.exe
@@ -105,3 +105,11 @@
%converter% %proj4%/pj_wink1.c wink1 > %bg_proj%/wink1.hpp
%converter% %proj4%/pj_wink2.c wink2 > %bg_proj%/wink2.hpp
%converter% %proj4%/proj_rouss.c rouss > %bg_proj%/rouss.hpp
+
+:: New since 4.7
+echo New since proj 4.7
+%converter% %proj4%/pj_auth.c auth > %bg_proj%/auth.hpp
+%converter% %proj4%/pj_healpix.c healpix > %bg_proj%/healpix.hpp
+%converter% %proj4%/pj_igh.c igh > %bg_proj%/igh.hpp
+%converter% %proj4%/pj_isea.c isea > %bg_proj%/isea.hpp
+%converter% %proj4%/pj_natearth.c natearth > %bg_proj%/natearth.hpp
Modified: sandbox/geometry/other/programs/proj4_to_boost_geometry/proj4_to_boost_geometry.cpp
==============================================================================
--- sandbox/geometry/other/programs/proj4_to_boost_geometry/proj4_to_boost_geometry.cpp (original)
+++ sandbox/geometry/other/programs/proj4_to_boost_geometry/proj4_to_boost_geometry.cpp 2012-03-04 06:46:10 EST (Sun, 04 Mar 2012)
@@ -7,6 +7,9 @@
//
// Proj4 to Boost.Geometry
+// NOTE:
+// This was written in 2008 to quickly accomplish a good conversion,
+// which was successful. However needs to be cleaned up, split up etc.
#include <iostream>
#include <fstream>
@@ -198,6 +201,11 @@
if (boost::contains(line, "->"))
{
boost::replace_all(line, "fac->", prefix + "fac.");
+
+ // BSG 2012-03-03, remove the new "proj ctx" context completely, it's only debug-info
+ boost::replace_all(line, "P->ctx, ", "");
+ boost::replace_all(line, "P->ctx,", "");
+
boost::replace_all(line, "P->", prefix + "par.");
boost::replace_all(line, "P -> ", prefix + "par.");
// Refer to project-specific parameters
@@ -212,18 +220,9 @@
// Same for lam0
boost::replace_all(line, "proj_parm.lam0", "par.lam0");
-
- /*if (projection_group == "chamb")
- {
- boost::replace_all(line, "par.c", "proj_parm.c");
- }
- if (use_mlfn())
- {
- boost::replace_all(line, "par.en", "proj_parm.en");
- }*/
}
- // Special casses
+ // Special cases
if (projection_group == "robin"
|| projection_group == "tmerc")
{
@@ -233,6 +232,13 @@
boost::replace_all(line, "floor", "int_floor");
}
}
+ else if (projection_group == "chamb")
+ {
+ boost::replace_all(line, "(projCtx ctx, ", "(");
+ boost::replace_all(line, "(ctx, ", "(");
+ boost::replace_all(line, "(ctx,", "(");
+ }
+
}
void replace_in_entry(std::string& line)
@@ -281,11 +287,23 @@
{
line = tab1 + "proj_parm.en = detail::gauss::gauss_ini(par.e, par.phi0, proj_parm.phic0, R);";
}
+ boost::replace_all(line, "ENTRYX", "");
+ boost::replace_all(line, "proj_parm.en=0;", "");
+ }
+ else if (projection_group == "cea")
+ {
+ boost::replace_all(line, "double t;", "double t = 0;");
}
else if (projection_group == "ob_tran")
{
boost::replace_all(line, "proj_parm.link->", "pj.");
}
+ else if (projection_group == "geos")
+ {
+ boost::replace_all(line, "sweep_axis == NULL", "sweep_axis.empty()");
+ }
+
+
if (use_mlfn())
{
@@ -321,16 +339,19 @@
boost::replace_all(line, it->name, it->value);
}
- if (boost::contains(boost::replace_all_copy(line, " ", ""), "pj_errno="))
+ if (boost::contains(line, "errno"))
{
- boost::replace_all(line, "pj_errno", "throw proj_exception(");
- boost::replace_all(line, "=", "");
- boost::replace_all(line, ";", ");");
- boost::replace_all(line, ";;", ";");
+ if (boost::contains(boost::replace_all_copy(line, " ", ""), "pj_errno="))
+ {
+ boost::replace_all(line, "pj_errno", "throw proj_exception(");
+ boost::replace_all(line, "=", "");
+ boost::replace_all(line, ";", ");");
+ boost::replace_all(line, ";;", ";");
+ }
+ boost::replace_all(line, "pj_ctx_set_errno", "throw proj_exception");
}
}
-
void replace_for_setup(std::string const& line, std::vector<std::string>& setup)
{
if (projection_group == "ob_tran")
@@ -375,7 +396,10 @@
else if (projection_group == "goode")
{
if (boost::contains(line, "!(P->sinu = pj_sinu")
- || boost::contains(line, "E_ERROR_0"))
+ || boost::contains(line, "E_ERROR_0")
+ || boost::contains(line, "->ctx")
+ || boost::contains(line, "sinu->es")
+ )
{
return;
}
@@ -623,7 +647,8 @@
in_projection = false;
started = true;
}
- else if (boost::starts_with(trimmed, "ENTRY"))
+ else if (boost::starts_with(trimmed, "ENTRY")
+ && ! boost::equals(trimmed, "ENTRYX"))
{
in_constructor = true;
in_postfix = false;
@@ -780,6 +805,11 @@
{
boost::replace_all(par, "XY", "CXY");
}
+ else if (projection_group == "geos")
+ {
+ // Update for sweep_axis
+ boost::replace_all(par, "char *", "std::string");
+ }
else if (projection_group == "goode")
{
if (boost::contains(trimmed, "struct PJconsts"))
@@ -880,25 +910,10 @@
else if (projection_group == "robin")
{
boost::replace_all(line, "float c0, c1", "double c0, c1");
- // Add missing braces, all values are separated by , and have a ., the rest
- // of the lines here do not have that combination
- if (boost::contains(line, ".") && boost::contains(line, ","))
- {
- boost::trim(line);
-
- // add begin brace
- line.insert(0, "{");
- if (boost::contains(line, "}"))
- {
- // For the last line: add double end brace
- boost::replace_last(line, "}", "}}");
- }
- else
- {
- // The normal case: add end brace
- boost::replace_last(line, ",", "},");
- }
- }
+
+ // There was a problem for "robin"
+ // with missing braces in an earlier version of proj4,
+ // which has been fixed in trunk now.
}
else if (projection_group == "goode")
{
@@ -1045,6 +1060,14 @@
{
line = tab1 + "detail::gauss::inv_gauss(m_proj_parm.en, lp_lon, lp_lat);";
}
+
+ // For "cosl" problem submitted by Krzysztof Czainski
+ if (boost::contains(line, "cosl"))
+ {
+ boost::replace_all(line, " cosl, ", " cosl_, ");
+ boost::replace_all(line, " cosl = ", " cosl_ = ");
+ boost::replace_all(line, " cosl);", " cosl_);");
+ }
}
else if (projection_group == "mod_ster")
{
@@ -1094,6 +1117,8 @@
line2 = tab1 + "xy_x = xy.x; xy_y = xy.y;";
}
}
+ // Surpress uninitialized variables warning
+ boost::replace_all(line, "double yc;", "double yc = 0;");
}
else if (projection_group == "goode")
{
@@ -1112,44 +1137,6 @@
}
}
- // Unused variables
- if (projection_group == "krovak")
- {
- boost::replace_all(line, "char errmess[255];", "");
- boost::replace_all(line, "char tmp[16];", "");
- boost::replace_all(line, ", lon17", "");
- boost::replace_all(line, ", lamdd", "");
- boost::replace_all(line, ", l24", "");
- }
- else if (projection_group == "geos")
- {
- boost::replace_all(line, ", c", "");
- }
- else if (projection_group == "gn_sinu")
- {
- boost::replace_all(line, "double s;", "double s; boost::ignore_unused_variable_warning(s);");
- }
- else if (projection_group == "lcca")
- {
- boost::replace_all(line, ", S3", "");
- }
- else if (projection_group == "mbt_fps")
- {
- boost::replace_all(line, ", s", "");
- }
- else if (projection_group == "moll" || projection_group == "nell")
- {
- boost::replace_all(line, "double th, s;", "");
- }
-
- // uninitialized variables warning
- if (projection_group == "imw_p")
- {
- boost::replace_all(line, "double yc;", "double yc = 0;");
- }
-
-
-
proj_it->lines.push_back(line);
if (! line2.empty())
{
@@ -1332,7 +1319,7 @@
stream << std::endl;
- stream << "namespace boost { namespace geometry { namespace projection" << std::endl
+ stream << "namespace boost { namespace geometry { namespace projections" << std::endl
<< "{" << std::endl;
if (projection_group == "ob_tran")
@@ -1818,7 +1805,7 @@
void write_end()
{
stream
- << "}}} // namespace boost::geometry::projection" << std::endl << std::endl
+ << "}}} // namespace boost::geometry::projections" << std::endl << std::endl
<< "#endif // " << hpp << std::endl << std::endl;
}
Modified: sandbox/geometry/other/programs/proj4_to_boost_geometry/proj4_to_boost_geometry.vcproj
==============================================================================
--- sandbox/geometry/other/programs/proj4_to_boost_geometry/proj4_to_boost_geometry.vcproj (original)
+++ sandbox/geometry/other/programs/proj4_to_boost_geometry/proj4_to_boost_geometry.vcproj 2012-03-04 06:46:10 EST (Sun, 04 Mar 2012)
@@ -40,6 +40,7 @@
<Tool
Name="VCCLCompilerTool"
Optimization="0"
+ AdditionalIncludeDirectories="../../../../../trunk"
PreprocessorDefinitions="WIN32;_DEBUG;_CONSOLE;_SCL_SECURE_NO_WARNINGS;_SCL_SECURE_NO_DEPRECATE"
MinimalRebuild="true"
BasicRuntimeChecks="3"
@@ -115,6 +116,7 @@
/>
<Tool
Name="VCCLCompilerTool"
+ AdditionalIncludeDirectories="../../../../../trunk"
PreprocessorDefinitions="WIN32;NDEBUG;_CONSOLE;_SCL_SECURE_NO_WARNINGS;_SCL_SECURE_NO_DEPRECATE"
RuntimeLibrary="2"
UsePrecompiledHeader="0"
Modified: sandbox/geometry/other/programs/proj4_to_boost_geometry/proj4_to_boost_geometry_copyright_header.txt
==============================================================================
--- sandbox/geometry/other/programs/proj4_to_boost_geometry/proj4_to_boost_geometry_copyright_header.txt (original)
+++ sandbox/geometry/other/programs/proj4_to_boost_geometry/proj4_to_boost_geometry_copyright_header.txt 2012-03-04 06:46:10 EST (Sun, 04 Mar 2012)
@@ -1,8 +1,8 @@
// Boost.Geometry - extensions-gis-projections (based on PROJ4)
// This file is automatically generated. DO NOT EDIT.
-// Copyright Barend Gehrels (1995-2009), Geodan Holding B.V. Amsterdam, the Netherlands.
-// Copyright Bruno Lalande (2008-2009)
+// Copyright (c) 2008-2012 Barend Gehrels, Amsterdam, the Netherlands.
+
// Use, modification and distribution is subject to the Boost Software License,
// Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
// http://www.boost.org/LICENSE_1_0.txt)
@@ -10,7 +10,7 @@
// 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 (Geodan, Amsterdam)
+// PROJ4 is converted to Boost.Geometry by Barend Gehrels
// Original copyright notice:
Boost-Commit list run by bdawes at acm.org, david.abrahams at rcn.com, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk