| 1 |
|
| 2 |
|
| 3 |
|
| 4 |
|
| 5 |
|
| 6 |
|
| 7 |
|
| 8 |
|
| 9 |
|
| 10 |
|
| 11 |
|
| 12 |
|
| 13 |
|
| 14 |
|
| 15 |
package org.locationtech.jts.geomgraph.index; |
| 16 |
|
| 17 |
import org.locationtech.jts.geom.Coordinate; |
| 18 |
import org.locationtech.jts.geomgraph.Edge; |
| 19 |
|
| 20 |
|
| 21 |
/** |
| 22 |
* @version 1.7 |
| 23 |
*/ |
| 24 |
public class SweepLineSegment { |
| 25 |
|
| 26 |
Edge edge; |
| 27 |
Coordinate[] pts; |
| 28 |
int ptIndex; |
| 29 |
|
| 30 |
public SweepLineSegment(Edge edge, int ptIndex) { |
| 31 |
this.edge = edge; |
| 32 |
this.ptIndex = ptIndex; |
| 33 |
pts = edge.getCoordinates(); |
| 34 |
} |
| 35 |
|
| 36 |
public double getMinX() |
| 37 |
{ |
| 38 |
double x1 = pts[ptIndex].x; |
| 39 |
double x2 = pts[ptIndex + 1].x; |
| 40 |
return x1 < x2 ? x1 : x2; |
| 41 |
} |
| 42 |
public double getMaxX() |
| 43 |
{ |
| 44 |
double x1 = pts[ptIndex].x; |
| 45 |
double x2 = pts[ptIndex + 1].x; |
| 46 |
return x1 > x2 ? x1 : x2; |
| 47 |
} |
| 48 |
public void computeIntersections(SweepLineSegment ss, SegmentIntersector si) |
| 49 |
{ |
| 50 |
si.addIntersections(edge, ptIndex, ss.edge, ss.ptIndex); |
| 51 |
} |
| 52 |
|
| 53 |
} |
| 54 |
|