X-Git-Url: https://git.mxchange.org/?a=blobdiff_plain;f=src%2FInstrumentation%2FKLN89%2Fkln89.cxx;h=f4308bbb3225fbbbfd85761b083dccaac8b83972;hb=a99ea1c7b5fb0ba69810bbad9b6aca8b4cdc116b;hp=2dbc71be4d680e7db1519628410b2b1ad7e1a79c;hpb=c9813d1b5d79b4aad13c263690a0223086af25ac;p=flightgear.git diff --git a/src/Instrumentation/KLN89/kln89.cxx b/src/Instrumentation/KLN89/kln89.cxx index 2dbc71be4..f4308bbb3 100644 --- a/src/Instrumentation/KLN89/kln89.cxx +++ b/src/Instrumentation/KLN89/kln89.cxx @@ -43,11 +43,12 @@ #include "kln89_symbols.hxx" #include -#include +#include #include
-#include +#include +#include "Airports/simple.hxx" -SG_USING_STD(cout); +using std::cout; KLN89::KLN89(RenderArea2D* instrument) : DCLGPS(instrument) { @@ -558,12 +559,12 @@ void KLN89::DrawMap(bool draw_avs) { double mapScaleMeters = _mapScale * (_mapScaleUnits == 0 ? SG_NM_TO_METER : 1000); // TODO - use an aligned projection when either DTK or TK up! - FGATCAlignedProjection mapProj(Point3D(_gpsLon * SG_RADIANS_TO_DEGREES, _gpsLat * SG_RADIANS_TO_DEGREES, 0.0), _mapHeading); + FGATCAlignedProjection mapProj(SGGeod::fromRad(_gpsLon, _gpsLat), _mapHeading); double meter_per_pix = (_mapOrientation == 0 ? mapScaleMeters / 20.0f : mapScaleMeters / 29.0f); - Point3D bottomLeft = mapProj.ConvertFromLocal(Point3D(gps_max(-57.0 * meter_per_pix, -50000), gps_max((_mapOrientation == 0 ? -20.0 * meter_per_pix : -11.0 * meter_per_pix), -25000), 0.0)); - Point3D topRight = mapProj.ConvertFromLocal(Point3D(gps_min(54.0 * meter_per_pix, 50000), gps_min((_mapOrientation == 0 ? 20.0 * meter_per_pix : 29.0 * meter_per_pix), 25000), 0.0)); + SGGeod bottomLeft = mapProj.ConvertFromLocal(SGVec3d(gps_max(-57.0 * meter_per_pix, -50000), gps_max((_mapOrientation == 0 ? -20.0 * meter_per_pix : -11.0 * meter_per_pix), -25000), 0.0)); + SGGeod topRight = mapProj.ConvertFromLocal(SGVec3d(gps_min(54.0 * meter_per_pix, 50000), gps_min((_mapOrientation == 0 ? 20.0 * meter_per_pix : 29.0 * meter_per_pix), 25000), 0.0)); // Draw Airport labels first (but not one's that are waypoints) // Draw Airports first (but not one's that are waypoints) @@ -576,7 +577,6 @@ void KLN89::DrawMap(bool draw_avs) { // Annotation then gets drawn by Nav page, NOT this function. if(_drawApt && draw_avs) { - airport_list apt; /* bool have_apt = _overlays->FindArpByRegion(&apt, bottomLeft.lat(), bottomLeft.lon(), topRight.lat(), topRight.lon()); //cout << "Vors enclosed are: "; @@ -646,8 +646,8 @@ void KLN89::DrawMap(bool draw_avs) { for(unsigned int i=1; i<_activeFP->waypoints.size(); ++i) { GPSWaypoint* wp0 = _activeFP->waypoints[i-1]; GPSWaypoint* wp1 = _activeFP->waypoints[i]; - Point3D p0 = mapProj.ConvertToLocal(Point3D(wp0->lon * SG_RADIANS_TO_DEGREES, wp0->lat * SG_RADIANS_TO_DEGREES, 0.0)); - Point3D p1 = mapProj.ConvertToLocal(Point3D(wp1->lon * SG_RADIANS_TO_DEGREES, wp1->lat * SG_RADIANS_TO_DEGREES, 0.0)); + SGVec3d p0 = mapProj.ConvertToLocal(SGGeod::fromRad(wp0->lon, wp0->lat)); + SGVec3d p1 = mapProj.ConvertToLocal(SGGeod::fromRad(wp1->lon, wp1->lat)); int mx0 = int(p0.x() / meter_per_pix) + 56; int my0 = int(p0.y() / meter_per_pix) + (_mapOrientation == 0 ? 19 : 10); int mx1 = int(p1.x() / meter_per_pix) + 56;