private static int QuickTest2DPolylinePoint(com.epl.geometry.Polyline geomA, com.epl.geometry.Point2D ptB, double tolerance, int testType) { int mask = com.epl.geometry.OperatorInternalRelationUtils.Relation.Touches | com.epl.geometry.OperatorInternalRelationUtils.Relation.Contains | com.epl.geometry.OperatorInternalRelationUtils.Relation.Within | com.epl.geometry.OperatorInternalRelationUtils.Relation.Disjoint | com.epl.geometry.OperatorInternalRelationUtils.Relation .Intersects; if ((testType & mask) == 0) { return(com.epl.geometry.OperatorInternalRelationUtils.Relation.NoThisRelation); } int res = QuickTest2DMVPointRasterOnly(geomA, ptB, tolerance); if (res > 0) { return(res); } // Go through the segments: double toleranceSqr = tolerance * tolerance; com.epl.geometry.MultiPathImpl mpImpl = (com.epl.geometry.MultiPathImpl)geomA._getImpl(); com.epl.geometry.SegmentIteratorImpl iter = mpImpl.QuerySegmentIterator(); while (iter.NextPath()) { int pathIndex = iter.GetPathIndex(); if (!geomA.IsClosedPath(pathIndex)) { int pathSize = geomA.GetPathSize(pathIndex); int pathStart = geomA.GetPathStart(pathIndex); if (pathSize == 0) { continue; } if (com.epl.geometry.Point2D.SqrDistance(geomA.GetXY(pathStart), ptB) <= toleranceSqr || (pathSize > 1 && com.epl.geometry.Point2D.SqrDistance(geomA.GetXY(pathStart + pathSize - 1), ptB) <= toleranceSqr)) { return((int)com.epl.geometry.OperatorInternalRelationUtils.Relation.Touches); } } if (testType != com.epl.geometry.OperatorInternalRelationUtils.Relation.Touches) { while (iter.HasNextSegment()) { com.epl.geometry.Segment segment = iter.NextSegment(); double t = segment.GetClosestCoordinate(ptB, false); com.epl.geometry.Point2D pt = segment.GetCoord2D(t); if (com.epl.geometry.Point2D.SqrDistance(pt, ptB) <= toleranceSqr) { if ((testType & com.epl.geometry.OperatorInternalRelationUtils.Relation.IntersectsOrDisjoint) != 0) { return(com.epl.geometry.OperatorInternalRelationUtils.Relation.Intersects); } return((int)com.epl.geometry.OperatorInternalRelationUtils.Relation.Contains); } } } } return((testType & com.epl.geometry.OperatorInternalRelationUtils.Relation.IntersectsOrDisjoint) != 0 ? com.epl.geometry.OperatorInternalRelationUtils.Relation.Disjoint : com.epl.geometry.OperatorInternalRelationUtils.Relation.NoThisRelation); }