Exemplo n.º 1
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");
            }
        }
Exemplo n.º 2
0
        public void removePoint(PolygonPoint p)
        {
            PolygonPoint next, prev;

            next = p.getNext();
            prev = p.getPrevious();
            prev.setNext(next);
            next.setPrevious(prev);
            _points.Remove(p);
        }
Exemplo n.º 3
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);
        }