This commit is contained in:
Erika Savell
2017-03-16 16:40:53 +13:00
4 changed files with 19 additions and 17 deletions
@@ -7,6 +7,7 @@ import javafx.scene.control.TableView;
import javafx.scene.layout.AnchorPane;
import javafx.scene.paint.Color;
import javafx.scene.paint.Paint;
import javafx.scene.transform.Rotate;
import seng302.GraphCoordinate;
import seng302.RaceMap;
@@ -46,6 +47,19 @@ public class RaceController extends Controller{
gc.fillOval(graphCoordinate.getX(), graphCoordinate.getY(), 10, 10);
}
public void displayArrow(GraphCoordinate coordinate, Paint paint){
rotate(10, 30,30);
gc.fillPolygon(new double[]{0, 6, 12, 8, 8, 4, 4},
new double[]{15, 0, 15, 15, 40, 40, 15},
7);
gc.restore();
}
private void rotate(double angle, double px, double py) {
Rotate r = new Rotate(angle, px, py);
gc.setTransform(r.getMxx(), r.getMyx(), r.getMxy(), r.getMyy(), r.getTx(), r.getTy());
}
@Override
public void initialize(URL location, ResourceBundle resources) {/*
raceMap.widthProperty().bind(canvasBase.widthProperty());
@@ -76,5 +90,6 @@ public class RaceController extends Controller{
displayLine(startline1, startline2, Color.GREEN);
displayPoint(this.map.convertGPS(32.293771, -64.855242), Color.BLACK);
displayArrow(new GraphCoordinate(100, 100), Color.BLUEVIOLET);
}
}