//右クリック時、すべての座標、●、方向線を削除
 private void MyCanvas_MouseRightButtonDown(object sender, MouseButtonEventArgs e)
 {
     MySegment.Points.Clear();
     MyControlLines.Clear();
     MyEllipseGeometry.Clear();
     foreach (var item in MyListPathControl)
     {
         MyCanvas.Children.Remove(item);
     }
     MyListPathControl.Clear();
 }
Esempio n. 2
0
        public Path WpfCompoundPolyline(wShapeCollection Shapes)
        {
            Path X = new Path();
            PathFigureCollection Fc = new PathFigureCollection();
            PathGeometry         G  = new PathGeometry();

            Fc.Clear();

            foreach (wShape Shp in Shapes.Shapes)
            {
                PathSegmentCollection Sc = new PathSegmentCollection();
                PathFigure            Pf = new PathFigure();
                wCurve Crv        = Shp.Curve;
                wPoint StartPoint = Crv.Points[0];

                Pf.StartPoint = new System.Windows.Point(StartPoint.X * Scale, StartPoint.Y * Scale);

                PathGeometry          Geo  = (PathGeometry)WpfPolyline(Crv, Shapes.Graphics, Shapes.Effects).Data;
                PathFigureCollection  Fig  = (PathFigureCollection)Geo.Figures;
                PathFigure            PFig = (PathFigure)(Fig[0]);
                PathSegmentCollection Seg  = (PathSegmentCollection)PFig.Segments;

                PolyLineSegment Pl = (PolyLineSegment)Seg[0];
                PolyLineSegment S  = new PolyLineSegment(Pl.Points, true);

                Pf.IsClosed = true;

                Sc.Add(S);
                Pf.Segments = Sc;
                Fc.Add(Pf);
            }

            G.Figures = Fc;
            X.Data    = G;

            X.RenderTransform = Xform;

            wGraphic Graphics     = Shapes.Graphics;
            wEffects ShapeEffects = Shapes.Effects;

            X = SetPathFill(X, Graphics);
            X = SetPathStroke(X, Graphics);
            X = SetPathEffects(X, ShapeEffects);


            group.Shapes.Add(new wShape(G, Graphics));
            return(X);
        }
Esempio n. 3
0
        public Path WpfCompoundSpline(wShapeCollection Shapes)
        {
            Path X = new Path();
            PathFigureCollection Fc = new PathFigureCollection();
            PathGeometry         G  = new PathGeometry();

            Fc.Clear();

            foreach (wShape Shp in Shapes.Shapes)
            {
                PathSegmentCollection Sc = new PathSegmentCollection();
                PathFigure            Pf = new PathFigure();
                wBezierSpline         C  = (wBezierSpline)Shp.Curve;
                wPoint StartPoint        = C.Points[0];

                PolyBezierSegment S = new PolyBezierSegment();

                Pf.StartPoint = new System.Windows.Point(C.Points[0].X * Scale, C.Points[0].Y * Scale);

                for (int i = 1; i < C.Points.Count; i++)
                {
                    wPoint P = C.Points[i];
                    S.Points.Add(new System.Windows.Point(P.X * Scale, P.Y * Scale));
                }

                Sc.Add(S);
                Pf.Segments = Sc;
                //Pf.IsClosed = true;
                Fc.Add(Pf);
            }

            G.Figures = Fc;
            X.Data    = G;

            X.RenderTransform = Xform;

            wGraphic Graphics     = Shapes.Graphics;
            wEffects ShapeEffects = Shapes.Effects;

            X = SetPathStroke(X, Graphics);
            X = SetPathFill(X, Graphics);
            X = SetPathEffects(X, ShapeEffects);


            group.Shapes.Add(new wShape(G, Graphics));
            return(X);
        }
Esempio n. 4
0
        /// <summary>
        /// Removes all <see cref="PathFigure"/> objects from this <see cref="PathGeometry"/>.
        /// </summary>
        /// <param name="pathGeometry">The <see cref="PathGeometry"/>.</param>
        /// <exception cref="ArgumentNullException">
        /// <paramref name="pathGeometry"/> is <see langword="null"/>.
        /// </exception>
        public static void Clear(this PathGeometry pathGeometry)
        {
            if (pathGeometry == null)
            {
                throw new ArgumentNullException(nameof(pathGeometry));
            }

            PathFigureCollection figures = pathGeometry.Figures;

            if (figures != null)
            {
                figures.Clear();
            }

            // Reassign figures collection - otherwise Silverlight won't update the visual.
            pathGeometry.Figures = figures;
        }