1
0
Fork 0

[linked_objects] Maintenance

This commit is contained in:
scttgs0 2023-05-14 12:08:46 -05:00
parent c04eab3101
commit c8ea78fbe6
2 changed files with 17 additions and 29 deletions

View file

@ -1,50 +1,38 @@
#include <simgear/debug/logstream.hxx> #include <simgear/debug/logstream.hxx>
#include "linked_objects.hxx"
#include "debug.hxx" #include "debug.hxx"
#include "linked_objects.hxx"
Windsock::Windsock(char* definition) Windsock::Windsock(char* definition)
{ {
std::istringstream ss(definition); std::istringstream ss(definition);
ss >> lat ss >> lat >> lon >> lit;
>> lon
>> lit;
TG_LOG(SG_GENERAL, SG_DEBUG, "Read Windsock: (" << lon << "," << lat << ") lit: " << lit ); TG_LOG(SG_GENERAL, SG_DEBUG, "Read Windsock: (" << lon << "," << lat << ") lit: " << lit);
} }
Beacon::Beacon(char* definition) Beacon::Beacon(char* definition)
{ {
std::istringstream ss(definition); std::istringstream ss(definition);
ss >> lat ss >> lat >> lon >> code;
>> lon
>> code;
TG_LOG(SG_GENERAL, SG_DEBUG, "Read Beacon: (" << lon << "," << lat << ") code: " << code ); TG_LOG(SG_GENERAL, SG_DEBUG, "Read Beacon: (" << lon << "," << lat << ") code: " << code);
} }
Sign::Sign(char* definition) Sign::Sign(char* definition)
{ {
char sgdef[256]; std::string sgdef;
double def_heading; double def_heading;
std::istringstream ss(definition); std::istringstream ss(definition);
ss >> lat ss >> lat >> lon >> def_heading >> reserved >> size >> sgdef;
>> lon
>> def_heading
>> reserved
>> size
>> sgdef;
// 850 format sign heading is the heading which points away from the visible numbers // 850 format sign heading is the heading which points away from the visible numbers
// Flightgear wants the heading to be the heading in which the sign is read // Flightgear wants the heading to be the heading in which the sign is read
heading = -def_heading + 360.0; heading = -def_heading + 360.0;
TG_LOG(SG_GENERAL, SG_DEBUG, "Read Sign: (" << lon << "," << lat << TG_LOG(SG_GENERAL, SG_DEBUG, "Read Sign: (" << lon << "," << lat << ") heading " << def_heading << " size " << size << " definition: " << sgdef << " calc view heading: " << heading);
") heading " << def_heading <<
" size " << size <<
" definition: " << sgdef <<
" calc view heading: " << heading );
sgn_def = sgdef; sgn_def = sgdef;
} }

View file

@ -14,12 +14,12 @@ public:
double lon; double lon;
int lit; int lit;
SGGeod GetLoc() SGGeod GetLoc() const
{ {
return SGGeod::fromDeg(lon, lat); return SGGeod::fromDeg(lon, lat);
} }
bool IsLit() bool IsLit() const
{ {
return (lit == 1) ? true : false; return (lit == 1) ? true : false;
} }
@ -37,12 +37,12 @@ public:
double lon; double lon;
int code; int code;
SGGeod GetLoc() SGGeod GetLoc() const
{ {
return SGGeod::fromDeg(lon, lat); return SGGeod::fromDeg(lon, lat);
} }
int GetCode() int GetCode() const
{ {
return code; return code;
} }
@ -62,22 +62,22 @@ public:
int size; int size;
std::string sgn_def; std::string sgn_def;
SGGeod GetLoc() SGGeod GetLoc() const
{ {
return SGGeod::fromDeg(lon, lat); return SGGeod::fromDeg(lon, lat);
} }
double GetHeading() double GetHeading() const
{ {
return heading; return heading;
} }
std::string GetDefinition() std::string GetDefinition() const
{ {
return sgn_def; return sgn_def;
} }
int GetSize() int GetSize() const
{ {
return size; return size;
} }