This example demonstrates how to manually create communication lines in a scene. During normal VR-Vantage execution, the communication and transmission element processors listen for interactions and messages on the network that indicate communications. Should communication lines need to be created to visualize communications that are either not published on the network or are different types of communications, communication lines can be manually created in the manner demonstrated in this example.
There are two different types of communication lines in VR-Vantage. The first is a line connecting the two communicating entities, and the second is a set of circular lines that radiate from the source of the communication.
The first type, dubbed 'Communication Lines' connect the sender and receiver of the communication. The end points of the line may be attached to either entities (either moving or stationary), or fixed points in space. The lines are also dashed, and scroll in the direction of the communication (from sender to receiver). The rate at which the lines scroll can be configured in the Interaction Definition Editor in the configured DtRadioCommunicationVisualizer's visual definition. Communication Lines can also be configured to be displayed as straight lines (Line-Of-Sight mode), or as curved lines that follow the surface of the earth (Curved-Earth mode) - the comm line display mode can be configured on the Radio Communications page in the Display Settings Dialog.
The second type of communication lines are called 'Squawk Lines,' and radiate outwards from the source of a radio communication so the source can be easily identified at a glance. As with Communication Lines, Squawk Lines can be attached to either an entity or a fixed point in space, and the animation rate can also be configured in the same manner as the Communication Lines' animation rate.
In addition to the above mentioned settings, there are also other settings that can be configured through the Display Settings dialog. These other settings include the duration for which the different types of communication lines remain visible after the initial communication (their 'lifetime'), and options for coloring communications based on their frequency.
All communication lines are created and managed through the DtCommunicationsLineManager. Having a single class manage and maintain all communication lines ensures that multiple DtCommunicationLine or DtSquawkLine objects aren't created between the same two entities or at the same point in space. It is also the DtCommunicationsLineManager that keeps track of the creation time of all the communication lines and handles their animation as well as their destruction when the end of their lifetimes are reached. The coloring of the communication lines based on frequency is also handled by the DtCommunicationLineManager.
The DtCommunicationsLineManager exists in VR-Vantage's main thread, and as such cannot be controlled directly from threads other than the main thread. The DtCommLineManagerCommunicatorAgent exists to allow communication with the DtCommunicationLineManager from other threads, and provides much the same interface as the DtCommunicationLineManager itself. In short, when creating or managing a communication or squawk line from the main thread - use the Manager, when creating or managing a communication or squawk line from any other thread - use the Communicator.
This example shows how to manually create communication lines in VR-Vantage. The example provides an environment for the communication lines (Ground_DB II), and an entity (F-18) for demonstrating attaching communication lines to a moving entity. For more information regarding the setup of the environment and entity, see the exampleDriver example.
The driver's onTick() method is where the communication line logic resides. Every time the driver ticks, it checks when the last time communication lines were created was, and waits until 15 seconds have passed to create new communication lines and squawk lines. Upon creating the communication lines, the driver sets the lifetime for the communication and squawk lines to 10 seconds, overriding the global lifetime setting and ensuring the lines will time out before new lines are created. If the driver didn't wait until the lines were timed out, the re-creation of the comm lines would only extend the lifetime of the existing lines another 10 seconds, and the lines would never time out.
The example provides code demonstrating both how to use the DtCommunicationLineManager directly, as well as how to use the DtCommLineManagerCommunicatorAgent. When using the DtCommunicationLineManager directly, a find call is necessary for each communication line and squawk line action, and the returned comm line ID must be used to modify it.
When using the DtCommLineManagerCommunicatorAgent, the communicator itself keeps track of the ID of the last communication line found and automatically uses that ID for further set calls.
This example is a plug-in. You can run it by running vrvStealth.exe –plugin ../examples/plugins/release/exampleCommLines.dll (on Windows) or vrvStealth.exe –plugin ../examples/plugins/release/libexampleCommLines.so (on Linux) from the command prompt. Once Vantage is started, press the "s" multiple time to move away from the "F18" and see the comminication lines. From the toolbar menu toogle to "plan view" to see the communication line in 2D. For more information about running examples, please see Running Applications and Examples.
#include <QtCore/QObject>
#include <QtCore/QString>
#include <QtWidgets/QToolBar>
static vrvSignalsLib::connection postInitializeConnection;
class DtExampleCommLinesToolbar :
public DtToolbar
{
public:
DtExampleCommLinesToolbar(
DtDe& de )
:
DtToolbar( de,
"DtExampleCommLinesToolbar" )
{
}
virtual ~DtExampleCommLinesToolbar() {}
{
QString title = QObject::tr("Comm Lines Example Toolbar");
tb->setWindowTitle( title );
tb->setObjectName( title );
return tb;
}
};
{
}
{
{
if (app)
{
}
}
}
{
return true;
}
{
new DtExampleCommLinesToolbar(de) );
}
Contains makVrv::DtDe class.
#define DT_DE_INIT_ONCE(de)
This macro is called by modules in their init() function. This macro ensures that the module is only ...
Definition DtDe.h:30
Contains makVrv:DtMasterScene class.
Contains classes used as menu items on the entity menu.
Contains makVrv::DtStealthConfiguration class.
Contains makVrv::DtVrvApplication implementation.
Definition DtExampleCommLinesDriver.h:32
The DtDe is the core component of any VR-Vantage application. It owns a DtRenderer,...
Definition DtDe.h:77
DtAgentManager & agentManager()
Get the scene manager.
virtual bool isInMasterMode() const
Returns true if the DtDe is in master mode.
virtual DtDriverManager & driverManager()
The DtMasterScene accessor. The function will throw before the initialize function is called.
boost::signalslib::signal< void()> signal_postInitialize
Definition DtDe.h:535
The initialization configuration for the makVrv::DtDe.
Definition DtDeInitializer.h:40
void addDriver(DtDriver *driver)
Add a host driver to the master scene. The host is now owned by the Master Scene.
void startDriver(DtDriver *driver)
Start a driver driver modifying the scene.
A configuration of the pages in the gui.
Definition DtPageConfiguration.h:26
This owns a list of display engine configurations.
Definition DtVrvApplicationConfiguration.h:33
const UIConfiguration & masterModeUIConfiguration() const
void setMasterModePageConfiguration(const DtPageConfiguration &pageConfig)
void setMasterModeToolbarConfiguration(const DtToolbarConfiguration &toolbarConfig)
void setMasterModeMenuConfiguration(const DtMenuConfiguration &menuConfig)
The Root IG Application object. To run the IG simply create one, initialize it and call run.
Definition DtVrvApplication.h:58
static DtVrvApplication * findFromDe(DtDe &)
virtual void installPostPluginTransform(const ApplicationTransform &transform, const std::string &id)
Add a transformer that runs after plug-ins are loaded.
boost::function< void(DtDeInitializer &, DtDe &, DtVrvApplicationConfiguration &)> ApplicationTransform
Definition DtVrvApplication.h:147
DT_DLL_EXAMPLEACCESSORY void init(makVrv::DtDe &de)
Contains DLL export macros.
DT_DLL_EXAMPLEPROJECTILE void installDriver(makVrv::DtDe &de)
DT_DE_PLUGIN_EXPORT_MACRO bool initDeModule(makVrv::DtDe *de)
Contains DtCreateSensorFieldOfViewCommand and DtCreateSensorFieldOfViewCommandCreator class declarati...
Definition DtGridLinesSettingsRecord.h:16
bool myShowStartupScreen
Definition DtVrvApplicationConfiguration.h:42
, myEntityFacade( 0 )
, myAngularVelocity( 0.2 )
, myOrbitCenter( 0.0, 0.0, 800.0 )
, myLastCommLineTime( 0.0 )
, myLastUpdateTime( 0.0 )
, myClockAngle( 0.0 )
, myRadius( 1000.0 )
, myRoll( 0.5 )
, myCoordinateSystem( nullptr )
{
myCoordinateSystem = am.
de().sharedState().coordinateSystem().clone();
if (myCoordinateSystem == nullptr)
{
DtTHROW_NEW(DtCorruptedState, "myDe.sharedState().coordinateSystem().clone() failed.");
}
slot_coordinateSystemChanged();
}
{
}
{
static std::string name = "DtExampleCommLinesDriver";
return name;
}
{
std::string groundDbPath =
myAgentManager.de().dePathConfiguration().sharedDataPath();
groundDbPath += "/TerrainData/TerrainConfiguration/Ground_DB II.mtf";
std::string entityDisplayName = "F-18";
const DtModelSetRealizationManager::ModelSetRealizations& setsToRealize =
myAgentManager.de().sharedState().modelSetRealizationManager().modelSetRealizations();
std::vector<DtElementID> objects;
DtInputDriver& inputDriver =
myAgentManager.de().driverManager().inputDriver();
return true;
}
{
{
}
{
}
return true;
}
{
{
const DtModelSetRealizationManager::ModelSetRealizations& setsToRealize =
myAgentManager.de().sharedState().modelSetRealizationManager().modelSetRealizations();
DtModelSetRealizationManager::ModelSetRealizations::const_iterator i;
DtModelSetRealizationManager::ModelSetRealizations::const_iterator e;
i = setsToRealize.begin();
e = setsToRealize.end();
for ( ; i != e; ++i )
{
if ( i->second )
{
}
}
}
return true;
}
{
}
{
DtEntityFacade* facade = new DtEntityFacade( am,
DtSharedSettingsManager::instance( am.
de() ), elementId, modelSets,
distribute );
if ( facade3d )
{
}
if ( facade2d )
{
}
if ( facadeColorized )
{
}
return facade;
}
{
DtTaitBryan ori( heading, 0,
myRoll );
}
{
DtVector houseRadio( -185.0, -600.0, 24.0 );
DtVector towerRadio( -105.0, 515.0, 94.0 );
#if 1
DtRadioCommsVisualizationManager& manager =
#else
DtRadioCommsVisualizationManagerCommunicatorAgent* communicator =
DtRadioCommsVisualizationManagerCommunicatorAgent::create(
myAgentManager,
false );
communicator->
findCommLine( modelSet, 0, towerRadio, elementId);
communicator->
findCommLine( modelSet, 0, elementId, houseRadio );
delete communicator;
communicator = 0;
#endif
}
{
DtCoordinateConverter* coordConverter;
DtVector finalPosition;
DtTaitBryan finalOrientation;
}
{
}
Contains makVrv:DtAgentManager class.
Contains makVrv::DtDataBank class.
Contains makVrv::DtDeSharedState class.
Contains makVrv::DtDeSharedStateSignaler class.
Contains makVrv::DtElementAttributes class.
Contains makVrv::DtElementData class.
Contains makVrv::DtEntity2dFacade class.
Contains makVrv::DtEntity3dFacade class.
Contains makVrv::DtEntityFacade class.
Contains makVrv::DtObserver class.
Contains the DtRadioCommsVisualizationManager class declaration.
Contains makVrv::DtScene class.
double myClockAngle
Definition DtExampleCommLinesDriver.h:97
virtual ~DtExampleCommLinesDriver()
Virtual DTOR.
makVrv::DtEntityFacade * myEntityFacade
Definition DtExampleCommLinesDriver.h:90
double myRadius
Definition DtExampleCommLinesDriver.h:98
virtual void updatePosition()
Updates the current position / orientation of the entity.
DtVector myOrbitCenter
Definition DtExampleCommLinesDriver.h:93
virtual void repositionAircraft(DtVector position, DtTaitBryan ori)
Positions the aircraft at the given coordinates.
makVrv::DtCoordinateSystem * myCoordinateSystem
Definition DtExampleCommLinesDriver.h:105
virtual void updateCommLines(makVrv::DtModelSetId modelSet)
Instantiates comm lines if they have timed out.
ElementIdsByModelSet myElementIds
Definition DtExampleCommLinesDriver.h:88
double myAngularVelocity
Definition DtExampleCommLinesDriver.h:92
virtual void slot_coordinateSystemChanged()
slot for when the coordinate system changes
DtExampleCommLinesDriver(makVrv::DtAgentManager &am)
CTOR.
virtual const std::string & className() const
double myLastUpdateTime
Definition DtExampleCommLinesDriver.h:96
double myRoll
Definition DtExampleCommLinesDriver.h:99
double myLastCommLineTime
Definition DtExampleCommLinesDriver.h:95
makVrv::DtEntityFacade * createEntityFacade(makVrv::DtAgentManager &am, makVrv::DtElementID elementId, const makVrv::DtModelSetRealizationManager::ModelSetRealizations &modelSets, bool distribute)
virtual void slot_displayEngineAdded(const makVrv::DtDeRecord &igRecord)
The DtAgentManager manages the distributed scene object framework. This includes the objects and upda...
Definition DtAgentManager.h:39
DtDe & de()
Get the scene manager's Ig object.
Definition DtAgentManager.h:107
virtual DtTaitBryan nedToCig_EulerTrans(const DtTaitBryan &topo) const
provide cig euler angles from topo euler
virtual void setupTopoFrame(const DtVector &truth)
virtual void enuToCig_coordTrans(const DtVector &enuPos, DtVector &cigPos) const
convert to Cig coordinates from Enu coordinates
A Record of an IG instance.
Definition DtDeRecord.h:25
static DtDeSharedStateSignaler & instance(DtDe &de)
Get an instance used to emit, or to connect.
The DtDriver is an abstract class. Developers derive from this to create logic that "directs" things ...
Definition DtDriver.h:32
DtElementChanges myChanges
Definition DtDriver.h:198
DtAgentManager & myAgentManager
Definition DtDriver.h:190
void reportElementCreated(DtElementID id, DtElementID parentId, DtElementEntry::ElementType type)
Report an element created.
void start()
Start the driver. Called by the Master Scene. Calls installAccessories().
void stop()
Stop the driver. Called by the Master Scene. Calls uninstallAccessories().
void reportElementDestroyed(DtElementID id)
Report an element destroyed.
void reportElementAttribute(DtElementID id, DtElementAttribute *attribute)
Report an element attribute changed.
virtual DtElementID elementID() const
Get the element id for the entity facade.
Definition DtEntity2dFacadeBase.inl:99
virtual DtModelSetId modelSet() const
Returns the model set being visualized.
Definition DtEntity2dFacadeBase.inl:104
virtual void setIconModelDefinition(const std::string &modelDefinitionName)
Set the model definition for the icon.
Definition DtEntity2dFacade.inl:155
virtual void setFillGlyph(DtUnicodeChar glyph)
Set the model definition for the icon.
Definition DtEntity2dFacade.inl:188
virtual void setDamageGlyph(DtUnicodeChar glyph)
Set the model definition for the icon.
Definition DtEntity2dFacade.inl:197
virtual void setOutlineGlyph(DtUnicodeChar glyph)
Set the model definition for the icon.
Definition DtEntity2dFacade.inl:179
virtual void setModelScalingEnabled(bool enabled)
Enable/Disable model scaling.
Definition DtEntity3dFacade.inl:344
virtual void setArticulatedModelDefinition(const std::string &modelName)
Set the entity's model definition names.
Definition DtEntity3dFacade.inl:294
virtual DtElementID elementId() const
Get the element id for the entity facade.
Definition DtEntity3dFacade.inl:143
virtual DtModelSetId modelSet() const
Returns the model set being visualized.
Definition DtEntity3dFacade.inl:148
The DtEntityFacade is a facade around agents that make up an entity. This entity facade represents a ...
Definition DtEntityFacade.h:36
const DtEntity3dFacade * findFacadeForColorized() const
Definition DtEntityFacade.inl:135
const DtEntity2dFacade * findFacadeFor2d() const
Definition DtEntityFacade.inl:145
const DtEntity3dFacade * findFacadeFor3d() const
Definition DtEntityFacade.inl:125
std::map< DtModelSetId, bool > ModelSetRealizations
Definition DtModelSetRealizationManager.h:42
void setPrimaryAttachment(const ElementList &elements)
virtual void setLifetime(float lifetime)=0
virtual void setStipplePattern(unsigned short stipplePattern)=0
virtual void setColor(float r, float g, float b)=0
virtual void findSquawkIndicator(DtModelSetId modelSet, int visualType, DtUniqueID entitySceneObjectId)=0
virtual void findCommLine(DtModelSetId modelSet, int visualType, DtUniqueID entitySceneObjectId1, DtUniqueID entitySceneObjectId2)=0
void setLifetime(float lifetime)
Sets the lifetime of the currently selected visualization.
void setStipplePattern(unsigned short stipplePattern)
Sets the stipple pattern of the currently selected visualization.
virtual void setColor(float red, float green, float blue, float alpha=1.0)
Sets the color of the currently selected visualization.
virtual void findOrCreateAndSelectSquawkIndicator(DtModelSetId modelSet, int visualType, const DtSquawkIndicator::AttachablePoint &transmitLoc)
virtual void findOrCreateAndSelectCommLine(DtModelSetId modelSet, int visualType, const DtCommunicationLine::AttachablePoint &source, const DtCommunicationLine::AttachablePoint &dest)
bool loadTerrain(const DtUnicode &filePath)
Load the terrain from a file.
DtUniqueElementAttribute< std::string, DtElementAttributes::DisplayName > DtElementAttributeDisplayName
Definition DtElementAttributes.h:88
DtModelSetId
Definition DtModelSetEnums.h:20
DtUniqueID DtElementID
Definition DtUniqueID.h:23
DtUniqueElementAttribute< bool, DtElementAttributes::ObjectVisibility > DtElementAttributeVisibility
Definition DtElementAttributes.h:97