1
0
Fork 0

Add edge lights to old 810-type taxiways

This commit is contained in:
Christian Schmitt 2012-11-18 14:24:05 +01:00
parent b013ad6b7b
commit 05091265a5
3 changed files with 38 additions and 77 deletions

View file

@ -295,75 +295,6 @@ tglightcontour_list Runway::gen_runway_center_line_lights( bool recip )
return result; return result;
} }
/*
// generate taxiway center line lighting, 50' spacing.
static superpoly_list gen_taxiway_center_line_lights( bool recip )
{
point_list g_lights; g_lights.clear();
point_list g_normals; g_normals.clear();
int i;
double len = rwy.length;
// this should be ??' technically but I'm trying 50' to space things out
int divs = (int)(len / 70) + 1;
Point3D normal = gen_runway_light_vector( 3.0, recip );
// using TGPolygon is a bit innefficient, but that's what the
// routine returns.
TGPolygon poly_corners = gen_runway_area_w_extend( 2.0, 0.0, 0.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 inc;
Point3D pt1, pt2;
if ( recip ) {
pt1 = (corner[0] + corner[1] ) / 2.0;
pt2 = (corner[2] + corner[3] ) / 2.0;
} else {
pt1 = (corner[2] + corner[3] ) / 2.0;
pt2 = (corner[0] + corner[1] ) / 2.0;
}
inc = (pt2 - pt1) / divs;
double dist = len;
double step = len / divs;
pt1 += inc; // move 25' in
dist -= step;
while ( dist > 0.0 ) {
g_lights.push_back( pt1 );
g_normals.push_back( normal );
pt1 += inc;
pt1 += inc;
dist -= step;
dist -= step;
}
superpoly_list result; result.clear();
if ( g_lights.size() > 0 ) {
TGPolygon lights_poly; lights_poly.erase();
TGPolygon normals_poly; normals_poly.erase();
lights_poly.add_contour( g_lights, false );
normals_poly.add_contour( g_normals, false );
TGSuperPoly green;
green.set_poly( lights_poly );
green.set_normals( normals_poly );
green.set_material( "RWY_GREEN_TAXIWAY_LIGHTS" );
result.push_back( green );
}
return result;
}
*/
// generate touch down zone lights // generate touch down zone lights
tgLightContour Runway::gen_touchdown_zone_lights( bool recip ) tgLightContour Runway::gen_touchdown_zone_lights( bool recip )

View file

@ -13,7 +13,7 @@ extern int nudge;
Taxiway::Taxiway(char* definition) Taxiway::Taxiway(char* definition)
{ {
// variables for sdjusting 810 rwy format to 850 rwy format // variables for adjusting 810 rwy format to 850 rwy format
double lon = 0, lat = 0; double lon = 0, lat = 0;
// variables to store unused parameters // variables to store unused parameters
@ -28,7 +28,7 @@ Taxiway::Taxiway(char* definition)
// format: // format:
// taxiway lat lon designation heading length threshold overrun // taxiway lat lon designation heading length threshold overrun
// 10 44.38085600 -074.20606200 xxx 79.29 3384 0.0 0.0 // 10 44.38085600 -074.20606200 xxx 79.29 3384 0.0 0.0
// //
// width lighting surface shoulder markings smoothness dist remain // width lighting surface shoulder markings smoothness dist remain
// 60 161161 1 0 0 0.35 0 // 60 161161 1 0 0 0.35 0
@ -36,8 +36,8 @@ Taxiway::Taxiway(char* definition)
// 44.38085600 -074.20606200 xxx 79.29 3384 0.0 0.0 60 161161 1 0 0 0.35 0 // 44.38085600 -074.20606200 xxx 79.29 3384 0.0 0.0 60 161161 1 0 0 0.35 0
// int fscanf(FILE *stream, const char *format, ...); // int fscanf(FILE *stream, const char *format, ...);
sscanf(definition, "%lf %lf %s %lf %lf %lf %lf %lf %s %d %d %d %lf %d", sscanf(definition, "%lf %lf %s %lf %lf %lf %lf %lf %s %d %d %d %lf %d",
&lat, &lon, designation, &heading, &length, &threshold, &overrun, &lat, &lon, designation, &heading, &length, &threshold, &overrun,
&width, lighting, &surface, &shoulder, &markings, &smoothness, &signs); &width, lighting, &surface, &shoulder, &markings, &smoothness, &signs);
SG_LOG(SG_GENERAL, SG_DEBUG, "Read taxiway: (" << lon << "," << lat << ") heading: " << heading << " length: " << length << " width: " << width ); SG_LOG(SG_GENERAL, SG_DEBUG, "Read taxiway: (" << lon << "," << lat << ") heading: " << heading << " length: " << length << " width: " << width );
@ -50,7 +50,34 @@ Taxiway::Taxiway(char* definition)
origin = SGGeodesy::direct( SGGeod::fromDeg(lon, lat), heading, -length/2 ); origin = SGGeodesy::direct( SGGeod::fromDeg(lon, lat), heading, -length/2 );
taxi_contour = gen_wgs84_rect( origin, heading, length, width ); taxi_contour = gen_wgs84_rect( origin, heading, length, width );
} }
void Taxiway::GenLights(tglightcontour_list& rwy_lights)
{
// Create blue taxiway edge lights along the long sides of the taxiway
// Spacing is 10m
// Vector calculation
SGVec3d vec = normalize(SGVec3d::fromGeod(taxi_contour.GetNode(0)));
tgLightContour blue;
blue.SetType( "RWY_BLUE_TAXIWAY_LIGHTS" );
for ( unsigned int i = 0; i < taxi_contour.GetSize(); ++i ) {
double dist, course, cs;
SGGeodesy::inverse(taxi_contour.GetNode(i), taxi_contour.GetNode(i+1), course, cs, dist );
int divs = (int)(dist / 10.0);
double step = dist/divs;
SGGeod pt = taxi_contour.GetNode(i);
for (int j = 0; j < divs; ++j) {
pt = SGGeodesy::direct(pt, course, step );
blue.AddLight( pt, vec );
}
i++;
}
rwy_lights.push_back( blue );
}
int Taxiway::BuildBtg( tgpolygon_list& rwy_polys, tglightcontour_list& rwy_lights, tgcontour_list& slivers, std::string& shapefile_name ) int Taxiway::BuildBtg( tgpolygon_list& rwy_polys, tglightcontour_list& rwy_lights, tgcontour_list& slivers, std::string& shapefile_name )
{ {
@ -60,6 +87,7 @@ int Taxiway::BuildBtg( tgpolygon_list& rwy_polys, tglightcontour_list& rwy_light
{ {
if ( (width <= 50) && (lighting[1] == '6') ) { if ( (width <= 50) && (lighting[1] == '6') ) {
material = "pa_taxiway"; material = "pa_taxiway";
GenLights(rwy_lights);
} else { } else {
material = "pa_tiedown"; material = "pa_tiedown";
} }
@ -68,6 +96,7 @@ int Taxiway::BuildBtg( tgpolygon_list& rwy_polys, tglightcontour_list& rwy_light
{ {
if ( (width <= 50) && (lighting[1] == '6') ) { if ( (width <= 50) && (lighting[1] == '6') ) {
material = "pc_taxiway"; material = "pc_taxiway";
GenLights(rwy_lights);
} else { } else {
material = "pc_tiedown"; material = "pc_tiedown";
} }
@ -112,7 +141,7 @@ int Taxiway::BuildBtg( tgpolygon_list& rwy_polys, tglightcontour_list& rwy_light
tgPolygon clipped = tgContour::DiffWithAccumulator( taxi_contour ); tgPolygon clipped = tgContour::DiffWithAccumulator( taxi_contour );
tgPolygon split = tgPolygon::SplitLongEdges( clipped, 100 ); tgPolygon split = tgPolygon::SplitLongEdges( clipped, 100 );
tgPolygon::RemoveSlivers( split, slivers ); tgPolygon::RemoveSlivers( split, slivers );
split.SetMaterial( material ); split.SetMaterial( material );

View file

@ -27,16 +27,17 @@ public:
tgPolygon& apt_base, tgPolygon& apt_base,
tgPolygon& apt_clearing, tgPolygon& apt_clearing,
std::string& shapefile_name ); std::string& shapefile_name );
private: private:
SGGeod origin; SGGeod origin;
double heading; double heading;
double length; double length;
double width; double width;
int surface; int surface;
char lighting[8]; char lighting[6];
tgContour taxi_contour; tgContour taxi_contour;
void GenLights(tglightcontour_list& rwy_lights);
}; };
typedef std::vector <Taxiway *> TaxiwayList; typedef std::vector <Taxiway *> TaxiwayList;