Ejemplo n.º 1
0
        /// <summary>
        /// Removes the specified contour.
        /// </summary>
        /// <param name="contour">The contour.</param>
        public void Remove(PolygonContour contour)
        {
            foreach (var item in Shapes)
            {
                switch (item)
                {
                case Group g:
                    g.Remove(contour);
                    break;

                case Polygon p:
                    p.Remove(contour);
                    break;

                case PolygonContour c:
                    if (c == contour)
                    {
                        Shapes.Remove(c);
                        return;
                    }

                    break;
                }
            }
        }
        /// <summary>
        /// Translates the specified path.
        /// </summary>
        /// <param name="path">The path.</param>
        /// <param name="delta">The delta.</param>
        /// <returns></returns>
        public static PolygonContour Translate(PolygonContour path, Vector2 delta)
        {
            var contour = new List <PointF>(path.Points.Count);

            for (var i = 0; i < path.Points.Count; i++)
            {
                contour.Add(new PointF(path[i].X + delta.X, path[i].Y + delta.Y));
            }

            return(new PolygonContour(contour));
        }
 /// <summary>
 /// Initializes a new instance of the <see cref="PolygonContour" /> class.
 /// </summary>
 /// <param name="polygon">The <paramref name="polygon" />.</param>
 public PolygonContour(PolygonContour polygon)
     : this(polygon.Points)
 {
 }
Ejemplo n.º 4
0
 /// <summary>
 /// Inserts the specified contour.
 /// </summary>
 /// <param name="index">The index.</param>
 /// <param name="contour">The contour.</param>
 public void Insert(int index, PolygonContour contour) => Shapes.Insert(index, contour);
Ejemplo n.º 5
0
 /// <summary>
 /// Adds the specified contour.
 /// </summary>
 /// <param name="contour">The contour.</param>
 public void Add(PolygonContour contour)
 {
     Shapes.Add(contour);
 }