SbTVizRegularGridData Class Reference
[TerrainViz]

TerrainViz Regular grid data class. More...

#include <TerrainViz/SbTVizRegularGridData.h>

Inheritance diagram for SbTVizRegularGridData:
SbTVizData

List of all members.

Public Member Functions

 SbTVizRegularGridData ()
 SbTVizRegularGridData (const SbTVizRegularGridData &data)
virtual ~SbTVizRegularGridData ()
SbBool loadDataFile (const SbString &fileName, const SbVec3d &step, const SbVec3d &offset)
SbBool loadDataFile (const SbString &fileName, const SbVec2s numSamples, const SbVec3d &step, const SbVec3d &offset, DataType dataType, OpenMode openMode, Encoding encoding)
float getAvgValue () const
float getMaxValue () const
float getMinValue () const
float getValue (const SbVec2d &point) const
float getValue (int idx) const
int getLineValues (SbVec3f *&values, SbVec2d &point0, SbVec2d &point1, float &lineStep) const
void setValues (const void *data, const SbVec2s numSamples, const SbVec3d &step, const SbVec3d &offset, DataType dataType)
const SbVec2sgetNumSamples () const
const SbVec3dgetSteps () const
SbBool writeDataFile (const SbString &filename, OpenMode mode)

Detailed Description

TerrainViz Regular grid data class.

This class stores data provided as a regular grid sampling. Each data point represents an elevation.

The step (space between two samples) must be specified.

The terrain can be shifted by an offset. All values are expressed in modeling coordinates, not physical units. But if the data come from a preprocessing operation (using SoTVizDataPreprocessor), the units are the units that were specified during the preprocessing.

Data can be loaded from a file (loadDataFile()), or given through a method (setValues()).

Here are the heads of two sample data files:

ASCII files - short - little endian Binary files - float - big endian
# TerrainViz V1.0 ascii # TerrainViz V1.0 binary
# type ushort # type float
# size 256 256 # size 256 512
# encoding LITTLE_ENDIAN # encoding BIG_ENDIAN
3562 2541 2365 ... 2125.5 3652.2 2155.6 ...

The data array is organized as following:

DTM_data_org.jpg

SEE ALSO

SbTVizData, SbTVizTexture, SbTVizTextureList, SoTViz, SoTVizRender

Deprecated:

Deprecated since Open Inventor 9500
No longer supported.

Constructor & Destructor Documentation

SbTVizRegularGridData::SbTVizRegularGridData (  ) 

Constructor.

SbTVizRegularGridData::SbTVizRegularGridData ( const SbTVizRegularGridData data  ) 

Constructor by copy.

virtual SbTVizRegularGridData::~SbTVizRegularGridData (  )  [virtual]

Destructor.


Member Function Documentation

float SbTVizRegularGridData::getAvgValue (  )  const [virtual]

Returns the average altitude of the data.

Implements SbTVizData.

int SbTVizRegularGridData::getLineValues ( SbVec3f *&  values,
SbVec2d point0,
SbVec2d point1,
float &  lineStep 
) const

Gets the altitude values between two given points, and returns the number of values.



Inputs: The coordinates of the line extremities (point0 and point1).

Input/Output:

  • A reference to the value array to be allocated and filled (values).
  • The sampling step along this line (lineStep). If 0, then it uses the grid resolution. This value may be adjusted by this method.

Return value: The array length (number of samples).

float SbTVizRegularGridData::getMaxValue (  )  const [virtual]

Returns the maximum altitude of the data.

Implements SbTVizData.

float SbTVizRegularGridData::getMinValue (  )  const [virtual]

Returns the minimum altitude of the data.

Implements SbTVizData.

const SbVec2s& SbTVizRegularGridData::getNumSamples (  )  const [inline]

Returns the number of samples (x, y).

const SbVec3d& SbTVizRegularGridData::getSteps (  )  const [inline]

Returns the sampling step along the three dimensions.

float SbTVizRegularGridData::getValue ( int  idx  )  const

Returns the altitude at the specified index in the array.

float SbTVizRegularGridData::getValue ( const SbVec2d point  )  const [virtual]

Returns the altitude at the specified coordinate.

If the input value does not correspond exactly to a grid point on the terrain data, the altitude of the nearest grid point is returned. No interpolation is done.

Implements SbTVizData.

SbBool SbTVizRegularGridData::loadDataFile ( const SbString fileName,
const SbVec2s  numSamples,
const SbVec3d step,
const SbVec3d offset,
DataType  dataType,
OpenMode  openMode,
Encoding  encoding 
)

Same as previous but to be used with rough data files, i.e., files that don't contain a descriptive header.

The following additional parameters must be specified: data type (listed by SbTVizData::DataType. Can be UCHAR, USHORT, FLOAT...), the open mode (ASCII or BINARY), and the encoding format (LITTLE_ENDIAN or BIG_ENDIAN).

SbBool SbTVizRegularGridData::loadDataFile ( const SbString fileName,
const SbVec3d step,
const SbVec3d offset 
)

Method to be used with the internal .dat format (specific header).

Sets the attributes and loads data from a regular grid data file (regular sampling, lines * columns).

In this case, the file must include a header specifying the open mode (ASCII or BINARY), the data type (listed by SbTVizData::DataType. Can be UCHAR, USHORT, FLOAT...), the size of the array, and the encoding format (LITTLE_ENDIAN or BIG_ENDIAN). The data organization is explained above.

void SbTVizRegularGridData::setValues ( const void *  data,
const SbVec2s  numSamples,
const SbVec3d step,
const SbVec3d offset,
DataType  dataType 
)

Sets the altitudes with all parameters.

The data organization is explained above.

SbBool SbTVizRegularGridData::writeDataFile ( const SbString filename,
OpenMode  mode 
) [virtual]

Writes data to a file (ASCII or BINARY).

The default file extension is .dat. The DataType (UCHAR, USHORT, etc.) is the DataType of the SbTVizData instance. The Encoding (BIG_ENDIAN or LITTLE_ENDIAN) is determined by the machine running the program.

Implements SbTVizData.


The documentation for this class was generated from the following file:

Open Inventor by FEI reference manual, generated on 19 Aug 2019
Copyright © FEI S.A.S. All rights reserved.
http://www.openinventor.com/