Operateurs { public static ILineString compileArcs(List<ILineString> geometries) { if (Operateurs.logger.isDebugEnabled()) { Operateurs.logger.debug("compile geometries"); for (ILineString l : geometries) { Operateurs.logger.debug("\t" + l); } } return Operateurs.compileArcs(geometries, 0d); }  static double paramForPoint(IDirectPosition m, IDirectPosition a, IDirectPosition b); static IDirectPosition param(double param, IDirectPosition a, IDirectPosition b); static IDirectPosition projection(IDirectPosition m, IDirectPosition a, IDirectPosition b); static IDirectPosition projection(IDirectPosition dp, ILineString ls); static ILineString projectionEtInsertion(IDirectPosition point, ILineString line); static void projectAndInsert(IDirectPosition point, List<IDirectPosition> points); static int projectAndInsertWithPosition(IDirectPosition point, List<IDirectPosition> points); static void projectAndInsertAll(IDirectPosition point, List<IDirectPosition> points); static IDirectPosition projection(IDirectPosition dp, IAggregate<IGeometry> aggr); static IDirectPosition pointEnAbscisseCurviligne(ILineString ls, double abscisse); static IDirectPosition pointEnAbscisseCurviligne(IMultiCurve<? extends ILineString> multiLs,
			double abscisse); static double abscisseCurviligne(ILineString ls, int i); static IDirectPosition milieu(ILineString ls); static IDirectPosition milieu(IDirectPosition A, IDirectPosition B); static IDirectPositionList premiersPoints(ILineString ls, double longueur); static IDirectPositionList derniersPoints(ILineString ls, double longueur); static IDirectPosition barycentre2D(IPolygon poly); static ILineString directOffset(ILineString ls, double offset); static ILineString indirectOffset(ILineString ls, double offset); static ILineString echantillone(ILineString ls, double pas); static ILineString echantilloneSansPreservation(ILineString ls, double pas); static ILineString echantillonePasVariable(ILineString ls, double pas); static IDirectPosition translate(IDirectPosition P, Vecteur V); static ILineString compileArcs(List<ILineString> geometries); static ILineString compileArcs(List<ILineString> geometries, double tolerance); static ILineString compileArcs(Collection<ILineString> geometries, double tolerance); static IGeometry intersectionRobuste(IGeometry A, IGeometry B, double min, double max); static IGeometry unionRobuste(IGeometry A, IGeometry B, double min, double max); static Angle directionPrincipale(IDirectPositionList listePts); static Angle directionPrincipaleOrientee(IDirectPositionList listePts); static boolean superposes(IDirectPosition pt1, IDirectPosition pt2); static boolean superposes2D(IDirectPosition pt1, IDirectPosition pt2); static boolean superposes(IPoint pt1, IPoint pt2); static int indice2D(IDirectPositionList dpl, IDirectPosition dp); static int indice3D(IDirectPositionList dpl, IDirectPosition dp); static ILineString calculeZ(ILineString ligne); @SuppressWarnings("unchecked") static void fusionneSurfaces(IPopulation<? extends IFeature> pop); static void bufferSurfaces(IPopulation<IFeature> popSurf, double tailleBuffer); static double surface(IPolygon poly); static double surface(IDirectPositionList pts); static IPolygon surfaceFromLineStrings(ILineString lineString1, ILineString lineString2); static boolean sensDirect(IDirectPositionList pts); static ILineString union(List<ILineString> linestringList); static ILineString union(List<ILineString> linestringList, double tolerance); static int insertionIndex(IDirectPosition point, List<IDirectPosition> points); static ILineString resampling(ILineString ls, double maxDistance); static IDirectPositionList resampling(IDirectPositionList list, double maxDistance);  }
@Test public void testCompileArcs() { WKTReader reader = new WKTReader(); try { Geometry g1 = reader .read("LINESTRING ( 651124.9 6861379.5 1365, 651134 6861382.300000001 1364, 651156.2000000001 6861384.5 1363 )"); Geometry g2 = reader .read("LINESTRING ( 651156.2000000001 6861384.5 1363, 651189.3 6861387.9 1361 )"); List<ILineString> edges = new ArrayList<ILineString>(); ILineString line1 = (ILineString) AdapterFactory.toGM_Object(g1); ILineString line2 = (ILineString) AdapterFactory.toGM_Object(g2); edges.add(line1); edges.add(line2); ILineString result = Operateurs.compileArcs(edges); System.out.println(result); edges.remove(line1); edges.add(line1); result = Operateurs.compileArcs(edges); Assert.assertNotNull(result); System.out.println(result); } catch (ParseException e) { e.printStackTrace(); } catch (Exception e) { e.printStackTrace(); } }
@Test public void testCompileArcWithTolerance() { WKTReader reader = new WKTReader(); try { Geometry g1 = reader .read("LINESTRING (601103.3340069023 129288.05055561525, 601102.0842804064 129856.67611130093, 601320.7864172085 129316.79426502353, 601323.263544294 129847.90736367383)"); Geometry g2 = reader .read("LINESTRING (601323.2858702005 129847.92802582885, 601824.4261951016 129860.42529078897, 601968.144742143 129494.25542745732, 601806.9300241574 129236.81176927875, 601447.0087933057 129430.51937616068, 601422.0142633856 129672.9663163871, 601549.4863659788 129830.43185488468)"); ILineString line1 = (ILineString) AdapterFactory.toGM_Object(g1); ILineString line2 = (ILineString) AdapterFactory.toGM_Object(g2); List<ILineString> list = new ArrayList<ILineString>(); list.add(line1); list.add(line2); ILineString result = Operateurs.compileArcs(list, 1.0); Assert.assertNotNull(result); } catch (Exception e) { e.printStackTrace(); } }
@Test public void testCompileArcsColn() { IDirectPositionList list1 = new DirectPositionList(); IDirectPositionList list2 = new DirectPositionList(); IDirectPositionList list3 = new DirectPositionList(); IDirectPositionList list4 = new DirectPositionList(); list1.add(new DirectPosition(0.0, 0.0)); list4.add(new DirectPosition(0.0, 0.0)); list1.add(new DirectPosition(2.0, 2.0)); list4.add(new DirectPosition(2.0, 2.0)); list1.add(new DirectPosition(4.0, 5.0)); list4.add(new DirectPosition(4.0, 5.0)); list2.add(new DirectPosition(4.0, 5.0)); list2.add(new DirectPosition(8.0, 7.0)); list4.add(new DirectPosition(8.0, 7.0)); list2.add(new DirectPosition(10.0, 10.0)); list4.add(new DirectPosition(10.0, 10.0)); list3.add(new DirectPosition(10.0, 10.0)); list3.add(new DirectPosition(15.0, 13.0)); list4.add(new DirectPosition(15.0, 13.0)); list3.add(new DirectPosition(20.0, 20.0)); list4.add(new DirectPosition(20.0, 20.0)); ILineString line1 = new GM_LineString(list1); ILineString line2 = new GM_LineString(list2); ILineString line3 = new GM_LineString(list3); ILineString finalLine = new GM_LineString(list4); Set<ILineString> linesToCompile = new HashSet<>(); linesToCompile.add(line3); linesToCompile.add(line1); linesToCompile.add(line2); ILineString compiled = Operateurs.compileArcs(linesToCompile, 0.1); Assert.assertEquals(finalLine, compiled); }