added linked objects for beacon and windsock support.
taxiway signs pending...
This commit is contained in:
parent
b146149877
commit
fdb37b36c7
7 changed files with 148 additions and 30 deletions
src/Airports/GenAirports850
|
@ -8,6 +8,7 @@ add_executable(genapts850
|
||||||
global.hxx
|
global.hxx
|
||||||
lights.cxx
|
lights.cxx
|
||||||
linearfeature.hxx linearfeature.cxx
|
linearfeature.hxx linearfeature.cxx
|
||||||
|
linked_objects.hxx linked_objects.cxx
|
||||||
main.cxx
|
main.cxx
|
||||||
object.hxx object.cxx
|
object.hxx object.cxx
|
||||||
parser.hxx parser.cxx
|
parser.hxx parser.cxx
|
||||||
|
|
|
@ -949,14 +949,32 @@ void Airport::BuildBtg(const string& root, const string_list& elev_src )
|
||||||
SG_LOG(SG_GENERAL, SG_DEBUG, "Done with base calc_elevations()");
|
SG_LOG(SG_GENERAL, SG_DEBUG, "Done with base calc_elevations()");
|
||||||
|
|
||||||
#if 0 // TODO : along with taxiway sign elevations
|
#if 0 // TODO : along with taxiway sign elevations
|
||||||
SG_LOG(SG_GENERAL, SG_INFO, "Computing beacon node elevations");
|
|
||||||
point_list beacon_nodes = calc_elevations( apt_surf, beacons, 0.0 );
|
|
||||||
SG_LOG(SG_GENERAL, SG_INFO, "Computing tower node elevations");
|
SG_LOG(SG_GENERAL, SG_INFO, "Computing tower node elevations");
|
||||||
point_list tower_nodes = calc_elevations( apt_surf, towers, 0.0 );
|
point_list tower_nodes = calc_elevations( apt_surf, towers, 0.0 );
|
||||||
SG_LOG(SG_GENERAL, SG_INFO, "Computing windsock node elevations");
|
|
||||||
point_list windsock_nodes = calc_elevations( apt_surf, windsocks, 0.0 );
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
// calc windsock elevations:
|
||||||
|
SG_LOG(SG_GENERAL, SG_INFO, "Computing windsock node elevations");
|
||||||
|
point_list ws_nodes;
|
||||||
|
ws_nodes.clear();
|
||||||
|
for ( i = 0; i < (int)windsocks.size(); ++i )
|
||||||
|
{
|
||||||
|
p = windsocks[i]->GetLoc();
|
||||||
|
ws_nodes.push_back( p );
|
||||||
|
}
|
||||||
|
point_list windsock_nodes = calc_elevations( apt_surf, ws_nodes, 0.0 );
|
||||||
|
|
||||||
|
|
||||||
|
SG_LOG(SG_GENERAL, SG_INFO, "Computing beacon node elevations");
|
||||||
|
point_list b_nodes;
|
||||||
|
b_nodes.clear();
|
||||||
|
for ( i = 0; i < (int)beacons.size(); ++i )
|
||||||
|
{
|
||||||
|
p = beacons[i]->GetLoc();
|
||||||
|
b_nodes.push_back( p );
|
||||||
|
}
|
||||||
|
point_list beacon_nodes = calc_elevations( apt_surf, b_nodes, 0.0 );
|
||||||
|
|
||||||
// add base skirt (to hide potential cracks)
|
// add base skirt (to hide potential cracks)
|
||||||
//
|
//
|
||||||
// this has to happen after we've calculated the node elevations
|
// this has to happen after we've calculated the node elevations
|
||||||
|
@ -1233,6 +1251,32 @@ void Airport::BuildBtg(const string& root, const string_list& elev_src )
|
||||||
write_index( objpath, b, name );
|
write_index( objpath, b, name );
|
||||||
|
|
||||||
#if 0 // TODO : along with taxiway signs
|
#if 0 // TODO : along with taxiway signs
|
||||||
|
// write out tower references
|
||||||
|
for ( i = 0; i < (int)tower_nodes.size(); ++i )
|
||||||
|
{
|
||||||
|
write_index_shared( objpath, b, tower_nodes[i],
|
||||||
|
"Models/Airport/tower.xml",
|
||||||
|
0.0 );
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
// write out windsock references : TODO - save elevation data in the windsock object
|
||||||
|
for ( i = 0; i < (int)windsock_nodes.size(); ++i )
|
||||||
|
{
|
||||||
|
if ( windsocks[i]->IsLit() )
|
||||||
|
{
|
||||||
|
write_index_shared( objpath, b, windsock_nodes[i],
|
||||||
|
"Models/Airport/windsock_lit.xml",
|
||||||
|
0.0 );
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
write_index_shared( objpath, b, windsock_nodes[i],
|
||||||
|
"Models/Airport/windsock.xml",
|
||||||
|
0.0 );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// write out beacon references
|
// write out beacon references
|
||||||
for ( i = 0; i < (int)beacon_nodes.size(); ++i )
|
for ( i = 0; i < (int)beacon_nodes.size(); ++i )
|
||||||
{
|
{
|
||||||
|
@ -1241,31 +1285,6 @@ void Airport::BuildBtg(const string& root, const string_list& elev_src )
|
||||||
0.0 );
|
0.0 );
|
||||||
}
|
}
|
||||||
|
|
||||||
// write out tower references
|
|
||||||
for ( i = 0; i < (int)tower_nodes.size(); ++i )
|
|
||||||
{
|
|
||||||
write_index_shared( objpath, b, tower_nodes[i],
|
|
||||||
"Models/Airport/tower.xml",
|
|
||||||
0.0 );
|
|
||||||
}
|
|
||||||
|
|
||||||
// write out windsock references
|
|
||||||
for ( i = 0; i < (int)windsock_nodes.size(); ++i )
|
|
||||||
{
|
|
||||||
if ( windsock_types[i] == 0 )
|
|
||||||
{
|
|
||||||
write_index_shared( objpath, b, windsock_nodes[i],
|
|
||||||
"Models/Airport/windsock.xml",
|
|
||||||
0.0 );
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
write_index_shared( objpath, b, windsock_nodes[i],
|
|
||||||
"Models/Airport/windsock_lit.xml",
|
|
||||||
0.0 );
|
|
||||||
}
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
string holepath = root + "/AirportArea";
|
string holepath = root + "/AirportArea";
|
||||||
// long int poly_index = poly_index_next();
|
// long int poly_index = poly_index_next();
|
||||||
|
|
|
@ -8,6 +8,7 @@
|
||||||
#include "object.hxx"
|
#include "object.hxx"
|
||||||
#include "closedpoly.hxx"
|
#include "closedpoly.hxx"
|
||||||
#include "linearfeature.hxx"
|
#include "linearfeature.hxx"
|
||||||
|
#include "linked_objects.hxx"
|
||||||
|
|
||||||
using std::string;
|
using std::string;
|
||||||
|
|
||||||
|
@ -45,6 +46,16 @@ public:
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void AddWindsock( Windsock* windsock )
|
||||||
|
{
|
||||||
|
windsocks.push_back( windsock );
|
||||||
|
}
|
||||||
|
|
||||||
|
void AddBeacon( Beacon* beacon )
|
||||||
|
{
|
||||||
|
beacons.push_back( beacon );
|
||||||
|
}
|
||||||
|
|
||||||
void BuildOsg( osg::Group* airport );
|
void BuildOsg( osg::Group* airport );
|
||||||
void BuildBtg( const string& root, const string_list& elev_src );
|
void BuildBtg( const string& root, const string_list& elev_src );
|
||||||
|
|
||||||
|
@ -58,6 +69,8 @@ private:
|
||||||
FeatureList features;
|
FeatureList features;
|
||||||
RunwayList runways;
|
RunwayList runways;
|
||||||
LightingObjList lightobjects;
|
LightingObjList lightobjects;
|
||||||
|
WindsockList windsocks;
|
||||||
|
BeaconList beacons;
|
||||||
};
|
};
|
||||||
|
|
||||||
typedef std::vector <Airport *> AirportList;
|
typedef std::vector <Airport *> AirportList;
|
||||||
|
|
18
src/Airports/GenAirports850/linked_objects.cxx
Normal file
18
src/Airports/GenAirports850/linked_objects.cxx
Normal file
|
@ -0,0 +1,18 @@
|
||||||
|
#include <simgear/math/sg_geodesy.hxx>
|
||||||
|
#include <simgear/debug/logstream.hxx>
|
||||||
|
#include "linked_objects.hxx"
|
||||||
|
|
||||||
|
Windsock::Windsock( char* definition )
|
||||||
|
{
|
||||||
|
sscanf(definition, "%lf %lf %d", &lat, &lon, &lit);
|
||||||
|
|
||||||
|
SG_LOG(SG_GENERAL, SG_DEBUG, "Read Windsock: (" << lon << "," << lat << ") lit: " << lit );
|
||||||
|
}
|
||||||
|
|
||||||
|
Beacon::Beacon( char* definition )
|
||||||
|
{
|
||||||
|
sscanf(definition, "%lf %lf %d", &lat, &lon, &code);
|
||||||
|
|
||||||
|
SG_LOG(SG_GENERAL, SG_DEBUG, "Read Beacon: (" << lon << "," << lat << ") code: " << code );
|
||||||
|
}
|
||||||
|
|
61
src/Airports/GenAirports850/linked_objects.hxx
Normal file
61
src/Airports/GenAirports850/linked_objects.hxx
Normal file
|
@ -0,0 +1,61 @@
|
||||||
|
#ifndef _LINKED_OBJECTS_H_
|
||||||
|
#define _LINKED_OBJECTS_H_
|
||||||
|
|
||||||
|
#include <stdio.h>
|
||||||
|
#include <stdlib.h>
|
||||||
|
|
||||||
|
#include <Polygon/polygon.hxx>
|
||||||
|
#include <Polygon/superpoly.hxx>
|
||||||
|
#include <Geometry/point3d.hxx>
|
||||||
|
|
||||||
|
#include "texparams.hxx"
|
||||||
|
|
||||||
|
using std::string;
|
||||||
|
|
||||||
|
class Windsock
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
Windsock(char* def);
|
||||||
|
|
||||||
|
double lat;
|
||||||
|
double lon;
|
||||||
|
int lit;
|
||||||
|
|
||||||
|
Point3D GetLoc()
|
||||||
|
{
|
||||||
|
return Point3D( lon, lat, 0.0f );
|
||||||
|
}
|
||||||
|
|
||||||
|
bool IsLit()
|
||||||
|
{
|
||||||
|
return (lit == 1) ? true : false;
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
typedef std::vector <Windsock *> WindsockList;
|
||||||
|
|
||||||
|
|
||||||
|
class Beacon
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
Beacon(char* def);
|
||||||
|
|
||||||
|
double lat;
|
||||||
|
double lon;
|
||||||
|
int code;
|
||||||
|
|
||||||
|
Point3D GetLoc()
|
||||||
|
{
|
||||||
|
return Point3D( lon, lat, 0.0f );
|
||||||
|
}
|
||||||
|
|
||||||
|
int GetCode()
|
||||||
|
{
|
||||||
|
return code;
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
typedef std::vector <Beacon *> BeaconList;
|
||||||
|
|
||||||
|
|
||||||
|
#endif
|
|
@ -390,10 +390,14 @@ int Parser::ParseLine(char* line)
|
||||||
case LIGHT_BEACON_CODE:
|
case LIGHT_BEACON_CODE:
|
||||||
SetState( STATE_PARSE_SIMPLE );
|
SetState( STATE_PARSE_SIMPLE );
|
||||||
SG_LOG(SG_GENERAL, SG_DEBUG, "Parsing light beacon: " << line);
|
SG_LOG(SG_GENERAL, SG_DEBUG, "Parsing light beacon: " << line);
|
||||||
|
cur_beacon = new Beacon(line);
|
||||||
|
cur_airport->AddBeacon( cur_beacon );
|
||||||
break;
|
break;
|
||||||
case WINDSOCK_CODE:
|
case WINDSOCK_CODE:
|
||||||
SetState( STATE_PARSE_SIMPLE );
|
SetState( STATE_PARSE_SIMPLE );
|
||||||
SG_LOG(SG_GENERAL, SG_DEBUG, "Parsing windsock: " << line);
|
SG_LOG(SG_GENERAL, SG_ALERT, "Parsing windsock: " << line);
|
||||||
|
cur_windsock = new Windsock(line);
|
||||||
|
cur_airport->AddWindsock( cur_windsock );
|
||||||
break;
|
break;
|
||||||
case TAXIWAY_SIGN:
|
case TAXIWAY_SIGN:
|
||||||
SetState( STATE_PARSE_SIMPLE );
|
SetState( STATE_PARSE_SIMPLE );
|
||||||
|
|
|
@ -90,6 +90,8 @@ private:
|
||||||
LinearFeature* cur_feat;
|
LinearFeature* cur_feat;
|
||||||
BezNode* prev_node;
|
BezNode* prev_node;
|
||||||
LightingObj* cur_object;
|
LightingObj* cur_object;
|
||||||
|
Windsock* cur_windsock;
|
||||||
|
Beacon* cur_beacon;
|
||||||
|
|
||||||
AirportList airports;
|
AirportList airports;
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue