本文整理汇总了Java中com.vividsolutions.jts.algorithm.RobustLineIntersector类的典型用法代码示例。如果您正苦于以下问题:Java RobustLineIntersector类的具体用法?Java RobustLineIntersector怎么用?Java RobustLineIntersector使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
RobustLineIntersector类属于com.vividsolutions.jts.algorithm包,在下文中一共展示了RobustLineIntersector类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: checkValid
import com.vividsolutions.jts.algorithm.RobustLineIntersector; //导入依赖的package包/类
/**
* Checks validity of a LinearRing.
*/
private void checkValid(LinearRing g) {
this.checkInvalidCoordinates(g.getCoordinates());
if (this.validErr != null) {
return;
}
this.checkClosedRing(g);
if (this.validErr != null) {
return;
}
GeometryGraph graph = new GeometryGraph(0, g);
this.checkTooFewPoints(graph);
if (this.validErr != null) {
return;
}
LineIntersector li = new RobustLineIntersector();
graph.computeSelfNodes(li, true);
this.checkNoSelfIntersectingRings(graph);
}
开发者ID:gegy1000,项目名称:Earth,代码行数:23,代码来源:IsValidOp.java
示例2: isSimpleLinearGeometry
import com.vividsolutions.jts.algorithm.RobustLineIntersector; //导入依赖的package包/类
private boolean isSimpleLinearGeometry(Geometry geom) {
if (geom.isEmpty()) {
return true;
}
GeometryGraph graph = new GeometryGraph(0, geom);
LineIntersector li = new RobustLineIntersector();
SegmentIntersector si = graph.computeSelfNodes(li, true);
// if no self-intersection, must be simple
if (!si.hasIntersection()) {
return true;
}
if (si.hasProperIntersection()) {
this.nonSimpleLocation = si.getProperIntersectionPoint();
return false;
}
if (this.hasNonEndpointIntersection(graph)) {
return false;
}
if (this.isClosedEndpointsInInterior) {
if (this.hasClosedEndpointIntersection(graph)) {
return false;
}
}
return true;
}
开发者ID:gegy1000,项目名称:Earth,代码行数:26,代码来源:IsSimpleOp.java
示例3: getNoder
import com.vividsolutions.jts.algorithm.RobustLineIntersector; //导入依赖的package包/类
private Noder getNoder(PrecisionModel precisionModel) {
if (this.workingNoder != null) {
return this.workingNoder;
}
// otherwise use a fast (but non-robust) noder
MCIndexNoder noder = new MCIndexNoder();
LineIntersector li = new RobustLineIntersector();
li.setPrecisionModel(precisionModel);
noder.setSegmentIntersector(new IntersectionAdder(li));
// Noder noder = new IteratedNoder(precisionModel);
return noder;
// Noder noder = new SimpleSnapRounder(precisionModel);
// Noder noder = new MCIndexSnapRounder(precisionModel);
// Noder noder = new ScaledNoder(new MCIndexSnapRounder(new PrecisionModel(1.0)),
// precisionModel.getScale());
}
开发者ID:gegy1000,项目名称:Earth,代码行数:18,代码来源:BufferBuilder.java
示例4: OffsetSegmentGenerator
import com.vividsolutions.jts.algorithm.RobustLineIntersector; //导入依赖的package包/类
public OffsetSegmentGenerator(PrecisionModel precisionModel,
BufferParameters bufParams, double distance) {
this.precisionModel = precisionModel;
this.bufParams = bufParams;
// compute intersections in full precision, to provide accuracy
// the points are rounded as they are inserted into the curve line
this.li = new RobustLineIntersector();
this.filletAngleQuantum = Math.PI / 2.0 / bufParams.getQuadrantSegments();
/**
* Non-round joins cause issues with short closing segments, so don't use
* them. In any case, non-round joins only really make sense for relatively
* small buffer distances.
*/
if (bufParams.getQuadrantSegments() >= 8
&& bufParams.getJoinStyle() == BufferParameters.JOIN_ROUND) {
this.closingSegLengthFactor = MAX_CLOSING_SEG_LEN_FACTOR;
}
this.init(distance);
}
开发者ID:gegy1000,项目名称:Earth,代码行数:22,代码来源:OffsetSegmentGenerator.java
示例5: isPointOnLineSegment
import com.vividsolutions.jts.algorithm.RobustLineIntersector; //导入依赖的package包/类
/**
* Checks if the point is located on the given {@link LineSegment} (including endpoints).
*/
public static boolean isPointOnLineSegment(Coordinate point, LineSegment line) {
double lengthOfLine = line.getLength();
double distFromEnd1 = point.distance(line.p0);
double distFromEnd2 = point.distance(line.p1);
// this seems to handle robustness errors (due to rounding) better
if (distFromEnd1 + distFromEnd2 == lengthOfLine) {
return true;
}
// Fallback to what should probably be the robust implementation (TODO: investigate precision issues)
LineIntersector lineIntersector = new RobustLineIntersector();
lineIntersector.computeIntersection(point, line.p0, line.p1);
return lineIntersector.hasIntersection();
}
开发者ID:grimsa,项目名称:polysplit,代码行数:19,代码来源:GeometryUtils.java
示例6: isSimpleLinearGeometry
import com.vividsolutions.jts.algorithm.RobustLineIntersector; //导入依赖的package包/类
private boolean isSimpleLinearGeometry(Geometry geom) {
if (geom.isEmpty()) return true;
GeometryGraph graph = new GeometryGraph(0, geom);
LineIntersector li = new RobustLineIntersector();
SegmentIntersector si = graph.computeSelfNodes(li, true);
// if no self-intersection, must be simple
if (!si.hasIntersection()) return true;
if (si.hasProperIntersection()) {
nonSimpleLocation = si.getProperIntersectionPoint();
return false;
}
if (hasNonEndpointIntersection(graph)) return false;
if (isClosedEndpointsInInterior) {
if (hasClosedEndpointIntersection(graph)) return false;
}
return true;
}
开发者ID:Semantive,项目名称:jts,代码行数:18,代码来源:IsSimpleOp.java
示例7: OffsetSegmentGenerator
import com.vividsolutions.jts.algorithm.RobustLineIntersector; //导入依赖的package包/类
public OffsetSegmentGenerator(PrecisionModel precisionModel,
BufferParameters bufParams, double distance) {
this.precisionModel = precisionModel;
this.bufParams = bufParams;
// compute intersections in full precision, to provide accuracy
// the points are rounded as they are inserted into the curve line
li = new RobustLineIntersector();
filletAngleQuantum = Math.PI / 2.0 / bufParams.getQuadrantSegments();
/**
* Non-round joins cause issues with short closing segments, so don't use
* them. In any case, non-round joins only really make sense for relatively
* small buffer distances.
*/
if (bufParams.getQuadrantSegments() >= 8
&& bufParams.getJoinStyle() == BufferParameters.JOIN_ROUND)
closingSegLengthFactor = MAX_CLOSING_SEG_LEN_FACTOR;
init(distance);
}
开发者ID:GitHubDroid,项目名称:geodroid_master_update,代码行数:21,代码来源:OffsetSegmentGenerator.java
示例8: findAndClassifyIntersections
import com.vividsolutions.jts.algorithm.RobustLineIntersector; //导入依赖的package包/类
private void findAndClassifyIntersections(Geometry geom) {
List lineSegStr = SegmentStringUtil.extractSegmentStrings(geom);
LineIntersector li = new RobustLineIntersector();
SegmentIntersectionDetector intDetector = new SegmentIntersectionDetector(li);
intDetector.setFindAllIntersectionTypes(true);
this.prepPoly.getIntersectionFinder().intersects(lineSegStr, intDetector);
this.hasSegmentIntersection = intDetector.hasIntersection();
this.hasProperIntersection = intDetector.hasProperIntersection();
this.hasNonProperIntersection = intDetector.hasNonProperIntersection();
}
开发者ID:gegy1000,项目名称:Earth,代码行数:13,代码来源:AbstractPreparedPolygonContains.java
示例9: isIntersectingPolygon
import com.vividsolutions.jts.algorithm.RobustLineIntersector; //导入依赖的package包/类
/**
* Checks if the line intersects any of the edges of given polygon.<br>
* Start and end points of the line can only touch, but not cross the edges of polygon.
*
* @param line line which might intersect the edges of polygon
* @param polygon the polygon
* @return true if line intersects at least one edge of the polygon
*/
public static boolean isIntersectingPolygon(LineSegment line, Polygon polygon) {
LineIntersector lineIntersector = new RobustLineIntersector();
List<LineSegment> edges = getLineSegments(polygon.getExteriorRing());
for (LineSegment edge : edges) {
lineIntersector.computeIntersection(line.p0, line.p1, edge.p0, edge.p1);
if (lineIntersector.hasIntersection() && lineIntersector.isProper()) { // intersection exists and is not one of the endpoints of the line
return true;
}
}
return false;
}
开发者ID:grimsa,项目名称:polysplit,代码行数:21,代码来源:GeometryUtils.java
示例10: fullClosedLine
import com.vividsolutions.jts.algorithm.RobustLineIntersector; //导入依赖的package包/类
LineString fullClosedLine(List<LineString> lines) {
List<Coordinate> tail = new ArrayList<>();
boolean found;
do {
found = false;
for (int i = 0; i < lines.size(); i++) {
if (addToClosed(tail, lines.get(i))) {
lines.remove(i);
i--;
found = true;
}
}
} while (found);
LineString s = GeometryHelper.createLine(tail);
if (!s.isClosed()) {
throw new RuntimeException("Non-closed line starts from " + tail.get(0) + " ends to "
+ tail.get(tail.size() - 1));
}
if (!s.isSimple()) {
GeometryGraph graph = new GeometryGraph(0, s);
LineIntersector li = new RobustLineIntersector();
SegmentIntersector si = graph.computeSelfNodes(li, true);
if (si.hasProperInteriorIntersection()) {
throw new RuntimeException("Self-intersection for " + relation.getObjectCode()
+ " near point " + si.getProperIntersectionPoint());
}else {
throw new RuntimeException("Self-intersected line: " + s);
}
}
return s;
}
开发者ID:alex73,项目名称:OSMemory,代码行数:34,代码来源:ExtendedRelation.java
示例11: getNoder
import com.vividsolutions.jts.algorithm.RobustLineIntersector; //导入依赖的package包/类
private Noder getNoder(PrecisionModel precisionModel) {
if (workingNoder != null) return workingNoder;
// otherwise use a fast (but non-robust) noder
MCIndexNoder noder = new MCIndexNoder();
LineIntersector li = new RobustLineIntersector();
li.setPrecisionModel(precisionModel);
noder.setSegmentIntersector(new IntersectionAdder(li));
// Noder noder = new IteratedNoder(precisionModel);
return noder;
// Noder noder = new SimpleSnapRounder(precisionModel);
// Noder noder = new MCIndexSnapRounder(precisionModel);
// Noder noder = new ScaledNoder(new MCIndexSnapRounder(new PrecisionModel(1.0)),
// precisionModel.getScale());
}
开发者ID:Semantive,项目名称:jts,代码行数:16,代码来源:BufferBuilder.java
示例12: test2Lines
import com.vividsolutions.jts.algorithm.RobustLineIntersector; //导入依赖的package包/类
public void test2Lines() {
RobustLineIntersector i = new RobustLineIntersector();
Coordinate p1 = new Coordinate(10, 10);
Coordinate p2 = new Coordinate(20, 20);
Coordinate q1 = new Coordinate(20, 10);
Coordinate q2 = new Coordinate(10, 20);
Coordinate x = new Coordinate(15, 15);
i.computeIntersection(p1, p2, q1, q2);
assertEquals(RobustLineIntersector.POINT_INTERSECTION, i.getIntersectionNum());
assertEquals(1, i.getIntersectionNum());
assertEquals(x, i.getIntersection(0));
assertTrue(i.isProper());
assertTrue(i.hasIntersection());
}
开发者ID:Semantive,项目名称:jts,代码行数:15,代码来源:RobustLineIntersectorTest.java
示例13: testCollinear1
import com.vividsolutions.jts.algorithm.RobustLineIntersector; //导入依赖的package包/类
public void testCollinear1() {
RobustLineIntersector i = new RobustLineIntersector();
Coordinate p1 = new Coordinate(10, 10);
Coordinate p2 = new Coordinate(20, 10);
Coordinate q1 = new Coordinate(22, 10);
Coordinate q2 = new Coordinate(30, 10);
i.computeIntersection(p1, p2, q1, q2);
assertEquals(RobustLineIntersector.NO_INTERSECTION, i.getIntersectionNum());
assertTrue(!i.isProper());
assertTrue(!i.hasIntersection());
}
开发者ID:Semantive,项目名称:jts,代码行数:12,代码来源:RobustLineIntersectorTest.java
示例14: testCollinear2
import com.vividsolutions.jts.algorithm.RobustLineIntersector; //导入依赖的package包/类
public void testCollinear2() {
RobustLineIntersector i = new RobustLineIntersector();
Coordinate p1 = new Coordinate(10, 10);
Coordinate p2 = new Coordinate(20, 10);
Coordinate q1 = new Coordinate(20, 10);
Coordinate q2 = new Coordinate(30, 10);
i.computeIntersection(p1, p2, q1, q2);
assertEquals(RobustLineIntersector.POINT_INTERSECTION, i.getIntersectionNum());
assertTrue(!i.isProper());
assertTrue(i.hasIntersection());
}
开发者ID:Semantive,项目名称:jts,代码行数:12,代码来源:RobustLineIntersectorTest.java
示例15: testCollinear3
import com.vividsolutions.jts.algorithm.RobustLineIntersector; //导入依赖的package包/类
public void testCollinear3() {
RobustLineIntersector i = new RobustLineIntersector();
Coordinate p1 = new Coordinate(10, 10);
Coordinate p2 = new Coordinate(20, 10);
Coordinate q1 = new Coordinate(15, 10);
Coordinate q2 = new Coordinate(30, 10);
i.computeIntersection(p1, p2, q1, q2);
assertEquals(RobustLineIntersector.COLLINEAR_INTERSECTION, i.getIntersectionNum());
assertTrue(!i.isProper());
assertTrue(i.hasIntersection());
}
开发者ID:Semantive,项目名称:jts,代码行数:12,代码来源:RobustLineIntersectorTest.java
示例16: testCollinear4
import com.vividsolutions.jts.algorithm.RobustLineIntersector; //导入依赖的package包/类
public void testCollinear4() {
RobustLineIntersector i = new RobustLineIntersector();
Coordinate p1 = new Coordinate(30, 10);
Coordinate p2 = new Coordinate(20, 10);
Coordinate q1 = new Coordinate(10, 10);
Coordinate q2 = new Coordinate(30, 10);
i.computeIntersection(p1, p2, q1, q2);
assertEquals(RobustLineIntersector.COLLINEAR_INTERSECTION, i.getIntersectionNum());
assertTrue(i.hasIntersection());
}
开发者ID:Semantive,项目名称:jts,代码行数:11,代码来源:RobustLineIntersectorTest.java
示例17: isInteriorDisconnected
import com.vividsolutions.jts.algorithm.RobustLineIntersector; //导入依赖的package包/类
public Expression<K, C, Boolean> isInteriorDisconnected() {
return new AbstractUnaryTestExpression<K, C, T>(this, "IsInteriorDisconnected") {
@Override
public boolean test(T value, C context) {
if (!(value instanceof Surface)) {
return false;
}
try {
final GeometryValidator validator = context.validateGeometry(value).validator;
final Surface polygon = (Surface) value;
final Ring exterior = new DefaultLinearRing("exterior", null, null, polygon
.getExteriorRingCoordinates());
final GeometryFactory geometryFactory = new GeometryFactory();
final LinearRing exteriorRing = getJTSRing(exterior, validator);
final ArrayList<LinearRing> interiorRings = new ArrayList<>();
for (final Points points : polygon.getInteriorRingsCoordinates()) {
final Ring ring = new DefaultLinearRing("interior", null, null, points);
interiorRings.add(getJTSRing(ring, validator));
}
com.vividsolutions.jts.geom.Polygon jtsPolygon = geometryFactory.createPolygon(exteriorRing,
interiorRings.toArray(new LinearRing[interiorRings.size()]));
final GeometryGraph geometryGraph = new GeometryGraph(0, jtsPolygon);
geometryGraph.computeSelfNodes(new RobustLineIntersector(), true);
ConnectedInteriorTester connectedInteriorTester = new ConnectedInteriorTester(geometryGraph);
return !connectedInteriorTester.isInteriorsConnected();
} catch (InvocationTargetException | IllegalArgumentException | IllegalAccessException e) {
throw new ExpressionEvaluationException(e);
}
}
};
}
开发者ID:CDS-INSPIRE,项目名称:InSpider,代码行数:39,代码来源:GeometryExpression.java
示例18: MCIndexSnapRounder
import com.vividsolutions.jts.algorithm.RobustLineIntersector; //导入依赖的package包/类
public MCIndexSnapRounder(PrecisionModel pm) {
this.pm = pm;
this.li = new RobustLineIntersector();
this.li.setPrecisionModel(pm);
this.scaleFactor = pm.getScale();
}
开发者ID:gegy1000,项目名称:Earth,代码行数:7,代码来源:MCIndexSnapRounder.java
示例19: SimpleSnapRounder
import com.vividsolutions.jts.algorithm.RobustLineIntersector; //导入依赖的package包/类
public SimpleSnapRounder(PrecisionModel pm) {
this.pm = pm;
this.li = new RobustLineIntersector();
this.li.setPrecisionModel(pm);
this.scaleFactor = pm.getScale();
}
开发者ID:gegy1000,项目名称:Earth,代码行数:7,代码来源:SimpleSnapRounder.java
示例20: IteratedNoder
import com.vividsolutions.jts.algorithm.RobustLineIntersector; //导入依赖的package包/类
public IteratedNoder(PrecisionModel pm) {
this.li = new RobustLineIntersector();
this.pm = pm;
this.li.setPrecisionModel(pm);
}
开发者ID:gegy1000,项目名称:Earth,代码行数:6,代码来源:IteratedNoder.java
注:本文中的com.vividsolutions.jts.algorithm.RobustLineIntersector类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论