1
0
Fork 0

[GenAirports] whitespace, header guard, spelling

This commit is contained in:
scttgs0 2023-05-12 22:51:50 -05:00
parent 777ea6ab92
commit f5e6c3821f
15 changed files with 381 additions and 418 deletions

View file

@ -1,24 +1,20 @@
#ifndef _APT_MATH_HXX_
#define _APT_MATH_HXX_
#pragma once
#include <terragear/tg_polygon.hxx>
tgContour gen_wgs84_area( SGGeod origin,
double length_m,
double displ1,
double displ2,
double width_m,
double heading_deg,
bool add_mid );
tgContour gen_wgs84_area(SGGeod origin,
double length_m,
double displ1,
double displ2,
double width_m,
double heading_deg,
bool add_mid);
tgContour gen_wgs84_area( SGGeod end1, SGGeod end2,
double length_ext,
double displ1, double displ2,
double width_m,
double heading_deg,
bool add_mid );
tgContour gen_wgs84_area(SGGeod end1, SGGeod end2,
double length_ext,
double displ1, double displ2,
double width_m,
double heading_deg,
bool add_mid);
tgContour gen_wgs84_rect( SGGeod origin, double heading, double length, double width );
#endif
tgContour gen_wgs84_rect(SGGeod origin, double heading, double length, double width);

View file

@ -1,7 +1,7 @@
#pragma once
#include <vector>
#include <memory>
#include <vector>
#include <simgear/debug/logstream.hxx>
#include <simgear/math/SGMath.hxx>

View file

@ -1,5 +1,4 @@
#ifndef _BEZPOLY_H_
#define _BEZPOLY_H_
#pragma once
#include <memory>
@ -8,35 +7,36 @@
#include "beznode.hxx"
#include "linearfeature.hxx"
class ClosedPoly
{
public:
explicit ClosedPoly( char* desc );
ClosedPoly( int st, float s, float th, char* desc );
~ClosedPoly();
explicit ClosedPoly(char* desc);
ClosedPoly(int st, float s, float th, char* desc);
~ClosedPoly();
inline std::string GetDescription() { return description; }
void AddNode( std::shared_ptr<BezNode> node );
void AddNode(std::shared_ptr<BezNode> node);
void CloseCurContour();
void Finish();
// Build BTG for airport base for airports with boundary
int BuildBtg( tgPolygon& apt_base,
tgPolygon& apt_clearing,
std::string& shapefile_name );
int BuildBtg(tgPolygon& apt_base,
tgPolygon& apt_clearing,
std::string& shapefile_name);
// Build BTG for pavements for airports with no boundary
int BuildBtg( tgpolygon_list& rwy_polys,
tgcontour_list& slivers,
tgAccumulator& accum,
std::string& shapefile_name );
int BuildBtg(tgpolygon_list& rwy_polys,
tgcontour_list& slivers,
tgAccumulator& accum,
std::string& shapefile_name);
int BuildBtg( tgpolygon_list& rwy_polys,
tgcontour_list& slivers,
tgpolygon_list& apt_base_polys,
tgpolygon_list& apt_clearing_polys,
tgAccumulator& accum,
std::string& shapefile_name );
int BuildBtg(tgpolygon_list& rwy_polys,
tgcontour_list& slivers,
tgpolygon_list& apt_base_polys,
tgpolygon_list& apt_clearing_polys,
tgAccumulator& accum,
std::string& shapefile_name);
FeatureList& GetFeatures()
{
@ -45,17 +45,17 @@ public:
private:
// convert the BezierPoly to a normal Poly (adding nodes for the curves)
void CreateConvexHull( void );
void ConvertContour( const BezContour& src, tgContour& dst );
std::string GetMaterial( int surface );
void CreateConvexHull(void);
void ConvertContour(const BezContour& src, tgContour& dst);
std::string GetMaterial(int surface);
bool is_pavement;
bool is_border;
bool has_feature;
int surface_type;
float smoothness;
bool is_pavement;
bool is_border;
bool has_feature;
int surface_type;
float smoothness;
double texture_heading;
std::string description;
@ -80,5 +80,3 @@ private:
};
typedef std::vector<std::shared_ptr<ClosedPoly>> PavementList;
#endif

View file

@ -1,3 +1,5 @@
#pragma once
#include <map>
#include <string>
#include <cstring>
@ -6,10 +8,7 @@
#include <simgear/threads/SGThread.hxx>
#include <simgear/debug/logstream.hxx>
#ifndef __DEBUG_HXX__
#define __DEBUG_HXX__
/* a debug map maps ICAOs to a vector of indexs we want to debug */
/* a debug map maps ICAOs to a vector of indexes we want to debug */
typedef std::map<std::string, std::vector<int>, std::less<std::string> > debug_map;
typedef debug_map::iterator debug_map_iterator;
typedef debug_map::const_iterator debug_map_const_iterator;
@ -20,11 +19,10 @@ extern std::map<long, std::string> thread_prefix_map;
extern void DebugRegisterPrefix( const std::string& prefix );
extern std::string DebugTimeToString(time_t& tt);
#define TG_LOG(C,P,M) do { \
if(sglog().would_log(C,P, __FILE__, __LINE__, __FUNCTION__)) { \
std::ostringstream os; \
os << thread_prefix_map[SGThread::current()] << ":" << M; \
sglog().log(C, P, __FILE__, __LINE__, __FUNCTION__, os.str()); \
} \
#define TG_LOG(C,P,M) do { \
if(sglog().would_log(C,P, __FILE__, __LINE__, __FUNCTION__)) { \
std::ostringstream os; \
os << thread_prefix_map[SGThread::current()] << ":" << M; \
sglog().log(C, P, __FILE__, __LINE__, __FUNCTION__, os.str()); \
} \
} while(0)
#endif

View file

@ -20,16 +20,18 @@
// Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA.
//
#pragma once
#include <terragear/tg_surface.hxx>
// lookup node elevations for each point in the SGGeod list. Returns
// average of all points. Doesn't modify the original list.
double tgAverageElevation( const std::string &root, const string_list elev_src,
const std::vector<SGGeod>& points_source );
double tgAverageElevation(const std::string& root, const string_list elev_src,
const std::vector<SGGeod>& points_source);
// lookup node elevations for each point in the specified nurbs++
// matrix.
void tgCalcElevations( const std::string &root, const string_list elev_src, tgMatrix& Pts, double average );
void tgCalcElevations(const std::string& root, const string_list elev_src, tgMatrix& Pts, double average);
// clamp all elevations to the specified range
void tgClampElevations( tgMatrix& Pts, double center_m, double max_clamp_m );
void tgClampElevations(tgMatrix& Pts, double center_m, double max_clamp_m);

View file

@ -21,17 +21,11 @@
// $Id: global.hxx,v 1.9 2005-10-31 18:43:27 curt Exp $
//
#ifndef _GEN_AIRPORT_GLOBAL_HXX
#define _GEN_AIRPORT_GLOBAL_HXX
#pragma once
extern int nudge;
// Each polygon vertex is snapped to a grid with this resolution (~1cm by default)
extern double gSnap;
extern double slope_max;
extern double slope_eps;
#endif

View file

@ -12,33 +12,33 @@
// along with this program; if not, write to the Free Software
// Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA.
#ifndef _HELIPAD_HXX
#define _HELIPAD_HXX
#pragma once
#include <memory>
#include "runway.hxx"
#include <terragear/tg_polygon.hxx>
#include <terragear/tg_accumulator.hxx>
#include <terragear/tg_light.hxx>
#include <terragear/tg_polygon.hxx>
#include "runway.hxx"
class Helipad
{
public:
explicit Helipad(char* def);
void BuildBtg( tgpolygon_list& heli_polys,
tglightcontour_list& heli_lights,
tgcontour_list& slivers,
tgAccumulator& accum );
void BuildBtg(tgpolygon_list& heli_polys,
tglightcontour_list& heli_lights,
tgcontour_list& slivers,
tgAccumulator& accum);
void BuildBtg( tgpolygon_list& heli_polys,
tglightcontour_list& heli_lights,
tgcontour_list& slivers,
tgpolygon_list& apt_base_polys,
tgpolygon_list& apt_clearing_polys,
tgAccumulator& accum );
void BuildBtg(tgpolygon_list& heli_polys,
tglightcontour_list& heli_lights,
tgcontour_list& slivers,
tgpolygon_list& apt_base_polys,
tgpolygon_list& apt_clearing_polys,
tgAccumulator& accum);
SGGeod GetLoc()
{
@ -50,50 +50,46 @@ public:
return (heli.surface < 3) ? true : false;
}
void BuildShoulder( tgpolygon_list& rwy_polys,
tgcontour_list& slivers,
tgAccumulator& accum
);
void BuildShoulder(tgpolygon_list& rwy_polys,
tgcontour_list& slivers,
tgAccumulator& accum);
private:
struct TGRunway {
// data for helipad
char designator[16];
double lat;
double lon;
double heading;
double length;
double width;
int surface;
int marking;
int shoulder;
double smoothness;
int edge_lights;
char designator[16];
double lat;
double lon;
double heading;
double length;
double width;
int surface;
int marking;
int shoulder;
double smoothness;
int edge_lights;
};
TGRunway heli;
// generate an area for a runway with expansion specified in meters
// (return result points in degrees)
tgContour gen_helipad_area_w_extend( double length_extend, double width_extend )
tgContour gen_helipad_area_w_extend(double length_extend, double width_extend)
{
return ( gen_wgs84_area( GetLoc(), heli.length + 2.0*length_extend, 0.0, 0.0, heli.width + 2.0*width_extend, heli.heading, false) );
return (gen_wgs84_area(GetLoc(), heli.length + 2.0 * length_extend, 0.0, 0.0, heli.width + 2.0 * width_extend, heli.heading, false));
}
tglightcontour_list gen_helipad_lights(double maxsize);
void build_helipad_shoulders( const tgContour& outer_area );
void build_helipad_shoulders(const tgContour& outer_area);
// storage for Shoulders - The superpolys are generated during
// storage for Shoulders - The super-polys are generated during
// helipad construction, but not clipped until shoulder construction.
tgpolygon_list shoulder_polys;
tgPolygon WriteGeom( const tgContour& area,
std::string material,
tgpolygon_list& rwy_polys,
tgcontour_list& slivers );
tgpolygon_list shoulder_polys;
tgPolygon WriteGeom(const tgContour& area,
std::string material,
tgpolygon_list& rwy_polys,
tgcontour_list& slivers);
};
typedef std::vector<std::shared_ptr<Helipad>> HelipadList;
#endif

View file

@ -1,11 +1,11 @@
#ifndef _LINEARFEATURE_H_
#define _LINEARFEATURE_H_
#pragma once
#include <memory>
#include <terragear/tg_polygon.hxx>
#include <terragear/tg_accumulator.hxx>
#include <terragear/tg_light.hxx>
#include <terragear/tg_polygon.hxx>
#include "beznode.hxx"
@ -81,8 +81,7 @@
#define LF_UNIDIR_GREEN (107)
#define LF_UNIDIR_GREEN_AMBER (108)
struct Marking
{
struct Marking {
public:
unsigned int type;
unsigned int start_idx;
@ -90,8 +89,7 @@ public:
};
typedef std::vector<Marking*> MarkingList;
struct Lighting
{
struct Lighting {
public:
unsigned int type;
unsigned int start_idx;
@ -102,8 +100,10 @@ public:
// 0 for omnidirectional
int LightDirection()
{
if (type == 103 || type == 104) return 1;
else if (type == 101 || type == 105) return 2;
if (type == 103 || type == 104)
return 1;
else if (type == 101 || type == 105)
return 2;
return 0;
}
};
@ -112,15 +112,13 @@ typedef std::vector<Lighting*> LightingList;
class LinearFeature
{
public:
LinearFeature( char* desc, double o ) :
LinearFeature(std::string(desc ? desc : "none"), o)
LinearFeature(char* desc, double o) : LinearFeature(std::string(desc ? desc : "none"), o)
{
}
LinearFeature( const std::string& desc, double o ) :
cur_mark(nullptr),
cur_light(nullptr),
description(desc)
LinearFeature(const std::string& desc, double o) : cur_mark(nullptr),
cur_light(nullptr),
description(desc)
{
offset = o;
width = 0;
@ -130,39 +128,37 @@ public:
inline std::string GetDescription() { return description; }
void AddNode( std::shared_ptr<BezNode> b )
void AddNode(std::shared_ptr<BezNode> b)
{
contour.push_back( b );
contour.push_back(b);
}
int Finish( bool closed, unsigned int idx );
int BuildBtg( tgpolygon_list& line_polys, tglightcontour_list& lights, tgAccumulator& accum, bool debug );
int Finish(bool closed, unsigned int idx);
int BuildBtg(tgpolygon_list& line_polys, tglightcontour_list& lights, tgAccumulator& accum, bool debug);
private:
double offset;
double width;
double offset;
double width;
MarkingList marks;
Marking* cur_mark;
MarkingList marks;
Marking* cur_mark;
LightingList lights;
Lighting* cur_light;
LightingList lights;
Lighting* cur_light;
void ConvertContour( const BezContour& src, bool closed );
void ConvertContour(const BezContour& src, bool closed);
// text description
std::string description;
// contour definition (each beznode has marking type)
BezContour contour;
BezContour contour;
// contour definition after bezier interpolation
tgContour points;
tgContour points;
tgpolygon_list marking_polys;
tgpolygon_list marking_polys;
tglightcontour_list lighting_polys;
};
typedef std::vector<std::shared_ptr<LinearFeature>> FeatureList;
#endif

View file

@ -1,10 +1,10 @@
#ifndef _LINKED_OBJECTS_H_
#define _LINKED_OBJECTS_H_
#pragma once
#include <memory>
#include <terragear/tg_polygon.hxx>
class Windsock
{
public:
@ -58,8 +58,8 @@ public:
double lat;
double lon;
double heading;
int reserved;
int size;
int reserved;
int size;
std::string sgn_def;
SGGeod GetLoc()
@ -84,5 +84,3 @@ public:
};
typedef std::vector<std::shared_ptr<Sign>> SignList;
#endif

View file

@ -1,11 +1,11 @@
#ifndef _OBJECT_H_
#define _OBJECT_H_
#pragma once
#include <memory>
#include <terragear/tg_light.hxx>
#include <terragear/tg_polygon.hxx>
class LightingObj
{
public:
@ -19,9 +19,7 @@ public:
char assoc_rw;
void BuildBtg( tglightcontour_list& lights );
void BuildBtg(tglightcontour_list& lights);
};
typedef std::vector<std::shared_ptr<LightingObj>> LightingObjList;
#endif
typedef std::vector<std::shared_ptr<LightingObj>> LightingObjList;

View file

@ -19,31 +19,27 @@
// Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA.
//
#ifndef _OUTPUT_HXX
#define _OUTPUT_HXX
#pragma once
#ifdef HAVE_CONFIG_H
#include <config.h>
#endif
// update index file (list of objects to be included in final scenery build)
void write_index_object( const std::string& base, const SGBucket& b, const std::string& name );
void write_index_object(const std::string& base, const SGBucket& b, const std::string& name);
// update index file (list of shared objects to be included in final scenery build)
void write_index_object_shared( const std::string &base, const SGBucket &b,
const SGGeod &p, const std::string& name,
const double &heading );
void write_index_object_shared(const std::string& base, const SGBucket& b,
const SGGeod& p, const std::string& name,
const double& heading);
// update index file (list of shared objects to be included in final scenery build)
void write_index_object_sign( const std::string &base, const SGBucket &b,
const SGGeod &p, const std::string& sign,
const double &heading, const int &size );
void write_index_object_sign(const std::string& base, const SGBucket& b,
const SGGeod& p, const std::string& sign,
const double& heading, const int& size);
// purge the existing index file when it already exists
void truncate_index_file( const std::string& fileName );
void truncate_index_file(const std::string& fileName);
// record index files that have been cleaned
std::set<std::string> cleanIndexFiles;
#endif

View file

@ -16,103 +16,103 @@
#include "trafficFlow.hxx"
#define STATE_NONE (1)
#define STATE_PARSE_SIMPLE (2)
#define STATE_PARSE_BOUNDARY (3)
#define STATE_PARSE_PAVEMENT (4)
#define STATE_PARSE_FEATURE (5)
#define STATE_DONE (10)
#define STATE_NONE (1)
#define STATE_PARSE_SIMPLE (2)
#define STATE_PARSE_BOUNDARY (3)
#define STATE_PARSE_PAVEMENT (4)
#define STATE_PARSE_FEATURE (5)
#define STATE_DONE (10)
//-------------------------------------
// [[deprecated]]
#define TAXIWAY_CODE (10)
#define TAXIWAY_CODE (10)
// [[deprecated]]
#define AIRPLANE_STARTUP_LOCATION_CODE (15)
#define AIRPLANE_STARTUP_LOCATION_CODE (15)
// [[deprecated]]
#define COMM_FREQ1_CODE (50)
#define COMM_FREQ1_CODE (50)
// [[deprecated]]
#define COMM_FREQ2_CODE (51)
#define COMM_FREQ2_CODE (51)
// [[deprecated]]
#define COMM_FREQ3_CODE (52)
#define COMM_FREQ3_CODE (52)
// [[deprecated]]
#define COMM_FREQ4_CODE (53)
#define COMM_FREQ4_CODE (53)
// [[deprecated]]
#define COMM_FREQ5_CODE (54)
#define COMM_FREQ5_CODE (54)
// [[deprecated]]
#define COMM_FREQ6_CODE (55)
#define COMM_FREQ6_CODE (55)
// [[deprecated]]
#define COMM_FREQ7_CODE (56)
#define COMM_FREQ7_CODE (56)
// [[deprecated]]
#define RWY_ARR_DEP_CONSTRAINTS (1100)
#define RWY_ARR_DEP_CONSTRAINTS (1100)
//-------------------------------------
#define LAND_AIRPORT_CODE (1)
#define SEA_AIRPORT_CODE (16)
#define HELIPORT_CODE (17)
#define LAND_AIRPORT_CODE (1)
#define SEA_AIRPORT_CODE (16)
#define HELIPORT_CODE (17)
#define AIRPORT_VIEWPOINT_CODE (14)
#define LIGHT_BEACON_CODE (18)
#define WINDSOCK_CODE (19)
#define TAXIWAY_SIGN (20)
#define LIGHTING_OBJECT (21)
#define AIRPORT_VIEWPOINT_CODE (14)
#define LIGHT_BEACON_CODE (18)
#define WINDSOCK_CODE (19)
#define TAXIWAY_SIGN (20)
#define LIGHTING_OBJECT (21)
#define LAND_RUNWAY_CODE (100)
#define WATER_RUNWAY_CODE (101)
#define HELIPAD_CODE (102)
#define LAND_RUNWAY_CODE (100)
#define WATER_RUNWAY_CODE (101)
#define HELIPAD_CODE (102)
#define PAVEMENT_CODE (110)
#define NODE_CODE (111)
#define BEZIER_NODE_CODE (112)
#define CLOSE_NODE_CODE (113)
#define CLOSE_BEZIER_NODE_CODE (114)
#define TERM_NODE_CODE (115)
#define TERM_BEZIER_NODE_CODE (116)
#define PAVEMENT_CODE (110)
#define NODE_CODE (111)
#define BEZIER_NODE_CODE (112)
#define CLOSE_NODE_CODE (113)
#define CLOSE_BEZIER_NODE_CODE (114)
#define TERM_NODE_CODE (115)
#define TERM_BEZIER_NODE_CODE (116)
#define LINEAR_FEATURE_CODE (120)
#define BOUNDARY_CODE (130)
#define LINEAR_FEATURE_CODE (120)
#define BOUNDARY_CODE (130)
#define END_OF_FILE (99)
#define END_OF_FILE (99)
// TODO: not implemented yet
#define TRAFFIC_FLOW_HEADER (1000)
#define TRAFFIC_FLOW_WIND_RULE (1001)
#define TRAFFIC_FLOW_MIN_CEILING_RULE (1002)
#define TRAFFIC_FLOW_HEADER (1000)
#define TRAFFIC_FLOW_WIND_RULE (1001)
#define TRAFFIC_FLOW_MIN_CEILING_RULE (1002)
#define TRAFFIC_FLOW_MIN_VISIBILITY_RULE (1003)
#define TRAFFIC_FLOW_TIME_RULE (1004)
#define TRAFFIC_FLOW_TIME_RULE (1004)
#define COMM_RECORDED (1050) // 8.33 kHz; AWOS, ASOS or ATIS
#define COMM_UNICOM (1051) // 8.33 kHz; Unicom (US), CTAF (US), Radio (UK)
#define COMM_CLD (1052) // 8.33 kHz; Clearance Delivery
#define COMM_GND (1053) // 8.33 kHz; Ground
#define COMM_TWR (1054) // 8.33 kHz; Tower
#define COMM_APP (1055) // 8.33 kHz; Approach
#define COMM_DEP (1056) // 8.33 kHz; Departure
#define COMM_RECORDED (1050) // 8.33 kHz; AWOS, ASOS or ATIS
#define COMM_UNICOM (1051) // 8.33 kHz; Unicom (US), CTAF (US), Radio (UK)
#define COMM_CLD (1052) // 8.33 kHz; Clearance Delivery
#define COMM_GND (1053) // 8.33 kHz; Ground
#define COMM_TWR (1054) // 8.33 kHz; Tower
#define COMM_APP (1055) // 8.33 kHz; Approach
#define COMM_DEP (1056) // 8.33 kHz; Departure
#define VFR_TRAFFIC_PATTERN (1101)
#define RWY_IN_USE_CONSTRAINTS (1110)
#define VFR_TRAFFIC_PATTERN (1101)
#define RWY_IN_USE_CONSTRAINTS (1110)
#define TAXI_ROUTE_NETWORK_HEADER (1200)
#define TAXI_ROUTE_NETWORK_NODE (1201)
#define TAXI_ROUTE_NETWORK_EDGE (1202)
#define TAXI_ROUTE_NETWORK_OBSOLETE (1203)
#define TAXI_ROUTE_EDGE_ACTIVE_ZONE (1204)
#define TAXI_ROUTE_EDGE_CONTROL (1205)
#define TAXI_ROUTE_NETWORK_HEADER (1200)
#define TAXI_ROUTE_NETWORK_NODE (1201)
#define TAXI_ROUTE_NETWORK_EDGE (1202)
#define TAXI_ROUTE_NETWORK_OBSOLETE (1203)
#define TAXI_ROUTE_EDGE_ACTIVE_ZONE (1204)
#define TAXI_ROUTE_EDGE_CONTROL (1205)
#define TAXI_ROUTE_EDGE_GROUND_VEHICLES (1206)
#define START_UP_LOCATION (1300)
#define START_UP_LOCATION_METADATA (1301)
#define START_UP_LOCATION (1300)
#define START_UP_LOCATION_METADATA (1301)
#define AIRPORT_IDENTIFICATION_METADATA (1302)
#define TRUCK_PARKING_LOCATION (1400)
#define TRUCK_DESTINATION_LOCATION (1401)
#define TRUCK_PARKING_LOCATION (1400)
#define TRUCK_DESTINATION_LOCATION (1401)
#define JETWAY_ACTIVE (1500)
#define JETWAY_CUSTOM (1501)
#define JETWAY_ACTIVE (1500)
#define JETWAY_CUSTOM (1501)
class Parser : public SGThread

View file

@ -1,18 +1,17 @@
#ifndef _RUNWAY_H_
#define _RUNWAY_H_
#pragma once
#include <memory>
#include <terragear/tg_polygon.hxx>
#include <terragear/tg_accumulator.hxx>
#include <terragear/tg_light.hxx>
#include <terragear/tg_polygon.hxx>
#include "apt_math.hxx"
class Runway
{
public:
explicit Runway(char* def);
SGGeod GetStart()
@ -27,7 +26,7 @@ public:
SGGeod GetMidpoint()
{
return SGGeod::fromDeg( (rwy.lon[0]+rwy.lon[1])/2.0f, (rwy.lat[0]+rwy.lat[1])/2.0f);
return SGGeod::fromDeg((rwy.lon[0] + rwy.lon[1]) / 2.0f, (rwy.lat[0] + rwy.lat[1]) / 2.0f);
}
bool GetsShoulder()
@ -35,120 +34,120 @@ public:
return (rwy.surface < 3) ? true : false;
}
int BuildBtg( tgpolygon_list& rwy_polys,
tglightcontour_list& rwy_lights,
tgcontour_list& slivers,
tgAccumulator& accum,
std::string& shapefile_name );
int BuildBtg(tgpolygon_list& rwy_polys,
tglightcontour_list& rwy_lights,
tgcontour_list& slivers,
tgAccumulator& accum,
std::string& shapefile_name);
int BuildBtg( tgpolygon_list& rwy_polys,
tglightcontour_list& rwy_lights,
tgcontour_list& slivers,
tgpolygon_list& apt_base_polys,
tgpolygon_list& apt_clearing_polys,
tgAccumulator& accum,
std::string& shapefile_name );
int BuildBtg(tgpolygon_list& rwy_polys,
tglightcontour_list& rwy_lights,
tgcontour_list& slivers,
tgpolygon_list& apt_base_polys,
tgpolygon_list& apt_clearing_polys,
tgAccumulator& accum,
std::string& shapefile_name);
void BuildShoulder( tgpolygon_list& rwy_polys,
tgcontour_list& slivers,
tgAccumulator& accum );
void BuildShoulder(tgpolygon_list& rwy_polys,
tgcontour_list& slivers,
tgAccumulator& accum);
private:
struct TGRunway {
// data for whole runway
int surface;
int shoulder;
int centerline_lights;
int edge_lights;
int dist_remain_signs;
int surface;
int shoulder;
int centerline_lights;
int edge_lights;
int dist_remain_signs;
double width;
double length;
double heading;
double smoothness;
double width;
double length;
double heading;
double smoothness;
// data for each end
char rwnum[2][16];
double lat[2];
double lon[2];
double threshold[2];
double overrun[2];
char rwnum[2][16];
double lat[2];
double lon[2];
double threshold[2];
double overrun[2];
int marking[2];
int approach_lights[2];
int tz_lights[2];
int reil[2];
int marking[2];
int approach_lights[2];
int tz_lights[2];
int reil[2];
};
TGRunway rwy;
std::string material_prefix;
TGRunway rwy;
std::string material_prefix;
// storage for Shoulders - The superpolys are generated during rwy construction,
// storage for Shoulders - The super-polys are generated during rwy construction,
// but not clipped until shoulder construction.
tgpolygon_list shoulder_polys;
tgpolygon_list shoulder_polys;
// Build Helpers:
// generate an area for a runway and include midpoints
tgContour gen_runway_w_mid( double length_extend_m, double width_extend_m )
tgContour gen_runway_w_mid(double length_extend_m, double width_extend_m)
{
return ( gen_wgs84_area( GetStart(), GetEnd(), 2.0*length_extend_m, 0.0, 0.0, rwy.width + 2.0 * width_extend_m, rwy.heading, true) );
return (gen_wgs84_area(GetStart(), GetEnd(), 2.0 * length_extend_m, 0.0, 0.0, rwy.width + 2.0 * width_extend_m, rwy.heading, true));
}
// generate an area for a runway with expansion specified in meters
// (return result points in degrees)
tgContour gen_runway_area_w_extend( double length_extend, double displ1, double displ2, double width_extend )
tgContour gen_runway_area_w_extend(double length_extend, double displ1, double displ2, double width_extend)
{
return ( gen_wgs84_area( GetStart(), GetEnd(), 2.0*length_extend, displ1, displ2, rwy.width + 2.0*width_extend, rwy.heading, false) );
return (gen_wgs84_area(GetStart(), GetEnd(), 2.0 * length_extend, displ1, displ2, rwy.width + 2.0 * width_extend, rwy.heading, false));
}
void gen_rw_designation( tgPolygon poly, double heading, std::string rwname,
double &start_pct, double &end_pct,
tgpolygon_list& rwy_polys,
tgcontour_list& slivers,
tgAccumulator& accum,
std::string& shapefile_name );
void gen_rw_designation(tgPolygon poly, double heading, std::string rwname,
double& start_pct, double& end_pct,
tgpolygon_list& rwy_polys,
tgcontour_list& slivers,
tgAccumulator& accum,
std::string& shapefile_name);
// generate a section of runway with shoulders
void gen_runway_section( const tgPolygon& runway,
double startl_pct, double endl_pct,
double startw_pct, double endw_pct,
double minu, double maxu, double minv, double maxv,
double heading,
const std::string& material,
tgpolygon_list& rwy_polys,
tgpolygon_list& shoulder_polys,
tgcontour_list& slivers,
tgAccumulator& accum,
std::string& shapefile_name );
void gen_runway_section(const tgPolygon& runway,
double startl_pct, double endl_pct,
double startw_pct, double endw_pct,
double minu, double maxu, double minv, double maxv,
double heading,
const std::string& material,
tgpolygon_list& rwy_polys,
tgpolygon_list& shoulder_polys,
tgcontour_list& slivers,
tgAccumulator& accum,
std::string& shapefile_name);
// generate a section of runway without shoulders
void gen_runway_section( const tgPolygon& runway,
double startl_pct, double endl_pct,
double startw_pct, double endw_pct,
double minu, double maxu, double minv, double maxv,
double heading,
const std::string& material,
tgpolygon_list& rwy_polys,
tgcontour_list& slivers,
tgAccumulator& accum,
std::string& shapefile_name );
void gen_runway_section(const tgPolygon& runway,
double startl_pct, double endl_pct,
double startw_pct, double endw_pct,
double minu, double maxu, double minv, double maxv,
double heading,
const std::string& material,
tgpolygon_list& rwy_polys,
tgcontour_list& slivers,
tgAccumulator& accum,
std::string& shapefile_name);
// generate a section of shoulder
tgPolygon gen_shoulder_section( SGGeod& p0, SGGeod& p1,
SGGeod& t0, SGGeod& t1,
int side,
double heading,
double width,
std::string surface );
tgPolygon gen_shoulder_section(SGGeod& p0, SGGeod& p1,
SGGeod& t0, SGGeod& t1,
int side,
double heading,
double width,
std::string surface);
void gen_simple_rwy( tgpolygon_list& rwy_polys, tgcontour_list& slivers, tgAccumulator& accum );
void gen_rwy( tgpolygon_list& rwy_polys,
tgcontour_list& slivers,
tgAccumulator& accum,
std::string& shapefile_name );
void gen_simple_rwy(tgpolygon_list& rwy_polys, tgcontour_list& slivers, tgAccumulator& accum);
void gen_runway_lights( tglightcontour_list& lights );
void gen_rwy(tgpolygon_list& rwy_polys,
tgcontour_list& slivers,
tgAccumulator& accum,
std::string& shapefile_name);
void gen_runway_lights(tglightcontour_list& lights);
int get_thresh0(bool recip)
{
@ -165,20 +164,20 @@ private:
return (rwy.threshold[get_thresh0(recip)] > 60.0) ? true : false;
}
SGVec3f gen_runway_light_vector( float angle, bool recip );
tglightcontour_list gen_runway_edge_lights( bool recip );
tglightcontour_list gen_runway_threshold_lights( const int kind, bool recip );
tglightcontour_list gen_runway_center_line_lights( bool recip );
tgLightContour gen_touchdown_zone_lights( bool recip );
tgLightContour gen_reil( const int kind, bool recip );
tglightcontour_list gen_calvert( const std::string &kind, bool recip );
tglightcontour_list gen_alsf( const std::string &kind, bool recip );
tgLightContour gen_odals( const int kind, bool recip );
tglightcontour_list gen_ssalx( const std::string& kind, bool recip );
tglightcontour_list gen_malsx( const std::string& kind, bool recip );
SGVec3f gen_runway_light_vector(float angle, bool recip);
tglightcontour_list gen_runway_edge_lights(bool recip);
tglightcontour_list gen_runway_threshold_lights(const int kind, bool recip);
tglightcontour_list gen_runway_center_line_lights(bool recip);
tgLightContour gen_touchdown_zone_lights(bool recip);
tgLightContour gen_reil(const int kind, bool recip);
tglightcontour_list gen_calvert(const std::string& kind, bool recip);
tglightcontour_list gen_alsf(const std::string& kind, bool recip);
tgLightContour gen_odals(const int kind, bool recip);
tglightcontour_list gen_ssalx(const std::string& kind, bool recip);
tglightcontour_list gen_malsx(const std::string& kind, bool recip);
};
typedef std::vector <std::shared_ptr<Runway>> RunwayList;
typedef std::vector<std::shared_ptr<Runway>> RunwayList;
class WaterRunway
@ -190,21 +189,19 @@ public:
SGGeod GetStart(void)
{
return SGGeod::fromDeg( lon[0], lat[0] );
return SGGeod::fromDeg(lon[0], lat[0]);
}
SGGeod GetEnd(void)
{
return SGGeod::fromDeg( lon[1], lat[1] );
return SGGeod::fromDeg(lon[1], lat[1]);
}
private:
double width;
int buoys;
char rwnum[2][16];
double lat[2];
double lon[2];
double width;
int buoys;
char rwnum[2][16];
double lat[2];
double lon[2];
};
typedef std::vector <std::shared_ptr<WaterRunway>> WaterRunwayList;
#endif
typedef std::vector<std::shared_ptr<WaterRunway>> WaterRunwayList;

View file

@ -1,5 +1,4 @@
#ifndef __SCHEDULER_HXX__
#define __SCHEDULER_HXX__
#pragma once
#include <string>
#include <iostream>
@ -13,18 +12,19 @@
#include <terragear/tg_rectangle.hxx>
#include "airport.hxx"
#define P_STATE_INIT (0)
#define P_STATE_PARSE (1)
#define P_STATE_BUILD (2)
#define P_STATE_TRIANGULATE (3)
#define P_STATE_OUTPUT (4)
#define P_STATE_DONE (8)
#define P_STATE_KILLED (9)
#define P_STATE_INIT_TIME ( 1*60)
#define P_STATE_PARSE_TIME ( 1*60)
#define P_STATE_INIT (0)
#define P_STATE_PARSE (1)
#define P_STATE_BUILD (2)
#define P_STATE_TRIANGULATE (3)
#define P_STATE_OUTPUT (4)
#define P_STATE_DONE (8)
#define P_STATE_KILLED (9)
#define P_STATE_INIT_TIME (1*60)
#define P_STATE_PARSE_TIME (1*60)
#define P_STATE_BUILD_TIME (30*60)
#define P_STATE_TRIANGULATE_TIME ( 1*60)
#define P_STATE_TRIANGULATE_TIME (1*60)
#define P_STATE_OUTPUT_TIME (10*60)
#define GENAPT_PORT (12397)
@ -34,6 +34,7 @@
#define PL_STATE_ALL_LAUNCHED (3)
#define PL_STATE_DONE (10)
// Forward declaration
class Scheduler;
@ -44,10 +45,9 @@ public:
{
}
AirportInfo( const std::string& id, long p, double s ) :
icao(id)
AirportInfo(const std::string& id, long p, double s) : icao(id)
{
pos = p;
pos = p;
snap = s;
numRunways = -1;
@ -56,39 +56,39 @@ public:
numTaxiways = -1;
}
std::string GetIcao( void ) { return icao; }
long GetPos( void ) { return pos; }
double GetSnap( void ) { return snap; }
std::string GetIcao(void) { return icao; }
long GetPos(void) { return pos; }
double GetSnap(void) { return snap; }
void SetRunways( int r ) { numRunways = r; }
void SetPavements( int p ) { numPavements = p; }
void SetFeats( int f ) { numFeats = f; }
void SetTaxiways( int t ) { numTaxiways = t; }
void SetParseTime( SGTimeStamp t ) { parseTime = t; }
void SetBuildTime( SGTimeStamp t ) { buildTime = t; }
void SetCleanTime( SGTimeStamp t ) { cleanTime = t; }
void SetTessTime( SGTimeStamp t ) { tessTime = t; }
void SetErrorString( char* e ) { errString = e; }
void SetRunways(int r) { numRunways = r; }
void SetPavements(int p) { numPavements = p; }
void SetFeats(int f) { numFeats = f; }
void SetTaxiways(int t) { numTaxiways = t; }
void SetParseTime(SGTimeStamp t) { parseTime = t; }
void SetBuildTime(SGTimeStamp t) { buildTime = t; }
void SetCleanTime(SGTimeStamp t) { cleanTime = t; }
void SetTessTime(SGTimeStamp t) { tessTime = t; }
void SetErrorString(char* e) { errString = e; }
void IncreaseSnap( void ) { snap *= 2.0f; }
void IncreaseSnap(void) { snap *= 2.0f; }
friend std::ostream& operator<<(std::ostream& output, const AirportInfo& ai);
private:
std::string icao;
long pos;
long pos;
int numRunways;
int numPavements;
int numFeats;
int numTaxiways;
int numRunways;
int numPavements;
int numFeats;
int numTaxiways;
SGTimeStamp parseTime;
SGTimeStamp buildTime;
SGTimeStamp cleanTime;
SGTimeStamp tessTime;
double snap;
double snap;
std::string errString;
};
@ -99,32 +99,30 @@ class Scheduler
public:
Scheduler(std::string& datafile, const std::string& root, const string_list& elev_src);
long FindAirport( const std::string& icao );
void AddAirport( std::string icao );
bool AddAirports( long start_pos, tgRectangle* boundingBox );
void RetryAirport( AirportInfo* pInfo );
long FindAirport(const std::string& icao);
void AddAirport(std::string icao);
bool AddAirports(long start_pos, tgRectangle* boundingBox);
void RetryAirport(AirportInfo* pInfo);
void Schedule( int num_threads, std::string& summaryfile );
void Schedule(int num_threads, std::string& summaryfile);
// Debug
void set_debug( const std::string& path, std::vector<std::string> runway_defs,
std::vector<std::string> pavement_defs,
std::vector<std::string> taxiway_defs,
std::vector<std::string> feature_defs );
void set_debug(const std::string& path, std::vector<std::string> runway_defs,
std::vector<std::string> pavement_defs,
std::vector<std::string> taxiway_defs,
std::vector<std::string> feature_defs);
private:
bool IsAirportDefinition( char* line, const std::string& icao );
bool IsAirportDefinition(char* line, const std::string& icao);
std::string filename;
string_list elevation;
std::string work_dir;
std::string filename;
string_list elevation;
std::string work_dir;
// debug
std::string debug_path;
debug_map debug_runways;
debug_map debug_pavements;
debug_map debug_taxiways;
debug_map debug_features;
std::string debug_path;
debug_map debug_runways;
debug_map debug_pavements;
debug_map debug_taxiways;
debug_map debug_features;
};
#endif

View file

@ -1,46 +1,42 @@
#ifndef _TAXIWAY_H_
#define _TAXIWAY_H_
#pragma once
#include <memory>
#include <terragear/tg_accumulator.hxx>
#include <terragear/tg_light.hxx>
#include <terragear/tg_polygon.hxx>
#include <terragear/tg_accumulator.hxx>
#include "apt_math.hxx"
class Taxiway
{
public:
explicit Taxiway(char* def);
int BuildBtg( tgpolygon_list& taxi_polys,
tglightcontour_list& taxi_lights,
tgcontour_list& slivers,
tgAccumulator& accum,
std::string& shapefile_name );
int BuildBtg(tgpolygon_list& taxi_polys,
tglightcontour_list& taxi_lights,
tgcontour_list& slivers,
tgAccumulator& accum,
std::string& shapefile_name);
int BuildBtg( tgpolygon_list& taxi_polys,
tglightcontour_list& taxi_lights,
tgcontour_list& slivers,
tgpolygon_list& apt_base_polys,
tgpolygon_list& apt_clearing_polys,
tgAccumulator& accum,
std::string& shapefile_name );
int BuildBtg(tgpolygon_list& taxi_polys,
tglightcontour_list& taxi_lights,
tgcontour_list& slivers,
tgpolygon_list& apt_base_polys,
tgpolygon_list& apt_clearing_polys,
tgAccumulator& accum,
std::string& shapefile_name);
private:
SGGeod origin;
double heading;
double length;
double width;
int surface;
char lighting[6];
SGGeod origin;
double heading;
double length;
double width;
int surface;
char lighting[6];
tgContour taxi_contour;
void GenLights(tglightcontour_list& rwy_lights);
};
typedef std::vector<std::shared_ptr<Taxiway>> TaxiwayList;
#endif