From 0f4f044a9475093732584e00d2480ebad9dbfedd Mon Sep 17 00:00:00 2001 From: jmt Date: Fri, 26 Dec 2008 12:28:05 +0000 Subject: [PATCH] Kill off many Point3D includes, and a couple of uses in the HUD code. Requires a SimGear update to get some new SGGeodesy helpers. --- src/AIModel/AIAircraft.cxx | 1 - src/AIModel/AIBallistic.cxx | 1 - src/AIModel/AIBase.hxx | 1 - src/AIModel/AIStatic.cxx | 1 - src/AIModel/AIStorm.cxx | 1 - src/AIModel/AIThermal.cxx | 1 - src/ATCDCL/AIEntity.cxx | 1 - src/ATCDCL/AIPlane.cxx | 1 - src/ATCDCL/AIPlane.hxx | 2 -- src/Cockpit/hud_rwy.cxx | 22 +++++++++------------- src/FDM/SP/MagicCarpet.cxx | 1 - src/FDM/UFO.cxx | 1 - src/Instrumentation/HUD/HUD_runway.cxx | 21 ++++++++------------- src/Instrumentation/adf.hxx | 1 - src/Instrumentation/dme.hxx | 5 ----- src/Instrumentation/tacan.hxx | 5 ----- src/Main/fg_init.cxx | 1 - src/Main/viewer.cxx | 1 - src/Model/model_panel.hxx | 1 - src/Scenery/tilemgr.cxx | 1 - src/Scenery/tilemgr.hxx | 1 - src/Time/light.hxx | 1 - 22 files changed, 17 insertions(+), 55 deletions(-) diff --git a/src/AIModel/AIAircraft.cxx b/src/AIModel/AIAircraft.cxx index 1ed6f7572..6207ffbda 100644 --- a/src/AIModel/AIAircraft.cxx +++ b/src/AIModel/AIAircraft.cxx @@ -22,7 +22,6 @@ # include #endif -#include #include #include
#include
diff --git a/src/AIModel/AIBallistic.cxx b/src/AIModel/AIBallistic.cxx index 0de56a46d..7b66be4bb 100644 --- a/src/AIModel/AIBallistic.cxx +++ b/src/AIModel/AIBallistic.cxx @@ -23,7 +23,6 @@ # include #endif -#include #include #include #include diff --git a/src/AIModel/AIBase.hxx b/src/AIModel/AIBase.hxx index b67c92878..46d287f73 100644 --- a/src/AIModel/AIBase.hxx +++ b/src/AIModel/AIBase.hxx @@ -25,7 +25,6 @@ #include #include -#include #include #include #include diff --git a/src/AIModel/AIStatic.cxx b/src/AIModel/AIStatic.cxx index 140325d42..83be7c8d6 100644 --- a/src/AIModel/AIStatic.cxx +++ b/src/AIModel/AIStatic.cxx @@ -22,7 +22,6 @@ # include #endif -#include #include
#include
#include diff --git a/src/AIModel/AIStorm.cxx b/src/AIModel/AIStorm.cxx index 3220cc773..fded8012d 100644 --- a/src/AIModel/AIStorm.cxx +++ b/src/AIModel/AIStorm.cxx @@ -22,7 +22,6 @@ # include #endif -#include #include
#include
#include diff --git a/src/AIModel/AIThermal.cxx b/src/AIModel/AIThermal.cxx index 0f1ee18f5..e9ad927a1 100644 --- a/src/AIModel/AIThermal.cxx +++ b/src/AIModel/AIThermal.cxx @@ -22,7 +22,6 @@ # include #endif -#include #include
#include
#include diff --git a/src/ATCDCL/AIEntity.cxx b/src/ATCDCL/AIEntity.cxx index 41baf4a05..f8284c3db 100644 --- a/src/ATCDCL/AIEntity.cxx +++ b/src/ATCDCL/AIEntity.cxx @@ -33,7 +33,6 @@ #include
#include #include -#include #include #include #include diff --git a/src/ATCDCL/AIPlane.cxx b/src/ATCDCL/AIPlane.cxx index 5352c1c47..f3bf43b8c 100644 --- a/src/ATCDCL/AIPlane.cxx +++ b/src/ATCDCL/AIPlane.cxx @@ -20,7 +20,6 @@ #include
#include
-#include #include #include #include diff --git a/src/ATCDCL/AIPlane.hxx b/src/ATCDCL/AIPlane.hxx index b29726c39..489ec1793 100644 --- a/src/ATCDCL/AIPlane.hxx +++ b/src/ATCDCL/AIPlane.hxx @@ -21,8 +21,6 @@ #ifndef _FG_AI_PLANE_HXX #define _FG_AI_PLANE_HXX -#include - #include "AIEntity.hxx" #include "ATC.hxx" diff --git a/src/Cockpit/hud_rwy.cxx b/src/Cockpit/hud_rwy.cxx index de1b7d2b8..321d20d3e 100644 --- a/src/Cockpit/hud_rwy.cxx +++ b/src/Cockpit/hud_rwy.cxx @@ -386,12 +386,10 @@ bool runway_instr::boundOutsidePoints(sgdVec3& v, sgdVec3& m) void runway_instr::drawArrow() { - Point3D ac(0.0), rwy(0.0); - ac.setlat(current_aircraft.fdm_state->get_Latitude_deg()); - ac.setlon(current_aircraft.fdm_state->get_Longitude_deg()); - rwy.setlat(runway->latitude()); - rwy.setlon(runway->longitude()); - float theta = GetHeadingFromTo(ac, rwy); + SGGeod acPos(SGGeod::fromDeg( + fgGetDouble("/position/longitude-deg"), + fgGetDouble("/position/latitude-deg"))); + float theta = SGGeodesy::courseDeg(acPos, runway->geod()); theta -= fgGetDouble("/orientation/heading-deg"); theta = -theta; glMatrixMode(GL_MODELVIEW); @@ -419,13 +417,11 @@ void runway_instr::drawArrow() void runway_instr::setLineWidth() { //Calculate the distance from the runway, A - double course, distance; - calc_gc_course_dist(Point3D(runway->longitude() * SGD_DEGREES_TO_RADIANS, - runway->latitude() * SGD_DEGREES_TO_RADIANS, 0.0), - Point3D(current_aircraft.fdm_state->get_Longitude(), - current_aircraft.fdm_state->get_Latitude(), 0.0 ), - &course, &distance); - distance *= SG_METER_TO_NM; + SGGeod acPos(SGGeod::fromDeg( + fgGetDouble("/position/longitude-deg"), + fgGetDouble("/position/latitude-deg"))); + double distance = SGGeodesy::distanceNm(acPos, runway->geod()); + //Get altitude above runway, B double alt_nm = get_agl(); static const SGPropertyNode *startup_units_node = fgGetNode("/sim/startup/units"); diff --git a/src/FDM/SP/MagicCarpet.cxx b/src/FDM/SP/MagicCarpet.cxx index f11573edf..558f39ddb 100644 --- a/src/FDM/SP/MagicCarpet.cxx +++ b/src/FDM/SP/MagicCarpet.cxx @@ -26,7 +26,6 @@ #endif #include -#include #include #include diff --git a/src/FDM/UFO.cxx b/src/FDM/UFO.cxx index f566a384f..81b532b5d 100644 --- a/src/FDM/UFO.cxx +++ b/src/FDM/UFO.cxx @@ -26,7 +26,6 @@ #endif #include -#include #include #include diff --git a/src/Instrumentation/HUD/HUD_runway.cxx b/src/Instrumentation/HUD/HUD_runway.cxx index d9b77665a..b263150f3 100644 --- a/src/Instrumentation/HUD/HUD_runway.cxx +++ b/src/Instrumentation/HUD/HUD_runway.cxx @@ -377,12 +377,10 @@ bool HUD::Runway::boundOutsidePoints(sgdVec3& v, sgdVec3& m) void HUD::Runway::drawArrow() { - Point3D ac(0.0), rwy(0.0); - ac.setlat(current_aircraft.fdm_state->get_Latitude_deg()); - ac.setlon(current_aircraft.fdm_state->get_Longitude_deg()); - rwy.setlat(_runway->latitude()); - rwy.setlon(_runway->longitude()); - float theta = GetHeadingFromTo(ac, rwy); + SGGeod acPos(SGGeod::fromDeg( + fgGetDouble("/position/longitude-deg"), + fgGetDouble("/position/latitude-deg"))); + float theta = SGGeodesy::courseDeg(acPos, _runway->geod()); theta -= fgGetDouble("/orientation/heading-deg"); theta = -theta; glMatrixMode(GL_MODELVIEW); @@ -411,13 +409,10 @@ void HUD::Runway::drawArrow() void HUD::Runway::setLineWidth() { //Calculate the distance from the runway, A - double course, distance; - calc_gc_course_dist(Point3D(_runway->longitude() * SGD_DEGREES_TO_RADIANS, - _runway->latitude() * SGD_DEGREES_TO_RADIANS, 0.0), - Point3D(current_aircraft.fdm_state->get_Longitude(), - current_aircraft.fdm_state->get_Latitude(), 0.0 ), - &course, &distance); - distance *= SG_METER_TO_NM; + SGGeod acPos(SGGeod::fromDeg( + fgGetDouble("/position/longitude-deg"), + fgGetDouble("/position/latitude-deg"))); + double distance = SGGeodesy::distanceNm(acPos, _runway->geod()); //Get altitude above runway, B double alt_nm = _agl->getDoubleValue(); diff --git a/src/Instrumentation/adf.hxx b/src/Instrumentation/adf.hxx index 0feac829d..41d55671d 100644 --- a/src/Instrumentation/adf.hxx +++ b/src/Instrumentation/adf.hxx @@ -13,7 +13,6 @@ #include -#include #include #include diff --git a/src/Instrumentation/dme.hxx b/src/Instrumentation/dme.hxx index 03ecca231..5d9963b10 100644 --- a/src/Instrumentation/dme.hxx +++ b/src/Instrumentation/dme.hxx @@ -7,11 +7,6 @@ #ifndef __INSTRUMENTS_DME_HXX #define __INSTRUMENTS_DME_HXX 1 -#ifndef __cplusplus -# error This library requires C++ -#endif - -#include #include #include diff --git a/src/Instrumentation/tacan.hxx b/src/Instrumentation/tacan.hxx index 2aa0ef6a8..7c8873aed 100755 --- a/src/Instrumentation/tacan.hxx +++ b/src/Instrumentation/tacan.hxx @@ -7,11 +7,6 @@ #ifndef __INSTRUMENTS_TACAN_HXX #define __INSTRUMENTS_TACAN_HXX 1 -#ifndef __cplusplus -# error This library requires C++ -#endif - -#include #include #include diff --git a/src/Main/fg_init.cxx b/src/Main/fg_init.cxx index 2bb9b477e..bc24739af 100644 --- a/src/Main/fg_init.cxx +++ b/src/Main/fg_init.cxx @@ -53,7 +53,6 @@ #include #include #include -#include #include #include #include diff --git a/src/Main/viewer.cxx b/src/Main/viewer.cxx index c03187619..f2ffd56c9 100644 --- a/src/Main/viewer.cxx +++ b/src/Main/viewer.cxx @@ -37,7 +37,6 @@ #include #include -#include #include #include #include diff --git a/src/Model/model_panel.hxx b/src/Model/model_panel.hxx index 2ee67051a..dcf41dd95 100644 --- a/src/Model/model_panel.hxx +++ b/src/Model/model_panel.hxx @@ -14,7 +14,6 @@ using std::vector; -#include #include diff --git a/src/Scenery/tilemgr.cxx b/src/Scenery/tilemgr.cxx index 315558e02..26ce7135a 100644 --- a/src/Scenery/tilemgr.cxx +++ b/src/Scenery/tilemgr.cxx @@ -32,7 +32,6 @@ #include #include -#include #include #include #include diff --git a/src/Scenery/tilemgr.hxx b/src/Scenery/tilemgr.hxx index 985abb2a5..f8e4f4b68 100644 --- a/src/Scenery/tilemgr.hxx +++ b/src/Scenery/tilemgr.hxx @@ -25,7 +25,6 @@ #define _TILEMGR_HXX #include -#include #include #include diff --git a/src/Time/light.hxx b/src/Time/light.hxx index ab256eed8..09b13baea 100644 --- a/src/Time/light.hxx +++ b/src/Time/light.hxx @@ -38,7 +38,6 @@ #include #include -#include // Define a structure containing the global lighting parameters -- 2.39.2