// Implementation of FGViewer.
////////////////////////////////////////////////////////////////////////
-// Constructor
-FGViewer::FGViewer( fgViewType Type, bool from_model, int from_model_index, bool at_model, int at_model_index, double x_offset_m, double y_offset_m, double z_offset_m, double near_m ):
+// Constructor...
+FGViewer::FGViewer( fgViewType Type, bool from_model, int from_model_index,
+ bool at_model, int at_model_index,
+ double x_offset_m, double y_offset_m, double z_offset_m,
+ double heading_offset_deg, double pitch_offset_deg,
+ double roll_offset_deg, double fov_deg,
+ double target_x_offset_m, double target_y_offset_m,
+ double target_z_offset_m, double near_m ):
_dirty(true),
_lon_deg(0),
_lat_deg(0),
_roll_deg(0),
_pitch_deg(0),
_heading_deg(0),
- _roll_offset_deg(0),
- _pitch_offset_deg(0),
- _heading_offset_deg(0),
- _goal_pitch_offset_deg(0.0),
- _goal_heading_offset_deg(0.0),
- _scaling_type(FG_SCALING_MAX),
- _fov_deg(55.0)
+ _scaling_type(FG_SCALING_MAX)
{
sgdZeroVec3(_absolute_view_pos);
_type = Type;
_x_offset_m = x_offset_m;
_y_offset_m = y_offset_m;
_z_offset_m = z_offset_m;
+ _heading_offset_deg = heading_offset_deg;
+ _pitch_offset_deg = pitch_offset_deg;
+ _roll_offset_deg = roll_offset_deg;
+ _goal_heading_offset_deg = heading_offset_deg;
+ _goal_pitch_offset_deg = pitch_offset_deg;
+ _goal_roll_offset_deg = roll_offset_deg;
+ if (fov_deg > 0) {
+ _fov_deg = fov_deg;
+ } else {
+ _fov_deg = 55;
+ }
+ _target_x_offset_m = target_x_offset_m;
+ _target_y_offset_m = target_y_offset_m;
+ _target_z_offset_m = target_z_offset_m;
_ground_level_nearplane_m = near_m;
- //a reasonable guess for init, so that the math doesn't blow up
+ // a reasonable guess for init, so that the math doesn't blow up
}
_z_offset_m = z_offset_m;
}
+void
+FGViewer::setTargetXOffset_m (double target_x_offset_m)
+{
+ _dirty = true;
+ _target_x_offset_m = target_x_offset_m;
+}
+
+void
+FGViewer::setTargetYOffset_m (double target_y_offset_m)
+{
+ _dirty = true;
+ _target_y_offset_m = target_y_offset_m;
+}
+
+void
+FGViewer::setTargetZOffset_m (double target_z_offset_m)
+{
+ _dirty = true;
+ _target_z_offset_m = target_z_offset_m;
+}
+
void
FGViewer::setPositionOffsets (double x_offset_m, double y_offset_m, double z_offset_m)
{
sgCopyMat4(LOCAL, location->getCachedTransformMatrix());
}
+void
+FGViewer::updateAtModelLocation (FGLocation * location)
+{
+ sgCopyMat4(ATLOCAL, location->getCachedTransformMatrix());
+}
+
void
FGViewer::recalcOurOwnLocation (FGLocation * location, double lon_deg, double lat_deg, double alt_ft,
double roll_deg, double pitch_deg, double heading_deg)
sgSetVec4(VIEW[2], _view_up[0], _view_up[1], _view_up[2],SG_ZERO);
sgSetVec4(VIEW[3], SG_ZERO, SG_ZERO, SG_ZERO,SG_ONE);
- // rotate matrix to get a matrix to apply Eye Position Offsets
+ // rotate model or local matrix to get a matrix to apply Eye Position Offsets
sgMat4 VIEW_UP; // L0 forward L1 right L2 up
sgCopyVec4(VIEW_UP[0], LOCAL[1]);
sgCopyVec4(VIEW_UP[1], LOCAL[2]);
sgVec3 right;
sgVec3 eye_pos, at_pos;
sgVec3 position_offset; // eye position offsets (xyz)
+ sgVec3 target_position_offset; // target position offsets (xyz)
// The position vectors originate from the view point or target location
// depending on the type of view.
// Update location data for target...
if ( _at_model ) {
// update or data from model location
- updateFromModelLocation(_target_location);
+ updateAtModelLocation(_target_location);
} else {
// if not model then calculate our own target position...
recalcOurOwnLocation( _target_location, _target_lon_deg, _target_lat_deg, _target_alt_ft,
sgSetVec3( _view_up, LOCAL[2][0], LOCAL[2][1], LOCAL[2][2] );
sgSetVec3( right, LOCAL[1][0], LOCAL[1][1], LOCAL[1][2] );
- // Note that when in "lookat" view the "world up" vector is always applied
- // to the viewer. World up is based on verticle at a given lon/lat (see
- // matrix "UP" above).
+ // rotate model or local matrix to get a matrix to apply Eye Position Offsets
+ sgMat4 VIEW_UP; // L0 forward L1 right L2 up
+ sgCopyVec4(VIEW_UP[0], LOCAL[1]);
+ sgCopyVec4(VIEW_UP[1], LOCAL[2]);
+ sgCopyVec4(VIEW_UP[2], LOCAL[0]);
+ sgZeroVec4(VIEW_UP[3]);
- // Orientation Offsets matrix
+ // get Orientation Offsets matrix
MakeVIEW_OFFSET( VIEW_OFFSET,
- (_heading_offset_deg -_heading_deg) * SG_DEGREES_TO_RADIANS, _world_up,
+ (_heading_offset_deg - 180) * SG_DEGREES_TO_RADIANS, _view_up,
_pitch_offset_deg * SG_DEGREES_TO_RADIANS, right );
-
- // add in the Orientation Offsets here
- sgSetVec3( position_offset, _x_offset_m, _y_offset_m, _z_offset_m );
- sgXformVec3( position_offset, position_offset, UP);
+ // add in the position offsets
+ sgSetVec3( position_offset, _y_offset_m, _x_offset_m, _z_offset_m );
+ sgXformVec3( position_offset, position_offset, VIEW_UP);
+
+ // apply the Orientation offsets
sgXformVec3( position_offset, position_offset, VIEW_OFFSET );
// add the Position offsets from object to the eye position
sgAddVec3( eye_pos, eye_pos, position_offset );
+ // add target offsets to at_position...
+ sgSetVec3(target_position_offset, _target_z_offset_m, _target_x_offset_m, _target_y_offset_m );
+ sgXformVec3(target_position_offset, target_position_offset, ATLOCAL);
+ sgAddVec3( at_pos, at_pos, target_position_offset);
+
// Make the VIEW matrix for a "LOOKAT".
sgMakeLookAtMat4( VIEW, eye_pos, at_pos, _view_up );
// Constructor
FGViewer( fgViewType Type, bool from_model, int from_model_index,
- bool at_model, int at_model_index, double x_offset_m,
- double y_offset_m, double z_offset_m, double near_m );
+ bool at_model, int at_model_index,
+ double x_offset_m, double y_offset_m, double z_offset_m,
+ double heading_offset_deg, double pitch_offset_deg,
+ double roll_offset_deg, double fov_deg,
+ double target_x_offset_m, double target_y_offset_m,
+ double target_z_offset_m, double near_m );
// Destructor
virtual ~FGViewer( void );
virtual double getXOffset_m () const { return _x_offset_m; }
virtual double getYOffset_m () const { return _y_offset_m; }
virtual double getZOffset_m () const { return _z_offset_m; }
+ virtual double getTargetXOffset_m () const { return _target_x_offset_m; }
+ virtual double getTargetYOffset_m () const { return _target_y_offset_m; }
+ virtual double getTargetZOffset_m () const { return _target_z_offset_m; }
virtual void setXOffset_m (double x_offset_m);
virtual void setYOffset_m (double y_offset_m);
virtual void setZOffset_m (double z_offset_m);
+ virtual void setTargetXOffset_m (double x_offset_m);
+ virtual void setTargetYOffset_m (double y_offset_m);
+ virtual void setTargetZOffset_m (double z_offset_m);
virtual void setPositionOffsets (double x_offset_m,
double y_offset_m,
double z_offset_m);
double _target_pitch_deg;
double _target_heading_deg;
- // Position offsets from center of gravity. The X axis is positive
+ // Position offsets from FDM origin. The X axis is positive
// out the tail, Y is out the right wing, and Z is positive up.
// distance in meters
double _x_offset_m;
double _y_offset_m;
double _z_offset_m;
+ // Target offsets from FDM origin (for "lookat" targets) The X
+ // axis is positive out the tail, Y is out the right wing, and Z
+ // is positive up. distance in meters
+ double _target_x_offset_m;
+ double _target_y_offset_m;
+ double _target_z_offset_m;
+
+
// orientation offsets from reference (_goal* are for smoothed transitions)
double _roll_offset_deg;
double _pitch_offset_deg;
// sg versions of our friendly matrices
sgMat4 VIEW, UP;
- sgMat4 LOCAL, TRANS, LARC_TO_SSG;
+ sgMat4 LOCAL, ATLOCAL, TRANS, LARC_TO_SSG;
// Transformation matrix for the view direction offset relative to
// the AIRCRAFT matrix
void recalcLookAt();
void copyLocationData();
void updateFromModelLocation (FGLocation * location);
+ void updateAtModelLocation (FGLocation * location);
void recalcOurOwnLocation (FGLocation * location, double lon_deg, double lat_deg, double alt_ft,
double roll_deg, double pitch_deg, double heading_deg);
bool at_model = false;
int from_model_index = 0;
int at_model_index = 0;
- double x_offset_m, y_offset_m, z_offset_m;
+ double x_offset_m, y_offset_m, z_offset_m, fov_deg;
+ double heading_offset_deg, pitch_offset_deg, roll_offset_deg;
+ double target_x_offset_m, target_y_offset_m, target_z_offset_m;
double near_m;
for (int i = 0; i < fgGetInt("/sim/number-views"); i++) {
nodepath = viewpath;
nodepath += "/config/z-offset-m";
z_offset_m = fgGetDouble(nodepath.c_str());
+ nodepath = viewpath;
+ nodepath += "/config/pitch-offset-deg";
+ pitch_offset_deg = fgGetDouble(nodepath.c_str());
+ fgSetDouble(nodepath.c_str(),pitch_offset_deg);
+ nodepath = viewpath;
+ nodepath += "/config/heading-offset-deg";
+ heading_offset_deg = fgGetDouble(nodepath.c_str());
+ fgSetDouble(nodepath.c_str(),heading_offset_deg);
+ nodepath = viewpath;
+ nodepath += "/config/roll-offset-deg";
+ roll_offset_deg = fgGetDouble(nodepath.c_str());
+ fgSetDouble(nodepath.c_str(),roll_offset_deg);
+ nodepath = viewpath;
+ nodepath += "/config/default-field-of-view-deg";
+ fov_deg = fgGetDouble(nodepath.c_str());
+
+ // target offsets for lookat mode only...
+ nodepath = viewpath;
+ nodepath += "/config/target-x-offset-m";
+ target_x_offset_m = fgGetDouble(nodepath.c_str());
+ nodepath = viewpath;
+ nodepath += "/config/target-y-offset-m";
+ target_y_offset_m = fgGetDouble(nodepath.c_str());
+ nodepath = viewpath;
+ nodepath += "/config/target-z-offset-m";
+ target_z_offset_m = fgGetDouble(nodepath.c_str());
nodepath = viewpath;
nodepath += "/config/ground-level-nearplane-m";
// supporting two types now "lookat" = 1 and "lookfrom" = 0
if ( strcmp("lookat",strdata.c_str()) == 0 )
add_view(new FGViewer ( FG_LOOKAT, from_model, from_model_index,
- at_model, at_model_index, x_offset_m, y_offset_m,
- z_offset_m, near_m ));
+ at_model, at_model_index, x_offset_m,
+ y_offset_m,z_offset_m,
+ heading_offset_deg, pitch_offset_deg,
+ roll_offset_deg, fov_deg,
+ target_x_offset_m, target_y_offset_m,
+ target_z_offset_m, near_m ));
else
add_view(new FGViewer ( FG_LOOKFROM, from_model, from_model_index, false,
- 0, x_offset_m, y_offset_m, z_offset_m, near_m ));
-
+ 0, x_offset_m, y_offset_m, z_offset_m,
+ heading_offset_deg, pitch_offset_deg,
+ roll_offset_deg, fov_deg, 0, 0, 0, near_m ));
}
copyToCurrent();
}
+void
+FGViewMgr::reinit ()
+{
+ char stridx [ 20 ];
+ string viewpath, nodepath, strdata;
+ double fov_deg;
+
+ // reset offsets and fov to configuration defaults
+
+ for (int i = 0; i < fgGetInt("/sim/number-views"); i++) {
+ viewpath = "/sim/view";
+ sprintf(stridx, "[%d]", i);
+ viewpath += stridx;
+
+ setView(i);
+
+ nodepath = viewpath;
+ nodepath += "/config/x-offset-m";
+ fgSetDouble("/sim/current-view/x-offset-m",fgGetDouble(nodepath.c_str()));
+
+ nodepath = viewpath;
+ nodepath += "/config/y-offset-m";
+ fgSetDouble("/sim/current-view/y-offset-m",fgGetDouble(nodepath.c_str()));
+
+ nodepath = viewpath;
+ nodepath += "/config/z-offset-m";
+ fgSetDouble("/sim/current-view/z-offset-m",fgGetDouble(nodepath.c_str()));
+
+ nodepath = viewpath;
+ nodepath += "/config/pitch-offset-deg";
+ fgSetDouble("/sim/current-view/pitch-offset-deg",
+ fgGetDouble(nodepath.c_str()));
+
+ nodepath = viewpath;
+ nodepath += "/config/heading-offset-deg";
+ fgSetDouble("/sim/current-view/heading-offset-deg",
+ fgGetDouble(nodepath.c_str()));
+
+ nodepath = viewpath;
+ nodepath += "/config/roll-offset-deg";
+ fgSetDouble("/sim/current-view/roll-offset-deg",
+ fgGetDouble(nodepath.c_str()));
+
+ nodepath = viewpath;
+ nodepath += "/config/default-field-of-view-deg";
+ fov_deg = fgGetDouble(nodepath.c_str());
+ if (fov_deg < 10.0) {
+ fov_deg = 55.0;
+ }
+ fgSetDouble("/sim/current-view/field-of-view",fov_deg);
+
+ // target offsets for lookat mode only...
+ nodepath = viewpath;
+ nodepath += "/config/target-x-offset-m";
+ fgSetDouble("/sim/current-view/target-x-offset-deg",
+ fgGetDouble(nodepath.c_str()));
+
+ nodepath = viewpath;
+ nodepath += "/config/target-y-offset-m";
+ fgSetDouble("/sim/current-view/target-y-offset-deg",
+ fgGetDouble(nodepath.c_str()));
+
+ nodepath = viewpath;
+ nodepath += "/config/target-z-offset-m";
+ fgSetDouble("/sim/current-view/target-z-offset-deg",
+ fgGetDouble(nodepath.c_str()));
+
+ }
+
+ setView(0);
+
+}
+
typedef double (FGViewMgr::*double_getter)() const;
void
{
// these are bound to the current view properties
fgTie("/sim/current-view/heading-offset-deg", this,
- &FGViewMgr::getViewOffset_deg, &FGViewMgr::setViewOffset_deg);
+ &FGViewMgr::getViewHeadingOffset_deg,
+ &FGViewMgr::setViewHeadingOffset_deg);
fgSetArchivable("/sim/current-view/heading-offset-deg");
fgTie("/sim/current-view/goal-heading-offset-deg", this,
- &FGViewMgr::getGoalViewOffset_deg, &FGViewMgr::setGoalViewOffset_deg);
+ &FGViewMgr::getViewGoalHeadingOffset_deg,
+ &FGViewMgr::setViewGoalHeadingOffset_deg);
fgSetArchivable("/sim/current-view/goal-heading-offset-deg");
fgTie("/sim/current-view/pitch-offset-deg", this,
- &FGViewMgr::getViewTilt_deg, &FGViewMgr::setViewTilt_deg);
+ &FGViewMgr::getViewPitchOffset_deg,
+ &FGViewMgr::setViewPitchOffset_deg);
fgSetArchivable("/sim/current-view/pitch-offset-deg");
fgTie("/sim/current-view/goal-pitch-offset-deg", this,
- &FGViewMgr::getGoalViewTilt_deg, &FGViewMgr::setGoalViewTilt_deg);
+ &FGViewMgr::getGoalViewPitchOffset_deg,
+ &FGViewMgr::setGoalViewPitchOffset_deg);
fgSetArchivable("/sim/current-view/goal-pitch-offset-deg");
+ fgTie("/sim/current-view/view-number", this,
+ &FGViewMgr::getView, &FGViewMgr::setView);
+ fgSetArchivable("/sim/current-view/view-number", FALSE);
+
fgTie("/sim/current-view/axes/long", this,
(double_getter)0, &FGViewMgr::setViewAxisLong);
+ fgSetArchivable("/sim/current-view/axes/long");
+
fgTie("/sim/current-view/axes/lat", this,
(double_getter)0, &FGViewMgr::setViewAxisLat);
+ fgSetArchivable("/sim/current-view/axes/lat");
fgTie("/sim/current-view/field-of-view", this,
&FGViewMgr::getFOV_deg, &FGViewMgr::setFOV_deg);
fgUntie("/sim/current-view/pitch-offset-deg");
fgUntie("/sim/current-view/goal-pitch-offset-deg");
fgUntie("/sim/field-of-view");
+ fgUntie("/sim/current-view/view-number");
fgUntie("/sim/current-view/axes/long");
fgUntie("/sim/current-view/axes/lat");
+ fgUntie("/sim/current-view/ground-level-nearplane-m");
}
void
sprintf(stridx, "[%d]", i);
viewpath += stridx;
-
FGViewer *loop_view = (FGViewer *)get_view( i );
// Set up view location and orientation
nodepath = viewpath;
nodepath += "/config/target-heading-deg-path";
heading_deg = fgGetDouble(fgGetString(nodepath.c_str()));
-
+
loop_view ->setTargetPosition(lon_deg, lat_deg, alt_ft);
loop_view->setTargetOrientation(roll_deg, pitch_deg, heading_deg);
} else {
loop_view->set_dirty();
}
}
- setPilotXOffset_m(fgGetDouble("/sim/current-view/x-offset-m"));
- setPilotYOffset_m(fgGetDouble("/sim/current-view/y-offset-m"));
- setPilotZOffset_m(fgGetDouble("/sim/current-view/z-offset-m"));
+
+ setViewXOffset_m(fgGetDouble("/sim/current-view/x-offset-m"));
+ setViewYOffset_m(fgGetDouble("/sim/current-view/y-offset-m"));
+ setViewZOffset_m(fgGetDouble("/sim/current-view/z-offset-m"));
+
+ setViewTargetXOffset_m(fgGetDouble("/sim/current-view/target-x-offset-m"));
+ setViewTargetYOffset_m(fgGetDouble("/sim/current-view/target-y-offset-m"));
+ setViewTargetZOffset_m(fgGetDouble("/sim/current-view/target-z-offset-m"));
// Update the current view
do_axes();
void
FGViewMgr::copyToCurrent()
{
- fgSetDouble("/sim/current-view/x-offset-m", getPilotXOffset_m());
- fgSetDouble("/sim/current-view/y-offset-m", getPilotYOffset_m());
- fgSetDouble("/sim/current-view/z-offset-m", getPilotZOffset_m());
+ char stridx [20];
+ string viewpath, nodepath;
+
+ int i = current;
+ viewpath = "/sim/view";
+ sprintf(stridx, "[%d]", i);
+ viewpath += stridx;
+
+ // copy certain view config data for default values
+ nodepath = viewpath;
+ nodepath += "/config/default-heading-offset-deg";
+ fgSetDouble("/sim/current-view/config/heading-offset-deg",
+ fgGetDouble(nodepath.c_str()));
+
+ nodepath = viewpath;
+ nodepath += "/config/pitch-offset-deg";
+ fgSetDouble("/sim/current-view/config/pitch-offset-deg",
+ fgGetDouble(nodepath.c_str()));
+
+ nodepath = viewpath;
+ nodepath += "/config/roll-offset-deg";
+ fgSetDouble("/sim/current-view/config/roll-offset-deg",
+ fgGetDouble(nodepath.c_str()));
+
+ nodepath = viewpath;
+ nodepath += "/config/default-field-of-view-deg";
+ fgSetDouble("/sim/current-view/config/default-field-of-view-deg",
+ fgGetDouble(nodepath.c_str()));
+
+ // copy view data
+ fgSetDouble("/sim/current-view/x-offset-m", getViewXOffset_m());
+ fgSetDouble("/sim/current-view/y-offset-m", getViewYOffset_m());
+ fgSetDouble("/sim/current-view/z-offset-m", getViewZOffset_m());
+ fgSetDouble("/sim/current-view/goal-heading-offset-deg",
+ get_current_view()->getGoalHeadingOffset_deg());
+ fgSetDouble("/sim/current-view/goal-pitch-offset-deg",
+ get_current_view()->getGoalPitchOffset_deg());
+ fgSetDouble("/sim/current-view/goal-roll-offset-deg",
+ get_current_view()->getRollOffset_deg());
+ fgSetDouble("/sim/current-view/heading-offset-deg",
+ get_current_view()->getHeadingOffset_deg());
+ fgSetDouble("/sim/current-view/pitch-offset-deg",
+ get_current_view()->getPitchOffset_deg());
+ fgSetDouble("/sim/current-view/roll-offset-deg",
+ get_current_view()->getRollOffset_deg());
+ fgSetDouble("/sim/current-view/target-x-offset-m",
+ get_current_view()->getTargetXOffset_m());
+ fgSetDouble("/sim/current-view/target-y-offset-m",
+ get_current_view()->getTargetYOffset_m());
+ fgSetDouble("/sim/current-view/target-z-offset-m",
+ get_current_view()->getTargetZOffset_m());
}
double
-FGViewMgr::getViewOffset_deg () const
+FGViewMgr::getViewHeadingOffset_deg () const
{
const FGViewer * view = get_current_view();
return (view == 0 ? 0 : view->getHeadingOffset_deg());
}
void
-FGViewMgr::setViewOffset_deg (double offset)
+FGViewMgr::setViewHeadingOffset_deg (double offset)
{
FGViewer * view = get_current_view();
if (view != 0) {
}
double
-FGViewMgr::getGoalViewOffset_deg () const
+FGViewMgr::getViewGoalHeadingOffset_deg () const
{
const FGViewer * view = get_current_view();
return (view == 0 ? 0 : view->getGoalHeadingOffset_deg());
}
void
-FGViewMgr::setGoalViewOffset_deg (double offset)
+FGViewMgr::setViewGoalHeadingOffset_deg (double offset)
{
FGViewer * view = get_current_view();
if (view != 0)
}
double
-FGViewMgr::getViewTilt_deg () const
+FGViewMgr::getViewPitchOffset_deg () const
{
const FGViewer * view = get_current_view();
return (view == 0 ? 0 : view->getPitchOffset_deg());
}
void
-FGViewMgr::setViewTilt_deg (double tilt)
+FGViewMgr::setViewPitchOffset_deg (double tilt)
{
FGViewer * view = get_current_view();
if (view != 0) {
}
double
-FGViewMgr::getGoalViewTilt_deg () const
+FGViewMgr::getGoalViewPitchOffset_deg () const
{
const FGViewer * view = get_current_view();
return (view == 0 ? 0 : view->getGoalPitchOffset_deg());
}
void
-FGViewMgr::setGoalViewTilt_deg (double tilt)
+FGViewMgr::setGoalViewPitchOffset_deg (double tilt)
{
FGViewer * view = get_current_view();
if (view != 0)
}
double
-FGViewMgr::getPilotXOffset_m () const
+FGViewMgr::getViewXOffset_m () const
{
const FGViewer * view = get_current_view();
if (view != 0) {
}
void
-FGViewMgr::setPilotXOffset_m (double x)
+FGViewMgr::setViewXOffset_m (double x)
{
FGViewer * view = get_current_view();
if (view != 0) {
}
double
-FGViewMgr::getPilotYOffset_m () const
+FGViewMgr::getViewYOffset_m () const
{
const FGViewer * view = get_current_view();
if (view != 0) {
}
void
-FGViewMgr::setPilotYOffset_m (double y)
+FGViewMgr::setViewYOffset_m (double y)
{
FGViewer * view = get_current_view();
if (view != 0) {
}
double
-FGViewMgr::getPilotZOffset_m () const
+FGViewMgr::getViewZOffset_m () const
{
const FGViewer * view = get_current_view();
if (view != 0) {
}
void
-FGViewMgr::setPilotZOffset_m (double z)
+FGViewMgr::setViewZOffset_m (double z)
{
FGViewer * view = get_current_view();
if (view != 0) {
}
}
+double
+FGViewMgr::getViewTargetXOffset_m () const
+{
+ const FGViewer * view = get_current_view();
+ if (view != 0) {
+ return ((FGViewer *)view)->getTargetXOffset_m();
+ } else {
+ return 0;
+ }
+}
+
+void
+FGViewMgr::setViewTargetXOffset_m (double x)
+{
+ FGViewer * view = get_current_view();
+ if (view != 0) {
+ view->setTargetXOffset_m(x);
+ }
+}
+
+double
+FGViewMgr::getViewTargetYOffset_m () const
+{
+ const FGViewer * view = get_current_view();
+ if (view != 0) {
+ return ((FGViewer *)view)->getTargetYOffset_m();
+ } else {
+ return 0;
+ }
+}
+
+void
+FGViewMgr::setViewTargetYOffset_m (double y)
+{
+ FGViewer * view = get_current_view();
+ if (view != 0) {
+ view->setTargetYOffset_m(y);
+ }
+}
+
+double
+FGViewMgr::getViewTargetZOffset_m () const
+{
+ const FGViewer * view = get_current_view();
+ if (view != 0) {
+ return ((FGViewer *)view)->getTargetZOffset_m();
+ } else {
+ return 0;
+ }
+}
+
+void
+FGViewMgr::setViewTargetZOffset_m (double z)
+{
+ FGViewer * view = get_current_view();
+ if (view != 0) {
+ view->setTargetZOffset_m(z);
+ }
+}
+
+int
+FGViewMgr::getView () const
+{
+ return ( current );
+}
+
+void
+FGViewMgr::setView (int newview )
+{
+ if ( newview < 0 || newview > (int)views.size() ) {
+ newview = 0;
+ }
+ // set new view
+ set_view( newview );
+ // copy in view data
+ copyToCurrent ();
+}
+
+
double
FGViewMgr::getFOV_deg () const
{