1
0
Fork 0

Added support for generating SSALS, SSALF, and SSALR approach lighting schemes.

This commit is contained in:
curt 2002-10-18 02:55:41 +00:00
parent e58523db01
commit c2f620744a

View file

@ -894,7 +894,7 @@ static FGSuperPoly gen_reil( const FGRunway& rwy_info, float alt_m,
}
// generate touch down zone lights
// generate ALSF-II approach lighting scheme
static superpoly_list gen_alsf_ii( const FGRunway& rwy_info,
float alt_m, bool recip )
{
@ -1229,6 +1229,269 @@ static superpoly_list gen_alsf_ii( const FGRunway& rwy_info,
}
// generate SSALS, SSALF, and SSALR approach lighting scheme (kind =
// S, F, or R)
static superpoly_list gen_ssalx( const FGRunway& rwy_info,
float alt_m, const string& kind, bool recip )
{
point_list g_lights; g_lights.clear();
point_list w_lights; w_lights.clear();
point_list r_lights; r_lights.clear();
point_list s_lights; s_lights.clear();
point_list g_normals; g_normals.clear();
point_list w_normals; w_normals.clear();
point_list r_normals; r_normals.clear();
point_list s_normals; s_normals.clear();
int i, j;
cout << "gen SSALx lights " << rwy_info.rwy_no << endl;
Point3D normal = gen_runway_light_vector( rwy_info, 3.0, recip );
// Generate the threshold lights
double len = rwy_info.length * SG_FEET_TO_METER;
int divs = (int)(len / 10.0) + 1;
// using FGPolygon is a bit innefficient, but that's what the
// routine returns.
FGPolygon poly_corners = gen_runway_area_w_expand( rwy_info, 2.0, 2.0 );
point_list corner;
for ( i = 0; i < poly_corners.contour_size( 0 ); ++i ) {
corner.push_back( poly_corners.get_pt( 0, i ) );
}
Point3D inc1, inc2;
Point3D pt1, pt2;
if ( recip ) {
inc1 = (corner[0] - corner[1]) / divs;
inc2 = (corner[3] - corner[2]) / divs;
pt1 = corner[1];
pt2 = corner[2];
} else {
inc1 = (corner[2] - corner[3]) / divs;
inc2 = (corner[1] - corner[0]) / divs;
pt1 = corner[3];
pt2 = corner[0];
}
double dist = rwy_info.length;
double step = dist / divs;
g_lights.push_back( pt1 );
g_normals.push_back( normal );
r_lights.push_back( pt2 );
r_normals.push_back( normal );
dist -= step;
for ( i = 0; i < divs; ++i ) {
pt1 += inc1;
pt2 += inc2;
g_lights.push_back( pt1 );
g_normals.push_back( normal );
r_lights.push_back( pt2 );
r_normals.push_back( normal );
dist -= step;
}
// Generate long center bar of lights (every 200')
// determine the start point.
Point3D ref_save;
double length_hdg, left_hdg;
double lon, lat, r;
if ( recip ) {
ref_save = (corner[0] + corner[1]) / 2;
length_hdg = rwy_info.heading + 180.0;
if ( length_hdg > 360.0 ) { length_hdg -= 360.0; }
} else {
ref_save = (corner[2] + corner[3]) / 2;
length_hdg = rwy_info.heading;
}
left_hdg = length_hdg - 90.0;
if ( left_hdg < 0 ) { left_hdg += 360.0; }
cout << "length hdg = " << length_hdg
<< " left heading = " << left_hdg << endl;
Point3D ref = ref_save;
for ( i = 0; i < 7; ++i ) {
// offset 200' downwind
geo_direct_wgs_84 ( alt_m, ref.lat(), ref.lon(), length_hdg,
-200 * SG_FEET_TO_METER, &lat, &lon, &r );
ref = Point3D( lon, lat, 0.0 );
pt1 = ref;
w_lights.push_back( pt1 );
w_normals.push_back( normal );
// left 2 side lights
geo_direct_wgs_84 ( alt_m, pt1.lat(), pt1.lon(), left_hdg,
3.5 * SG_FEET_TO_METER, &lat, &lon, &r );
pt1 = Point3D( lon, lat, 0.0 );
w_lights.push_back( pt1 );
w_normals.push_back( normal );
geo_direct_wgs_84 ( alt_m, pt1.lat(), pt1.lon(), left_hdg,
3.5 * SG_FEET_TO_METER, &lat, &lon, &r );
pt1 = Point3D( lon, lat, 0.0 );
w_lights.push_back( pt1 );
w_normals.push_back( normal );
pt1 = ref;
// right 2 side lights
geo_direct_wgs_84 ( alt_m, pt1.lat(), pt1.lon(), left_hdg,
-3.5 * SG_FEET_TO_METER, &lat, &lon, &r );
pt1 = Point3D( lon, lat, 0.0 );
w_lights.push_back( pt1 );
w_normals.push_back( normal );
geo_direct_wgs_84 ( alt_m, pt1.lat(), pt1.lon(), left_hdg,
-3.5 * SG_FEET_TO_METER, &lat, &lon, &r );
pt1 = Point3D( lon, lat, 0.0 );
w_lights.push_back( pt1 );
w_normals.push_back( normal );
}
// Generate -1000' extra horizontal row of lights
ref = ref_save;
// offset 1000' downwind
geo_direct_wgs_84 ( alt_m, ref.lat(), ref.lon(), length_hdg,
-1000 * SG_FEET_TO_METER, &lat, &lon, &r );
ref = Point3D( lon, lat, 0.0 );
pt1 = ref;
// left 5 side lights
geo_direct_wgs_84 ( alt_m, pt1.lat(), pt1.lon(), left_hdg,
15 * SG_FEET_TO_METER, &lat, &lon, &r );
pt1 = Point3D( lon, lat, 0.0 );
w_lights.push_back( pt1 );
w_normals.push_back( normal );
for ( j = 0; j < 4; ++j ) {
geo_direct_wgs_84 ( alt_m, pt1.lat(), pt1.lon(), left_hdg,
5 * SG_FEET_TO_METER, &lat, &lon, &r );
pt1 = Point3D( lon, lat, 0.0 );
w_lights.push_back( pt1 );
w_normals.push_back( normal );
}
pt1 = ref;
// right 5 side lights
geo_direct_wgs_84 ( alt_m, pt1.lat(), pt1.lon(), left_hdg,
-15 * SG_FEET_TO_METER, &lat, &lon, &r );
pt1 = Point3D( lon, lat, 0.0 );
w_lights.push_back( pt1 );
w_normals.push_back( normal );
for ( j = 0; j < 4; ++j ) {
geo_direct_wgs_84 ( alt_m, pt1.lat(), pt1.lon(), left_hdg,
-5 * SG_FEET_TO_METER, &lat, &lon, &r );
pt1 = Point3D( lon, lat, 0.0 );
w_lights.push_back( pt1 );
w_normals.push_back( normal );
}
if ( kind == "R" ) {
// generate 8 rabbit lights
ref = ref_save;
// start 1600' downwind
geo_direct_wgs_84 ( alt_m, ref.lat(), ref.lon(), length_hdg,
-1600 * SG_FEET_TO_METER, &lat, &lon, &r );
ref = Point3D( lon, lat, 0.0 );
for ( i = 0; i < 8; ++i ) {
s_lights.push_back( ref );
s_normals.push_back( normal );
// offset 200' downwind
geo_direct_wgs_84 ( alt_m, ref.lat(), ref.lon(), length_hdg,
-200 * SG_FEET_TO_METER, &lat, &lon, &r );
ref = Point3D( lon, lat, 0.0 );
}
} else if ( kind == "F" ) {
// generate 3 sequenced lights aligned with last 3 light bars
ref = ref_save;
// start 1010' downwind
geo_direct_wgs_84 ( alt_m, ref.lat(), ref.lon(), length_hdg,
-1010 * SG_FEET_TO_METER, &lat, &lon, &r );
ref = Point3D( lon, lat, 0.0 );
for ( i = 0; i < 3; ++i ) {
s_lights.push_back( ref );
s_normals.push_back( normal );
// offset 200' downwind
geo_direct_wgs_84 ( alt_m, ref.lat(), ref.lon(), length_hdg,
-200 * SG_FEET_TO_METER, &lat, &lon, &r );
ref = Point3D( lon, lat, 0.0 );
}
}
FGPolygon lights_poly; lights_poly.erase();
FGPolygon normals_poly; normals_poly.erase();
lights_poly.add_contour( g_lights, false );
normals_poly.add_contour( g_normals, false );
FGSuperPoly green;
green.set_poly( lights_poly );
green.set_normals( normals_poly );
green.set_material( "RWY_GREEN_LIGHTS" );
lights_poly.erase();
normals_poly.erase();
lights_poly.add_contour( r_lights, false );
normals_poly.add_contour( r_normals, false );
FGSuperPoly red;
red.set_poly( lights_poly );
red.set_normals( normals_poly );
red.set_material( "RWY_RED_LIGHTS" );
lights_poly.erase();
normals_poly.erase();
lights_poly.add_contour( w_lights, false );
normals_poly.add_contour( w_normals, false );
FGSuperPoly white;
white.set_poly( lights_poly );
white.set_normals( normals_poly );
white.set_material( "RWY_WHITE_LIGHTS" );
superpoly_list result; result.clear();
result.push_back( green );
result.push_back( red );
result.push_back( white );
if ( s_lights.size() > 0 ) {
lights_poly.erase();
normals_poly.erase();
lights_poly.add_contour( s_lights, false );
normals_poly.add_contour( s_normals, false );
FGSuperPoly sequenced;
sequenced.set_poly( lights_poly );
sequenced.set_normals( normals_poly );
sequenced.set_material( "RWY_SEQUENCED_LIGHTS" );
result.push_back( sequenced );
}
return result;
}
// top level runway light generator
void gen_runway_lights( const FGRunway& rwy_info, float alt_m,
superpoly_list &lights ) {
@ -1327,6 +1590,48 @@ void gen_runway_lights( const FGRunway& rwy_info, float alt_m,
}
}
// SSALS
if ( rwy_info.end1_flags.substr(3,1) == "S" ) {
superpoly_list s = gen_ssalx( rwy_info, alt_m, "S", false );
for ( i = 0; i < s.size(); ++i ) {
lights.push_back( s[i] );
}
}
if ( rwy_info.end2_flags.substr(3,1) == "S" ) {
superpoly_list s = gen_ssalx( rwy_info, alt_m, "S", true );
for ( i = 0; i < s.size(); ++i ) {
lights.push_back( s[i] );
}
}
// SSALF
if ( rwy_info.end1_flags.substr(3,1) == "Q" ) {
superpoly_list s = gen_ssalx( rwy_info, alt_m, "F", false );
for ( i = 0; i < s.size(); ++i ) {
lights.push_back( s[i] );
}
}
if ( rwy_info.end2_flags.substr(3,1) == "Q" ) {
superpoly_list s = gen_ssalx( rwy_info, alt_m, "F", true );
for ( i = 0; i < s.size(); ++i ) {
lights.push_back( s[i] );
}
}
// SSALR
if ( rwy_info.end1_flags.substr(3,1) == "R" ) {
superpoly_list s = gen_ssalx( rwy_info, alt_m, "R", false );
for ( i = 0; i < s.size(); ++i ) {
lights.push_back( s[i] );
}
}
if ( rwy_info.end2_flags.substr(3,1) == "R" ) {
superpoly_list s = gen_ssalx( rwy_info, alt_m, "R", true );
for ( i = 0; i < s.size(); ++i ) {
lights.push_back( s[i] );
}
}
// Many aproach lighting systems define the threshold lighting
// needed, but for those that don't (i.e. REIL) make threshold
// lighting