Skip to content

Commit

Permalink
Merge branch 'hotfix/1.0.1'
Browse files Browse the repository at this point in the history
  • Loading branch information
KarmaKamikaze committed May 19, 2021
2 parents 02b3ee5 + 2909a9c commit 000e075
Show file tree
Hide file tree
Showing 16 changed files with 104 additions and 248 deletions.
10 changes: 5 additions & 5 deletions node/PublicResources/css/style.css
Original file line number Diff line number Diff line change
Expand Up @@ -80,14 +80,18 @@ body {
color: #fff;
}

.options-container {
transform: translateY(-40%);
}

.content h1 {
margin-top: 80px;
font-size: 50px;
text-transform: uppercase;
}

.options-container h1 {
margin-top: 240px;
margin-top: 80px;
font-size: 40px;
text-transform: uppercase;
}
Expand Down Expand Up @@ -207,10 +211,6 @@ div.cy.headless {
margin-left: 50px;
}

div.slider-container {
padding-top: 50px;
}

.control-center input {
margin-left: 50px;
width: 170px;
Expand Down
6 changes: 2 additions & 4 deletions node/PublicResources/html/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -18,12 +18,10 @@
<ul>
<li><a href="/">Home</a></li>
<li>
<a href="https://github.com/KarmaKamikaze/P2-Project">Project</a>
<a href="https://github.com/KarmaKamikaze/FCDS">Project</a>
</li>
<li>
<a href="https://github.com/KarmaKamikaze/P2-Project#readme"
>About</a
>
<a href="https://github.com/KarmaKamikaze/FCDS#readme">About</a>
</li>
</ul>
</div>
Expand Down
1 change: 1 addition & 0 deletions node/PublicResources/js/cytoStylesheet.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ export { CytoStyle, TestCytoStyle };
* Applies the stylesheet to the cytoscape graph
* @param {string} containerId The id of the given graph
* @param {string} graphSize The size of the graph, either "small" or "large", that the stylesheet is to be applied to
* @param {boolean} headless Whether the graph should be rendered or not
* @returns The finished graph object
*/
function CytoStyle(containerId, graphSize, headless) {
Expand Down
78 changes: 0 additions & 78 deletions node/PublicResources/js/darkMode.js

This file was deleted.

2 changes: 1 addition & 1 deletion node/PublicResources/js/dijkstra.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import { initializeSingleSource, relax } from "../js/pathModules.js";

/**
* Dijkstra's algorithm will find the shortest path between all nodes in a weighted graph.
* @param {Object} cyGraph The graph nodes will be updated with new distances
* @param {Class} cyGraph The graph nodes will be updated with new distances
* and parents in terms of the new starting point.
* @param {Object} startNode The starting point node. Also called source.
*/
Expand Down
9 changes: 2 additions & 7 deletions node/PublicResources/js/dynamicPageGeneration.js
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,6 @@ const generateVisualizationHTML = (graphs) => {
<img class="legend disable-select" src="../html/legend.png" alt="Graph legend reference" title="Graph legend reference">
<!-- Load application code at the end to ensure DOM is loaded -->
<script src="../js/graphCore.js" type="module"></script>
<script src="../js/darkMode.js" type="module"></script>
</body>
</html>
`;
Expand Down Expand Up @@ -170,13 +169,10 @@ const generateOptionsHTML = (pageObject) => {
<ul>
<li><a href="/">Home</a></li>
<li>
<a href="https://github.com/KarmaKamikaze/P2-Project">Project</a>
<a href="https://github.com/KarmaKamikaze/FCDS">Project</a>
</li>
<li>
<a
href="https://github.com/KarmaKamikaze/P2-Project/blob/master/README.md"
>About</a
>
<a href="https://github.com/KarmaKamikaze/FCDS#readme">About</a>
</li>
</ul>
</div>
Expand Down Expand Up @@ -369,7 +365,6 @@ const generateHeadlessHTML = (graph, infoDiv) => {
${infoDiv}
<!-- Load application code at the end to ensure DOM is loaded -->
<script src="../js/graphCore.js" type="module"></script>
<script src="../js/darkMode.js" type="module"></script>
</body>
</html>
`;
Expand Down
26 changes: 13 additions & 13 deletions node/PublicResources/js/graphCore.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,24 +2,24 @@ import { CyGraph } from "./graphHelper.js";
import { CytoStyle } from "./cytoStylesheet.js";
import { dijkstra } from "./dijkstra.js";
import { aStar } from "./aStar.js";
import { addDarkBtn } from "./darkMode.js";
import { greedyBestFirstSearch } from "./greedyBestFirstSearch.js";
import { startSimulation } from "./orderGeneration.js";
import * as tests from "./tests.js";
import { runAllTests } from "./tests.js";

export { SetupGraph, simulationTest, getAlgorithm, startSim };

/**
* Performs setup and initialization of the input Cytoscape graph
* @param {CyGraph} cyGraph The CyGraph class to set up
* @param {Class} cyGraph The CyGraph class to set up
* @param {File} presetFile The graph preset file to load
* @param {Function} startSimulationCallback Callback function which starts the simulation
* @param {Number} tickDuration the desired miliseconds per simulation tick
*/
function SetupGraph(
cyGraph,
presetFile = null,
startSimulationCallback,
tickSpeed
tickDuration
) {
if (presetFile === null) {
startSimulation(cyGraph);
Expand All @@ -35,16 +35,18 @@ function SetupGraph(
cyGraph.initializeNodes();
cyGraph.graph.fit(cyGraph.graph.elements());
// then call the given start simulation function for this graph
startSimulationCallback(cyGraph, tickSpeed);
startSimulationCallback(cyGraph, tickDuration);
});
}

/**
* Callback function which starts the simulation once the graph is initialized
* @param {CyGraph} cyGraph The graph to perform the simulation on
* @param {Class} cyGraph The graph to perform the simulation on
* @param {Number} tickDuration the desired miliseconds per simulation tick
*/
function simulationTest(cyGraph, tickSpeed) {
startSimulation(cyGraph, tickSpeed);
function simulationTest(cyGraph, tickDuration) {
startSimulation(cyGraph, tickDuration);
runAllTests();
console.log(`[${cyGraph.name}] Started simulation`);
}

Expand Down Expand Up @@ -87,7 +89,7 @@ async function startSim() {
: graphSettings["graph-size"] === "large"
? BIG_GRAPH_PRESET_FILE
: AALBORG_GRAPH;
let tickSpeed = 1000 / graphSettings["ticks-per-second"];
let tickDuration = 1000 / graphSettings["ticks-per-second"];

for (let i = 0; i < graphSettings["number-of-graphs"]; i++) {
let cytoStyle = new CytoStyle(
Expand All @@ -105,11 +107,11 @@ async function startSim() {
graphSettings["idle-zones"], // use idle zones
graphDivs[i].classList.contains("headless"), // headless traversal
graphSettings["courier-frequency"], // max number of couriers
tickSpeed, // ms per tick
tickDuration, // ms per tick
graphSettings["obstruction-level"]
);
graphArray.push(cyGraph);
SetupGraph(cyGraph, graphSize, simulationTest, tickSpeed);
SetupGraph(cyGraph, graphSize, simulationTest, tickDuration);
}
}

Expand All @@ -122,5 +124,3 @@ const DISTANCE_PER_TICK = 300; // 300 units per tick -> meters per minute -> 18
let graphArray = [];

startSim();

addDarkBtn(graphArray);
Loading

0 comments on commit 000e075

Please sign in to comment.