Add upstream patch for proj 5 support
This commit is contained in:
parent
3304f8febe
commit
b901524ddd
131
vtk-proj5.patch
Normal file
131
vtk-proj5.patch
Normal file
@ -0,0 +1,131 @@
|
||||
diff -up VTK-9.0.1/Geovis/Core/vtkGeoProjection.cxx.proj5 VTK-9.0.1/Geovis/Core/vtkGeoProjection.cxx
|
||||
--- VTK-9.0.1/Geovis/Core/vtkGeoProjection.cxx.proj5 2020-06-26 07:24:40.000000000 -0600
|
||||
+++ VTK-9.0.1/Geovis/Core/vtkGeoProjection.cxx 2021-03-13 11:36:29.049321435 -0700
|
||||
@@ -121,7 +121,11 @@ vtkGeoProjection::~vtkGeoProjection()
|
||||
this->SetPROJ4String(nullptr);
|
||||
if (this->Projection)
|
||||
{
|
||||
+#if PROJ_VERSION_MAJOR >= 5
|
||||
+ proj_destroy(this->Projection);
|
||||
+#else
|
||||
pj_free(this->Projection);
|
||||
+#endif
|
||||
}
|
||||
delete this->Internals;
|
||||
this->Internals = nullptr;
|
||||
@@ -185,13 +189,21 @@ int vtkGeoProjection::UpdateProjection()
|
||||
|
||||
if (this->Projection)
|
||||
{
|
||||
+#if PROJ_VERSION_MAJOR >= 5
|
||||
+ proj_destroy(this->Projection);
|
||||
+#else
|
||||
pj_free(this->Projection);
|
||||
+#endif
|
||||
this->Projection = nullptr;
|
||||
}
|
||||
|
||||
if (this->PROJ4String && strlen(this->PROJ4String))
|
||||
{
|
||||
+#if PROJ_VERSION_MAJOR >= 5
|
||||
+ this->Projection = proj_create(PJ_DEFAULT_CTX, this->PROJ4String);
|
||||
+#else
|
||||
this->Projection = pj_init_plus(this->PROJ4String);
|
||||
+#endif
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -230,8 +242,11 @@ int vtkGeoProjection::UpdateProjection()
|
||||
stringHolder[i] = param.str();
|
||||
pjArgs[3 + i] = stringHolder[i].c_str();
|
||||
}
|
||||
-
|
||||
+#if PROJ_VERSION_MAJOR >= 5
|
||||
+ this->Projection = proj_create_argv(PJ_DEFAULT_CTX, argSize, const_cast<char**>(pjArgs));
|
||||
+#else
|
||||
this->Projection = pj_init(argSize, const_cast<char**>(pjArgs));
|
||||
+#endif
|
||||
delete[] pjArgs;
|
||||
}
|
||||
this->ProjectionMTime = this->GetMTime();
|
||||
diff -up VTK-9.0.1/Geovis/Core/vtkGeoTransform.cxx.proj5 VTK-9.0.1/Geovis/Core/vtkGeoTransform.cxx
|
||||
--- VTK-9.0.1/Geovis/Core/vtkGeoTransform.cxx.proj5 2020-06-26 07:24:40.000000000 -0600
|
||||
+++ VTK-9.0.1/Geovis/Core/vtkGeoTransform.cxx 2021-03-13 11:35:13.646115813 -0700
|
||||
@@ -163,8 +163,12 @@ void vtkGeoTransform::InternalTransformP
|
||||
projPJ src = this->SourceProjection ? this->SourceProjection->GetProjection() : nullptr;
|
||||
projPJ dst = this->DestinationProjection ? this->DestinationProjection->GetProjection() : nullptr;
|
||||
int delta = stride - 2;
|
||||
+#if PROJ_VERSION_MAJOR >= 5
|
||||
+ PJ_COORD c, c_out;
|
||||
+#else
|
||||
projLP lp;
|
||||
projXY xy;
|
||||
+#endif
|
||||
if (src)
|
||||
{
|
||||
// Convert from src system to lat/long using inverse of src transform
|
||||
@@ -172,17 +176,15 @@ void vtkGeoTransform::InternalTransformP
|
||||
for (vtkIdType i = 0; i < numPts; ++i)
|
||||
{
|
||||
#if PROJ_VERSION_MAJOR >= 5
|
||||
- xy.x = coord[0];
|
||||
- xy.y = coord[1];
|
||||
+ c.xy.x = coord[0];
|
||||
+ c.xy.y = coord[1];
|
||||
+ c_out = proj_trans(src, PJ_INV, c);
|
||||
+ coord[0] = c_out.lp.lam;
|
||||
+ coord[1] = c_out.lp.phi;
|
||||
#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
|
||||
@@ -208,17 +210,15 @@ void vtkGeoTransform::InternalTransformP
|
||||
for (vtkIdType i = 0; i < numPts; ++i)
|
||||
{
|
||||
#if PROJ_VERSION_MAJOR >= 5
|
||||
- lp.lam = coord[0];
|
||||
- lp.phi = coord[1];
|
||||
+ c.lp.lam = coord[0];
|
||||
+ c.lp.phi = coord[1];
|
||||
+ c_out = proj_trans(src, PJ_FWD, c);
|
||||
+ coord[0] = c_out.xy.x;
|
||||
+ coord[1] = c_out.xy.y;
|
||||
#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
|
||||
diff -up VTK-9.0.1/ThirdParty/libproj/vtk_libproj.h.in.proj5 VTK-9.0.1/ThirdParty/libproj/vtk_libproj.h.in
|
||||
--- VTK-9.0.1/ThirdParty/libproj/vtk_libproj.h.in.proj5 2020-06-26 07:24:40.000000000 -0600
|
||||
+++ VTK-9.0.1/ThirdParty/libproj/vtk_libproj.h.in 2021-03-13 11:35:13.646115813 -0700
|
||||
@@ -28,14 +28,9 @@
|
||||
#if VTK_MODULE_USE_EXTERNAL_vtklibproj
|
||||
# if VTK_LibPROJ_MAJOR_VERSION >= 5
|
||||
# include <proj.h>
|
||||
-# endif
|
||||
-# if VTK_LibPROJ_MAJOR_VERSION < 6
|
||||
+# else
|
||||
# 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
|
||||
# include <vtklibproj/src/projects.h>
|
6
vtk.spec
6
vtk.spec
@ -54,6 +54,8 @@ Patch3: vtk-AllValues.patch
|
||||
# Temporary patch for building against freetype-2.10.4, which removed FT_CALLBACK_DEF,
|
||||
# but was later re-added in https://git.savannah.gnu.org/cgit/freetype/freetype2.git/commit/?id=b0667d2d36fb134d48030b2a560eaaa37810d6ba
|
||||
Patch4: vtk_freetype-2.10.4.patch
|
||||
# Proj 5 support - backport https://gitlab.kitware.com/vtk/vtk/-/merge_requests/7731
|
||||
Patch5: vtk-proj5.patch
|
||||
|
||||
URL: https://vtk.org/
|
||||
|
||||
@ -428,6 +430,7 @@ programming languages.
|
||||
%patch2 -p1 -b .includes
|
||||
%patch3 -p1 -b .AllValues
|
||||
%patch4 -p1 -b .freetype
|
||||
%patch5 -p1 -b .proj5
|
||||
# Remove included thirdparty sources just to be sure
|
||||
# TODO - diy2 - not yet packaged
|
||||
# TODO - exodusII - not yet packaged
|
||||
@ -775,6 +778,9 @@ cat xorg.log
|
||||
|
||||
|
||||
%changelog
|
||||
* Sat Mar 13 2021 Orion Poplawski <orion@nwra.com> - 9.0.1-4
|
||||
- Add upstream patch for proj 5 support
|
||||
|
||||
* Sun Mar 07 2021 Sandro Mani <manisandro@gmail.com> - 9.0.1-4
|
||||
- Rebuild (proj)
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user