VR-Vantage
Loading...
Searching...
No Matches
exampleDrawObjects

Overview

This example demonstrates how to use the vrvControlToolkit to draw objects remotely on an instance of VR-Vantage.

Expected Result

Draw Object Result

Example details

The example will run through a series of 3D objects (area/projected area/sphere/cube/cylinder/line/projected), then move on to 2D objects (text/line/circle/triangle/square). Please note that in order to see the 3D objects, you need to load Ground_DB II.mtf, and use the saved view "exampleDrawObjectsGroundDbView.osrx".

Building the Example

VR-Vantage includes pre-built versions of the example application. To build it yourself, follow the instructions at Building VR-Vantage Examples, Applications, and Plug-ins.

Running the Example

This example is an application. First open Vantage, load Ground_DB II terrain than from the "Observer Views" panel click on "import and append views" and select "exampleDrawObjectsGroundDbView.osrx" then click on "remoteGraphicsView", then connect with the protocol you will use the example with. Then, from the bin/ directory, run one of the launcher scripts for the desired protocol: exampleDrawObjectsDISLocal.bat / exampleDrawObjectsDISLocal.sh (DIS on 127.0.0.1), exampleDrawObjectsHLA1516e.bat / exampleDrawObjectsHLA1516e.sh, or exampleDrawObjectsHLA4.bat / exampleDrawObjectsHLA4.sh. Upon running this example, any running instances of VR-Vantage that are connected to the appropriate connection (DIS/HLA13/HLA1516) will display the objects rendered by the example.

When using HLA1516e, it's important to configure the default connection using the RTI Assistant. In Windows, the RTI Assistant can be found under "MAK Technologies" from the Windows start menu. In Linux, the RTI Assistant can be started using the "./rtiAssitstant -N" script located in the RTI installed location bin folder. Using the RTI Assistant connection preferences tab, set the default connection to be "[machine name]'s predefined rtiexec loopback connection" rather than the default "Predefined lightweight loopback connection".

Configuring the Exercise Connection

The launcher scripts in bin/ pass "--exConnConfigFile ../appData/settings/connections/MAK-ONE-2026-Config.xml" to the example on startup. This XML file is the shared VR-Link exercise-connection configuration used across the MAK ONE product family, so the example joins the same exercise, site, application, federation, and RTI as VR-Vantage, VR-Forces, and VR-Engage by default. To point the example at a different configuration (for example, your own federation), pass "&ndash;exConnConfigFile <path>" on the command line; the option may be repeated and later files override earlier ones in argument order. See 6.2.7 Exercise Connection Configuration for details.

For more information about running examples, please see Running Applications and Examples.

Example Source Files


drawObjects.cxx

/******************************************************************************
** Copyright (c) 2025 MAK Technologies, Inc.
** All rights reserved.
******************************************************************************/
#include <vl/exerciseConn.h>
#include <vl/exerciseConnInitializer.h>
#include <vlutil/vlProcessControl.h>
#include <matrix/utmCoord.h>
#include <matrix/vlTaitBryan.h>
#include <vl/dataInteraction.h>
#include <matrix/topoCoord.h>
#include <stdio.h>
#include <vlutil/vlKeyboard.h>
#ifdef DtDIS
# include <vrvDis/vrvDis.h>
# define DT_PROTOCOL_NAMESPACE vrvDis
#else
# ifdef DtHLA_4
# include <vrvHla4/vrvHla4.h>
# define DT_PROTOCOL_namespace vrvHla4
# elif DtHLA_1516_EVOLVED
# define DT_PROTOCOL_NAMESPACE vrvHla1516e
# else
# ifdef DtHLA_1516
# include <vrvHla1516/vrvHla1516.h>
# define DT_PROTOCOL_NAMESPACE vrvHla1516
# else
# ifdef DtHLA
# define DT_PROTOCOL_NAMESPACE vrvHla13
# define DL_DLL_IGCONVRLINK DT_DLL_VRVHLA13
# else
# error "Protocol not specified or unsupported."
# endif
# endif
# endif
#endif
using namespace vrvControlToolkit;
DtExerciseConn* exConn;
std::vector<DtDrawControlObject*> myObjects;
DtText2DObject* myText = 0;
int id = 0;
// Updates the objects in our objects list.
void updateObjects(double time = 0.0)
{
if (time > 0.0)
{
DtTime tickTime = exConn->clock()->elapsedRealTime();
while (exConn->clock()->simTime() <= tickTime + time)
{
exConn->drainInput();
for (unsigned int i = 0; i < myObjects.size(); ++i)
{
myObjects[i]->update();
}
exConn->clock()->setSimTime(exConn->clock()->elapsedRealTime());
DtSleep(0.1);
}
}
else
{
exConn->drainInput();
for (unsigned int i = 0; i < myObjects.size(); ++i)
{
myObjects[i]->update();
}
exConn->clock()->setSimTime(exConn->clock()->elapsedRealTime());
}
}
// Prints a messages in 2D text to the screen.
void setMsg(const char *msg)
{
DtNetU8 ucolor[4] = {255, 255, 255, 255};
double pos1[2];
pos1[0] = (-40 / 200.) + .5;
pos1[1] = (70 / 200.) + .5;
if (!myText)
{
myText = new DtText2DObject(exConn, 300, "",
DtVdcVector2D(pos1[0], pos1[1]));
exConn->drainInput();
myText->setFlashing(0);
DtVdcColor colorToSet(ucolor[0], ucolor[1], ucolor[2], ucolor[3]);
myText->setColor(colorToSet);
myObjects.push_back(myText);
}
myText->setFont("$(SHARED_DATA_DIR)/Fonts/FreeSans.otf", 14);
myText->setText(msg);
myText->update();
// Process any incoming messages.
exConn->drainInput();
DtSleep(0.1);
}
// Shows the specified set.
void showSet(const DtString& setName)
{
DtRemoteGraphicSet_v1 showSetCommand;
sprintf(showSetCommand.mySetName, "%s", setName.c_str());
showSetCommand.myState = true;
DtDataInteraction dataInter;
myCommandMarshaller.encode(&showSetCommand, &dataInter);
exConn->sendStamped(dataInter);
}
// Hides the specified set.
void hideSet(const DtString& setName)
{
DtRemoteGraphicSet_v1 showSetCommand;
sprintf(showSetCommand.mySetName, "%s", setName.c_str());
showSetCommand.myState = false;
DtDataInteraction dataInter;
myCommandMarshaller.encode(&showSetCommand, &dataInter);
exConn->sendStamped(dataInter);
}
// Runs the 2D demo
void demo2d()
{
id = 100;
showSet("2D Objects");
setMsg("2D Demo, Text....");
showSet("2D Objects::Text");
int i;
unsigned pattern;
double pos1[2], pos2[2];
double scale[3];
double rot;
pos1[0] = .1;
pos1[1] = .3;
ucolor[0] = 255;ucolor[1] = 255; ucolor[2] = 255; ucolor[3] = 255;
char texts[3][256] ={"2DText1", "2DText2", "2DText with spaces 3"};
for (i = 0; i < 3; i++)
{
DtText2DObject* text2D = new DtText2DObject(exConn, id++,
texts[i], DtVdcVector2D(pos1[0], pos1[1]));
text2D->setColor(ucolor);
text2D->setFlashing(((i % 2) != 0));
text2D->setRemoteGraphicSet("2D Objects::Text");
myObjects.push_back(text2D);
updateObjects();
ucolor[i] -= 50;
pos1[1] += 0.2;
DtSleep(1);
}
DtSleep(2);
hideSet("2D Objects::Text");
setMsg("2D Demo, Squares....");
showSet("2D Objects::Squares");
pos1[0] = .3;
pos1[1] = .2;
rot = 0;
scale[0] = 0.15;
scale[1] = 0.15;
pattern = 0xffffffff;
ucolor[0] = 255;ucolor[1] = 255; ucolor[2] = 255; ucolor[3] = 255;
for (i = 0; i < 4; i++)
{
DtRectangleObject* square = new DtRectangleObject(exConn, id++,
DtVdcVector2D(pos1[0], pos1[1]),
DtVdcVector2D(scale[0] / 2, scale[1] / 2));
square->setColor(ucolor);
square->setRotation(rot);
square->setFlashing((((i+1)%3) == 0));
square->setFill((((i+1)%3) != 0));
square->setPattern(pattern);
square->setRemoteGraphicSet("2D Objects::Squares");
myObjects.push_back(square);
updateObjects();
pattern -= 678;
ucolor[i%3] -= 120;
pos1[1] += .15;
rot += DtDeg2Rad(35);
scale[i%2] += 0.05 *(i+1);
DtSleep(1);
}
DtSleep(2);
hideSet("2D Objects::Squares");
setMsg("2D Demo, Circles....");
showSet("2D Objects::Circles");
pos1[0] = 0.5;
pos1[1] = 0.1;
rot = 0;
scale[0] = 0.15;
scale[1] = 0.15;
pattern = 0xbbbbbbbb;
ucolor[0] = 255;ucolor[1] = 255; ucolor[2] = 255; ucolor[3] = 255;
for (i = 0; i < 4; i++)
{
DtEllipseObject* circle = new DtEllipseObject(exConn, id++,
DtVdcVector2D(pos1[0], pos1[1]),
DtVdcVector2D(scale[0] / 2, scale[1] / 2));
circle->setFlashing((((i+1)%3) == 0));
circle->setColor(ucolor);
circle->setRotation(rot);
circle->setFill((((i+1)%3) != 0));
circle->setPattern(pattern);
circle->setRemoteGraphicSet("2D Objects::Circles");
myObjects.push_back(circle);
updateObjects();
pattern -= 678;
ucolor[i%3] -= 80;
pos1[1] += 0.2;
rot += DtDeg2Rad(55);
scale[i%2] += 0.05 *(i+1);
DtSleep(1);
}
DtSleep(2);
hideSet("2D Objects::Circles");
setMsg("2D Demo, Triangles....");
showSet("2D Objects::Triangles");
pos1[0] = 0.7;
pos1[1] = 0.2;
rot = 0;
scale[0] = 0.05;
scale[1] = 0.05;
pattern = 0xbbbbbbbb;
ucolor[0] = 255;ucolor[1] = 255; ucolor[2] = 255; ucolor[3] = 255;
DtVector points[3];
points[0] = DtVector(0, 0, .5);
points[1] = DtVector(1, 0, .5);
points[2] = DtVector(.5, 1, .5);
for (i = 0; i < 4; i++)
{
DtTriangle2DObject* triangle = new DtTriangle2DObject(exConn, id++,
DtVdcVector2D(points[0].x(), points[0].y()),
DtVdcVector2D(points[1].x(), points[1].y()),
DtVdcVector2D(points[2].x(), points[2].y()));
triangle->setOffset(DtVdcVector2D(pos1[0], pos1[1]));
triangle->setFlashing((((i+1)%3) == 0));
triangle->setColor(ucolor);
triangle->setRotation(rot);
triangle->setScale(DtVdcVector2D(scale[0], scale[1]));
triangle->setFill((((i+1)%3) != 0));
triangle->setPattern(pattern);
triangle->setRemoteGraphicSet("2D Objects::Triangles");
myObjects.push_back(triangle);
updateObjects();
pattern -= 678;
ucolor[i%3] -= 80;
pos1[1] += 0.2;
rot += DtDeg2Rad(55);
scale[i%2] += 0.05 *(i+1);
DtSleep(1);
}
DtSleep(2);
hideSet("2D Objects::Triangles");
setMsg("2D Demo, Lines....");
showSet("2D Objects::Lines");
pos2[0] = 0.75;
pos2[1] = 0.2;
pos1[0] = 0.25;
pos1[1] = 0.5;
rot = 0;
scale[0] = 0.05;
scale[1] = 0.05;
pattern = 0xffffffff;
ucolor[0] = 255;ucolor[1] = 255; ucolor[2] = 80; ucolor[3] = 255;
int thick = 1;
for (i = 0; i < 4; i++)
{
DtLine2DObject* line = new DtLine2DObject(exConn, id++,
DtVdcVector2D(pos1[0], pos1[1]),
DtVdcVector2D(pos2[0], pos2[1]));
line->setFlashing((((i+1)%3) == 0));
line->setThickness(thick);
line->setColor(ucolor);
line->setPattern(pattern);
line->setRemoteGraphicSet("2D Objects::Lines");
myObjects.push_back(line);
updateObjects();
thick += 1;
pattern -= 678;
ucolor[i%3] -= 80;
pos1[1] += .075;
pos2[1] += .075;
DtSleep(1);
}
DtSleep(2);
hideSet("2D Objects::Lines");
pattern = 0xffffffff;
setMsg("2D Demo, Segmented Line....");
showSet("2D Objects::Segmented Lines");
pos2[0] = 0.9;
pos2[1] = 0.1;
pos1[0] = 0.1;
pos1[1] = 0.9;
DtLine2DObject* segLine = new DtLine2DObject(exConn, id++,
DtVdcVector2D(pos1[0], pos1[1]),
DtVdcVector2D(pos2[0], pos2[1]),
4);
segLine->setFlashing(0);
segLine->setRemoteGraphicSet("2D Objects::Segmented Lines");
thick = 1;
ucolor[0] = 255;ucolor[1] = 255; ucolor[2] = 255; ucolor[3] = 255;
for (i = 0; i < 4; i++)
{
segLine->setColor(ucolor, i);
segLine->setPattern(pattern, i);
segLine->setThickness(thick, i);
segLine->setPercentage(.25, i);
pattern -= 0x11111111;
ucolor[i%3] -= 100;
thick += 2;
}
myObjects.push_back(segLine);
updateObjects(2.0);
setMsg("2D Demo, Changing Segmented Line....");
int dt = 25;
int inc = -1;
for(int j = 0; j < 200; j++)
{
segLine->setPercentage((dt * 0.01), 0);
for (i = 1; i < 3; i++)
{
segLine->setPercentage(0.25, i);
}
segLine->setPercentage((50 - dt) * 0.01, 3);
dt += inc;
if (dt == 25 || dt == 1)
inc *= -1;
updateObjects();
DtSleep(0.1);
}
DtSleep(2);
showSet("2D Objects::Text");
showSet("2D Objects::Squares");
showSet("2D Objects::Circles");
showSet("2D Objects::Triangles");
showSet("2D Objects::Lines");
DtSleep(3);
hideSet("2D Objects");
}
void demo3d()
{
int i = 0;
id = 1000;
showSet("3D Objects");
setMsg("Area...");
showSet("3D Objects::Areas");
unsigned ar1 = id++;
std::vector<DtVector> vertices;
// Coordinates for Ground DB II
vertices.push_back( DtVector( 6378401, -1500.0, -3000.0 ) );
vertices.push_back( DtVector( 6378801, -3500.0, -3000.0 ) );
vertices.push_back( DtVector( 6378001, -3500.0, 3000.0 ) );
DtArea3DObject* ar = new DtArea3DObject(exConn, ar1, vertices);
ar->setFlashing(false);
ar->setColor(DtVdcColor(255, 255, 0, 100));
ar->setRemoteGraphicSet("3D Objects::Areas");
myObjects.push_back(ar);
ar->setFlashing(false);
updateObjects(2.0);
DtSleep(5);
setMsg( "Projected Area..." );
vertices.clear();
vertices.push_back( DtVector( 6378400, -600.0, -1000.0 ) );
vertices.push_back( DtVector( 6378400, -600.0, -400.0 ) );
vertices.push_back( DtVector( 6378000, -400.0, -700.0 ) );
vertices.push_back( DtVector( 6378000, -500.0, -900.0 ) );
unsigned ar2 = id++;
DtArea3DObject* projectedArea = new DtArea3DObject( exConn, ar2, vertices );
projectedArea->setColor( DtVdcColor( 255, 255, 255, 200 ) );
projectedArea->setRemoteGraphicSet( "3D Objects::Areas" );
projectedArea->setFlashing( false );
myObjects.push_back( projectedArea );
projectedArea->setProjected( true );
// 0 or 1, means non-tiled textures for projected, exact number of tiles for
// projected is not supported
projectedArea->setNumTextureTiles( 1 );
updateObjects( 2.0 );
DtSleep( 2 );
setMsg( "Textured Projected Area..." );
vertices.clear();
vertices.push_back( DtVector( 6378400, -700.0, -900.0 ) );
vertices.push_back( DtVector( 6378400, -700.0, -400.0 ) );
vertices.push_back( DtVector( 6378000, -300.0, -600.0 ) );
vertices.push_back( DtVector( 6378000, -600.0, -800.0 ) );
unsigned ar3 = id++;
DtArea3DObject* tProjectedArea = new DtArea3DObject( exConn, ar3, vertices );
tProjectedArea ->setColor( DtVdcColor( 255, 50, 50, 255 ) );
tProjectedArea ->setRemoteGraphicSet( "3D Objects::Areas" );
tProjectedArea ->setFlashing( false );
myObjects.push_back( tProjectedArea );
tProjectedArea->setProjected( true );
// 0 or 1, means non-tiled textures for projected, exact number of tiles for
// projected is not supported
tProjectedArea->setNumTextureTiles( 2 ); // tiled texture
tProjectedArea->setTextureFilename( "$(DATA_DIR)/Icons/OverlayMinefield.png" );
updateObjects( 2.0 );
DtSleep( 2 );
DtSleep( 5 );
hideSet("3D Objects::Areas");
setMsg("Sphere...");
showSet("3D Objects::Ellipsoids");
unsigned sph1 = id++;
DtEllipsoidObject* sphere = new DtEllipsoidObject(exConn, sph1,
DtVdc3DAttachPoint(DtVector( 6378400, -300.0, -300.0 )),
DtVector(20, 20, 20));
DtVdcColor clsp1(0, 255 ,0, 100);
sphere->setFlashing(false);
sphere->setColor(clsp1);
sphere->setRemoteGraphicSet("3D Objects::Ellipsoids");
myObjects.push_back(sphere);
updateObjects(2.0);
setMsg("Scaling sphere...");
int scales[3];
scales[0] = 20;
scales[1] = 20;
scales[2] = 20;
int inc = 0;
inc = 0;
int clplus = 5;
for (i = 0; inc < 3; i++)
{
scales[inc] += 4;
clsp1[2] += clplus;
sphere->setDiameters(DtVector(scales[0], scales[1], scales[2]));
sphere->setColor(clsp1);
updateObjects();
if (scales[inc] > 60)
inc++;
DtSleep(0.1);
}
setMsg("Rotating sphere...");
inc = 0;
scales[0] = 10;
scales[1] = 10;
scales[2] = 10;
for (i = 0; inc < 3; i++)
{
scales[inc] += 5;
clsp1[2] += clplus;
if (clsp1[2] == 250 || clsp1[2] == 50)
clplus *= -1;
sphere->setRotation(DtTaitBryan(DtDeg2Rad(scales[0]), DtDeg2Rad(scales[1]), DtDeg2Rad(scales[2])));
sphere->setColor(clsp1);
updateObjects();
if (scales[inc] > 60)
inc++;
DtSleep(0.1);
}
hideSet("3D Objects::Ellipsoids");
setMsg("Cube...");
showSet("3D Objects::Cuboids");
unsigned cubeId = id++;
DtVdcColor clsp3(0, 0, 255, 100);
DtCuboidObject* cube = new DtCuboidObject(exConn, cubeId,
DtVdc3DAttachPoint(sphere->globalId()), 10, 10, 10);
cube->setColor(clsp3);
cube->setRemoteGraphicSet("3D Objects::Cuboids");
myObjects.push_back(cube);
updateObjects(2.0);
setMsg("Scaling cube...");
scales[0] = 10;
scales[1] = 10;
scales[2] = 10;
inc = 0;
clplus = 5;
for (i = 0; inc < 3; i++)
{
scales[inc] += 4;
clsp1[3] += clplus;
if (clsp1[3] == 250 || clsp1[3] == 50)
clplus *= -1;
cube->setLength(scales[0]);
cube->setWidth(scales[1]);
cube->setHeight(scales[2]);
cube->setColor(clsp1);
updateObjects();
if (scales[inc] > 60)
inc++;
DtSleep(0.1);
}
setMsg("Rotating cube...");
inc = 0;
scales[0] = 10;
scales[1] = 10;
scales[2] = 10;
for (i = 0; inc < 3; i++)
{
scales[inc] += 5;
clsp1[2] += clplus;
if (clsp1[2] == 250 || clsp1[2] == 50)
clplus *= -1;
cube->setRotation(DtTaitBryan(DtDeg2Rad(scales[0]), DtDeg2Rad(scales[1]), DtDeg2Rad(scales[2])));
cube->setColor(clsp1);
updateObjects();
if (scales[inc] > 60)
inc++;
DtSleep(0.1);
}
cube->setOffset(DtVector32(150, 0, 0));
updateObjects();
hideSet("3D Objects::Cuboids");
setMsg("Cylinder...");
showSet("3D Objects::Cylinders");
int cyl1 = id++;
DtCylinderObject* cylinder = new DtCylinderObject(exConn, cyl1,
DtVdc3DAttachPoint(sphere->globalId()), 20, DtVdcVector2D(4, 4));
cylinder->setFlashing(false);
DtVdcColor clrcyl1(255, 0, 255, 60);
cylinder->setColor(clrcyl1);
cylinder->setRotation(DtTaitBryan(0,0,0));
cylinder->setRemoteGraphicSet("3D Objects::Cylinders");
myObjects.push_back(cylinder);
updateObjects(2.0);
setMsg("Scaling cylinder...");
scales[0] = 20;
scales[1] = 4;
scales[2] = 4;
inc = 0;
clplus = 5;
int size = 60;
for (i = 0; inc < 3; i++)
{
scales[inc] += 4;
clsp1[3] += clplus;
if (clsp1[3] == 250 || clsp1[3] == 50)
clplus *= -1;
cylinder->setLength(scales[0]);
cylinder->setDiameters(DtVdcVector2D(scales[1], scales[2]));
cylinder->setColor(clsp1);
updateObjects();
if (scales[inc] > size)
{
inc++;
size = 15;
}
DtSleep(0.1);
}
setMsg("Rotating cylinder...");
inc = 0;
scales[0] = 10;
scales[1] = 10;
scales[2] = 10;
for (i = 0; inc < 3; i++)
{
scales[inc] += 5;
clsp1[2] += clplus;
if (clsp1[2] == 250 || clsp1[2] == 50)
clplus *= -1;
cylinder->setRotation(DtTaitBryan(DtDeg2Rad(scales[0]), DtDeg2Rad(scales[1]), DtDeg2Rad(scales[2])));
cylinder->setColor(clsp1);
updateObjects();
if (scales[inc] > 60)
inc++;
DtSleep(0.1);
}
cylinder->setRotation(DtTaitBryan(0,0,0));
// X is the length, YZ are the radius. Because we are linking between two spheres
// the length is omited
cylinder->setLength(120);
cylinder->setDiameters(DtVdcVector2D(10, 10));
updateObjects();
setMsg("3D texts");
showSet("3D Objects::Text");
DtText3DObject* text = new DtText3DObject(exConn, id++, "Text One",
DtVdcColor textcolor(255, 255, 0, 255);
text->setFlashing(false);
text->setColor(textcolor);
text->setOffset(DtVector32(0, 15, 0));
text->setRemoteGraphicSet("3D Objects::Text");
myObjects.push_back(text);
updateObjects(2.0);
DtText3DObject* text2 = new DtText3DObject(exConn, id++, "FLASHING TEXT",
text2->setColor(textcolor);
text2->setFlashing(true);
text2->setOffset(DtVector32(45, 0, 0));
text2->setRemoteGraphicSet("3D Objects::Text");
myObjects.push_back(text2);
updateObjects(2.0);
DtSleep(4);
hideSet("3D Objects::Cylinders");
hideSet("3D Objects::Text");
setMsg("3D lines");
showSet("3D Objects::Lines");
int line1 = id++;
DtLine3DObject* line = new DtLine3DObject(exConn, line1,
DtVdcColor linecolor1(255 , 255, 50, 255);
line->setFlashing(false);
line->setColor(linecolor1);
line->setPattern(0xffffffff);
line->setThickness(3);
line->setOffset(DtVector32(0,0,50));
line->setRemoteGraphicSet("3D Objects::Lines");
myObjects.push_back(line);
updateObjects(2.0);
DtLine3DObject* line2 = new DtLine3DObject(exConn, id++,
DtVdcColor linecolor2(255 , 50, 50, 255);
line2->setFlashing(true);
line2->setColor(linecolor2);
line2->setPattern(0xffffffff);
line2->setThickness(1);
line2->setOffset(DtVector32(0, 0, 70));
line2->setRemoteGraphicSet("3D Objects::Lines");
myObjects.push_back(line2);
updateObjects(2.0);
DtSleep(4);
hideSet("3D Objects::Lines");
setMsg("Segmented line....");
showSet("3D Objects::Segmented Lines");
DtLine3DObject* segLine = new DtLine3DObject(exConn, id++,
segLine->setFlashing(0);
segLine->setOffset(DtVector32(0,0,90));
segLine->setRemoteGraphicSet("3D Objects::Segmented Lines");
myObjects.push_back(segLine);
linecolor2[0] = 255;linecolor2[1] = 255; linecolor2[2] = 255; linecolor2[3] = 255;
for (i = 0; i < 4; i++)
{
segLine->setColor(linecolor2, i);
segLine->setPattern(0xbbbbbbbb, i);
segLine->setThickness(2, i);
segLine->setPercentage(0.25, i);
linecolor2[i%3] -= 100;
}
updateObjects(2.0);
setMsg("Changing segmented Line....");
int dt = 25;
inc = -1;
for(int j = 0; j < 200; j++)
{
segLine->setPercentage(dt * 0.01, 0);
for (i = 1; i < 3; i++)
{
segLine->setPercentage(0.25, i);
}
segLine->setPercentage((50 - dt) * 0.01, 3);
dt +=inc;
if (dt == 1 || dt == 25)
inc *= -1;
updateObjects();
DtSleep(0.1);
}
DtSleep(2);
setMsg( "Projected Line...." );
DtLine3DObject* projectedLine = new DtLine3DObject( exConn, id++,
DtVdc3DAttachPoint( DtVector( 6378400, -600.0, -1000.0 ) ),
DtVdc3DAttachPoint( DtVector( 6378000, -400.0, -700.0 ) ) );
projectedLine->setFlashing( false );
projectedLine->setColor( linecolor1 );
projectedLine->setPattern( 0xffffffff );
// Not currently supported for projected line
//projectedLine->setLineStyle( DtVdcLineSegment::DtVdcSegmentStyleLightning );
//projectedLine->setArrowStyle( DtVdcLineSegment::DtVdcSegmentArrowStyleArrowDouble );
projectedLine->setThickness( 3 );
projectedLine->setOffset( DtVector32( 0, 0, 50 ) );
projectedLine->setRemoteGraphicSet( "3D Objects::Lines" );
projectedLine->setProjected( true );
myObjects.push_back( projectedLine );
updateObjects(2.0);
DtSleep( 3 );
showSet("3D Objects::Cuboids");
showSet("3D Objects::Ellipsoids");
showSet("3D Objects::Cylinders");
showSet("3D Objects::Text");
showSet("3D Objects::Lines");
showSet("3D Objects::Areas");
DtSleep(3);
hideSet("3D Objects");
return;
}
int main(int argc, char** argv)
{
DtVrlApplicationInitializer appInit(argc, argv, "drawObjects");
appInit.parseCmdLine();
exConn = new DtExerciseConn(appInit);
exConn->setApplicationId(3, 5);
#if DtHLA
exConn->ignoreAdvisories();
#endif
setMsg("start demo 3D..");
demo3d();
setMsg("End demo 3D..");
DtSleep(2);
setMsg("Start demo 2D..");
demo2d();
setMsg("End demo 2D..");
for (unsigned int i = 0; i < myObjects.size(); ++i)
{
delete myObjects[i];
}
delete exConn;
return 0;
}
DtArea3DObject.h contains the class definition for DtArea3DObject, which represents an area object po...
DtAttributeGroupObject.h contains the class definition for DtAttributeGroupObject,...
DtAttributeGroupTemplateObject.h contains the class definition for DtAttributeGroupTemplateObject,...
DtCuboidObject.h contains the class definition for DtCuboidObject, which represents cuboidal Draw Con...
DtEllipseObject.h contains the class definition for DtEllipseObject, which represents elliptical,...
DtEllipsoidObject.h contains the class definition for DtEllipsoidObject, which represents 3D ellipsoi...
DtLine2DObject.h contains the class definition for DtLine2DObject, which represents a line object pos...
DtLine3DObject.h contains the class definition for DtLine3DObject, which represents a line object pos...
DtRectangleObject.h contains the class definition for DtRectangleObject, which represents rectangular...
DtText2DObject.h contains the class definition for DtText2DObject, which represents a text object pos...
DtText3DObject.h contains the class definition for DtText3DObject, which represents a text object pos...
Definition DtArea3DObject.h:44
virtual void setTextureFilename(const DtString &str)
Texture file name mutator.
virtual void setProjected(bool projected)
Get/Set the boolean that indicates whether or not the line (if it is a 3D line) should be projected o...
virtual void setRemoteGraphicSet(const std::string &setName)
virtual void setColor(const DtVdcColor &color)
color mutator
virtual void setFlashing(bool flashing)
flashing mutator
virtual void setNumTextureTiles(int numTextureTiles)
Texture tile repetitions mutator.
A 3D cuboidal Stealth Draw Control Object.
Definition DtCuboidObject.h:28
virtual void setHeight(double height)
height mutator
virtual void setLength(double length)
length mutator
virtual void setWidth(double width)
width mutator
virtual void setRotation(const DtTaitBryan &rotation)
rotation mutator
A class for representing cylinders.
Definition DtCylinderObject.h:40
virtual void setRemoteGraphicSet(const std::string &setName)
virtual void setLength(double length)
length mutator
virtual void setColor(const DtVdcColor &color)
color mutator
virtual void setDiameters(const DtVdcVector2D &diameters)
diameters mutator
virtual void setFlashing(bool flashing)
flashing mutator
virtual void setRotation(const DtTaitBryan &rotation)
rotation mutator
virtual const DtGlobalObjectDesignator & globalId() const
A 2D elliptical Stealth Draw Control Object.
Definition DtEllipseObject.h:23
virtual void setRotation(double rotation)
rotation mutator
virtual void setRemoteGraphicSet(const std::string &setName)
virtual void setPattern(unsigned pattern)
pattern mutator
virtual void setColor(const DtVdcColor &color)
color mutator
virtual void setFlashing(bool flashing)
flashing mutator
virtual void setFill(bool fill)
fill mutator
virtual void setRemoteGraphicSet(const std::string &setName)
virtual void setFlashing(bool flashing)
flashing mutator
virtual void setColor(const DtVdcColor &color)
color mutator
virtual void setOffset(const DtVector32 &off)
offset mutator
A 3D ellipsoidal Stealth Draw Control Object.
Definition DtEllipsoidObject.h:27
virtual void setRotation(const DtTaitBryan &rotation)
rotation mutator
virtual void setDiameters(const DtVector &diameters)
diameters mutator
A 2D Line Stealth Draw Control Object.
Definition DtLine2DObject.h:38
virtual void setLineStyle(DtVdcLineSegment::DtVdcSegmentStyle lineStyle, int segment=0)
lineStyle mutator
virtual void setColor(const DtVdcColor &color, int segment)
color mutator
virtual void setPattern(unsigned pattern, int segment=0)
pattern mutator
virtual void setFlashing(bool flashing)
flashing mutator
virtual void setThickness(unsigned thickness, int segment=0)
thickness mutator
virtual void setRemoteGraphicSet(const std::string &setName)
virtual void setArrowStyle(DtVdcLineSegment::DtVdcSegmentArrowStyle arrowStyle, int segment=0)
arrowStyle mutator
virtual void setPercentage(double percentage, int segment)
percentage mutator
A 3D Line Stealth Draw Control Object.
Definition DtLine3DObject.h:40
virtual void setLineStyle(DtVdcLineSegment::DtVdcSegmentStyle lineStyle, int segment=0)
lineStyle mutator
virtual void setFlashing(bool flashing)
flashing mutator
virtual void setPercentage(double percentage, int segment)
percentage mutator
virtual void setColor(const DtVdcColor &color, int segment)
color mutator
virtual void setThickness(unsigned thickness, int segment=0)
thickness mutator
virtual void setOffset(const DtVector32 &off)
offset mutator
virtual void setArrowStyle(DtVdcLineSegment::DtVdcSegmentArrowStyle arrowStyle, int segment=0)
arrowStyle mutator
virtual void setProjected(bool projected)
projected mutator
virtual void setPattern(unsigned pattern, int segment=0)
pattern mutator
virtual void setRemoteGraphicSet(const std::string &setName)
A 2D rectangular Stealth Draw Control Object.
Definition DtRectangleObject.h:26
A 2D Text Stealth Draw Control Object.
Definition DtText2DObject.h:31
virtual void setFont(const char *fontFilePath, float size)
font mutator
virtual void setColor(const DtVdcColor &color)
color mutator
virtual void setRemoteGraphicSet(const std::string &setName)
virtual void update()
update the internal pdu
virtual void setText(const DtString &text)
text mutator
virtual void setFlashing(bool flashing)
flashing mutator
A 3D Text Stealth Draw Control Object.
Definition DtText3DObject.h:31
virtual void setOffset(const DtVector32 &off)
offset mutator
virtual void setColor(const DtVdcColor &color)
color mutator
virtual void setRemoteGraphicSet(const std::string &setName)
virtual void setFlashing(bool flashing)
flashing mutator
A 2D triangular Stealth Draw Control Object.
Definition DtTriangle2DObject.h:31
virtual void setScale(const DtVdcVector2D &scale)
scale mutator
virtual void setColor(const DtVdcColor &color)
color mutator
virtual void setOffset(const DtVdcVector2D &offset)
offset mutator
virtual void setPattern(unsigned pattern)
pattern mutator
virtual void setFlashing(bool flashing)
flashing mutator
virtual void setRotation(double rotation)
rotation mutator
virtual void setFill(bool fill)
fill mutator
virtual void setRemoteGraphicSet(const std::string &setName)
DtVdc3DAttachPoint represents the 3 methods for attaching a 3D draw control object in 3-space.
Definition DtVdc3DAttachPoint.h:34
DtVdcColor represents colors for Draw Control Objects.
Definition DtVdcColor.h:22
static const DtVdcColor DtVdcWhite
Constant for the color White.
Definition DtVdcColor.h:186
DtVdcSegmentStyle
Supported Line Segment Styles.
Definition DtVdcLineSegment.h:31
@ DtVdcSegmentStyleStraight
Straight line.
Definition DtVdcLineSegment.h:33
@ DtVdcSegmentStyleLightning
Lightning bolt line.
Definition DtVdcLineSegment.h:35
DtVdcSegmentArrowStyle
Supported Arrow Segment Styles.
Definition DtVdcLineSegment.h:43
@ DtVdcSegmentArrowStyleArrowStart
Arrowhead on the segment start.
Definition DtVdcLineSegment.h:49
@ DtVdcSegmentArrowStyleNoArrow
No arrowhead on either end.
Definition DtVdcLineSegment.h:45
@ DtVdcSegmentArrowStyleArrowDouble
Arrowhead on both ends of the segment.
Definition DtVdcLineSegment.h:51
Definition DtVdcVector2D.h:34
x y t t *t x y t t t x y t t t x *y t *t t x *y t *t t x y t t t x y t t t x(y+z)
A 3D Area Stealth Draw Control Object.
Definition DtVrlinkDataInterMarshaller.h:18
Definition vrvControlToolkitDataTypes.h:1226
DtInt8 mySetName[256]
Definition vrvControlToolkitDataTypes.h:1231
DtBool myState
Show or hide.
Definition vrvControlToolkitDataTypes.h:1233
Contains vrvControlToolkit control structures and defines.
Contains DLL export macros.
Contains DLL export macros.
Contains DLL export macros.
Contains DLL export macros.