Improve buoys calculation for water runways
This commit is contained in:
parent
42e4cefab3
commit
133c0ef91b
3 changed files with 34 additions and 45 deletions
|
@ -1343,7 +1343,7 @@ void Airport::BuildBtg(const string& root, const string_list& elev_src )
|
|||
// it avoids biases introduced from the surrounding area if the
|
||||
// airport is located in a bowl or on a hill.
|
||||
|
||||
SG_LOG(SG_GENERAL, SG_DEBUG, " calcaverage elevation");
|
||||
SG_LOG(SG_GENERAL, SG_DEBUG, " calc average elevation");
|
||||
{
|
||||
point_list dbg = nodes.get_node_list();
|
||||
|
||||
|
@ -1443,7 +1443,7 @@ void Airport::BuildBtg(const string& root, const string_list& elev_src )
|
|||
|
||||
SG_LOG(SG_GENERAL, SG_DEBUG, "Done with base calc_elevations()");
|
||||
|
||||
#if 0 // TODO : along with taxiway sign elevations
|
||||
#if 0 // TODO
|
||||
SG_LOG(SG_GENERAL, SG_INFO, "Computing tower node elevations");
|
||||
point_list tower_nodes = calc_elevations( apt_surf, towers, 0.0 );
|
||||
#endif
|
||||
|
@ -1483,27 +1483,15 @@ void Airport::BuildBtg(const string& root, const string_list& elev_src )
|
|||
point_list taxisigns_nodes = calc_elevations( apt_surf, ts_nodes, 0.0 );
|
||||
SG_LOG(SG_GENERAL, SG_DEBUG, "Done");
|
||||
|
||||
SG_LOG(SG_GENERAL, SG_DEBUG, "Computing water buoy elevations");
|
||||
// calc water runway buoys elevations:
|
||||
point_list water_buoys_nodes;
|
||||
if ( waterrunways.size() > 0){
|
||||
if ( waterrunways[0]->HasBuoys() )
|
||||
{
|
||||
point_list buoy_nodes;
|
||||
buoy_nodes.clear();
|
||||
for ( unsigned int i = 0; i < waterrunways.size(); ++i )
|
||||
{
|
||||
TGPolygon tmp_nodes;
|
||||
tmp_nodes.erase();
|
||||
tmp_nodes = waterrunways[i]->GetNodes();
|
||||
for ( int j = 0; j< tmp_nodes.contour_size( 0 ); ++j )
|
||||
{
|
||||
buoy_nodes.push_back( tmp_nodes.get_pt( 0, j ) );
|
||||
}
|
||||
}
|
||||
water_buoys_nodes = calc_elevations( apt_surf, buoy_nodes, 0.0 );
|
||||
}
|
||||
SG_LOG(SG_GENERAL, SG_DEBUG, "Computing water buoy elevations");
|
||||
point_list buoy_nodes;
|
||||
buoy_nodes.clear();
|
||||
for ( unsigned int i = 0; i < waterrunways.size(); ++i )
|
||||
{
|
||||
buoy_nodes = waterrunways[i]->GetNodes();
|
||||
}
|
||||
point_list water_buoys_nodes = calc_elevations( apt_surf, buoy_nodes, 0.0 );
|
||||
|
||||
// add base skirt (to hide potential cracks)
|
||||
//
|
||||
|
|
|
@ -60,24 +60,32 @@ WaterRunway::WaterRunway(char* definition)
|
|||
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()
|
||||
point_list WaterRunway::GetNodes()
|
||||
{
|
||||
TGPolygon buoy_nodes;
|
||||
buoy_nodes.erase();
|
||||
point_list buoys_nodes;
|
||||
buoys_nodes.clear();
|
||||
|
||||
SG_LOG(SG_GENERAL, SG_DEBUG, "WaterRunway::GetNodes" );
|
||||
if (buoys){
|
||||
double heading, az2, length;
|
||||
// calculate runway heading and length
|
||||
geo_inverse_wgs_84( lat[0], lon[0], lat[1], lon[1], &heading, &az2, &length );
|
||||
|
||||
if (buoys == 1){ /*no point to calculate stuff we don't need*/
|
||||
// create a polygon for the outline and use it to calculate the point list
|
||||
int divs = (int)(length / 100.0);
|
||||
TGPolygon area = gen_wgs84_area(Point3D( (lon[0] + lon[1]) / 2 , (lat[0] + lat[1]) / 2, 0),
|
||||
length, 0, 0, width, heading, false);
|
||||
Point3D pt, inc;
|
||||
|
||||
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, false);
|
||||
}
|
||||
return buoy_nodes;
|
||||
for ( int i = 0; i < area.contour_size( 0 ); ++i ) {
|
||||
pt = area.get_pt( 0, i );
|
||||
inc = (area.get_pt(0, i==3 ? 0 : i+1) - area.get_pt(0,i)) / divs;
|
||||
for ( int j = 0; j < divs; ++j) {
|
||||
buoys_nodes.push_back( pt);
|
||||
pt += inc;
|
||||
}
|
||||
}
|
||||
}
|
||||
return buoys_nodes;
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -188,6 +188,8 @@ class WaterRunway
|
|||
public:
|
||||
WaterRunway(char* def);
|
||||
|
||||
point_list GetNodes();
|
||||
|
||||
Point3D GetStart(void)
|
||||
{
|
||||
return ( Point3D( lon[0], lat[0], 0.0f ));
|
||||
|
@ -198,21 +200,12 @@ public:
|
|||
return ( Point3D( lon[1], lat[1], 0.0f ));
|
||||
}
|
||||
|
||||
bool HasBuoys()
|
||||
{
|
||||
if (buoys == 1)
|
||||
return true;
|
||||
else
|
||||
return false;
|
||||
}
|
||||
|
||||
private:
|
||||
double width;
|
||||
int buoys;
|
||||
char rwnum[2][16];
|
||||
double lat[2];
|
||||
double lon[2];
|
||||
|
||||
TGPolygon GetNodes();
|
||||
};
|
||||
typedef std::vector <WaterRunway *> WaterRunwayList;
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue