Skip to content

Commit

Permalink
Merge branch 'vladi' into develop
Browse files Browse the repository at this point in the history
  • Loading branch information
mbatchkarov committed Jul 3, 2014
2 parents d677299 + 345f30e commit 84ad088
Showing 1 changed file with 10 additions and 9 deletions.
19 changes: 10 additions & 9 deletions src/main/java/controller/Controller.java
Original file line number Diff line number Diff line change
Expand Up @@ -177,26 +177,26 @@ public void save(String path, MyGraph g, PersistentLayout layout) throws IOExcep
//=========!!!all generated/loaded graphs will appear in a new window!!!=========
//-----------GENERATION FUNCTIONALITY-------------------
public void generateRandom(int a, int b, boolean autodetermineIconType) {
this.g.setInstance(setNewGraphColorsFromOldGraph(Generator.generateRandom(a, b, this, autodetermineIconType)));
this.g.setInstance(setNewGraphStyleFromOldGraph(Generator.generateRandom(a, b, this, autodetermineIconType)));
gui.setVertexRenderer();
}

public void generate4Lattice(int a, int b, int nodeDensity, boolean autodetermineIconType) {
MyGraph newGraph = Generator.generateRectangularLattice(a, b, this, autodetermineIconType);
newGraph.getLayoutParameters().setNodeDensity(nodeDensity);
this.g.setInstance(setNewGraphColorsFromOldGraph(newGraph));
this.g.setInstance(setNewGraphStyleFromOldGraph(newGraph));
gui.setVertexRenderer();
}

public void generate6Lattice(int a, int b, int nodeDensity, boolean autodetermineIconType) {
MyGraph newGraph = Generator.generateHexagonalLattice(a, b, this, autodetermineIconType);
newGraph.getLayoutParameters().setNodeDensity(nodeDensity);
this.g.setInstance(setNewGraphColorsFromOldGraph(newGraph));
this.g.setInstance(setNewGraphStyleFromOldGraph(newGraph));
gui.setVertexRenderer();
}

public void generateKleinbergSmallWorld(int m, int n, double c, boolean autodetermineIconType) {
this.g.setInstance(setNewGraphColorsFromOldGraph(Generator.generateKleinbergSmallWorld(m, n, c, this, autodetermineIconType)));
this.g.setInstance(setNewGraphStyleFromOldGraph(Generator.generateKleinbergSmallWorld(m, n, c, this, autodetermineIconType)));
gui.setVertexRenderer();
}

Expand All @@ -205,33 +205,34 @@ public void generateErdosRenyi(int m, double p, boolean autodetermineIconType) {
getVertexFactory().reset(),
getEdgeFactory().reset(),
m, p);
MyGraph myGraph = setNewGraphColorsFromOldGraph(new MyGraph(gen.create()));
MyGraph myGraph = setNewGraphStyleFromOldGraph(new MyGraph(gen.create()));
if (autodetermineIconType) {
Generator.determineInitialNodeTypes(myGraph);
}
this.g.setInstance(myGraph);
gui.setVertexRenderer();
}
public void generateScaleFree(int a, int b, int c, boolean autodetermineIconType) {
this.g.setInstance(setNewGraphColorsFromOldGraph(Generator.generateScaleFree(a, 1, c, this, autodetermineIconType)));
this.g.setInstance(setNewGraphStyleFromOldGraph(Generator.generateScaleFree(a, 1, c, this, autodetermineIconType)));
gui.setVertexRenderer();
}

public void generateEppsteinPowerLaw(int numVert, int numEdges, int r, boolean autodetermineIconType) {
this.g.setInstance(setNewGraphColorsFromOldGraph(Generator.generateEppsteinPowerLaw(numVert, numEdges, r, this, autodetermineIconType)));
this.g.setInstance(setNewGraphStyleFromOldGraph(Generator.generateEppsteinPowerLaw(numVert, numEdges, r, this, autodetermineIconType)));
gui.setVertexRenderer();
}

public void generateEmptyGraph() {
getEdgeFactory().reset();
getVertexFactory().reset();
this.g.setInstance(setNewGraphColorsFromOldGraph(getGraphFactory().create()));
this.g.setInstance(setNewGraphStyleFromOldGraph(getGraphFactory().create()));
gui.setVertexRenderer();
}

private MyGraph setNewGraphColorsFromOldGraph(MyGraph newGraph) {
private MyGraph setNewGraphStyleFromOldGraph(MyGraph newGraph) {
newGraph.getLayoutParameters().setBackgroundColor(g.getLayoutParameters().getBackgroundColorRgb());
newGraph.getLayoutParameters().setEdgeColor(g.getLayoutParameters().getEdgeColorRgb());
newGraph.getLayoutParameters().setAllowNodeIcons(g.getLayoutParameters().areNodeIconsAllowed());
return newGraph;
}

Expand Down

0 comments on commit 84ad088

Please sign in to comment.