Merge remote-tracking branch 'origin/story9' into mergePacedLoop
# Conflicts: # .idea/compiler.xml # .idea/misc.xml
This commit is contained in:
Generated
+16
-1
@@ -1,8 +1,23 @@
|
|||||||
<?xml version="1.0" encoding="UTF-8"?>
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
<project version="4">
|
<project version="4">
|
||||||
<component name="CompilerConfiguration">
|
<component name="CompilerConfiguration">
|
||||||
|
<resourceExtensions />
|
||||||
|
<wildcardResourcePatterns>
|
||||||
|
<entry name="!?*.java" />
|
||||||
|
<entry name="!?*.form" />
|
||||||
|
<entry name="!?*.class" />
|
||||||
|
<entry name="!?*.groovy" />
|
||||||
|
<entry name="!?*.scala" />
|
||||||
|
<entry name="!?*.flex" />
|
||||||
|
<entry name="!?*.kt" />
|
||||||
|
<entry name="!?*.clj" />
|
||||||
|
<entry name="!?*.aj" />
|
||||||
|
</wildcardResourcePatterns>
|
||||||
<annotationProcessing>
|
<annotationProcessing>
|
||||||
<profile name="Maven default annotation processors profile" enabled="true">
|
<profile default="true" name="Default" enabled="false">
|
||||||
|
<processorPath useClasspath="true" />
|
||||||
|
</profile>
|
||||||
|
<profile default="false" name="Maven default annotation processors profile" enabled="true">
|
||||||
<sourceOutputDir name="target/generated-sources/annotations" />
|
<sourceOutputDir name="target/generated-sources/annotations" />
|
||||||
<sourceTestOutputDir name="target/generated-test-sources/test-annotations" />
|
<sourceTestOutputDir name="target/generated-test-sources/test-annotations" />
|
||||||
<outputRelativeToContentRoot value="true" />
|
<outputRelativeToContentRoot value="true" />
|
||||||
|
|||||||
Generated
-3
@@ -1,3 +0,0 @@
|
|||||||
<component name="CopyrightManager">
|
|
||||||
<settings default="" />
|
|
||||||
</component>
|
|
||||||
@@ -2,7 +2,14 @@ package seng302.Controllers;
|
|||||||
|
|
||||||
import javafx.fxml.FXML;
|
import javafx.fxml.FXML;
|
||||||
import javafx.scene.canvas.Canvas;
|
import javafx.scene.canvas.Canvas;
|
||||||
|
import javafx.scene.canvas.GraphicsContext;
|
||||||
import javafx.scene.control.TableView;
|
import javafx.scene.control.TableView;
|
||||||
|
import javafx.scene.layout.AnchorPane;
|
||||||
|
import javafx.scene.paint.Color;
|
||||||
|
import javafx.scene.paint.Paint;
|
||||||
|
import javafx.scene.shape.Line;
|
||||||
|
import seng302.Coordinate;
|
||||||
|
import seng302.RaceMap;
|
||||||
|
|
||||||
import java.net.URL;
|
import java.net.URL;
|
||||||
import java.util.ResourceBundle;
|
import java.util.ResourceBundle;
|
||||||
@@ -15,10 +22,60 @@ public class RaceController extends Controller{
|
|||||||
Canvas raceMap;
|
Canvas raceMap;
|
||||||
@FXML
|
@FXML
|
||||||
TableView boatInfoTable;
|
TableView boatInfoTable;
|
||||||
|
@FXML
|
||||||
|
AnchorPane canvasBase;
|
||||||
|
|
||||||
|
private GraphicsContext gc;
|
||||||
|
private RaceMap map;
|
||||||
|
|
||||||
|
public void displayBoat(Coordinate coordinate, Paint paint){
|
||||||
|
gc.setFill(paint);
|
||||||
|
gc.fillOval(coordinate.getX(), coordinate.getY(), 15, 15);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void displayLine(Coordinate coordinateA, Coordinate coordinateB, Paint paint){
|
||||||
|
gc.setStroke(paint);
|
||||||
|
gc.setFill(paint);
|
||||||
|
gc.fillOval(coordinateA.getX() - 3, coordinateA.getY() - 3, 6, 6);
|
||||||
|
gc.fillOval(coordinateB.getX() - 3, coordinateB.getY() - 3, 6, 6);
|
||||||
|
gc.strokeLine(coordinateA.getX(), coordinateA.getY(), coordinateB.getX(), coordinateB.getY());
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public void displayPoint(Coordinate coordinate, Paint paint){
|
||||||
|
gc.setFill(paint);
|
||||||
|
gc.fillOval(coordinate.getX(), coordinate.getY(), 10, 10);
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void initialize(URL location, ResourceBundle resources) {
|
public void initialize(URL location, ResourceBundle resources) {/*
|
||||||
|
raceMap.widthProperty().bind(canvasBase.widthProperty());
|
||||||
|
raceMap.heightProperty().bind(canvasBase.heightProperty());*/
|
||||||
|
this.gc = raceMap.getGraphicsContext2D();
|
||||||
|
this.map = new RaceMap(32.321989, -64.8553, 32.246, -64.831, (int)raceMap.getWidth(), (int)raceMap.getHeight());
|
||||||
|
//boat
|
||||||
|
Coordinate boat1coord = this.map.convertGPS(32.296577, -64.854304);
|
||||||
|
displayBoat(boat1coord, Color.AQUAMARINE);
|
||||||
|
//finish line
|
||||||
|
gc.setLineWidth(2);
|
||||||
|
Coordinate finishLineCoord1 = this.map.convertGPS(32.317379, -64.839291);
|
||||||
|
Coordinate finishLineCoord2 = this.map.convertGPS(32.317257, -64.836260);
|
||||||
|
displayLine(finishLineCoord1, finishLineCoord2, Color.DARKRED);
|
||||||
|
//marks
|
||||||
|
Coordinate markCoord = this.map.convertGPS(32.293039, -64.843983);
|
||||||
|
Coordinate southGate1 = this.map.convertGPS(32.284680, -64.850045);
|
||||||
|
Coordinate southGate2 = this.map.convertGPS(32.280164, -64.847591);
|
||||||
|
Coordinate northGate1 = this.map.convertGPS(32.309693, -64.835249);
|
||||||
|
Coordinate northGate2 = this.map.convertGPS(32.308046, -64.831785);
|
||||||
|
displayBoat(boat1coord, Color.AQUAMARINE);
|
||||||
|
displayBoat(markCoord, Color.GOLD);
|
||||||
|
displayLine(southGate1, southGate2, Color.DARKCYAN);
|
||||||
|
displayLine(northGate1, northGate2, Color.DARKVIOLET);
|
||||||
|
//start line
|
||||||
|
Coordinate startline1 = this.map.convertGPS(32.296577, -64.854304);
|
||||||
|
Coordinate startline2 = this.map.convertGPS(32.293771, -64.855242);
|
||||||
|
displayLine(startline1, startline2, Color.GREEN);
|
||||||
|
|
||||||
|
displayPoint(this.map.convertGPS(32.293771, -64.855242), Color.BLACK);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -0,0 +1,19 @@
|
|||||||
|
package seng302;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Created by cbt24 on 15/03/17.
|
||||||
|
*/
|
||||||
|
public class Coordinate {
|
||||||
|
private int x;
|
||||||
|
private int y;
|
||||||
|
|
||||||
|
public Coordinate(int x, int y) { this.x = x; this.y = y; }
|
||||||
|
|
||||||
|
public int getX() {
|
||||||
|
return x;
|
||||||
|
}
|
||||||
|
|
||||||
|
public int getY() {
|
||||||
|
return y;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,26 @@
|
|||||||
|
package seng302;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Created by cbt24 on 15/03/17.
|
||||||
|
*/
|
||||||
|
public class RaceMap {
|
||||||
|
private double x1, x2, y1, y2;
|
||||||
|
private int width, height;
|
||||||
|
|
||||||
|
public RaceMap(double x1, double y1, double x2, double y2, int width, int height) {
|
||||||
|
this.x1 = x1; this.x2 = x2; this.y1 = y1; this.y2 = y2; this.width = width; this.height = height;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Converts GPS coordinates to coordinates for container
|
||||||
|
* @param lat GPS latitude
|
||||||
|
* @param lon GPS longitude
|
||||||
|
* @return Coordinate (pair of doubles)
|
||||||
|
* @see seng302.Coordinate
|
||||||
|
*/
|
||||||
|
public Coordinate convertGPS(double lat, double lon) {
|
||||||
|
return new Coordinate((int) (width * (lat - x1) / (x2 - x1)), (int) (height - (height * (lon - y1) / (y2 - y1))));
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -5,14 +5,13 @@
|
|||||||
<?import java.lang.*?>
|
<?import java.lang.*?>
|
||||||
<?import javafx.scene.layout.*?>
|
<?import javafx.scene.layout.*?>
|
||||||
|
|
||||||
|
|
||||||
<AnchorPane xmlns="http://javafx.com/javafx/8" xmlns:fx="http://javafx.com/fxml/1" fx:controller="seng302.Controllers.RaceController">
|
<AnchorPane xmlns="http://javafx.com/javafx/8" xmlns:fx="http://javafx.com/fxml/1" fx:controller="seng302.Controllers.RaceController">
|
||||||
<children>
|
<children>
|
||||||
<SplitPane fx:id="racePane" dividerPositions="0.75" maxHeight="-Infinity" maxWidth="-Infinity" minHeight="-Infinity" minWidth="-Infinity" prefHeight="400.0" prefWidth="600.0" AnchorPane.bottomAnchor="0.0" AnchorPane.leftAnchor="0.0" AnchorPane.rightAnchor="0.0" AnchorPane.topAnchor="0.0">
|
<SplitPane fx:id="racePane" dividerPositions="0.75" maxHeight="-Infinity" maxWidth="-Infinity" minHeight="-Infinity" minWidth="-Infinity" prefHeight="400.0" prefWidth="600.0" AnchorPane.bottomAnchor="0.0" AnchorPane.leftAnchor="0.0" AnchorPane.rightAnchor="0.0" AnchorPane.topAnchor="0.0">
|
||||||
<items>
|
<items>
|
||||||
<AnchorPane minHeight="0.0" minWidth="0.0" prefHeight="160.0" prefWidth="100.0">
|
<AnchorPane fx:id="canvasBase" minHeight="0.0" minWidth="0.0">
|
||||||
<children>
|
<children>
|
||||||
<Canvas fx:id="raceMap" height="400.0" width="446.0" AnchorPane.bottomAnchor="0.0" AnchorPane.leftAnchor="0.0" AnchorPane.rightAnchor="0.0" AnchorPane.topAnchor="0.0" />
|
<Canvas fx:id="raceMap" height="600.0" width="600.0" />
|
||||||
</children>
|
</children>
|
||||||
</AnchorPane>
|
</AnchorPane>
|
||||||
<AnchorPane minHeight="0.0" minWidth="0.0" prefHeight="160.0" prefWidth="100.0">
|
<AnchorPane minHeight="0.0" minWidth="0.0" prefHeight="160.0" prefWidth="100.0">
|
||||||
|
|||||||
Reference in New Issue
Block a user