TmmT_Terrain_Reader_Init_Proc()
Abstract
Entry point for the code library used to read a specific terrain format.
Syntax
tmm_terrain_handler (library_base_name)
| Argument | Type | Description |
|---|---|---|
library_base_name |
const char * |
Name of the code library source file, without extensions |
Return Value
TmmT_Terrain_Type *
Pointer to a newly created Terrain Handler object with the specified base name.
Header
tmm.h
Example
// Entry point for terrain reader
extern "C" {
DLLEXPORT TmmT_Terrain_Type *
tmm_terrain_handler (const char * library_base_name);
DLLEXPORT TmmT_Terrain_Type *
tmm_terrain_handler (const char * library_base_name)
{
FIN (tmm_terrain_handler);
TmmT_Terrain_Type * handler = new TmmT_Terrain_Type;
if (handler == VOSC_NIL)
{
Vos_Error_Print (VOSC_ERROR_RECOVER, “TMM”,
“Unable to allocate memory for terrain handler library: “,
library_base_name, VOSC_NIL);
FRET (VOSC_NIL);
}
handler->identifier = "<terrain_type_name>";
handler->is_file = 1;
hanlder->file_selections = “<file_suffix_string>”;
handler->load_proc = <load_proc>;
handler->num_source_steps_proc = <num_source_steps_proc>;
handler->coverage_proc = <coverage_proc>;
handler->elevation_proc = <elevation_proc>;
handler->resolution_proc = <resolution_proc>;
handler->elevation_profile_fill_proc = <elevation_profile_fill_proc>;
handler->unload_proc = <unload_proc>;
handler->exit_proc = <exit_proc>;
FRET (handler);
}
}
Details
This function is the entry point to the library of functions used to access a custom terrain format. It should allocate a new TmmT_Terrain_Type object for the terrain format, fill in the various fields, and return the object. The structure of this object is
struct TmmT_Terrain_Type
{
TmmT_Terrain_Reader_Load_Proc load_proc;
TmmT_Terrain_Reader_Unload_Proc unload_proc;
TmmT_Terrain_Reader_Coverage_Proc coverage_proc;
TmmT_Terrain_Reader_Elevation_Proc elevation_proc;
TmmT_Terrain_Reader_Resolution_Proc resolution_proc;
TmmT_Terrain_Reader_Elevation_Profile_Fill_Proc elevation_profile_fill_proc;
TmmT_Terrain_Reader_Num_Source_Steps_Proc num_source_steps_proc;
TmmT_Terrain_Reader_Exit_Proc exit_proc;
const char * identifier;
int is_file;
const char * file_selections;
void * global_state_ptr;
} TmmT_Terrain_Type;
When filling in the fields of this object, note that:
- Only procedures you expect to use need to be defined. Unneeded procedures can be set to
OPC_NIL. identifieris a string used to represent this terrain type in GUI menus and internally. For example: “OpenFlight”.is_fileis a Boolean indicating whether to let the user select a single file or a directory of files when browsing for terrain data of this type. Set to TRUE for a single file.file_selectionsis a semicolon-separated list of descriptive names and file extensions for supported terrain data sources. Used only ifis_fileis TRUE. For example: “OpenFlight files (.flt);All files (.*)”.global_state_ptrpoints to optional user-defined state information.
Purpose
Callback used as the entry point for the code library used to read a specific terrain format.