示例#1
0
        protected override void OnRender(DrawingContext drawingContext)
        {
            base.OnRender(drawingContext);

            Point[] edges   = getViewEdges();
            bool    changed = net.findSquaresInViewRect(net.zeroSquare, new Rect(edges[0], edges[1]));

            Square[] squaresToRender = net.getCachedSquares();
            if (squaresToRender == null)
            {
                drawRect(new SquareRect(net.zeroSquare, net.averageBottomValue, net.maxDepth), drawingContext);
                foreach (Square square in net.getChildSquares(net.zeroSquare, 2))
                {
                    drawRect(new SquareRect(square, net.averageBottomValue, net.maxDepth), drawingContext);
                }
                return;
            }

            if (changed)
            {
                sRectsCache = generateSRects(squaresToRender);
            }

            visibleSquaresCount = squaresToRender.Length;
            foreach (SquareRect sRect in sRectsCache)
            {
                drawRect(sRect, drawingContext);
            }
        }
示例#2
0
        protected override void OnRender(DrawingContext drawingContext)
        {
            base.OnRender(drawingContext);

            PointLatLng[] edges = new PointLatLng[]
            {
                new PointLatLng(mapView.ViewArea.Lat, mapView.ViewArea.Lng),
                new PointLatLng(mapView.ViewArea.Lat - mapView.ViewArea.HeightLat, mapView.ViewArea.Lng + mapView.ViewArea.WidthLng)
            };
            bool changed = net.findSquaresInViewRect(
                net.zeroSquare,
                new Rect(new Point(edges[0].Lng, edges[0].Lat), new Point(edges[1].Lng, edges[1].Lat)),
                2000);

            Square[] squaresToRender = net.getCachedSquares();
            if (squaresToRender == null)
            {
                drawRect(new SquareRect(net.zeroSquare, net.averageBottomValue, net.maxDepth), drawingContext);
                foreach (Square square in net.getChildSquares(net.zeroSquare, 2))
                {
                    drawRect(new SquareRect(square, net.averageBottomValue, net.maxDepth), drawingContext);
                }
                return;
            }

            if (changed)
            {
                sRectsCache = generateSRects(squaresToRender);
            }

            visibleSquaresCount = squaresToRender.Length;
            foreach (SquareRect sRect in sRectsCache)
            {
                drawRect(sRect, drawingContext);
            }

            /*GPoint p = mapView.FromLatLngToLocal(edges[0]);
             * GPoint p1 = mapView.FromLatLngToLocal(edges[1]);
             *
             * drawingContext.DrawEllipse(Brushes.Green, new Pen(Brushes.Black, 1), new Point(p.X, p.Y), 20, 20);
             * drawingContext.DrawEllipse(Brushes.Green, new Pen(Brushes.Black, 1), new Point(p1.X, p1.Y), 20, 20);*/
        }