It shows how to use the DtGeoReference class to position and orient the gimbal using the plane's position and orientation; and how to find azimuth and elevation angles to a target in the gimbal's local coordinate system. It attaches the observer named "Observer 1" to the gimbal, and uses the azimuth and elevation angles determined to lock the observer onto the target location.
#include <vlutil/vlUtil.h>
using namespace makVrv;
const double DtTargetLatitude = DtDeg2Rad(10.0327245110);
const double DtTargetLongitude = DtDeg2Rad(60.0271819335);
const double DtTargetAltitude = 29.389;
const double DtGimbalForwardOffset = 2.0;
const double DtGimbalDownOffset = 2.5;
const double DtGimbalRightOffset = 0.;
: makVrv::
DtDriver( am,
"DtGimbalDriver" )
, myPlaneGeoRef( 0 )
, myGimbalGeoRef( 0 )
, myGimbalSceneObjectAgent( 0 )
, myTargetLocation( 0 )
{
myTargetLocation = new DtGeodeticCoord( DtTargetLatitude, DtTargetLongitude, DtTargetAltitude,
myAgentManager.de().sharedState().coordinateSystem().referenceEllipsoid() );
mySignalConnections += DtDeSharedStateSignaler::instance( myAgentManager.de() )
}
{
{
}
}
{
myTargetLocation =
new DtGeodeticCoord( DtTargetLatitude, DtTargetLongitude, DtTargetAltitude,
}
{
}
{
bool found = false;
DtElementData::ElementEntryMap::const_iterator curIter =
DtElementData::ElementEntryMap::const_iterator endIter =
for( ; curIter != endIter; ++curIter )
{
if ( name && name->
value() ==
"Entity From Facade" )
{
sceneObjectIds, DtSceneObject::ModelSet_3D );
if ( sceneObjectIds.size() == 1 )
{
if(updater)
{
found = true;
}
}
}
}
if (! found )
{
return false;
}
myGimbalSceneObjectAgent->setModelSet( 0 );
myGimbalSceneObjectAgent->setElementID(
myGimbalId );
return true;
}
{
return true;
}
{
return true;
}
{
if ( myGimbalSceneObjectAgent == NULL )
{
{
return true;
}
}
DtVector planePosition;
DtTaitBryan planeOrientation;
DtGeodeticCoord gimbalGeod;
DtTaitBryan gimbalOri;
DtVector( DtGimbalForwardOffset, DtGimbalRightOffset, DtGimbalDownOffset),
DtTaitBryan(0., 0., 0.),
gimbalGeod, gimbalOri );
myGimbalSceneObjectAgent->setTopographicOrientation( 0, gimbalOri );
DtVector targetTopo;
DtTaitBryan unused( 0., 0., 0. );
double azimuthAngle = -atan2( targetTopo[1], targetTopo[0] );
double xyPlaneDistance = sqrt( targetTopo[0] * targetTopo[0] + targetTopo[1] * targetTopo[1] );
double elevationAngle = DtDeg2Rad( 90. ) - atan2( xyPlaneDistance, -targetTopo[2] );
if ( observer )
{
}
return true;
}
{
driverManager().inputDriver().findObserverByName( "Observer 1" );
if ( observer )
{
std::set<std::string> displayNames;
displayNames.insert( entityName );
}
}
{
}