예제 #1
0
        /// <summary>
        ///		Determines the topological relationship (location) of a single point
        ///		to a Geometry.  It handles both single-element and multi-element Geometries.
        ///		The algorithm for multi-part Geometries is more complex, since it has
        ///		to take into account the boundaryDetermination rule.
        /// </summary>
        /// <param name="p"></param>
        /// <param name="geom"></param>
        /// <returns>Returns the location of the point relative to the input Geometry.</returns>
        public int Locate(Coordinate p, Geometry geom)
        {
            if (geom.IsEmpty())
            {
                return(Location.Exterior);
            }

            if (geom is LineString)
            {
                return(Locate(p, (LineString)geom));
            }
            if (geom is LinearRing)
            {
                return(Locate(p, (LinearRing)geom));
            }
            else if (geom is Polygon)
            {
                return(Locate(p, (Polygon)geom));
            }

            _isIn          = false;
            _numBoundaries = 0;
            ComputeLocation(p, geom);
            if (GeometryGraph.IsInBoundary(_numBoundaries))
            {
                return(Location.Boundary);
            }
            if (_numBoundaries > 0 || _isIn)
            {
                return(Location.Interior);
            }
            return(Location.Exterior);
        }         // public int Locate( Coordinate p, Geometry geom )
예제 #2
0
        /// <summary>
        /// Computes the topological relationship ({Location}) of a single point to a Geometry.
        /// It handles both single-element and multi-element Geometries.
        /// The algorithm for multi-part Geometries takes into account the boundaryDetermination rule.
        /// </summary>
        /// <returns>The Location of the point relative to the input Geometry.</returns>
        public virtual LocationType Locate(Coordinate p, IGeometry geom)
        {
            if (geom.IsEmpty)
            {
                return(LocationType.Exterior);
            }
            if (geom is ILineString)
            {
                return(LocateInLineString(p, (ILineString)geom));
            }
            if (geom is IPolygon)
            {
                return(LocateInPolygon(p, (IPolygon)geom));
            }

            _isIn          = false;
            _numBoundaries = 0;
            ComputeLocation(p, geom);
            if (GeometryGraph.IsInBoundary(_numBoundaries))
            {
                return(LocationType.Boundary);
            }
            if (_numBoundaries > 0 || _isIn)
            {
                return(LocationType.Interior);
            }
            return(LocationType.Exterior);
        }
예제 #3
0
        /// <summary>
        /// Computes the topological relationship ({Location}) of a single point to a Geometry.
        /// It handles both single-element and multi-element Geometries.
        /// The algorithm for multi-part Geometries takes into account the boundaryDetermination rule.
        /// </summary>
        /// <returns>The Location of the point relative to the input Geometry.</returns>
        public Locations Locate(ICoordinate p, IGeometry geom)
        {
            if (geom.IsEmpty)
            {
                return(Locations.Exterior);
            }
            if (geom is ILineString)
            {
                return(Locate(p, (ILineString)geom));
            }
            else if (geom is IPolygon)
            {
                return(Locate(p, (IPolygon)geom));
            }

            isIn          = false;
            numBoundaries = 0;
            ComputeLocation(p, geom);
            if (GeometryGraph.IsInBoundary(numBoundaries))
            {
                return(Locations.Boundary);
            }
            if (numBoundaries > 0 || isIn)
            {
                return(Locations.Interior);
            }
            return(Locations.Exterior);
        }
예제 #4
0
        /// <summary>
        /// Computes the topological relationship (<see cref="LocationType"/>)
        /// of a single point to a <see cref="Geometry"/>.
        /// </summary>
        /// <returns>
        /// The <see cref="LocationType"/> of the point relative to the input Geometry
        /// </returns>
        /// <remarks>
        /// It handles both single-element and multi-element geometries.
        /// The algorithm for multi-part geometries takes into account
        /// the Boundary Determination rule.
        /// </remarks>
        public int Locate(Coordinate p, Geometry geom)
        {
            if (geom.IsEmpty)
            {
                return(LocationType.Exterior);
            }

            GeometryType geomType = geom.GeometryType;

            if (geomType == GeometryType.LineString)
            {
                return(Locate(p, (LineString)geom));
            }
            else if (geomType == GeometryType.LinearRing)
            {
                return(Locate(p, (LineString)geom));
            }
            else if (geomType == GeometryType.Polygon)
            {
                return(Locate(p, (Polygon)geom));
            }

            isIn          = false;
            numBoundaries = 0;
            ComputeLocation(p, geom);

            if (GeometryGraph.IsInBoundary(numBoundaries))
            {
                return(LocationType.Boundary);
            }

            if (numBoundaries > 0 || isIn)
            {
                return(LocationType.Interior);
            }

            return(LocationType.Exterior);
        }