props->tie("radar/x-shift", SGRawValuePointer<double>(&x_shift));
props->tie("radar/y-shift", SGRawValuePointer<double>(&y_shift));
props->tie("radar/rotation", SGRawValuePointer<double>(&rotation));
+ props->tie("radar/ht-diff-ft", SGRawValuePointer<double>(&ht_diff));
props->tie("controls/lighting/nav-lights",
SGRawValueFunctions<bool>(_isNight));
props->untie("radar/x-shift");
props->untie("radar/y-shift");
props->untie("radar/rotation");
+ props->untie("radar/ht-diff-ft");
props->untie("controls/lighting/nav-lights");
}
if (horiz_offset < -180.0) horiz_offset += 360.0;
// calculate elevation to target
- elevation = atan2( altitude * SG_METER_TO_FEET - user_altitude, range_ft )
- * SG_RADIANS_TO_DEGREES;
+ elevation = atan2( altitude - user_altitude, range_ft ) * SG_RADIANS_TO_DEGREES;
// calculate look up/down to target
- vert_offset = elevation + user_pitch;
+ vert_offset = elevation - user_pitch;
/* this calculation needs to be fixed, but it isn't important anyway
// calculate range rate
x_shift = range * sin( horiz_offset * SG_DEGREES_TO_RADIANS);
rotation = hdg - user_heading;
if (rotation < 0.0) rotation += 360.0;
+ ht_diff = altitude - user_altitude;
}
double x_shift; // value used by radar display instrument
double y_shift; // value used by radar display instrument
double rotation; // value used by radar display instrument
-
+ double ht_diff; // value used by radar display instrument
string model_path; //Path to the 3D model
ssgSharedPtr<ssgBranch> model; //The 3D model object
_yaw_node = fgGetNode("/orientation/side-slip-deg", true);
_serviceable_node = node->getChild("serviceable", 0, true);
_electrical_node = fgGetNode("/systems/electrical/outputs/tacan", true);
+ _ident_node = node->getChild("ident", 0, true);
SGPropertyNode *fnode = node->getChild("frequencies", 0, true);
_source_node = fnode->getChild("source", 0, true);
_frequency_node = fnode->getChild("selected-mhz", 0, true);
_transmitter_bias = _mobile_bias;
_transmitter_name = _mobile_name;
_name_node->setStringValue(_transmitter_name.c_str());
+ _transmitter_ident = _mobile_ident;
+ _ident_node->setStringValue(_transmitter_ident.c_str());
_channel_node->setStringValue(_channel.c_str());
}
_rotation_node->setDoubleValue(0);
_transmitter_name = "";
_name_node->setStringValue(_transmitter_name.c_str());
+ _transmitter_ident = "";
+ _ident_node->setStringValue(_transmitter_ident.c_str());
_channel_node->setStringValue(_channel.c_str());
return;
}
_mobile_range_nm = mobile_tacan->get_range();
_mobile_bias = mobile_tacan->get_multiuse();
_mobile_name = mobile_tacan->get_name();
+ _mobile_ident = mobile_tacan->get_trans_ident();
_mobile_valid = true;
SG_LOG( SG_INSTR, SG_DEBUG, " carrier transmitter valid " << _mobile_valid );
break;
_mobile_range_nm = mobile_tacan->get_range();
_mobile_bias = mobile_tacan->get_multiuse();
_mobile_name = mobile_tacan->get_name();
+ _mobile_ident = mobile_tacan->get_trans_ident();
_mobile_valid = true;
SG_LOG( SG_INSTR, SG_DEBUG, " tanker transmitter valid " << _mobile_valid );
break;
_mobile_range_nm = mobile_tacan->get_range();
_mobile_bias = mobile_tacan->get_multiuse();
_mobile_name = mobile_tacan->get_name();
+ _mobile_ident = mobile_tacan->get_trans_ident();
_mobile_valid = true;
SG_LOG( SG_INSTR, SG_DEBUG, " mp tanker transmitter valid " << _mobile_valid );
_transmitter_bias = tacan->get_multiuse();
_transmitter_name = tacan->get_name();
_name_node->setStringValue(_transmitter_name.c_str());
+ _transmitter_ident = tacan->get_trans_ident();
+ _ident_node->setStringValue(_transmitter_ident.c_str());
SG_LOG( SG_INSTR, SG_DEBUG, "name " << _transmitter_name);
SG_LOG( SG_INSTR, SG_DEBUG, "lat " << _transmitter_lat << "lon " << _transmitter_lon);
SGPropertyNode_ptr _x_shift_node;
SGPropertyNode_ptr _y_shift_node;
SGPropertyNode_ptr _rotation_node;
+ /*SGPropertyNode_ptr _x_shift_calibration_node;
+ SGPropertyNode_ptr _y_shift_calibration_node;
+ SGPropertyNode_ptr _distance_calibration_node;*/
SGPropertyNode_ptr _in_range_node;
SGPropertyNode_ptr _distance_node;
double _transmitter_bearing_deg;
double _transmitter_bias;
string _transmitter_name;
+ string _transmitter_ident;
double _mobile_lat, _mobile_lon;
double _mobile_elevation_ft;
double _mobile_bearing_deg;
double _mobile_bias;
string _mobile_name;
+ string _mobile_ident;
string name;
int num;
// find something interesting to do...
} else {
string display_mode = _Instrument->getStringValue("display-mode", "arc");
+
// pretend we have a scan angle bigger then the FOV
// TODO:check real fov, enlarge if < nn, and do clipping if > mm
const float fovFactor = 1.45f;
// float view_heading = get_track() * SG_DEGREES_TO_RADIANS;
} else if( display_mode == "plan" ) {
// no sense I presume
- float view_heading = 0.0;
+ view_heading = 0;
} else {
// rose
}
---------
*/
float yOffset = 180.0f, xOffset = 256.0f;
+
if( display_mode != "arc" ) {
yOffset = 40.0f;
xOffset = 240.0f;
}
+
+ if ( display_mode != "plan" ) {
glDisable(GL_BLEND);
glColor4f(1.0f, 0.0f, 0.0f, 0.01f);
glBegin( GL_QUADS );
glBegin( GL_TRIANGLES );
glVertex2f(0.0, 0.0);
glVertex2f(-256.0, 0.0);
- glVertex2f(-256.0, 256.0);
+ glVertex2f(-256.0, 256.0 * tan(30*SG_DEGREES_TO_RADIANS));
glVertex2f(0.0, 0.0);
glVertex2f(256.0, 0.0);
- glVertex2f(256.0, 256.0);
+ glVertex2f(256.0, 256.0 * tan(30*SG_DEGREES_TO_RADIANS));
glVertex2f(-256, 0.0);
glVertex2f(256.0, 0.0);
glVertex2f(256.0, -256.0);
glVertex2f(-256.0, -256.0);
glEnd();
+ }
// DEBUG only
/* glColor4f(1.0f, 0.0f, 0.0f, 1.0f);