1
0
Fork 0

Airport lighting arrangement now factors in displaced thresholds.

This commit is contained in:
curt 2004-04-06 16:01:10 +00:00
parent 4d3cbc5f55
commit c75fa83c15
8 changed files with 271 additions and 235 deletions

View file

@ -221,10 +221,15 @@ TGAptSurface::TGAptSurface( const string& path,
double accum = 0.0; double accum = 0.0;
for ( int ii = 0; ii < mult; ++ii ) { for ( int ii = 0; ii < mult; ++ii ) {
for ( int jj = 0; jj < mult; ++jj ) { for ( int jj = 0; jj < mult; ++jj ) {
double value = dPts(mult*(i+1) - (mult/2) + ii,
mult*(j+1) - (mult/2) + jj).z();
SG_LOG( SG_GENERAL, SG_DEBUG, "value = " << value );
accum += dPts(mult*(i+1) - (mult/2) + ii, accum += dPts(mult*(i+1) - (mult/2) + ii,
mult*(j+1) - (mult/2) + jj).z(); mult*(j+1) - (mult/2) + jj).z();
} }
} }
SG_LOG( SG_GENERAL, SG_DEBUG,
" average = " << accum / (mult*mult) );
Pts(i,j) = Point3Df( min_deg.lon() + i * dlon, Pts(i,j) = Point3Df( min_deg.lon() + i * dlon,
min_deg.lat() + j * dlat, min_deg.lat() + j * dlat,
accum / (mult*mult) ); accum / (mult*mult) );

View file

@ -316,13 +316,15 @@ static void build_runway( const TGRunway& rwy_info,
TGPolygon base, safe_base; TGPolygon base, safe_base;
if ( rwy_info.really_taxiway ) { if ( rwy_info.really_taxiway ) {
base = gen_runway_area_w_extend( rwy_info, 0.0, 10.0, 10.0 ); base = gen_runway_area_w_extend( rwy_info, 0.0, 10.0, 0.0, 0.0, 10.0 );
// also clear a safe area around the taxiway // also clear a safe area around the taxiway
safe_base = gen_runway_area_w_extend( rwy_info, 0.0, 40.0, 40.0 ); safe_base
= gen_runway_area_w_extend( rwy_info, 0.0, 40.0, 0.0, 0.0, 40.0 );
} else { } else {
base = gen_runway_area_w_extend( rwy_info, 0.0, 20.0, 20.0 ); base = gen_runway_area_w_extend( rwy_info, 0.0, 20.0, 0.0, 0.0, 20.0 );
// also clear a safe area around the runway // also clear a safe area around the runway
safe_base = gen_runway_area_w_extend( rwy_info, 0.0, 180.0, 50.0 ); safe_base
= gen_runway_area_w_extend( rwy_info, 0.0, 180.0, 0.0, 0.0, 50.0 );
} }
*apt_clearing = polygon_union(safe_base, *apt_clearing); *apt_clearing = polygon_union(safe_base, *apt_clearing);
@ -436,10 +438,10 @@ void build_airport( string airport_id, float alt_m,
} }
SGBucket b( apt_lon / (double)rwy_count, apt_lat / (double)rwy_count ); SGBucket b( apt_lon / (double)rwy_count, apt_lat / (double)rwy_count );
Point3D center_geod( b.get_center_lon() * SGD_DEGREES_TO_RADIANS,
b.get_center_lat() * SGD_DEGREES_TO_RADIANS, 0 );
Point3D gbs_center = sgGeodToCart( center_geod );
SG_LOG(SG_GENERAL, SG_INFO, b.gen_base_path() << "/" << b.gen_index_str()); SG_LOG(SG_GENERAL, SG_INFO, b.gen_base_path() << "/" << b.gen_index_str());
Point3D center_geod( b.get_center_lon() * SGD_DEGREES_TO_RADIANS,
b.get_center_lat() * SGD_DEGREES_TO_RADIANS, 0 );
Point3D gbs_center = sgGeodToCart( center_geod );
// parse taxiways and generate the vertex list // parse taxiways and generate the vertex list
runway_list taxiways; runway_list taxiways;
@ -1140,10 +1142,17 @@ void build_airport( string airport_id, float alt_m,
p.setx( geod_nodes[i].x() * SGD_DEGREES_TO_RADIANS ); p.setx( geod_nodes[i].x() * SGD_DEGREES_TO_RADIANS );
p.sety( geod_nodes[i].y() * SGD_DEGREES_TO_RADIANS ); p.sety( geod_nodes[i].y() * SGD_DEGREES_TO_RADIANS );
p.setz( geod_nodes[i].z() ); p.setz( geod_nodes[i].z() );
wgs84_nodes.push_back( sgGeodToCart( p ) ); SG_LOG(SG_GENERAL, SG_DEBUG, "geod pt = " << geod_nodes[i] );
Point3D cart = sgGeodToCart( p );
SG_LOG(SG_GENERAL, SG_DEBUG, " cart pt = " << cart );
Point3D geod = sgCartToGeod( cart );
SG_LOG(SG_GENERAL, SG_DEBUG, " remapped goed pt = " << geod );
wgs84_nodes.push_back( cart );
} }
float gbs_radius = sgCalcBoundingRadius( gbs_center, wgs84_nodes ); float gbs_radius = sgCalcBoundingRadius( gbs_center, wgs84_nodes );
SG_LOG(SG_GENERAL, SG_DEBUG, "Done with wgs84 node mapping"); SG_LOG(SG_GENERAL, SG_DEBUG, "Done with wgs84 node mapping");
SG_LOG(SG_GENERAL, SG_DEBUG, " center = " << gbs_center
<< " radius = " << gbs_radius );
// null structures // null structures
group_list fans_v; fans_v.clear(); group_list fans_v; fans_v.clear();

View file

@ -44,7 +44,8 @@ static Point3D gen_runway_light_vector( const TGRunway& rwy_info,
double length; double length;
// Generate the 4 corners of the runway // Generate the 4 corners of the runway
TGPolygon poly_corners = gen_runway_area_w_extend( rwy_info, 0.0, 0.0, 0.0 ); TGPolygon poly_corners
= gen_runway_area_w_extend( rwy_info, 0.0, 0.0, 0.0, 0.0, 0.0 );
point_list corner; point_list corner;
for ( int i = 0; i < poly_corners.contour_size( 0 ); ++i ) { for ( int i = 0; i < poly_corners.contour_size( 0 ); ++i ) {
corner.push_back( poly_corners.get_pt( 0, i ) ); corner.push_back( poly_corners.get_pt( 0, i ) );
@ -99,7 +100,11 @@ static superpoly_list gen_runway_edge_lights( const TGRunway& rwy_info,
// using TGPolygon is a bit innefficient, but that's what the // using TGPolygon is a bit innefficient, but that's what the
// routine returns. // routine returns.
TGPolygon poly_corners = gen_runway_area_w_extend( rwy_info, 0.0, 2.0, 2.0 ); TGPolygon poly_corners
= gen_runway_area_w_extend( rwy_info, 0.0, 2.0,
rwy_info.disp_thresh1 * SG_FEET_TO_METER,
rwy_info.disp_thresh2 * SG_FEET_TO_METER,
2.0 );
point_list corner; point_list corner;
for ( i = 0; i < poly_corners.contour_size( 0 ); ++i ) { for ( i = 0; i < poly_corners.contour_size( 0 ); ++i ) {
@ -209,7 +214,8 @@ static superpoly_list gen_taxiway_edge_lights( const TGRunway& rwy_info,
// using TGPolygon is a bit innefficient, but that's what the // using TGPolygon is a bit innefficient, but that's what the
// routine returns. // routine returns.
TGPolygon poly_corners = gen_runway_area_w_extend( rwy_info, 0.0, 2.0, 2.0 ); TGPolygon poly_corners
= gen_runway_area_w_extend( rwy_info, 0.0, 2.0, 0.0, 0.0, 2.0 );
point_list corner; point_list corner;
for ( i = 0; i < poly_corners.contour_size( 0 ); ++i ) { for ( i = 0; i < poly_corners.contour_size( 0 ); ++i ) {
@ -286,7 +292,11 @@ static superpoly_list gen_runway_threshold_lights( const TGRunway& rwy_info,
// using TGPolygon is a bit innefficient, but that's what the // using TGPolygon is a bit innefficient, but that's what the
// routine returns. // routine returns.
TGPolygon poly_corners = gen_runway_area_w_extend( rwy_info, 0.0, 0.0, 0.0 ); TGPolygon poly_corners
= gen_runway_area_w_extend( rwy_info, 0.0, 0.0,
rwy_info.disp_thresh1 * SG_FEET_TO_METER,
rwy_info.disp_thresh2 * SG_FEET_TO_METER,
0.0 );
point_list corner; point_list corner;
for ( i = 0; i < poly_corners.contour_size( 0 ); ++i ) { for ( i = 0; i < poly_corners.contour_size( 0 ); ++i ) {
@ -418,7 +428,11 @@ static superpoly_list gen_runway_center_line_lights( const TGRunway& rwy_info,
// using TGPolygon is a bit innefficient, but that's what the // using TGPolygon is a bit innefficient, but that's what the
// routine returns. // routine returns.
TGPolygon poly_corners = gen_runway_area_w_extend( rwy_info, 0.0, 2.0, 2.0 ); TGPolygon poly_corners
= gen_runway_area_w_extend( rwy_info, 0.0, 2.0,
rwy_info.disp_thresh1 * SG_FEET_TO_METER,
rwy_info.disp_thresh2 * SG_FEET_TO_METER,
2.0 );
point_list corner; point_list corner;
for ( i = 0; i < poly_corners.contour_size( 0 ); ++i ) { for ( i = 0; i < poly_corners.contour_size( 0 ); ++i ) {
@ -516,7 +530,8 @@ static superpoly_list gen_taxiway_center_line_lights( const TGRunway& rwy_info,
// using TGPolygon is a bit innefficient, but that's what the // using TGPolygon is a bit innefficient, but that's what the
// routine returns. // routine returns.
TGPolygon poly_corners = gen_runway_area_w_extend( rwy_info, 0.0, 2.0, 2.0 ); TGPolygon poly_corners
= gen_runway_area_w_extend( rwy_info, 0.0, 2.0, 0.0, 0.0, 2.0 );
point_list corner; point_list corner;
for ( i = 0; i < poly_corners.contour_size( 0 ); ++i ) { for ( i = 0; i < poly_corners.contour_size( 0 ); ++i ) {
@ -584,7 +599,11 @@ static TGSuperPoly gen_touchdown_zone_lights( const TGRunway& rwy_info,
// using TGPolygon is a bit innefficient, but that's what the // using TGPolygon is a bit innefficient, but that's what the
// routine returns. // routine returns.
TGPolygon poly_corners = gen_runway_area_w_extend( rwy_info, 0.0, 0.0, 0.0 ); TGPolygon poly_corners
= gen_runway_area_w_extend( rwy_info, 0.0, 0.0,
rwy_info.disp_thresh1 * SG_FEET_TO_METER,
rwy_info.disp_thresh2 * SG_FEET_TO_METER,
0.0 );
point_list corner; point_list corner;
for ( i = 0; i < poly_corners.contour_size( 0 ); ++i ) { for ( i = 0; i < poly_corners.contour_size( 0 ); ++i ) {
@ -688,7 +707,11 @@ static TGSuperPoly gen_vasi( const TGRunway& rwy_info, float alt_m,
// using TGPolygon is a bit innefficient, but that's what the // using TGPolygon is a bit innefficient, but that's what the
// routine returns. // routine returns.
TGPolygon poly_corners = gen_runway_area_w_extend( rwy_info, 0.0, 0.0, 0.0 ); TGPolygon poly_corners
= gen_runway_area_w_extend( rwy_info, 0.0, 0.0,
rwy_info.disp_thresh1 * SG_FEET_TO_METER,
rwy_info.disp_thresh2 * SG_FEET_TO_METER,
0.0 );
point_list corner; point_list corner;
for ( i = 0; i < poly_corners.contour_size( 0 ); ++i ) { for ( i = 0; i < poly_corners.contour_size( 0 ); ++i ) {
@ -829,7 +852,11 @@ static TGSuperPoly gen_papi( const TGRunway& rwy_info, float alt_m,
// using TGPolygon is a bit innefficient, but that's what the // using TGPolygon is a bit innefficient, but that's what the
// routine returns. // routine returns.
TGPolygon poly_corners = gen_runway_area_w_extend( rwy_info, 0.0, 0.0, 0.0 ); TGPolygon poly_corners
= gen_runway_area_w_extend( rwy_info, 0.0, 0.0,
rwy_info.disp_thresh1 * SG_FEET_TO_METER,
rwy_info.disp_thresh2 * SG_FEET_TO_METER,
0.0 );
point_list corner; point_list corner;
for ( i = 0; i < poly_corners.contour_size( 0 ); ++i ) { for ( i = 0; i < poly_corners.contour_size( 0 ); ++i ) {
@ -925,7 +952,11 @@ static TGSuperPoly gen_reil( const TGRunway& rwy_info, float alt_m,
// using TGPolygon is a bit innefficient, but that's what the // using TGPolygon is a bit innefficient, but that's what the
// routine returns. // routine returns.
TGPolygon poly_corners = gen_runway_area_w_extend( rwy_info, 0.0, 0.0, 0.0 ); TGPolygon poly_corners
= gen_runway_area_w_extend( rwy_info, 0.0, 0.0,
rwy_info.disp_thresh1 * SG_FEET_TO_METER,
rwy_info.disp_thresh2 * SG_FEET_TO_METER,
0.0 );
point_list corner; point_list corner;
for ( i = 0; i < poly_corners.contour_size( 0 ); ++i ) { for ( i = 0; i < poly_corners.contour_size( 0 ); ++i ) {
@ -997,7 +1028,7 @@ static TGSuperPoly gen_reil( const TGRunway& rwy_info, float alt_m,
// generate Calvert-I/II approach lighting schemes // generate Calvert-I/II approach lighting schemes
static superpoly_list gen_calvert( const TGRunway& rwy_info, static superpoly_list gen_calvert( const TGRunway& rwy_info,
float alt_m, const string &kind, bool recip ) float alt_m, const string &kind, bool recip )
{ {
point_list g_lights; g_lights.clear(); point_list g_lights; g_lights.clear();
point_list w_lights; w_lights.clear(); point_list w_lights; w_lights.clear();
@ -1009,19 +1040,14 @@ static superpoly_list gen_calvert( const TGRunway& rwy_info,
point_list s_normals; s_normals.clear(); point_list s_normals; s_normals.clear();
int i, j; int i, j;
string flag; string flag;
if (kind == "1") if ( kind == "1" ) {
{ cout << "gen Calvert lights " << rwy_info.rwy_no << endl;
cout << "gen Calvert lights " << rwy_info.rwy_no << endl; } else if ( kind == "2" ) {
} else if (kind == "2")
{
cout << "gen Calvert/II lights " << rwy_info.rwy_no << endl; cout << "gen Calvert/II lights " << rwy_info.rwy_no << endl;
} else } else {
{
cout << "gen unknown Calvert lights " << rwy_info.rwy_no << endl; cout << "gen unknown Calvert lights " << rwy_info.rwy_no << endl;
} }
Point3D normal1 = gen_runway_light_vector( rwy_info, 3.0, recip ); Point3D normal1 = gen_runway_light_vector( rwy_info, 3.0, recip );
Point3D normal2 = gen_runway_light_vector( rwy_info, 3.0, !recip ); Point3D normal2 = gen_runway_light_vector( rwy_info, 3.0, !recip );
@ -1032,7 +1058,11 @@ static superpoly_list gen_calvert( const TGRunway& rwy_info,
// using TGPolygon is a bit innefficient, but that's what the // using TGPolygon is a bit innefficient, but that's what the
// routine returns. // routine returns.
TGPolygon poly_corners = gen_runway_area_w_extend( rwy_info, 0.0, 2.0, 2.0 ); TGPolygon poly_corners
= gen_runway_area_w_extend( rwy_info, 0.0, 2.0,
rwy_info.disp_thresh1 * SG_FEET_TO_METER,
rwy_info.disp_thresh2 * SG_FEET_TO_METER,
2.0 );
point_list corner; point_list corner;
for ( i = 0; i < poly_corners.contour_size( 0 ); ++i ) { for ( i = 0; i < poly_corners.contour_size( 0 ); ++i ) {
@ -1122,152 +1152,129 @@ static superpoly_list gen_calvert( const TGRunway& rwy_info,
-1 * CALVERT_HORIZ_SPACING, &lat, &lon, &r ); -1 * CALVERT_HORIZ_SPACING, &lat, &lon, &r );
pt = Point3D( lon, lat, 0.0 ); pt = Point3D( lon, lat, 0.0 );
if (kind == "1" ) if (kind == "1" ) {
{ if ( i >= 10 && i < 20 ) {
if (i >= 10 && i < 20) geo_direct_wgs_84 ( alt_m, pt.lat(), pt.lon(), left_hdg,
{ CALVERT_VERT_SPACING/2, &lat, &lon, &r );
pair = Point3D( lon, lat, 0.0 );
w_lights.push_back( pair );
geo_direct_wgs_84 ( alt_m, pt.lat(), pt.lon(), left_hdg, w_normals.push_back( normal1 );
CALVERT_VERT_SPACING/2, &lat, &lon, &r );
pair = Point3D( lon, lat, 0.0 );
w_lights.push_back( pair );
w_normals.push_back( normal1 );
geo_direct_wgs_84 ( alt_m, pt.lat(), pt.lon(), left_hdg, geo_direct_wgs_84 ( alt_m, pt.lat(), pt.lon(), left_hdg,
-1 * CALVERT_VERT_SPACING/2, &lat, &lon, &r ); -1 * CALVERT_VERT_SPACING/2, &lat, &lon,
pair = Point3D( lon, lat, 0.0 ); &r );
w_lights.push_back( pair ); pair = Point3D( lon, lat, 0.0 );
w_normals.push_back( normal1 ); w_lights.push_back( pair );
w_normals.push_back( normal1 );
} else if (i >= 20) {
w_lights.push_back( pt );
w_normals.push_back( normal1 );
geo_direct_wgs_84 ( alt_m, pt.lat(), pt.lon(), left_hdg,
CALVERT_VERT_SPACING, &lat, &lon, &r );
pair = Point3D( lon, lat, 0.0 );
w_lights.push_back( pair );
w_normals.push_back( normal1 );
} else if (i >= 20) geo_direct_wgs_84 ( alt_m, pt.lat(), pt.lon(), left_hdg,
{ -1 * CALVERT_VERT_SPACING, &lat, &lon, &r );
w_lights.push_back( pt ); pair = Point3D( lon, lat, 0.0 );
w_normals.push_back( normal1 ); w_lights.push_back( pair );
w_normals.push_back( normal1 );
geo_direct_wgs_84 ( alt_m, pt.lat(), pt.lon(), left_hdg, } else {
CALVERT_VERT_SPACING, &lat, &lon, &r ); w_lights.push_back( pt );
pair = Point3D( lon, lat, 0.0 ); w_normals.push_back( normal1 );
w_lights.push_back( pair ); }
w_normals.push_back( normal1 ); } else {
if ( i < 10 ) {
geo_direct_wgs_84 ( alt_m, pt.lat(), pt.lon(), left_hdg,
-1 * CALVERT_VERT_SPACING, &lat, &lon, &r );
pair = Point3D( lon, lat, 0.0 );
w_lights.push_back( pair );
w_normals.push_back( normal1 );
} else
{
w_lights.push_back( pt );
w_normals.push_back( normal1 );
}
} else
{
if (i < 10)
{
// cal2 has red centre lights // cal2 has red centre lights
r_lights.push_back( pt ); r_lights.push_back( pt );
r_normals.push_back( normal1 ); r_normals.push_back( normal1 );
} else } else {
{
// cal2 has red centre lights // cal2 has red centre lights
w_lights.push_back( pt ); w_lights.push_back( pt );
w_normals.push_back( normal1 ); w_normals.push_back( normal1 );
} }
} }
switch(i) switch ( i ) {
{
case 4: case 4:
crossbar[0] = pt; crossbar[0] = pt;
break; break;
case 9: case 9:
crossbar[1] = pt; crossbar[1] = pt;
break; break;
case 14: case 14:
crossbar[2] = pt; crossbar[2] = pt;
break; break;
case 19: case 19:
crossbar[3] = pt; crossbar[3] = pt;
break; break;
case 24: case 24:
crossbar[4] = pt; crossbar[4] = pt;
break; break;
} }
// add 2 more rows if CAL/II (white) // add 2 more rows if CAL/II (white)
// //
if ( kind == "2" ) {
saved = pt;
if (kind == "2" ) geo_direct_wgs_84 ( alt_m, pt.lat(), pt.lon(), left_hdg,
{ CALVERT2_VERT_SPACING, &lat, &lon, &r );
saved = pt; pt = Point3D( lon, lat, 0.0 );
geo_direct_wgs_84 ( alt_m, pt.lat(), pt.lon(), left_hdg, w_lights.push_back( pt );
CALVERT2_VERT_SPACING, &lat, &lon, &r ); w_normals.push_back( normal1 );
pt = Point3D( lon, lat, 0.0 );
w_lights.push_back( pt );
w_normals.push_back( normal1 );
// five rows < 300m // five rows < 300m
if (i < 10) if ( i < 10 ) {
{ geo_direct_wgs_84 ( alt_m, pt.lat(), pt.lon(), left_hdg,
geo_direct_wgs_84 ( alt_m, pt.lat(), pt.lon(), left_hdg, CALVERT2_VERT_SPACING, &lat, &lon, &r );
CALVERT2_VERT_SPACING, &lat, &lon, &r ); pt = Point3D( lon, lat, 0.0 );
pt = Point3D( lon, lat, 0.0 ); w_lights.push_back( pt );
w_lights.push_back( pt ); w_normals.push_back( normal1 );
w_normals.push_back( normal1 );
// outer strip of lights // outer strip of lights
for (j=0;j<9;j++) for (j=0;j<9;j++) {
{ geo_direct_wgs_84 ( alt_m, pt.lat(), pt.lon(), left_hdg,
geo_direct_wgs_84 ( alt_m, pt.lat(), pt.lon(), left_hdg, CALVERT2_VERT_SPACING, &lat, &lon, &r );
CALVERT2_VERT_SPACING, &lat, &lon, &r ); pt = Point3D( lon, lat, 0.0 );
pt = Point3D( lon, lat, 0.0 ); if ( i == 0 || j > 3 ) {
if (i == 0 || j > 3) w_lights.push_back( pt );
{ w_normals.push_back( normal1 );
w_lights.push_back( pt ); }
w_normals.push_back( normal1 ); }
} }
}
}
pt = saved; pt = saved;
geo_direct_wgs_84 ( alt_m, pt.lat(), pt.lon(), left_hdg, geo_direct_wgs_84 ( alt_m, pt.lat(), pt.lon(), left_hdg,
-1 * CALVERT2_VERT_SPACING, &lat, &lon, &r ); -1 * CALVERT2_VERT_SPACING, &lat, &lon, &r );
pt = Point3D( lon, lat, 0.0 ); pt = Point3D( lon, lat, 0.0 );
w_lights.push_back( pt ); w_lights.push_back( pt );
w_normals.push_back( normal1 ); w_normals.push_back( normal1 );
// five rows < 300m // five rows < 300m
if (i < 10) if ( i < 10 ) {
{ geo_direct_wgs_84 ( alt_m, pt.lat(), pt.lon(), left_hdg,
geo_direct_wgs_84 ( alt_m, pt.lat(), pt.lon(), left_hdg, -1 * CALVERT2_VERT_SPACING, &lat, &lon,
-1 * CALVERT2_VERT_SPACING, &lat, &lon, &r ); &r );
pt = Point3D( lon, lat, 0.0 ); pt = Point3D( lon, lat, 0.0 );
w_lights.push_back( pt ); w_lights.push_back( pt );
w_normals.push_back( normal1 ); w_normals.push_back( normal1 );
// outer strip of lights // outer strip of lights
for (j=0;j<9;j++) for ( j = 0; j < 9; j++ ) {
{ geo_direct_wgs_84 ( alt_m, pt.lat(), pt.lon(), left_hdg,
geo_direct_wgs_84 ( alt_m, pt.lat(), pt.lon(), left_hdg, -1 * CALVERT2_VERT_SPACING, &lat, &lon,
-1 * CALVERT2_VERT_SPACING, &lat, &lon, &r ); &r );
pt = Point3D( lon, lat, 0.0 ); pt = Point3D( lon, lat, 0.0 );
if (i == 0 || j > 3) if ( i == 0 || j > 3 ) {
{ w_lights.push_back( pt );
w_lights.push_back( pt ); w_normals.push_back( normal1 );
w_normals.push_back( normal1 ); }
} }
} }
}
pt = saved;
pt = saved;
} }
ref = pt; ref = pt;
@ -1277,95 +1284,82 @@ static superpoly_list gen_calvert( const TGRunway& rwy_info,
ref = ref_save; ref = ref_save;
int spacing; int spacing;
int num_lights; int num_lights = 0;
// draw nice crossbars // draw nice crossbars
for(i=0;i<5;i++) for ( i = 0; i < 5; i++ ) {
{ if (kind == "1") {
spacing = CALVERT_VERT_SPACING;
if (kind == "1") } else {
{ spacing = CALVERT2_VERT_SPACING;
spacing = CALVERT_VERT_SPACING;
} else
{
spacing = CALVERT2_VERT_SPACING;
} }
switch(i) switch ( i ) {
{
case 0: case 0:
num_lights = 4; num_lights = 4;
break; break;
case 1: case 1:
num_lights = 5; num_lights = 5;
break; break;
case 2: case 2:
num_lights = 6; num_lights = 6;
break; break;
case 3: case 3:
num_lights = 7; num_lights = 7;
break; break;
case 4: case 4:
num_lights = 8; num_lights = 8;
break; break;
} }
pt = crossbar[i]; pt = crossbar[i];
for (j=0;j<num_lights;j++) for ( j = 0 ; j < num_lights; j++ ) {
{ // left side lights
// left side lights
// space out from centre lights // space out from centre lights
if (j==0) if ( j == 0 ) {
{ geo_direct_wgs_84 ( alt_m, pt.lat(), pt.lon(), left_hdg,
geo_direct_wgs_84 ( alt_m, pt.lat(), pt.lon(), left_hdg, CALVERT_VERT_SPACING * j, &lat, &lon, &r );
CALVERT_VERT_SPACING * j, &lat, &lon, &r ); pt = Point3D( lon, lat, 0.0 );
pt = Point3D( lon, lat, 0.0 ); }
}
geo_direct_wgs_84 ( alt_m, pt.lat(), pt.lon(), left_hdg, geo_direct_wgs_84 ( alt_m, pt.lat(), pt.lon(), left_hdg,
spacing, &lat, &lon, &r ); spacing, &lat, &lon, &r );
pt = Point3D( lon, lat, 0.0 ); pt = Point3D( lon, lat, 0.0 );
if (kind == "1" || i >= 2) if ( kind == "1" || i >= 2 ) {
{ w_lights.push_back( pt );
w_lights.push_back( pt ); w_normals.push_back( normal1 );
w_normals.push_back( normal1 ); } else {
} else r_lights.push_back( pt );
{ r_normals.push_back( normal1 );
r_lights.push_back( pt ); }
r_normals.push_back( normal1 );
}
} }
pt = crossbar[i]; pt = crossbar[i];
for (j=0;j<num_lights;j++) for ( j = 0; j < num_lights; j++ ) {
{ // right side lights
// right side lights // space out from centre lights
// space out from centre lights if ( j == 0 ) {
if (j==0) geo_direct_wgs_84 ( alt_m, pt.lat(), pt.lon(), left_hdg,
{ -1 * CALVERT_VERT_SPACING * j, &lat, &lon,
geo_direct_wgs_84 ( alt_m, pt.lat(), pt.lon(), left_hdg, &r );
-1 * CALVERT_VERT_SPACING * j, &lat, &lon, &r ); pt = Point3D( lon, lat, 0.0 );
pt = Point3D( lon, lat, 0.0 ); }
}
geo_direct_wgs_84 ( alt_m, pt.lat(), pt.lon(), left_hdg, geo_direct_wgs_84 ( alt_m, pt.lat(), pt.lon(), left_hdg,
-1 * spacing, &lat, &lon, &r ); -1 * spacing, &lat, &lon, &r );
pt = Point3D( lon, lat, 0.0 ); pt = Point3D( lon, lat, 0.0 );
if (kind == "1" || i >= 2) if ( kind == "1" || i >= 2 ) {
{ w_lights.push_back( pt );
w_lights.push_back( pt ); w_normals.push_back( normal1 );
w_normals.push_back( normal1 ); } else {
} else r_lights.push_back( pt );
{ r_normals.push_back( normal1 );
r_lights.push_back( pt ); }
r_normals.push_back( normal1 );
}
} }
} }
TGPolygon lights_poly; lights_poly.erase(); TGPolygon lights_poly; lights_poly.erase();
TGPolygon normals_poly; normals_poly.erase(); TGPolygon normals_poly; normals_poly.erase();
lights_poly.add_contour( g_lights, false ); lights_poly.add_contour( g_lights, false );
@ -1450,7 +1444,11 @@ static superpoly_list gen_alsf( const TGRunway& rwy_info,
// using TGPolygon is a bit innefficient, but that's what the // using TGPolygon is a bit innefficient, but that's what the
// routine returns. // routine returns.
TGPolygon poly_corners = gen_runway_area_w_extend( rwy_info, 0.0, 2.0, 2.0 ); TGPolygon poly_corners
= gen_runway_area_w_extend( rwy_info, 0.0, 2.0,
rwy_info.disp_thresh1 * SG_FEET_TO_METER,
rwy_info.disp_thresh2 * SG_FEET_TO_METER,
2.0 );
point_list corner; point_list corner;
for ( i = 0; i < poly_corners.contour_size( 0 ); ++i ) { for ( i = 0; i < poly_corners.contour_size( 0 ); ++i ) {
@ -1953,7 +1951,11 @@ static TGSuperPoly gen_odals( const TGRunway& rwy_info, float alt_m,
// using TGPolygon is a bit innefficient, but that's what the // using TGPolygon is a bit innefficient, but that's what the
// routine returns. // routine returns.
TGPolygon poly_corners = gen_runway_area_w_extend( rwy_info, 0.0, 0.0, 0.0 ); TGPolygon poly_corners
= gen_runway_area_w_extend( rwy_info, 0.0, 0.0,
rwy_info.disp_thresh1 * SG_FEET_TO_METER,
rwy_info.disp_thresh2 * SG_FEET_TO_METER,
0.0 );
point_list corner; point_list corner;
for ( i = 0; i < poly_corners.contour_size( 0 ); ++i ) { for ( i = 0; i < poly_corners.contour_size( 0 ); ++i ) {
@ -2060,7 +2062,11 @@ static superpoly_list gen_ssalx( const TGRunway& rwy_info,
// using TGPolygon is a bit innefficient, but that's what the // using TGPolygon is a bit innefficient, but that's what the
// routine returns. // routine returns.
TGPolygon poly_corners = gen_runway_area_w_extend( rwy_info, 0.0, 2.0, 2.0 ); TGPolygon poly_corners
= gen_runway_area_w_extend( rwy_info, 0.0, 2.0,
rwy_info.disp_thresh1 * SG_FEET_TO_METER,
rwy_info.disp_thresh2 * SG_FEET_TO_METER,
2.0 );
point_list corner; point_list corner;
for ( i = 0; i < poly_corners.contour_size( 0 ); ++i ) { for ( i = 0; i < poly_corners.contour_size( 0 ); ++i ) {
@ -2326,7 +2332,11 @@ static superpoly_list gen_malsx( const TGRunway& rwy_info,
// using TGPolygon is a bit innefficient, but that's what the // using TGPolygon is a bit innefficient, but that's what the
// routine returns. // routine returns.
TGPolygon poly_corners = gen_runway_area_w_extend( rwy_info, 0.0, 2.0, 2.0 ); TGPolygon poly_corners
= gen_runway_area_w_extend( rwy_info, 0.0, 2.0,
rwy_info.disp_thresh1 * SG_FEET_TO_METER,
rwy_info.disp_thresh2 * SG_FEET_TO_METER,
2.0 );
point_list corner; point_list corner;
for ( i = 0; i < poly_corners.contour_size( 0 ); ++i ) { for ( i = 0; i < poly_corners.contour_size( 0 ); ++i ) {

View file

@ -98,6 +98,7 @@ static void help( int argc, char **argv ) {
cout << "SRTM-North_America-3\n"; cout << "SRTM-North_America-3\n";
cout << "SRTM-South_America-3\n"; cout << "SRTM-South_America-3\n";
cout << "SRTM-Eurasia-3\n"; cout << "SRTM-Eurasia-3\n";
cout << "SRTM-Africa-3\n";
cout << "DEM-USGS-3\n"; cout << "DEM-USGS-3\n";
cout << "SRTM-30"; cout << "SRTM-30";
cout << "\n\n"; cout << "\n\n";
@ -117,7 +118,7 @@ int main( int argc, char **argv ) {
string_list elev_src; string_list elev_src;
elev_src.clear(); elev_src.clear();
sglog().setLogLevels( SG_GENERAL, SG_INFO ); sglog().setLogLevels( SG_GENERAL, SG_DEBUG );
// parse arguments // parse arguments
string work_dir = ""; string work_dir = "";
@ -177,6 +178,7 @@ int main( int argc, char **argv ) {
elev_src.push_back( "SRTM-North_America-3" ); elev_src.push_back( "SRTM-North_America-3" );
elev_src.push_back( "SRTM-South_America-3" ); elev_src.push_back( "SRTM-South_America-3" );
elev_src.push_back( "SRTM-Eurasia-3" ); elev_src.push_back( "SRTM-Eurasia-3" );
elev_src.push_back( "SRTM-Africa-3" );
elev_src.push_back( "DEM-USGS-3" ); elev_src.push_back( "DEM-USGS-3" );
elev_src.push_back( "SRTM-30" ); elev_src.push_back( "SRTM-30" );

View file

@ -37,8 +37,13 @@
// given a runway center point, length, width, and heading, and // given a runway center point, length, width, and heading, and
// altitude (meters) generate the lon and lat 4 corners using wgs84 // altitude (meters) generate the lon and lat 4 corners using wgs84
// math. // math.
TGPolygon gen_wgs84_area( Point3D origin, double length_m, double width_m, static TGPolygon gen_wgs84_area( Point3D origin,
double heading_deg, double alt_m, bool add_mid ) double length_m,
double displ1, double displ2,
double width_m,
double heading_deg,
double alt_m,
bool add_mid )
{ {
TGPolygon result_list; TGPolygon result_list;
double length_hdg = heading_deg; double length_hdg = heading_deg;
@ -49,7 +54,7 @@ TGPolygon gen_wgs84_area( Point3D origin, double length_m, double width_m,
Point3D ref = origin; Point3D ref = origin;
double lon, lat, r; double lon, lat, r;
geo_direct_wgs_84 ( alt_m, ref.lat(), ref.lon(), length_hdg, geo_direct_wgs_84 ( alt_m, ref.lat(), ref.lon(), length_hdg,
length_m / 2.0, &lat, &lon, &r ); length_m / 2.0 - displ2, &lat, &lon, &r );
ref = Point3D( lon, lat, 0.0 ); ref = Point3D( lon, lat, 0.0 );
// move to the l,-w corner (then we add points in a clockwise direction) // move to the l,-w corner (then we add points in a clockwise direction)
@ -77,7 +82,7 @@ TGPolygon gen_wgs84_area( Point3D origin, double length_m, double width_m,
// move to the -l end/center of the runway // move to the -l end/center of the runway
ref = origin; ref = origin;
geo_direct_wgs_84 ( alt_m, ref.lat(), ref.lon(), length_hdg, geo_direct_wgs_84 ( alt_m, ref.lat(), ref.lon(), length_hdg,
-length_m / 2.0, &lat, &lon, &r ); displ1 - length_m/2.0, &lat, &lon, &r );
ref = Point3D( lon, lat, 0.0 ); ref = Point3D( lon, lat, 0.0 );
// move to the -l,w corner (then we add points in a clockwise direction) // move to the -l,w corner (then we add points in a clockwise direction)
@ -117,8 +122,9 @@ TGPolygon gen_runway_area_w_scale( const TGRunway& runway,
Point3D origin(runway.lon, runway.lat, 0); Point3D origin(runway.lon, runway.lat, 0);
result_list = gen_wgs84_area( origin, result_list = gen_wgs84_area( origin,
runway.length * length_scale * SG_FEET_TO_METER, runway.length*length_scale * SG_FEET_TO_METER,
runway.width * width_scale * SG_FEET_TO_METER, 0.0, 0.0,
runway.width*width_scale * SG_FEET_TO_METER,
runway.heading, alt_m, false ); runway.heading, alt_m, false );
// display points // display points
@ -136,6 +142,7 @@ TGPolygon gen_runway_area_w_scale( const TGRunway& runway,
TGPolygon gen_runway_area_w_extend( const TGRunway& runway, TGPolygon gen_runway_area_w_extend( const TGRunway& runway,
double alt_m, double alt_m,
double length_extend, double length_extend,
double displ1, double displ2,
double width_extend ) { double width_extend ) {
TGPolygon result_list; TGPolygon result_list;
@ -143,8 +150,9 @@ TGPolygon gen_runway_area_w_extend( const TGRunway& runway,
result_list result_list
= gen_wgs84_area( origin, = gen_wgs84_area( origin,
runway.length * SG_FEET_TO_METER + 2.0 * length_extend, runway.length*SG_FEET_TO_METER + 2.0*length_extend,
runway.width * SG_FEET_TO_METER + 2.0 * width_extend, displ1, displ2,
runway.width*SG_FEET_TO_METER + 2.0*width_extend,
runway.heading, alt_m, false ); runway.heading, alt_m, false );
// display points // display points
@ -167,7 +175,8 @@ TGPolygon gen_runway_w_mid( const TGRunway& runway,
result_list = gen_wgs84_area( origin, result_list = gen_wgs84_area( origin,
runway.length * SG_FEET_TO_METER runway.length * SG_FEET_TO_METER
+ 2.0 * length_extend_m, + 2.0*length_extend_m,
0.0, 0.0,
runway.width * SG_FEET_TO_METER runway.width * SG_FEET_TO_METER
+ 2.0 * width_extend_m, + 2.0 * width_extend_m,
runway.heading, alt_m, true ); runway.heading, alt_m, true );

View file

@ -78,15 +78,16 @@ TGPolygon gen_runway_area_w_scale( const TGRunway& runway,
// (return result points in degrees) // (return result points in degrees)
TGPolygon gen_runway_area_w_extend( const TGRunway& runway, TGPolygon gen_runway_area_w_extend( const TGRunway& runway,
double alt_m, double alt_m,
double length_extend = 0.0, double length_extend,
double width_extend = 0.0 ); double displ1, double displ2,
double width_extend );
// generate an area for half a runway // generate an area for half a runway
TGPolygon gen_runway_w_mid( const TGRunway& runway, TGPolygon gen_runway_w_mid( const TGRunway& runway,
double alt_m, double alt_m,
double length_extend_m = 0.0, double length_extend_m,
double width_extend_m = 0.0 ); double width_extend_m );
#endif // _RUNWAY_HXX #endif // _RUNWAY_HXX

View file

@ -43,7 +43,7 @@ void gen_simple_rwy( const TGRunway& rwy_info,
{ {
int j, k; int j, k;
TGPolygon runway = gen_runway_w_mid( rwy_info, alt_m ); TGPolygon runway = gen_runway_w_mid( rwy_info, alt_m, 0.0, 0.0 );
// runway half "a" // runway half "a"
TGPolygon runway_a; TGPolygon runway_a;

View file

@ -43,7 +43,7 @@ void gen_taxiway( const TGRunway& rwy_info,
{ {
int j, k; int j, k;
TGPolygon runway = gen_runway_w_mid( rwy_info, alt_m ); TGPolygon runway = gen_runway_w_mid( rwy_info, alt_m, 0.0, 0.0 );
// runway half "a" // runway half "a"
TGPolygon runway_a; TGPolygon runway_a;