VR-Forces Developer's Guide
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
List of all members | Classes | Public Types | Public Member Functions | Static Public Member Functions | Protected Types | Protected Member Functions | Protected Attributes | Friends
makVrv::DtOverlayGroupManager Class Reference

Manages the allocation of overlay groups. Overlay groups are used to determine the draw order of sprites on a 2D overlay. This manager configures overlay group sets and allocates group ids within those sets. The separate group sets allow for all overlay widgets of a specific type to be ordered above or below widgets of a different type. The allocation of different group IDs to each widget within a group ensures that the widget's different components don't fight to be on top. When the first call to nextGroupId( const std::string& ) is made, the configured sets are allocated id ranges, and further modifications to the group sets is prohibited.

Customizing block layout: subclass this manager, override layersPerBlock() to reserve extra slot space and layerSlot() to remap stock layers within the wider block. Register the subclass instance (DE-side registerFastInstance via the instance() substitution pattern, or before the driver's copyInstance runs) BEFORE the first allocation locks the manager. copyInstance propagates the subclass to connection clones through the virtual clone().

Inheritance diagram for makVrv::DtOverlayGroupManager:
Inheritance graph
[legend]

Classes

class  DtOverlayGroupIdGenerator
 

Public Types

enum  OverlayGroupId {
  HiddenGroup = 0, DefaultGroup = 1, UnusedLowGroup = 2, GroupsGroup = 500000,
  UnusedHighGroup = 1000000
}
 
typedef std::list< std::string > GroupRangeList
 

Public Member Functions

virtual DtOverlayGroupManager * clone ()
 
virtual ~DtOverlayGroupManager ()
 
void initializeDefaultGroupSets ()
 
virtual void addOverlayGroupSet (const std::string &name)
 
virtual void addOverlayGroupSetUnder (const std::string &name, const std::string &beforeName)
 
virtual void addOverlayGroupSetAbove (const std::string &name, const std::string &afterName)
 
virtual const GroupRangeList & overlayGroupSets () const
 
virtual GroupRangeList & overlayGroupSets ()
 
virtual unsigned int nextGroupId (const std::string &groupSetName)
 
virtual unsigned int acquireElementBlock (const DtElementID &elementId)
 
virtual void releaseElementBlock (const DtElementID &elementId)
 
virtual unsigned int elementGroupId (DtOverlayZone zone, unsigned int blockIndex, DtElementOverlayLayer layer) const
 
virtual unsigned int layersPerBlock () const
 
virtual unsigned int layerSlot (DtElementOverlayLayer layer) const
 
virtual void setOverlayGroupSetSizeMultiplier (const std::string &name, unsigned int multiplier)
 
virtual unsigned int blocksPerZone () const
 
- Public Member Functions inherited from makVrv::DtVirtualBaseClass
 DtVirtualBaseClass ()
 
virtual ~DtVirtualBaseClass ()
 

Static Public Member Functions

static DtOverlayGroupManager & instance (DtDe &de)
 
static DtOverlayGroupManager & instance (DtBaseConnection &sim)
 
static void copyInstance (DtBaseConnection &sim, DtDe &de)
 

Protected Types

using ElementBlockMap = std::unordered_map< DtElementID, unsigned int >
 
using GroupIdGeneratorList = std::unordered_map< std::string, DtOverlayGroupIdGenerator * >
 

Protected Member Functions

 DtOverlayGroupManager ()
 
 DtOverlayGroupManager (DtDe &de)
 
 DtOverlayGroupManager (const DtOverlayGroupManager &copy)
 
virtual void initializeGroupIdGenerators ()
 

Protected Attributes

GroupIdGeneratorList myGroupIdGenerators
 
GroupRangeList myOverlayGroupRanges
 
std::unordered_map
< std::string, unsigned int > 
myGroupSizeMultipliers
 
ElementBlockMap myElementBlocks
 
std::set< unsigned int > myFreeBlockIndices
 
unsigned int myNextBlockIndex
 
bool myBlockExhaustionWarned
 
unsigned int myNormalZoneBase
 
unsigned int mySelectedZoneBase
 
unsigned int myMouseOverZoneBase
 
unsigned int myBlocksPerZone
 
DtDe * myOptionalDe
 
unsigned int myNextGroupId
 
bool myModificationsLockedFlag
 

Friends

template<typename ManagerClass >
ManagerClass & defaultManagerInstanceFunction (DtDe &, bool)
 
template<typename ManagerClass >
void defaultManagerRegisterInstanceFunction (DtDe &, ManagerClass *)
 

Member Typedef Documentation

typedef std::list<std::string> makVrv::DtOverlayGroupManager::GroupRangeList

List type for the names and order of configured overlay group sets.

Map type from element id to block allocation record.

using makVrv::DtOverlayGroupManager::GroupIdGeneratorList = std::unordered_map<std::string,DtOverlayGroupIdGenerator*>
protected

Map type for mapping overlay group sets to their ID generators.

Member Enumeration Documentation

Enumerates the various special valued overlay group ids.

Enumerator
HiddenGroup 
DefaultGroup 
UnusedLowGroup 
GroupsGroup 
UnusedHighGroup 

Constructor & Destructor Documentation

virtual makVrv::DtOverlayGroupManager::~DtOverlayGroupManager ( )
virtual

Virtual DTOR.

makVrv::DtOverlayGroupManager::DtOverlayGroupManager ( )
protected

Protected CTOR. (Use ::instance(..)).

makVrv::DtOverlayGroupManager::DtOverlayGroupManager ( DtDe &  de)
protected

Protected CTOR. (Use ::instance(..)).

makVrv::DtOverlayGroupManager::DtOverlayGroupManager ( const DtOverlayGroupManager &  copy)
protected

Protected CTOR. (Use ::instance(..)).

Member Function Documentation

static DtOverlayGroupManager& makVrv::DtOverlayGroupManager::instance ( DtDe &  de)
static

Instance method (for use in the main thread).

Returns
the overlay group manager for the given de.
static DtOverlayGroupManager& makVrv::DtOverlayGroupManager::instance ( DtBaseConnection &  sim)
static

Instance method (for use in the connection thread).

Returns
the overlay group manager for the given sim.
virtual DtOverlayGroupManager* makVrv::DtOverlayGroupManager::clone ( )
virtual

Clone function so derived classes can be used with copyInstance.

static void makVrv::DtOverlayGroupManager::copyInstance ( DtBaseConnection &  sim,
DtDe &  de 
)
static

Create a copy of the de's overlay group manager for the base connection.

void makVrv::DtOverlayGroupManager::initializeDefaultGroupSets ( )
inline

Initialization of the default group sets used by VR-Vantage. This method creates the default overlay group sets used by VR-Vantage. The default groups are (ordered from highest to lowest):

  • hoverGroupSet
  • overlayZoneMouseOver (8x ID range - per-entity mouse-over block zone)
  • overlayZoneSelected (8x ID range - per-entity selected/pinned block zone)
  • selectedGroupSet
  • overlayZoneNormal (8x ID range - per-entity normal block zone)
  • aboveIconsGroupSet
  • iconsGroupSet
  • rangeInfoGroupSet
  • entityInfoPinnedGroupSet
  • symbolDecorationGroupSet Users may add additional groups using the addOverlayGroupSet(..), addOverlayGroupSetUnder(..), and addOverlayGroupSetAbove(..) methods, or by modifying the list of groups directly using the overlayGroupSets() method.
virtual void makVrv::DtOverlayGroupManager::addOverlayGroupSet ( const std::string &  name)
virtual

Adds a new set of overlay groups with the given name. The new set is added under all other configured sets.

virtual void makVrv::DtOverlayGroupManager::addOverlayGroupSetUnder ( const std::string &  name,
const std::string &  beforeName 
)
virtual

Adds a new set of overlay groups below the specified set. The new set has the given name and is below the specified set but above all other sets below that one.

virtual void makVrv::DtOverlayGroupManager::addOverlayGroupSetAbove ( const std::string &  name,
const std::string &  afterName 
)
virtual

Adds a new set of overlay groups above the specified set. The new set has the given name and is above the specified set but below all other sets above that one.

virtual const GroupRangeList& makVrv::DtOverlayGroupManager::overlayGroupSets ( ) const
virtual

Accessor for the list of configured overlay group sets (const). Sets towards the beginning of the list are lower on the overlay.

virtual GroupRangeList& makVrv::DtOverlayGroupManager::overlayGroupSets ( )
virtual

Accessor for the list of configured overlay group sets. Sets towards the beginning of the list are lower on the overlay.

Exceptions
DtCorruptedStateif modifications to the manager are locked.
virtual unsigned int makVrv::DtOverlayGroupManager::nextGroupId ( const std::string &  groupSetName)
virtual

Returns the next available group id for the given set. Obtains the group id generator for the set with the given name and returns the group id returned by the generator's nextGroupId() method. If a group set with the given name could not be found, OverlayGroupId::DefaultGroup (1) is returned.

virtual unsigned int makVrv::DtOverlayGroupManager::acquireElementBlock ( const DtElementID &  elementId)
virtual

Acquires a per-entity overlay block for the given element. The first call for a given elementId allocates a fresh block index from the free list (or the next sequential index). Subsequent calls for the same elementId return the same index. Use elementGroupId() to convert a block index and layer into a overlay group id.

Parameters
elementIdthe unique id of the entity element.
Returns
the allocated block index.
See Also
elementGroupId
releaseElementBlock
virtual void makVrv::DtOverlayGroupManager::releaseElementBlock ( const DtElementID &  elementId)
virtual

Releases the per-entity overlay block for the given element. The block index is returned to the free list. Calls for unknown element ids are ignored gracefully.

Parameters
elementIdthe unique id of the entity element.
See Also
acquireElementBlock
virtual unsigned int makVrv::DtOverlayGroupManager::elementGroupId ( DtOverlayZone  zone,
unsigned int  blockIndex,
DtElementOverlayLayer  layer 
) const
virtual

Converts a zone, block index, and layer into an overlay group id. Returns the group id used to draw a widget at the given layer within the given zone for the entity that owns blockIndex.

Parameters
zonethe state zone (Normal, Selected, or Hover).
blockIndexthe index returned by acquireElementBlock.
layerthe DtElementOverlayLayer slot within the block.
Returns
the overlay group id to pass to setOrderGroup / setBackgroundOrderGroup.
Note
Returns OverlayGroupId::DefaultGroup if called before initialization.
virtual unsigned int makVrv::DtOverlayGroupManager::layersPerBlock ( ) const
virtual

Returns the number of overlay group slots per entity block. This is the block stride used when computing element group IDs. Subclasses may return a larger value to reserve room for custom layer slots above the stock LayerCount, provided the value is consistent with layerSlot().

Returns
the slot count per block (default: DtElementOverlayLayer::LayerCount).
virtual unsigned int makVrv::DtOverlayGroupManager::layerSlot ( DtElementOverlayLayer  layer) const
virtual

Maps a stock DtElementOverlayLayer to its slot offset within a block. The base implementation returns static_cast<unsigned int>(layer). Subclasses that widen the block (by overriding layersPerBlock) may remap stock layers to non-contiguous slot positions so custom layers can fill the gaps.

Parameters
layerthe DtElementOverlayLayer to map.
Returns
the slot offset within the element block.
virtual void makVrv::DtOverlayGroupManager::setOverlayGroupSetSizeMultiplier ( const std::string &  name,
unsigned int  multiplier 
)
virtual

Sets the ID-range size multiplier for the named group set. Multiplies the number of group IDs allocated to the named set relative to a default set (multiplier 1). A set at multiplier 8 receives 8x the ID slots of a default set. Does not affect draw ordering, which comes solely from the set's position in the ordered list. Must be called before the first nextGroupId() or acquireElementBlock() call locks the manager.

Parameters
namethe name of the group set.
multiplierID-range size multiplier (default 1; zone sets use 8).
Note
The call is ignored (with a warning) if modifications are already locked.
virtual unsigned int makVrv::DtOverlayGroupManager::blocksPerZone ( ) const
virtual

Returns the number of entity blocks that fit within one zone.

Returns
myBlocksPerZone; valid after the first nextGroupId() or acquireElementBlock() call (zero before that).
virtual void makVrv::DtOverlayGroupManager::initializeGroupIdGenerators ( )
protectedvirtual

Initializes the group id generators for all configured sets. Ranges for the individual group sets are allocated based on the size multiplier of each set (default multiplier 1; zone sets use 8).

Friends And Related Function Documentation

template<typename ManagerClass >
ManagerClass& defaultManagerInstanceFunction ( DtDe &  de,
bool  allowedInSlave 
)
friend

default Manager instance function. Manager requirements: 1) Static instance function 2) Protected DtSignalConnectionManager named myConnections. 3) Member functioned called loadDefaults which takes no arguments. and loads the default settings of the manager or factory from disk. 4) define defaultManagerInstanceFunction as friend. 5) define defaultManagerRegisterInstanceFunction as friend (see below). 5) Protected Constructor which only takes a DtDe reference.

Befriend the manager instance functions for instance retreival/creation.

Befriend the manager instance functions for instance retrieval/creation.

class Manager
{
public:
static Manager& instance(DtDe& de);
void loadDefaults();
protected:
template <typename ManagerClass>
friend ManagerClass& defaultManagerInstanceFunction(DtDe& de, bool);
template <typename ManagerClass>
friend void defaultManagerRegisterInstanceFunction(DtDe& de, ManagerClass* mgr)
Manager(DtDe&);
DtSignalConnectionManager myConnections;
};

Then simply in the implementation of instance call defaultManagerInstanceFunction with the de object and return the return value.

Manager& Manager::instance(DtDe& de)
{
return defaultManagerInstanceFunction<Manager>(de);
}
template<typename ManagerClass >
void defaultManagerRegisterInstanceFunction ( DtDe &  de,
ManagerClass *  mgr 
)
friend

Default implementation of how to register a manager, especially necessary when overriding the manager.

Befriend the manager instance functions for instance retreival/creation.

Befriend the manager instance functions for instance retrieval/creation.

static void Manager::registerInstance(DtDe& de, Manager* mgr)
{
}
...else where call.
// Assuming class NewManager : public Manager
Manager::registerInstance(de,new NewManager(de));

Member Data Documentation

GroupIdGeneratorList makVrv::DtOverlayGroupManager::myGroupIdGenerators
protected
GroupRangeList makVrv::DtOverlayGroupManager::myOverlayGroupRanges
protected
std::unordered_map<std::string, unsigned int> makVrv::DtOverlayGroupManager::myGroupSizeMultipliers
protected

Per-set ID-range size multipliers; unregistered sets default to 1.

ElementBlockMap makVrv::DtOverlayGroupManager::myElementBlocks
protected

Per-entity block allocations, keyed by DtElementID.

std::set<unsigned int> makVrv::DtOverlayGroupManager::myFreeBlockIndices
protected

Recycled block indices awaiting reuse. std::set deduplicates double-releases and yields deterministic lowest-index-first reuse.

unsigned int makVrv::DtOverlayGroupManager::myNextBlockIndex
protected

Next sequential block index to hand out when free list is empty.

bool makVrv::DtOverlayGroupManager::myBlockExhaustionWarned
protected

True after the one-time block exhaustion warning has been emitted.

unsigned int makVrv::DtOverlayGroupManager::myNormalZoneBase
protected

Base group id of the overlayZoneNormal range.

unsigned int makVrv::DtOverlayGroupManager::mySelectedZoneBase
protected

Base group id of the overlayZoneSelected range.

unsigned int makVrv::DtOverlayGroupManager::myMouseOverZoneBase
protected

Base group id of the overlayZoneMouseOver range.

unsigned int makVrv::DtOverlayGroupManager::myBlocksPerZone
protected

Number of entity blocks that fit within one zone.

DtDe* makVrv::DtOverlayGroupManager::myOptionalDe
protected
unsigned int makVrv::DtOverlayGroupManager::myNextGroupId
protected
bool makVrv::DtOverlayGroupManager::myModificationsLockedFlag
protected

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

Document ID: Generated on Thu Oct 15 21:27:02 EDT 2026 from SVN revision 296421
Copyright © 2005-2026 MAK Technologies. All Rights Reserved (www.mak.com)