vtElevationGrid Class Reference

Inheritance diagram for vtElevationGrid:

Inheritance graph
[legend]

List of all members.

Public Member Functions

 vtElevationGrid ()
 vtElevationGrid (const vtElevationGrid &rhs)
 vtElevationGrid (const DRECT &area, int iColumns, int iRows, bool bFloat, const vtProjection &proj)
virtual ~vtElevationGrid ()
vtElevationGridoperator= (const vtElevationGrid &rhs)
bool CopyFrom (const vtElevationGrid &rhs)
bool CopyHeaderFrom (const vtElevationGrid &rhs)
bool CopyDataFrom (const vtElevationGrid &rhs)
bool Create (const DRECT &area, int iColumns, int iRows, bool bFloat, const vtProjection &proj)
void FreeData ()
bool ConvertProjection (vtElevationGrid *pOld, const vtProjection &NewProj, float bUpgradeToFloat, bool progress_callback(int)=NULL)
bool ReprojectExtents (const vtProjection &proj_new)
void Scale (float fScale, bool bDirect, bool bRecomputeExtents=true)
void VertOffset (float fAmount)
void ComputeHeightExtents ()
void Offset (const DPoint2 &delta)
int ReplaceValue (float value1, float value2)
bool FillGaps (DRECT *area=NULL, bool progress_callback(int)=NULL)
bool FillGapsSmooth (DRECT *area=NULL, bool progress_callback(int)=NULL)
int FillGapsByRegionGrowing (int radius_start=2, int radius_stop=5, bool progress_callback(int)=NULL)
int FillGapsByRegionGrowing (int radius, bool progress_callback(int)=NULL)
bool LoadFromFile (const char *szFileName, bool progress_callback(int)=NULL)
bool LoadFrom3TX (const char *szFileName, bool progress_callback(int)=NULL)
bool LoadFromASC (const char *szFileName, bool progress_callback(int)=NULL)
bool LoadFromDEM (const char *szFileName, bool progress_callback(int)=NULL)
bool LoadFromTerragen (const char *szFileName, bool progress_callback(int)=NULL)
bool LoadFromCDF (const char *szFileName, bool progress_callback(int)=NULL)
bool LoadFromDTED (const char *szFileName, bool progress_callback(int)=NULL)
bool LoadFromGTOPO30 (const char *szFileName, bool progress_callback(int)=NULL)
bool LoadFromGLOBE (const char *szFileName, bool progress_callback(int)=NULL)
bool LoadFromGRD (const char *szFileName, bool progress_callback(int)=NULL)
bool LoadFromDSAA (const char *szFileName, bool progress_callback(int)=NULL)
bool LoadFromPGM (const char *szFileName, bool progress_callback(int)=NULL)
bool LoadFromRAW (const char *szFileName, int width, int height, int bytes_per_element, float vertical_units, bool bBigEndian, bool progress_callback(int))
bool LoadFromMicroDEM (const char *szFileName, bool progress_callback(int)=NULL)
bool LoadFromXYZ (const char *szFileName, bool progress_callback(int)=NULL)
bool LoadFromXYZ (FILE *fp, const char *format, bool progress_callback(int)=NULL)
bool LoadFromHGT (const char *szFileName, bool progress_callback(int)=NULL)
bool LoadFromBT (const char *szFileName, bool progress_callback(int)=NULL, vtElevGridError *err=NULL)
bool LoadBTHeader (const char *szFileName, vtElevGridError *err=NULL)
bool LoadBTData (const char *szFileName, bool progress_callback(int)=NULL, vtElevGridError *err=NULL)
bool LoadWithGDAL (const char *szFileName, bool progress_callback(int)=NULL)
bool LoadFromNTF5 (const char *szFileName, bool progress_callback(int)=NULL)
vtString GetErrorMsg ()
bool SaveTo3TX (const char *szFileName, bool progress_callback(int)=NULL)
bool SaveToGeoTIFF (const char *szFileName) const
bool SaveToBMP (const char *szFileName) const
bool SaveToTerragen (const char *szFileName) const
bool SaveToBT (const char *szFileName, bool progress_callback(int)=NULL, bool bGZip=false)
bool SaveToSTM (const char *szFileName, bool progress_callback(int)=NULL)
bool SaveToPlanet (const char *szDirName, bool progress_callback(int)=NULL)
bool SaveToASC (const char *szFileName, bool progress_callback(int)=NULL) const
bool SaveToVRML (const char *szFileName, bool progress_callback(int)=NULL) const
bool SaveToXYZ (const char *szFileName, bool progress_callback(int)=NULL) const
bool SaveToRAWINF (const char *szFileName, bool progress_callback(int)=NULL) const
bool SaveToPNG16 (const char *fname)
void SetFValue (int i, int j, float value)
void SetValue (int i, int j, short value)
short GetValue (int i, int j) const
float GetFValue (int i, int j) const
float GetFValueSafe (int i, int j) const
float GetClosestValue (const DPoint2 &p) const
float GetFilteredValue (const DPoint2 &p) const
const char * GetDEMName ()
DRECT GetAreaExtents () const
bool IsFloatMode () const
void FillWithSingleValue (float fValue)
void GetEarthPoint (int i, int j, DPoint2 &p) const
void GetEarthLocation (int i, int j, DPoint3 &loc) const
vtProjectionGetProjection ()
const vtProjectionGetProjection () const
void SetProjection (const vtProjection &proj)
bool GetCorners (DLine2 &line, bool bGeo) const
void SetCorners (const DLine2 &line)
short * GetData ()
float * GetFloatData ()
const short * GetData () const
const float * GetFloatData () const
void SetScale (float sc)
float GetScale () const
bool HasData () const
int MemoryNeeded () const
int MemoryUsed () const
bool FindAltitudeOnEarth (const DPoint2 &p, float &fAltitude, bool bTrue=false) const
virtual float GetElevation (int iX, int iZ, bool bTrue=false) const
virtual void GetWorldLocation (int i, int j, FPoint3 &loc, bool bTrue=false) const
void SetupConversion (float fVerticalExag=1.0f)
float GetWorldValue (int i, int j, bool bTrue=false) const
bool FindAltitudeAtPoint (const FPoint3 &p3, float &fAltitude, bool bTrue=false, int iCultureFlags=0, FPoint3 *vNormal=NULL) const

Protected Member Functions

void ComputeExtentsFromCorners ()
void ComputeCornersFromExtents ()
bool ParseNTF5 (OGRDataSource *pDatasource, vtString &msg, bool progress_callback(int))
bool GetXYZLine (const char *buf, const char *pattern, const char *format, int components, double *x, double *y, double *z)
bool _AllocateArray ()

Protected Attributes

bool m_bFloatMode
short * m_pData
float * m_pFData
float m_fVMeters
float m_fVerticalScale
DPoint2 m_Corners [4]
vtProjection m_proj
vtString m_strOriginalDEMName
vtString m_strError


Detailed Description

The vtElevationGrid class represents a generic grid of elevation data. It supports reading and writing the data from many file formats, testing the height at any given point, reprojecting the grid between coordinate systems, and many other operations.

Height elements ("heixels") can be either integer (2 bytes) or floating point (4 bytes). Heixel values are always in meters. Areas of unknown elevation are represented by the value INVALID_ELEVATION.

To load a grid from a file, first create an empty grid, then call the appropriated Load method.


Constructor & Destructor Documentation

vtElevationGrid::vtElevationGrid (  ) 

Constructor: Creates an empty grid.

vtElevationGrid::vtElevationGrid ( const vtElevationGrid rhs  ) 

Copy constructor.

vtElevationGrid::vtElevationGrid ( const DRECT area,
int  iColumns,
int  iRows,
bool  bFloat,
const vtProjection proj 
)

Constructor: Creates a grid of given size.

Parameters:
area the coordinate extents of the grid (rectangular area)
iColumns number of columns in the grid (east-west)
iRows number of rows (north-south)
bFloat data size: true to use floating-point, false for shorts.
proj the geographical projection to use.
The grid will initially have no data in it (all values are INVALID_ELEVATION).

vtElevationGrid::~vtElevationGrid (  )  [virtual]

Destructor


Member Function Documentation

void vtElevationGrid::ComputeCornersFromExtents (  )  [protected]

For a grid whose absolute extents are known, use those extents to imply the 4 corners coordinates.

void vtElevationGrid::ComputeExtentsFromCorners (  )  [protected]

For a grid whose 4 corners coordinates are known, use those corners to imply absolute extents.

void vtElevationGrid::ComputeHeightExtents (  ) 

Scans the grid to compute the minimum and maximum height values.

See also:
GetHeightExtents

bool vtElevationGrid::ConvertProjection ( vtElevationGrid pOld,
const vtProjection NewProj,
float  bUpgradeToFloat,
bool   progress_callbackint = NULL 
)

Initializes an elevation grid by converting the contents of an another grid to a new projection.

Parameters:
pOld An existing elevation grid to convert from.
NewProj The new projection to convert to.
bUpgradeToFloat If true, the resulting grid will always use floating-point values. Otherwise, it matches the input grid.
progress_callback If supplied, this function will be called back with a value of 0 to 100 as the operation progresses.
Returns:
True if successful.

bool vtElevationGrid::Create ( const DRECT area,
int  iColumns,
int  iRows,
bool  bFloat,
const vtProjection proj 
)

Create a grid of given size.

Parameters:
area the coordinate extents of the grid (rectangular area)
iColumns number of columns in the grid (east-west)
iRows number of rows (north-south)
bFloat data size: true to use floating-point, false for shorts.
proj the geographical projection to use.
The grid will initially have no data in it (all values are INVALID_ELEVATION).

bool vtElevationGrid::FillGaps ( DRECT area = NULL,
bool   progress_callbackint = NULL 
)

Fill the gaps (heixels of value INVALID_ELVATION) in this grid, by interpolating from the valid values.

This method uses a simple, unoptimized algorithm to move across the grid, one column at a time, averaging the surrounding pixels to fill each gap.

Parameters:
area Optionally, restrict the operation to a given area.
progress_callback Provide if you want a callback on progress.
Returns:
true if successful, false if cancelled.

int vtElevationGrid::FillGapsByRegionGrowing ( int  radius,
bool   progress_callbackint = NULL 
)

Fill-in algorithm. Replaces no-data values by repeated region growing. Smoothly extrapolates the filled-in value via partial derivatives. Restricts the fill-in operation to concavities with a diameter of less than radius^2+1 pixels.

Adapted subset from original code by: Stefan Roettger.

Returns:
The number of no-data heixels that were filled. Returns -1 on error, for example if there was not enought memory to create the temporary buffers.

int vtElevationGrid::FillGapsByRegionGrowing ( int  radius_start = 2,
int  radius_stop = 5,
bool   progress_callbackint = NULL 
)

Fill-in algorithm. Replaces no-data values by repeated region growing. Smoothly extrapolates the filled-in value via partial derivatives. Restricts the fill-in operation to concavities with a diameter of less than radius^2+1 pixels.

Returns:
The number of no-data heixels that were filled. Returns -1 on error, for example if there was not enought memory to create the temporary buffers.

bool vtElevationGrid::FillGapsSmooth ( DRECT area = NULL,
bool   progress_callbackint = NULL 
)

Fill the gaps (heixels of value INVALID_ELVATION) in this grid, by interpolating from the valid values.

This method attempts to be a little better than FillGaps(), by keeping an entire second grid for the interpolated results on each pass, to avoid some cases of the results getting "smeared" left to right. However, this makes it much slower on most data.

Parameters:
area Optionally, restrict the operation to a given area.
progress_callback Provide if you want a callback on progress.
Returns:
true if successful, false if cancelled.

bool vtElevationGrid::FindAltitudeAtPoint ( const FPoint3 p,
float &  fAltitude,
bool  bTrue = false,
int  iCultureFlags = 0,
FPoint3 vNormal = NULL 
) const [virtual]

Simple elevation test for perfectly regular grid terrain. Find altitude (y) and (optionally) surface normal, given (x,z) world coordinates.

This approach is very straightforward, so it could be significantly sped up if needed.

Parameters:
p A 3D point in world coordinates. Only the X and Z values are used.
fAltitude If the test succeeds, this contains the result by reference.
bTrue Pass true to the use the true elevation, false to consider the vertical exaggeration in effect.
iCultureFlags Pass 0 to test only the heightfield itself, non-zero to test any culture objects which may be sitting on the heightfield. Values include:
  • CE_STRUCTURES Test structures on the ground.
  • CE_ROADS Test roads on the ground.
  • CE_ALL Test everything on the ground.
vNormal If you pass a pointer to a vector, it will be filled in with the upwards-pointing surface normal at the given point.
Returns:
true if the point was inside the elevation grid, false if outside.

Implements vtHeightField3d.

bool vtElevationGrid::FindAltitudeOnEarth ( const DPoint2 p,
float &  fAltitude,
bool  bTrue = false 
) const [virtual]

Return the elevation value at a given point in earth coordinates.

Parameters:
p A 2D point in earth coordinates.
fAltitude If the test succeeds, this contains the result by reference.
bTrue Pass true to the use the true elevation, false to consider the vertical exaggeration in effect.
Returns:
true if the point was inside the elevation grid, false if outside.

Implements vtHeightField.

void vtElevationGrid::FreeData (  ) 

Free any memory being used by this class for elevation data.

DRECT vtElevationGrid::GetAreaExtents (  )  const

Returns the geographic extents of the *area* covered by grid.

The standard extents of an elevation grid are the min and max of its data points. However, because each point in the grid is a spot elevation that implies the elevation of the ground around itself, the area over which the elevation could be understood to describe is actually half a heixel larger in each direction. This method returns that larger area.

float vtElevationGrid::GetClosestValue ( const DPoint2 p  )  const

Get the height of the grid at a specific world coordinate (nearest neighbor)

The value of the gridpoint closest to the specified location is returned. If the location is not within the extents of the grid, INVALID_ELEVATION is returned.

Parameters:
p The point to query.

const char* vtElevationGrid::GetDEMName (  )  [inline]

Return the embedded name of the DEM is it has one

float vtElevationGrid::GetFilteredValue ( const DPoint2 p  )  const

Get the interpolated height of the grid at a specific world coordinate.

The value is linearly interpolated between the surrounding gridpoints. If the location is not within the extents of the grid, INVALID_ELEVATION is returned. The height field has a 0.5 pixel safety boundary to catch all samples on the edges.

Parameters:
p The point to query.

float vtElevationGrid::GetFValue ( int  i,
int  j 
) const

Get an elevation value from the grid.

Parameters:
i,j Column and row location in the grid.
Returns:
The value in (float) meters.

short vtElevationGrid::GetValue ( int  i,
int  j 
) const

Get an elevation value from the grid.

Parameters:
i,j Column and row location in the grid.
Returns:
The value in (integer) meters.

bool vtElevationGrid::IsFloatMode (  )  const [inline]

Get the data size of the grid heixels (height elements): true if floating point (4-byte), false if integer (2-byte).

bool vtElevationGrid::LoadBTHeader ( const char *  szFileName,
vtElevGridError *  err = NULL 
)

Loads just the header information from a BT (Binary Terrain) file.

This can be useful if you want to check the information such as the size of the data, without reading the entire file. This method works whether it is given a normal BT file, or one which has been compressed with gzip.
Returns:
true if the header was successfully parsed.

bool vtElevationGrid::LoadFrom3TX ( const char *  szFileName,
bool   progress_callbackint = NULL 
)

Loads from a 3TX ascii grid file. Projection is Geo WGS84, extents are always 1 degree in size.

You should call SetupConversion() after loading if you will be doing heightfield operations on this grid.

Returns:
true if the file was successfully opened and read.

bool vtElevationGrid::LoadFromASC ( const char *  szFileName,
bool   progress_callbackint = NULL 
)

Loads from a Arc/Info compatible ASCII grid file. Projection is read from a corresponding .prj file.

You should call SetupConversion() after loading if you will be doing heightfield operations on this grid.

Returns:
true if the file was successfully opened and read.

bool vtElevationGrid::LoadFromBT ( const char *  szFileName,
bool   progress_callbackint = NULL,
vtElevGridError *  err = NULL 
)

Loads from a BT (Binary Terrain) file.

Both the current version (1.1) and older BT versions are supported. This method works whether it is given a normal BT file, or one which has been compressed with gzip.
Returns:
true if the file was successfully opened and read.

bool vtElevationGrid::LoadFromCDF ( const char *  szFileName,
bool   progress_callbackint = NULL 
)

Loads from a netCDF file. Elevation values are assumed to be integer meters. Projection is assumed to be geographic.

You should call SetupConversion() after loading if you will be doing heightfield operations on this grid.

Returns:
true if the file was successfully opened and read.

bool vtElevationGrid::LoadFromDEM ( const char *  szFileName,
bool   progress_callbackint = NULL 
)

Loads elevation from a USGS DEM file.

Some non-standard variations of the DEM format are supported.

You should call SetupConversion() after loading if you will be doing heightfield operations on this grid.

Returns:
true if the file was successfully opened and read.

bool vtElevationGrid::LoadFromDSAA ( const char *  szFileName,
bool   progress_callbackint = NULL 
)

Helper function for LoadFromGRD, loads from a Surfer ascii grid file (GRD)

Projection is always geographic and elevation is floating-point.

Returns:
true if the file was successfully opened and read.

bool vtElevationGrid::LoadFromDTED ( const char *  szFileName,
bool   progress_callbackint = NULL 
)

Loads from a DTED file.

Should support DTED0, DTED1 and DTED2 files, although it has only been tested on DTED0. Projection is assumed to be geographic and elevation is integer meters.
You should call SetupConversion() after loading if you will be doing heightfield operations on this grid.

Returns:
true if the file was successfully opened and read.

bool vtElevationGrid::LoadFromFile ( const char *  szFileName,
bool   progress_callbackint = NULL 
)

Load from a file whose type is not known a priori. This will end up calling one of the Load* member functions.

You should call SetupConversion() after loading if you will be doing heightfield operations on this grid.

Returns:
true if successful.

bool vtElevationGrid::LoadFromGLOBE ( const char *  szFileName,
bool   progress_callbackint = NULL 
)

Loads from a NOAA GlOBE file.

In fact, there is no "GLOBE format", GLOBE files are delivered as raw data, which can be intepreted using a variety of separate header files. Using the GLOBE server "Select Your Own Area" feature results in 2 files, a header with a .hdr extension and data with a .bin extension. This method reads those file. Pass the filename of the .hdr file to this function, and it will automatically look for a corresponding .bin file in the same location.

Projection is always geographic and elevation is integer meters.

You should call SetupConversion() after loading if you will be doing heightfield operations on this grid.

Returns:
true if the file was successfully opened and read.

bool vtElevationGrid::LoadFromGRD ( const char *  szFileName,
bool   progress_callbackint = NULL 
)

Loads from a Surfer binary grid file (GRD)

GRD does not contain any information about CRS, so the following assumption is made: UTM zone 1.

You should call SetupConversion() after loading if you will be doing heightfield operations on this grid.

Returns:
true if the file was successfully opened and read.

bool vtElevationGrid::LoadFromGTOPO30 ( const char *  szFileName,
bool   progress_callbackint = NULL 
)

Loads from a GTOPO30 (or SRTM30) file.

GTOPO30 files are actually composed of at least 2 files, a header with a .hdr extension and data with a .dem extension. Pass the filename of the .hdr file to this function, and it will automatically look for a corresponding .dem file in the same location.

Projection is always geographic and elevation is integer meters.

You should call SetupConversion() after loading if you will be doing heightfield operations on this grid.

Returns:
true if the file was successfully opened and read.

bool vtElevationGrid::LoadFromHGT ( const char *  szFileName,
bool   progress_callbackint = NULL 
)

Loads from an "HGT" file, which is the format used by the USGS SRTM FTP site for their 1-degree blocks of SRTM data. It is simply a raw block of signed 2-byte data, in WGS84 geographic coords.

The file will either be: 2,884,802 bytes (for 3 arcsec, 1201*1201) or 25,934,402 bytes (for 1 arcsec, 3601*3601)

You should call SetupConversion() after loading if you will be doing heightfield operations on this grid.

Returns:
true if the file was successfully opened and read.

bool vtElevationGrid::LoadFromMicroDEM ( const char *  szFileName,
bool   progress_callbackint = NULL 
)

Loads from a MicroDEM format file.

You should call SetupConversion() after loading if you will be doing heightfield operations on this grid.

Returns:
true if the file was successfully opened and read.

bool vtElevationGrid::LoadFromNTF5 ( const char *  szFileName,
bool   progress_callbackint = NULL 
)

Loads an elevation grid from an UK Ordnance Survey NTF level 5 file using the OGR library.

Parameters:
szFileName The file name to read from.
progress_callback If supplied, this function will be called back with a value of 0 to 100 as the operation progresses.
You should call SetupConversion() after loading if you will be doing heightfield operations on this grid.

Returns:
True if the file was successfully opened and read.

bool vtElevationGrid::LoadFromPGM ( const char *  szFileName,
bool   progress_callbackint = NULL 
)

Loads from a PGM (Portable Gray Map) file. Both PGM Binary and ASCII varieties are supported.

PGM does not contain any information about geographic location, so the following assumptions are made: UTM coordinates, 1-meter spacing, origin at (0,0).

You should call SetupConversion() after loading if you will be doing heightfield operations on this grid.

Returns:
true if the file was successfully opened and read.

bool vtElevationGrid::LoadFromRAW ( const char *  szFileName,
int  width,
int  height,
int  bytes_per_element,
float  vertical_units,
bool  bBigEndian,
bool   progress_callbackint 
)

Loads from a RAW file (a naked array of elevation values). The file will not contain any information about at all about data size, data type, or projection, so this information must be passed in as arguments.

Parameters:
szFileName The file name to read from.
width The width of the expected array.
height The height of the expected array.
bytes_per_element The number of bytes for each elevation value. If this is 1 or 2, the data is assumed to be integer. If 4, then the data is assumed to be floating-point values.
vertical_units Indicates what scale factor to apply to the elevation values to convert them to meters. E.g. if the file is in meters, pass 1.0, if in feet, pass 0.3048.
bBigEndian True for Big-endian byte order, false for Little-endian (Intel byte order).
progress_callback If supplied, this function will be called back with a value of 0 to 100 as the operation progresses.
Returns:
true if the file was successfully opened and read.

bool vtElevationGrid::LoadFromTerragen ( const char *  szFileName,
bool   progress_callbackint = NULL 
)

Loads from a Terragen Terrain file.

You should call SetupConversion() after loading if you will be doing heightfield operations on this grid.

Returns:
true if the file was successfully opened and read.

bool vtElevationGrid::LoadFromXYZ ( const char *  szFileName,
bool   progress_callbackint = NULL 
)

Loads from an "XYZ file", which is a simple text file containing a set of grid points in the form X,Y,Z - where X and Y are ground coordinates, and Z is elevation. The values may be separated either by commas (X, Y, Z) or by whitespace (X Y Z).

Returns:
true if the file was successfully opened and read.

bool vtElevationGrid::LoadWithGDAL ( const char *  szFileName,
bool   progress_callbackint = NULL 
)

Loads an elevation grid using the GDAL library. The GDAL library supports a very large number of formats, including SDTS-DEM. See http://www.remotesensing.org/gdal/formats_list.html for the complete list of GDAL-supported formats.

Parameters:
szFileName The file name to read from.
progress_callback If supplied, this function will be called back with a value of 0 to 100 as the operation progresses.
You should call SetupConversion() after loading if you will be doing heightfield operations on this grid.

Returns:
True if the file was successfully opened and read.

void vtElevationGrid::Offset ( const DPoint2 delta  ) 

Offset the entire elevation grid horizontally.

Parameters:
delta The X,Y amount to shift the location of the grid.

vtElevationGrid & vtElevationGrid::operator= ( const vtElevationGrid rhs  ) 

Assignment operator.

Returns:
*this with new values

int vtElevationGrid::ReplaceValue ( float  value1,
float  value2 
)

Replace one value with another. For example, replace all heixels of value INVALID_ELEVATION with 0.0.

Parameters:
value1 The heixel value to replace.
value2 The value to replace it with.
Returns:
The number of heixels that were modified.

bool vtElevationGrid::ReprojectExtents ( const vtProjection proj_new  ) 

Reprojects an elevation grid by converting just the extents to a new projection.

This is much faster than creating a new grid and reprojecting every heixel, but it only produces correct results when the difference between the projections is only a horizontal shift. For example, this occurs when the only difference between the old and new projection is choice of Datum.

Parameters:
proj_new The new projection to convert to.
Returns:
True if successful.

bool vtElevationGrid::SaveToASC ( const char *  szFileName,
bool   progress_callbackint = NULL 
) const

Writes an Arc/Info compatible ASCII grid file. Projection is written to a corresponding .prj file.

Returns:
true if the file was successfully opened and written.

bool vtElevationGrid::SaveToBMP ( const char *  szFileName  )  const

Write the elevation grid to a 8-bit BMP file. Much information is lost, including precision, sign, and geographic location.

bool vtElevationGrid::SaveToBT ( const char *  szFileName,
bool   progress_callbackint = NULL,
bool  bGZip = false 
)

Writes the grid to a BT (Binary Terrain) file. The current BT format version (1.3) is written.

Parameters:
szFileName The file name to write to.
progress_callback If supplied, this function will be called back with a value of 0 to 100 as the operation progresses.
bGZip If true, the data will be compressed with gzip. If true, you should Use a filename ending with ".gz".

bool vtElevationGrid::SaveToGeoTIFF ( const char *  szFileName  )  const

Write the elevation grid to a 16-bit greyscale GeoTIFF.

bool vtElevationGrid::SaveToPlanet ( const char *  szDirName,
bool   progress_callbackint = NULL 
)

Write elevation to the MSI Planet (Marconi) format.

Returns:
true if the file was successfully opened and written.

bool vtElevationGrid::SaveToPNG16 ( const char *  fname  ) 

Write elevation a 16-bit greyscale PNG file.

bool vtElevationGrid::SaveToRAWINF ( const char *  szFileName,
bool   progress_callbackint = NULL 
) const

Write elevation to a .raw file along with an .inf file which describes the data for the purpose of exporting to MS Flight Simulator 2004 via their MSFS SDK 'resample' utility.

Parameters:
szFileName Should end in ".raw"
progress_callback If supplied, this function will be called back with a value of 0 to 100 as the operation progresses.
Returns:
true if the file was successfully written.

bool vtElevationGrid::SaveToSTM ( const char *  szFileName,
bool   progress_callbackint = NULL 
)

Write elevation to the STM (Simple Terrain Model) format created by Michael Garland for his 'Scape' Terrain Simplification software.

Returns:
true if the file was successfully opened and written.

bool vtElevationGrid::SaveToTerragen ( const char *  szFileName  )  const

Writes the grid to a TerraGen Terrain file.

Parameters:
szFileName The filename to write to.

bool vtElevationGrid::SaveToVRML ( const char *  szFileName,
bool   progress_callbackint = NULL 
) const

Write elevation to a VRML file which contains a single ElevationGrid node.

Returns:
true if the file was successfully opened and written.

bool vtElevationGrid::SaveToXYZ ( const char *  szFileName,
bool   progress_callbackint = NULL 
) const

Write elevation to a text file which contains an XYZ for each point.

Returns:
true if the file was successfully opened and written.

void vtElevationGrid::Scale ( float  fScale,
bool  bDirect,
bool  bRecomputeExtents = true 
)

Scale all the valid elevation values in the grid by a given factor.

Parameters:
fScale The desired scale, e.g. 1.0 produces no change in scale.
bDirect If true, scale the stored height values directly. Otherwise, only the height scale (vertical meters per unit) is scaled.
bRecomputeExtents If true, recompute the height extents. Default is true.

void vtElevationGrid::SetFValue ( int  i,
int  j,
float  value 
)

Set an elevation value to the grid.

Parameters:
i,j Column and row location in the grid.
value The value in (float) meters.

void vtElevationGrid::SetupConversion ( float  fVerticalExag = 1.0f  ) 

Set up the terrain's coordinate systems, including the conversion from Earth coordinates to the World coordinates of the terrain itself. You should call this method after loading or creating a vtElevationGrid, before using methods on it such as FindAltitudeOnEarth or GetSpacing.

For explanation of vtlib/vtdata world coordinates, please see http://vterrain.org/Doc/coords.html

Parameters:
fVerticalExag The vertical exaggeration of the terrain, which is how many times higher it should appear than it really is. Pass 1.0 for no exaggeration.

void vtElevationGrid::SetValue ( int  i,
int  j,
short  value 
)

Set an elevation value to the grid.

Parameters:
i,j Column and row location in the grid.
value The value in (integer) meters.

void vtElevationGrid::VertOffset ( float  fAmount  ) 

Vertically offset the valid elevation values in the grid by a given amount.

Parameters:
fAmount The amount to be added to every elevation value.


Generated on Wed Dec 24 13:08:41 2008 for vtdata library by  doxygen 1.5.7.1