예제 #1
0
 /// <summary>
 /// Removes if contained
 /// </summary>
 /// <param name="geometry"></param>
 protected virtual bool Remove(NetTopologySuite.Geometries.Geometry geometry, System.Collections.Generic.IEqualityComparer <NetTopologySuite.Geometries.Geometry> comparer = null)
 {
     if (IsReadOnly || IsEmpty)
     {
         return(false);
     }
     comparer = comparer ?? new Geometry.ExactGeometryComparer();
     for (int i = 0; i < Geometries.Length; ++i)
     {
         if (comparer.Equals(geometry, Geometries[i]))
         {
             if (geometry is IPolygonal)
             {
                 polygonCount -= geometry.NumGeometries;
             }
             else if (geometry is ILineal)
             {
                 lineStringCount -= geometry.NumGeometries;
             }
             else if (geometry is IPuntal)
             {
                 pointCount -= geometry.NumGeometries;
             }
             if (geometry is ICurvedGeometry)
             {
                 curveCount -= geometry.NumGeometries;
             }
             Geometries = Geometries.Take(i).Skip(1).Take(int.MaxValue).ToArray();
             GeometryChanged();
             return(true);
         }
     }
     return(false);
 }