VR-Engage  2.3
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
16#include "entityResolver.h"
18
19#include "vrePlayerStation/chooseRolePanelUI.hpp"
21
23
25#include <vrvCoreQt/DtDockable.h>
26
27#include <vrvCore/DtUniqueID.h>
28#include <vrvCore/DtElementData.h>
29#include <vrvCore/DtSelectionManager.h>
30#include <vrvCore/DtElementAttributeManager.h>
31
32#include <vrvUtil/DtSignalConnectionManager.h>
33
34namespace makVrv
35{
36class DtSceneObject;
37class DtQtDeMainWindow;
38} // namespace makVrv
39
40namespace makVre
41{
42//! \brief Forward declaration of the player station application class
44
45//! \brief Forward declaration of the entity event processor 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 Updates the altitude box's unit suffix
588 //!
589 //! Changes the altitude spinbox's suffix to match the current display units.
590 //! Called when the display unit settings change in the application.
591 virtual void on_displayUnitChanged();
592
593 //! \brief Pointer to the main application window
594 //!
595 //! References the main application window, used for determining panel placement,
596 //! accessing application-wide resources, and coordinating UI interactions.
597 //! This is typically the parent widget for the panel.
598 QMainWindow* myMainWindow;
599
600 //! \brief Context menu for the entity list
601 //!
602 //! Context menu displayed when right-clicking on items in the entity list.
603 //! Contains actions related to the selected entity, such as copying its ID
604 //! or type information.
606
607 //! \brief Context menu for the create entity list
608 //!
609 //! Context menu displayed when right-clicking on items in the create entity list.
610 //! Contains actions related to the selected entity type, such as copying type
611 //! information or accessing additional entity creation options.
613
614 //! \brief Action for copying entity IDs
615 //!
616 //! Menu action for copying the selected entity's unique identifier to the clipboard.
617 //! Useful for developers and testers who need to reference specific entities.
619
620 //! \brief Action for copying entity types
621 //!
622 //! Menu action for copying the selected entity's type string to the clipboard.
623 //! Useful for developers and scenario designers working with entity definitions.
625
626 //! \brief Action for copying entity types from the creation list
627 //!
628 //! Menu action for copying the selected entity type from the create entity list
629 //! to the clipboard. Useful for referencing available entity types during
630 //! scenario development or testing.
632
633 //! \brief Enumeration of available view modes
634 //!
635 //! Defines the supported viewing modes for the observer during role selection.
636 //! These modes control how the simulation environment is visualized.
638 {
639 ViewMode_Map, //!< 2D map view mode (top-down orthographic projection)
640 ViewMode_3D //!< 3D perspective view mode (configurable camera angle)
641 };
642
643 //! \brief Sets the current view mode
644 //! \param mode View mode to set (default: 3D view)
645 //! \return True if the view mode was changed successfully, false otherwise
646 //!
647 //! Changes the current view mode between map view (2D) and 3D view.
648 //! Updates UI elements and observer settings accordingly, including camera
649 //! position, orientation, projection type, and control sensitivity.
650 //! The map view is useful for precise placement and spatial awareness,
651 //! while the 3D view provides better depth perception and visual context.
652 virtual void setViewMode(ViewModes mode = ViewMode_3D);
653
654 //! \brief Data fields for entity list items
655 //!
656 //! Defines the data fields stored in each entity list item. These fields
657 //! provide metadata about the entity and are used for filtering, display,
658 //! and selection logic. Fields are stored as item data in the QTreeWidgetItem.
660 {
661 DataField_ElementId, //!< Display engine element ID from the scene graph
662 DataField_EntityId, //!< Simulation entity ID used in network messages
663 DataField_Type, //!< Entity type (e.g., "T-72", "M1A2", "Infantry")
664 DataField_Force, //!< Force type (friendly, hostile, neutral, etc.)
665 DataField_Categories, //!< Categories the entity belongs to (e.g., "Ground", "Air")
666 DataField_Countries, //!< Countries associated with the entity (e.g., "USA", "UK")
667 DataField_Name, //!< Display name of the entity shown in the UI
668 DataField_OwnThis, //!< Whether this entity is owned by the current player
669 DataField_EmbarkedRole, //!< Role this entity is embarked as (if applicable)
670 DataField_EngagedBy, //!< Player name who is currently engaged with this entity
671 };
672
673 //! \brief Column identifiers for the entity list
674 //!
675 //! Defines the columns displayed in the entity list tree widget. These columns
676 //! present entity information to the user and can be used for sorting and navigation.
678 {
679 ColumnId_Name, //!< Name column showing entity display name
680 ColumnId_Type, //!< Type column showing entity type designation
681 ColumnId_Host, //!< Host column showing containing entity (if embarked)
682 ColumnId_Engaged, //!< Engaged column showing engagement status and player
683 };
684
685 //! \brief Event processor for creating new entities
686 //!
687 //! Handles mouse clicks and other events for entity creation, such as
688 //! determining placement location and orientations based on user input.
690
691 //! \brief Manager for signal connections
692 //!
693 //! Manages connections to Qt signals and slots, ensuring proper cleanup
694 //! when the panel is destroyed or connections need to be broken.
695 makVrv::DtSignalConnectionManager mySignals;
696
697 //! \brief Reference to the player station application
698 //!
699 //! Provides access to application-level functionality and state,
700 //! such as entity creation, player station management, and state transitions.
702
703 //! \brief Reference to the display engine
704 //!
705 //! Provides access to the 3D scene, rendering capabilities, and scene manipulation,
706 //! used for visualization and entity placement during role selection.
707 makVrv::DtDe& myDe;
708
709 //! \brief Flag indicating whether spectator mode was requested
710 //!
711 //! When true, indicates that the user has requested to enter spectator mode,
712 //! which allows observation without directly controlling an entity.
714
715 //! \brief Flag indicating whether an initial view of all entities was performed
716 //!
717 //! When true, indicates that the panel has already performed an initial
718 //! camera adjustment to show all entities when first opened.
720
721 //! \brief Last known count of entities in the scene
722 //!
723 //! Stores the number of entities present in the scene during the last update.
724 //! Used to detect changes in entity count for triggering UI updates.
726
727 //! \brief Timer for tracking scene clicks
728 //!
729 //! Tracks time since the last scene click, used for debouncing rapid clicks
730 //! and preventing accidental double selections.
732
733 //! \brief Index for cycling through entity updates
734 //!
735 //! Current index in the entity list for progressive updates. Used to
736 //! distribute update processing across multiple frames for better performance.
738
739 //! \brief Time of the last entity state update
740 //!
741 //! Stores the time when the last entity state update was performed, used
742 //! to control the frequency of state updates based on the update interval.
744
745 //! \brief Interval between entity state updates
746 //!
747 //! Number of seconds between entity state update cycles. Controls how
748 //! frequently the panel refreshes entity information from the simulation.
750
751 //! \brief Currently selected entity type
752 //!
753 //! Stores the entity type that is currently selected in the create entity list.
754 //! Used for populating role options and other type-specific UI elements.
756
757 //! \brief Flag indicating that the display list needs updating
758 //!
759 //! When true, the UI needs to refresh the display layouts list based on
760 //! changes to entity selection, role selection, or other factors.
762
763 //! \brief Cache of role settings by entity type
764 //!
765 //! Stores display layouts for when switching entity selections
766 //! or disengaging, allowing the UI to remember previous selections.
767 //! Maps entity type names to previously selected roles for those types.
768 std::map<std::string, std::string> myPreviousRoleSettings;
769
770 //! \brief Additional manager for signal connections
771 //!
772 //! Manages a separate set of signal connections, primarily used
773 //! for temporary connections that need different lifecycle management
774 //! than the primary signal connections.
775 makVrv::DtSignalConnectionManager myConnections;
776
777 //! \brief Handle for the global entity resolver.
778 //! \vreAttrKey{DtEntityResolver}
780
782};
783} // namespace makVre
Provides handle classes for safe access to attributes.
Defines the DtChooseRoleState class for entity and role selection.
Type-specific handle class for attributes.
Definition attributeHandle.h:229
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:761
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:631
int myEntityStateUpdateIndex
Index for cycling through entity updates.
Definition chooseRolePanel.h:737
QMainWindow * myMainWindow
Pointer to the main application window.
Definition chooseRolePanel.h:598
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:689
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.
makVrv::DtSignalConnectionManager mySignals
Manager for signal connections.
Definition chooseRolePanel.h:695
ViewModes
Enumeration of available view modes.
Definition chooseRolePanel.h:638
@ ViewMode_3D
3D perspective view mode (configurable camera angle)
Definition chooseRolePanel.h:640
@ ViewMode_Map
2D map view mode (top-down orthographic projection)
Definition chooseRolePanel.h:639
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:731
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:713
DtPlayerStationApp & myApp
Reference to the player station application.
Definition chooseRolePanel.h:701
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:725
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:618
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:743
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:775
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:749
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.
DtAttributeHandleType< DtEntityResolver * > myEntityResolverAttr
Handle for the global entity resolver.
Definition chooseRolePanel.h:779
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:768
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:660
@ DataField_OwnThis
Whether this entity is owned by the current player.
Definition chooseRolePanel.h:668
@ DataField_Type
Entity type (e.g., "T-72", "M1A2", "Infantry")
Definition chooseRolePanel.h:663
@ DataField_ElementId
Display engine element ID from the scene graph.
Definition chooseRolePanel.h:661
@ DataField_Categories
Categories the entity belongs to (e.g., "Ground", "Air")
Definition chooseRolePanel.h:665
@ DataField_EntityId
Simulation entity ID used in network messages.
Definition chooseRolePanel.h:662
@ DataField_Force
Force type (friendly, hostile, neutral, etc.)
Definition chooseRolePanel.h:664
@ DataField_EmbarkedRole
Role this entity is embarked as (if applicable)
Definition chooseRolePanel.h:669
@ DataField_Countries
Countries associated with the entity (e.g., "USA", "UK")
Definition chooseRolePanel.h:666
@ DataField_Name
Display name of the entity shown in the UI.
Definition chooseRolePanel.h:667
@ DataField_EngagedBy
Player name who is currently engaged with this entity.
Definition chooseRolePanel.h:670
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.
DtFunctionQueue myFunctionQueue
Definition chooseRolePanel.h:781
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:624
QMenu * myEntityTreeContextMenu
Context menu for the entity list.
Definition chooseRolePanel.h:605
makVrv::DtDe & myDe
Reference to the display engine.
Definition chooseRolePanel.h:707
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:678
@ ColumnId_Name
Name column showing entity display name.
Definition chooseRolePanel.h:679
@ ColumnId_Host
Host column showing containing entity (if embarked)
Definition chooseRolePanel.h:681
@ ColumnId_Engaged
Engaged column showing engagement status and player.
Definition chooseRolePanel.h:682
@ ColumnId_Type
Type column showing entity type designation.
Definition chooseRolePanel.h:680
bool myDidInitialViewAll
Flag indicating whether an initial view of all entities was performed.
Definition chooseRolePanel.h:719
virtual void clearSelectedEntities()
Clears all entity selections.
DtEntityType mySelectedEntityType
Currently selected entity type.
Definition chooseRolePanel.h:755
QMenu * myCreateTreeContextMenu
Context menu for the create entity list.
Definition chooseRolePanel.h:612
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
Definition functionQueue.h:26
Top-level class representing the VR-Engage application.
Definition playerStationApp.h:155
Abstract base class for all VREngage messages.
Definition vreMessage.h:50
Defines the entity resolver for mapping between entity representations.
Deferred function queue.
Defines export macros for the VR-Engage Player Station library.
#define PLAYERSTATION_DLL
Definition export.h:24
!
Definition glsVreMessageUtil.h:50
DtVreMessageResult
Enumeration of possible message handling results.
Definition vreMessage.h:33
Definition appLauncherComponent.h:28
makVrv::DtDe * de()
Gets the display element pointer used by the plugin.