示例#1
0
        public override Geometry CurveToLine(double tolerance)
        {
            LinearRing exteriorRing = new LinearRing((ExteriorRing.CurveToLine(tolerance) as LineString).Points);
            IEnumerable <LinearRing> linearRings = InteriorRings.Select(r => new LinearRing((r.CurveToLine(tolerance) as LineString).Points));

            return(new Polygon(exteriorRing, linearRings));
        }
示例#2
0
        public void TryOrientProperly()
        {
            ExteriorRing.TryOrientClockwise();

            foreach (Linestring interiorRing in InteriorRings)
            {
                interiorRing.TryOrientAnticlockwise();
            }
        }
示例#3
0
        /// <summary>
        /// Serves as a hash function for a particular type. <see cref="GetHashCode"/> is suitable for use
        /// in hashing algorithms and data structures like a hash table.
        /// </summary>
        /// <returns>A hash code for the current <see cref="GetHashCode"/>.</returns>
        public override int GetHashCode()
        {
            int hash = ExteriorRing.GetHashCode();

            foreach (var t in InteriorRings)
            {
                hash = hash ^ t.GetHashCode();
            }
            return(hash);
        }
示例#4
0
        /// <summary>
        /// Serves as a hash function for a particular type. <see cref="GetHashCode"/> is suitable for use
        /// in hashing algorithms and data structures like a hash table.
        /// </summary>
        /// <returns>A hash code for the current <see cref="GetHashCode"/>.</returns>
        public override int GetHashCode()
        {
            int hash = ExteriorRing.GetHashCode();;

            for (int i = 0; i < InteriorRings.Count; i++)
            {
                hash = hash ^ InteriorRings[i].GetHashCode();
            }
            return(hash);
        }
示例#5
0
        public override MultiLinestring Clone()
        {
            var result = new RingGroup(ExteriorRing.Clone(),
                                       InteriorRings.Select(i => i.Clone()))
            {
                Id = Id
            };

            return(result);
        }
示例#6
0
        /// <summary>
        ///     Return a copy of this geometry
        /// </summary>
        /// <returns>Copy of Geometry</returns>
        public new Polygon Clone()
        {
            var polygon = new Polygon {
                ExteriorRing = ExteriorRing.Clone()
            };

            foreach (var interiorRing in InteriorRings)
            {
                polygon.InteriorRings.Add(interiorRing.Clone());
            }
            return(polygon);
        }
示例#7
0
        public Polygon Rotate(double degrees, Point center)
        {
            var rotatedPolygon = Clone();

            rotatedPolygon.ExteriorRing = ExteriorRing.Rotate(degrees, center);
            for (var i = 0; i < InteriorRings.Count; i++)
            {
                rotatedPolygon.InteriorRings[i] = InteriorRings[i].Rotate(degrees, center);
            }

            return(rotatedPolygon);
        }
示例#8
0
        /// <summary>
        /// The actual implementation of the <see cref="Geometry.Reverse"/> function for <c>POLYGON</c>s
        /// </summary>
        /// <returns>A reversed geometry</returns>
        protected override Geometry ReverseInternal()
        {
#pragma warning disable 618
            var shell = (LinearRing)ExteriorRing.Reverse();
            var holes = new LinearRing[NumInteriorRings];
            for (int i = 0; i < holes.Length; i++)
            {
                holes[i] = (LinearRing)GetInteriorRingN(i).Reverse();
            }
#pragma warning restore 618

            return(Factory.CreatePolygon(shell, holes));
        }
示例#9
0
        /// <summary>
        /// Creates a deep copy of the Polygon.
        /// </summary>
        /// <returns>A copy of the Polygon instance.</returns>
        public override Geometry Clone()
        {
            Polygon p = new Polygon();

            p.ExteriorRing = ExteriorRing.Clone() as LinearRing;

            foreach (LinearRing ring in InteriorRings)
            {
                p.InteriorRings.Add(ring.Clone() as LinearRing);
            }

            return(p);
        }
示例#10
0
        /// <summary>
        /// Serves as a hash function for a particular type. <see cref="GetHashCode"/> is suitable for use
        /// in hashing algorithms and data structures like a hash table.
        /// </summary>
        /// <returns>A hash code for the current <see cref="GetHashCode"/>.</returns>
        public override Int32 GetHashCode()
        {
            Int32 hash = ExteriorRing.GetHashCode();

            ;

            for (Int32 i = 0; i < InteriorRings.Count; i++)
            {
                hash = hash ^ InteriorRings[i].GetHashCode();
            }

            return(hash);
        }
示例#11
0
        public override IEnumerable <Point> GetVertexes()
        {
            foreach (Point point in ExteriorRing.GetVertexes())
            {
                yield return(point);
            }

            foreach (LinearRing ring in _interiorRings)
            {
                foreach (Point point in ring.GetVertexes())
                {
                    yield return(point);
                }
            }
        }
示例#12
0
 /// <summary>
 ///
 /// </summary>
 /// <returns></returns>
 public override Geometry ConvexHull()
 {
     return(ExteriorRing.ConvexHull());
 }
示例#13
0
 public override BoundingBox GetBoundingBox()
 {
     return(ExteriorRing.GetBoundingBox());
 }
示例#14
0
 public override Point GetCenter()
 {
     return(ExteriorRing.GetCenter());
 }
示例#15
0
 public bool Equals(CurvePolygon other)
 {
     return(ExteriorRing.Equals(other.ExteriorRing) && InteriorRings.SequenceEqual(other.InteriorRings));
 }
示例#16
0
 public bool Equals(Triangle other)
 {
     return(ExteriorRing.Equals(other.ExteriorRing) && InteriorRings.SequenceEqual(other.InteriorRings));
 }