public override void Paint(object sender, PaintEventArgs e) { try { base.Paint(sender, e); if (!Project.spoiling) { if (!HasPutOnMap) { //LibSys.StatusBar.Trace("LayerVehicles:Paint(): calling PutOnMap()"); PutOnMap(); } foreach (LiveObject lo in VehiclesCache.LiveObjects) { if (lo.BoundingRect.IsEmpty) // new object just added dynamically, or old object moved { lo.PutOnMap(this, null, this); PictureManager.Invalidate(lo.BoundingRect); // will cause Paint } else if (e.ClipRectangle.IntersectsWith(lo.BoundingRect)) { lo.Paint(e.Graphics, this, null); } } } } catch (Exception eee) { LibSys.StatusBar.Error("LV:Paint(): " + eee.Message); } }
public void VehicleMoveHandler(LiveObject lo, Rectangle prev) { //LibSys.StatusBar.Trace("IP: LayerVehicles:VehicleMoveHandler() veh=" + lo); lo.init(true); // provoke PutOnMap in Paint() prev.Inflate(1, 1); // it is likely that move is not too far, so do one bigger invalidate - save drawing time: PictureManager.Invalidate(Rectangle.Union(prev, lo.BoundingRect)); //PictureManager.Invalidate(lo.BoundingRect); //PictureManager.Invalidate(prev); }
public override void Paint(object sender, PaintEventArgs e) { try { base.Paint(sender, e); if (!Project.spoiling) { if (!HasPutOnMap) { //LibSys.StatusBar.Trace("LayerEarthquakes:Paint(): calling PutOnMap()"); PutOnMap(); } foreach (Earthquake eq in EarthquakesCache.EarthquakesAll) { if (TimeMagnitudeFilter.passesAll(eq.DateTime, eq.Magn)) { if (eq.BoundingRect.IsEmpty) // new object just added dynamically, or old object moved { eq.PutOnMap(this, null, this); PictureManager.Invalidate(eq.BoundingRect); } Point pixelPos = toPixelLocation(eq.Location, null); if (e.ClipRectangle.IntersectsWith(eq.BoundingRect)) { eq.Paint(e.Graphics, this, null); } } } foreach (Earthquake eq in EarthquakesCache.EarthquakesAll) { if (TimeMagnitudeFilter.passesAll(eq.DateTime, eq.Magn)) { eq.AdjustPlacement(this, null, this); } } foreach (Earthquake eq in EarthquakesCache.EarthquakesAll) { Point pixelPos = toPixelLocation(eq.Location, null); if (e.ClipRectangle.IntersectsWith(eq.BoundingRect) && TimeMagnitudeFilter.passesAll(eq.DateTime, eq.Magn)) { eq.PaintLabel(e.Graphics, this, null, false); } } } } catch (Exception eee) { //LibSys.StatusBar.Error("LayerEarthquakes:Paint(): " + eee); } }
public void EarthquakeMoveHandler(LiveObject lo, Rectangle prev) { //LibSys.StatusBar.Trace("IP: LayerEarthquakes:EarthquakeRemoveHandler() eq=" + lo); lo.init(true); // provoke PutOnMap in Paint() PictureManager.Invalidate(prev); }
public void EarthquakeDeleteHandler(LiveObject lo) { //LibSys.StatusBar.Trace("IP: LayerEarthquakes:EarthquakeRemoveHandler() eq=" + lo); PictureManager.Invalidate(lo.BoundingRect); }
public void VehicleDeleteHandler(LiveObject lo) { //LibSys.StatusBar.Trace("IP: LayerVehicles:VehicleDeleteHandler() veh=" + lo); PictureManager.Invalidate(lo.BoundingRect); }
public override void Paint(object sender, PaintEventArgs e) { try { base.Paint(sender, e); if (!Project.spoiling) { if (!HasPutOnMap) { //LibSys.StatusBar.Trace("LayerWaypoints:Paint(): calling PutOnMap()"); PutOnMap(); } foreach (LiveObject lo in WaypointsCache.WaypointsAll) { if (lo.BoundingRect.IsEmpty) // new object just added dynamically, or old object moved { lo.PutOnMap(this, null, this); PictureManager.Invalidate(lo.BoundingRect); } Point pixelPos = toPixelLocation(lo.Location, null); if (e.ClipRectangle.IntersectsWith(lo.BoundingRect)) { lo.Paint(e.Graphics, this, null); } } foreach (LiveObject lo in WaypointsCache.WaypointsAll) { lo.AdjustPlacement(this, null, this); } foreach (LiveObject lo in WaypointsCache.WaypointsAll) { Point pixelPos = toPixelLocation(lo.Location, null); if (e.ClipRectangle.IntersectsWith(lo.BoundingRect)) { lo.PaintLabel(e.Graphics, this, null, false); } } foreach (Track trk in WaypointsCache.TracksAll) { trk.Paint(e.Graphics, this, null); } if (moveLegMode) { int MARK_RADIUS = 5; int minX = Math.Min(Math.Min(m_movePoint.X - MARK_RADIUS - 1, hotLeg.WptFrom.PixelLocation.X), hotLeg.WptTo.PixelLocation.X); int maxX = Math.Max(Math.Max(m_movePoint.X + MARK_RADIUS + 1, hotLeg.WptFrom.PixelLocation.X), hotLeg.WptTo.PixelLocation.X); int minY = Math.Min(Math.Min(m_movePoint.Y - MARK_RADIUS - 1, hotLeg.WptFrom.PixelLocation.Y), hotLeg.WptTo.PixelLocation.Y); int maxY = Math.Max(Math.Max(m_movePoint.Y + MARK_RADIUS + 1, hotLeg.WptFrom.PixelLocation.Y), hotLeg.WptTo.PixelLocation.Y); m_lastMoveLegRect = new Rectangle(minX - 10, minY - 10, maxX - minX + 12, maxY - minY + 12); Rectangle r = new Rectangle(m_movePoint.X - MARK_RADIUS, m_movePoint.Y - MARK_RADIUS, MARK_RADIUS * 2, MARK_RADIUS * 2); e.Graphics.DrawRectangle(Pens.Red, r); e.Graphics.DrawLine(Pens.Red, m_movePoint, hotLeg.WptFrom.PixelLocation); e.Graphics.DrawLine(Pens.Red, m_movePoint, hotLeg.WptTo.PixelLocation); } else { m_lastMoveLegRect = Rectangle.Empty; } } } catch (Exception eee) { //LibSys.StatusBar.Error("LayerWaypoints:Paint(): " + eee); } }