Exemplo n.º 1
0
        ///<summary>
        /// Converts a linearring to be sure it is clockwise.
        ///</summary>
        ///<remarks>Normal form is a unique representation
        /// for Geometry's. It can be used to test whether two Geometrys are equal in a way that is
        /// independent of the ordering of the coordinates within them. Normal form equality is a stronger
        /// condition than topological equality, but weaker than pointwise equality. The definitions for
        /// normal form use the standard lexicographical ordering for coordinates. Sorted in order of
        /// coordinates means the obvious extension of this ordering to sequences of coordinates.
        ///</remarks>
        private void Normalize(LinearRing ring, bool clockwise)
        {
            if (ring.IsEmpty())
            {
                return;
            }
            Coordinates uniqueCoordinates = new Coordinates();

            for (int i = 0; i < ring.GetNumPoints() - 1; i++)
            {
                uniqueCoordinates.Add(ring.GetCoordinateN(i));                                  // copy all but last one into uniquecoordinates
            }
            Coordinate minCoordinate = MinCoordinate(ring.GetCoordinates());

            Scroll(uniqueCoordinates, minCoordinate);
            Coordinates ringCoordinates = ring.GetCoordinates();

            ringCoordinates.Clear();
            ringCoordinates.AddRange(uniqueCoordinates);
            ringCoordinates.Add(uniqueCoordinates[0].Clone());                          // add back in the closing point.
            if (_cgAlgorithms.IsCCW(ringCoordinates) == clockwise)
            {
                ReversePointOrder(ringCoordinates);
            }
        }
Exemplo n.º 2
0
        ///<summary>
        ///  Returns this Geometry's vertices. Do not modify  the array, as it may be the actual array stored
        ///  by this Geometry.  The Geometries contained by composite Geometries must be Geometry's;
        ///  that is, they must implement get Coordinates.
        ///</summary>
        ///<returns>Returns the vertices of this Geometry.</returns>
        public override Coordinates GetCoordinates()
        {
            Coordinates coords = new Coordinates();

            if (IsEmpty())
            {
                return(coords);
            }
            coords.AddRange(_shell.GetCoordinates());

            if (_holes != null)
            {
                for (int i = 0; i < _holes.Length; i++)
                {
                    coords.AddRange(_holes[i].GetCoordinates());
                }
            }
            return(coords);
        }
Exemplo n.º 3
0
		///<summary>
		///  Returns this Geometry's vertices. Do not modify  the array, as it may be the actual array stored
		///  by this Geometry.  The Geometries contained by composite Geometries must be Geometry's;
		///  that is, they must implement get Coordinates.  
		///</summary>
		///<returns>Returns the vertices of this Geometry.</returns>
		public override Coordinates GetCoordinates()
		{
			Coordinates coords = new Coordinates();
			if( IsEmpty() )
			{
				return coords;
			}
			coords.AddRange( _shell.GetCoordinates() );
			
			if(_holes != null)
			{
				for(int i = 0; i < _holes.Length; i++)
				{
					coords.AddRange( _holes[i].GetCoordinates() );
				}
			}
			return coords;
		}