Commit a455ae1c authored by Aashish Chaudhary's avatar Aashish Chaudhary Committed by Dan Lipsa
Browse files

Updated to use proj47 or higher



Conflicts:
	Geovis/Core/vtkGeoTransform.cxx
Co-authored-by: Dan Lipsa's avatarDan Lipsa <dan.lipsa@kitware.com>
parent 09d0f189
Pipeline #7028 passed with stage
......@@ -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;
}
}
......
......@@ -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
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment