diff --git a/src/Airports/GenAirports850/lights.cxx b/src/Airports/GenAirports850/lights.cxx index e57906c3..be7f797a 100644 --- a/src/Airports/GenAirports850/lights.cxx +++ b/src/Airports/GenAirports850/lights.cxx @@ -295,75 +295,6 @@ tglightcontour_list Runway::gen_runway_center_line_lights( bool recip ) 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 tgLightContour Runway::gen_touchdown_zone_lights( bool recip ) diff --git a/src/Airports/GenAirports850/taxiway.cxx b/src/Airports/GenAirports850/taxiway.cxx index b69fcc0c..4880b92b 100644 --- a/src/Airports/GenAirports850/taxiway.cxx +++ b/src/Airports/GenAirports850/taxiway.cxx @@ -13,7 +13,7 @@ extern int nudge; 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; // variables to store unused parameters @@ -28,7 +28,7 @@ Taxiway::Taxiway(char* definition) // format: // taxiway lat lon designation heading length threshold overrun // 10 44.38085600 -074.20606200 xxx 79.29 3384 0.0 0.0 - // + // // width lighting surface shoulder markings smoothness dist remain // 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 // int fscanf(FILE *stream, const char *format, ...); - sscanf(definition, "%lf %lf %s %lf %lf %lf %lf %lf %s %d %d %d %lf %d", - &lat, &lon, designation, &heading, &length, &threshold, &overrun, + sscanf(definition, "%lf %lf %s %lf %lf %lf %lf %lf %s %d %d %d %lf %d", + &lat, &lon, designation, &heading, &length, &threshold, &overrun, &width, lighting, &surface, &shoulder, &markings, &smoothness, &signs); 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 ); 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 ) { @@ -60,6 +87,7 @@ int Taxiway::BuildBtg( tgpolygon_list& rwy_polys, tglightcontour_list& rwy_light { if ( (width <= 50) && (lighting[1] == '6') ) { material = "pa_taxiway"; + GenLights(rwy_lights); } else { material = "pa_tiedown"; } @@ -68,6 +96,7 @@ int Taxiway::BuildBtg( tgpolygon_list& rwy_polys, tglightcontour_list& rwy_light { if ( (width <= 50) && (lighting[1] == '6') ) { material = "pc_taxiway"; + GenLights(rwy_lights); } else { 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 split = tgPolygon::SplitLongEdges( clipped, 100 ); - + tgPolygon::RemoveSlivers( split, slivers ); split.SetMaterial( material ); diff --git a/src/Airports/GenAirports850/taxiway.hxx b/src/Airports/GenAirports850/taxiway.hxx index 0d5d3030..90603e10 100644 --- a/src/Airports/GenAirports850/taxiway.hxx +++ b/src/Airports/GenAirports850/taxiway.hxx @@ -27,16 +27,17 @@ public: tgPolygon& apt_base, tgPolygon& apt_clearing, std::string& shapefile_name ); - + private: SGGeod origin; double heading; double length; double width; int surface; - char lighting[8]; + char lighting[6]; tgContour taxi_contour; + void GenLights(tglightcontour_list& rwy_lights); }; typedef std::vector TaxiwayList;