add water runways. The corresponding buoys will follow into fgdata :)
This commit is contained in:
parent
ec6b862730
commit
c551e81136
6 changed files with 74 additions and 3 deletions
|
@ -995,6 +995,21 @@ void Airport::BuildBtg(const string& root, const string_list& elev_src )
|
|||
}
|
||||
point_list taxisigns_nodes = calc_elevations( apt_surf, ts_nodes, 0.0 );
|
||||
|
||||
// calc water runway buoys elevations:
|
||||
point_list buoy_nodes;
|
||||
buoy_nodes.clear();
|
||||
for ( i = 0; i < (int)waterrunways.size(); ++i )
|
||||
{
|
||||
TGPolygon tmp_nodes;
|
||||
tmp_nodes.erase();
|
||||
tmp_nodes = waterrunways[i]->GetNodes();
|
||||
for (j=0; j< tmp_nodes.contour_size( 0 ); ++j )
|
||||
{
|
||||
buoy_nodes.push_back( tmp_nodes.get_pt( 0, j ) );
|
||||
}
|
||||
}
|
||||
point_list water_buoys_nodes = calc_elevations( apt_surf, buoy_nodes, 0.0 );
|
||||
|
||||
|
||||
// add base skirt (to hide potential cracks)
|
||||
//
|
||||
|
@ -1314,8 +1329,13 @@ void Airport::BuildBtg(const string& root, const string_list& elev_src )
|
|||
0.0 );
|
||||
}
|
||||
|
||||
|
||||
|
||||
// write out water buoys
|
||||
for ( i = 0; i < (int)water_buoys_nodes.size(); ++i )
|
||||
{
|
||||
write_index_shared( objpath, b, water_buoys_nodes[i],
|
||||
"Models/Airport/water_rw_buoy.xml",
|
||||
0.0 );
|
||||
}
|
||||
|
||||
|
||||
string holepath = root + "/AirportArea";
|
||||
|
|
|
@ -23,6 +23,11 @@ public:
|
|||
runways.push_back( runway );
|
||||
}
|
||||
|
||||
void AddWaterRunway( WaterRunway* waterrunway )
|
||||
{
|
||||
waterrunways.push_back( waterrunway );
|
||||
}
|
||||
|
||||
void AddObj( LightingObj* lightobj )
|
||||
{
|
||||
lightobjects.push_back( lightobj );
|
||||
|
@ -79,6 +84,7 @@ private:
|
|||
PavementList pavements;
|
||||
FeatureList features;
|
||||
RunwayList runways;
|
||||
WaterRunwayList waterrunways;
|
||||
LightingObjList lightobjects;
|
||||
WindsockList windsocks;
|
||||
BeaconList beacons;
|
||||
|
|
|
@ -269,6 +269,11 @@ int Parser::ParseLine(char* line)
|
|||
case WATER_RUNWAY_CODE:
|
||||
SetState( STATE_PARSE_SIMPLE );
|
||||
SG_LOG(SG_GENERAL, SG_DEBUG, "Parsing water runway: " << line);
|
||||
cur_waterrunway = new WaterRunway(line);
|
||||
if (cur_airport)
|
||||
{
|
||||
cur_airport->AddWaterRunway( cur_waterrunway );
|
||||
}
|
||||
break;
|
||||
case HELIPAD_CODE:
|
||||
SetState( STATE_PARSE_SIMPLE );
|
||||
|
|
|
@ -86,6 +86,7 @@ private:
|
|||
// (first is outside boundry, remaining are holes)
|
||||
Airport* cur_airport;
|
||||
Runway* cur_runway;
|
||||
WaterRunway* cur_waterrunway;
|
||||
Helipad* cur_helipad;
|
||||
ClosedPoly* cur_pavement;
|
||||
LinearFeature* cur_feat;
|
||||
|
|
|
@ -103,6 +103,30 @@ int Runway::BuildOsg ( osg::Group* airport )
|
|||
return 0;
|
||||
}
|
||||
|
||||
WaterRunway::WaterRunway(char* definition)
|
||||
{
|
||||
sscanf(definition, "%lf %d %s %lf %lf %s %lf %lf", &width, &buoys, &rwnum[0], &lat[0], &lon[0], &rwnum[1], &lat[1], &lon[1]);
|
||||
|
||||
SG_LOG(SG_GENERAL, SG_DEBUG, "Read water runway: (" << lon[0] << "," << lat[0] << ") to (" << lon[1] << "," << lat[1] << ") width: " << width << " buoys = " << buoys );
|
||||
}
|
||||
|
||||
TGPolygon WaterRunway::GetNodes()
|
||||
{
|
||||
TGPolygon buoy_nodes;
|
||||
buoy_nodes.erase();
|
||||
if (buoys == 1){ /*no point to calculate stuff we don't need*/
|
||||
|
||||
double heading, az2, length;
|
||||
// calculate runway heading and length
|
||||
geo_inverse_wgs_84( lat[0], lon[0], lat[1], lon[1], &heading, &az2, &length );
|
||||
|
||||
// create a polygon for the 4 buoy points
|
||||
// TODO: The amount of points can be increased if needed (more buoys)
|
||||
buoy_nodes = gen_wgs84_area(Point3D( (lon[0] + lon[1]) / 2 , (lat[0] + lat[1]) / 2, 0), length, 0, 0, width, heading, 0, false);
|
||||
}
|
||||
return buoy_nodes;
|
||||
}
|
||||
|
||||
|
||||
int Runway::BuildBtg( float alt_m, superpoly_list* rwy_polys, texparams_list* texparams, superpoly_list* rwy_lights, TGPolygon* accum, TGPolygon* apt_base, TGPolygon* apt_clearing )
|
||||
{
|
||||
|
|
|
@ -145,7 +145,22 @@ private:
|
|||
superpoly_list gen_ssalx( float alt_m, const string& kind, bool recip );
|
||||
superpoly_list gen_malsx( float alt_m, const string& kind, bool recip );
|
||||
};
|
||||
|
||||
typedef std::vector <Runway *> RunwayList;
|
||||
|
||||
|
||||
class WaterRunway
|
||||
{
|
||||
public:
|
||||
WaterRunway(char* def);
|
||||
|
||||
double width;
|
||||
int buoys;
|
||||
char rwnum[2][16];
|
||||
double lat[2];
|
||||
double lon[2];
|
||||
|
||||
TGPolygon GetNodes();
|
||||
};
|
||||
typedef std::vector <WaterRunway *> WaterRunwayList;
|
||||
|
||||
#endif
|
||||
|
|
Loading…
Reference in a new issue