Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

cartography: Support Proj4.8 API

This should be backwards compatible with Proj4.7
  • Loading branch information...
commit 67f777e8e0ba62243a16e6b36dd572d301ee5963 1 parent 09c7eac
Zack Moratto zmoratto authored
2  configure.ac
View
@@ -303,7 +303,7 @@ fi
AC_DEFINE_UNQUOTED(HAS_BIGTIFF, [$has_bigtiff], [Define to 1 if VW has BigTIFF support])
AC_MSG_RESULT([$VW_HAS_BIGTIFF])
-AX_PKG(PROJ4, [M], [-lproj], [projects.h])
+AX_PKG(PROJ4, [M], [-lproj], [proj_api.h])
if test "$HAVE_PKG_QT" = no; then
ENABLE_QT_QMAKE=no
12 src/vw/Cartography/GeoReference.cc
View
@@ -33,7 +33,7 @@
#include <boost/foreach.hpp>
// Proj.4
-#include <projects.h>
+#include <proj_api.h>
namespace vw {
namespace cartography {
@@ -420,8 +420,8 @@ namespace cartography {
Vector2 GeoReference::point_to_lonlat(Vector2 loc) const {
if ( ! m_is_projected ) return loc;
- XY projected;
- LP unprojected;
+ projXY projected;
+ projLP unprojected;
projected.u = loc[0];
projected.v = loc[1];
@@ -438,10 +438,10 @@ namespace cartography {
Vector2 GeoReference::lonlat_to_point(Vector2 lon_lat) const {
if ( ! m_is_projected ) return lon_lat;
// This value is proj's internal limit
- static const double BOUND = HALFPI-(1e-10)-std::numeric_limits<double>::epsilon();
+ static const double BOUND = M_PI/2.0-(1e-10)-std::numeric_limits<double>::epsilon();
- XY projected;
- LP unprojected;
+ projXY projected;
+ projLP unprojected;
// Proj.4 expects the (lon,lat) pair to be in radians
unprojected.u = lon_lat[0] * DEG_TO_RAD;
16 src/vw/Cartography/GeoReference.h
View
@@ -33,11 +33,15 @@
#endif
// Forward declaration of Proj.4 things. C++ needs forward declaration of
-// typedefs so we can call it PJ instead of PJconsts. Bad if Proj ever
+// typedefs so we can call it PJ instead of projPJ. Bad if Proj ever
// changes their struct names; we suddenly have a difficult to find bug.
// If the Proj API ever changes and this breaks, see if there's a new name
// for this structure.
-struct PJconsts;
+#if !defined(PROJECTS_H)
+typedef void* projPJ;
+#else
+typedef PJ* projPJ;
+#endif
namespace vw {
namespace cartography {
@@ -52,12 +56,12 @@ namespace cartography {
// reduces the possibility of a memory related bug. Implementation
// code for most of it is in GeoReference.cc.
class ProjContext : private boost::noncopyable {
- // Declare PJconsts as PJ like done in projects.h; sadly, C++ has no
+ // Declare projPJ as PJ like done in projects.h; sadly, C++ has no
// forward declaration of typedefs. So if Proj ever changes their
// names, we get screwed over here and have to change this as well.
- typedef PJconsts PJ;
+ typedef projPJ PJ;
- PJ* m_proj_ptr;
+ PJ m_proj_ptr;
char** split_proj4_string(std::string const& proj4_str, int &num_strings);
@@ -65,7 +69,7 @@ namespace cartography {
ProjContext(std::string const& proj4_str);
~ProjContext();
- inline PJ* proj_ptr() { return m_proj_ptr; }
+ inline PJ proj_ptr() { return m_proj_ptr; }
};
2  src/vw/Cartography/GeoTransform.cc
View
@@ -23,7 +23,7 @@
#include <vw/Image/ImageView.h>
// Proj.4
-#include <projects.h>
+#include <proj_api.h>
namespace vw {
namespace cartography {
Please sign in to comment.
Something went wrong with that request. Please try again.