示例#1
0
		/// <summary>
		/// Removes a point from the polygon.
		/// </summary>
		/// <param name="p"></param>
		public void RemovePoint(PolygonPoint p)
		{
			PolygonPoint next, prev;

			next = p.Next;
			prev = p.Previous;
			prev.Next = next;
			next.Previous = prev;
			this._points.Remove(p);
		}
示例#2
0
		/// <summary>
		/// Inserts list (after last point in polygon?)
		/// </summary>
		/// <param name="list"></param>
		public void AddPoints(IEnumerable<PolygonPoint> list)
		{
			PolygonPoint first;
			foreach (PolygonPoint p in list)
			{
				p.Previous = this._last;
				if (this._last != null)
				{
					p.Next = this._last.Next;
					this._last.Next = p;
				}
				this._last = p;
				this._points.Add(p);
			}
			first = (PolygonPoint)this._points[0];
			this._last.Next = first;
			first.Previous = this._last;
		}
示例#3
0
		/// <summary>
		/// Inserts newPoint after point.
		/// </summary>
		/// <param name="point">The point to insert after in the polygon</param>
		/// <param name="newPoint">The point to insert into the polygon</param>
		public void InsertPointAfter(PolygonPoint point, PolygonPoint newPoint)
		{
			// Validate that 
			int index = this._points.IndexOf(point);
			if (index == -1)
			{
				throw new ArgumentException(
					"Tried to insert a point into a Polygon after a point not belonging to the Polygon", "point");
			}
			newPoint.Next = point.Next;
			newPoint.Previous = point;
			point.Next.Previous = newPoint;
			point.Next = newPoint;
			this._points.Insert(index + 1, newPoint);
		}
示例#4
0
		/// <summary>
		/// Adds a point after the last in the polygon.
		/// </summary>
		/// <param name="p">The point to add</param>
		public void AddPoint(PolygonPoint p)
		{
			p.Previous = this._last;
			p.Next = this._last.Next;
			this._last.Next = p;
			this._points.Add(p);
		}