|
VR-Engage
2.2
|
DtChooseRolePanel provides the main user interface for selecting entities and roles in VR-Engage. It displays lists of available entities, filtering options, role selections, and controls for engaging with the simulation.
This panel manages the transition between the role selection state and the engaged state, handling UI interactions, entity selection, and role configuration.
#include <chooseRolePanel.h>
Public Member Functions | |
| DtChooseRolePanel (makVrv::DtDe &de, makVrv::DtQtDeMainWindow *mainWindow, DtPlayerStationApp &app) | |
| virtual | ~DtChooseRolePanel () override |
| virtual bool | initiallyVisible () const |
| virtual void | showContainer () |
| virtual void | hideContainer () |
| virtual void | tick (double dt) |
| virtual void | setReady (bool ready) |
| DtVreMessageResult | handleSmsLoadComplete (DtVreMessage *msg) |
| virtual void | onSmsChanged () |
| virtual void | onNewEntityCreated () |
| virtual void | resetPanel () |
| void | onDePreTick (makVrv::DtDe &de) |
| void | onDePostTick () |
| virtual void | setEntityStateUpdateTime (double seconds) |
| virtual bool | isObserverViewsButtonActive () const |
| virtual void | enableCreateEntity (bool enabled) |
| virtual void | clearSelectedEntities () |
| virtual void | onElementsAdded (const makVrv::DtElementData::ElementIdList &elements) |
| virtual void | onElementsRemoved (const makVrv::DtElementData::ElementIdList &keys) |
| virtual void | onElementsChanged (const makVrv::DtElementAttributeManager::EntryAttributesList &attributes) |
| virtual DtVreMessageResult | handleSimState (DtVreMessage *msg) |
| virtual void | onSceneSelectionChanged (const makVrv::DtSelectionManager::IdSet &selected, const makVrv::DtSelectionManager::IdSet &deselected) |
| virtual void | onSceneClicked (makVrv::DtUniqueID id, const DtVector &location, double altAboveGround) |
| virtual bool | eventFilter (QObject *p, QEvent *e) override |
| virtual void | installEventFilters () |
| virtual void | removeEventFilters () |
Protected Types | |
| enum | ViewModes { ViewMode_Map , ViewMode_3D } |
| enum | EntityListItemDataFields { DataField_ElementId , DataField_EntityId , DataField_Type , DataField_Force , DataField_Categories , DataField_Countries , DataField_Name , DataField_OwnThis , DataField_EmbarkedRole , DataField_EngagedBy } |
| enum | EntityListItemColumns { ColumnId_Name , ColumnId_Type , ColumnId_Host , ColumnId_Engaged } |
Protected Member Functions | |
| virtual void | updateDisplayLayoutsList (const makVrv::DtSceneObject *sceneObject) |
| virtual int | altitudeSpinboxValueInMeters () |
| void | showOptimizingVRPerformanceDialog () |
| virtual void | on_displayUnitChanged () |
| virtual void | setViewMode (ViewModes mode=ViewMode_3D) |
| virtual void | removeElementFromEntityList (makVrv::DtElementID id) |
| virtual void | addElementToEntityList (const makVrv::DtElementEntry &data) |
| virtual QTreeWidgetItem * | findEntityListItem (const makVrv::DtElementID &id) |
| virtual QTreeWidgetItem * | findEntityListItem (const DtEntityIdentifier &id) |
| virtual void | applyFilters () |
| virtual void | applyFilter (QTreeWidget *tree) |
| virtual bool | viewAllEntities () |
| virtual bool | viewCurrentEntity () |
|
protected |
Enumeration of available view modes.
Defines the supported viewing modes for the observer during role selection. These modes control how the simulation environment is visualized.
| Enumerator | |
|---|---|
| ViewMode_Map | 2D map view mode (top-down orthographic projection) |
| ViewMode_3D | 3D perspective view mode (configurable camera angle) |
|
protected |
Data fields for entity list items.
Defines the data fields stored in each entity list item. These fields provide metadata about the entity and are used for filtering, display, and selection logic. Fields are stored as item data in the QTreeWidgetItem.
|
protected |
Column identifiers for the entity list.
Defines the columns displayed in the entity list tree widget. These columns present entity information to the user and can be used for sorting and navigation.
| makVre::DtChooseRolePanel::DtChooseRolePanel | ( | makVrv::DtDe & | de, |
| makVrv::DtQtDeMainWindow * | mainWindow, | ||
| DtPlayerStationApp & | app ) |
Constructor.
| de | Reference to the display engine |
| mainWindow | Pointer to the main application window |
| app | Reference to the player station application |
Creates a new role selection panel, initializing UI components and connecting signals and slots for event handling.
References de().
|
overridevirtual |
Destructor.
Cleans up resources and disconnects signals.
|
inlinevirtual |
Determines initial visibility of the panel.
Virtual function needed for controlling if the widget is initially visible when docked. Returns false by default, as the panel is typically shown only when entering the role selection state.
|
virtual |
Shows the panel container.
Makes the role selection panel visible to the user.
|
virtual |
Hides the panel container.
Makes the role selection panel invisible to the user.
|
virtual |
Updates the panel state.
| dt | Time in seconds since the last update |
Called once per frame to update the panel's state, handle deferred operations, and refresh the UI as needed.
|
virtual |
Sets the ready state of the panel.
| ready | True if the panel is ready, false otherwise |
Indicates whether the panel is fully initialized and ready for interaction. When ready, certain UI elements become enabled and data loading completes.
|
virtual |
Element signal handlers.
Handles the addition of new elements to the scene
| elements | List of IDs for the added elements |
Called when new elements are added to the display engine scene. Updates the entity list with the new elements that can be engaged.
|
virtual |
Handles the removal of elements from the scene.
| keys | List of IDs for the removed elements |
Called when elements are removed from the display engine scene. Removes the corresponding entries from the entity list.
|
virtual |
Handles changes to element attributes.
| attributes | List of attribute changes for elements |
Called when element attributes change in the display engine. Updates the entity list with the modified information.
|
virtual |
Entity message handlers.
Handles simulation state messages
| msg | Pointer to the simulation state message |
Processes messages about entity simulation state changes, updating the UI with the latest information about entities.
|
virtual |
Scene signal handlers.
Handles scene selection changes
| selected | Set of IDs for newly selected elements |
| deselected | Set of IDs for deselected elements |
Called when the user changes the selection in the 3D scene. Updates the UI to reflect the currently selected entities.
|
virtual |
Handles scene clicks.
| id | Unique ID of the clicked element (if any) |
| location | 3D position of the click |
| altAboveGround | Altitude above ground at the click position |
Called when the user clicks in the 3D scene. Used for selecting entities or determining locations for entity creation.
| DtVreMessageResult makVre::DtChooseRolePanel::handleSmsLoadComplete | ( | DtVreMessage * | msg | ) |
Handles SMS load completion messages.
| msg | Pointer to the SMS load complete message |
Processes messages indicating that loading of Simulation Model Sets (SMS) has completed, triggering UI updates with the new data.
|
virtual |
Handles SMS changes.
Called when the list of active Simulation Model Sets (SMS) changes. Updates the entity lists and filtering options accordingly.
|
virtual |
Handles creation of new entities.
Called when a new entity is created in the simulation. Updates the entity list and may select the new entity.
|
virtual |
Resets the panel to its initial state.
Clears all selections, filters, and cached data, returning the panel to its initial state as if it was just opened. This is typically called when disengaging from a role or when the application state changes.
| void makVre::DtChooseRolePanel::onDePreTick | ( | makVrv::DtDe & | de | ) |
Handles pre-tick events from the display engine.
| de | Reference to the display engine |
Called before the display engine updates each frame. Used for time-sensitive operations that need to occur before rendering.
References de().
| void makVre::DtChooseRolePanel::onDePostTick | ( | ) |
Handles post-tick events from the display engine.
Called after the display engine updates each frame. Used for operations that should occur after rendering is complete.
|
virtual |
Sets the entity state update interval.
| seconds | Number of seconds between updates |
Sets the number of seconds between entity simulation state update cycles. The default value is 5 seconds. Shorter intervals provide more frequent updates but may impact performance.
|
overridevirtual |
Application event handling.
Filters application-level events
| p | Object that received the event |
| e | Event that was received |
Intercepts application-level events for custom processing, such as keyboard shortcuts or mouse events outside the normal widget hierarchy.
|
virtual |
Installs event filters for application-level event handling.
Sets up the event filters to intercept application events before they reach their normal destination widgets.
|
virtual |
Removes previously installed event filters.
Removes the event filters, restoring normal event handling.
|
virtual |
Checks if the observer views button is active.
Determines whether the observer views button in the UI is currently in the active (checked) state. This affects whether observer views are shown alongside the role selection panel.
|
virtual |
Enables or disables the create entity option.
| enabled | True to enable entity creation, false to disable it |
Controls whether the UI allows users to create new entities. This might be disabled in certain contexts or configurations.
|
virtual |
Clears all entity selections.
Deselects all currently selected entities in both the UI and the scene. This resets the selection state without affecting other panel settings.
|
virtualslot |
UI event handlers (slots)
Handles clicks on the "Take Control" (Engage) button
| checked | Whether the button is now checked |
|
virtualslot |
Handles clicks on the "Create New" button.
| checked | Whether the button is now checked |
|
virtualslot |
Handles changes to the category filter.
| category | New category filter value |
|
virtualslot |
Handles changes to the country filter.
| country | New country filter value |
|
virtualslot |
Handles changes to the force filter.
| force | New force filter value |
|
virtualslot |
Handles selection of a different role.
| role | Name of the selected role |
|
virtualslot |
Handles selection of a different display configuration.
| config | Name of the selected configuration |
|
virtualslot |
Handles clicks on the "Reset Filters" button.
|
virtualslot |
Handles changes to the search filter text.
| text | New search filter text |
|
virtualslot |
Handles clicks on the "Reset Search" button.
|
virtualslot |
Handles clicks on items in the entity list.
| item | The tree widget item that was clicked |
| column | The column that was clicked |
|
virtualslot |
Handles double-clicks on items in the entity list.
| item | The tree widget item that was double-clicked |
| column | The column that was double-clicked |
|
virtualslot |
Handles changes in entity selection in the entity list.
Called when the user selects a different entity in the entity list. Updates the role and display layout lists based on the new selection, and may also update the view to focus on the selected entity.
|
virtualslot |
Handles clicks on items in the create entity list.
| item | The tree widget item that was clicked |
| column | The column that was clicked |
Called when the user clicks on an item in the create entity list. Updates the selected entity type and role options based on the clicked item.
|
virtualslot |
Handles double-clicks on items in the create entity list.
| item | The tree widget item that was double-clicked |
| column | The column that was double-clicked |
Called when the user double-clicks on an item in the create entity list. May automatically select the item and begin the entity creation process.
|
virtualslot |
Handles changes in entity selection in the create entity list.
Called when the user selects a different entity type in the create entity list. Updates the role and display layout lists based on the new selection.
|
virtualslot |
Handles edits to the entity name field.
| name | The new entity name |
Called when the user edits the name field for a new entity. Updates the stored name for the entity being created.
|
virtualslot |
Handles toggling of the "at altitude" option.
| on | True if the option is turned on, false otherwise |
Called when the user toggles the option to place an entity at a specific altitude. Enables or disables the altitude input field based on the toggle state.
|
virtualslot |
Handles changes to the altitude value.
| altitude | The new altitude value |
Called when the user changes the altitude value for entity placement. Updates the stored altitude for the entity being created.
|
virtualslot |
Handles changes to the entity heading.
| heading | The new heading value as a string |
Called when the user changes the heading value for entity placement. Updates the stored heading for the entity being created.
|
virtualslot |
Handles changes to the entity pitch.
| pitch | The new pitch value as a string |
Called when the user changes the pitch value for entity placement. Updates the stored pitch for the entity being created.
|
virtualslot |
Handles clicks on the "Reset View" button.
Called when the user clicks the Reset View button. Resets the observer view to show all entities in the scene, providing an overview of the available entities.
|
virtualslot |
Handles toggling of the observer views panel.
| visible | True if the panel should be visible, false otherwise |
Called when the user toggles the observer views panel button. Shows or hides the observer views panel based on the toggle state.
|
virtualslot |
Handles toggling of the map view.
| on | True if map view should be enabled, false otherwise |
Called when the user toggles the map view button. Switches the view mode between 2D map view and 3D perspective view.
|
virtualslot |
Handles toggling of the entity view.
| on | True if entity view should be enabled, false otherwise |
Called when the user toggles the entity view button. Controls whether the view focuses on the selected entity.
|
virtualslot |
Handles clicks on the "Play" button.
Called when the user clicks the Play button. This engages the user with the selected entity using the chosen role and display layout, transitioning from the role selection state to the playing state.
|
virtualslot |
Handles context menu requests in the entity list.
| pos | Position where the context menu was requested |
Called when the user right-clicks on an item in the entity list. Shows a context menu with entity-specific actions.
|
virtualslot |
Handles context menu requests in the create entity list.
| pos | Position where the context menu was requested |
Called when the user right-clicks on an item in the create entity list. Shows a context menu with actions specific to entity creation.
|
virtualslot |
Handles the "Copy ID" action from the entity context menu.
Called when the user selects the Copy ID action from the entity context menu. Copies the selected entity's ID to the clipboard.
|
virtualslot |
Handles the "Copy Type" action from the entity context menu.
Called when the user selects the Copy Type action from the entity context menu. Copies the selected entity's type to the clipboard.
|
virtualslot |
Handles the "Copy Type" action from the create entity context menu.
Called when the user selects the Copy Type action from the create entity context menu. Copies the selected entity type to the clipboard.
|
protectedvirtual |
Repositions the choose role panel.
Adjusts the position and size of the panel within the application window. This is typically called when the window size changes or when the panel is first shown.
|
protectedvirtual |
Provides debugging information.
Called during debugging to output information about the panel's state. This is used for diagnostic purposes during development and testing.
|
protectedvirtual |
List building methods.
Builds the list of entity types that can be created
Populates the create entity list with all available entity types from the current simulation model sets.
|
protectedvirtual |
Builds the list of existing entities in the simulation.
Populates the existing entity list with all entities currently present in the simulation that can be engaged with.
|
protectedvirtual |
Builds the list of entity categories for filtering.
Populates the category filter dropdown with all unique categories found in the available entity types.
|
protectedvirtual |
Builds the list of countries for filtering.
Populates the country filter dropdown with all unique countries found in the available entity types.
|
protectedvirtual |
Builds the list of force types for filtering.
Populates the force filter dropdown with all available force types (Friendly, Hostile, Neutral, etc.).
|
protectedvirtual |
Builds the list of available roles for an entity type.
| entityType | The entity type to get roles for |
Populates the role dropdown with all available roles for the specified entity type.
|
protectedvirtual |
Finds available roles for an entity type.
| entityType | The entity type to find roles for |
| box | Optional combo box to populate with the roles |
Searches for available roles for the specified entity type and optionally populates a combo box with the results.
|
protectedvirtual |
Entity list management methods.
Removes an element from the entity list
| id | ID of the element to remove |
Removes an entity from the list of existing entities based on its element ID.
|
protectedvirtual |
Adds an element to the entity list.
| data | Element data to add |
Adds a new entity to the list of existing entities based on its element data.
|
protectedvirtual |
Finds an item in the entity list by element ID.
| id | Element ID to search for |
Searches the entity list for an item with the specified element ID.
|
protectedvirtual |
Finds an item in the entity list by entity ID.
| id | Entity ID to search for |
Searches the entity list for an item with the specified entity ID.
|
protectedvirtual |
Filter application methods.
Applies all filters to both entity lists
Applies the current search text and category/country/force filters to both the existing entity list and the create entity list.
|
protectedvirtual |
Applies filters to a specific tree widget.
| tree | The tree widget to apply filters to |
Applies the current filters to the specified tree widget, showing only items that match all filter criteria.
|
protectedvirtual |
View manipulation methods.
Centers the view on all entities
Adjusts the observer view to show all entities in the scene.
|
protectedvirtual |
Centers the view on the currently selected entity.
Adjusts the observer view to focus on the currently selected entity.
|
protectedvirtual |
Updates the list of available display layouts.
| sceneObject | Pointer to the scene object representing the selected entity |
Updates the display layout dropdown with layouts available for the selected entity and role combination.
|
protectedvirtual |
Converts the altitude spinbox value to meters.
Uses VR-Vantage's display units manager to convert the altitude spinbox's value from the current display units to meters for internal calculations.
|
protected |
Shows the VR performance optimization dialog.
Displays a dialog offering performance tips for VR display configurations. Called when the user clicks on the "Engage" button and the selected display configuration is a VR configuration. The user can optionally choose to never show the dialog again, in which case it will be suppressed in future sessions.
|
protectedvirtual |
Updates the altitude box's unit suffix.
Changes the altitude spinbox's suffix to match the current display units. Called when the display unit settings change in the application.
|
protectedvirtual |
Sets the current view mode.
| mode | View mode to set (default: 3D view) |
Changes the current view mode between map view (2D) and 3D view. Updates UI elements and observer settings accordingly, including camera position, orientation, projection type, and control sensitivity. The map view is useful for precise placement and spatial awareness, while the 3D view provides better depth perception and visual context.
References ViewMode_3D.
|
protected |
Pointer to the main application window.
References the main application window, used for determining panel placement, accessing application-wide resources, and coordinating UI interactions. This is typically the parent widget for the panel.
|
protected |
Context menu for the entity list.
Context menu displayed when right-clicking on items in the entity list. Contains actions related to the selected entity, such as copying its ID or type information.
|
protected |
Context menu for the create entity list.
Context menu displayed when right-clicking on items in the create entity list. Contains actions related to the selected entity type, such as copying type information or accessing additional entity creation options.
|
protected |
Action for copying entity IDs.
Menu action for copying the selected entity's unique identifier to the clipboard. Useful for developers and testers who need to reference specific entities.
|
protected |
Action for copying entity types.
Menu action for copying the selected entity's type string to the clipboard. Useful for developers and scenario designers working with entity definitions.
|
protected |
Action for copying entity types from the creation list.
Menu action for copying the selected entity type from the create entity list to the clipboard. Useful for referencing available entity types during scenario development or testing.
|
protected |
Event processor for creating new entities.
Handles mouse clicks and other events for entity creation, such as determining placement location and orientations based on user input.
|
protected |
Manager for signal connections.
Manages connections to Qt signals and slots, ensuring proper cleanup when the panel is destroyed or connections need to be broken.
|
protected |
Reference to the player station application.
Provides access to application-level functionality and state, such as entity creation, player station management, and state transitions.
|
protected |
Reference to the display engine.
Provides access to the 3D scene, rendering capabilities, and scene manipulation, used for visualization and entity placement during role selection.
|
protected |
Flag indicating whether spectator mode was requested.
When true, indicates that the user has requested to enter spectator mode, which allows observation without directly controlling an entity.
|
protected |
Flag indicating whether an initial view of all entities was performed.
When true, indicates that the panel has already performed an initial camera adjustment to show all entities when first opened.
|
protected |
Last known count of entities in the scene.
Stores the number of entities present in the scene during the last update. Used to detect changes in entity count for triggering UI updates.
|
protected |
Timer for tracking scene clicks.
Tracks time since the last scene click, used for debouncing rapid clicks and preventing accidental double selections.
|
protected |
Index for cycling through entity updates.
Current index in the entity list for progressive updates. Used to distribute update processing across multiple frames for better performance.
|
protected |
Time of the last entity state update.
Stores the time when the last entity state update was performed, used to control the frequency of state updates based on the update interval.
|
protected |
Interval between entity state updates.
Number of seconds between entity state update cycles. Controls how frequently the panel refreshes entity information from the simulation.
|
protected |
Currently selected entity type.
Stores the entity type that is currently selected in the create entity list. Used for populating role options and other type-specific UI elements.
|
protected |
Flag indicating that the display list needs updating.
When true, the UI needs to refresh the display layouts list based on changes to entity selection, role selection, or other factors.
|
protected |
Cache of role settings by entity type.
Stores display layouts for when switching entity selections or disengaging, allowing the UI to remember previous selections. Maps entity type names to previously selected roles for those types.
|
protected |
Dialog for VR performance optimization tips.
Shows performance optimization tips when controlling an entity in a VR display configuration. This dialog appears the first time a user selects a VR display layout, with an option to suppress future appearances.
|
protected |
Additional manager for signal connections.
Manages a separate set of signal connections, primarily used for temporary connections that need different lifecycle management than the primary signal connections.