Add getNodes() and getSuccessors() methods and remove iterable from Graph and Node.
This commit is contained in:
@@ -65,7 +65,7 @@ public class NodesInputPanel extends JPanel
|
||||
public Node findClosestNode(Point point) {
|
||||
Node minNode = null;
|
||||
double minDis = Double.POSITIVE_INFINITY;
|
||||
for (Node node: graph) {
|
||||
for (Node node: graph.getNodes()) {
|
||||
double dlon = point.getLongitude() - node.getPoint().getLongitude();
|
||||
double dlat = point.getLatitude() - node.getPoint().getLatitude();
|
||||
double dis = dlon * dlon + dlat * dlat; // No need to square
|
||||
|
@@ -679,8 +679,8 @@ public class BasicDrawing extends JPanel implements Drawing {
|
||||
this.removeMouseMotionListener(zoomAndPanListener);
|
||||
this.removeMouseWheelListener(zoomAndPanListener);
|
||||
|
||||
for (Node node: graph) {
|
||||
for (Arc arc: node) {
|
||||
for (Node node: graph.getNodes()) {
|
||||
for (Arc arc: node.getSuccessors()) {
|
||||
// Draw arcs only if there are one-way arcs or if origin is lower than
|
||||
// destination, avoid drawing two-ways arc twice.
|
||||
if (arc.getRoadInformation().isOneWay()
|
||||
|
Reference in New Issue
Block a user