Skip to content

Commit

Permalink
create 3 plots in the same time
Browse files Browse the repository at this point in the history
  • Loading branch information
johnprif committed Feb 13, 2023
1 parent b0f0fc5 commit 740093d
Show file tree
Hide file tree
Showing 9 changed files with 116 additions and 319 deletions.
21 changes: 12 additions & 9 deletions src/Control/AlgorithmsHandler.java
Original file line number Diff line number Diff line change
@@ -1,33 +1,36 @@
package Control;

import Model.SmallestEnclosingCirlceAlgorithm1;
import Model.FarthestNeighborVoronoiAlgorithm2;
import Model.NearestNeighborVoronoiAlgorithm3;
import Model.VoronoiAlgorithm2and3;
import Model.DataBase;
import Model.GrahamScan;

public class AlgorithmsHandler
{
private GrahamScan grahamScan;
private SmallestEnclosingCirlceAlgorithm1 algorithm1;
private FarthestNeighborVoronoiAlgorithm2 algorithm2;
private NearestNeighborVoronoiAlgorithm3 algorithm3;
private VoronoiAlgorithm2and3 nearestNeighbor;
private VoronoiAlgorithm2and3 farthestNeighbor;
private DataBase dataBase;

public AlgorithmsHandler()
{
dataBase = DataBase.getInstance();
dataBase.createListOfKandE();

grahamScan = new GrahamScan();
grahamScan = new GrahamScan();
grahamScan.initialize();

algorithm1 = new SmallestEnclosingCirlceAlgorithm1();
dataBase.prepareForAlgorithm(0);
algorithm1.computeSmallestEnclosingCircle();

// algorithm2 = new FarthestNeighborVoronoiAlgorithm2();
// algorithm2.computeFarthestNeighborVoronoiDiagram();
nearestNeighbor = new VoronoiAlgorithm2and3();
dataBase.prepareForAlgorithm(1);
nearestNeighbor.computeVoronoiDiagram();

algorithm3 = new NearestNeighborVoronoiAlgorithm3();
algorithm3.computeNearestNeighborVoronoiDiagram();
farthestNeighbor = new VoronoiAlgorithm2and3();
dataBase.prepareForAlgorithm(2);
farthestNeighbor.computeVoronoiDiagram();
}
}
34 changes: 11 additions & 23 deletions src/Control/GraphGUIHandler.java
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
package Control;

import Model.DataBase;
import Model.NearestNeighborVoronoiAlgorithm3;
import View.SmallestEnclosingCircleGraphGUI;
import View.VoronoiGraphGUI;

Expand All @@ -11,47 +10,36 @@ public class GraphGUIHandler
private DataBase dataBase;
private SmallestEnclosingCircleGraphGUI circleGraphGUI;
private VoronoiGraphGUI farthestNeighborVoronoiGraphGUI;
private VoronoiGraphGUI nearestNeighborVoronoiGraphGUI;

public GraphGUIHandler(String path)
{
this.path = path;
dataBase = DataBase.getInstance();

makeCircleGraph();
// makeFarthestNeighborVoronoiGraph();
makeNearestNeighborVoronoiGraph();
makeCircleGraph("Smallest Enclosing Circle", 0, 0);
makeVoronoiGraph("Nearest Neighbor Voronoi Diagram", 700, 0, 0);
makeVoronoiGraph("Farthest Neighbor Voronoi Diagram", 1400, 0, 1);
}

private void makeCircleGraph()
private void makeCircleGraph(String title, int x, int y)
{
circleGraphGUI = new SmallestEnclosingCircleGraphGUI(path);
circleGraphGUI.setTitle(title);
circleGraphGUI.setAllPoints(dataBase.getAllPoints());
circleGraphGUI.setConvexPoints(dataBase.getConvexPoints());
circleGraphGUI.setCirclePoints(dataBase.getCirclePoints());
circleGraphGUI.setCircleObject(dataBase.findCircle());
circleGraphGUI.initialize();
circleGraphGUI.initialize(x, y);
}

private void makeFarthestNeighborVoronoiGraph()
private void makeVoronoiGraph(String title, int x, int y, int mode)
{
farthestNeighborVoronoiGraphGUI = new VoronoiGraphGUI(path);
farthestNeighborVoronoiGraphGUI.setTitle("Farthest Neighbor Voronoi Diagram");
farthestNeighborVoronoiGraphGUI.setTitle(title);
farthestNeighborVoronoiGraphGUI.setAllPointsSize(dataBase.getAllPointsSize());
farthestNeighborVoronoiGraphGUI.setConvexPoints(dataBase.getConvexPoints());
farthestNeighborVoronoiGraphGUI.setK(dataBase.getK());
farthestNeighborVoronoiGraphGUI.setE(dataBase.getE());
farthestNeighborVoronoiGraphGUI.initialize();
}

private void makeNearestNeighborVoronoiGraph()
{
nearestNeighborVoronoiGraphGUI = new VoronoiGraphGUI(path);
nearestNeighborVoronoiGraphGUI.setTitle("Nearest Neighbor Voronoi Diagram");
nearestNeighborVoronoiGraphGUI.setAllPointsSize(dataBase.getAllPointsSize());
nearestNeighborVoronoiGraphGUI.setConvexPoints(dataBase.getConvexPoints());
nearestNeighborVoronoiGraphGUI.setK(dataBase.getK());
nearestNeighborVoronoiGraphGUI.setE(dataBase.getE());
nearestNeighborVoronoiGraphGUI.initialize();
farthestNeighborVoronoiGraphGUI.setK(dataBase.getK(mode));
farthestNeighborVoronoiGraphGUI.setE(dataBase.getE(mode));
farthestNeighborVoronoiGraphGUI.initialize(x, y);
}
}
Loading

0 comments on commit 740093d

Please sign in to comment.