Revision 13591 trunk/libraries/libTopology/src/org/gvsig/jts/LineStringSelfIntersectionChecker.java
LineStringSelfIntersectionChecker.java | ||
---|---|---|
6 | 6 |
|
7 | 7 |
import com.iver.cit.gvsig.util.SnappingCoordinateMap; |
8 | 8 |
import com.vividsolutions.jts.algorithm.RobustLineIntersector; |
9 |
import com.vividsolutions.jts.algorithms.SnapCGAlgorithms; |
|
9 | 10 |
import com.vividsolutions.jts.geom.CoordinateArrays; |
10 | 11 |
import com.vividsolutions.jts.geom.GeometryFactory; |
11 | 12 |
import com.vividsolutions.jts.geom.LineString; |
... | ... | |
86 | 87 |
//TODO Add snap tolerance concept |
87 | 88 |
|
88 | 89 |
public boolean isProper(Coordinate coordinate){ |
89 |
if(lineString instanceof LinearRing) |
|
90 |
if(lineString instanceof LinearRing)//TODO INTRODUCE SNAP
|
|
90 | 91 |
return coordinate.equals2D(lineString.getCoordinateN(0)); |
91 |
else |
|
92 |
return graph.isBoundaryNode(0, coordinate); |
|
92 |
else{ |
|
93 |
boolean solution = graph.isBoundaryNode(0, coordinate); |
|
94 |
if(!solution){ |
|
95 |
//one more try: see the coordinates of the extremes |
|
96 |
//this is needed becase the labeling process for closed linestring |
|
97 |
//dont gives us the desired results |
|
98 |
if(SnapCGAlgorithms.snapEquals2D(coordinate, lineString.getCoordinateN(0), snapTolerance) || |
|
99 |
SnapCGAlgorithms.snapEquals2D(coordinate, lineString.getCoordinateN(lineString.getNumPoints() - 1), snapTolerance)){ |
|
100 |
solution = true; |
|
101 |
}//if |
|
102 |
}//if |
|
103 |
return solution; |
|
104 |
}//else |
|
93 | 105 |
} |
94 | 106 |
|
95 | 107 |
|
Also available in: Unified diff