From b18044aa2df924da9c63a164e756675d7e57c661 Mon Sep 17 00:00:00 2001 From: Chris Cromer Date: Sat, 9 Jul 2016 20:38:13 -0400 Subject: [PATCH] Added diagonal arrows. --- .../cromer/estructuras/GrafoController.java | 45 +++++++++++++++++++ 1 file changed, 45 insertions(+) diff --git a/src/cl/cromer/estructuras/GrafoController.java b/src/cl/cromer/estructuras/GrafoController.java index 06ef7aa..4d4079a 100644 --- a/src/cl/cromer/estructuras/GrafoController.java +++ b/src/cl/cromer/estructuras/GrafoController.java @@ -532,6 +532,9 @@ public class GrafoController implements Initializable { // Diagonals dirigido.addEdge(dirigido.getVertex(0), dirigido.getVertex(3), WEIGHT); + dirigido.addEdge(dirigido.getVertex(3), dirigido.getVertex(0), WEIGHT); + dirigido.addEdge(dirigido.getVertex(1), dirigido.getVertex(2), WEIGHT); + dirigido.addEdge(dirigido.getVertex(2), dirigido.getVertex(1), WEIGHT); List> edges = dirigido.getEdges(); for (Grafo.Edge edge : edges) { @@ -653,6 +656,48 @@ public class GrafoController implements Initializable { ); graphicsContext.restore(); } + // Line between 3 and 0 + if (from == grafoNodos[3] && to == grafoNodos[0]) { + graphicsContext.strokeLine(45, 45, 215, 215); + + graphicsContext.save(); + Rotate rotate = new Rotate(135, 44.0, 44.0); + graphicsContext.setTransform(rotate.getMxx(), rotate.getMyx(), rotate.getMxy(), rotate.getMyy(), rotate.getTx(), rotate.getTy()); + graphicsContext.fillPolygon( + new double[] {39.0, 49.0, 44.0}, + new double[] {34.0, 34.0, 44.0}, + 3 + ); + graphicsContext.restore(); + } + // Line between 1 and 2 + if (from == grafoNodos[1] && to == grafoNodos[2]) { + graphicsContext.strokeLine(45, 215, 215, 45); + + graphicsContext.save(); + Rotate rotate = new Rotate(45, 47.0, 213.0); + graphicsContext.setTransform(rotate.getMxx(), rotate.getMyx(), rotate.getMxy(), rotate.getMyy(), rotate.getTx(), rotate.getTy()); + graphicsContext.fillPolygon( + new double[] {42.0, 52.0, 47.0}, + new double[] {208.0, 208.0, 218.0}, + 3 + ); + graphicsContext.restore(); + } + // Line between 2 and 1 + if (from == grafoNodos[2] && to == grafoNodos[1]) { + graphicsContext.strokeLine(45, 215, 215, 45); + + graphicsContext.save(); + Rotate rotate = new Rotate(225, 217.0, 43.0); + graphicsContext.setTransform(rotate.getMxx(), rotate.getMyx(), rotate.getMxy(), rotate.getMyy(), rotate.getTx(), rotate.getTy()); + graphicsContext.fillPolygon( + new double[] {212.0, 222.0, 217.0}, + new double[] {33.0, 33.0, 43.0}, + 3 + ); + graphicsContext.restore(); + } /* // Line between 0 and 2.