GeoTessCPPExamples  2.0
Public Member Functions | Static Public Member Functions | Protected Member Functions | Private Member Functions | Private Attributes
geotess::GeoTessModelExtended Class Reference

#include <GeoTessModelExtended.h>

Inheritance diagram for geotess::GeoTessModelExtended:

Public Member Functions

 GeoTessModelExtended ()
 
 GeoTessModelExtended (const string &modelInputFile, const string &relativeGridPath)
 
 GeoTessModelExtended (const string &modelInputFile)
 
 GeoTessModelExtended (vector< int > &attributeFilter)
 
 GeoTessModelExtended (const string &modelInputFile, const string &relativeGridPath, vector< int > &attributeFilter)
 
 GeoTessModelExtended (const string &modelInputFile, vector< int > &attributeFilter)
 
 GeoTessModelExtended (const string &gridFileName, GeoTessMetaData *metaData)
 
 GeoTessModelExtended (GeoTessGrid *grid, GeoTessMetaData *metaData)
 
 GeoTessModelExtended (GeoTessModel *baseModel)
 
virtual ~GeoTessModelExtended ()
 
string getExtraData ()
 
void setExtraData (const string &xData)
 

Static Public Member Functions

static string class_name ()
 

Protected Member Functions

void loadModelAscii (IFStreamAscii &input, const string &inputDirectory, const string &relGridFilePath)
 
void loadModelBinary (IFStreamBinary &input, const string &inputDirectory, const string &relGridFilePath)
 
void writeModelAscii (IFStreamAscii &output, const string &gridFileName)
 
void writeModelBinary (IFStreamBinary &output, const string &gridFileName)
 

Private Member Functions

void initializeData ()
 

Private Attributes

string extraData
 

Detailed Description

This class is an example of a class that extends GeoTessModel. It does everything a GeoTessModel can do but adds an extra data item to the model. In this example, the extra data is just a simple string called 'extraData', but in real models that extend GeoTessModel, it could be anything.

Classes that extend GeoTessModel should provide implementations of all the GeoTessModel constructors with the first thing that they do is call the super class constructor. This example does this.

In addition, classes that extend GeoTessModel must override 4 IO functions:

In addition to the 4 required IO functions, derived classes may want to implement these functions:

Finally, the derived class can implement any other functionality that is deemed appropriate. This simple example implements functions getExtraData() and setExtraData().Any resources allocated by the derived class should be deleted in its destructor.

Author
sballar

Definition at line 103 of file GeoTessModelExtended.h.

Constructor & Destructor Documentation

◆ GeoTessModelExtended() [1/9]

geotess::GeoTessModelExtended::GeoTessModelExtended ( )

Default constructor.

This class is an example of a class that extends GeoTessModel. It does everything a GeoTessModel can do but adds an extra data item to the model. In this example, the extra data is just a simple String, but in real models that extend GeoTessModel, it could be anything.

Classes that extend GeoTessModel should provide implementations of all the GeoTessModel constructors with the first thing that they do is call the super class constructor.

In addition, classes that extend GeoTessModel should override 4 IO functions: loadModelBinary, writeModelBinary, loadModelAscii, writeModelAscii. See examples below.

The first thing that these methods do is call the super class implementations to read/write the standard GeoTessModel information. After that, the methods may read/write the application specific data from/to the end of the standard GeoTessModel file.

Author
sballar Extend basemodel constructor by initializing extraData.

Definition at line 75 of file GeoTessModelExtended.cc.

◆ GeoTessModelExtended() [2/9]

geotess::GeoTessModelExtended::GeoTessModelExtended ( const string &  modelInputFile,
const string &  relativeGridPath 
)

Construct a new GeoTessModel object and populate it with information from the specified file.

Parameters
modelInputFilename of file containing the model.
relativeGridPaththe relative path from the directory where the model is stored to the directory where the grid is stored. Often, the model and grid are stored together in the same file in which case this parameter is ignored. Sometimes, however, the grid is stored in a separate file and only the name of the grid file (without path information) is stored in the model file. In this case, the code needs to know which directory to search for the grid file. The default is "" (empty string), which will cause the code to search for the grid file in the same directory in which the model file resides. Bottom line is that the default value is appropriate when the grid is stored in the same file as the model, or the model file is in the same directory as the model file.

Extend basemodel constructor by initializing extraData.

Definition at line 84 of file GeoTessModelExtended.cc.

◆ GeoTessModelExtended() [3/9]

geotess::GeoTessModelExtended::GeoTessModelExtended ( const string &  modelInputFile)

Construct a new GeoTessModel object and populate it with information from the specified file.

relativeGridPath is assumed to be "" (empty string), which is appropriate when the grid information is stored in the same file as the model or when the grid is stored in a separate file located in the same directory as the model file.

Parameters
modelInputFilename of file containing the model.

Extend basemodel constructor by initializing extraData.

Definition at line 94 of file GeoTessModelExtended.cc.

◆ GeoTessModelExtended() [4/9]

geotess::GeoTessModelExtended::GeoTessModelExtended ( vector< int > &  attributeFilter)

Default constructor.

Parameters
attributeFilterthe indexes of available attributes that should be loaded into memory.

Extend basemodel constructor by initializing extraData.

Definition at line 104 of file GeoTessModelExtended.cc.

◆ GeoTessModelExtended() [5/9]

geotess::GeoTessModelExtended::GeoTessModelExtended ( const string &  modelInputFile,
const string &  relativeGridPath,
vector< int > &  attributeFilter 
)

Construct a new GeoTessModel object and populate it with information from the specified file.

Parameters
modelInputFilename of file containing the model.
relativeGridPaththe relative path from the directory where the model is stored to the directory where the grid is stored. Often, the model and grid are stored together in the same file in which case this parameter is ignored. Sometimes, however, the grid is stored in a separate file and only the name of the grid file (without path information) is stored in the model file. In this case, the code needs to know which directory to search for the grid file. The default is "" (empty string), which will cause the code to search for the grid file in the same directory in which the model file resides. Bottom line is that the default value is appropriate when the grid is stored in the same file as the model, or the model file is in the same directory as the model file.
attributeFilterthe indexes of available attributes that should be loaded into memory.

Extend basemodel constructor by initializing extraData.

Definition at line 113 of file GeoTessModelExtended.cc.

◆ GeoTessModelExtended() [6/9]

geotess::GeoTessModelExtended::GeoTessModelExtended ( const string &  modelInputFile,
vector< int > &  attributeFilter 
)

Construct a new GeoTessModel object and populate it with information from the specified file.

relativeGridPath is assumed to be "" (empty string), which is appropriate when the grid information is stored in the same file as the model or when the grid is stored in a separate file located in the same directory as the model file.

Parameters
modelInputFilename of file containing the model.
attributeFilterthe indexes of available attributes that should be loaded into memory.

Extend basemodel constructor by initializing extraData.

Definition at line 124 of file GeoTessModelExtended.cc.

◆ GeoTessModelExtended() [7/9]

geotess::GeoTessModelExtended::GeoTessModelExtended ( const string &  gridFileName,
GeoTessMetaData *  metaData 
)

Parameterized constructor, specifying the grid and metadata for the model. The grid is constructed and the data structures are initialized based on information supplied in metadata. The data structures are not populated with any information however (all Profiles are null). The application should populate the new model's Profiles after this constructor completes.

Before calling this constructor, the supplied MetaData object must be populated with required information by calling the following MetaData methods:

  • setDescription()
  • setLayerNames()
  • setAttributes()
  • setDataType()
  • setLayerTessIds() (only required if grid has more than one multi-level tessellation)
Parameters
gridFileNamename of file from which to load the grid.
metaDataMetaData the new GeoTessModel instantiates a reference to the supplied metaData. No copy is made.
Exceptions
GeoTessExceptionif metadata is incomplete.

Extend basemodel constructor by initializing extraData.

Definition at line 134 of file GeoTessModelExtended.cc.

◆ GeoTessModelExtended() [8/9]

geotess::GeoTessModelExtended::GeoTessModelExtended ( GeoTessGrid *  grid,
GeoTessMetaData *  metaData 
)

Parameterized constructor, specifying the grid and metadata for the model. The grid is constructed and the data structures are initialized based on information supplied in metadata. The data structures are not populated with any information however (all Profiles are null). The application should populate the new model's Profiles after this constructor completes.

Before calling this constructor, the supplied MetaData object must be populated with required information by calling the following MetaData methods:

  • setDescription()
  • setLayerNames()
  • setAttributes()
  • setDataType()
  • setLayerTessIds() (only required if grid has more than one multi-level tessellation)
  • setSoftwareVersion()
  • setGenerationDate()
Parameters
grida pointer to the GeoTessGrid that will support this GeoTessModel. GeoTessModel assumes ownership of the supplied grid object and will delete it when it is done with it.
metaDataMetaData the new GeoTessModel instantiates a reference to the supplied metaData. No copy is made.
Exceptions
GeoTessExceptionif metadata is incomplete.

Extend basemodel constructor by initializing extraData.

Definition at line 143 of file GeoTessModelExtended.cc.

◆ GeoTessModelExtended() [9/9]

geotess::GeoTessModelExtended::GeoTessModelExtended ( GeoTessModel *  baseModel)

Construct a new GeoTessModelExtended by making a deep copy of an existing GeoTessModel and initializing the extra data with default values.

Parameters
baseModelpointer to an existing GeoTessModel.

Definition at line 155 of file GeoTessModelExtended.cc.

◆ ~GeoTessModelExtended()

geotess::GeoTessModelExtended::~GeoTessModelExtended ( )
virtual

Destructor.

Definition at line 173 of file GeoTessModelExtended.cc.

Member Function Documentation

◆ class_name()

static string geotess::GeoTessModelExtended::class_name ( )
inlinestatic

Returns the class name.

Definition at line 175 of file GeoTessModelExtended.h.

◆ getExtraData()

string geotess::GeoTessModelExtended::getExtraData ( )

Retrieve the extra data stored by this derived class.

Definition at line 344 of file GeoTessModelExtended.cc.

◆ initializeData()

void geotess::GeoTessModelExtended::initializeData ( )
inlineprivate

Initialize the extraData.

Definition at line 116 of file GeoTessModelExtended.h.

◆ loadModelAscii()

void geotess::GeoTessModelExtended::loadModelAscii ( IFStreamAscii &  input,
const string &  inputDirectory,
const string &  relGridFilePath 
)
protected

Override GeoTessModel::loadModelAscii(). Applications don't call this protected method directly. It is call from GeoTessModel.loadModel().

Parameters
inputascii stream that provides input
inputDirectorythe directory where the model file resides
relGridFilePaththe relative path from the directory where the model file resides to the directory where the grid file resides.
Exceptions
GeoTessExceptionOverride GeoTessModel::loadModelAscii()
Parameters
inputascii stream that provides input
inputDirectorythe directory where the model file resides
relGridFilePaththe relative path from the directory where the model file resides to the directory where the grid file resides.
Exceptions
GeoTessException

Definition at line 188 of file GeoTessModelExtended.cc.

◆ loadModelBinary()

void geotess::GeoTessModelExtended::loadModelBinary ( IFStreamBinary &  input,
const string &  inputDirectory,
const string &  relGridFilePath 
)
protected

Override GeoTessModel::loadModelBinary() Applications don't call this protected method directly. It is call from GeoTessModel.loadModel().

Parameters
inputbinary stream that provides input
inputDirectorythe directory where the model file resides
relGridFilePaththe relative path from the directory where the model file resides to the directory where the grid file resides.
Exceptions
GeoTessExceptionOverride GeoTessModel::loadModelBinary()
Parameters
inputbinary stream that provides input
inputDirectorythe directory where the model file resides
relGridFilePaththe relative path from the directory where the model file resides to the directory where the grid file resides.
Exceptions
GeoTessException

Definition at line 240 of file GeoTessModelExtended.cc.

◆ setExtraData()

void geotess::GeoTessModelExtended::setExtraData ( const string &  xData)

Modify the extra data stored by this derived class

Parameters
xDatathe new value

Modify the extra data stored by this derived class

Definition at line 350 of file GeoTessModelExtended.cc.

◆ writeModelAscii()

void geotess::GeoTessModelExtended::writeModelAscii ( IFStreamAscii &  output,
const string &  gridFileName 
)
protected

Override GeoTessModel::writeModelAscii() Applications don't call this protected method directly. It is call from GeoTessModel.writeModel().

Parameters
outputthe output ascii stream to which model is written.
gridFileName

Definition at line 291 of file GeoTessModelExtended.cc.

◆ writeModelBinary()

void geotess::GeoTessModelExtended::writeModelBinary ( IFStreamBinary &  output,
const string &  gridFileName 
)
protected

Override GeoTessModel::writeModelBinary() Applications don't call this protected method directly. It is call from GeoTessModel.writeModel().

Parameters
outputthe output ascii stream to which model is written.
gridFileName

Definition at line 320 of file GeoTessModelExtended.cc.

Field Documentation

◆ extraData

string geotess::GeoTessModelExtended::extraData
private

This string is just an example that represents whatever extra data the derived class might choose to implement.

Definition at line 111 of file GeoTessModelExtended.h.


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