VR-Forces 4.7 Class Documentation
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
List of all members | Classes | Public Member Functions | Static Public Member Functions | Protected Types | Protected Member Functions | Protected Attributes
txp::TXPArchive Class Reference
Inheritance diagram for txp::TXPArchive:
Inheritance graph
[legend]

Classes

struct  TileInfo
 Gets some informations for a given tile. More...
struct  TileLocationInfo

Public Member Functions

 TXPArchive ()
 Constructor.
bool openFile (const std::string &archiveName)
 Opens the archive file and reads the header.
bool loadMaterials ()
 Load the materials from the archve.
bool loadMaterial (int ix)
bool loadTexture (int i)
bool loadModels ()
 Load the models from the archive.
bool loadModel (int ix)
bool loadLightAttributes ()
 Load the light attribs from the archive.
bool loadTextStyles ()
 Load the text styles from the archive.
std::map< int, osg::ref_ptr
< osgText::Font > > & 
getStyles ()
std::map< int, osg::Vec4 > & getTextColors ()
void addLightAttribute (osgSim::LightPointNode *lpn, osg::StateSet *fallback, const osg::Vec3 &attitude, int handle)
 Add light attrib.
int getNumLightAttributes ()
DeferredLightAttributegetLightAttribute (unsigned int i)
 Get light attrib.
bool getTileInfo (int x, int y, int lod, TileInfo &info)
bool getTileInfo (const TileLocationInfo &loc, TileInfo &info)
void setId (int id)
 Set/Get the archive id.
const intgetId () const
const intgetNumLODs () const
 Returns the number of LODs for this archive.
void getExtents (osg::BoundingBox &extents)
 Returns the extents of the archive FIXME - Needs to change for databases that aren't flat-earth.
void getOrigin (double &x, double &y)
 { extents.set(_swExtents.x,_swExtents.y,0.0f,_neExtents.x,_neExtents.y,0.0f); }
osg::Texture2D * getGlobalTexture (int id)
 Returns global texture.
osg::Group * getTileContent (int x, int y, int lod, double realMinRange, double realMaxRange, double usedMaxRange, osg::Vec3 &tileCenter, std::vector< TileLocationInfo > &childInfoList)
 Returns scenegraph representing the Tile.
osg::Group * getTileContent (const TileLocationInfo &loc, double realMinRange, double realMaxRange, double usedMaxRange, osg::Vec3 &tileCenter, std::vector< TileLocationInfo > &childInfoList)
 To be used for Version 2.1 with lod > 0.
bool getLODSize (int lod, int &x, int &y)
 Get the number of tiles for given LOD.
void GetVersion (int &majorVer, int &minorVer) const
void SetUserDataToMaterialAttributes (osg::StateSet &osg_state_set, const trpgMaterial &mat)
 This section brought to you by A.
void SetMaterialAttributesToStateSetVar (bool value)
- Public Member Functions inherited from trpgr_Archive
 trpgr_Archive (void)
virtual ~trpgr_Archive (void)
virtual void SetDirectory (const char *)
virtual bool OpenFile (const char *)
virtual void CloseFile (void)
 Open File.
virtual bool ReadHeader (void)
virtual bool ReadHeader (bool readAllBlocks)
 Read header (materials, tile table. etc..)
bool ReadSubArchive (int row, int col, trpgEndian cpuNess)
virtual bool ReadTile (uint32 x, uint32 y, uint32 lod, trpgMemReadBuffer &)
 In version 2.1, only tile at lod 0 are fetchable via the tile table.
virtual bool ReadTile (const trpgwAppAddress &addr, trpgMemReadBuffer &buf)
virtual bool ReadExternalTile (uint32 x, uint32 y, uint32 lod, trpgMemReadBuffer &buf)
virtual const trpgHeaderGetHeader (void) const
 Get access to header info.
virtual const trpgMatTableGetMaterialTable (void) const
virtual trpgTexTableGetTexTable (void)
virtual const trpgModelTableGetModelTable (void) const
virtual const trpgTileTableGetTileTable (void) const
virtual const trpgLightTableGetLightTable (void) const
virtual const trpgRangeTableGetRangeTable (void) const
virtual const
trpgLabelPropertyTable
GetLabelPropertyTable () const
virtual const trpgTextStyleTableGetTextStyleTable () const
virtual const
trpgSupportStyleTable
GetSupportStyleTable () const
virtual bool trpgGetTileMBR (uint32 x, uint32 y, uint32 lod, trpg3dPoint &ll, trpg3dPoint &ur) const
 Utility routine to calculate the MBR of a given tile.
trpgEndian GetEndian (void) const
chargetDir (void)
virtual trpgrImageHelperGetNewRImageHelper (trpgEndian ness, char *dir, const trpgMatTable &matTable, const trpgTexTable &texTable)
virtual trpgrAppFileCacheGetNewRAppFileCache (const char *fullBase, const char *ext)
virtual int32 GetHeaderData (char *dataPtr, int32 length, FILE *filehandle)
virtual int32 GetMagicNumber ()
- Public Member Functions inherited from trpgCheckable
 trpgCheckable (void)
virtual ~trpgCheckable (void)
bool isValid (void) const
 Returns the state of the valid flag, or can be overriden by a subclass to do a more complex check.
virtual TeAttrHdl GetHandle () const
virtual void SetHandle (TeAttrHdl hdl)

Static Public Member Functions

static void setShouldLoadDisplayData (bool)
 Set to false to not load imagery and materials. Default is true.
static bool shouldLoadDisplayData ()
static void setExternalLoadOptions (osg::ref_ptr< osgDB::ReaderWriter::Options > opts)
static osg::ref_ptr
< osgDB::ReaderWriter::Options > 
externalLoadOptions ()
static void setShouldLoadLocalMaterials (bool)
 Disables loading local materials, which will still load texture image objects.
static bool shouldLoadLocalMaterials ()

Protected Types

typedef std::map< int,
osg::ref_ptr< osg::Texture2D > > 
OSGTexMapType
 Textures.
typedef std::map< int,
osg::ref_ptr< osg::StateSet > > 
OSGStatesMapType
 States.
typedef std::map< int,
osg::ref_ptr< osg::Node > > 
OSGModelsMapType
 Models.

Protected Member Functions

virtual ~TXPArchive ()
 Destructor.
void SetTexMap (int key, osg::ref_ptr< osg::Texture2D > ref)
osg::ref_ptr< osg::Texture2D > GetTexMapEntry (int key)
void SetStatesMap (int key, osg::ref_ptr< osg::StateSet > ref)
osg::ref_ptr< osg::StateSet > GetStatesMapEntry (int key)

Protected Attributes

int _id
 Id of the archive.
int _numLODs
 Number of the LODs.
trpg2dPoint _swExtents
 Archive extents.
trpg2dPoint _neExtents
osg::ref_ptr< TXPParser_parser
 Terra Page Parser.
OSGTexMapType _texmap
OSGStatesMapType _statesMap
OSGModelsMapType _models
std::map< int,
DeferredLightAttribute
_lights
 Light attributes vector.
std::map< int, osg::ref_ptr
< osgText::Font > > 
_fonts
 Text styles / Fonts.
std::map< int, osg::Vec4 > _fcolors
 Text colors.
OpenThreads::Mutex _mutex
int _majorVersion
 Cache those: TerraPage version.
int _minorVersion
bool _isMaster
bool _loadMaterialsToStateSet
- Protected Attributes inherited from trpgr_Archive
bool headerRead
trpgEndian ness
FILE * fp
int fid
char dir [1024]
 Header info.
trpgHeader header
trpgMatTable materialTable
trpgTexTable texTable
trpgModelTable modelTable
trpgTileTable tileTable
trpgLightTable lightTable
trpgRangeTable rangeTable
trpgTextStyleTable textStyleTable
trpgSupportStyleTable supportStyleTable
trpgLabelPropertyTable labelPropertyTable
trpgrAppFileCachetileCache
- Protected Attributes inherited from trpgCheckable
bool valid
TeAttrHdl handle
bool writeHandle

Member Typedef Documentation

typedef std::map<int,osg::ref_ptr<osg::Texture2D> > txp::TXPArchive::OSGTexMapType
protected

Textures.

typedef std::map<int,osg::ref_ptr<osg::StateSet> > txp::TXPArchive::OSGStatesMapType
protected

States.

typedef std::map<int,osg::ref_ptr<osg::Node> > txp::TXPArchive::OSGModelsMapType
protected

Models.

Constructor & Destructor Documentation

txp::TXPArchive::TXPArchive ( )

Constructor.

virtual txp::TXPArchive::~TXPArchive ( )
protectedvirtual

Destructor.

Member Function Documentation

bool txp::TXPArchive::openFile ( const std::string &  archiveName)

Opens the archive file and reads the header.

bool txp::TXPArchive::loadMaterials ( )

Load the materials from the archve.

bool txp::TXPArchive::loadMaterial ( int  ix)
bool txp::TXPArchive::loadTexture ( int  i)
bool txp::TXPArchive::loadModels ( )

Load the models from the archive.

bool txp::TXPArchive::loadModel ( int  ix)
bool txp::TXPArchive::loadLightAttributes ( )

Load the light attribs from the archive.

bool txp::TXPArchive::loadTextStyles ( )

Load the text styles from the archive.

std::map<int, osg::ref_ptr<osgText::Font> >& txp::TXPArchive::getStyles ( )
inline
std::map<int, osg::Vec4 >& txp::TXPArchive::getTextColors ( )
inline
void txp::TXPArchive::addLightAttribute ( osgSim::LightPointNode *  lpn,
osg::StateSet *  fallback,
const osg::Vec3 &  attitude,
int  handle 
)

Add light attrib.

int txp::TXPArchive::getNumLightAttributes ( )
inline
DeferredLightAttribute& txp::TXPArchive::getLightAttribute ( unsigned int  i)
inline

Get light attrib.

bool txp::TXPArchive::getTileInfo ( int  x,
int  y,
int  lod,
TileInfo info 
)
bool txp::TXPArchive::getTileInfo ( const TileLocationInfo loc,
TileInfo info 
)
void txp::TXPArchive::setId ( int  id)
inline

Set/Get the archive id.

const int& txp::TXPArchive::getId ( ) const
inline
const int& txp::TXPArchive::getNumLODs ( ) const
inline

Returns the number of LODs for this archive.

void txp::TXPArchive::getExtents ( osg::BoundingBox &  extents)

Returns the extents of the archive FIXME - Needs to change for databases that aren't flat-earth.

void txp::TXPArchive::getOrigin ( double x,
double y 
)
inline

{ extents.set(_swExtents.x,_swExtents.y,0.0f,_neExtents.x,_neExtents.y,0.0f); }

Returns the origin of the archive

osg::Texture2D* txp::TXPArchive::getGlobalTexture ( int  id)
inline

Returns global texture.

osg::Group* txp::TXPArchive::getTileContent ( int  x,
int  y,
int  lod,
double  realMinRange,
double  realMaxRange,
double  usedMaxRange,
osg::Vec3 &  tileCenter,
std::vector< TileLocationInfo > &  childInfoList 
)

Returns scenegraph representing the Tile.

For version 2.1 and over this function can only be call with lod = 0, since the archive tile table will contain only tiles with lod = 0

osg::Group* txp::TXPArchive::getTileContent ( const TileLocationInfo loc,
double  realMinRange,
double  realMaxRange,
double  usedMaxRange,
osg::Vec3 &  tileCenter,
std::vector< TileLocationInfo > &  childInfoList 
)

To be used for Version 2.1 with lod > 0.

bool txp::TXPArchive::getLODSize ( int  lod,
int x,
int y 
)

Get the number of tiles for given LOD.

void txp::TXPArchive::GetVersion ( int majorVer,
int minorVer 
) const
inline
void txp::TXPArchive::SetUserDataToMaterialAttributes ( osg::StateSet &  osg_state_set,
const trpgMaterial mat 
)
inline

This section brought to you by A.

Danklefsen and the team @ Alion Science And Technology 2/12/07 This will allow you to have smc / fid / swc / stp values and places them on the userdata of the state set. this way your own terrain loader / parser can know these values

References trpgMaterial::GetAttr().

void txp::TXPArchive::SetMaterialAttributesToStateSetVar ( bool  value)
inline
static void txp::TXPArchive::setShouldLoadDisplayData ( bool  )
static

Set to false to not load imagery and materials. Default is true.

static bool txp::TXPArchive::shouldLoadDisplayData ( )
static
static void txp::TXPArchive::setExternalLoadOptions ( osg::ref_ptr< osgDB::ReaderWriter::Options >  opts)
static
static osg::ref_ptr<osgDB::ReaderWriter::Options> txp::TXPArchive::externalLoadOptions ( )
static
static void txp::TXPArchive::setShouldLoadLocalMaterials ( bool  )
static

Disables loading local materials, which will still load texture image objects.

Default true. Added by MAK for VRFSIM.

static bool txp::TXPArchive::shouldLoadLocalMaterials ( )
static
void txp::TXPArchive::SetTexMap ( int  key,
osg::ref_ptr< osg::Texture2D >  ref 
)
protected
osg::ref_ptr<osg::Texture2D> txp::TXPArchive::GetTexMapEntry ( int  key)
protected
void txp::TXPArchive::SetStatesMap ( int  key,
osg::ref_ptr< osg::StateSet >  ref 
)
protected
osg::ref_ptr<osg::StateSet> txp::TXPArchive::GetStatesMapEntry ( int  key)
protected

Member Data Documentation

int txp::TXPArchive::_id
protected

Id of the archive.

int txp::TXPArchive::_numLODs
protected

Number of the LODs.

trpg2dPoint txp::TXPArchive::_swExtents
protected

Archive extents.

trpg2dPoint txp::TXPArchive::_neExtents
protected
osg::ref_ptr<TXPParser> txp::TXPArchive::_parser
protected

Terra Page Parser.

OSGTexMapType txp::TXPArchive::_texmap
protected
OSGStatesMapType txp::TXPArchive::_statesMap
protected
OSGModelsMapType txp::TXPArchive::_models
protected
std::map<int, DeferredLightAttribute> txp::TXPArchive::_lights
protected

Light attributes vector.

std::map<int, osg::ref_ptr<osgText::Font> > txp::TXPArchive::_fonts
protected

Text styles / Fonts.

std::map<int, osg::Vec4 > txp::TXPArchive::_fcolors
protected

Text colors.

OpenThreads::Mutex txp::TXPArchive::_mutex
protected
int txp::TXPArchive::_majorVersion
protected

Cache those: TerraPage version.

int txp::TXPArchive::_minorVersion
protected
bool txp::TXPArchive::_isMaster
protected
bool txp::TXPArchive::_loadMaterialsToStateSet
protected

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

Document ID: Generated on Fri Apr 26 21:53:14 EDT 2019 from SVN revision 197883
Copyright © 2005-2019 VT MAK. All Rights Reserved (www.mak.com)