| 1 |
|
| 2 |
|
| 3 |
|
| 4 |
|
| 5 |
|
| 6 |
|
| 7 |
|
| 8 |
|
| 9 |
|
| 10 |
|
| 11 |
|
| 12 |
|
| 13 |
|
| 14 |
package org.locationtech.jts.operation.overlay; |
| 15 |
|
| 16 |
import java.util.ArrayList; |
| 17 |
import java.util.Iterator; |
| 18 |
import java.util.List; |
| 19 |
|
| 20 |
import org.locationtech.jts.algorithm.LineIntersector; |
| 21 |
import org.locationtech.jts.geomgraph.Edge; |
| 22 |
import org.locationtech.jts.geomgraph.index.EdgeSetIntersector; |
| 23 |
import org.locationtech.jts.geomgraph.index.SegmentIntersector; |
| 24 |
import org.locationtech.jts.geomgraph.index.SimpleMCSweepLineIntersector; |
| 25 |
|
| 26 |
/** |
| 27 |
* Nodes a set of edges. |
| 28 |
* Takes one or more sets of edges and constructs a |
| 29 |
* new set of edges consisting of all the split edges created by |
| 30 |
* noding the input edges together |
| 31 |
* @version 1.7 |
| 32 |
*/ |
| 33 |
public class EdgeSetNoder { |
| 34 |
|
| 35 |
private LineIntersector li; |
| 36 |
private List inputEdges = new ArrayList(); |
| 37 |
|
| 38 |
public EdgeSetNoder(LineIntersector li) { |
| 39 |
this.li = li; |
| 40 |
} |
| 41 |
|
| 42 |
public void addEdges(List edges) |
| 43 |
{ |
| 44 |
inputEdges.addAll(edges); |
| 45 |
} |
| 46 |
|
| 47 |
public List getNodedEdges() |
| 48 |
{ |
| 49 |
EdgeSetIntersector esi = new SimpleMCSweepLineIntersector(); |
| 50 |
SegmentIntersector si = new SegmentIntersector(li, true, false); |
| 51 |
esi.computeIntersections(inputEdges, si, true); |
| 52 |
|
| 53 |
|
| 54 |
List splitEdges = new ArrayList(); |
| 55 |
for (Iterator i = inputEdges.iterator(); i.hasNext(); ) { |
| 56 |
Edge e = (Edge) i.next(); |
| 57 |
e.getEdgeIntersectionList().addSplitEdges(splitEdges); |
| 58 |
} |
| 59 |
return splitEdges; |
| 60 |
} |
| 61 |
} |
| 62 |
|