void MapWindow::DrawProjectedTrack(Canvas &canvas) { if (task == NULL || !task->Valid() || !task->getSettings().AATEnabled || task->getActiveIndex() ==0) return; if (Calculated().Circling || task->TaskIsTemporary()) { // don't display in various modes return; } // TODO feature: maybe have this work even if no task? // TODO feature: draw this also when in target pan mode GEOPOINT start = Basic().Location; GEOPOINT previous_loc = task->getTargetLocation(task->getActiveIndex() - 1); double distance_from_previous, bearing; DistanceBearing(previous_loc, start, &distance_from_previous, &bearing); if (distance_from_previous < 100.0) { bearing = Basic().TrackBearing; // too short to have valid data } POINT pt[2] = {{0,-75},{0,-400}}; if (SettingsMap().TargetPan) { double screen_range = GetScreenDistanceMeters(); double f_low = 0.4; double f_high = 1.5; screen_range = max(screen_range, Calculated().WaypointDistance); GEOPOINT p1, p2; FindLatitudeLongitude(start, bearing, f_low*screen_range, &p1); FindLatitudeLongitude(start, bearing, f_high*screen_range, &p2); LonLat2Screen(p1, pt[0]); LonLat2Screen(p2, pt[1]); } else if (fabs(bearing-Calculated().WaypointBearing)<10) { // too small an error to bother return; } else { pt[1].y = (long)(-max(MapRectBig.right-MapRectBig.left, MapRectBig.bottom-MapRectBig.top)*1.2); PolygonRotateShift(pt, 2, Orig_Aircraft.x, Orig_Aircraft.y, bearing-DisplayAngle); } Pen dash_pen(Pen::DASH, IBLSCALE(2), Color(0, 0, 0)); canvas.select(dash_pen); canvas.line(pt[0], pt[1]); }
void MapWindow::DrawCrossHairs(Canvas &canvas) { Pen dash_pen(Pen::DASH, 1, Color(50, 50, 50)); canvas.select(dash_pen); canvas.line(Orig_Screen.x + 20, Orig_Screen.x - 20, Orig_Screen.y, Orig_Screen.y); canvas.line(Orig_Screen.x, Orig_Screen.x, Orig_Screen.y + 20, Orig_Screen.y - 20); }
void MapWindow::DrawAbortedTask(Canvas &canvas) { if (way_points == NULL || task == NULL) return; Pen dash_pen(Pen::DASH, IBLSCALE(1), MapGfx.TaskColor); canvas.select(dash_pen); DrawAbortedTaskVisitor dv(canvas, Orig_Aircraft, *way_points); task->scan_point_forward(dv, false); // read lock }
void GlueMapWindow::DrawCrossHairs(Canvas &canvas) const { Pen dash_pen(Pen::DASH, 1, COLOR_DARK_GRAY); canvas.select(dash_pen); const RasterPoint Orig_Screen = render_projection.GetScreenOrigin(); canvas.line(Orig_Screen.x + 20, Orig_Screen.y, Orig_Screen.x - 20, Orig_Screen.y); canvas.line(Orig_Screen.x, Orig_Screen.y + 20, Orig_Screen.x, Orig_Screen.y - 20); }
void GlueMapWindow::DrawCrossHairs(Canvas &canvas) const { Pen dash_pen(Pen::DASH, 1, COLOR_DARK_GRAY); canvas.Select(dash_pen); const RasterPoint center = render_projection.GetScreenOrigin(); canvas.DrawLine(center.x + 20, center.y, center.x - 20, center.y); canvas.DrawLine(center.x, center.y + 20, center.x, center.y - 20); }
void MapWindow::DrawHorizon(Canvas &canvas, const RECT rc) { POINT Start; Start.y = IBLSCALE(55)+rc.top; Start.x = rc.right - IBLSCALE(19); if (SettingsMap().EnableVarioGauge && MapRectBig.right == rc.right) Start.x -= InfoBoxLayout::ControlWidth; Pen hpHorizonSky(IBLSCALE(1), Color(0x40,0x40,0xff)); Brush hbHorizonSky(Color(0xA0,0xA0,0xff)); Pen hpHorizonGround(IBLSCALE(1), Color(106,55,12)); Brush hbHorizonGround(Color(157,101,60)); int radius = IBLSCALE(17); double phi = max(-89,min(89,Calculated().BankAngle)); double alpha = RAD_TO_DEG *acos(max(-1.0,min(1.0,Calculated().PitchAngle/50.0))); double alpha1 = 180-alpha-phi; double alpha2 = 180+alpha-phi; canvas.select(hpHorizonSky); canvas.select(hbHorizonSky); canvas.segment(Start.x, Start.y, radius, rc, alpha2, alpha1, true); canvas.select(hpHorizonGround); canvas.select(hbHorizonGround); canvas.segment(Start.x, Start.y, radius, rc, alpha1, alpha2, true); /* POINT a1, a2; a1.x = Start.x + fastsine(alpha1)*radius; a1.y = Start.y - fastcosine(alpha1)*radius; a2.x = Start.x + fastsine(alpha2)*radius; a2.y = Start.y - fastcosine(alpha2)*radius; ClipDrawLine(hDC, PS_SOLID, IBLSCALE(1), a1, a2, RGB(0,0,0)); */ Pen dash_pen(Pen::DASH, 2, Color(0, 0, 0)); canvas.select(dash_pen); canvas.line(Start.x + radius / 2, Start.y, Start.x - radius / 2, Start.y); canvas.line(Start.x, Start.y - radius / 4, Start.x - radius / 2, Start.y); // #define ROOT2 0.70711 int rr2p = lround(radius*ROOT2+IBLSCALE(1)); int rr2n = lround(radius*ROOT2); Pen penb1(Pen::SOLID, 1, Color(0,0,0)); canvas.select(penb1); canvas.line(Start.x + rr2p, Start.y - rr2p, Start.x + rr2n, Start.y - rr2n); canvas.line(Start.x - rr2p, Start.y - rr2p, Start.x - rr2n, Start.y - rr2n); // JMW experimental, display stall sensor double s = max(0.0,min(1.0,Basic().StallRatio)); long m = (long)((rc.bottom-rc.top)*s*s); Pen penr2(Pen::SOLID, 1, Color(0,0,0)); canvas.select(penr2); canvas.line(rc.right - 1, rc.bottom - m, rc.right - 11, rc.bottom - m); }
void MapWindow::DrawWindAtAircraft2(Canvas &canvas, const POINT Orig, const RECT rc) { int i; POINT Start; TCHAR sTmp[12]; static SIZE tsize = {0,0}; if (Calculated().WindSpeed<1) { return; // JMW don't bother drawing it if not significant } if (tsize.cx == 0){ canvas.select(MapWindowBoldFont); tsize = canvas.text_size(TEXT("99")); tsize.cx = tsize.cx/2; } canvas.select(MapGfx.hpWind); canvas.select(MapGfx.hbWind); int wmag = iround(4.0*Calculated().WindSpeed); Start.y = Orig.y; Start.x = Orig.x; int kx = tsize.cx/InfoBoxLayout::scale/2; POINT Arrow[7] = { {0,-20}, {-6,-26}, {0,-20}, {6,-26}, {0,-20}, {8+kx, -24}, {-8-kx, -24}}; for (i=1;i<4;i++) Arrow[i].y -= wmag; PolygonRotateShift(Arrow, 7, Start.x, Start.y, Calculated().WindBearing-DisplayAngle); canvas.polygon(Arrow, 5); if (SettingsMap().WindArrowStyle==1) { POINT Tail[2] = {{0,-20}, {0,-26-min(20,wmag)*3}}; double angle = AngleLimit360(Calculated().WindBearing-DisplayAngle); for(i=0; i<2; i++) { if (InfoBoxLayout::scale>1) { Tail[i].x *= InfoBoxLayout::scale; Tail[i].y *= InfoBoxLayout::scale; } protateshift(Tail[i], angle, Start.x, Start.y); } // optionally draw dashed line Pen dash_pen(Pen::DASH, 1, Color(0, 0, 0)); canvas.select(dash_pen); canvas.line(Tail[0], Tail[1]); } _stprintf(sTmp, TEXT("%i"), iround(Calculated().WindSpeed * SPEEDMODIFY)); TextInBoxMode_t TextInBoxMode = { 16 | 32 }; // JMW test {2 | 16}; if (Arrow[5].y>=Arrow[6].y) { TextInBox(canvas, sTmp, Arrow[5].x-kx, Arrow[5].y, TextInBoxMode, rc); } else { TextInBox(canvas, sTmp, Arrow[6].x-kx, Arrow[6].y, TextInBoxMode, rc); } }