-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
0 parents
commit 9d3c575
Showing
28 changed files
with
778 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<module type="JAVA_MODULE" version="4"> | ||
<component name="NewModuleRootManager" inherit-compiler-output="true"> | ||
<exclude-output /> | ||
<content url="file://$MODULE_DIR$"> | ||
<sourceFolder url="file://$MODULE_DIR$/src" isTestSource="false" /> | ||
</content> | ||
<orderEntry type="inheritedJdk" /> | ||
<orderEntry type="sourceFolder" forTests="false" /> | ||
<orderEntry type="library" name="javafx" level="project" /> | ||
<orderEntry type="library" name="javafx" level="project" /> | ||
<orderEntry type="library" name="javafx" level="project" /> | ||
<orderEntry type="library" name="javafx" level="project" /> | ||
<orderEntry type="library" name="javafx" level="project" /> | ||
<orderEntry type="library" name="javafx" level="project" /> | ||
<orderEntry type="library" name="javafx" level="project" /> | ||
<orderEntry type="library" name="javafx" level="project" /> | ||
<orderEntry type="library" name="javafx" level="project" /> | ||
<orderEntry type="library" name="javafx" level="project" /> | ||
<orderEntry type="library" name="javafx" level="project" /> | ||
<orderEntry type="library" name="javafx" level="project" /> | ||
</component> | ||
</module> |
Binary file added
BIN
+350 KB
WaterfordCityRouteFinder/out/production/WaterfordCityRouteFinder/WaterfordMap.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+52.1 KB
...uteFinder/out/production/WaterfordCityRouteFinder/WaterfordMapBlackAndWhite.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+1.92 KB
WaterfordCityRouteFinder/out/production/WaterfordCityRouteFinder/sample/Controller$1.class
Binary file not shown.
Binary file added
BIN
+1.57 KB
WaterfordCityRouteFinder/out/production/WaterfordCityRouteFinder/sample/Controller$2.class
Binary file not shown.
Binary file added
BIN
+1.43 KB
WaterfordCityRouteFinder/out/production/WaterfordCityRouteFinder/sample/Controller$3.class
Binary file not shown.
Binary file added
BIN
+8.33 KB
WaterfordCityRouteFinder/out/production/WaterfordCityRouteFinder/sample/Controller.class
Binary file not shown.
Binary file added
BIN
+2.65 KB
WaterfordCityRouteFinder/out/production/WaterfordCityRouteFinder/sample/CostedPath.class
Binary file not shown.
Binary file added
BIN
+2.13 KB
WaterfordCityRouteFinder/out/production/WaterfordCityRouteFinder/sample/GraphLink.class
Binary file not shown.
Binary file added
BIN
+2.83 KB
WaterfordCityRouteFinder/out/production/WaterfordCityRouteFinder/sample/GraphNode.class
Binary file not shown.
Binary file added
BIN
+1.42 KB
WaterfordCityRouteFinder/out/production/WaterfordCityRouteFinder/sample/LandMark.class
Binary file not shown.
Binary file added
BIN
+2.65 KB
WaterfordCityRouteFinder/out/production/WaterfordCityRouteFinder/sample/LoadPoints.class
Binary file not shown.
Binary file added
BIN
+1.19 KB
WaterfordCityRouteFinder/out/production/WaterfordCityRouteFinder/sample/Main.class
Binary file not shown.
Binary file added
BIN
+1.52 KB
WaterfordCityRouteFinder/out/production/WaterfordCityRouteFinder/sample/Road.class
Binary file not shown.
58 changes: 58 additions & 0 deletions
58
WaterfordCityRouteFinder/out/production/WaterfordCityRouteFinder/sample/sample.fxml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,58 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
|
||
<?import javafx.scene.control.Button?> | ||
<?import javafx.scene.control.ComboBox?> | ||
<?import javafx.scene.control.Label?> | ||
<?import javafx.scene.control.TextArea?> | ||
<?import javafx.scene.image.ImageView?> | ||
<?import javafx.scene.layout.ColumnConstraints?> | ||
<?import javafx.scene.layout.GridPane?> | ||
<?import javafx.scene.layout.Pane?> | ||
<?import javafx.scene.layout.RowConstraints?> | ||
<?import javafx.scene.text.Font?> | ||
|
||
<GridPane alignment="center" hgap="10" vgap="10" xmlns="http://javafx.com/javafx/11.0.1" xmlns:fx="http://javafx.com/fxml/1" fx:controller="sample.Controller"> | ||
<columnConstraints> | ||
<ColumnConstraints /> | ||
</columnConstraints> | ||
<rowConstraints> | ||
<RowConstraints /> | ||
</rowConstraints> | ||
<children> | ||
<Pane fx:id="pane" prefHeight="740.0" prefWidth="900.0"> | ||
<children> | ||
<ImageView fx:id="waterfordMap" fitHeight="387.0" fitWidth="758.0" layoutX="71.0" layoutY="22.0" pickOnBounds="true" preserveRatio="true" /> | ||
<ComboBox fx:id="menuOption" layoutX="78.0" layoutY="576.0" prefHeight="29.0" prefWidth="156.0" promptText="Choose option here.........." /> | ||
<Button fx:id="findRoute" layoutX="255.0" layoutY="576.0" mnemonicParsing="false" onAction="#findRoute" prefHeight="27.0" prefWidth="81.0" text="Find Route"> | ||
<font> | ||
<Font size="13.0" /> | ||
</font> | ||
</Button> | ||
<ComboBox fx:id="from" layoutX="78.0" layoutY="450.0" prefWidth="193.0" /> | ||
<ComboBox fx:id="to" layoutX="309.0" layoutY="450.0" prefWidth="193.0" /> | ||
<ComboBox fx:id="avoid" layoutX="550.0" layoutY="450.0" prefWidth="193.0" /> | ||
<Label layoutX="159.0" layoutY="430.0" text="From"> | ||
<font> | ||
<Font size="14.0" /> | ||
</font> | ||
</Label> | ||
<Label layoutX="390.0" layoutY="430.0" text="To"> | ||
<font> | ||
<Font size="14.0" /> | ||
</font> | ||
</Label> | ||
<Label layoutX="629.0" layoutY="430.0" text="Avoid"> | ||
<font> | ||
<Font size="14.0" /> | ||
</font> | ||
</Label> | ||
<TextArea fx:id="route" layoutX="442.0" layoutY="505.0" prefHeight="200.0" prefWidth="407.0" /> | ||
<Button fx:id="clear" layoutX="354.0" layoutY="578.0" mnemonicParsing="false" onAction="#clear" prefHeight="29.0" prefWidth="71.0" text="Clear"> | ||
<font> | ||
<Font size="13.0" /> | ||
</font> | ||
</Button> | ||
</children> | ||
</Pane> | ||
</children> | ||
</GridPane> |
49 changes: 49 additions & 0 deletions
49
WaterfordCityRouteFinder/out/production/WaterfordCityRouteFinder/waterfordCity.txt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
Landmark,001,Waterford Institute of Technology,199,360 | ||
Landmark,002,The Clock Tower,409,149 | ||
Landmark,003,Bishop's Palace,458,187 | ||
Landmark,004,Cathedral of the Most Holy Trinity,436,165 | ||
Landmark,005,The Apple Market,414,206 | ||
Landmark,006,Thomas Francis Meagher statue,430,158 | ||
Landmark,007,John's St Junction,428,213 | ||
Landmark,008,Meagher's Quay Junction,436,159 | ||
Landmark,009,Tesco Lisduggan,237,289 | ||
Landmark,010,Paddy Browne's Rd Junction,179,366 | ||
Landmark,011,Walsh Park Roundabout,292,252 | ||
Landmark,012,Walsh Park GAA Pitch,290,242 | ||
Landmark,013,Vincent White Rd Roundabout,315,283 | ||
Landmark,014,Matties Hill Junction,309,319 | ||
Landmark,015,Cork rd Roundabout,329,329 | ||
Landmark,016,College street Junction,406,248 | ||
Landmark,017,FerryBank Bridge,373,132 | ||
Landmark,018,Military rd Junction,348,163 | ||
Landmark,019,HyperMarket,341,175 | ||
Landmark,020,Cleaboy Rd Roundabout,279,200 | ||
Landmark,021,NCT Roundabout,155,252 | ||
Road,002,John's St Junction,The Apple Market,120,John's St | ||
Road,003,John's St Junction,Bishop's Palace,400,Cork rd | ||
Road,004,Bishop's Palace,Meagher's Quay Junction,650,Cork rd | ||
Road,005,Meagher's Quay Junction,Cathedral of the Most Holy Trinity,50,Barronstrand St | ||
Road,006,Meagher's Quay Junction,Thomas Francis Meagher statue,100,Cork rd | ||
Road,007,Thomas Francis Meagher statue,The Clock Tower,200,Cork rd | ||
Road,008,Tesco Lisduggan,Paddy Browne's Rd Junction,950,Paddy Browne's rd | ||
Road,009,Paddy Browne's Rd Junction,Waterford Institute of Technology,400,Cork rd | ||
Road,010,Walsh Park Roundabout,Tesco Lisduggan,750,Paddy Browne's rd | ||
Road,011,Walsh Park Roundabout,Walsh Park GAA Pitch,30,Keane's Rd | ||
Road,012,Walsh Park Roundabout,Vincent White Rd Roundabout,400,Vincent White Rd | ||
Road,013,Vincent White Rd Roundabout,Matties Hill Junction,350,Matties Hill rd | ||
Road,014,Matties Hill Junction,Cork rd Roundabout,40,Matties Hill | ||
Road,015,Cork rd Roundabout,College street Junction,1100,Cork rd | ||
Road,016,The Clock Tower,FerryBank Bridge,1100,Cork rd along Quay | ||
Road,017,Waterford Institute of Technology,Cork rd Roundabout,1100,Cork rd | ||
Road,018,Cork rd Roundabout,College street Junction,1100,Cork rd | ||
Road,019,College street Junction,John's St Junction,400,Cork rd | ||
Road,020,FerryBank Bridge,Military rd Junction,900,Military rd | ||
Road,021,Military rd Junction,HyperMarket,100,Military rd | ||
Road,022,Cleaboy Rd Roundabout,Walsh Park GAA Pitch,400,Keane's Rd | ||
Road,023,Cleaboy Rd Roundabout,HyperMarket,750,Upper Yellow Road | ||
Road,024,NCT Roundabout,Cleaboy Rd Roundabout,1300,Cleaboy Rd | ||
Road,025,NCT Roundabout,Paddy Browne's Rd Junction,1500,Industrial estate | ||
|
||
|
||
|
||
|
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,237 @@ | ||
package sample; | ||
|
||
import javafx.event.ActionEvent; | ||
import javafx.event.EventHandler; | ||
import javafx.scene.control.*; | ||
import javafx.scene.control.Button; | ||
import javafx.scene.control.TextArea; | ||
import javafx.scene.image.*; | ||
import javafx.scene.image.Image; | ||
import javafx.scene.input.MouseEvent; | ||
import javafx.scene.layout.Pane; | ||
import javafx.scene.paint.Paint; | ||
import javafx.scene.shape.Circle; | ||
import javafx.scene.shape.Line; | ||
|
||
import java.awt.*; | ||
import java.io.File; | ||
import java.io.IOException; | ||
import java.util.ArrayList; | ||
|
||
public class Controller { | ||
|
||
public ImageView waterfordMap; | ||
public ComboBox menuOption; | ||
public Button findRoute; | ||
public LoadPoints loadPoints = new LoadPoints(); | ||
public LandMark landMark = new LandMark(); | ||
public ComboBox from; | ||
public ComboBox to; | ||
public ComboBox avoid; | ||
public TextArea route; | ||
public Button clear; | ||
public Pane pane; | ||
|
||
|
||
public void initialize() throws IOException { | ||
setWaterfordMap(); | ||
setMenuSelection(); | ||
loadPoints.loadPoints(); | ||
drawLandMarkPoints(); | ||
setComboBoxes(); | ||
} | ||
|
||
public void setWaterfordMap() { | ||
File file = new File("src/WaterfordMap.png"); | ||
Image image = new Image(file.toURI().toString(),758.0,387,false,false); | ||
waterfordMap.setImage(image); | ||
} | ||
|
||
public void setMenuSelection() throws IOException { | ||
menuOption.getItems().add("Generate Direct Route"); | ||
menuOption.getItems().add("Generate Multiple Routes"); | ||
menuOption.getItems().add("Generate Shortest Route using Dijkstra’s algorithm"); | ||
menuOption.getItems().add("Generate Shortest Route using breadth-first search (BFS)"); | ||
menuOption.getItems().add("Generate Most cultural/historic Route"); | ||
} | ||
|
||
public void setComboBoxes(){ | ||
for (int i = 0 ; i < loadPoints.landMarks.size(); i++) { | ||
String name = loadPoints.landMarks.get(i).landMarkName; | ||
from.getItems().add(name); | ||
to.getItems().add(name); | ||
avoid.getItems().add(name); | ||
} | ||
} | ||
|
||
|
||
public void findRoute() throws IOException { | ||
String findRoute = menuOption.getValue().toString(); | ||
switch (findRoute) { | ||
|
||
case "Generate Direct Route": | ||
generateDirectRoute(); | ||
break; | ||
|
||
case "Generate Multiple Routes": | ||
generateMultipleRoutes(); | ||
break; | ||
|
||
case "Generate Shortest Route using Dijkstra’s algorithm": | ||
generateShortestRouteusingDijkstrasalgorithm(); | ||
break; | ||
|
||
case "Generate Shortest Route using breadth-first search (BFS)": | ||
generateShortestRouteusingbreadthfirstsearch(); | ||
break; | ||
|
||
case "Generate Most cultural/historic Route": | ||
generateMostculturalRoute(); | ||
break; | ||
|
||
} | ||
} | ||
|
||
public void drawLandMarkPoints() throws IOException { | ||
for (int i = 0 ; i < loadPoints.landMarks.size(); i++) { | ||
String name = loadPoints.landMarks.get(i).landMarkName; | ||
int x = Integer.parseInt(loadPoints.landMarks.get(i).xCoord); | ||
int y = Integer.parseInt(loadPoints.landMarks.get(i).yCoord); | ||
|
||
Circle circle = new Circle(x,y, 4,Paint.valueOf("Red")); | ||
circle.setTranslateX(waterfordMap.getLayoutX()); | ||
circle.setTranslateY(waterfordMap.getLayoutY()); | ||
|
||
|
||
Tooltip mousePositionToolTip = new Tooltip(""); | ||
circle.setOnMouseEntered(new EventHandler<MouseEvent>() { | ||
@Override | ||
public void handle(MouseEvent event) { | ||
String msg = "Name : " + name + "\n"; | ||
mousePositionToolTip.setText(msg); | ||
circle.setRadius(8); | ||
mousePositionToolTip.show(circle, event.getScreenX() + 20, event.getScreenY()); | ||
} | ||
|
||
}); | ||
|
||
circle.setOnMouseClicked(new EventHandler<MouseEvent>() { | ||
@Override | ||
public void handle(MouseEvent event) { | ||
circle.setRadius(6); | ||
circle.setFill(Paint.valueOf("Blue")); | ||
|
||
if(from.getValue() == null){ | ||
from.setValue(name); | ||
}else{ | ||
to.setValue(name); | ||
} | ||
|
||
} | ||
|
||
}); | ||
|
||
|
||
circle.setOnMouseExited(new EventHandler<MouseEvent>() { | ||
@Override | ||
public void handle(MouseEvent event) { | ||
mousePositionToolTip.hide();//hides the tooltip on exit | ||
|
||
if(circle.getFill() != Paint.valueOf("Blue")) | ||
circle.setRadius(4); | ||
} | ||
}); | ||
|
||
((Pane) waterfordMap.getParent()).getChildren().add(circle); | ||
} | ||
} | ||
|
||
public void generateDirectRoute() throws IOException { | ||
String startingPoint = from.getValue().toString(); | ||
String endPoint = to.getValue().toString(); | ||
|
||
GraphNode<LandMark> startNode = new GraphNode<>(); | ||
LandMark endNode = new LandMark(); | ||
|
||
for(int i = 0 ; i < loadPoints.graphNodes.size(); i++){ | ||
if(loadPoints.graphNodes.get(i).data.landMarkName.equalsIgnoreCase(startingPoint)){ | ||
startNode = loadPoints.graphNodes.get(i); | ||
}if(loadPoints.graphNodes.get(i).data.landMarkName.equalsIgnoreCase(endPoint)){ | ||
endNode = loadPoints.graphNodes.get(i).data; | ||
} | ||
} | ||
|
||
CostedPath thePath = CostedPath.searchGraphDepthFirstCheapestPath(startNode,null,0,endNode); | ||
StringBuilder stringRoute = new StringBuilder(); | ||
for(int i = 0 ; i < thePath.pathList.size()-1; i++) { | ||
stringRoute.append(((LandMark) (thePath.pathList.get(i).data)).landMarkName + " to " + ((LandMark) (thePath.pathList.get(i + 1).data)).landMarkName + " via " + | ||
thePath.pathList.get(i).adjList.get(0).roadName+ " ("+thePath.pathList.get(i).adjList.get(0).cost+"m)" + "\n"); | ||
|
||
String startXCoord = ((LandMark) (thePath.pathList.get(i).data)).xCoord; | ||
String startYCoord = ((LandMark) (thePath.pathList.get(i).data)).yCoord; | ||
|
||
String endXCoord = ((LandMark) (thePath.pathList.get(i + 1).data)).xCoord; | ||
String endYCoord = ((LandMark) (thePath.pathList.get(i + 1).data)).yCoord; | ||
|
||
int startX = Integer.parseInt(startXCoord); | ||
int startY = Integer.parseInt(startYCoord); | ||
|
||
int endX = Integer.parseInt(endXCoord); | ||
int endY = Integer.parseInt(endYCoord); | ||
|
||
drawLineForRoute(startX, startY, endX, endY); | ||
route.setText(String.valueOf(stringRoute)); | ||
} | ||
} | ||
|
||
|
||
public void generateMultipleRoutes(){ | ||
} | ||
|
||
public void generateShortestRouteusingDijkstrasalgorithm(){ | ||
|
||
} | ||
|
||
public void generateShortestRouteusingbreadthfirstsearch(){ | ||
|
||
} | ||
|
||
public void generateMostculturalRoute(){ | ||
|
||
} | ||
|
||
public void drawLineForRoute(int startX, int startY,int endX,int endY) { | ||
Line line = new Line(startX, startY, endX, endY); | ||
line.setTranslateX(waterfordMap.getLayoutX()); | ||
line.setTranslateY(waterfordMap.getLayoutY()); | ||
line.setStrokeWidth(3); | ||
((Pane) waterfordMap.getParent()).getChildren().add(line); | ||
|
||
for (int i = 0; i < pane.getChildren().size(); i++) { | ||
if (pane.getChildren().get(i) instanceof Circle) { | ||
Circle circle = (Circle) pane.getChildren().get(i); | ||
if(circle.getCenterX() == startX && circle.getCenterY() == startY) { | ||
circle.setRadius(6); | ||
circle.setFill(Paint.valueOf("Blue")); | ||
} | ||
} | ||
|
||
} | ||
} | ||
|
||
public void clear() throws IOException { | ||
route.clear(); | ||
from.setValue(null); | ||
to.setValue(null); | ||
for (int i = 0 ; i < pane.getChildren().size(); i++) { | ||
if (pane.getChildren().get(i) instanceof Circle) { | ||
Circle circle = (Circle) pane.getChildren().get(i); | ||
circle.setRadius(4); | ||
circle.setFill(Paint.valueOf("Red")); | ||
}else if(pane.getChildren().get(i) instanceof Line){ | ||
Line line = (Line) pane.getChildren().get(i); | ||
line.setStrokeWidth(0); | ||
} | ||
} | ||
} | ||
} |
Oops, something went wrong.