public Path GetCircumCircle(Polygon polygon)
 {
     if (!circles.ContainsKey(polygon))
     {
         Triad triad = triangles[polygon];
         EllipseGeometry geometry = new EllipseGeometry();
         geometry.Center = new Point(triad.CircumcircleX, triad.CircumcircleY);
         geometry.RadiusX = geometry.RadiusY = Math.Sqrt(triad.CircumcircleR2);
         geometry.Freeze();
         Path path = new Path();
         Panel.SetZIndex(path, CircleZIndex);
         path.StrokeThickness = CircleStrokeTickness;
         path.Stroke = new SolidColorBrush(circleStrokeColor);
         path.Data = geometry;
         circles[polygon] = path;
     }
     return circles[polygon];
 }
Пример #2
0
        public Path CreateVertexPoint(Vertex vertex)
        {
            if (this.verticesPaths == null)
            {
                this.verticesPaths = new Dictionary<Vertex, Path>();
            }

            if (!this.verticesPaths.ContainsKey(vertex))
            {
                EllipseGeometry geometry = new EllipseGeometry();
                geometry.Center = new Point(vertex.X, vertex.Y);
                geometry.RadiusX = geometry.RadiusY = VertexRadius;
                geometry.Freeze();
                Path path = new Path();
                path.StrokeThickness = VertexTickness;
                path.Stroke = new SolidColorBrush(VertexColor);
                path.Data = geometry;
                this.verticesPaths[vertex] = path;
            }
            return this.verticesPaths[vertex];
        }
Пример #3
0
        protected override void OnRender(DrawingContext dc)
        {
            // Draw background
            dc.DrawRectangle(Brushes.White, null, new Rect(RenderSize));

            Transform t = new MatrixTransform(TheModel.GetTikzToScreenTransform().ToWpfMatrix());
            t.Freeze();

            Pen pen = new Pen(Brushes.WhiteSmoke, 1);
            pen.Freeze();

            TheModel.DrawRaster(
                (p1, p2) => dc.DrawLine(pen, t.Transform(p1), t.Transform(p2)),
                (r1, r2) =>
                {
                    EllipseGeometry eg = new EllipseGeometry(new Point(0, 0), r1, r2);
                    eg.Transform = t;
                    eg.Freeze();
                    dc.DrawGeometry(null, pen, eg);
                });

        }