From 539f032fd605b3bdfd025bdddb867b82a75f64a1 Mon Sep 17 00:00:00 2001 From: Sergey Tolstov Date: Fri, 17 Jul 2026 19:39:00 -0700 Subject: [PATCH] Fix invalid check of envelope intersect for path envelopes --- .../com/esri/core/geometry/RelationalOperations.java | 2 +- .../java/com/esri/core/geometry/TestIntersect2.java | 11 +++++++++++ 2 files changed, 12 insertions(+), 1 deletion(-) diff --git a/src/main/java/com/esri/core/geometry/RelationalOperations.java b/src/main/java/com/esri/core/geometry/RelationalOperations.java index abf03372..34fdd216 100644 --- a/src/main/java/com/esri/core/geometry/RelationalOperations.java +++ b/src/main/java/com/esri/core/geometry/RelationalOperations.java @@ -1609,7 +1609,7 @@ private static boolean polylineDisjointPolyline_(Polyline polyline_a, PairwiseIntersectorImpl intersector_paths = new PairwiseIntersectorImpl(multi_path_impl_a, multi_path_impl_b, tolerance, true); if (!intersector_paths.next()) - return false; + return true; return !linearPathIntersectsLinearPath_(polyline_a, polyline_b, tolerance); diff --git a/src/test/java/com/esri/core/geometry/TestIntersect2.java b/src/test/java/com/esri/core/geometry/TestIntersect2.java index 36860635..0254dcb8 100644 --- a/src/test/java/com/esri/core/geometry/TestIntersect2.java +++ b/src/test/java/com/esri/core/geometry/TestIntersect2.java @@ -25,6 +25,7 @@ package com.esri.core.geometry; import com.esri.core.geometry.Geometry.Type; +import com.esri.core.geometry.ogc.OGCGeometry; import junit.framework.TestCase; import org.junit.Test; @@ -39,6 +40,16 @@ protected void tearDown() throws Exception { super.tearDown(); } + @Test + public void testIntersectsLinestringAndMultilinestring() { + // https://github.com/Esri/geometry-api-java/issues/326 + OGCGeometry line = OGCGeometry.fromText("LINESTRING(1 0, 1 1)"); + OGCGeometry multiLine = OGCGeometry.fromText("MULTILINESTRING((0 0, 0 1), (2 0, 2 1))"); + + assertFalse(line.intersects(multiLine)); + assertFalse(multiLine.intersects(line)); + } + @Test /** * Intersect