Commit d5e87276 authored by Will Schroeder's avatar Will Schroeder
Browse files

ENH:Provide alternative origin (sea level rather than the min of the elevation bounding box)

parent ef10382f
......@@ -20,7 +20,7 @@
#include "vtkStreamingDemandDrivenPipeline.h"
#include "vtkPointData.h"
vtkCxxRevisionMacro(vtkDEMReader, "1.38");
vtkCxxRevisionMacro(vtkDEMReader, "1.39");
vtkStandardNewMacro(vtkDEMReader);
#define VTK_SW 0
......@@ -73,6 +73,7 @@ vtkDEMReader::vtkDEMReader()
{
this->SpatialResolution[i] = 0;
}
this->ElevationReference = REFERENCE_ELEVATION_BOUNDS;
this->SetNumberOfInputPorts(0);
}
......@@ -347,7 +348,14 @@ void vtkDEMReader::ComputeExtentOriginAndSpacing (int extent[6],
//
origin[0] = this->GroundCoords[VTK_SW][0];
origin[1] = this->GroundCoords[VTK_SW][1];
origin[2] = this->ElevationBounds[0];
if ( this->ElevationReference == REFERENCE_ELEVATION_BOUNDS )
{
origin[2] = this->ElevationBounds[0];
}
else //REFERENCE_SEA_LEVEL
{
origin[2] = 0.0;
}
spacing[0] = this->SpatialResolution[0] * planeConversion;
spacing[1] = this->SpatialResolution[1] * planeConversion;
......
......@@ -39,6 +39,22 @@ public:
vtkSetStringMacro(FileName);
vtkGetStringMacro(FileName);
//BTX
enum {REFERENCE_SEA_LEVEL=0,REFERENCE_ELEVATION_BOUNDS};
//ETX
// Description:
// Specify the elevation origin to use. By default, the elevation origin
// is equal to ElevationBounds[0]. A more convenient origin is to use sea
// level (i.e., a value of 0.0).
vtkSetClampMacro(ElevationReference,int,REFERENCE_SEA_LEVEL,
REFERENCE_ELEVATION_BOUNDS);
vtkGetMacro(ElevationReference,int);
void SetElevationReferenceToSeaLevel()
{this->SetElevationReference(REFERENCE_SEA_LEVEL);}
void SetElevationReferenceToElevationBounds()
{this->SetElevationReference(REFERENCE_ELEVATION_BOUNDS);}
// Description:
// An ASCII description of the map
vtkGetStringMacro(MapLabel);
......@@ -134,6 +150,8 @@ protected:
float SpatialResolution[3];
int ProfileDimension[2];
int ProfileSeekOffset;
int ElevationReference;
void ComputeExtentOriginAndSpacing (int extent[6],
double origin[6],
double spacing[6]);
......
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