예제 #1
0
 /// <summary>
 /// Will add a point after the last point added
 /// </summary>
 public void addPoint(PolygonPoint p)
 {
     p.setPrevious(_last);
     p.setNext(_last.getNext());
     _last.setNext(p);
     _points.Add(p);
 }
예제 #2
0
        public void addPoints(List <PolygonPoint> list)
        {
            PolygonPoint first;

            foreach (PolygonPoint p in list)
            {
                p.setPrevious(_last);
                if (_last != null)
                {
                    p.setNext(_last.getNext());
                    _last.setNext(p);
                }
                _last = p;
                _points.Add(p);
            }
            first = (PolygonPoint)_points[0];
            _last.setNext(first);
            first.setPrevious(_last);
        }
예제 #3
0
        /// <summary>
        /// Will insert a point in the polygon after given point
        /// </summary>
        public void insertPointAfter(PolygonPoint a, PolygonPoint newPoint)
        {
            // Validate that
            int index = _points.IndexOf(a);

            if (index != -1)
            {
                newPoint.setNext(a.getNext());
                newPoint.setPrevious(a);
                a.getNext().setPrevious(newPoint);
                a.setNext(newPoint);
                _points.Insert(index + 1, newPoint);
            }
            else
            {
                throw new Exception("Tried to insert a point into a Polygon after a point not belonging to the Polygon");
            }
        }