265 lines
8.7 KiB
Diff
265 lines
8.7 KiB
Diff
--- a/CMake/FindLibPROJ.cmake
|
|
+++ b/CMake/FindLibPROJ.cmake
|
|
@@ -30,7 +30,7 @@ if ( NOT LibPROJ_INCLUDE_DIR OR NOT LibP
|
|
)
|
|
|
|
find_path( LibPROJ_INCLUDE_DIR
|
|
- NAMES proj_api.h
|
|
+ NAMES proj_api.h proj.h
|
|
HINTS
|
|
${_LibPROJ_DIR}
|
|
${_LibPROJ_DIR}/include
|
|
--- a/Geovis/Core/vtkGeoProjection.cxx
|
|
+++ b/Geovis/Core/vtkGeoProjection.cxx
|
|
@@ -72,6 +72,9 @@ public:
|
|
}
|
|
|
|
std::map< std::string, std::string > OptionalParameters;
|
|
+#if PROJ_VERSION_MAJOR >= 5
|
|
+ PJ_PROJ_INFO ProjInfo;
|
|
+#endif
|
|
};
|
|
|
|
//-----------------------------------------------------------------------------
|
|
@@ -80,7 +83,7 @@ int vtkGeoProjection::GetNumberOfProject
|
|
if ( vtkGeoProjectionNumProj < 0 )
|
|
{
|
|
vtkGeoProjectionNumProj = 0;
|
|
- for ( const PJ_LIST* pj = pj_get_list_ref(); pj && pj->id; ++ pj )
|
|
+ for ( const PJ_LIST* pj = proj_list_operations(); pj && pj->id; ++ pj )
|
|
++ vtkGeoProjectionNumProj;
|
|
}
|
|
return vtkGeoProjectionNumProj;
|
|
@@ -91,7 +94,7 @@ const char* vtkGeoProjection::GetProject
|
|
if ( projection < 0 || projection >= vtkGeoProjection::GetNumberOfProjections() )
|
|
return nullptr;
|
|
|
|
- return pj_get_list_ref()[projection].id;
|
|
+ return proj_list_operations()[projection].id;
|
|
}
|
|
//-----------------------------------------------------------------------------
|
|
const char* vtkGeoProjection::GetProjectionDescription( int projection )
|
|
@@ -99,7 +102,7 @@ const char* vtkGeoProjection::GetProject
|
|
if ( projection < 0 || projection >= vtkGeoProjection::GetNumberOfProjections() )
|
|
return nullptr;
|
|
|
|
- return pj_get_list_ref()[projection].descr[0];
|
|
+ return proj_list_operations()[projection].descr[0];
|
|
}
|
|
//-----------------------------------------------------------------------------
|
|
vtkGeoProjection::vtkGeoProjection()
|
|
@@ -144,7 +147,7 @@ void vtkGeoProjection::PrintSelf( ostrea
|
|
int vtkGeoProjection::GetIndex()
|
|
{
|
|
int i = 0;
|
|
- for ( const PJ_LIST* proj = pj_get_list_ref(); proj && proj->id; ++ proj, ++ i )
|
|
+ for ( const PJ_LIST* proj = proj_list_operations(); proj && proj->id; ++ proj, ++ i )
|
|
{
|
|
if ( ! strcmp( proj->id, this->Name ) )
|
|
{
|
|
@@ -161,7 +164,11 @@ const char* vtkGeoProjection::GetDescrip
|
|
{
|
|
return nullptr;
|
|
}
|
|
+#if PROJ_VERSION_MAJOR >= 5
|
|
+ return this->Internals->ProjInfo.description;
|
|
+#else
|
|
return this->Projection->descr;
|
|
+#endif
|
|
}
|
|
//-----------------------------------------------------------------------------
|
|
projPJ vtkGeoProjection::GetProjection()
|
|
@@ -232,6 +239,9 @@ int vtkGeoProjection::UpdateProjection()
|
|
this->ProjectionMTime = this->GetMTime();
|
|
if ( this->Projection )
|
|
{
|
|
+#if PROJ_VERSION_MAJOR >= 5
|
|
+ this->Internals->ProjInfo = proj_pj_info(this->Projection);
|
|
+#endif
|
|
return 0;
|
|
}
|
|
return 1;
|
|
--- a/Geovis/Core/vtkGeoTransform.cxx
|
|
+++ b/Geovis/Core/vtkGeoTransform.cxx
|
|
@@ -167,9 +167,17 @@ void vtkGeoTransform::InternalTransformP
|
|
double* coord = x;
|
|
for ( vtkIdType i = 0; i < numPts; ++ i )
|
|
{
|
|
+#if PROJ_VERSION_MAJOR >= 5
|
|
+ xy.x = coord[0]; xy.y = coord[1];
|
|
+#else
|
|
xy.u = coord[0]; xy.v = coord[1];
|
|
+#endif
|
|
lp = pj_inv( xy, src );
|
|
+#if PROJ_VERSION_MAJOR >= 5
|
|
+ coord[0] = lp.lam; coord[1] = lp.phi;
|
|
+#else
|
|
coord[0] = lp.u; coord[1] = lp.v;
|
|
+#endif
|
|
coord += stride;
|
|
}
|
|
}
|
|
@@ -191,9 +199,17 @@ void vtkGeoTransform::InternalTransformP
|
|
double* coord = x;
|
|
for ( vtkIdType i = 0; i < numPts; ++ i )
|
|
{
|
|
+#if PROJ_VERSION_MAJOR >= 5
|
|
+ lp.lam = coord[0]; lp.phi = coord[1];
|
|
+#else
|
|
lp.u = coord[0]; lp.v = coord[1];
|
|
+#endif
|
|
xy = pj_fwd( lp, dst );
|
|
+#if PROJ_VERSION_MAJOR >= 5
|
|
+ coord[0] = xy.x; coord[1] = xy.y;
|
|
+#else
|
|
coord[0] = xy.u; coord[1] = xy.v;
|
|
+#endif
|
|
coord += stride;
|
|
}
|
|
}
|
|
--- a/ThirdParty/libproj/vtk_libproj.h.in
|
|
+++ b/ThirdParty/libproj/vtk_libproj.h.in
|
|
@@ -15,10 +15,20 @@
|
|
#ifndef vtk_libproj_h
|
|
#define vtk_libproj_h
|
|
|
|
+#define VTK_LibPROJ_MAJOR_VERSION @LibPROJ_MAJOR_VERSION@
|
|
+
|
|
/* Use the libproj library configured for VTK. */
|
|
#cmakedefine VTK_USE_SYSTEM_LIBPROJ
|
|
#ifdef VTK_USE_SYSTEM_LIBPROJ
|
|
-# include <projects.h>
|
|
+# if VTK_LibPROJ_MAJOR_VERSION >= 5
|
|
+# include <proj.h>
|
|
+# endif
|
|
+# if VTK_LibPROJ_MAJOR_VERSION < 6
|
|
+# include <projects.h>
|
|
+# endif
|
|
+# if VTK_LibPROJ_MAJOR_VERSION >= 6
|
|
+# define ACCEPT_USE_OF_DEPRECATED_PROJ_API_H 1
|
|
+# endif
|
|
# include <proj_api.h>
|
|
# include <geodesic.h>
|
|
#else
|
|
--- VTK-8.2.0/CMake/FindLibPROJ.cmake 2019-09-11 22:13:29.493741215 -0600
|
|
+++ vtk/CMake/FindLibPROJ.cmake 2019-09-11 19:56:57.465802610 -0600
|
|
@@ -1,55 +1,67 @@
|
|
-# Find LibPROJ library and header file
|
|
-# Sets
|
|
-# LibPROJ_FOUND to 0 or 1 depending on the result
|
|
-# LibPROJ_INCLUDE_DIR to directories required for using libproj4
|
|
-# LibPROJ_LIBRARIES to libproj4 and any dependent libraries
|
|
-# If LibPROJ_REQUIRED is defined, then a fatal error message will be generated if libproj4 is not found
|
|
-
|
|
-if ( NOT LibPROJ_INCLUDE_DIR OR NOT LibPROJ_LIBRARIES OR NOT LibPROJ_FOUND )
|
|
+find_path(LibPROJ_INCLUDE_DIR
|
|
+ NAMES proj_api.h proj.h
|
|
+ DOC "libproj include directories")
|
|
+mark_as_advanced(LibPROJ_INCLUDE_DIR)
|
|
|
|
- if ( $ENV{LibPROJ_DIR} )
|
|
- file( TO_CMAKE_PATH "$ENV{LibPROJ_DIR}" _LibPROJ_DIR )
|
|
+find_library(LibPROJ_LIBRARY_RELEASE
|
|
+ NAMES proj
|
|
+ DOC "libproj release library")
|
|
+mark_as_advanced(LibPROJ_LIBRARY_RELEASE)
|
|
+
|
|
+find_library(LibPROJ_LIBRARY_DEBUG
|
|
+ NAMES projd
|
|
+ DOC "libproj debug library")
|
|
+mark_as_advanced(LibPROJ_LIBRARY_DEBUG)
|
|
+
|
|
+include(SelectLibraryConfigurations)
|
|
+select_library_configurations(LibPROJ)
|
|
+
|
|
+if (LibPROJ_INCLUDE_DIR)
|
|
+ if (EXISTS "${LibPROJ_INCLUDE_DIR}/proj.h")
|
|
+ file(STRINGS "${LibPROJ_INCLUDE_DIR}/proj.h" _libproj_version_lines REGEX "#define[ \t]+PROJ_VERSION_(MAJOR|MINOR|PATCH)")
|
|
+ string(REGEX REPLACE ".*PROJ_VERSION_MAJOR *\([0-9]*\).*" "\\1" _libproj_version_major "${_libproj_version_lines}")
|
|
+ string(REGEX REPLACE ".*PROJ_VERSION_MINOR *\([0-9]*\).*" "\\1" _libproj_version_minor "${_libproj_version_lines}")
|
|
+ string(REGEX REPLACE ".*PROJ_VERSION_PATCH *\([0-9]*\).*" "\\1" _libproj_version_patch "${_libproj_version_lines}")
|
|
+ else ()
|
|
+ file(STRINGS "${LibPROJ_INCLUDE_DIR}/proj_api.h" _libproj_version_lines REGEX "#define[ \t]+PJ_VERSION")
|
|
+ string(REGEX REPLACE ".*PJ_VERSION *\([0-9]*\).*" "\\1" _libproj_version "${_libproj_version_lines}")
|
|
+ math(EXPR _libproj_version_major "${_libproj_version} / 100")
|
|
+ math(EXPR _libproj_version_minor "(${_libproj_version} % 100) / 10")
|
|
+ math(EXPR _libproj_version_patch "${_libproj_version} % 10")
|
|
endif ()
|
|
-
|
|
- set(LibPROJ_LIBRARY_SEARCH_PATHS
|
|
- ${_LibPROJ_DIR}
|
|
- ${_LibPROJ_DIR}/lib64
|
|
- ${_LibPROJ_DIR}/lib
|
|
- )
|
|
-
|
|
- find_library( LibPROJ_LIBRARY_RELEASE
|
|
- NAMES proj
|
|
- HINTS
|
|
- ${LibPROJ_LIBRARY_SEARCH_PATHS}
|
|
- )
|
|
-
|
|
- find_library( LibPROJ_LIBRARY_DEBUG
|
|
- NAMES projd
|
|
- PATHS
|
|
- ${LibPROJ_LIBRARY_SEARCH_PATHS}
|
|
- )
|
|
-
|
|
- find_path( LibPROJ_INCLUDE_DIR
|
|
- NAMES proj_api.h proj.h
|
|
- HINTS
|
|
- ${_LibPROJ_DIR}
|
|
- ${_LibPROJ_DIR}/include
|
|
- )
|
|
-
|
|
- include(SelectLibraryConfigurations)
|
|
- select_library_configurations(LibPROJ)
|
|
-
|
|
- include(FindPackageHandleStandardArgs)
|
|
- find_package_handle_standard_args(LibPROJ
|
|
- REQUIRED_VARS LibPROJ_LIBRARY LibPROJ_INCLUDE_DIR)
|
|
-
|
|
- if(LibPROJ_FOUND)
|
|
- set(LibPROJ_INCLUDE_DIRS ${LibPROJ_INCLUDE_DIR})
|
|
-
|
|
- if(NOT LibPROJ_LIBRARIES)
|
|
- set(LibPROJ_LIBRARIES ${LibPROJ_LIBRARY})
|
|
- endif()
|
|
- endif()
|
|
+ set(LibPROJ_VERSION "${_libproj_version_major}.${_libproj_version_minor}.${_libproj_version_patch}")
|
|
+ set(LibPROJ_MAJOR_VERSION "${_libproj_version_major}")
|
|
+ unset(_libproj_version_major)
|
|
+ unset(_libproj_version_minor)
|
|
+ unset(_libproj_version_patch)
|
|
+ unset(_libproj_version)
|
|
+ unset(_libproj_version_lines)
|
|
endif ()
|
|
|
|
-mark_as_advanced(LibPROJ_INCLUDE_DIR)
|
|
+include(FindPackageHandleStandardArgs)
|
|
+find_package_handle_standard_args(LibPROJ
|
|
+ REQUIRED_VARS LibPROJ_LIBRARY LibPROJ_INCLUDE_DIR
|
|
+ VERSION_VAR LibPROJ_VERSION)
|
|
+
|
|
+if (LibPROJ_FOUND)
|
|
+ set(LibPROJ_INCLUDE_DIRS "${LibPROJ_INCLUDE_DIR}")
|
|
+ set(LibPROJ_LIBRARIES "${LibPROJ_LIBRARY}")
|
|
+
|
|
+ if (NOT TARGET LibPROJ::LibPROJ)
|
|
+ add_library(LibPROJ::LibPROJ UNKNOWN IMPORTED)
|
|
+ set_target_properties(LibPROJ::LibPROJ PROPERTIES
|
|
+ INTERFACE_INCLUDE_DIRECTORIES "${LibPROJ_INCLUDE_DIR}")
|
|
+ if (LibPROJ_LIBRARY_RELEASE)
|
|
+ set_property(TARGET LibPROJ::LibPROJ APPEND PROPERTY
|
|
+ IMPORTED_CONFIGURATIONS RELEASE)
|
|
+ set_target_properties(LibPROJ::LibPROJ PROPERTIES
|
|
+ IMPORTED_LOCATION_RELEASE "${LibPROJ_LIBRARY_RELEASE}")
|
|
+ endif ()
|
|
+ if (LibPROJ_LIBRARY_DEBUG)
|
|
+ set_property(TARGET LibPROJ::LibPROJ APPEND PROPERTY
|
|
+ IMPORTED_CONFIGURATIONS DEBUG)
|
|
+ set_target_properties(LibPROJ::LibPROJ PROPERTIES
|
|
+ IMPORTED_LOCATION_DEBUG "${LibPROJ_LIBRARY_DEBUG}")
|
|
+ endif ()
|
|
+ endif ()
|
|
+endif ()
|