1
0
Fork 0

More cleanup on the runway and helipad side. Remove point3d occurences from helipad light code.

This commit is contained in:
Christian Schmitt 2012-10-28 11:33:15 +01:00
parent 608057596b
commit 707e939337
8 changed files with 77 additions and 408 deletions

View file

@ -111,16 +111,15 @@ tgContour gen_wgs84_area( SGGeod end1, SGGeod end2,
return result;
}
tgContour gen_wgs84_rect( double lat, double lon, double heading, double length, double width )
tgContour gen_wgs84_rect( SGGeod origin, double heading, double length, double width )
{
tgContour result;
SGGeod ref = SGGeod::fromDeg(lon, lat);
SGGeod p;
// starting point is in the middle of the rectangle width, at the beginning - stretch to heading
// Point 1 is -90deg, 1/2 width away
double left_hdg = SGMiscd::normalizePeriodic(0, 360, heading -90 );
p = SGGeodesy::direct( ref, left_hdg, width / 2.0 );
p = SGGeodesy::direct( origin, left_hdg, width / 2.0 );
result.AddNode( p );
// Point 2 is heading, length away from point 1

View file

@ -27,7 +27,7 @@ tgContour gen_wgs84_area( SGGeod end1, SGGeod end2,
double heading_deg,
bool add_mid );
tgContour gen_wgs84_rect( double lat, double lon, double heading, double length, double width );
tgContour gen_wgs84_rect( SGGeod origin, double heading, double length, double width );
#endif

View file

@ -43,26 +43,23 @@ Helipad::Helipad(char* definition)
tglightcontour_list Helipad::gen_helipad_lights(double maxsize){
tglightcontour_list result;
point_list y_lights; y_lights.clear();
point_list y_normals; y_normals.clear();
// Vector calculation
SGVec3d vec = normalize(SGVec3d::fromGeod(GetLoc()));
// Create yellow edge lights, 5m spacing
int divs = (int)(maxsize / 5.0);
tgContour area = gen_runway_area_w_extend(0.0, 0.0, 0.0, 0.0, 0.0);
Point3D pt, inc;
tgLightContour yellow;
yellow.SetType( "RWY_YELLOW_LIGHTS" );
for ( unsigned int i = 0; i < area.GetSize(); ++i ) {
pt = Point3D::fromSGGeod( area.GetNode( i ) );
inc = (Point3D::fromSGGeod( area.GetNode( i==3 ? 0 : i+1) ) - Point3D::fromSGGeod( area.GetNode(i) ) ) / divs;
for ( int j = 0; j < divs; ++j) {
yellow.AddLight( pt.toSGGeod(), vec );
pt += inc;
double dist, course, cs;
SGGeodesy::inverse(area.GetNode(i), area.GetNode(i==3 ? 0 : i+1), course, cs, dist );
int divs = (int)(dist / 5.0);
double step = dist/divs;
SGGeod pt = area.GetNode(i);
for (int j = 0; j < divs; ++j) {
pt = SGGeodesy::direct(pt, course, step );
yellow.AddLight( pt, vec );
}
}
@ -98,151 +95,6 @@ tgPolygon Helipad::WriteGeom( const tgContour& area, string material,
return split;
}
void Helipad::BuildBtg( tgpolygon_list& rwy_polys,
tglightcontour_list& rwy_lights,
tgcontour_list& slivers,
tgPolygon& apt_base,
tgPolygon& apt_clearing )
{
//
// Generate the basic helipad outlines
//
double maxsize = heli.width - heli.length;
bool area_top = false;
bool area_side = false;
if (maxsize == 0) {
maxsize = heli.width;
} else if (maxsize < 0) {
maxsize = heli.width;
area_top = true;
} else {
maxsize = heli.length;
area_side = true;
}
tgContour helipad = gen_wgs84_area( GetLoc(), maxsize, 0, 0, maxsize, heli.heading, false);
helipad = tgContour::Snap( helipad, gSnap );
string material, shoulder_mat;
if (heli.surface == 1)
material = "pa_";
else
material = "pc_";
// write out
tgPolygon result = WriteGeom( helipad, material + "heli", rwy_polys, slivers);
result.SetTexParams( helipad.GetNode(0), maxsize, maxsize, heli.heading );
result.SetTexLimits( 1,1,0,0 );
result.SetTexMethod( TG_TEX_BY_TPS_CLIPUV, 0.0, 0.0, 1.0, 1.0 );
rwy_polys.push_back( result );
int i = 0;
double heading = 0, areahight = 0;
tgContour heli_area = gen_runway_area_w_extend(0.0, 0.0, 0.0, 0.0, 0.0);
heli_area = tgContour::Snap( heli_area, gSnap );
tgcontour_list area_contours;
tgContour area;
if (area_top || area_side) {
if (area_top) {
areahight = (heli.length - maxsize) /2;
heading = SGMiscd::normalizePeriodic( 0, 360, heli.heading-90 );
i = 0;
} else {
areahight = (heli.width - maxsize) /2;
heading = SGMiscd::normalizePeriodic( 0, 360, heli.heading-90 );
i = 1;
}
for (;i<4; ++i) {
area.Erase();
area.AddNode( heli_area.GetNode( i ) );
area.AddNode( heli_area.GetNode( i == 3 ? 0 : i+1 ) );
area.AddNode( helipad.GetNode( i == 3 ? 0 : i+1) );
area.AddNode( helipad.GetNode( i ) );
area.SetHole( false );
area_contours.push_back( area );
i++;
}
tgPolygon result;
for (i = 0; i < 2; ++i) {
result = WriteGeom( area_contours[i], material + "tiedown", rwy_polys, slivers);
result.SetTexParams( area_contours[i].GetNode(0), maxsize, areahight, heading );
result.SetTexLimits( 1,1,0,0 );
result.SetTexMethod( TG_TEX_BY_TPS_CLIPUV, 0.0, 0.0, 1.0, 1.0 );
rwy_polys.push_back( result );
heading = SGMiscd::normalizePeriodic(0, 360, heading + 180 );
}
}
if (heli.shoulder == 1) {
shoulder_mat = "pa_shoulder";
areahight = 6; // shoulder size in m
} else if (heli.shoulder == 2) {
shoulder_mat = "pc_shoulder";
areahight = 6; // shoulder size in m
} else {
shoulder_mat = material + "shoulder_f";
areahight = 1; // fake shoulder size in m
}
double shoulder_width = heli.length;
heading = heli.heading;
if (area_side) {
shoulder_width = heli.width;
}
tgContour shoulder = gen_runway_area_w_extend(0.0, areahight, 0.0, 0.0, areahight);
shoulder = tgContour::Snap( shoulder, gSnap );
for (i = 0; i < 4; ++i) {
heading = SGMiscd::normalizePeriodic(0,360,heading-90);
area.Erase();
area.AddNode( shoulder.GetNode( i ) );
area.AddNode( shoulder.GetNode( i == 3 ? 0 : i+1 ) );
area.AddNode( heli_area.GetNode( i == 3 ? 0 : i+1 ) );
area.AddNode( heli_area.GetNode( i ) );
area.SetHole(false);
result.Erase();
result.AddContour( area );
result.SetMaterial( shoulder_mat );
result.SetTexParams( area.GetNode(1), areahight, shoulder_width, heading );
result.SetTexLimits( 1,1,0,0 );
result.SetTexMethod( TG_TEX_BY_TPS_CLIPUV, 0.0, 0.0, 1.0, 1.0 );
shoulder_polys.push_back( result );
}
if (heli.edge_lights)
{
// Now generate the helipad lights
tglightcontour_list s = gen_helipad_lights(maxsize);
for ( unsigned int i = 0; i < s.size(); ++i ) {
rwy_lights.push_back( s[i] );
}
}
// generate area around helipad
tgContour base, safe_base;
base = gen_runway_area_w_extend( 0.0, heli.length * 0.25 , 0.0, 0.0, heli.width * 0.25 );
base = tgContour::Snap( base, gSnap );
// also clear a safe area around the pad
safe_base = gen_runway_area_w_extend( 0.0, heli.length * 0.5, 0.0, 0.0, heli.width * 0.5 );
safe_base = tgContour::Snap( safe_base, gSnap );
// add this to the airport clearing
apt_clearing = tgPolygon::Union(safe_base, apt_clearing);
// and add the clearing to the base
apt_base = tgPolygon::Union( base, apt_base );
}
void Helipad::BuildBtg( tgpolygon_list& rwy_polys,
tglightcontour_list& rwy_lights,
tgcontour_list& slivers )
@ -277,6 +129,7 @@ void Helipad::BuildBtg( tgpolygon_list& rwy_polys,
result.SetTexParams( helipad.GetNode(0), maxsize, maxsize, heli.heading );
result.SetTexLimits( 1,1,0,0 );
result.SetTexMethod( TG_TEX_BY_TPS_CLIPUV, 0.0, 0.0, 1.0, 1.0 );
rwy_polys.push_back( result );
int i = 0;
@ -370,6 +223,30 @@ void Helipad::BuildBtg( tgpolygon_list& rwy_polys,
}
}
void Helipad::BuildBtg( tgpolygon_list& rwy_polys,
tglightcontour_list& rwy_lights,
tgcontour_list& slivers,
tgPolygon& apt_base,
tgPolygon& apt_clearing )
{
BuildBtg( rwy_polys, rwy_lights, slivers );
// generate area around helipad
tgContour base, safe_base;
base = gen_runway_area_w_extend( 0.0, heli.length * 0.25 , 0.0, 0.0, heli.width * 0.25 );
base = tgContour::Snap( base, gSnap );
// also clear a safe area around the pad
safe_base = gen_runway_area_w_extend( 0.0, heli.length * 0.5, 0.0, 0.0, heli.width * 0.5 );
safe_base = tgContour::Snap( safe_base, gSnap );
// add this to the airport clearing
apt_clearing = tgPolygon::Union(safe_base, apt_clearing);
// and add the clearing to the base
apt_base = tgPolygon::Union( base, apt_base );
}
void Helipad::BuildShoulder( tgpolygon_list& rwy_polys,
tgcontour_list& slivers,
tgPolygon& apt_base,

View file

@ -149,12 +149,12 @@ void Runway::gen_runway_section( const tgPolygon& runway,
double lshoulder_width = 0.0f;
double rshoulder_width = 0.0f;
std::string shoulder_surface = "";
#if 0
static int runway_idx = 0;
static int section_idx = 0;
static int clipped_idx = 0;
char layer[64];
#endif
SGVec2d a0 = SGVec2d( runway.GetNode(0, 1).getLongitudeDeg(), runway.GetNode(0, 1).getLatitudeDeg() );
SGVec2d a1 = SGVec2d( runway.GetNode(0, 2).getLongitudeDeg(), runway.GetNode(0, 2).getLatitudeDeg() );
SGVec2d a2 = SGVec2d( runway.GetNode(0, 0).getLongitudeDeg(), runway.GetNode(0, 0).getLatitudeDeg() );
@ -345,9 +345,9 @@ void Runway::gen_runway_section( const tgPolygon& runway,
double length = rwy.length;
SGVec2d a0 = SGVec2d( runway.GetNode(0, 1).getLongitudeDeg(), runway.GetNode(0, 1).getLatitudeDeg() );
SGVec2d a1 = SGVec2d( runway.GetNode(0, 1).getLongitudeDeg(), runway.GetNode(0, 2).getLatitudeDeg() );
SGVec2d a2 = SGVec2d( runway.GetNode(0, 1).getLongitudeDeg(), runway.GetNode(0, 0).getLatitudeDeg() );
SGVec2d a3 = SGVec2d( runway.GetNode(0, 1).getLongitudeDeg(), runway.GetNode(0, 3).getLatitudeDeg() );
SGVec2d a1 = SGVec2d( runway.GetNode(0, 2).getLongitudeDeg(), runway.GetNode(0, 2).getLatitudeDeg() );
SGVec2d a2 = SGVec2d( runway.GetNode(0, 0).getLongitudeDeg(), runway.GetNode(0, 0).getLatitudeDeg() );
SGVec2d a3 = SGVec2d( runway.GetNode(0, 3).getLongitudeDeg(), runway.GetNode(0, 3).getLatitudeDeg() );
if ( startl_pct > 0.0 ) {
startl_pct -= nudge * SG_EPSILON;
@ -573,9 +573,15 @@ void Runway::gen_rwy( tgpolygon_list& rwy_polys,
tgContour runway = gen_runway_w_mid( 0, 0 );
tgPolygon runway_half;
for ( int rwhalf=0; rwhalf<2; ++rwhalf ){
for ( int rwhalf = 0; rwhalf < 2; ++rwhalf ) {
double start1_pct = 0.0;
double end1_pct = 0.0;
double heading = 0.0;
double length = rwy.length / 2.0;
if (rwhalf == 0) {
heading = SGMiscd::normalizePeriodic(0, 360, rwy.heading + 180);
//Create the first half of the runway (first entry in apt.dat)
runway_half.Erase();
@ -585,7 +591,8 @@ void Runway::gen_rwy( tgpolygon_list& rwy_polys,
runway_half.AddNode( 0, runway.GetNode(2) );
}
else if (rwhalf == 1) {
else {
heading = rwy.heading;
//Create the second runway half from apt.dat
runway_half.Erase();
@ -595,15 +602,6 @@ void Runway::gen_rwy( tgpolygon_list& rwy_polys,
runway_half.AddNode( 0, runway.GetNode(5) );
}
SGGeod p;
SG_LOG(SG_GENERAL, SG_DEBUG, "raw runway half pts (run " << rwhalf << ")");
for ( unsigned int i = 0; i < runway_half.ContourSize( 0 ); ++i ) {
p = runway_half.GetNode( 0, i );
SG_LOG(SG_GENERAL, SG_DEBUG, " point = " << p);
}
double length = rwy.length / 2.0;
// Make sure our runway is long enough for the desired marking variant
if ( (rwy.marking[rwhalf]==2 || rwy.marking[rwhalf]==4) && length < 1150 * SG_FEET_TO_METER ) {
SG_LOG( SG_GENERAL, SG_ALERT,
@ -617,25 +615,12 @@ void Runway::gen_rwy( tgpolygon_list& rwy_polys,
<< rwy.length << "m) for precision markings! Setting runway markings to visual!");
rwy.marking[rwhalf]=1;
}
SG_LOG( SG_GENERAL, SG_DEBUG, "runway marking = " << rwy.marking[rwhalf] );
double start1_pct = 0.0;
double end1_pct = 0.0;
double heading = 0.0;
string rwname;
//
// Displaced threshold if it exists
//
if (rwhalf == 0) {
heading = SGMiscd::normalizePeriodic( 0,360, rwy.heading + 180.0 );
rwname = rwy.rwnum[0];
}
else if (rwhalf == 1) {
heading = rwy.heading;
rwname = rwy.rwnum[1];
}
SG_LOG( SG_GENERAL, SG_DEBUG, "runway marking = " << rwy.marking[rwhalf] );
if ( rwy.threshold[rwhalf] > 0.0 ) {
SG_LOG( SG_GENERAL, SG_DEBUG, "Displaced threshold for RW side " << rwhalf << " is " << rwy.threshold[rwhalf] );
@ -734,7 +719,7 @@ void Runway::gen_rwy( tgpolygon_list& rwy_polys,
// Runway designation block
gen_rw_designation( runway_half, heading,
rwname, start1_pct, end1_pct,
rwy.rwnum[rwhalf], start1_pct, end1_pct,
rwy_polys, slivers,
make_shapefiles );

View file

@ -20,18 +20,13 @@
//
#include <simgear/compiler.h>
#include <simgear/constants.h>
#include <simgear/debug/logstream.hxx>
#include <Polygon/superpoly.hxx>
#include "runway.hxx"
using std::string;
// generate a simple runway. The routine modifies rwy_polys,
// texparams, and accum
// generate a simple runway
void Runway::gen_simple_rwy( tgpolygon_list& rwy_polys,
tgcontour_list& slivers )
{
@ -40,7 +35,13 @@ void Runway::gen_simple_rwy( tgpolygon_list& rwy_polys,
for ( int rwhalf=0; rwhalf<2; ++rwhalf ) {
double length = rwy.length / 2.0;
double start_pct = 0.0;
double end_pct = 0.0;
double heading = 0.0;
if (rwhalf == 0) {
heading = SGMiscd::normalizePeriodic(0, 360, rwy.heading + 180.0);
//Create the first half of the runway (first entry in apt.dat)
runway_half.Erase();
@ -50,7 +51,8 @@ void Runway::gen_simple_rwy( tgpolygon_list& rwy_polys,
runway_half.AddNode( 0, runway.GetNode(2) );
}
else if (rwhalf == 1) {
else {
heading = rwy.heading;
//Create the second runway half from apt.dat
runway_half.Erase();
@ -60,45 +62,34 @@ void Runway::gen_simple_rwy( tgpolygon_list& rwy_polys,
runway_half.AddNode( 0, runway.GetNode(5) );
}
double length = rwy.length / 2.0;
double start1_pct = 0.0;
double end1_pct = 0.0;
double heading = 0.0;
if (rwhalf == 0) {
heading = SGMiscd::normalizePeriodic(0, 360, rwy.heading + 180.0);
}
else if (rwhalf == 1) {
heading = rwy.heading;
}
SG_LOG( SG_GENERAL, SG_DEBUG, "runway marking = " << rwy.marking[rwhalf] );
// Displaced threshold if it exists
if ( rwy.threshold[rwhalf] > 0.0 ) {
SG_LOG( SG_GENERAL, SG_DEBUG, "Displaced threshold for RW side " << rwhalf << " is "
<< rwy.threshold[rwhalf] );
<< rwy.threshold[rwhalf] );
start1_pct = end1_pct;
end1_pct = start1_pct + ( rwy.threshold[rwhalf] / length );
start_pct = end_pct;
end_pct = start_pct + ( rwy.threshold[rwhalf] / length );
Runway::gen_runway_section( runway_half,
start1_pct, end1_pct,
start_pct, end_pct,
0.0, 1.0,
0.0, 1.0, 0.0, 1.0,
heading,
"",
rwy_polys,
rwy_polys,
slivers,
false );
}
// Generate runway
Runway::gen_runway_section( runway_half,
0, 1,
end_pct, 1.0,
0.0, 1.0,
0.0, 0.28, 0.0, 1.0,
heading,
"",
rwy_polys,
rwy_polys,
slivers,
false );
}

View file

@ -2,11 +2,7 @@
#include <simgear/compiler.h>
#include <simgear/structure/exception.hxx>
#include <simgear/debug/logstream.hxx>
#include <simgear/bucket/newbucket.hxx>
#include <simgear/math/sg_geodesy.hxx>
#include <Geometry/poly_support.hxx>
#include <Polygon/polygon.hxx>
#include <simgear/math/SGMath.hxx>
#include "global.hxx"
#include "apt_math.hxx"
@ -18,8 +14,7 @@ extern int nudge;
Taxiway::Taxiway(char* definition)
{
// variables for sdjusting 810 rwy format to 850 rwy format
double pt_x = 0, pt_y = 0;
double az2;
double lon = 0, lat = 0;
// variables to store unused parameters
char designation[16];
@ -52,159 +47,28 @@ Taxiway::Taxiway(char* definition)
width *= SG_FEET_TO_METER;
// adjust lat / lon to the start of the taxiway, not the middle
geo_direct_wgs_84( lat, lon, heading, -length/2, &pt_y, &pt_x, &az2 );
lat = pt_y;
lon = pt_x;
origin = SGGeodesy::direct( SGGeod::fromDeg(lon, lat), heading, -length/2 );
}
int Taxiway::BuildBtg( tgpolygon_list& rwy_polys, tglightcontour_list& rwy_lights, tgcontour_list& slivers, tgPolygon& apt_base, tgPolygon& apt_clearing, bool make_shapefiles )
{
tgContour taxi;
tgContour base, safe_base;
std::string material;
#if 0
void* ds_id = NULL; // If we are going to build shapefiles
void* l_id = NULL; // datasource and layer IDs
if ( make_shapefiles ) {
char ds_name[128];
sprintf(ds_name, "./taxi_debug");
ds_id = tgShapefileOpenDatasource( ds_name );
}
#endif
if ( surface == 1 /* Asphalt */ )
{
if ( (width <= 50) && (lighting[1] == '6') ) {
material = "pa_taxiway";
} else {
material = "pa_tiedown";
}
}
else if ( surface == 2 /* Concrete */ )
{
if ( (width <= 50) && (lighting[1] == '6') ) {
material = "pc_taxiway";
} else {
material = "pc_tiedown";
}
}
else if ( surface == 3 /* Turf/Grass */ )
{
material = "grass_rwy";
}
else if ( surface == 4 /* Dirt */ || surface == 5 /* Gravel */ )
{
material = "dirt_rwy";
}
else if ( surface == 12 /* Dry Lakebed */ )
{
material = "lakebed_taxiway";
}
else if ( surface == 13 /* Water runway (buoy's?) */ )
{
// water
}
else if ( surface == 14 /* Snow / Ice */ )
{
// Ice
}
else if ( surface == 15 /* Transparent */ )
{
//Transparent texture
}
else
{
SG_LOG(SG_GENERAL, SG_WARN, "surface_code = " << surface);
throw sg_exception("unknown runway type!");
}
BuildBtg( rwy_polys, rwy_lights, slivers, make_shapefiles );
// generate a poly for this segment
taxi = gen_wgs84_rect( lat, lon, heading, length, width );
#if 0
if ( make_shapefiles ) {
char layer_name[128];
char feature_name[128];
sprintf( layer_name, "original" );
l_id = tgShapefileOpenLayer( ds_id, layer_name );
sprintf( feature_name, "original" );
tgShapefileCreateFeature( ds_id, l_id, taxi, feature_name );
}
#endif
tgPolygon clipped = tgContour::DiffWithAccumulator( taxi );
tgPolygon::RemoveSlivers( clipped, slivers );
SG_LOG(SG_GENERAL, SG_DEBUG, "tw1 clipped = " << clipped.Contours());
clipped.SetMaterial( material );
clipped.SetTexParams( taxi.GetNode(0), width, 250*SG_FEET_TO_METER, heading );
clipped.SetTexMethod( TG_TEX_BY_TPS_CLIPUV, 0.0, 0.0, 1.0, 1.0 );
rwy_polys.push_back( clipped );
tgContour::AddToAccumulator( taxi );
#if 0
/* If debugging this poly, write the poly, and clipped poly and the accum buffer into their own layers */
if ( make_shapefiles ) {
char layer_name[128];
char feature_name[128];
sprintf( layer_name, "clipped" );
l_id = tgShapefileOpenLayer( ds_id, layer_name );
sprintf( feature_name, "clipped" );
tgShapefileCreateFeature( ds_id, l_id, clipped, feature_name );
}
#endif
taxi = gen_wgs84_rect( origin, heading, length, width );
base = tgContour::Expand( taxi, 20.0);
#if 0
if ( make_shapefiles ) {
char layer_name[128];
char feature_name[128];
sprintf( layer_name, "exp_base" );
l_id = tgShapefileOpenLayer( ds_id, layer_name );
sprintf( feature_name, "exp_base" );
tgShapefileCreateFeature( ds_id, l_id, base, feature_name );
}
#endif
safe_base = tgContour::Expand( taxi, 50.0);
#if 0
if ( make_shapefiles ) {
char layer_name[128];
char feature_name[128];
SG_LOG(SG_GENERAL, SG_INFO, "expanded safe poly: " << safe_base);
sprintf( layer_name, "exp_safe_base" );
l_id = tgShapefileOpenLayer( ds_id, layer_name );
sprintf( feature_name, "exp_safe_base" );
tgShapefileCreateFeature( ds_id, l_id, safe_base, feature_name );
}
#endif
// add this to the airport clearing
apt_clearing = tgPolygon::Union( safe_base, apt_clearing);
// and add the clearing to the base
apt_base = tgPolygon::Union( base, apt_base );
#if 0
if ( make_shapefiles )
{
tgShapefileCloseDatasource( ds_id );
}
#endif
return 0;
}
@ -213,17 +77,6 @@ int Taxiway::BuildBtg( tgpolygon_list& rwy_polys, tglightcontour_list& rwy_light
tgContour taxi;
std::string material;
#if 0
void* ds_id = NULL; // If we are going to build shapefiles
void* l_id = NULL; // datasource and layer IDs
if ( make_shapefiles ) {
char ds_name[128];
sprintf(ds_name, "./taxi_debug");
ds_id = tgShapefileOpenDatasource( ds_name );
}
#endif
if ( surface == 1 /* Asphalt */ )
{
if ( (width <= 50) && (lighting[1] == '6') ) {
@ -271,19 +124,7 @@ int Taxiway::BuildBtg( tgpolygon_list& rwy_polys, tglightcontour_list& rwy_light
}
// generate a poly for this segment
taxi = gen_wgs84_rect( lat, lon, heading, length, width );
#if 0
if ( make_shapefiles ) {
char layer_name[128];
char feature_name[128];
sprintf( layer_name, "original" );
l_id = tgShapefileOpenLayer( ds_id, layer_name );
sprintf( feature_name, "original" );
tgShapefileCreateFeature( ds_id, l_id, taxi, feature_name );
}
#endif
taxi = gen_wgs84_rect( origin, heading, length, width );
tgPolygon clipped = tgContour::DiffWithAccumulator( taxi );
tgPolygon::RemoveSlivers( clipped, slivers );
@ -297,25 +138,5 @@ int Taxiway::BuildBtg( tgpolygon_list& rwy_polys, tglightcontour_list& rwy_light
tgContour::AddToAccumulator( taxi );
#if 0
/* If debugging this poly, write the poly, and clipped poly and the accum buffer into their own layers */
if ( make_shapefiles ) {
char layer_name[128];
char feature_name[128];
sprintf( layer_name, "clipped" );
l_id = tgShapefileOpenLayer( ds_id, layer_name );
sprintf( feature_name, "clipped" );
tgShapefileCreateFeature( ds_id, l_id, clipped, feature_name );
}
#endif
#if 0
if ( make_shapefiles )
{
tgShapefileCloseDatasource( ds_id );
}
#endif
return 0;
}

View file

@ -5,9 +5,6 @@
#include <stdlib.h>
#include <Polygon/polygon.hxx>
#include <Polygon/superpoly.hxx>
#include <Polygon/texparams.hxx>
#include <Geometry/point3d.hxx>
#include "apt_math.hxx"
@ -32,8 +29,7 @@ public:
bool make_shapefiles );
private:
double lat;
double lon;
SGGeod origin;
double heading;
double length;
double width;

View file

@ -2297,7 +2297,7 @@ void tgPolygon::InheritElevations( const tgPolygon& source )
// go back ways
last = -9999.0;
for ( unsigned int j = contours[i].GetSize()-1; j >= 0; --j ) {
for ( unsigned int j = contours[i].GetSize()-1; j > 0; --j ) {
Point3D p = Point3D::fromSGGeod( GetNode(i,j) );
if ( p.z() > -9000 ) {
last = p.z();