VR-Forces 4.3.1 Class Documentation
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
List of all members | Public Types | Public Member Functions | Protected Member Functions | Protected Attributes | Private Member Functions
DtSpatialVrfObjectManager Class Reference

Implementation of a spatial object manager based on DtSpatialSubdivision. More...

Inheritance diagram for DtSpatialVrfObjectManager:
Inheritance graph
[legend]

Public Types

typedef DtSpatialSubdivision
< DtVrfObject * > 
DtSpatialContainer
typedef std::vector
< DtVrfObject * > 
DtNonSpatialContainer
typedef
DtNonSpatialContainer::iterator 
DtNonSpatialVrfObjectIter
typedef
DtNonSpatialContainer::const_iterator 
DtNonSpatialVrfObjectConstIter
- Public Types inherited from DtSpatialVrfObjectManagerInterface
typedef boost::unordered_set
< DtVrfObject * > 
DtVrfObjectUniqueContainer
 Set of functions used to get the relevant DtVrfObjects from the object manager.
typedef boost::unordered_set
< const DtVrfObject * > 
DtVrfConstObjectUniqueContainer
typedef std::list< DtVrfObject * > DtVrfObjectContainer

Public Member Functions

 DtSpatialVrfObjectManager (unsigned int xRes=1, unsigned int yRes=1, unsigned int zRes=1)
 Constructor Creates a default container, with a single cell unless the resolutions are otherwise specified.
virtual ~DtSpatialVrfObjectManager ()
 Destructor.
virtual bool initialize (const DtManagedObjectListConstPtr &vrfObjects, unsigned int cellCountX, unsigned int cellCountY, unsigned int cellCountZ)
 Initializes the spatial object manager.
virtual void addVrfObjects (const DtManagedObjectListConstPtr &vrfObjects)
 Spatially sorts the vrfObjects associated in the vrfObjects.
virtual void removeVrfObject (DtVrfObject *vrfObject)
 Removes vrfObject from the set of vrfObjects we are maintaining.
virtual void clearVrfObjects ()
 Clears all managed objects from the manager.
virtual bool setResolutions (unsigned int xRes, unsigned int yRes, unsigned int zRes)
 Deprecated – doesn't apply to octree manager.
virtual unsigned int xResolution () const
virtual unsigned int yResolution () const
virtual unsigned int zResolution () const
virtual void resolutions (unsigned int &xRes, unsigned int &yRes, unsigned int &zRes) const
virtual void reset (const DtManagedObjectListConstPtr &vrfObjects)
 Clears out the current subdivision, sets it to have the minimum extent, that contains all of the DtVrfObjects specified, and adds the specified DtVrfObjects.
bool getVrfObjects (const DtExtent &extent, DtVrfObjectUniqueContainer &objects)
 Set of functions used to get the relevant DtVrfObjects from the object manager.
bool getVrfObjects (const DtExtent &extent, DtVrfConstObjectUniqueContainer &objects) const
bool getVrfObjects (DtVrfObjectPredicate &predicate, const DtExtent &extent, DtVrfObjectUniqueContainer &objects)
bool getVrfObjects (DtVrfObjectPredicate &predicate, const DtExtent &extent, DtVrfConstObjectUniqueContainer &objects) const
bool getVrfObjects (DtChord &chord, std::list< DtVrfObject * > &objects)
bool getVrfObjects (DtChord &chord, std::list< const DtVrfObject * > &objects) const
bool getVrfObjects (DtVrfObjectPredicate &predicate, DtChord &chord, std::list< DtVrfObject * > &objects)
bool getVrfObjects (DtVrfObjectPredicate &predicate, DtChord &chord, std::list< const DtVrfObject * > &objects) const
void visitVrfObjects (const DtExtent &extent, DtSpatialSelectionFunctor &callback) const
 Functions that call the specified functor for every object intersecting the requested region (whether chord or extent).
void visitVrfObjects (const DtChord &chord, DtSpatialSelectionFunctor &callback) const
virtual const DtSpatialContainerspatialContainer () const
virtual DtSpatialContainerspatialContainer ()
virtual const
DtNonSpatialContainer
nonSpatiallyOrganizedObjects () const
virtual DtNonSpatialContainernonSpatiallyOrganizedObjects ()
- Public Member Functions inherited from DtSpatialVrfObjectManagerInterface
virtual ~DtSpatialVrfObjectManagerInterface ()

Protected Member Functions

virtual bool createSpatialContainer (const DtExtent &extent, unsigned int cellCountX, unsigned int cellCountY, unsigned int cellCountZ)
 Creates an empty spatial container with the specified extent and resolution.
virtual void setExtent (const DtManagedObjectListConstPtr &vrfObjects)
 Updates the spatial container's extent to encompasses all the vrfObjects specified by the vrfObject iterator.
virtual void expandExtent (const DtManagedObjectListConstPtr &vrfObjects, DtExtent &expandedExtent) const
 Expands the specified extent to include all the extents of all vrfObjects specified in the vrfObject iterator.
bool testInvariant () const

Protected Attributes

DtSpatialContainermyVrfObjectSpatialContainer
 Spatial container of DtVrfObjects.
DtNonSpatialContainer myNonSpatiallyOrganizedObjects
 Container of objects that fall outside of the spatial subdivision.

Private Member Functions

 DtSpatialVrfObjectManager (const DtSpatialVrfObjectManager &original)
 Copy constructor and assignment operator not implemented.
DtSpatialVrfObjectManageroperator= (const DtSpatialVrfObjectManager &original)

Detailed Description

Implementation of a spatial object manager based on DtSpatialSubdivision.

Member Typedef Documentation

typedef DtNonSpatialContainer::iterator DtSpatialVrfObjectManager::DtNonSpatialVrfObjectIter
typedef DtNonSpatialContainer::const_iterator DtSpatialVrfObjectManager::DtNonSpatialVrfObjectConstIter

Constructor & Destructor Documentation

DtSpatialVrfObjectManager::DtSpatialVrfObjectManager ( unsigned int  xRes = 1,
unsigned int  yRes = 1,
unsigned int  zRes = 1 
)

Constructor Creates a default container, with a single cell unless the resolutions are otherwise specified.

virtual DtSpatialVrfObjectManager::~DtSpatialVrfObjectManager ( )
virtual

Destructor.

DtSpatialVrfObjectManager::DtSpatialVrfObjectManager ( const DtSpatialVrfObjectManager original)
private

Copy constructor and assignment operator not implemented.

Member Function Documentation

DtSpatialVrfObjectManager& DtSpatialVrfObjectManager::operator= ( const DtSpatialVrfObjectManager original)
private
virtual bool DtSpatialVrfObjectManager::initialize ( const DtManagedObjectListConstPtr vrfObjects,
unsigned int  cellCountX,
unsigned int  cellCountY,
unsigned int  cellCountZ 
)
virtual

Initializes the spatial object manager.

This includes creating and initializing spatial container managed by this class

Must be called immediately after creation and before any operations are performed or the container used in any way.

virtual void DtSpatialVrfObjectManager::addVrfObjects ( const DtManagedObjectListConstPtr vrfObjects)
virtual

Spatially sorts the vrfObjects associated in the vrfObjects.

Note
Implementation detail: If the objects do not fit into the spatial container, then they are stored in a non-spatially sorted container.

Implements DtSpatialVrfObjectManagerInterface.

virtual void DtSpatialVrfObjectManager::removeVrfObject ( DtVrfObject vrfObject)
virtual

Removes vrfObject from the set of vrfObjects we are maintaining.

Parameters
vrfObjectPointer to the object to be removed.

Implements DtSpatialVrfObjectManagerInterface.

virtual void DtSpatialVrfObjectManager::clearVrfObjects ( )
virtual

Clears all managed objects from the manager.

Does not affect the spatial container, other than to empty its cells of any elements.

Implements DtSpatialVrfObjectManagerInterface.

virtual bool DtSpatialVrfObjectManager::setResolutions ( unsigned int  xRes,
unsigned int  yRes,
unsigned int  zRes 
)
virtual

Deprecated – doesn't apply to octree manager.

Still necessary for DtSpatialVrfObjectManager. TODO need to push this all into the manager class, instead of having the DtPhysicalWorld assume that things are uniformly subdivided.

Implements DtSpatialVrfObjectManagerInterface.

virtual unsigned int DtSpatialVrfObjectManager::xResolution ( ) const
virtual
Returns
The resolution in the X dimension.
virtual unsigned int DtSpatialVrfObjectManager::yResolution ( ) const
virtual
Returns
The resolution in the Y dimension.
virtual unsigned int DtSpatialVrfObjectManager::zResolution ( ) const
virtual
Returns
The resolution in the Z dimension.
virtual void DtSpatialVrfObjectManager::resolutions ( unsigned int xRes,
unsigned int yRes,
unsigned int zRes 
) const
virtual
Returns
The resolution in each dimension in the specified output parameters.
virtual void DtSpatialVrfObjectManager::reset ( const DtManagedObjectListConstPtr vrfObjects)
virtual

Clears out the current subdivision, sets it to have the minimum extent, that contains all of the DtVrfObjects specified, and adds the specified DtVrfObjects.

Note
This is provided as a memory optimization. Deleting and reallocating the spatial subdivision every tick was inefficient. So the spatial container is just cleared and resized to adjust for entities moving, being created destroyed, etc. This has the benefit of not causing a large memory reallocation, but at the disadvantage of not allowing the spatial subdivision to change its resolution.

Implements DtSpatialVrfObjectManagerInterface.

void DtSpatialVrfObjectManager::visitVrfObjects ( const DtExtent &  extent,
DtSpatialSelectionFunctor callback 
) const
virtual

Functions that call the specified functor for every object intersecting the requested region (whether chord or extent).

The functor should return false while additional processing should be done, and true if processing is complete and visitVrfObjects() should return. Note that processing is not guaranteed to stop immediately when the functor returns true; it is only a recommendation that processing can stop at any time.

Note
The functor may, and probably will, be called for additional DtVrfObjects when a primitive is supplied. We are only guaranteed not to miss any that do intersect.

Implements DtSpatialVrfObjectManagerInterface.

void DtSpatialVrfObjectManager::visitVrfObjects ( const DtChord &  chord,
DtSpatialSelectionFunctor callback 
) const
virtual
virtual const DtSpatialContainer* DtSpatialVrfObjectManager::spatialContainer ( ) const
virtual
Returns
A pointer to the spatial container of vrfObjects.
virtual DtSpatialContainer* DtSpatialVrfObjectManager::spatialContainer ( )
virtual
virtual const DtNonSpatialContainer* DtSpatialVrfObjectManager::nonSpatiallyOrganizedObjects ( ) const
virtual
Returns
A pointer to the container of non-spatially organized objects
virtual DtNonSpatialContainer* DtSpatialVrfObjectManager::nonSpatiallyOrganizedObjects ( )
virtual
virtual bool DtSpatialVrfObjectManager::createSpatialContainer ( const DtExtent &  extent,
unsigned int  cellCountX,
unsigned int  cellCountY,
unsigned int  cellCountZ 
)
protectedvirtual

Creates an empty spatial container with the specified extent and resolution.

Returns
A boolean indicating success or failure in creating the container.
virtual void DtSpatialVrfObjectManager::setExtent ( const DtManagedObjectListConstPtr vrfObjects)
protectedvirtual

Updates the spatial container's extent to encompasses all the vrfObjects specified by the vrfObject iterator.

This does not insert the specified vrfObjects into the spatial container.

Note
This will clear the spatial container of all currently managed objects.
The spatial subdivision member is assumed be valid when this is called. If it is not, nothing is done.
See Also
expandExtentToIncludeVrfObjects
virtual void DtSpatialVrfObjectManager::expandExtent ( const DtManagedObjectListConstPtr vrfObjects,
DtExtent &  expandedExtent 
) const
protectedvirtual

Expands the specified extent to include all the extents of all vrfObjects specified in the vrfObject iterator.

bool DtSpatialVrfObjectManager::testInvariant ( ) const
protected
Returns
a boolean indicating whether or not the class is respecting its invariant or not. If not, returns false.

Member Data Documentation

DtSpatialContainer* DtSpatialVrfObjectManager::myVrfObjectSpatialContainer
protected

Spatial container of DtVrfObjects.

(a pointer because it is not guaranteed to exist at construction.)

DtNonSpatialContainer DtSpatialVrfObjectManager::myNonSpatiallyOrganizedObjects
protected

Container of objects that fall outside of the spatial subdivision.

This is necessary because the spatial subdivision, as configured, may not contain all the vrfObjects specified. Thus the ones that do not fit in the spatial subdivision are stored in this container.


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

Document ID: Generated on Wed Jul 29 00:55:00 EDT 2015 from SVN revision 155257
Copyright © 2005-2015 VT MÄK. All Rights Reserved (www.mak.com)