private IList <IGPSLocation> getSelectedGPSLocations(IMapDrawContext drawContext) { IList <IGPSLocation> list = new List <IGPSLocation>() { }; IMapControl mapControl = UI.MapLayers.MapControlLayer.Instance.MapControl; ICollection <IMapControlObject> selectedGPS = mapControl.Selected; if (selectedGPS.Count > 0) { IMapControlObject[] selectedMapControlObjects = new IMapControlObject[selectedGPS.Count]; selectedGPS.CopyTo(selectedMapControlObjects, 0); for (int i = 0; i < selectedGPS.Count; i++) { Rectangle rec = selectedMapControlObjects[i].PixelBounds(drawContext); int X = rec.X + (rec.Width / 2) - (drawContext.DrawRectangle.Width / 2); int Y = rec.Y + (rec.Height / 2) - (drawContext.DrawRectangle.Height / 2); IGPSLocation loc = drawContext.Projection.PixelToGPS(drawContext.Center, drawContext.ZoomLevel, new Point(X, Y)); list.Add(loc); } } return(list); }
public ICollection <IMapControlObject> HitTest(Rectangle rectClient, IMapDrawContext drawContext) { if (_showPage) { //No select by rect in Trails page, just individual points throw new NotImplementedException(); } else { return(null); } }
private IList<IGPSLocation> getSelectedGPSLocations(IMapDrawContext drawContext) { IList<IGPSLocation> list = new List<IGPSLocation>() { }; IMapControl mapControl = UI.MapLayers.MapControlLayer.Instance.MapControl; ICollection<IMapControlObject> selectedGPS = mapControl.Selected; if (selectedGPS.Count > 0) { IMapControlObject[] selectedMapControlObjects = new IMapControlObject[selectedGPS.Count]; selectedGPS.CopyTo(selectedMapControlObjects, 0); for (int i = 0; i < selectedGPS.Count; i++) { Rectangle rec = selectedMapControlObjects[i].PixelBounds(drawContext); int X = rec.X + (rec.Width / 2) - (drawContext.DrawRectangle.Width / 2); int Y = rec.Y + (rec.Height / 2) - (drawContext.DrawRectangle.Height / 2); IGPSLocation loc = drawContext.Projection.PixelToGPS(drawContext.Center, drawContext.ZoomLevel, new Point(X, Y)); list.Add(loc); } } return list; }
public void Draw(IMapDrawContext drawContext) { if (m_CaptureSelectedGPSLocations) { m_CaptureSelectedGPSLocations = false; if (m_SelectedGPSLocations.Count != MapControl.Selected.Count) { m_SelectedGPSLocations = getSelectedGPSLocations(drawContext); SelectedGPSLocationsChanged(this, new System.EventArgs()); } } if (_showPage) { //drawContext.Center IGPSLocation loc1 = drawContext.Projection.PixelToGPS(drawContext.Center, drawContext.ZoomLevel, new Point(0, 0)); IGPSLocation loc2 = drawContext.Projection.PixelToGPS(drawContext.Center, drawContext.ZoomLevel, new Point(0, 100)); IGPSPoint point1 = Utils.GPS.LocationToPoint(loc1); IGPSPoint point2 = Utils.GPS.LocationToPoint(loc2); float meters = point1.DistanceMetersToPoint(point2) / 100; float radiusInPixels = m_highlightRadius / meters; foreach (TrailGPSLocation gpsLocation in m_TrailPoints) { Point point = drawContext.Projection.GPSToPixel(drawContext.Center, drawContext.ZoomLevel, gpsLocation.GpsLocation); Pen pen = new Pen(Color.Red, 5.0F); drawContext.Graphics.SmoothingMode = System.Drawing.Drawing2D.SmoothingMode.HighQuality; float X = point.X + (drawContext.DrawRectangle.Width / 2) - radiusInPixels; float Y = point.Y + (drawContext.DrawRectangle.Height / 2) - radiusInPixels; if (X > 0 && X < 1000 && Y > 0 && Y < 1000) { //Prevent crashes at large elipses drawContext.Graphics.DrawEllipse(pen, X, Y, radiusInPixels * 2, radiusInPixels * 2); } } } }
public void Draw(IMapDrawContext drawContext) { if (m_CaptureSelectedGPSLocations) { m_CaptureSelectedGPSLocations = false; if (m_SelectedGPSLocations.Count != MapControl.Selected.Count) { m_SelectedGPSLocations = getSelectedGPSLocations(drawContext); SelectedGPSLocationsChanged(this, new System.EventArgs()); } } if (_showPage) { //drawContext.Center IGPSLocation loc1 = drawContext.Projection.PixelToGPS(drawContext.Center, drawContext.ZoomLevel, new Point(0,0)); IGPSLocation loc2 = drawContext.Projection.PixelToGPS(drawContext.Center, drawContext.ZoomLevel, new Point(0,100)); IGPSPoint point1 = Utils.GPS.LocationToPoint(loc1); IGPSPoint point2 = Utils.GPS.LocationToPoint(loc2); float meters = point1.DistanceMetersToPoint(point2) / 100; float radiusInPixels = m_highlightRadius / meters; foreach (TrailGPSLocation gpsLocation in m_TrailPoints) { Point point = drawContext.Projection.GPSToPixel(drawContext.Center, drawContext.ZoomLevel, gpsLocation.GpsLocation); Pen pen = new Pen(Color.Red, 5.0F); drawContext.Graphics.SmoothingMode = System.Drawing.Drawing2D.SmoothingMode.HighQuality; float X = point.X + (drawContext.DrawRectangle.Width / 2) - radiusInPixels; float Y = point.Y + (drawContext.DrawRectangle.Height / 2) - radiusInPixels; if (X > 0 && X < 1000 && Y > 0 && Y < 1000) { //Prevent crashes at large elipses drawContext.Graphics.DrawEllipse(pen, X, Y, radiusInPixels * 2, radiusInPixels * 2); } } } }
public Size InfoSize(IMapDrawContext drawContext, bool bSelected) { return(new Size()); }
public Rectangle PixelBounds(IMapDrawContext drawContext) { return(new Rectangle()); }
public void DrawInfo(IMapDrawContext drawContext, System.Drawing.Rectangle infoRect, bool bSelected) { }
public void DrawSelected(IMapDrawContext drawContext) { }
public IMapControlObject HitTest(Point ptClient, bool bSelect, IMapDrawContext drawContext, out Cursor cursor) { cursor = Cursors.Default; return(null); }
public void DrawHighlight(IMapDrawContext drawContext) { }
public ICollection<IMapControlObject> HitTest(Rectangle rectClient, IMapDrawContext drawContext) { if (_showPage) { //No select by rect in Trails page, just individual points throw new NotImplementedException(); } else { return null; } }
public IMapControlObject HitTest(Point ptClient, bool bSelect, IMapDrawContext drawContext, out Cursor cursor) { cursor = Cursors.Default; return null; }
public void DrawHighlight(IMapDrawContext drawContext) { }
public Rectangle PixelBounds(IMapDrawContext drawContext) { return new Rectangle(); }
public Size InfoSize(IMapDrawContext drawContext, bool bSelected) { return new Size(); }
public void DrawSelected(IMapDrawContext drawContext) { }
public void DrawInfo(IMapDrawContext drawContext, System.Drawing.Rectangle infoRect, bool bSelected) { }