Пример #1
0
 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)));
 }
Пример #2
0
 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));
 }
Пример #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);
 }
Пример #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();
            }
        }
Пример #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();
            }
        }
Пример #7
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);
        }
Пример #8
0
 virtual protected void TranslateCoords()
 {
     _screenView = _centerCoordinate.GetScreenViewFromCenter(Width, Height, _level);
     _coordinateView = ScreenView;
 }
Пример #9
0
 public static Coordinate GetCoordinateFromScreen(GoogleRectangle screenView, Point point)
 {
     return screenView.LeftTop + new GoogleCoordinate(point.X, point.Y, screenView.Level);
 }
Пример #10
0
 public Point GetScreenPoint(GoogleRectangle screenView)
 {
     return new GoogleCoordinate(this, screenView.Level).GetScreenPoint(screenView);
 }
Пример #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;
        }