/// <summary>
 ///
 /// </summary>
 /// <param name="p"></param>
 /// <param name="geom"></param>
 /// <returns></returns>
 private static bool ContainsPoint(Coordinate p, IGeometry geom)
 {
     if (geom is Polygon)
         return ContainsPointInPolygon(p, (Polygon)geom);
     if (geom is GeometryCollection)
     {
         IEnumerator geomi = new GeometryCollection.Enumerator((GeometryCollection)geom);
         while (geomi.MoveNext())
         {
             Geometry g2 = (Geometry)geomi.Current;
             // if (g2 != geom)  --- Diego Guidi say's: Java code tests reference equality: in C# with operator overloads we tests the object.equals()... more slower!
             if (!ReferenceEquals(g2, geom))
                 if (ContainsPoint(p, g2))
                     return true;
         }
     }
     return false;
 }
예제 #2
0
 /// <summary>
 ///
 /// </summary>
 /// <param name="p"></param>
 /// <param name="geom"></param>
 private void ComputeLocation(Coordinate p, IGeometry geom)
 {
     if (geom is ILineString)
     {
         UpdateLocationInfo(Locate(p, geom));
     }
     else if (geom is IPolygon)
     {
         UpdateLocationInfo(Locate(p, geom));
     }
     else if (geom is IMultiLineString)
     {
         IMultiLineString ml = (IMultiLineString)geom;
         foreach (ILineString l in ml.Geometries)
         {
             UpdateLocationInfo(Locate(p, l));
         }
     }
     else if (geom is IMultiPolygon)
     {
         IMultiPolygon mpoly = (IMultiPolygon)geom;
         foreach (IPolygon poly in mpoly.Geometries)
         {
             UpdateLocationInfo(Locate(p, poly));
         }
     }
     else if (geom is IGeometryCollection)
     {
         IEnumerator geomi = new GeometryCollection.Enumerator((IGeometryCollection)geom);
         while (geomi.MoveNext())
         {
             IGeometry g2 = (IGeometry)geomi.Current;
             if (g2 != geom)
             {
                 ComputeLocation(p, g2);
             }
         }
     }
 }
 /// <summary>
 ///
 /// </summary>
 /// <param name="p"></param>
 /// <param name="geom"></param>
 /// <returns></returns>
 private static bool ContainsPoint(Coordinate p, IGeometry geom)
 {
     if (geom is Polygon)
     {
         return(ContainsPointInPolygon(p, (Polygon)geom));
     }
     if (geom is GeometryCollection)
     {
         IEnumerator geomi = new GeometryCollection.Enumerator((GeometryCollection)geom);
         while (geomi.MoveNext())
         {
             Geometry g2 = (Geometry)geomi.Current;
             // if (g2 != geom)  --- Diego Guidi say's: Java code tests reference equality: in C# with operator overloads we tests the object.equals()... more slower!
             if (!ReferenceEquals(g2, geom))
             {
                 if (ContainsPoint(p, g2))
                 {
                     return(true);
                 }
             }
         }
     }
     return(false);
 }
예제 #4
0
 /// <summary>
 ///
 /// </summary>
 /// <param name="p"></param>
 /// <param name="geom"></param>
 private void ComputeLocation(Coordinate p, IGeometry geom)
 {
     if (geom is ILineString)
         UpdateLocationInfo(Locate(p, geom));
     else if (geom is IPolygon)
         UpdateLocationInfo(Locate(p, geom));
     else if (geom is IMultiLineString)
     {
         IMultiLineString ml = (IMultiLineString)geom;
         foreach (ILineString l in ml.Geometries)
             UpdateLocationInfo(Locate(p, l));
     }
     else if (geom is IMultiPolygon)
     {
         IMultiPolygon mpoly = (IMultiPolygon)geom;
         foreach (IPolygon poly in mpoly.Geometries)
             UpdateLocationInfo(Locate(p, poly));
     }
     else if (geom is IGeometryCollection)
     {
         IEnumerator geomi = new GeometryCollection.Enumerator((IGeometryCollection)geom);
         while (geomi.MoveNext())
         {
             IGeometry g2 = (IGeometry)geomi.Current;
             if (g2 != geom)
                 ComputeLocation(p, g2);
         }
     }
 }