Exemplo n.º 1
0
        public override void Render(DrawingContext context, Rect viewRect, double zoom, Point leftTopPixel, bool isDarkTheme)
        {
            var pointCenter = Location.ToPixel(zoom);

            if (!viewRect.IntersectsWith(new Rect(pointCenter - MarkerSize, pointCenter + MarkerSize)))
            {
                return;
            }

            var basePoint = (Point)(Location.ToPixel(zoom) - leftTopPixel);

            context.DrawLine(CenterPen, basePoint - new Vector(5, 5), basePoint + new Vector(5, 5));
            context.DrawLine(CenterPen, basePoint - new Vector(-5, 5), basePoint + new Vector(-5, 5));

            if (zoom <= 6)
            {
                return;
            }

            if (cache == null || NeedUpdate || cachedZoom != zoom)
            {
                cache      = GeometryGenerator.MakeCircleGeometry(Location, Distance, zoom, 30);
                NeedUpdate = false;
                cachedZoom = zoom;
            }

            if (cache == null)
            {
                return;
            }
            if (cache.Transform is not TranslateTransform tt)
            {
                cache.Transform = new TranslateTransform(-leftTopPixel.X, -leftTopPixel.Y);
            }