private bool DrawImages(Rectangle localBlockView, GoogleRectangle localScreenView) { for (var x = localBlockView.Left; x <= localBlockView.Right; x++) { for (var y = localBlockView.Top; y <= localBlockView.Bottom; y++) { var block = new GoogleBlock(x, y, Level); var pt = ((GoogleCoordinate)block).GetScreenPoint(localScreenView); var bmp = FindImage(block); if (bmp != null) { DrawBitmap(bmp, pt); } else { DrawBitmap(_emptyBlock, pt); PutMapThreadEvent(WorkerEventType.DownloadImage, block, EventPriorityType.Idle); } if (Terminating) { return(true); } if (localScreenView.CompareTo(ScreenView) != 0) { return(false); } } } return(true); }
protected override void OnLoad(EventArgs e) { base.OnLoad(e); var circle = new GoogleCircle { Center = new LatLng(42.1229, 24.7879), Radius = 200000 }; var polygon = new GooglePolygon { FillColor = Color.Red, FillOpacity = .5F, StrokeColor = Color.Black, StrokeWeight = 5, Paths = new List<LatLng> { new LatLng(37.97918, 23.716647), new LatLng(41.036501, 28.984895), new LatLng(44.447924, 26.097879), new LatLng(44.802416, 20.465601), new LatLng(42.002411, 21.436097), new LatLng(37.97918, 23.716647), new LatLng(37.97918, 23.716647) } }; var rectangle = new GoogleRectangle { FillColor = Color.Green, Bounds = new Bounds { SouthWest = new LatLng(44.802416, 20.465601), NorthEast = new LatLng(37.97918, 23.716647) } }; GoogleMap1.Overlays.Add(circle); GoogleMap1.Overlays.Add(polygon); GoogleMap1.Overlays.Add(rectangle); }
private void LineSheetAction(TNode node, SheetActionType actionType) { var blockViewLevel = NextGoogleLevel; var line = node.Rectangle; var rect = new GoogleRectangle(line, blockViewLevel).BlockView; var deltaX = (rect.Left <= rect.Right) ? 1 : -1; var deltaY = (rect.Top <= rect.Bottom) ? 1 : -1; //line search in daughter sheet for (var x = rect.Left; (deltaX == 1 && x <= rect.Right) || (deltaX == -1 && x >= rect.Right); x += deltaX) { for (var y = rect.Top; (deltaY == 1 && y <= rect.Bottom) || (deltaY == -1 && y >= rect.Bottom); y += deltaY) { var block = new GoogleBlock(x, y, blockViewLevel); var googleRect = (GoogleRectangle)block; if (googleRect.LineContains(line) != InterseptResult.None) { lock (this) { var sheet = Sheets[block]; sheet.SheetAction(node, actionType); PostSheetAction(block, sheet, actionType); } } } } }
private void RectangleSheetAction(TNode node, SheetActionType actionType) { var blockViewLevel = NextGoogleLevel; var rect = new GoogleRectangle(node.Rectangle, blockViewLevel).BlockView; var deltaX = (rect.Left <= rect.Right) ? 1 : -1; var deltaY = (rect.Top <= rect.Bottom) ? 1 : -1; //rectangle search in daughter sheet for (var x = rect.Left; (deltaX == 1 && x <= rect.Right) || (deltaX == -1 && x >= rect.Right); x += deltaX) { for (var y = rect.Top; (deltaY == 1 && y <= rect.Bottom) || (deltaY == -1 && y >= rect.Bottom); y += deltaY) { var block = new GoogleBlock(x, y, blockViewLevel); lock (this) { var sheet = Sheets[block]; sheet.SheetAction(node, actionType); PostSheetAction(block, sheet, actionType); } } } }
private void RedrawCables(GoogleRectangle localScreenView) { try { _lockCr.EnterReadLock(); if (_rCableTree.NodeCount == 0) { return; } var res = _rCableTree.Query(localScreenView); foreach (var node in res) { var row = (SimpleMapDb.CablesRow)node.Row; var cabRect = new CoordinateRectangle(row.Longitude1, row.Latitude1, row.Longitude2, row.Latitude2); var rect = cabRect.GetScreenRect(localScreenView); DrawLine(rect, 2, Color.Blue); if (Level >= 14) { var caption = row.Caption; if (!String.IsNullOrEmpty(caption)) { var coordinate = cabRect.LineMiddlePoint; var point = coordinate.GetScreenPoint(localScreenView); DrawString(caption, HalfVertexSize.Height, Point.Add(point, HalfVertexSize)); } } } } catch (Exception ex) { //do nothing System.Diagnostics.Trace.WriteLine(ex.Message); } finally { _lockCr.ExitReadLock(); } }
private void RedrawVertexes(GoogleRectangle localScreenView) { try { _lockVr.EnterReadLock(); if (_rVertexTree.NodeCount == 0) { return; } var res = _rVertexTree.Query(localScreenView); foreach (var node in res) { var row = (SimpleMapDb.VertexesRow)node.Row; var coordinate = new Coordinate(row.Longitude, row.Latitude); var pt = coordinate.GetScreenPoint(localScreenView); DrawBitmap(Vertex, Point.Subtract(pt, HalfVertexSize)); if (Level >= 14) { var caption = row.Caption; if (!String.IsNullOrEmpty(caption)) { DrawString(caption, HalfVertexSize.Height, Point.Add(pt, HalfVertexSize)); } } } } catch (Exception ex) { //do nothing System.Diagnostics.Trace.WriteLine(ex.Message); } finally { _lockVr.ExitReadLock(); } }
protected override void OnLoad(EventArgs e) { base.OnLoad(e); var circle = new GoogleCircle { Center = new LatLng(42.1229, 24.7879), Radius = 200000 }; var polygon = new GooglePolygon { FillColor = Color.Red, FillOpacity = .5F, StrokeColor = Color.Black, StrokeWeight = 5, Paths = new List <LatLng> { new LatLng(37.97918, 23.716647), new LatLng(41.036501, 28.984895), new LatLng(44.447924, 26.097879), new LatLng(44.802416, 20.465601), new LatLng(42.002411, 21.436097), new LatLng(37.97918, 23.716647), new LatLng(37.97918, 23.716647) } }; var rectangle = new GoogleRectangle { FillColor = Color.Green, Bounds = new Bounds { SouthWest = new LatLng(44.802416, 20.465601), NorthEast = new LatLng(37.97918, 23.716647) } }; GoogleMap1.Overlays.Add(circle); GoogleMap1.Overlays.Add(polygon); GoogleMap1.Overlays.Add(rectangle); }
public static Coordinate GetCoordinateFromScreen(GoogleRectangle screenView, Point point) { return(screenView.LeftTop + new GoogleCoordinate(point.X, point.Y, screenView.Level)); }
public Point GetScreenPoint(GoogleRectangle screenView) { return(new GoogleCoordinate(this, screenView.Level).GetScreenPoint(screenView)); }
virtual protected void TranslateCoords() { _screenView = _centerCoordinate.GetScreenViewFromCenter(Width, Height, _level); _coordinateView = ScreenView; }
public Rectangle GetScreenRect(GoogleRectangle screenView) { return(new GoogleRectangle(this, screenView.Level).GetScreenRect(screenView)); }