internal static com.epl.geometry.Envelope2DIntersectorImpl GetEnvelope2DIntersectorForParts(com.epl.geometry.MultiPathImpl multipathImplA, com.epl.geometry.MultiPathImpl multipathImplB, double tolerance, bool bExteriorOnlyA, bool bExteriorOnlyB) { int type_a = multipathImplA.GetType().Value(); int type_b = multipathImplB.GetType().Value(); com.epl.geometry.Envelope2D env_a = new com.epl.geometry.Envelope2D(); com.epl.geometry.Envelope2D env_b = new com.epl.geometry.Envelope2D(); multipathImplA.QueryLooseEnvelope2D(env_a); multipathImplB.QueryLooseEnvelope2D(env_b); env_a.Inflate(tolerance, tolerance); env_b.Inflate(tolerance, tolerance); com.epl.geometry.Envelope2D envInter = new com.epl.geometry.Envelope2D(); envInter.SetCoords(env_a); envInter.Intersect(env_b); com.epl.geometry.Envelope2DIntersectorImpl intersector = new com.epl.geometry.Envelope2DIntersectorImpl(); intersector.SetTolerance(tolerance); bool b_found_red = false; intersector.StartRedConstruction(); for (int ipath_a = 0, npaths = multipathImplA.GetPathCount(); ipath_a < npaths; ipath_a++) { if (bExteriorOnlyA && type_a == com.epl.geometry.Geometry.GeometryType.Polygon && !multipathImplA.IsExteriorRing(ipath_a)) { continue; } multipathImplA.QueryPathEnvelope2D(ipath_a, env_a); if (!env_a.IsIntersecting(envInter)) { continue; } b_found_red = true; intersector.AddRedEnvelope(ipath_a, env_a); } intersector.EndRedConstruction(); if (!b_found_red) { return(null); } bool b_found_blue = false; intersector.StartBlueConstruction(); for (int ipath_b = 0, npaths = multipathImplB.GetPathCount(); ipath_b < npaths; ipath_b++) { if (bExteriorOnlyB && type_b == com.epl.geometry.Geometry.GeometryType.Polygon && !multipathImplB.IsExteriorRing(ipath_b)) { continue; } multipathImplB.QueryPathEnvelope2D(ipath_b, env_b); if (!env_b.IsIntersecting(envInter)) { continue; } b_found_blue = true; intersector.AddBlueEnvelope(ipath_b, env_b); } intersector.EndBlueConstruction(); if (!b_found_blue) { return(null); } return(intersector); }