VR-Engage  2.2
Loading...
Searching...
No Matches
chooseRolePanel.h
Go to the documentation of this file.
1/******************************************************************************
2** Copyright (c) 2025 MAK Technologies
3** All rights reserved.
4******************************************************************************/
5
6//! \file chooseRolePanel.h
7//! \brief Defines the DtChooseRolePanel class for selecting entity roles
8//!
9//! This file contains the DtChooseRolePanel class, which provides the user interface
10//! for selecting and engaging with entities in VR-Engage. It displays available
11//! entities, their roles, and various filtering options to help users find and
12//! select appropriate roles to play.
13
14#pragma once
15
17
18#include "vrePlayerStation/chooseRolePanelUI.hpp"
21
22#include <vrvCoreQt/DtDockable.h>
23
24#include <vrvCore/DtUniqueID.h>
25#include <vrvCore/DtElementData.h>
26#include <vrvCore/DtSelectionManager.h>
27#include <vrvCore/DtElementAttributeManager.h>
28
29#include <vrvUtil/DtSignalConnectionManager.h>
30
31namespace makVrv
32{
33class DtSceneObject;
34class DtQtDeMainWindow;
35} // namespace makVrv
36
37namespace makVre
38{
39//! \brief Forward declaration of the player station application class
41
42//! \brief Forward declaration of the entity event processor class
44
45//! \brief Forward declaration of the VR performance dialog class
47
48//! \brief UI panel for selecting and engaging with entities and roles
49//!
50//! DtChooseRolePanel provides the main user interface for selecting entities
51//! and roles in VR-Engage. It displays lists of available entities, filtering
52//! options, role selections, and controls for engaging with the simulation.
53//!
54//! This panel manages the transition between the role selection state and the
55//! engaged state, handling UI interactions, entity selection, and role configuration.
57 //, public makVrv::DtDockable
58 ,
59 public Ui::DtChooseRolePanelUI
60{
61 Q_OBJECT;
62
63public:
64 //! \brief Constructor
65 //! \param de Reference to the display engine
66 //! \param mainWindow Pointer to the main application window
67 //! \param app Reference to the player station application
68 //!
69 //! Creates a new role selection panel, initializing UI components and
70 //! connecting signals and slots for event handling.
71 DtChooseRolePanel(makVrv::DtDe& de, makVrv::DtQtDeMainWindow* mainWindow, DtPlayerStationApp& app);
72
73 //! \brief Destructor
74 //!
75 //! Cleans up resources and disconnects signals.
76 virtual ~DtChooseRolePanel() override;
77
78 //! \brief Determines initial visibility of the panel
79 //! \return False to indicate the panel should initially be hidden
80 //!
81 //! Virtual function needed for controlling if the widget is initially
82 //! visible when docked. Returns false by default, as the panel is typically
83 //! shown only when entering the role selection state.
84 virtual bool initiallyVisible() const { return false; }
85
86 //! \brief Shows the panel container
87 //!
88 //! Makes the role selection panel visible to the user.
89 virtual void showContainer();
90
91 //! \brief Hides the panel container
92 //!
93 //! Makes the role selection panel invisible to the user.
94 virtual void hideContainer();
95
96 //! \brief Updates the panel state
97 //! \param dt Time in seconds since the last update
98 //!
99 //! Called once per frame to update the panel's state, handle deferred operations,
100 //! and refresh the UI as needed.
101 virtual void tick(double dt);
102
103 //! \brief Sets the ready state of the panel
104 //! \param ready True if the panel is ready, false otherwise
105 //!
106 //! Indicates whether the panel is fully initialized and ready for interaction.
107 //! When ready, certain UI elements become enabled and data loading completes.
108 virtual void setReady(bool ready);
109
110 //! \brief Element signal handlers
111 //! @{
112
113 //! \brief Handles the addition of new elements to the scene
114 //! \param elements List of IDs for the added elements
115 //!
116 //! Called when new elements are added to the display engine scene.
117 //! Updates the entity list with the new elements that can be engaged.
118 virtual void onElementsAdded(const makVrv::DtElementData::ElementIdList& elements);
119
120 //! \brief Handles the removal of elements from the scene
121 //! \param keys List of IDs for the removed elements
122 //!
123 //! Called when elements are removed from the display engine scene.
124 //! Removes the corresponding entries from the entity list.
125 virtual void onElementsRemoved(const makVrv::DtElementData::ElementIdList& keys);
126
127 //! \brief Handles changes to element attributes
128 //! \param attributes List of attribute changes for elements
129 //!
130 //! Called when element attributes change in the display engine.
131 //! Updates the entity list with the modified information.
132 virtual void onElementsChanged(const makVrv::DtElementAttributeManager::EntryAttributesList& attributes);
133 //! @}
134
135 //! \brief Entity message handlers
136 //! @{
137
138 //! \brief Handles simulation state messages
139 //! \param msg Pointer to the simulation state message
140 //! \return Message handling result
141 //!
142 //! Processes messages about entity simulation state changes,
143 //! updating the UI with the latest information about entities.
145 //! @}
146
147 //! \brief Scene signal handlers
148 //! @{
149
150 //! \brief Handles scene selection changes
151 //! \param selected Set of IDs for newly selected elements
152 //! \param deselected Set of IDs for deselected elements
153 //!
154 //! Called when the user changes the selection in the 3D scene.
155 //! Updates the UI to reflect the currently selected entities.
157 const makVrv::DtSelectionManager::IdSet& selected, const makVrv::DtSelectionManager::IdSet& deselected);
158
159 //! \brief Handles scene clicks
160 //! \param id Unique ID of the clicked element (if any)
161 //! \param location 3D position of the click
162 //! \param altAboveGround Altitude above ground at the click position
163 //!
164 //! Called when the user clicks in the 3D scene. Used for selecting
165 //! entities or determining locations for entity creation.
166 virtual void onSceneClicked(makVrv::DtUniqueID id, const DtVector& location, double altAboveGround);
167 //! @}
168
169 //! \brief Handles SMS load completion messages
170 //! \param msg Pointer to the SMS load complete message
171 //! \return Message handling result
172 //!
173 //! Processes messages indicating that loading of Simulation Model Sets (SMS)
174 //! has completed, triggering UI updates with the new data.
176
177 //! \brief Handles SMS changes
178 //!
179 //! Called when the list of active Simulation Model Sets (SMS) changes.
180 //! Updates the entity lists and filtering options accordingly.
181 virtual void onSmsChanged();
182
183 //! \brief Handles creation of new entities
184 //!
185 //! Called when a new entity is created in the simulation.
186 //! Updates the entity list and may select the new entity.
187 virtual void onNewEntityCreated();
188
189 //! \brief Resets the panel to its initial state
190 //!
191 //! Clears all selections, filters, and cached data, returning the panel
192 //! to its initial state as if it was just opened. This is typically called
193 //! when disengaging from a role or when the application state changes.
194 virtual void resetPanel();
195
196 //! \brief Handles pre-tick events from the display engine
197 //! \param de Reference to the display engine
198 //!
199 //! Called before the display engine updates each frame.
200 //! Used for time-sensitive operations that need to occur before rendering.
201 void onDePreTick(makVrv::DtDe& de);
202
203 //! \brief Handles post-tick events from the display engine
204 //!
205 //! Called after the display engine updates each frame.
206 //! Used for operations that should occur after rendering is complete.
208
209 //! \brief Sets the entity state update interval
210 //! \param seconds Number of seconds between updates
211 //!
212 //! Sets the number of seconds between entity simulation state update cycles.
213 //! The default value is 5 seconds. Shorter intervals provide more frequent
214 //! updates but may impact performance.
215 virtual void setEntityStateUpdateTime(double seconds);
216
217 //! \brief Application event handling
218 //! @{
219
220 //! \brief Filters application-level events
221 //! \param p Object that received the event
222 //! \param e Event that was received
223 //! \return True if the event was handled, false to pass it on
224 //!
225 //! Intercepts application-level events for custom processing, such as
226 //! keyboard shortcuts or mouse events outside the normal widget hierarchy.
227 virtual bool eventFilter(QObject* p, QEvent* e) override;
228
229 //! \brief Installs event filters for application-level event handling
230 //!
231 //! Sets up the event filters to intercept application events before
232 //! they reach their normal destination widgets.
233 virtual void installEventFilters();
234
235 //! \brief Removes previously installed event filters
236 //!
237 //! Removes the event filters, restoring normal event handling.
238 virtual void removeEventFilters();
239 //! @}
240
241 //! \brief Checks if the observer views button is active
242 //! \return True if the observer views button is checked, false otherwise
243 //!
244 //! Determines whether the observer views button in the UI is currently
245 //! in the active (checked) state. This affects whether observer views
246 //! are shown alongside the role selection panel.
247 virtual bool isObserverViewsButtonActive() const;
248
249 //! \brief Enables or disables the create entity option
250 //! \param enabled True to enable entity creation, false to disable it
251 //!
252 //! Controls whether the UI allows users to create new entities.
253 //! This might be disabled in certain contexts or configurations.
254 virtual void enableCreateEntity(bool enabled);
255
256 //! \brief Clears all entity selections
257 //!
258 //! Deselects all currently selected entities in both the UI and the scene.
259 //! This resets the selection state without affecting other panel settings.
260 virtual void clearSelectedEntities();
261
262public slots:
263 //! \brief UI event handlers (slots)
264 //! @{
265
266 //! \brief Handles clicks on the "Take Control" (Engage) button
267 //! \param checked Whether the button is now checked
268 virtual void slot_onTakeControlClicked(bool checked);
269
270 //! \brief Handles clicks on the "Create New" button
271 //! \param checked Whether the button is now checked
272 virtual void slot_onCreateNewClicked(bool checked);
273
274 //! \brief Handles changes to the category filter
275 //! \param category New category filter value
276 virtual void slot_onCategoryFilterChanged(const QString& category);
277
278 //! \brief Handles changes to the country filter
279 //! \param country New country filter value
280 virtual void slot_onCountryFilterChanged(const QString& country);
281
282 //! \brief Handles changes to the force filter
283 //! \param force New force filter value
284 virtual void slot_onForceFilterChanged(const QString& force);
285
286 //! \brief Handles selection of a different role
287 //! \param role Name of the selected role
288 virtual void slot_onRoleSelectionChanged(const QString& role);
289
290 //! \brief Handles selection of a different display configuration
291 //! \param config Name of the selected configuration
292 virtual void slot_onConfigurationSelectionChanged(const QString& config);
293
294 //! \brief Handles clicks on the "Reset Filters" button
296
297 //! \brief Handles changes to the search filter text
298 //! \param text New search filter text
299 virtual void slot_onSearchFilterChanged(const QString& text);
300
301 //! \brief Handles clicks on the "Reset Search" button
303
304 //! \brief Handles clicks on items in the entity list
305 //! \param item The tree widget item that was clicked
306 //! \param column The column that was clicked
307 virtual void slot_onEntityItemClicked(QTreeWidgetItem* item, int column);
308
309 //! \brief Handles double-clicks on items in the entity list
310 //! \param item The tree widget item that was double-clicked
311 //! \param column The column that was double-clicked
312 virtual void slot_onEntityItemDoubleClicked(QTreeWidgetItem*, int);
313
314 //! \brief Handles changes in entity selection in the entity list
315 //!
316 //! Called when the user selects a different entity in the entity list.
317 //! Updates the role and display layout lists based on the new selection,
318 //! and may also update the view to focus on the selected entity.
320
321 //! \brief Handles clicks on items in the create entity list
322 //! \param item The tree widget item that was clicked
323 //! \param column The column that was clicked
324 //!
325 //! Called when the user clicks on an item in the create entity list.
326 //! Updates the selected entity type and role options based on the clicked item.
327 virtual void slot_onCreateItemClicked(QTreeWidgetItem* item, int column);
328
329 //! \brief Handles double-clicks on items in the create entity list
330 //! \param item The tree widget item that was double-clicked
331 //! \param column The column that was double-clicked
332 //!
333 //! Called when the user double-clicks on an item in the create entity list.
334 //! May automatically select the item and begin the entity creation process.
335 virtual void slot_onCreateItemDoubleClicked(QTreeWidgetItem* item, int column);
336
337 //! \brief Handles changes in entity selection in the create entity list
338 //!
339 //! Called when the user selects a different entity type in the create entity list.
340 //! Updates the role and display layout lists based on the new selection.
342
343 //! \brief Handles edits to the entity name field
344 //! \param name The new entity name
345 //!
346 //! Called when the user edits the name field for a new entity.
347 //! Updates the stored name for the entity being created.
348 virtual void slot_onNameEdited(const QString& name);
349
350 //! \brief Handles toggling of the "at altitude" option
351 //! \param on True if the option is turned on, false otherwise
352 //!
353 //! Called when the user toggles the option to place an entity at a specific altitude.
354 //! Enables or disables the altitude input field based on the toggle state.
355 virtual void slot_onAtAltitudeToggled(bool on);
356
357 //! \brief Handles changes to the altitude value
358 //! \param altitude The new altitude value
359 //!
360 //! Called when the user changes the altitude value for entity placement.
361 //! Updates the stored altitude for the entity being created.
362 virtual void slot_onAltitudeChanged(int altitude);
363
364 //! \brief Handles changes to the entity heading
365 //! \param heading The new heading value as a string
366 //!
367 //! Called when the user changes the heading value for entity placement.
368 //! Updates the stored heading for the entity being created.
369 virtual void slot_onHeadingChanged(const QString& heading);
370
371 //! \brief Handles changes to the entity pitch
372 //! \param pitch The new pitch value as a string
373 //!
374 //! Called when the user changes the pitch value for entity placement.
375 //! Updates the stored pitch for the entity being created.
376 virtual void slot_onPitchChanged(const QString& pitch);
377
378 //! \brief Handles clicks on the "Reset View" button
379 //!
380 //! Called when the user clicks the Reset View button. Resets the
381 //! observer view to show all entities in the scene, providing an
382 //! overview of the available entities.
384
385 //! \brief Handles toggling of the observer views panel
386 //! \param visible True if the panel should be visible, false otherwise
387 //!
388 //! Called when the user toggles the observer views panel button.
389 //! Shows or hides the observer views panel based on the toggle state.
390 virtual void slot_onObserverViewsPanelToggled(bool visible);
391
392 //! \brief Handles toggling of the map view
393 //! \param on True if map view should be enabled, false otherwise
394 //!
395 //! Called when the user toggles the map view button. Switches the
396 //! view mode between 2D map view and 3D perspective view.
397 virtual void slot_onMapViewToggled(bool on);
398
399 //! \brief Handles toggling of the entity view
400 //! \param on True if entity view should be enabled, false otherwise
401 //!
402 //! Called when the user toggles the entity view button. Controls
403 //! whether the view focuses on the selected entity.
404 virtual void slot_onEntityViewToggled(bool on);
405
406 //! \brief Handles clicks on the "Play" button
407 //!
408 //! Called when the user clicks the Play button. This engages the
409 //! user with the selected entity using the chosen role and display layout,
410 //! transitioning from the role selection state to the playing state.
411 virtual void slot_onPlayClicked();
412
413 //! \brief Handles context menu requests in the entity list
414 //! \param pos Position where the context menu was requested
415 //!
416 //! Called when the user right-clicks on an item in the entity list.
417 //! Shows a context menu with entity-specific actions.
418 virtual void slot_onEntityContextMenu(const QPoint& pos);
419
420 //! \brief Handles context menu requests in the create entity list
421 //! \param pos Position where the context menu was requested
422 //!
423 //! Called when the user right-clicks on an item in the create entity list.
424 //! Shows a context menu with actions specific to entity creation.
425 virtual void slot_onCreateContextMenu(const QPoint& pos);
426
427 //! \brief Handles the "Copy ID" action from the entity context menu
428 //!
429 //! Called when the user selects the Copy ID action from the entity
430 //! context menu. Copies the selected entity's ID to the clipboard.
432
433 //! \brief Handles the "Copy Type" action from the entity context menu
434 //!
435 //! Called when the user selects the Copy Type action from the entity
436 //! context menu. Copies the selected entity's type to the clipboard.
438
439 //! \brief Handles the "Copy Type" action from the create entity context menu
440 //!
441 //! Called when the user selects the Copy Type action from the create entity
442 //! context menu. Copies the selected entity type to the clipboard.
444
445protected:
446 //! \brief Repositions the choose role panel
447 //!
448 //! Adjusts the position and size of the panel within the application window.
449 //! This is typically called when the window size changes or when the panel
450 //! is first shown.
452
453 //! \brief Provides debugging information
454 //!
455 //! Called during debugging to output information about the panel's state.
456 //! This is used for diagnostic purposes during development and testing.
457 virtual void debugCallback();
458
459 //! \brief List building methods
460 //! @{
461
462 //! \brief Builds the list of entity types that can be created
463 //!
464 //! Populates the create entity list with all available entity types
465 //! from the current simulation model sets.
466 virtual void buildCreateEntityList();
467
468 //! \brief Builds the list of existing entities in the simulation
469 //!
470 //! Populates the existing entity list with all entities currently
471 //! present in the simulation that can be engaged with.
473
474 //! \brief Builds the list of entity categories for filtering
475 //!
476 //! Populates the category filter dropdown with all unique categories
477 //! found in the available entity types.
478 virtual void buildCategoriesList();
479
480 //! \brief Builds the list of countries for filtering
481 //!
482 //! Populates the country filter dropdown with all unique countries
483 //! found in the available entity types.
484 virtual void buildCountriesList();
485
486 //! \brief Builds the list of force types for filtering
487 //!
488 //! Populates the force filter dropdown with all available force types
489 //! (Friendly, Hostile, Neutral, etc.).
490 virtual void buildForcesList();
491
492 //! \brief Builds the list of available roles for an entity type
493 //! \param entityType The entity type to get roles for
494 //!
495 //! Populates the role dropdown with all available roles for the
496 //! specified entity type.
497 virtual void buildRolesList(const DtEntityType& entityType);
498
499 //! \brief Finds available roles for an entity type
500 //! \param entityType The entity type to find roles for
501 //! \param box Optional combo box to populate with the roles
502 //! \return True if roles were found, false otherwise
503 //!
504 //! Searches for available roles for the specified entity type and
505 //! optionally populates a combo box with the results.
506 virtual bool findRoles(const DtEntityType& entityType, QComboBox* box = NULL);
507
508 //! @}
509
510 //! \brief Entity list management methods
511 //! @{
512
513 //! \brief Removes an element from the entity list
514 //! \param id ID of the element to remove
515 //!
516 //! Removes an entity from the list of existing entities based on its element ID.
517 virtual void removeElementFromEntityList(makVrv::DtElementID id);
518
519 //! \brief Adds an element to the entity list
520 //! \param data Element data to add
521 //!
522 //! Adds a new entity to the list of existing entities based on its element data.
523 virtual void addElementToEntityList(const makVrv::DtElementEntry& data);
524
525 //! \brief Finds an item in the entity list by element ID
526 //! \param id Element ID to search for
527 //! \return Pointer to the found item, or NULL if not found
528 //!
529 //! Searches the entity list for an item with the specified element ID.
530 virtual QTreeWidgetItem* findEntityListItem(const makVrv::DtElementID& id);
531
532 //! \brief Finds an item in the entity list by entity ID
533 //! \param id Entity ID to search for
534 //! \return Pointer to the found item, or NULL if not found
535 //!
536 //! Searches the entity list for an item with the specified entity ID.
537 virtual QTreeWidgetItem* findEntityListItem(const DtEntityIdentifier& id);
538 //! @}
539
540 //! \brief Filter application methods
541 //! @{
542
543 //! \brief Applies all filters to both entity lists
544 //!
545 //! Applies the current search text and category/country/force filters
546 //! to both the existing entity list and the create entity list.
547 virtual void applyFilters();
548
549 //! \brief Applies filters to a specific tree widget
550 //! \param tree The tree widget to apply filters to
551 //!
552 //! Applies the current filters to the specified tree widget, showing
553 //! only items that match all filter criteria.
554 virtual void applyFilter(QTreeWidget* tree);
555 //! @}
556
557 //! \brief View manipulation methods
558 //! @{
559
560 //! \brief Centers the view on all entities
561 //! \return True if the view was adjusted successfully, false otherwise
562 //!
563 //! Adjusts the observer view to show all entities in the scene.
564 virtual bool viewAllEntities();
565
566 //! \brief Centers the view on the currently selected entity
567 //! \return True if the view was adjusted successfully, false otherwise
568 //!
569 //! Adjusts the observer view to focus on the currently selected entity.
570 virtual bool viewCurrentEntity();
571 //! @}
572
573 //! \brief Updates the list of available display layouts
574 //! \param sceneObject Pointer to the scene object representing the selected entity
575 //!
576 //! Updates the display layout dropdown with layouts available for the
577 //! selected entity and role combination.
578 virtual void updateDisplayLayoutsList(const makVrv::DtSceneObject* sceneObject);
579
580 //! \brief Converts the altitude spinbox value to meters
581 //! \return Altitude value in meters
582 //!
583 //! Uses VR-Vantage's display units manager to convert the altitude spinbox's
584 //! value from the current display units to meters for internal calculations.
586
587 //! \brief Shows the VR performance optimization dialog
588 //!
589 //! Displays a dialog offering performance tips for VR display configurations.
590 //! Called when the user clicks on the "Engage" button and the selected display
591 //! configuration is a VR configuration. The user can optionally choose to never
592 //! show the dialog again, in which case it will be suppressed in future sessions.
594
595 //! \brief Updates the altitude box's unit suffix
596 //!
597 //! Changes the altitude spinbox's suffix to match the current display units.
598 //! Called when the display unit settings change in the application.
599 virtual void on_displayUnitChanged();
600
601 //! \brief Pointer to the main application window
602 //!
603 //! References the main application window, used for determining panel placement,
604 //! accessing application-wide resources, and coordinating UI interactions.
605 //! This is typically the parent widget for the panel.
606 QMainWindow* myMainWindow;
607
608 //! \brief Context menu for the entity list
609 //!
610 //! Context menu displayed when right-clicking on items in the entity list.
611 //! Contains actions related to the selected entity, such as copying its ID
612 //! or type information.
614
615 //! \brief Context menu for the create entity list
616 //!
617 //! Context menu displayed when right-clicking on items in the create entity list.
618 //! Contains actions related to the selected entity type, such as copying type
619 //! information or accessing additional entity creation options.
621
622 //! \brief Action for copying entity IDs
623 //!
624 //! Menu action for copying the selected entity's unique identifier to the clipboard.
625 //! Useful for developers and testers who need to reference specific entities.
627
628 //! \brief Action for copying entity types
629 //!
630 //! Menu action for copying the selected entity's type string to the clipboard.
631 //! Useful for developers and scenario designers working with entity definitions.
633
634 //! \brief Action for copying entity types from the creation list
635 //!
636 //! Menu action for copying the selected entity type from the create entity list
637 //! to the clipboard. Useful for referencing available entity types during
638 //! scenario development or testing.
640
641 //! \brief Enumeration of available view modes
642 //!
643 //! Defines the supported viewing modes for the observer during role selection.
644 //! These modes control how the simulation environment is visualized.
646 {
647 ViewMode_Map, //!< 2D map view mode (top-down orthographic projection)
648 ViewMode_3D //!< 3D perspective view mode (configurable camera angle)
649 };
650
651 //! \brief Sets the current view mode
652 //! \param mode View mode to set (default: 3D view)
653 //! \return True if the view mode was changed successfully, false otherwise
654 //!
655 //! Changes the current view mode between map view (2D) and 3D view.
656 //! Updates UI elements and observer settings accordingly, including camera
657 //! position, orientation, projection type, and control sensitivity.
658 //! The map view is useful for precise placement and spatial awareness,
659 //! while the 3D view provides better depth perception and visual context.
660 virtual void setViewMode(ViewModes mode = ViewMode_3D);
661
662 //! \brief Data fields for entity list items
663 //!
664 //! Defines the data fields stored in each entity list item. These fields
665 //! provide metadata about the entity and are used for filtering, display,
666 //! and selection logic. Fields are stored as item data in the QTreeWidgetItem.
668 {
669 DataField_ElementId, //!< Display engine element ID from the scene graph
670 DataField_EntityId, //!< Simulation entity ID used in network messages
671 DataField_Type, //!< Entity type (e.g., "T-72", "M1A2", "Infantry")
672 DataField_Force, //!< Force type (friendly, hostile, neutral, etc.)
673 DataField_Categories, //!< Categories the entity belongs to (e.g., "Ground", "Air")
674 DataField_Countries, //!< Countries associated with the entity (e.g., "USA", "UK")
675 DataField_Name, //!< Display name of the entity shown in the UI
676 DataField_OwnThis, //!< Whether this entity is owned by the current player
677 DataField_EmbarkedRole, //!< Role this entity is embarked as (if applicable)
678 DataField_EngagedBy, //!< Player name who is currently engaged with this entity
679 };
680
681 //! \brief Column identifiers for the entity list
682 //!
683 //! Defines the columns displayed in the entity list tree widget. These columns
684 //! present entity information to the user and can be used for sorting and navigation.
686 {
687 ColumnId_Name, //!< Name column showing entity display name
688 ColumnId_Type, //!< Type column showing entity type designation
689 ColumnId_Host, //!< Host column showing containing entity (if embarked)
690 ColumnId_Engaged, //!< Engaged column showing engagement status and player
691 };
692
693 //! \brief Event processor for creating new entities
694 //!
695 //! Handles mouse clicks and other events for entity creation, such as
696 //! determining placement location and orientations based on user input.
698
699 //! \brief Manager for signal connections
700 //!
701 //! Manages connections to Qt signals and slots, ensuring proper cleanup
702 //! when the panel is destroyed or connections need to be broken.
703 makVrv::DtSignalConnectionManager mySignals;
704
705 //! \brief Reference to the player station application
706 //!
707 //! Provides access to application-level functionality and state,
708 //! such as entity creation, player station management, and state transitions.
710
711 //! \brief Reference to the display engine
712 //!
713 //! Provides access to the 3D scene, rendering capabilities, and scene manipulation,
714 //! used for visualization and entity placement during role selection.
715 makVrv::DtDe& myDe;
716
717 //! \brief Flag indicating whether spectator mode was requested
718 //!
719 //! When true, indicates that the user has requested to enter spectator mode,
720 //! which allows observation without directly controlling an entity.
722
723 //! \brief Flag indicating whether an initial view of all entities was performed
724 //!
725 //! When true, indicates that the panel has already performed an initial
726 //! camera adjustment to show all entities when first opened.
728
729 //! \brief Last known count of entities in the scene
730 //!
731 //! Stores the number of entities present in the scene during the last update.
732 //! Used to detect changes in entity count for triggering UI updates.
734
735 //! \brief Timer for tracking scene clicks
736 //!
737 //! Tracks time since the last scene click, used for debouncing rapid clicks
738 //! and preventing accidental double selections.
740
741 //! \brief Index for cycling through entity updates
742 //!
743 //! Current index in the entity list for progressive updates. Used to
744 //! distribute update processing across multiple frames for better performance.
746
747 //! \brief Time of the last entity state update
748 //!
749 //! Stores the time when the last entity state update was performed, used
750 //! to control the frequency of state updates based on the update interval.
752
753 //! \brief Interval between entity state updates
754 //!
755 //! Number of seconds between entity state update cycles. Controls how
756 //! frequently the panel refreshes entity information from the simulation.
758
759 //! \brief Currently selected entity type
760 //!
761 //! Stores the entity type that is currently selected in the create entity list.
762 //! Used for populating role options and other type-specific UI elements.
764
765 //! \brief Flag indicating that the display list needs updating
766 //!
767 //! When true, the UI needs to refresh the display layouts list based on
768 //! changes to entity selection, role selection, or other factors.
770
771 //! \brief Cache of role settings by entity type
772 //!
773 //! Stores display layouts for when switching entity selections
774 //! or disengaging, allowing the UI to remember previous selections.
775 //! Maps entity type names to previously selected roles for those types.
776 std::map<std::string, std::string> myPreviousRoleSettings;
777
778 //! \brief Dialog for VR performance optimization tips
779 //!
780 //! Shows performance optimization tips when controlling an
781 //! entity in a VR display configuration. This dialog appears
782 //! the first time a user selects a VR display layout, with an
783 //! option to suppress future appearances.
785
786 //! \brief Additional manager for signal connections
787 //!
788 //! Manages a separate set of signal connections, primarily used
789 //! for temporary connections that need different lifecycle management
790 //! than the primary signal connections.
791 makVrv::DtSignalConnectionManager myConnections;
792};
793} // namespace makVre
Defines the DtChooseRoleState class for entity and role selection.
virtual void on_displayUnitChanged()
Updates the altitude box's unit suffix.
virtual bool findRoles(const DtEntityType &entityType, QComboBox *box=NULL)
Finds available roles for an entity type.
bool myDisplayListNeedsUpdate
Flag indicating that the display list needs updating.
Definition chooseRolePanel.h:769
virtual void installEventFilters()
Installs event filters for application-level event handling.
virtual void slot_onEntityItemDoubleClicked(QTreeWidgetItem *, int)
Handles double-clicks on items in the entity list.
virtual void onSceneSelectionChanged(const makVrv::DtSelectionManager::IdSet &selected, const makVrv::DtSelectionManager::IdSet &deselected)
Scene signal handlers.
QAction * myCopyCreateTypeAction
Action for copying entity types from the creation list.
Definition chooseRolePanel.h:639
int myEntityStateUpdateIndex
Index for cycling through entity updates.
Definition chooseRolePanel.h:745
QMainWindow * myMainWindow
Pointer to the main application window.
Definition chooseRolePanel.h:606
virtual void slot_onCreateItemClicked(QTreeWidgetItem *item, int column)
Handles clicks on items in the create entity list.
virtual void slot_onCreateSelectionChanged()
Handles changes in entity selection in the create entity list.
virtual void buildCreateEntityList()
List building methods.
virtual void slot_onCreateContextMenu(const QPoint &pos)
Handles context menu requests in the create entity list.
DtChooseRolePanel(makVrv::DtDe &de, makVrv::DtQtDeMainWindow *mainWindow, DtPlayerStationApp &app)
Constructor.
DtCreateNewEntityEventProcessor * myEventProcessor
Event processor for creating new entities.
Definition chooseRolePanel.h:697
virtual int altitudeSpinboxValueInMeters()
Converts the altitude spinbox value to meters.
virtual bool isObserverViewsButtonActive() const
Checks if the observer views button is active.
virtual void slot_onEntityViewToggled(bool on)
Handles toggling of the entity view.
virtual void slot_onEntityContextMenuActionCopyType()
Handles the "Copy Type" action from the entity context menu.
virtual bool viewAllEntities()
View manipulation methods.
virtual void slot_onCreateNewClicked(bool checked)
Handles clicks on the "Create New" button.
virtual ~DtChooseRolePanel() override
Destructor.
void showOptimizingVRPerformanceDialog()
Shows the VR performance optimization dialog.
makVrv::DtSignalConnectionManager mySignals
Manager for signal connections.
Definition chooseRolePanel.h:703
ViewModes
Enumeration of available view modes.
Definition chooseRolePanel.h:646
@ ViewMode_3D
3D perspective view mode (configurable camera angle)
Definition chooseRolePanel.h:648
@ ViewMode_Map
2D map view mode (top-down orthographic projection)
Definition chooseRolePanel.h:647
virtual void slot_onResetViewClicked()
Handles clicks on the "Reset View" button.
virtual void buildRolesList(const DtEntityType &entityType)
Builds the list of available roles for an entity type.
virtual void onNewEntityCreated()
Handles creation of new entities.
virtual void applyFilter(QTreeWidget *tree)
Applies filters to a specific tree widget.
double mySceneClickTimer
Timer for tracking scene clicks.
Definition chooseRolePanel.h:739
virtual void slot_onMapViewToggled(bool on)
Handles toggling of the map view.
virtual void debugCallback()
Provides debugging information.
virtual void slot_onEntityContextMenu(const QPoint &pos)
Handles context menu requests in the entity list.
virtual void slot_onEntityContextMenuActionCopyId()
Handles the "Copy ID" action from the entity context menu.
DtVreMessageResult handleSmsLoadComplete(DtVreMessage *msg)
Handles SMS load completion messages.
virtual void enableCreateEntity(bool enabled)
Enables or disables the create entity option.
virtual void removeEventFilters()
Removes previously installed event filters.
virtual void onSmsChanged()
Handles SMS changes.
virtual void slot_onTakeControlClicked(bool checked)
UI event handlers (slots)
virtual void slot_onSearchFilterChanged(const QString &text)
Handles changes to the search filter text.
void onDePreTick(makVrv::DtDe &de)
Handles pre-tick events from the display engine.
bool myWantedSpectator
Flag indicating whether spectator mode was requested.
Definition chooseRolePanel.h:721
DtPlayerStationApp & myApp
Reference to the player station application.
Definition chooseRolePanel.h:709
virtual void setViewMode(ViewModes mode=ViewMode_3D)
Sets the current view mode.
virtual void applyFilters()
Filter application methods.
int myLastEntityCount
Last known count of entities in the scene.
Definition chooseRolePanel.h:733
virtual void slot_onCreateItemDoubleClicked(QTreeWidgetItem *item, int column)
Handles double-clicks on items in the create entity list.
QAction * myCopyEntityIdAction
Action for copying entity IDs.
Definition chooseRolePanel.h:626
virtual void slot_onCountryFilterChanged(const QString &country)
Handles changes to the country filter.
virtual void slot_onEntityItemClicked(QTreeWidgetItem *item, int column)
Handles clicks on items in the entity list.
virtual void resetPanel()
Resets the panel to its initial state.
virtual void slot_onCategoryFilterChanged(const QString &category)
Handles changes to the category filter.
virtual void removeElementFromEntityList(makVrv::DtElementID id)
Entity list management methods.
double myEntityStateLastUpdateTime
Time of the last entity state update.
Definition chooseRolePanel.h:751
virtual void slot_onEntitySelectionChanged()
Handles changes in entity selection in the entity list.
virtual void onElementsRemoved(const makVrv::DtElementData::ElementIdList &keys)
Handles the removal of elements from the scene.
virtual void updateDisplayLayoutsList(const makVrv::DtSceneObject *sceneObject)
Updates the list of available display layouts.
virtual DtVreMessageResult handleSimState(DtVreMessage *msg)
Entity message handlers.
makVrv::DtSignalConnectionManager myConnections
Additional manager for signal connections.
Definition chooseRolePanel.h:791
virtual void slot_onPitchChanged(const QString &pitch)
Handles changes to the entity pitch.
virtual void onSceneClicked(makVrv::DtUniqueID id, const DtVector &location, double altAboveGround)
Handles scene clicks.
virtual void slot_onAtAltitudeToggled(bool on)
Handles toggling of the "at altitude" option.
double myEntityStateUpdateTime
Interval between entity state updates.
Definition chooseRolePanel.h:757
virtual bool eventFilter(QObject *p, QEvent *e) override
Application event handling.
virtual bool viewCurrentEntity()
Centers the view on the currently selected entity.
virtual QTreeWidgetItem * findEntityListItem(const DtEntityIdentifier &id)
Finds an item in the entity list by entity ID.
virtual void slot_onResetFiltersClicked()
Handles clicks on the "Reset Filters" button.
virtual void slot_onConfigurationSelectionChanged(const QString &config)
Handles selection of a different display configuration.
virtual void onElementsAdded(const makVrv::DtElementData::ElementIdList &elements)
Element signal handlers.
virtual void buildExistingEntityList()
Builds the list of existing entities in the simulation.
std::map< std::string, std::string > myPreviousRoleSettings
Cache of role settings by entity type.
Definition chooseRolePanel.h:776
virtual void repositionChooseRolePanel()
Repositions the choose role panel.
virtual void slot_onResetSearchClicked()
Handles clicks on the "Reset Search" button.
virtual void slot_onForceFilterChanged(const QString &force)
Handles changes to the force filter.
virtual void hideContainer()
Hides the panel container.
virtual void slot_onPlayClicked()
Handles clicks on the "Play" button.
virtual void buildCategoriesList()
Builds the list of entity categories for filtering.
virtual QTreeWidgetItem * findEntityListItem(const makVrv::DtElementID &id)
Finds an item in the entity list by element ID.
virtual void slot_onCreateContextMenuActionCopyType()
Handles the "Copy Type" action from the create entity context menu.
EntityListItemDataFields
Data fields for entity list items.
Definition chooseRolePanel.h:668
@ DataField_OwnThis
Whether this entity is owned by the current player.
Definition chooseRolePanel.h:676
@ DataField_Type
Entity type (e.g., "T-72", "M1A2", "Infantry")
Definition chooseRolePanel.h:671
@ DataField_ElementId
Display engine element ID from the scene graph.
Definition chooseRolePanel.h:669
@ DataField_Categories
Categories the entity belongs to (e.g., "Ground", "Air")
Definition chooseRolePanel.h:673
@ DataField_EntityId
Simulation entity ID used in network messages.
Definition chooseRolePanel.h:670
@ DataField_Force
Force type (friendly, hostile, neutral, etc.)
Definition chooseRolePanel.h:672
@ DataField_EmbarkedRole
Role this entity is embarked as (if applicable)
Definition chooseRolePanel.h:677
@ DataField_Countries
Countries associated with the entity (e.g., "USA", "UK")
Definition chooseRolePanel.h:674
@ DataField_Name
Display name of the entity shown in the UI.
Definition chooseRolePanel.h:675
@ DataField_EngagedBy
Player name who is currently engaged with this entity.
Definition chooseRolePanel.h:678
void onDePostTick()
Handles post-tick events from the display engine.
virtual void slot_onNameEdited(const QString &name)
Handles edits to the entity name field.
virtual void addElementToEntityList(const makVrv::DtElementEntry &data)
Adds an element to the entity list.
virtual void showContainer()
Shows the panel container.
virtual void slot_onObserverViewsPanelToggled(bool visible)
Handles toggling of the observer views panel.
virtual void buildCountriesList()
Builds the list of countries for filtering.
virtual void slot_onRoleSelectionChanged(const QString &role)
Handles selection of a different role.
virtual void onElementsChanged(const makVrv::DtElementAttributeManager::EntryAttributesList &attributes)
Handles changes to element attributes.
QAction * myCopyEntityTypeAction
Action for copying entity types.
Definition chooseRolePanel.h:632
QMenu * myEntityTreeContextMenu
Context menu for the entity list.
Definition chooseRolePanel.h:613
DtOptimizingVRPerformanceDialog * myOptimizingVRPerformanceDialog
Dialog for VR performance optimization tips.
Definition chooseRolePanel.h:784
makVrv::DtDe & myDe
Reference to the display engine.
Definition chooseRolePanel.h:715
virtual void setEntityStateUpdateTime(double seconds)
Sets the entity state update interval.
virtual bool initiallyVisible() const
Determines initial visibility of the panel.
Definition chooseRolePanel.h:84
virtual void slot_onHeadingChanged(const QString &heading)
Handles changes to the entity heading.
virtual void tick(double dt)
Updates the panel state.
virtual void setReady(bool ready)
Sets the ready state of the panel.
EntityListItemColumns
Column identifiers for the entity list.
Definition chooseRolePanel.h:686
@ ColumnId_Name
Name column showing entity display name.
Definition chooseRolePanel.h:687
@ ColumnId_Host
Host column showing containing entity (if embarked)
Definition chooseRolePanel.h:689
@ ColumnId_Engaged
Engaged column showing engagement status and player.
Definition chooseRolePanel.h:690
@ ColumnId_Type
Type column showing entity type designation.
Definition chooseRolePanel.h:688
bool myDidInitialViewAll
Flag indicating whether an initial view of all entities was performed.
Definition chooseRolePanel.h:727
virtual void clearSelectedEntities()
Clears all entity selections.
DtEntityType mySelectedEntityType
Currently selected entity type.
Definition chooseRolePanel.h:763
QMenu * myCreateTreeContextMenu
Context menu for the create entity list.
Definition chooseRolePanel.h:620
virtual void buildForcesList()
Builds the list of force types for filtering.
virtual void slot_onAltitudeChanged(int altitude)
Handles changes to the altitude value.
Event processor for entity creation and placement.
Definition createNewEntityEventProcessor.h:36
Dialog for displaying VR performance optimization tips.
Definition optimizingVRPerformanceDialog.h:40
Top-level class representing the VR-Engage application.
Definition playerStationApp.h:163
Abstract base class for all VREngage messages.
Definition vreMessage.h:50
Defines export macros for the VR-Engage Player Station library.
#define PLAYERSTATION_DLL
Definition export.h:24
Include export definitions for this library.
Definition glsVreMessageUtil.h:49
DtVreMessageResult
Enumeration of possible message handling results.
Definition vreMessage.h:33
Definition appLauncherComponent.h:28
Defines the VR performance optimization tip dialog.
makVrv::DtDe * de()
Gets the display element pointer used by the plugin.