diff options
| author | manzerbredes <loic.guegan_secondary@yahoo.fr> | 2016-03-21 13:20:41 +0100 |
|---|---|---|
| committer | manzerbredes <loic.guegan_secondary@yahoo.fr> | 2016-03-21 13:20:41 +0100 |
| commit | 8511b3af4778da926634742941d7893b46697c51 (patch) | |
| tree | a479016d258dacf00689c01f1bd9e39e74c333f0 /main | |
| parent | e3006549a89d471fc89559dd38ddbf600185920b (diff) | |
| parent | 0676d16b3a5c13e2b75e97e7140b938b323cd79e (diff) | |
Merge branch 'master' into develop
Diffstat (limited to 'main')
| -rw-r--r-- | main/Main.java | 53 |
1 files changed, 53 insertions, 0 deletions
diff --git a/main/Main.java b/main/Main.java new file mode 100644 index 0000000..51e3c59 --- /dev/null +++ b/main/Main.java @@ -0,0 +1,53 @@ +package main; + +import java.util.ArrayList; +import java.util.HashMap; +import java.util.Iterator; +import java.util.Set; + +import org.graphstream.graph.Graph; +import org.graphstream.graph.implementations.SingleGraph; + +import structure.Grid; +import structure.Router; + +public class Main { + + public static void main(String[] args) { + Grid g=new Grid(); + + + System.setProperty("org.graphstream.ui.renderer", "org.graphstream.ui.j2dviewer.J2DGraphRenderer"); + Graph graph = new SingleGraph("Tutorial 1"); + graph.addAttribute("ui.stylesheet", "url('resources/style.css')"); + + ArrayList<Router> grid=g.getGrid(); + for(Router r : grid){ + graph.addNode(r.name); + + } + for(Router r : grid){ + String current=r.name; + HashMap<Router, Integer> relier=r.getLinks(); + Set<Router> k=relier.keySet(); + Iterator<Router> i=k.iterator(); + while(i.hasNext()){ + Router currentRouter=i.next(); + String currentRouterName=currentRouter.name; + try{ + //graph.addEdge(current+currentRouter, current, currentRouter).addAttribute("ui.style", "fill-color: rgb(0,100,255);"); + graph.addEdge(current+currentRouterName, current, currentRouterName).setAttribute("ui.label", relier.get(currentRouter)); + + + + } + catch(Exception e){ + // System.out.println("Bug de merde."); + } + + } + + } + graph.display(); + } +} |
