Commit 02c482c3 authored by Ben Boeckel's avatar Ben Boeckel
Browse files

Merge remote-tracking branch 'gl/danlipsa/update_vtk_proj4_9_2'



* gl/danlipsa/update_vtk_proj4_9_2:
  libproj4 2016-02-12 (59bbf704)
  Fix Geovis tests. Projections numbers changed in proj 4.9.2
  Remove all proj4 files to start fresh.
  Update script for ThirdPary/libproj4
  Updated to use proj47 or higher
Acked-by: Brad King's avatarBrad King <brad.king@kitware.com>
Reviewed-by: Aashish Chaudhary's avatarAashish Chaudhary <aashish.chaudhary@kitware.com>
Merge-request: !1207
parents e7cb1fc4 616c2243
......@@ -53,7 +53,7 @@
int TestCoincidentGeoGraphRepresentation2D(int argc, char* argv[])
{
int projNum = 44;
int projNum = 26; // eqc : Equidistant Cylindrical (Plate Caree)
char* fname = vtkTestUtilities::ExpandDataFileName(
argc, argv, "Data/NE2_ps_bath_small.jpg");
vtkStdString imageFile = fname;
......
......@@ -44,7 +44,7 @@
int TestLabeledGeoView2D(int argc, char* argv[])
{
int proj = 40;
int proj = 24; // eck5 : Eckert V
char* fname = vtkTestUtilities::ExpandDataFileName(
argc, argv, "Data/NE2_ps_bath_small.jpg");
vtkStdString imageFile = fname;
......
......@@ -80,7 +80,7 @@ int vtkGeoProjection::GetNumberOfProjections()
if ( vtkGeoProjectionNumProj < 0 )
{
vtkGeoProjectionNumProj = 0;
for ( const PROJ_LIST* pj = proj_list; pj && pj->id; ++ pj )
for ( const PJ_LIST* pj = pj_get_list_ref(); pj && pj->id; ++ pj )
++ vtkGeoProjectionNumProj;
}
return vtkGeoProjectionNumProj;
......@@ -91,7 +91,7 @@ const char* vtkGeoProjection::GetProjectionName( int projection )
if ( projection < 0 || projection >= vtkGeoProjection::GetNumberOfProjections() )
return 0;
return proj_list[projection].id;
return pj_get_list_ref()[projection].id;
}
//-----------------------------------------------------------------------------
const char* vtkGeoProjection::GetProjectionDescription( int projection )
......@@ -99,7 +99,7 @@ const char* vtkGeoProjection::GetProjectionDescription( int projection )
if ( projection < 0 || projection >= vtkGeoProjection::GetNumberOfProjections() )
return 0;
return proj_list[projection].descr[0];
return pj_get_list_ref()[projection].descr[0];
}
//-----------------------------------------------------------------------------
vtkGeoProjection::vtkGeoProjection()
......@@ -116,7 +116,7 @@ vtkGeoProjection::~vtkGeoProjection()
this->SetName( 0 );
if ( this->Projection )
{
proj_free( this->Projection );
pj_free( this->Projection );
}
delete this->Internals;
this->Internals = NULL;
......@@ -142,7 +142,7 @@ int vtkGeoProjection::GetIndex()
if ( ! this->Projection )
return -1;
int i = 0;
for ( const PROJ_LIST* proj = proj_list; proj && proj->id; ++ proj, ++ i )
for ( const PJ_LIST* proj = pj_get_list_ref(); proj && proj->id; ++ proj, ++ i )
{
if ( ! strcmp( proj->id, this->Name ) )
{
......@@ -162,7 +162,7 @@ const char* vtkGeoProjection::GetDescription()
return this->Projection->descr;
}
//-----------------------------------------------------------------------------
PROJ* vtkGeoProjection::GetProjection()
projPJ vtkGeoProjection::GetProjection()
{
this->UpdateProjection();
return this->Projection;
......@@ -178,7 +178,7 @@ int vtkGeoProjection::UpdateProjection()
if ( this->Projection )
{
proj_free( this->Projection );
pj_free( this->Projection );
this->Projection = 0;
}
......@@ -217,7 +217,7 @@ int vtkGeoProjection::UpdateProjection()
pjArgs[3+i] = stringHolder[i].c_str();
}
this->Projection = proj_init( argSize, const_cast<char**>( pjArgs ) );
this->Projection = pj_init( argSize, const_cast<char**>( pjArgs ) );
delete[] pjArgs;
if ( this->Projection )
{
......
......@@ -29,8 +29,9 @@
#include "vtkGeovisCoreModule.h" // For export macro
#include "vtkObject.h"
struct PROJconsts;
typedef PROJconsts PROJ;
struct PJconsts;
typedef struct PJconsts PJ;
typedef PJ* projPJ;
class VTKGEOVISCORE_EXPORT vtkGeoProjection : public vtkObject
{
......@@ -85,7 +86,7 @@ public:
// this method returns may be freed, so you should not use the PROJ.4 structure
// after changing any parameters. Also, you should not modify the PROJ.4 structure
// on your own as it will then be out of sync with the vtkGeoProjection class.
PROJ* GetProjection();
projPJ GetProjection();
// Description:
// Add an optional parameter to the projection that will be computed or
......@@ -125,7 +126,7 @@ protected:
char* Name;
double CentralMeridian;
PROJ* Projection;
projPJ Projection;
vtkTimeStamp ProjectionMTime;
private:
......
......@@ -73,8 +73,8 @@ void vtkGeoTransform::TransformPoints( vtkPoints* srcPts, vtkPoints* dstPts )
}
dstCoords->DeepCopy( srcCoords );
PROJ* src = this->SourceProjection ? this->SourceProjection->GetProjection() : 0;
PROJ* dst = this->DestinationProjection ? this->DestinationProjection->GetProjection() : 0;
projPJ src = this->SourceProjection ? this->SourceProjection->GetProjection() : 0;
projPJ dst = this->DestinationProjection ? this->DestinationProjection->GetProjection() : 0;
if ( ! src && ! dst )
{
// we've already copied srcCoords to dstCoords and src=dst=0 implies no transform...
......@@ -156,20 +156,20 @@ vtkAbstractTransform* vtkGeoTransform::MakeTransform()
void vtkGeoTransform::InternalTransformPoints( double* x, vtkIdType numPts, int stride )
{
PROJ* src = this->SourceProjection ? this->SourceProjection->GetProjection() : 0;
PROJ* dst = this->DestinationProjection ? this->DestinationProjection->GetProjection() : 0;
projPJ src = this->SourceProjection ? this->SourceProjection->GetProjection() : 0;
projPJ dst = this->DestinationProjection ? this->DestinationProjection->GetProjection() : 0;
int delta = stride - 2;
PROJ_LP lp;
PROJ_XY xy;
projLP lp;
projXY xy;
if ( src )
{
// Convert from src system to lat/long using inverse of src transform
double* coord = x;
for ( vtkIdType i = 0; i < numPts; ++ i )
{
xy.x = coord[0]; xy.y = coord[1];
lp = proj_inv( xy, src );
coord[0] = lp.lam; coord[1] = lp.phi;
xy.u = coord[0]; xy.v = coord[1];
lp = pj_inv( xy, src );
coord[0] = lp.u; coord[1] = lp.v;
coord += stride;
}
}
......@@ -191,9 +191,9 @@ void vtkGeoTransform::InternalTransformPoints( double* x, vtkIdType numPts, int
double* coord = x;
for ( vtkIdType i = 0; i < numPts; ++ i )
{
lp.lam = coord[0]; lp.phi = coord[1];
xy = proj_fwd( lp, dst );
coord[0] = xy.x; coord[1] = xy.y;
lp.u = coord[0]; lp.v = coord[1];
xy = pj_fwd( lp, dst );
coord[0] = xy.u; coord[1] = xy.v;
coord += stride;
}
}
......
#!/usr/bin/env bash
set -e
set -x
shopt -s dotglob
readonly name="libproj4"
readonly ownership="Proj Upstream <kwrobot@kitware.com>"
readonly subtree="ThirdParty/$name/vtk$name"
readonly repo="https://gitlab.kitware.com/third-party/proj.git"
readonly tag="for/vtk"
readonly paths="
AUTHORS
ChangeLog
cmake/*.cmake
cmake/*.cmake.in
cmake/CMakeLists.txt
CMakeLists.txt
COPYING
src/CMakeLists.txt
src/proj.def
src/*.c
src/*.cmake
src/*.h
NEWS
README
.gitattributes
.gitignore
"
extract_source () {
git_archive
}
. "${BASH_SOURCE%/*}/../update-common.sh"
......@@ -18,9 +18,13 @@
/* Use the libproj4 library configured for VTK. */
#cmakedefine VTK_USE_SYSTEM_LIBPROJ4
#ifdef VTK_USE_SYSTEM_LIBPROJ4
# include <lib_proj.h>
# include <projects.h>
# include <proj_api.h>
# include <geodesic.h>
#else
# include <vtklibproj4/lib_proj.h>
# include <vtklibproj4/src/projects.h>
# include <vtklibproj4/src/proj_api.h>
# include <vtklibproj4/src/geodesic.h>
#endif
#endif
# Ignore whitespace for kwrobot
* -whitespace
*~
Makefile
CMakeFiles
CMakeCache.txt
CTestTestfile.cmake
cmake_install.cmake
install_manifest.txt
cmake/project-config*.cmake
/*.manifest
/*.swp
/autom4te.cache
/config.log
/config.status
/config.cache
/proj.pc
/nbproject
/bin
/lib
/DartConfiguration.tcl
/Testing
# html
/html/dl
/html/robots.txt
# nad
/nad/WI
/nad/prvi
/nad/WO
/nad/alaska
/nad/FL
/nad/README.NADUS
/nad/stpaul
/nad/stgeorge
/nad/TN
/nad/conus
/nad/MD
/nad/hawaii
/nad/stlrnc
/nad/null
/nad/*.lla
# src
/src/*.o
/src/*.lo
/src/*.la
/src/proj.dll
/src/*.lib
/src/*.pdb
/src/*.exp
/src/*.opt
/src/*.obj
/src/*.exe
/src/.libs
/src/.deps
/src/*.manifest
/src/*.swp
/src/nad2nad
/src/nad2bin
/src/proj
/src/geod
/src/stamp-h*
/src/proj_config.h
/src/cs2cs
/src/multistresstest
/src/test228
Original Author:
Gerald Evenden
Maintainer(s):
Frank Warmerdam <warmerdam@pobox.com>
Howard Butler <howard@hobu.co>
Contributors:
Brent Fraser <bfraser@geoanalytic.com>
Chris Stuber <imap@chesapeake.net>
Craig Bruce <cbruce@cubewerx.com>
Victor Osipkov <vctos@email.com>
Andrea Antonello <andrea.antonello@hydrologis.com>
Charles Karney <charles.karney@sri.com>
Karsten Engsager
Knud Poder
#------------------------------------------------------------------------------
# libproj4 -- library of cartographic projections
#################################################################################
#
project( libproj4 )
#------------------------------------------------------------------------------
# Platform configuration tests and options.
# Shared or static library?
if ( NOT DEFINED BUILD_SHARED_LIBS )
option( BUILD_SHARED_LIBS "Should libproj4 be built as a shared library (or static)?" OFF )
endif ()
# Only experts should turn this on:
option( PROJ_LIST_EXTERNAL "Does an external project define proj_list or should libproj4 define it?" OFF )
mark_as_advanced( PROJ_LIST_EXTERNAL )
if ( PROJ_LIST_EXTERNAL AND BUILD_SHARED_LIBS )
message( FATAL_ERROR "You may not define both PROJ_LIST_EXTERNAL and BUILD_SHARED_LIBS. Turn one off and re-run CMake." )
endif ()
# Make libproj4 thread-safe?
option( PROJ_USE_PTHREADS "Should libproj4 be built as a thread-friendly library?" ${VTK_USE_PTHREADS} )
mark_as_advanced( PROJ_USE_PTHREADS )
if ( PROJ_USE_PTHREADS )
if ( NOT VTK_USE_PTHREADS )
message( FATAL_ERROR "Your platform does not appear to support pthreads. Please turn PROJ_USE_PTHREADS off and retry." )
endif ()
endif ()
# Include code that requires GSL
option( PROJ_USE_GSL "Should libproj4 include projection code that relies on GSL?" OFF )
mark_as_advanced( PROJ_USE_GSL )
if ( PROJ_USE_GSL )
find_package( PkgConfig )
if ( PKG_CONFIG_FOUND )
pkg_check_modules( GSL REQUIRED gsl )
endif ()
if ( NOT GSL_FOUND )
message( FATAL_ERROR "You must install GSL and its pkg-config file OR turn PROJ_USE_GSL off" )
endif ()
endif ()
# Test for "double complex" type and "atanh()" support.
if ( UNIX )
set( LINK_LIBRARIES m )
endif ()
# This file is part of CMake configuration for PROJ4 library (inspired from SOCI
# CMake, Copyright (C) 2009-2010 Mateusz Loskot <mateusz@loskot.net> )
#
# Copyright (C) 2011 Nicolas David <nicolas.david@ign.fr>
# Distributed under the MIT license
#
#################################################################################
# General settings
#################################################################################
cmake_minimum_required(VERSION 2.6.0 FATAL_ERROR)
# proj4 is an ANSI C project
project(PROJ4 C)
set(PROJECT_INTERN_NAME PROJ)
#################################################################################
# PROJ4 CMake modules
#################################################################################
# Path to additional CMake modules
set(CMAKE_MODULE_PATH ${PROJ4_SOURCE_DIR}/cmake ${CMAKE_MODULE_PATH})
set(CMAKE_MODULE_PATH ${PROJ4_SOURCE_DIR}/cmake/modules ${CMAKE_MODULE_PATH})
include(Proj4Utilities)
message(STATUS "")
colormsg(_HIBLUE_ "Configuring PROJ:")
#################################################################################
#PROJ version information
#################################################################################
include(Proj4Version)
proj_version(MAJOR 4 MINOR 9 PATCH 2)
set(PROJ_API_VERSION "9")
set(PROJ_BUILD_VERSION "10.0.1")
#################################################################################
# Build features and variants
#################################################################################
include(Proj4SystemInfo)
include(Proj4Config)
include(Proj4Mac)
include(policies)
#################################################################################
# threading configuration
#################################################################################
set(CMAKE_THREAD_PREFER_PTHREAD TRUE)
find_package (Threads)
include(CheckIncludeFiles)
include(CheckSymbolExists)
set(CMAKE_REQUIRED_LIBRARIES m)
check_symbol_exists(csin complex.h PROJ_HAVE_COMPLEX)
check_symbol_exists(atanh math.h PROJ_HAVE_ATANH)
set(CMAKE_REQUIRED_LIBRARIES)
#------------------------------------------------------------------------------
# Source
set( AZIM_SRCS
proj_aeqd.c proj_aitoff.c proj_geos.c
proj_gilbert.c proj_gnom.c proj_hammer.c
proj_laea.c proj_mod_ster.c proj_nsper.c
proj_nzmg.c proj_ortho.c proj_rouss.c
proj_sterea.c proj_stere.c proj_wag7.c
proj_wag9.c
)
set( CONIC_SRCS
proj_aea.c proj_bipc.c proj_bonne.c
proj_eqdc.c proj_hill.c proj_imw_p.c
proj_kocc.c proj_lcca.c proj_lcc.c
proj_poly.c proj_rpoly.c proj_sconics.c
)
set( CYLIND_SRCS
proj_ardn_cls.c proj_braun2.c proj_cass.c
proj_cc.c proj_cea.c proj_cubic.c
proj_cyl_stere.c proj_eqc.c proj_labrd.c
proj_lsat.c proj_merc.c proj_mill_2.c
proj_mill.c proj_mill_per.c proj_ocea.c
proj_omerc.c proj_somerc.c proj_tcc.c
proj_tcea.c proj_tmerc.c proj_tob_sqr.c
proj_etmerc.c
)
if ( PROJ_HAVE_COMPLEX )
set( CYLIND_SRCS
${CYLIND_SRCS}
proj_ftmerc.c
)
endif ()
if ( PROJ_HAVE_ATANH )
set( CYLIND_SRCS
${CYLIND_SRCS}
proj_gstmerc.c
proj_ktmerc.c
)
CHECK_SYMBOL_EXISTS(PTHREAD_MUTEX_RECURSIVE pthread.h HAVE_PTHREAD_MUTEX_RECURSIVE_DEFN)
if (HAVE_PTHREAD_MUTEX_RECURSIVE_DEFN)
add_definitions(-DHAVE_PTHREAD_MUTEX_RECURSIVE=1)
endif()
boost_report_value(PROJ_PLATFORM_NAME)
boost_report_value(PROJ_COMPILER_NAME)
# Set a default build type for single-configuration cmake generators if
# no build type is set.
if (NOT CMAKE_CONFIGURATION_TYPES AND NOT CMAKE_BUILD_TYPE)
set (CMAKE_BUILD_TYPE Release)
endif ()
set( MISC_SRCS
proj_airy.c proj_apian2.c proj_armadillo.c
proj_august.c proj_bacon.c
proj_eisen.c proj_four1.c proj_guyou.c
proj_lagrng.c proj_larr.c proj_lask.c
proj_nocol.c proj_ob_tran.c proj_oea.c
proj_tpeqd.c proj_vandg2.c proj_vandg4.c
proj_vandg.c
)
set( PSEUDO_SRCS
proj_baker.c proj_baranyi4.c proj_baranyi.c
proj_boggs.c proj_collg.c proj_crast.c
proj_denoy.c proj_eck1.c proj_eck2.c
proj_eck3.c proj_eck4.c proj_eck5.c
proj_equi_moll.c proj_erdi_ksz.c proj_fahey.c
proj_fc-loerr.c proj_fouc_s.c proj_four2.c
proj_gins8.c proj_gn_sinu.c proj_goode.c
proj_hatano.c proj_holzel.c proj_loxim.c
proj_maurer.c proj_mayr.c proj_mbtfpp.c
proj_mbtfpq.c proj_mbt_fps.c proj_mcb_s3.c
proj_moll.c proj_nell.c
proj_oxford.c proj_putp2.c proj_putp3.c
proj_putp4p.c proj_putp5.c proj_putp6.c
proj_robin.c proj_semiconf.c proj_s_min_err.c
proj_sts.c proj_tob_g1.c proj_trapez.c
proj_urm5.c proj_urmfps.c proj_wag2.c
proj_wag3.c proj_wag5.c proj_wink1.c
proj_wink2.c
)
if ( PROJ_HAVE_ATANH )
set( PSEUDO_SRCS
${PSEUDO_SRCS}
proj_nell_h.c
)
if (MSVC OR CMAKE_CONFIGURATION_TYPES)
# For multi-config systems and for Visual Studio, the debug version of
# the library has _d appended.
set (CMAKE_DEBUG_POSTFIX _d)
endif ()
set( SUPPORT_SRCS
proj_adjlon.c proj_auth.c proj_deriv.c
proj_dmstor.c proj_ellps.c proj_ell_set.c
proj_err_list.c proj_errno.c proj_factors.c
proj_fwd.c proj_gauss.c proj_init.c
proj_inv.c proj_mdist.c
proj_msfn.c proj_param.c proj_phi2.c
proj_pr_list.c proj_rtodms.c proj_strerrno.c
proj_strerror_r.c proj_trans.c proj_translate.c
proj_tsfn.c proj_units.c proj_zpoly1.c
proj_psi.c
)
if ( NOT PROJ_LIST_EXTERNAL )
set( SUPPORT_SRCS
${SUPPORT_SRCS}
proj_list.c
)
#------------------------------------------------------------------------------
# Doesn't work with CMake 2.4
# set_source_files_properties(
# FILES
# proj_list.c
# PROPERTIES
# OBJECT_DEPENDS ${libproj4_SOURCE_DIR}/proj_list.h
# )
endif ()
#################################################################################
# Installation
#################################################################################
include(Proj4InstallPath)
set(LIBPROJ_BINDIR "${DEFAULT_BINDIR}" CACHE PATH "The directory to install binaries into.")
set(LIBPROJ_LIBDIR "${DEFAULT_LIBDIR}" CACHE PATH "The directory to install libraries into.")
set(LIBPROJ_DATADIR "${DEFAULT_DATADIR}" CACHE PATH "The directory to install data files into.")
set(LIBPROJ_DOCDIR "${DEFAULT_DOCDIR}" CACHE PATH "The directory to install doc files into.")
set(LIBPROJ_INCLUDEDIR "${DEFAULT_INCLUDEDIR}" CACHE PATH "The directory to install includes into.")
set( LP4_SRCS
${AZIM_SRCS} ${CONIC_SRCS} ${CYLIND_SRCS}
${MISC_SRCS} ${PSEUDO_SRCS} ${SUPPORT_SRCS}
)
mark_as_advanced(LIBPROJ_BINDIR LIBPROJ_LIBDIR LIBPROJ_DATADIR LIBPROJ_DOCDIR LIBPROJ_INCLUDEDIR)
#------------------------------------------------------------------------------
# Executable and library targets
#################################################################################
# Build configured components
#################################################################################
include_directories(${PROJ4_SOURCE_DIR}/src)
include_directories(
${libproj4_SOURCE_DIR}
${libproj4_BINARY_DIR}
)
vtk_add_library( vtkproj4
${LP4_SRCS}
)
if ( UNIX )
target_link_libraries( vtkproj4
LINK_PUBLIC
m
)
endif ()
if ( PROJ_LIBRARY_PROPERTIES )
set_target_properties( vtkproj4
PROPERTIES
${PROJ_LIBRARY_PROPERTIES}
)
endif ()
add_executable( lproj
lproj.c
)
target_link_libraries( lproj
vtkproj4
)
if ( GSL_FOUND )
include_directories( GSL_INCLUDE_DIRS )
target_link_libraries( proj4
${GSL_LIBRARIES}
)
endif ()
message(STATUS "")
add_subdirectory(src)
add_subdirectory(cmake)
configure_file(
${libproj4_SOURCE_DIR}/proj_config.h.cmake