Search in sources :

Example 11 with LineStringGraph

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

the class LineStringGraphTest method testIntersectionTrueMiddleStart.

public void testIntersectionTrueMiddleStart() {
    final LineString line1 = this.geometryFactory.geometry("LINESTRING(800000 1000000,800000 1000010,800000 1000020)");
    final LineStringGraph graph = new LineStringGraph(line1);
    final LineString line2 = this.geometryFactory.geometry("LINESTRING(800000 1000010,800010 1000010,800020 1000010)");
    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 12 with LineStringGraph

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

the class LineStringGraphTest method testCleanupLoopSegmentOverlap.

public void testCleanupLoopSegmentOverlap() {
    final LineString line = this.geometryFactory.geometry("LINESTRING(844000 1343000,844010 1343000,844020 1343000,844020 1343010,844010 1343010,844010 1343000,844020 1343000,844030 1343000)");
    final LineStringGraph graph = new LineStringGraph(line);
    final List<LineString> lines = graph.getLines();
    checkLines(lines, "LINESTRING(844000 1343000,844010 1343000)", "LINESTRING(844010 1343000,844020 1343000)", "LINESTRING(844020 1343000,844020 1343010,844010 1343010,844010 1343000)", "LINESTRING(844020 1343000,844030 1343000)");
}
Also used : LineString(com.revolsys.geometry.model.LineString) LineStringGraph(com.revolsys.geometry.graph.linestring.LineStringGraph)

Example 13 with LineStringGraph

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

the class LineStringGraphTest method testCleanupSplitCrossingEdgesMiddle.

public void testCleanupSplitCrossingEdgesMiddle() {
    final LineString line = this.geometryFactory.geometry("LINESTRING(844000 1343000,844100 1343100,844000 1343100,844100 1343000)");
    final LineStringGraph graph = new LineStringGraph(line);
    graph.splitCrossingEdges();
    final List<LineString> lines = graph.getLines();
    checkLines(lines, "LINESTRING(844000 1343000,844050 1343050)", "LINESTRING(844050 1343050,844100 1343100,844000 1343100,844050 1343050)", "LINESTRING(844050 1343050,844100 1343000)");
}
Also used : LineString(com.revolsys.geometry.model.LineString) LineStringGraph(com.revolsys.geometry.graph.linestring.LineStringGraph)

Example 14 with LineStringGraph

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

the class LineStringGraphTest method testCleanupEndOfSegmentOverlap.

public void testCleanupEndOfSegmentOverlap() {
    final LineString line = this.geometryFactory.geometry("LINESTRING(844000 1343000,844010 1343000,844020 1343000,844010 1343000)");
    final LineStringGraph graph = new LineStringGraph(line);
    final List<LineString> lines = graph.getLines();
    checkLines(lines, "LINESTRING(844000 1343000,844010 1343000,844020 1343000)");
}
Also used : LineString(com.revolsys.geometry.model.LineString) LineStringGraph(com.revolsys.geometry.graph.linestring.LineStringGraph)

Example 15 with LineStringGraph

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

the class LineStringGraphTest method testCleanupFigure8WithOverlap.

public void testCleanupFigure8WithOverlap() {
    final LineString line = this.geometryFactory.geometry("LINESTRING(844000 1343000,844100 1343000,844200 1343000,844300 1343000,844300 1343100,844200 1343100,844200 1343000,844100 1343000,844100 1343100,844000 1343100,844000 1343000)");
    final LineStringGraph graph = new LineStringGraph(line);
    graph.splitEdgesCloseToNodes();
    final List<LineString> lines = graph.getLines();
    checkLines(lines, "LINESTRING(844000 1343000,844100 1343000)", "LINESTRING(844100 1343000,844200 1343000)", "LINESTRING(844200 1343000,844300 1343000,844300 1343100,844200 1343100,844200 1343000)", "LINESTRING(844100 1343000,844100 1343100,844000 1343100,844000 1343000)");
}
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