Beispiel #1
0
		///<summary>
		/// Returns whether this Geometry is greater than, equal to, or less than another Geometry. If their 
		/// classes are different, they are compared using the following  ordering:  
		/// <list type="bullet">
		///		<item><term>Point (lowest)</term></item>
		///		<item><term>MultiPoint</term></item>
		///		<item><term>LineString</term></item>
		///		<item><term>LinearRing</term></item>
		///		<item><term>MultiLineString</term></item>
		///		<item><term>Polygon</term></item>
		///		<item><term>MultiPolygon</term></item>
		///		<item><term>GeometryCollection (highest)</term></item>
		///	</list>
		///	If the two Geometrys have the same class, their first elements are compared. 
		///	If those are the same, the second elements are compared, etc.  
		///</summary>
		///<param name="obj">A Geometry with which to compare to this Geometry.</param>
		///<returns>
		///	Returns a positive number, 0, or a negative number, depending on whether this object
		/// is greater than, equal to, or less than the other geometry.
		///</returns>
		public virtual int CompareTo(object obj) 
		{
			Geometry geometry = obj as Geometry;
			if ( geometry != null )
			{
				if ( GetClassSortIndex() != geometry.GetClassSortIndex() ) 
				{
					return GetClassSortIndex() - geometry.GetClassSortIndex();
				}
				if ( IsEmpty() && geometry.IsEmpty() ) 
				{
					return 0;
				}
				if ( IsEmpty() ) 
				{
					return -1;
				}
				if ( geometry.IsEmpty() ) 
				{
					return 1;
				}
				return CompareToSameClass( geometry );
			}
			else
			{
				throw new ArgumentException("object geometry is not of type Geometry");
			}
		}