Package com.vividsolutions.jts.planargraph

Examples of com.vividsolutions.jts.planargraph.Node


    buildEdgeStringsForUnprocessedNodes();
 
 
  private void buildEdgeStringsForUnprocessedNodes() {
    for (Iterator i = graph.getNodes().iterator(); i.hasNext(); ) {
      Node node = (Node) i.next();
      if (!node.isMarked()) {
        Assert.isTrue(node.getDegree() == 2);
        buildEdgeStringsStartingAt(node);
        node.setMarked(true);
      }
    }
  } 
View Full Code Here


      }
    }
  } 
  private void buildEdgeStringsForNonDegree2Nodes() {
    for (Iterator i = graph.getNodes().iterator(); i.hasNext(); ) {
      Node node = (Node) i.next();
      if (node.getDegree() != 2) {
        buildEdgeStringsStartingAt(node);
        node.setMarked(true);
      }
    }
  }
View Full Code Here

  public void addEdge(LineString lineString) {
    if (lineString.isEmpty()) { return; }
    Coordinate[] coordinates = CoordinateArrays.removeRepeatedPoints(lineString.getCoordinates());
    Coordinate startCoordinate = coordinates[0];
    Coordinate endCoordinate = coordinates[coordinates.length - 1];
    Node startNode = getNode(startCoordinate);
    Node endNode = getNode(endCoordinate);
    DirectedEdge directedEdge0 = new LineMergeDirectedEdge(startNode, endNode,
        coordinates[1], true);
    DirectedEdge directedEdge1 = new LineMergeDirectedEdge(endNode, startNode,
        coordinates[coordinates.length - 2], false);
    Edge edge = new LineMergeEdge(lineString);
View Full Code Here

    edge.setDirectedEdges(directedEdge0, directedEdge1);
    add(edge);
  }

  private Node getNode(Coordinate coordinate) {
    Node node = findNode(coordinate);
    if (node == null) {
      node = new Node(coordinate);
      add(node);
    }

    return node;
  }
View Full Code Here

    buildEdgeStringsForUnprocessedNodes();
 
 
  private void buildEdgeStringsForUnprocessedNodes() {
    for (Iterator i = graph.getNodes().iterator(); i.hasNext(); ) {
      Node node = (Node) i.next();
      if (!node.isMarked()) {
        Assert.isTrue(node.getDegree() == 2);
        buildEdgeStringsStartingAt(node);
        node.setMarked(true);
      }
    }
  } 
View Full Code Here

      }
    }
  } 
  private void buildEdgeStringsForNonDegree2Nodes() {
    for (Iterator i = graph.getNodes().iterator(); i.hasNext(); ) {
      Node node = (Node) i.next();
      if (node.getDegree() != 2) {
        buildEdgeStringsStartingAt(node);
        node.setMarked(true);
      }
    }
  }
View Full Code Here

    // don't add lines with all coordinates equal
    if (coordinates.length <= 1) return;
   
    Coordinate startCoordinate = coordinates[0];
    Coordinate endCoordinate = coordinates[coordinates.length - 1];
    Node startNode = getNode(startCoordinate);
    Node endNode = getNode(endCoordinate);
    DirectedEdge directedEdge0 = new LineMergeDirectedEdge(startNode, endNode,
        coordinates[1], true);
    DirectedEdge directedEdge1 = new LineMergeDirectedEdge(endNode, startNode,
        coordinates[coordinates.length - 2], false);
    Edge edge = new LineMergeEdge(lineString);
View Full Code Here

    edge.setDirectedEdges(directedEdge0, directedEdge1);
    add(edge);
  }

  private Node getNode(Coordinate coordinate) {
    Node node = findNode(coordinate);
    if (node == null) {
      node = new Node(coordinate);
      add(node);
    }

    return node;
  }
View Full Code Here

    assertTrue(! algorithms.isOnLine(new Coordinate(30,10),
          new Coordinate[] {new Coordinate(0,10), new Coordinate(20,10)}));
  }

  public void testDirectedEdgeComparator() {
    DirectedEdge d1 = new DirectedEdge(new Node(new Coordinate(0, 0)),
        new Node(new Coordinate(10, 10)), new Coordinate(10, 10), true);
    DirectedEdge d2 = new DirectedEdge(new Node(new Coordinate(0, 0)),
        new Node(new Coordinate(20, 20)), new Coordinate(20, 20), false);
    assertEquals(0, d2.compareTo(d1));
  }
View Full Code Here

        new Node(new Coordinate(20, 20)), new Coordinate(20, 20), false);
    assertEquals(0, d2.compareTo(d1));
  }

  public void testDirectedEdgeToEdges() {
    DirectedEdge d1 = new DirectedEdge(new Node(new Coordinate(0, 0)),
        new Node(new Coordinate(10, 10)), new Coordinate(10, 10), true);
    DirectedEdge d2 = new DirectedEdge(new Node(new Coordinate(20, 0)),
        new Node(new Coordinate(20, 10)), new Coordinate(20, 10), false);
    List edges = DirectedEdge.toEdges(Arrays.asList(new Object[]{d1, d2}));
    assertEquals(2, edges.size());
    assertNull(edges.get(0));
    assertNull(edges.get(1));
  }
View Full Code Here

TOP

Related Classes of com.vividsolutions.jts.planargraph.Node

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.