Helipads are also back, including some light
This commit is contained in:
parent
1990ce6806
commit
e9a266fdf1
11 changed files with 225 additions and 212 deletions
|
@ -7,6 +7,7 @@ add_executable(genapts850
|
|||
convex_hull.hxx convex_hull.cxx
|
||||
elevations.cxx elevations.hxx
|
||||
global.hxx
|
||||
helipad.hxx helipad.cxx
|
||||
lights.cxx
|
||||
linearfeature.hxx linearfeature.cxx
|
||||
linked_objects.hxx linked_objects.cxx
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
#include "beznode.hxx"
|
||||
#include "runway.hxx"
|
||||
#include "helipad.hxx"
|
||||
#include "airport.hxx"
|
||||
|
||||
#include <list>
|
||||
|
@ -391,6 +392,14 @@ void Airport::BuildBtg(const string& root, const string_list& elev_src )
|
|||
}
|
||||
}
|
||||
|
||||
// Build helipads (use runway poly- and texture list for this)
|
||||
if (helipads.size())
|
||||
{
|
||||
for (i=0; i<helipads.size(); i++ )
|
||||
{
|
||||
helipads[i]->BuildBtg( altitude, &rwy_polys, &rwy_tps, &rwy_lights, &accum, &apt_base, &apt_clearing );
|
||||
}
|
||||
}
|
||||
// Build the pavements
|
||||
if (pavements.size())
|
||||
{
|
||||
|
|
|
@ -6,6 +6,7 @@
|
|||
|
||||
#include "runway.hxx"
|
||||
#include "object.hxx"
|
||||
#include "helipad.hxx"
|
||||
#include "closedpoly.hxx"
|
||||
#include "linearfeature.hxx"
|
||||
#include "linked_objects.hxx"
|
||||
|
@ -27,6 +28,11 @@ public:
|
|||
lightobjects.push_back( lightobj );
|
||||
}
|
||||
|
||||
void AddHelipad( Helipad* helipad )
|
||||
{
|
||||
helipads.push_back( helipad );
|
||||
}
|
||||
|
||||
void AddPavement( ClosedPoly* pavement )
|
||||
{
|
||||
pavements.push_back( pavement );
|
||||
|
@ -71,6 +77,7 @@ private:
|
|||
LightingObjList lightobjects;
|
||||
WindsockList windsocks;
|
||||
BeaconList beacons;
|
||||
HelipadList helipads;
|
||||
};
|
||||
|
||||
typedef std::vector <Airport *> AirportList;
|
||||
|
|
|
@ -1,70 +0,0 @@
|
|||
// rwy_gen.cxx -- Build a runway
|
||||
//
|
||||
// Written by Curtis Olson, started February 2002.
|
||||
//
|
||||
// Copyright (C) 2002 Curtis L. Olson - http://www.flightgear.org/~curt
|
||||
//
|
||||
// This program is free software; you can redistribute it and/or modify
|
||||
// it under the terms of the GNU General Public License as published by
|
||||
// the Free Software Foundation; either version 2 of the License, or
|
||||
// (at your option) any later version.
|
||||
//
|
||||
// This program is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with this program; if not, write to the Free Software
|
||||
// Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
//
|
||||
|
||||
#include <simgear/compiler.h>
|
||||
#include <simgear/constants.h>
|
||||
#include <simgear/debug/logstream.hxx>
|
||||
|
||||
#include "rwy_common.hxx"
|
||||
|
||||
#include <stdlib.h>
|
||||
|
||||
using std::string;
|
||||
|
||||
|
||||
void gen_heli( const TGRunway& rwy_info,
|
||||
double alt_m,
|
||||
const string& material,
|
||||
superpoly_list *rwy_polys,
|
||||
texparams_list *texparams,
|
||||
TGPolygon *accum )
|
||||
{
|
||||
SG_LOG( SG_GENERAL, SG_INFO, "Building helipad = " << rwy_info.rwy_no1 );
|
||||
|
||||
//
|
||||
// Generate the basic helipad outlines
|
||||
//
|
||||
Point3D helicenter = Point3D( rwy_info.lon, rwy_info.lat, 0.0);
|
||||
|
||||
TGPolygon helipad = gen_wgs84_area( helicenter, rwy_info.length, 0, 0, rwy_info.width, rwy_info.heading,
|
||||
alt_m, false);
|
||||
|
||||
double start1_pct = 0.0;
|
||||
double end1_pct = 0.0;
|
||||
double maxsize = rwy_info.width - rwy_info.length;
|
||||
|
||||
if (maxsize <= 0)
|
||||
maxsize = rwy_info.width;
|
||||
else if (maxsize > 0)
|
||||
maxsize = rwy_info.length;
|
||||
|
||||
double percent = (maxsize / rwy_info.length) /2;
|
||||
|
||||
start1_pct = 0.5 - percent;
|
||||
end1_pct = 0.5 + percent;
|
||||
gen_runway_section( rwy_info, helipad,
|
||||
start1_pct, end1_pct,
|
||||
0.0, 1.0,
|
||||
0.0, 1.0, 0.0, 1.0,
|
||||
rwy_info.heading,
|
||||
material, "heli",
|
||||
rwy_polys, texparams, accum );
|
||||
}
|
|
@ -1,49 +0,0 @@
|
|||
// rwy_gen.hxx -- Build a runway
|
||||
//
|
||||
// Written by Curtis Olson, started February 2002.
|
||||
//
|
||||
// Copyright (C) 2002 Curtis L. Olson - http://www.flightgear.org/~curt
|
||||
//
|
||||
// This program is free software; you can redistribute it and/or modify
|
||||
// it under the terms of the GNU General Public License as published by
|
||||
// the Free Software Foundation; either version 2 of the License, or
|
||||
// (at your option) any later version.
|
||||
//
|
||||
// This program is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with this program; if not, write to the Free Software
|
||||
// Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
//
|
||||
// $Id: rwy_prec.hxx,v 1.5 2004-11-19 22:25:49 curt Exp $
|
||||
//
|
||||
|
||||
|
||||
#ifndef _HELI_GEN_HXX
|
||||
#define _HELI_GEN_HXX
|
||||
|
||||
|
||||
#include <Polygon/polygon.hxx>
|
||||
#include <Polygon/superpoly.hxx>
|
||||
|
||||
#include "runway.hxx"
|
||||
#include "texparams.hxx"
|
||||
|
||||
|
||||
// generate a runway. The routine modifies
|
||||
// rwy_polys, texparams, and accum. For specific details and
|
||||
// dimensions of precision runway markings, please refer to FAA
|
||||
// document AC 150/5340-1H
|
||||
|
||||
void gen_heli( const TGRunway& rwy_info,
|
||||
double alt_m,
|
||||
const std::string& material,
|
||||
superpoly_list *rwy_polys,
|
||||
texparams_list *texparams,
|
||||
TGPolygon *accum );
|
||||
|
||||
|
||||
#endif // _RWY_PREC_HXX
|
134
src/Airports/GenAirports850/helipad.cxx
Normal file
134
src/Airports/GenAirports850/helipad.cxx
Normal file
|
@ -0,0 +1,134 @@
|
|||
// This program is free software; you can redistribute it and/or modify
|
||||
// it under the terms of the GNU General Public License as published by
|
||||
// the Free Software Foundation; either version 2 of the License, or
|
||||
// (at your option) any later version.
|
||||
//
|
||||
// This program is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with this program; if not, write to the Free Software
|
||||
// Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
//
|
||||
|
||||
#include <simgear/compiler.h>
|
||||
#include <simgear/constants.h>
|
||||
#include <simgear/debug/logstream.hxx>
|
||||
#include <simgear/math/sg_geodesy.hxx>
|
||||
|
||||
#include "apt_math.hxx"
|
||||
#include "helipad.hxx"
|
||||
#include "runway.hxx"
|
||||
|
||||
#include <stdlib.h>
|
||||
|
||||
Helipad::Helipad(char* definition)
|
||||
{
|
||||
|
||||
// format:
|
||||
// helipad designator lat lon heading length width surface markings shoulder smoothness edge lighting
|
||||
|
||||
// int fscanf(FILE *stream, const char *format, ...);
|
||||
sscanf(definition, "%s %lf %lf %lf %lf %lf %d %d %d %lf %d",
|
||||
&heli.designator, &heli.lat, &heli.lon, &heli.heading, &heli.length, &heli.width, &heli.surface,
|
||||
&heli.marking, &heli.shoulder, &heli.smoothness, &heli.edge_lights);
|
||||
|
||||
SG_LOG(SG_GENERAL, SG_DEBUG, "Read helipad: (" << heli.lon << "," << heli.lat << ") heading: " << heli.heading << " length: " << heli.length << " width: " << heli.width );
|
||||
}
|
||||
|
||||
superpoly_list Helipad::gen_helipad_lights(void){
|
||||
|
||||
point_list c_lights; c_lights.clear();
|
||||
point_list c_normals; c_normals.clear();
|
||||
double lat2, lon2, az2;
|
||||
|
||||
// Create a circle of lights approx. where the white circle is
|
||||
for (int deg=0; deg<360; deg+=10){
|
||||
geo_direct_wgs_84(0, heli.lat, heli.lon, deg ,
|
||||
heli.width * 0.46 , &lat2, &lon2, &az2 );
|
||||
|
||||
c_lights.push_back( Point3D( lon2, lat2, 0.0 ) );
|
||||
|
||||
Point3D tmp = Point3D( lon2, lat2, 0.0 );
|
||||
Point3D vec = sgGeodToCart( tmp * SG_DEGREES_TO_RADIANS );
|
||||
double length = vec.distance3D( Point3D(0.0) );
|
||||
vec = vec / length;
|
||||
c_normals.push_back( vec );
|
||||
}
|
||||
|
||||
TGPolygon lights_poly; lights_poly.erase();
|
||||
TGPolygon normals_poly; normals_poly.erase();
|
||||
lights_poly.add_contour( c_lights, false );
|
||||
normals_poly.add_contour( c_normals, false );
|
||||
|
||||
TGSuperPoly green;
|
||||
green.set_poly( lights_poly );
|
||||
green.set_normals( normals_poly );
|
||||
green.set_material( "RWY_GREEN_LIGHTS" );
|
||||
|
||||
superpoly_list result; result.clear();
|
||||
|
||||
result.push_back( green );
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
void Helipad::BuildBtg( float alt_m,
|
||||
superpoly_list *rwy_polys,
|
||||
texparams_list *texparams,
|
||||
superpoly_list *rwy_lights,
|
||||
TGPolygon *accum, TGPolygon* apt_base, TGPolygon* apt_clearing )
|
||||
{
|
||||
SG_LOG( SG_GENERAL, SG_INFO, "Building helipad = " << heli.designator );
|
||||
|
||||
//
|
||||
// Generate the basic helipad outlines
|
||||
//
|
||||
Point3D helicenter = Point3D( heli.lon, heli.lat, 0.0);
|
||||
|
||||
|
||||
TGPolygon helipad = gen_wgs84_area( helicenter, heli.length, 0, 0, heli.width, heli.heading, alt_m, false);
|
||||
|
||||
double start1_pct = 0.0;
|
||||
double end1_pct = 0.0;
|
||||
double maxsize = heli.width - heli.length;
|
||||
|
||||
if (maxsize <= 0)
|
||||
maxsize = heli.width;
|
||||
else if (maxsize > 0)
|
||||
maxsize = heli.length;
|
||||
|
||||
double percent = (maxsize / heli.length) /2;
|
||||
|
||||
start1_pct = 0.5 - percent;
|
||||
end1_pct = 0.5 + percent;
|
||||
gen_tex_section( helipad,
|
||||
start1_pct, end1_pct,
|
||||
0.0, 1.0,
|
||||
0.0, 1.0, 0.0, 1.0,
|
||||
heli.heading, heli.width, heli.length,
|
||||
"pc_", "heli",
|
||||
rwy_polys, texparams, accum );
|
||||
|
||||
|
||||
// generate area around helipad
|
||||
TGPolygon base, safe_base;
|
||||
base = gen_runway_area_w_extend( 0.0, maxsize * 0.25 , 0.0, 0.0, maxsize * 0.25 );
|
||||
|
||||
// also clear a safe area around the pad
|
||||
safe_base = gen_runway_area_w_extend( 0.0, maxsize * 0.5, 0.0, 0.0, maxsize * 0.5 );
|
||||
|
||||
// add this to the airport clearing
|
||||
*apt_clearing = tgPolygonUnion(safe_base, *apt_clearing);
|
||||
|
||||
// and add the clearing to the base
|
||||
*apt_base = tgPolygonUnion( base, *apt_base );
|
||||
|
||||
// Now generate the helipad lights
|
||||
superpoly_list s = gen_helipad_lights();
|
||||
for ( int i = 0; i < s.size(); ++i ) {
|
||||
rwy_lights->push_back( s[i] );
|
||||
}
|
||||
}
|
68
src/Airports/GenAirports850/helipad.hxx
Normal file
68
src/Airports/GenAirports850/helipad.hxx
Normal file
|
@ -0,0 +1,68 @@
|
|||
// This program is free software; you can redistribute it and/or modify
|
||||
// it under the terms of the GNU General Public License as published by
|
||||
// the Free Software Foundation; either version 2 of the License, or
|
||||
// (at your option) any later version.
|
||||
//
|
||||
// This program is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with this program; if not, write to the Free Software
|
||||
// Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
|
||||
|
||||
#ifndef _HELIPAD_HXX
|
||||
#define _HELIPAD_HXX
|
||||
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
#include <Polygon/polygon.hxx>
|
||||
#include <Polygon/superpoly.hxx>
|
||||
|
||||
#include "texparams.hxx"
|
||||
|
||||
class Helipad
|
||||
{
|
||||
public:
|
||||
Helipad(char* def);
|
||||
void BuildBtg( float alt_m, superpoly_list* heli_polys, texparams_list* texparams, superpoly_list* heli_lights, TGPolygon* accum, TGPolygon* apt_base, TGPolygon* apt_clearing );
|
||||
|
||||
private:
|
||||
struct TGRunway {
|
||||
// data for whole runway
|
||||
int surface;
|
||||
int shoulder;
|
||||
int edge_lights;
|
||||
|
||||
double width;
|
||||
double length;
|
||||
double heading;
|
||||
double smoothness;
|
||||
|
||||
// data for each end
|
||||
char designator[16];
|
||||
double lat;
|
||||
double lon;
|
||||
|
||||
int marking;
|
||||
};
|
||||
|
||||
TGRunway heli;
|
||||
|
||||
// generate an area for a runway with expansion specified in meters
|
||||
// (return result points in degrees)
|
||||
TGPolygon gen_runway_area_w_extend( double alt_m, double length_extend, double displ1, double displ2, double width_extend )
|
||||
{
|
||||
return ( gen_wgs84_area(Point3D(heli.lon, heli.lat, 0.0f), heli.length + 2.0*length_extend, displ1, displ2, heli.width + 2.0*width_extend, heli.heading, alt_m, false) );
|
||||
}
|
||||
|
||||
superpoly_list gen_helipad_lights(void);
|
||||
|
||||
};
|
||||
|
||||
typedef std::vector <Helipad *> HelipadList;
|
||||
|
||||
#endif
|
|
@ -83,44 +83,6 @@ Point3D Runway::gen_runway_light_vector( double angle, bool recip ) {
|
|||
return light_vec;
|
||||
}
|
||||
|
||||
/*static superpoly_list gen_helipad_lights(const TGRunway& rwy_info){
|
||||
|
||||
point_list c_lights; c_lights.clear();
|
||||
point_list c_normals; c_normals.clear();
|
||||
double lat2, lon2, az2;
|
||||
|
||||
// Create a circle of lights approx. where the white circle is
|
||||
for (int deg=0; deg<360; deg+=30){
|
||||
geo_direct_wgs_84(0, rwy_info.lat, rwy_info.lon, deg ,
|
||||
rwy_info.width * 0.46 , &lat2, &lon2, &az2 );
|
||||
|
||||
c_lights->push_back( Point3D( lon2, lat2, 0.0 ) );
|
||||
|
||||
Point3D tmp = Point3D( lon2, lat2, 0.0 );
|
||||
Point3D vec = sgGeodToCart( tmp * SG_DEGREES_TO_RADIANS );
|
||||
double length = vec.distance3D( Point3D(0.0) );
|
||||
vec = vec / length;
|
||||
c_normals.push_back( vec );
|
||||
}
|
||||
|
||||
TGPolygon lights_poly; lights_poly.erase();
|
||||
TGPolygon normals_poly; normals_poly.erase();
|
||||
lights_poly.add_contour( c_lights, false );
|
||||
normals_poly.add_contour( c_normals, false );
|
||||
|
||||
TGSuperPoly green;
|
||||
green.set_poly( lights_poly );
|
||||
green.set_normals( normals_poly );
|
||||
green.set_material( "RWY_GREEN_LIGHTS" );
|
||||
|
||||
superpoly_list result; result.clear();
|
||||
|
||||
result.push_back( green );
|
||||
|
||||
return result;
|
||||
}*/
|
||||
|
||||
|
||||
// generate runway edge lighting
|
||||
// 60 meters spacing or the next number down that divides evenly.
|
||||
superpoly_list Runway::gen_runway_edge_lights( bool recip )
|
||||
|
@ -2634,12 +2596,6 @@ void Runway::gen_runway_lights( float alt_m, superpoly_list *lights, TGPolygon *
|
|||
lights->push_back( s[i] );
|
||||
}
|
||||
}
|
||||
/* if ( rwy_info.type == 102){
|
||||
superpoly_list s = gen_helipad_lights( rwy_info );
|
||||
for ( i = 0; i < s.size(); ++i ) {
|
||||
lights->push_back( s[i] );
|
||||
}
|
||||
}*/
|
||||
|
||||
// Centerline lighting
|
||||
if ( rwy.centerline_lights == 1 /* Has centerline lighting */ ) {
|
||||
|
|
|
@ -273,6 +273,11 @@ int Parser::ParseLine(char* line)
|
|||
case HELIPAD_CODE:
|
||||
SetState( STATE_PARSE_SIMPLE );
|
||||
SG_LOG(SG_GENERAL, SG_DEBUG, "Parsing helipad: " << line);
|
||||
cur_helipad = new Helipad(line);
|
||||
if (cur_airport)
|
||||
{
|
||||
cur_airport->AddHelipad( cur_helipad );
|
||||
}
|
||||
break;
|
||||
|
||||
case PAVEMENT_CODE:
|
||||
|
|
|
@ -86,6 +86,7 @@ private:
|
|||
// (first is outside boundry, remaining are holes)
|
||||
Airport* cur_airport;
|
||||
Runway* cur_runway;
|
||||
Helipad* cur_helipad;
|
||||
ClosedPoly* cur_pavement;
|
||||
LinearFeature* cur_feat;
|
||||
BezNode* prev_node;
|
||||
|
|
|
@ -1,49 +0,0 @@
|
|||
// rwy_gen.hxx -- Build a runway
|
||||
//
|
||||
// Written by Curtis Olson, started February 2002.
|
||||
//
|
||||
// Copyright (C) 2002 Curtis L. Olson - http://www.flightgear.org/~curt
|
||||
//
|
||||
// This program is free software; you can redistribute it and/or modify
|
||||
// it under the terms of the GNU General Public License as published by
|
||||
// the Free Software Foundation; either version 2 of the License, or
|
||||
// (at your option) any later version.
|
||||
//
|
||||
// This program is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with this program; if not, write to the Free Software
|
||||
// Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
//
|
||||
// $Id: rwy_prec.hxx,v 1.5 2004-11-19 22:25:49 curt Exp $
|
||||
//
|
||||
|
||||
|
||||
#ifndef _RWY_PREC_HXX
|
||||
#define _RWY_PREC_HXX
|
||||
|
||||
|
||||
#include <Polygon/polygon.hxx>
|
||||
#include <Polygon/superpoly.hxx>
|
||||
|
||||
#include "runway.hxx"
|
||||
#include "texparams.hxx"
|
||||
|
||||
|
||||
// generate a runway. The routine modifies
|
||||
// rwy_polys, texparams, and accum. For specific details and
|
||||
// dimensions of precision runway markings, please refer to FAA
|
||||
// document AC 150/5340-1H
|
||||
|
||||
void gen_rwy( const TGRunway& rwy_info,
|
||||
double alt_m,
|
||||
const std::string& material,
|
||||
superpoly_list *rwy_polys,
|
||||
texparams_list *texparams,
|
||||
TGPolygon *accum );
|
||||
|
||||
|
||||
#endif // _RWY_PREC_HXX
|
Loading…
Add table
Reference in a new issue