#include "kln89_symbols.hxx"
#include <iostream>
-#include <ATC/ATCProjection.hxx>
+#include <ATCDCL/ATCProjection.hxx>
#include <Main/fg_props.hxx>
-#include <simgear/math/point3d.hxx>
+#include <simgear/math/SGMath.hxx>
+#include "Airports/simple.hxx"
-SG_USING_STD(cout);
+using std::cout;
KLN89::KLN89(RenderArea2D* instrument)
: DCLGPS(instrument) {
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)
// 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: ";
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;