From c8ea78fbe60cfa35f9a5374112731dcf1cad03d0 Mon Sep 17 00:00:00 2001 From: scttgs0 Date: Sun, 14 May 2023 12:08:46 -0500 Subject: [PATCH] [linked_objects] Maintenance --- src/Airports/GenAirports/linked_objects.cxx | 30 +++++++-------------- src/Airports/GenAirports/linked_objects.hxx | 16 +++++------ 2 files changed, 17 insertions(+), 29 deletions(-) diff --git a/src/Airports/GenAirports/linked_objects.cxx b/src/Airports/GenAirports/linked_objects.cxx index 52c809e6..c8360a79 100644 --- a/src/Airports/GenAirports/linked_objects.cxx +++ b/src/Airports/GenAirports/linked_objects.cxx @@ -1,50 +1,38 @@ #include -#include "linked_objects.hxx" #include "debug.hxx" +#include "linked_objects.hxx" + Windsock::Windsock(char* definition) { std::istringstream ss(definition); - ss >> lat - >> lon - >> lit; + ss >> lat >> 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) { std::istringstream ss(definition); - ss >> lat - >> lon - >> code; + ss >> lat >> 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) { - char sgdef[256]; + std::string sgdef; double def_heading; std::istringstream ss(definition); - ss >> lat - >> lon - >> def_heading - >> reserved - >> size - >> sgdef; + ss >> lat >> lon >> def_heading >> reserved >> size >> sgdef; // 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 heading = -def_heading + 360.0; - TG_LOG(SG_GENERAL, SG_DEBUG, "Read Sign: (" << lon << "," << lat << - ") heading " << def_heading << - " size " << size << - " definition: " << sgdef << - " calc view heading: " << heading ); + TG_LOG(SG_GENERAL, SG_DEBUG, "Read Sign: (" << lon << "," << lat << ") heading " << def_heading << " size " << size << " definition: " << sgdef << " calc view heading: " << heading); sgn_def = sgdef; } diff --git a/src/Airports/GenAirports/linked_objects.hxx b/src/Airports/GenAirports/linked_objects.hxx index 9226cf3a..63d60bdc 100644 --- a/src/Airports/GenAirports/linked_objects.hxx +++ b/src/Airports/GenAirports/linked_objects.hxx @@ -14,12 +14,12 @@ public: double lon; int lit; - SGGeod GetLoc() + SGGeod GetLoc() const { return SGGeod::fromDeg(lon, lat); } - bool IsLit() + bool IsLit() const { return (lit == 1) ? true : false; } @@ -37,12 +37,12 @@ public: double lon; int code; - SGGeod GetLoc() + SGGeod GetLoc() const { return SGGeod::fromDeg(lon, lat); } - int GetCode() + int GetCode() const { return code; } @@ -62,22 +62,22 @@ public: int size; std::string sgn_def; - SGGeod GetLoc() + SGGeod GetLoc() const { return SGGeod::fromDeg(lon, lat); } - double GetHeading() + double GetHeading() const { return heading; } - std::string GetDefinition() + std::string GetDefinition() const { return sgn_def; } - int GetSize() + int GetSize() const { return size; }