VR-Forces 4.0.4 Class Documentation
Public Types | Public Member Functions | Protected Member Functions | Protected Attributes | Private Member Functions
DtVectorObstructionManager Class Reference

Instances of DtVectorObstructionManager are responsible for managing the vector obstructions in a simulation. More...

List of all members.

Public Types

typedef std::list< std::pair
< DtVectorObstructionID,
std::vector
< DtVectorObstruction > > > 
DtVectorIDObstructionAssociations
typedef std::list< std::pair
< DtVectorObstructionID,
DtSpatialSubdivision
< DtVectorObstruction * > * > > 
DtObstructionSpatialContainers

Public Member Functions

 DtVectorObstructionManager (const DtTerrainInterface &terrainDatabase)
 constructor
virtual ~DtVectorObstructionManager ()
 destructor
virtual bool init ()
 Initializes the vector obstruction manager.
void setExtrudeObstructions (bool extrude)
 Sets whether obstructions should be extruded in the Z direction.
virtual bool getObstructions (const DtVectorObstructionID &vectorObstructionID, std::vector< DtVectorObstruction > *&vectorObstructions)
 Gets a reference to a const container of vector obstructions of the specified vector obstruction ID.
virtual bool getObstructions (const DtVectorObstructionID &vectorObstructionID, DtExtent &extent, std::set< DtVectorObstruction * > &vectorObstructions)
virtual bool createNewVectorObstructionCollection (const DtVectorObstructionID &vectorObstructionID, std::vector< DtVectorObstruction > *&newVectorObstructionCollection)
 Creates a new container of vector obstructions from the vector network.
virtual bool createNewVectorObstructionSpatialContainer (const DtVectorObstructionID &vectorObstructionID, std::vector< DtVectorObstruction > &newVectorObstructionCollection, DtSpatialSubdivision< DtVectorObstruction * > *&obstructionSpatialContainer, unsigned int numXSubdivisions=100, unsigned int numYSubdivisions=100, unsigned int numZSubdivisions=1)
 Creates a new spatial subdivision and fills it with the specified vector obstructions.
virtual bool addNewVectorObstructionType (const DtVectorObstructionID &vectorObstructionID, std::vector< DtVectorObstruction > *&newVectorObstructionCollection, DtSpatialSubdivision< DtVectorObstruction * > *&newVectorObstructionSpatialContainer)
 Creates a new vector obstruction collection for the specified vector obstruction ID.
virtual bool getAllFeaturesInRange (double range, const DtVectorObstructionID &vectorObstructionID, std::list< const DtNetworkNode * > &nodes)
 Selects all network elements within the specified range and with the specified vector obstruction ID from the vector network.
virtual bool getAllFeaturesInRange (double range, const DtVectorObstructionID &vectorObstructionID, std::list< const DtNetworkSegment * > &segments)
virtual bool expandExtentToIncludeVectorObstructions (const std::vector< DtVectorObstruction > &vectorObstructions, DtExtent &extent)
 Expands the specified extent to include all of the specified vector obstructions.
virtual bool addVectorObstructionsToSpatialContainer (std::vector< DtVectorObstruction > &vectorObstructions, DtSpatialSubdivision< DtVectorObstruction * > &newVectorObstructionSpatialContainer)
 Uses a spatial subdivision inserter, specialized for DtVectorObstructions, to add all of the obstructions in the container, to the specified spatial subdivision.

Protected Member Functions

virtual const Coordinate_SystemcoordinateSystem () const
virtual const DtTerrainInterfaceterrainDatabase () const
virtual
DtVectorIDObstructionAssociations
vectorObstructionCollections ()
virtual
DtObstructionSpatialContainers
vectorObstructionSpatialContainers ()
virtual
DtVectorIDObstructionAssociations
obstructionCollections ()
virtual
DtObstructionSpatialContainers
obstructionSpatialContainers ()
bool testInvariant () const
 Tests the invariant of the class to ensure that its state is consistent and correct and that the invariants are upheld.

Protected Attributes

DtVectorIDObstructionAssociations myVectorObstructionCollections
 Contains a list of std::pairs, each containing a vector obstruction ID and the list of vector obstructions associated with it.
DtObstructionSpatialContainers myVectorObstructionSpatialContainers
 A container of all the vector obstruction spatial subdivisions.
const DtTerrainInterfacemyTerrainDatabase
bool myExtrudeObstructions
 Indicated whether obstructions should be extruded in the Z direction.

Private Member Functions

 DtVectorObstructionManager (const DtVectorObstructionManager &orig)
 copy constructor - not implemented
DtVectorObstructionManageroperator= (const DtVectorObstructionManager &orig)
 assignment operator - not implemented

Detailed Description

Instances of DtVectorObstructionManager are responsible for managing the vector obstructions in a simulation.

They maintain containers of the vector obstructions, both spatially sorted and non-spatially sorted. This class is used by the DtCollisionDetector in determining potential obstructions for obstruction detection and collision avoidance.


Member Typedef Documentation


Constructor & Destructor Documentation

constructor

destructor

copy constructor - not implemented


Member Function Documentation

DtVectorObstructionManager& DtVectorObstructionManager::operator= ( const DtVectorObstructionManager orig) [private]

assignment operator - not implemented

virtual bool DtVectorObstructionManager::init ( ) [virtual]

Initializes the vector obstruction manager.

Removes any currently managed containers of vector obstructions.

Sets whether obstructions should be extruded in the Z direction.

Defaults to false.

virtual bool DtVectorObstructionManager::getObstructions ( const DtVectorObstructionID vectorObstructionID,
std::vector< DtVectorObstruction > *&  vectorObstructions 
) [virtual]

Gets a reference to a const container of vector obstructions of the specified vector obstruction ID.

Parameters:
vectorObstructionIDspecifies which types of vector obstructions to return in the container.
extentIf supplied, specified the volume of interest. The resulting container of vector obstructions will contain all obstructions that intersect the specified extent in any way.
Note:
There may be additional obstructions as well, but never fewer.
Parameters:
vectorObstructionsa reference to a pointer to a const container of the vector obstructions.
Returns:
a boolean signifying success or failure in getting the container of obstructions
See also:
releaseVectorObstruction
Note:
For optimization purposes, the containers are cached once requested.
virtual bool DtVectorObstructionManager::getObstructions ( const DtVectorObstructionID vectorObstructionID,
DtExtent extent,
std::set< DtVectorObstruction * > &  vectorObstructions 
) [virtual]
virtual bool DtVectorObstructionManager::createNewVectorObstructionCollection ( const DtVectorObstructionID vectorObstructionID,
std::vector< DtVectorObstruction > *&  newVectorObstructionCollection 
) [virtual]

Creates a new container of vector obstructions from the vector network.

The container will have all vector obstructions of the specified type in the vector network.

Parameters:
vectorObstructionIDthe vector obstruction ID to select by.
newVectorObstructionCollectiona reference to a pointer to the new container of vector obstructions.
virtual bool DtVectorObstructionManager::createNewVectorObstructionSpatialContainer ( const DtVectorObstructionID vectorObstructionID,
std::vector< DtVectorObstruction > &  newVectorObstructionCollection,
DtSpatialSubdivision< DtVectorObstruction * > *&  obstructionSpatialContainer,
unsigned int  numXSubdivisions = 100,
unsigned int  numYSubdivisions = 100,
unsigned int  numZSubdivisions = 1 
) [virtual]

Creates a new spatial subdivision and fills it with the specified vector obstructions.

First, deletes the specified spatial subdivision if not already NULL. Then determines the extent of the vector obstructions, and finally creates a new subdivision with the specified parameters, and adds the obstructions to it.

Parameters:
vectorObstructionIDThe vector obstructions to contain
newVectorObstructionCollectionThe collection of all the new vector obstructions
obstructionSpatialContainerThe new spatial subdivision containing pointers to the vector obstructions.
virtual bool DtVectorObstructionManager::addNewVectorObstructionType ( const DtVectorObstructionID vectorObstructionID,
std::vector< DtVectorObstruction > *&  newVectorObstructionCollection,
DtSpatialSubdivision< DtVectorObstruction * > *&  newVectorObstructionSpatialContainer 
) [virtual]

Creates a new vector obstruction collection for the specified vector obstruction ID.

Then creates a new vector obstruction spatial container. If it is able to do this, than the user specified parameters are set to reference the new collection and container respectively.

Returns:
A boolean indicating success or failure in adding the new vector obstruction type.
See also:
createNewVectorObstructionCollection
createNewVectorObstructionSpatialContainer
virtual bool DtVectorObstructionManager::getAllFeaturesInRange ( double  range,
const DtVectorObstructionID vectorObstructionID,
std::list< const DtNetworkNode * > &  nodes 
) [virtual]

Selects all network elements within the specified range and with the specified vector obstruction ID from the vector network.

If successful, the specified std::list is populated with the results.

Returns:
a boolean indicating success or failure in selecting all appropriate network elements within the specified range.
virtual bool DtVectorObstructionManager::getAllFeaturesInRange ( double  range,
const DtVectorObstructionID vectorObstructionID,
std::list< const DtNetworkSegment * > &  segments 
) [virtual]
virtual bool DtVectorObstructionManager::expandExtentToIncludeVectorObstructions ( const std::vector< DtVectorObstruction > &  vectorObstructions,
DtExtent extent 
) [virtual]

Expands the specified extent to include all of the specified vector obstructions.

If successful, the extent is guaranteed to contain all of the vector obstructions.

Returns:
a boolean indicating success or failure in expanding the extent.
Note:
Technically, this is a utility function that does not have to be a member of this class.
virtual bool DtVectorObstructionManager::addVectorObstructionsToSpatialContainer ( std::vector< DtVectorObstruction > &  vectorObstructions,
DtSpatialSubdivision< DtVectorObstruction * > &  newVectorObstructionSpatialContainer 
) [virtual]

Uses a spatial subdivision inserter, specialized for DtVectorObstructions, to add all of the obstructions in the container, to the specified spatial subdivision.

Returns:
A boolean indicating success or failure in adding the vector obstructions to the spatial subdivision.
Note:
Technically, this is a utility function that does not have to be a member of this class.
virtual const Coordinate_System* DtVectorObstructionManager::coordinateSystem ( ) const [protected, virtual]
Returns:
A pointer to the coordinate system associated with the terrain.
virtual const DtTerrainInterface* DtVectorObstructionManager::terrainDatabase ( ) const [protected, virtual]
Returns:
A pointer to the (const) terrain database object associated with the vector obstruction manager. This terrain database is the source and owner of all of the vector features which this manager uses as the basis for the obstructions.
Note:
Should never be 0.
Returns:
a reference to the vector obstruction collections
Returns:
a reference to the vector obstruction spatial subdivisions container.
Returns:
a reference to the managed vector obstruction collection.

Tests the invariant of the class to ensure that its state is consistent and correct and that the invariants are upheld.

Called at the beginning of every non-const public function and at the end (before the return statement) of every public function, const and non-const.

Note:
Only active in DEBUG mode.
Returns:
A boolean indicating whether or not the invariant was upheld or not.

Member Data Documentation

Contains a list of std::pairs, each containing a vector obstruction ID and the list of vector obstructions associated with it.

A container of all the vector obstruction spatial subdivisions.

For every type of vector obstruction, the manager maintains a separate subdivision, so that the intersection results are appropriate as is, and no further sorting is necessary.

Note:
This is a trade-off between memory and performance. Additionally, the spatial containers must be updated when vector features are modified in any way. They do not self-update.

Indicated whether obstructions should be extruded in the Z direction.


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

Document ID: Generated on Fri Jun 29 16:33:32 EDT 2012 from SVN revision 116588
Copyright © 2005-2012 VT MÄK Inc. All Rights Reserved (www.mak.com)