/// <summary> /// Checks whether this closed shape overlaps a line /// </summary> /// <param name="shape">Positions defining a closed outline (the last position /// must coincide with the first position). At least 3 positions.</param> /// <param name="shapeWindow">The extent of <paramref name="shape"/></param> /// <param name="line">The line to compare with the shape</param> /// <returns>True if the shape overlaps the line</returns> internal bool IsOverlap(LineGeometry line) { // Get the window of the line IWindow lwin = line.Extent; // The two windows have to overlap. if (!m_Extent.IsOverlap(lwin)) { return(false); } // If either end of the line falls inside this shape, we've got overlap. IPointGeometry p = line.Start; if (m_Extent.IsOverlap(p) && Geom.IsPointInClosedShape(this.Data, p)) { return(true); } p = line.End; if (m_Extent.IsOverlap(p) && Geom.IsPointInClosedShape(this.Data, p)) { return(true); } // The only thing left is a possible interesection between // the shape and the line. return(IsIntersect(line)); }
/// <summary> /// Checks whether this closed shape overlaps (encloses) a point. /// </summary> /// <param name="point">The position to check</param> /// <returns>True if the shape overlaps the point</returns> internal bool IsOverlap(IPointGeometry point) { return(m_Extent.IsOverlap(point) && Geom.IsPointInClosedShape(this.Data, point)); }