public Point GetScreenPoint(GoogleRectangle screenView)
 {
     if (Level != screenView.Level)
     {
         screenView = new GoogleRectangle(new CoordinateRectangle(screenView.LeftTop, screenView.RightBottom), Level);
     }
     return(new Point((int)(X - screenView.Left), (int)(Y - screenView.Top)));
 }
 public Point GetScreenPoint(GoogleRectangle screenView)
 {
     if (Level != screenView.Level)
     {
         screenView = new GoogleRectangle(new CoordinateRectangle(screenView.LeftTop, screenView.RightBottom), Level);
     }
     return new Point((int)(X - screenView.Left), (int)(Y - screenView.Top));
 }
Exemple #3
0
        public Rectangle GetScreenRect(GoogleRectangle screenView)
        {
            if (Level != screenView.Level)
            {
                screenView = new GoogleRectangle(
                    new CoordinateRectangle(screenView.LeftTop, screenView.RightBottom), Level);
            }

            var pt1 = LeftTop.GetScreenPoint(screenView);
            var pt2 = RightBottom.GetScreenPoint(screenView);

            return(Rectangle.FromLTRB(pt1.X, pt1.Y, pt2.X, pt2.Y));
        }
 public Rectangle GetScreenRect(GoogleRectangle screenView)
 {
     return new GoogleRectangle(this, screenView.Level).GetScreenRect(screenView);
 }
Exemple #5
0
        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();
            }
        }
Exemple #6
0
        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();
            }
        }
        public Rectangle GetScreenRect(GoogleRectangle screenView)
        {
            if (Level != screenView.Level)
            {
                screenView = new GoogleRectangle(
                    new CoordinateRectangle(screenView.LeftTop, screenView.RightBottom), Level);
            }

            var pt1 = LeftTop.GetScreenPoint(screenView);
            var pt2 = RightBottom.GetScreenPoint(screenView);

            return Rectangle.FromLTRB(pt1.X, pt1.Y, pt2.X, pt2.Y);
        }
 virtual protected void TranslateCoords()
 {
     _screenView = _centerCoordinate.GetScreenViewFromCenter(Width, Height, _level);
     _coordinateView = ScreenView;
 }
 public static Coordinate GetCoordinateFromScreen(GoogleRectangle screenView, Point point)
 {
     return screenView.LeftTop + new GoogleCoordinate(point.X, point.Y, screenView.Level);
 }
Exemple #10
0
 public Point GetScreenPoint(GoogleRectangle screenView)
 {
     return new GoogleCoordinate(this, screenView.Level).GetScreenPoint(screenView);
 }
Exemple #11
0
        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;
        }