示例#1
0
        /// <summary>
        /// Internal initialization routine.
        /// </summary>
        private void Complete()
        {
            // Close the polygon
            if (_points[0] != _points[_points.Count - 1])
            {
                _points.Add(_points[0]);
            }

            _readOnlyPoints = new ReadOnlyPointList(_points);

            // Calculate polygon bounding rectangle
            float l = float.MaxValue;
            float t = float.MaxValue;
            float r = float.MinValue;
            float b = float.MinValue;

            foreach (PointF point in _points)
            {
                l = Math.Min(l, point.X);
                t = Math.Min(t, point.Y);
                r = Math.Max(r, point.X);
                b = Math.Max(b, point.Y);
            }
            _bounds = new RectangleF(l, t, r - l, b - t);
        }
示例#2
0
		/// <summary>
		/// Internal initialization routine.
		/// </summary>
		private void Complete()
		{
			// Close the polygon
			if (_points[0] != _points[_points.Count - 1])
				_points.Add(_points[0]);

			_readOnlyPoints = new ReadOnlyPointList(_points);

			// Calculate polygon bounding rectangle
			float l = float.MaxValue;
			float t = float.MaxValue;
			float r = float.MinValue;
			float b = float.MinValue;
			foreach (PointF point in _points)
			{
				l = Math.Min(l, point.X);
				t = Math.Min(t, point.Y);
				r = Math.Max(r, point.X);
				b = Math.Max(b, point.Y);
			}
			_bounds = new RectangleF(l, t, r - l, b - t);
		}