Search in sources :

Example 6 with LineStringGraph

use of com.revolsys.geometry.graph.linestring.LineStringGraph in project com.revolsys.open by revolsys.

the class LineStringGraphTest method testIntersectionFalseStartLoop1.

public void testIntersectionFalseStartLoop1() {
    final LineString line1 = this.geometryFactory.geometry("LINESTRING(1189556.287 388686.558,1189562.632 388678.83,1189600.858 388676.435,1189628.151 388671.584,1189641.422 388666.145,1189652.815 388657.629,1189661.246 388647.99,1189673.352 388622.518,1189682.078 388581.915,1189682.664 388567.95,1189676.365 388550.699,1189664.681 388542.216,1189651.787 388538.678,1189609.68 388537.912,1189596.534 388540.359,1189585.183 388547.877,1189574.749 388557.432,1189566.276 388568.068,1189554.171 388593.541,1189552.039 388620.431,1189556.918 388647.614,1189556.58 388679.576,1189556.287 388686.558)");
    final LineStringGraph graph = new LineStringGraph(line1);
    final LineString line2 = this.geometryFactory.geometry("LINESTRING(1189556.287 388686.558,1189555.995 388693.54,1189555.182 388694.284)");
    final boolean intersects = graph.intersects(line2);
    Assert.assertEquals("Intersects incorrect", false, intersects);
}
Also used : LineString(com.revolsys.geometry.model.LineString) LineStringGraph(com.revolsys.geometry.graph.linestring.LineStringGraph)

Example 7 with LineStringGraph

use of com.revolsys.geometry.graph.linestring.LineStringGraph in project com.revolsys.open by revolsys.

the class LineStringGraphTest method testCleanupPOverlapNotStart.

/**
 * +---+ | | ===S---+
 */
public void testCleanupPOverlapNotStart() {
    final LineString line = this.geometryFactory.geometry("LINESTRING(844100 1343000,844000 1343000,844100 1343000,844200 1343000,844200 1343100,844100 1343100,844100 1343000)");
    final LineStringGraph lineGraph = new LineStringGraph(line);
    lineGraph.splitEdgesCloseToNodes();
    lineGraph.splitCrossingEdges();
    final List<LineString> lines = lineGraph.getLines();
    checkLines(lines, "LINESTRING(844100 1343000,844000 1343000)", "LINESTRING(844100 1343000,844200 1343000,844200 1343100,844100 1343100,844100 1343000)");
}
Also used : LineString(com.revolsys.geometry.model.LineString) LineStringGraph(com.revolsys.geometry.graph.linestring.LineStringGraph)

Example 8 with LineStringGraph

use of com.revolsys.geometry.graph.linestring.LineStringGraph in project com.revolsys.open by revolsys.

the class LineStringGraphTest method testIntersectionTrueMiddleMiddle.

public void testIntersectionTrueMiddleMiddle() {
    final LineString line1 = this.geometryFactory.geometry("LINESTRING(800000 1000020,800010 1000010,800020 1000020)");
    final LineStringGraph graph = new LineStringGraph(line1);
    final LineString line2 = this.geometryFactory.geometry("LINESTRING(800000 1000000,800010 1000010,800020 1000000)");
    final boolean intersects = graph.intersects(line2);
    Assert.assertEquals("Intersects incorrect", true, intersects);
}
Also used : LineString(com.revolsys.geometry.model.LineString) LineStringGraph(com.revolsys.geometry.graph.linestring.LineStringGraph)

Example 9 with LineStringGraph

use of com.revolsys.geometry.graph.linestring.LineStringGraph in project com.revolsys.open by revolsys.

the class LineStringGraphTest method testIntersectionFalseStartEnd.

public void testIntersectionFalseStartEnd() {
    final LineString line1 = this.geometryFactory.geometry("LINESTRING(844200 1343000,844300 1343000,844400 1343000)");
    final LineStringGraph graph = new LineStringGraph(line1);
    final LineString line2 = this.geometryFactory.geometry("LINESTRING(844000 1343000,844100 1343000,844200 1343000)");
    final boolean intersects = graph.intersects(line2);
    Assert.assertEquals("Intersects incorrect", false, intersects);
}
Also used : LineString(com.revolsys.geometry.model.LineString) LineStringGraph(com.revolsys.geometry.graph.linestring.LineStringGraph)

Example 10 with LineStringGraph

use of com.revolsys.geometry.graph.linestring.LineStringGraph in project com.revolsys.open by revolsys.

the class LineStringGraphTest method testIntersectionFalseStartEndEndStart.

// 
// 
// public void testIntersectionTrueCloseMiddleMiddle() {
// final LineString line1 =
// geometryFactory.createGeometry("LINESTRING(800000 1000000.001,800010
// 1000000.0005,800020 1000000)");
// final GeometryGraph graph = new GeometryGraph(line1);
// final LineString line2 =
// geometryFactory.createGeometry("LINESTRING(800000 1000000,800010
// 1000000,800020 1000000)");
// 
// final boolean intersects = graph.intersects(line2);
// Assert.assertEquals("Intersects incorrect", true, intersects);
// }
public void testIntersectionFalseStartEndEndStart() {
    final LineString line1 = this.geometryFactory.geometry("LINESTRING(800000 1000000,800010 1000000,800010 1000010)");
    final LineStringGraph graph = new LineStringGraph(line1);
    final LineString line2 = this.geometryFactory.geometry("LINESTRING(800010 1000010,800000 1000010,800000 1000000)");
    final boolean intersects = graph.intersects(line2);
    Assert.assertEquals("Intersects incorrect", false, intersects);
}
Also used : LineString(com.revolsys.geometry.model.LineString) LineStringGraph(com.revolsys.geometry.graph.linestring.LineStringGraph)

Aggregations

LineStringGraph (com.revolsys.geometry.graph.linestring.LineStringGraph)25 LineString (com.revolsys.geometry.model.LineString)24 Edge (com.revolsys.geometry.graph.Edge)2 LineSegment (com.revolsys.geometry.model.segment.LineSegment)2 ArrayList (java.util.ArrayList)2 List (java.util.List)2 Node (com.revolsys.geometry.graph.Node)1 Point (com.revolsys.geometry.model.Point)1 LineStringDouble (com.revolsys.geometry.model.impl.LineStringDouble)1 HashMap (java.util.HashMap)1