From f9a83704338192e37ffd2cd227ce2d3af39bb163 Mon Sep 17 00:00:00 2001
From: curt <curt>
Date: Mon, 16 Jul 2001 01:57:46 +0000
Subject: [PATCH] Tweak size of grass area surrounding taxiways.

---
 src/Airports/GenAirports/build.cxx  |  7 +++-
 src/Airports/GenAirports/runway.cxx | 54 ++++++++++++++++++++++++++---
 src/Airports/GenAirports/runway.hxx | 16 ++++++---
 3 files changed, 68 insertions(+), 9 deletions(-)

diff --git a/src/Airports/GenAirports/build.cxx b/src/Airports/GenAirports/build.cxx
index 8bbd2553..53233208 100644
--- a/src/Airports/GenAirports/build.cxx
+++ b/src/Airports/GenAirports/build.cxx
@@ -1707,7 +1707,12 @@ void build_runway( const FGRunway& rwy_info,
 	exit(-1);
     }
 
-    FGPolygon base = gen_runway_area( rwy_info, 1.05, 1.5 );
+    FGPolygon base;
+    if ( rwy_info.really_taxiway ) {
+	base = gen_runway_area_w_expand( rwy_info, 10, 10 );
+    } else {
+	base = gen_runway_area_w_scale( rwy_info, 1.05, 1.5 );
+    }
 
     // add base to apt_base
     *apt_base = polygon_union( base, *apt_base );
diff --git a/src/Airports/GenAirports/runway.cxx b/src/Airports/GenAirports/runway.cxx
index 93e89349..0c5522b1 100644
--- a/src/Airports/GenAirports/runway.cxx
+++ b/src/Airports/GenAirports/runway.cxx
@@ -113,10 +113,11 @@ FGPolygon gen_area(Point3D origin, double angle, const FGPolygon& cart_list) {
 }
 
 
-// generate an area for a runway
-FGPolygon gen_runway_area( const FGRunway& runway,
- 			   double len_scale,
-			   double width_scale ) {
+// generate an area for a runway with expantion specified as a scale
+// factor (return result points in degrees)
+FGPolygon gen_runway_area_w_scale( const FGRunway& runway,
+				   double len_scale,
+				   double width_scale ) {
 
     FGPolygon result_list;
     FGPolygon tmp_list;
@@ -157,6 +158,51 @@ FGPolygon gen_runway_area( const FGRunway& runway,
 }
 
 
+// generate an area for a runway with expansion specified in meters
+// (return result points in degrees)
+FGPolygon gen_runway_area_w_expand( const FGRunway& runway,
+				    double len_expand,
+				    double wid_expand ) {
+
+    FGPolygon result_list;
+    FGPolygon tmp_list;
+
+    double l, w;
+
+    /*
+    printf("runway: lon = %.2f lat = %.2f hdg = %.2f len = %.2f width = %.2f\n",
+	   lon, lat, heading, length, width);
+    */
+
+    Point3D origin(runway.lon, runway.lat, 0);
+    l = runway.length * SG_FEET_TO_METER / 2.0 + len_expand;
+    w = runway.width * SG_FEET_TO_METER / 2.0 + wid_expand;
+
+    // generate untransformed runway area vertices
+    tmp_list.add_node( 0, Point3D( l, w, 0 ) );
+    tmp_list.add_node( 0, Point3D( l, -w, 0 ) );
+    tmp_list.add_node( 0, Point3D( -l, -w, 0 ) );
+    tmp_list.add_node( 0, Point3D( -l, w, 0 ) );
+
+    // display points
+    // cout << "Untransformed, unrotated runway" << endl;
+    // for ( int i = 0; i < tmp_list.contour_size( 0 ); ++i ) {
+    //    cout << "  " << tmp_list.get_pt(0, i) << endl;
+    // }
+
+    // rotate, transform, and convert points to lon, lat in degrees
+    result_list = gen_area(origin, runway.heading * SGD_DEGREES_TO_RADIANS, tmp_list);
+
+    // display points
+    // cout << "Results in radians." << endl;
+    // for ( int i = 0; i < result_list.contour_size( 0 ); ++i ) {
+    //     cout << "  " << result_list.get_pt(0, i) << endl;
+    // }
+
+    return result_list;
+}
+
+
 // generate an area for a runway and include midpoints
 FGPolygon gen_runway_w_mid( const FGRunway& runway, 
 			    double len_scale,
diff --git a/src/Airports/GenAirports/runway.hxx b/src/Airports/GenAirports/runway.hxx
index 4d3d6c34..4069e991 100644
--- a/src/Airports/GenAirports/runway.hxx
+++ b/src/Airports/GenAirports/runway.hxx
@@ -67,10 +67,18 @@ typedef runway_list::iterator runway_list_iterator;
 typedef runway_list::const_iterator const_runway_list_iterator;
 
 
-// generate an area for a runway (return result points in degrees)
-FGPolygon gen_runway_area( const FGRunway& runway, 
-			   double len_scale = 1.0,
-			   double width_scale = 1.0 );
+// generate an area for a runway with expantion specified as a scale
+// factor (return result points in degrees)
+FGPolygon gen_runway_area_w_scale( const FGRunway& runway, 
+				   double len_scale = 1.0,
+				   double width_scale = 1.0 );
+
+// generate an area for a runway with expansion specified in meters
+// (return result points in degrees)
+FGPolygon gen_runway_area_w_expand( const FGRunway& runway, 
+				    double len_expand = 0.0,
+				    double wid_expand = 0.0 );
+
 
 // generate an area for half a runway
 FGPolygon gen_runway_w_mid( const FGRunway& runway,