Esempio n. 1
0
        ///// <summary>
        ///// Gets a floating point version of the 2D Rectangular extensts.
        ///// </summary>
        ///// <param name="self">The IEnvelope to use with this method</param>
        //public static System.Drawing.RectangleF ToRectangleF(this IEnvelope self)
        //{
        //    if (self == null || self.IsNull)
        //    {
        //        return System.Drawing.RectangleF.Empty;
        //    }

        //    System.Drawing.RectangleF result = new System.Drawing.RectangleF();
        //    result.X = Convert.ToSingle(self.Minimum.X);
        //    result.Y = Convert.ToSingle(self.Minimum.Y);
        //    result.Width = Convert.ToSingle(self.Maximum.X - self.Minimum.X);
        //    result.Height = Convert.ToSingle(self.Maximum.Y - self.Minimum.Y);
        //    return result;

        //}

        /// <summary>
        /// Converts this envelope into a linear ring.
        /// </summary>
        /// <param name="self">The IEnvelope to use with this method</param>
        /// <returns>A Linear ring describing the border of this envelope.</returns>
        public static ILinearRing ToLinearRing(this IEnvelope self)
        {
            // Holes are counter clockwise, so this should create
            // a clockwise linear ring.
            CoordinateListSequence coords = new CoordinateListSequence();

            coords.Add(self.TopLeft());
            coords.Add(self.TopRight());
            coords.Add(self.BottomRight());
            coords.Add(self.BottomLeft());
            coords.Add(self.TopLeft()); // close the polygon
            return(new LinearRing(coords));
        }
Esempio n. 2
0
        ///// <summary>
        ///// Gets a floating point version of the 2D Rectangular extensts.
        ///// </summary>
        ///// <param name="self">The IEnvelope to use with this method</param>
        //public static System.Drawing.RectangleF ToRectangleF(this IEnvelope self)
        //{
        //    if (self == null || self.IsNull)
        //    {
        //        return System.Drawing.RectangleF.Empty;
        //    }

        //    System.Drawing.RectangleF result = new System.Drawing.RectangleF();
        //    result.X = Convert.ToSingle(self.Minimum.X);
        //    result.Y = Convert.ToSingle(self.Minimum.Y);
        //    result.Width = Convert.ToSingle(self.Maximum.X - self.Minimum.X);
        //    result.Height = Convert.ToSingle(self.Maximum.Y - self.Minimum.Y);
        //    return result;

        //}

        /// <summary>
        /// Converts this envelope into a linear ring.
        /// </summary>
        /// <param name="self">The IEnvelope to use with this method</param>
        /// <returns>A Linear ring describing the border of this envelope.</returns>
        public static ILinearRing ToLinearRing(this IEnvelope self)
        {
            // Holes are counter clockwise, so this should create
            // a clockwise linear ring.
            CoordinateListSequence coords = new CoordinateListSequence();
            coords.Add(self.TopLeft());
            coords.Add(self.TopRight());
            coords.Add(self.BottomRight());
            coords.Add(self.BottomLeft());
            coords.Add(self.TopLeft()); // close the polygon
            return new LinearRing(coords);
        }