mirror of
https://github.com/michaelrausch/Party-Parrots-At-Sea.git
synced 2026-05-09 14:28:43 +00:00
Merged with develop
This commit is contained in:
@@ -64,9 +64,9 @@ public class App extends Application {
|
||||
}
|
||||
//Change the StreamReceiver in this else block to change the default data source.
|
||||
else{
|
||||
// sr = new StreamReceiver("localhost", 4949, "RaceStream");
|
||||
sr = new StreamReceiver("localhost", 4949, "RaceStream");
|
||||
// sr = new StreamReceiver("csse-s302staff.canterbury.ac.nz", 4941, "RaceStream");
|
||||
sr = new StreamReceiver("livedata.americascup.com", 4941, "RaceStream");
|
||||
// sr = new StreamReceiver("livedata.americascup.com", 4941, "RaceStream");
|
||||
}
|
||||
|
||||
sr.start();
|
||||
|
||||
@@ -22,7 +22,6 @@ import seng302.models.mark.MarkType;
|
||||
import seng302.models.mark.SingleMark;
|
||||
import seng302.models.map.Boundary;
|
||||
import seng302.models.map.CanvasMap;
|
||||
import seng302.models.mark.*;
|
||||
import seng302.models.stream.StreamParser;
|
||||
import seng302.models.stream.XMLParser;
|
||||
import seng302.models.stream.XMLParser.RaceXMLObject.Limit;
|
||||
@@ -132,61 +131,36 @@ public class CanvasController {
|
||||
initializeBoats();
|
||||
initializeMarks();
|
||||
timer = new AnimationTimer() {
|
||||
|
||||
private int UPDATE_FPM_PERIOD = 50; // update FPM label every 50 frames
|
||||
private int updateFPMCounter = 100;
|
||||
|
||||
private long lastTime = 0;
|
||||
|
||||
@Override
|
||||
public void handle(long now) {
|
||||
//fps stuff
|
||||
long oldFrameTime = frameTimes[frameTimeIndex] ;
|
||||
frameTimes[frameTimeIndex] = now ;
|
||||
frameTimeIndex = (frameTimeIndex + 1) % frameTimes.length ;
|
||||
if (frameTimeIndex == 0) {
|
||||
arrayFilled = true ;
|
||||
}
|
||||
long elapsedNanos;
|
||||
if (arrayFilled) {
|
||||
elapsedNanos = now - oldFrameTime ;
|
||||
long elapsedNanosPerFrame = elapsedNanos / frameTimes.length ;
|
||||
frameRate = 1_000_000_000.0 / elapsedNanosPerFrame ;
|
||||
if (updateFPMCounter++ > UPDATE_FPM_PERIOD) {
|
||||
updateFPMCounter = 0;
|
||||
drawFps(frameRate.intValue());
|
||||
if (lastTime == 0) {
|
||||
lastTime = now;
|
||||
} else {
|
||||
if (now - lastTime >= (1e8 / 60)) { //Fix for framerate going above 60 when minimized
|
||||
long oldFrameTime = frameTimes[frameTimeIndex];
|
||||
frameTimes[frameTimeIndex] = now;
|
||||
frameTimeIndex = (frameTimeIndex + 1) % frameTimes.length;
|
||||
if (frameTimeIndex == 0) {
|
||||
arrayFilled = true;
|
||||
}
|
||||
long elapsedNanos;
|
||||
if (arrayFilled) {
|
||||
elapsedNanos = now - oldFrameTime;
|
||||
long elapsedNanosPerFrame = elapsedNanos / frameTimes.length;
|
||||
frameRate = 1_000_000_000.0 / elapsedNanosPerFrame;
|
||||
drawFps(frameRate.intValue());
|
||||
}
|
||||
updateGroups();
|
||||
if (StreamParser.isRaceFinished()) {
|
||||
this.stop();
|
||||
}
|
||||
lastTime = now;
|
||||
}
|
||||
}
|
||||
raceViewController.updateSparkLine();
|
||||
}
|
||||
|
||||
// TODO: 1/05/17 cir27 - Make the RaceObjects update on the actual delay.
|
||||
elapsedNanos = 1000 / 60;
|
||||
updateGroups();
|
||||
if (StreamParser.isRaceFinished()) {
|
||||
this.stop();
|
||||
if (lastTime == 0) {
|
||||
lastTime = now;
|
||||
} else {
|
||||
if (now - lastTime >= (1e8 / 60)) { //Fix for framerate going above 60 when minimized
|
||||
long oldFrameTime = frameTimes[frameTimeIndex] ;
|
||||
frameTimes[frameTimeIndex] = now ;
|
||||
frameTimeIndex = (frameTimeIndex + 1) % frameTimes.length ;
|
||||
if (frameTimeIndex == 0) {
|
||||
arrayFilled = true ;
|
||||
}
|
||||
long elapsedNanos;
|
||||
if (arrayFilled) {
|
||||
elapsedNanos = now - oldFrameTime ;
|
||||
long elapsedNanosPerFrame = elapsedNanos / frameTimes.length ;
|
||||
frameRate = 1_000_000_000.0 / elapsedNanosPerFrame ;
|
||||
drawFps(frameRate.intValue());
|
||||
}
|
||||
updateGroups(frameRate);
|
||||
if (StreamParser.isRaceFinished()) {
|
||||
this.stop();
|
||||
}
|
||||
lastTime = now;
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
@@ -239,7 +213,7 @@ public class CanvasController {
|
||||
raceBorder.getPoints().setAll(boundaryPoints);
|
||||
}
|
||||
|
||||
private void updateGroups(double frameRate){
|
||||
private void updateGroups(){
|
||||
for (BoatGroup boatGroup : boatGroups) {
|
||||
// some raceObjects will have multiple ID's (for instance gate marks)
|
||||
//checking if the current "ID" has any updates associated with it
|
||||
@@ -262,8 +236,6 @@ public class CanvasController {
|
||||
|
||||
private void checkForCourseChanges() {
|
||||
if (StreamParser.isNewRaceXmlReceived()){
|
||||
gc.clearRect(0, 0, CANVAS_WIDTH, CANVAS_HEIGHT);
|
||||
drawGoogleMap();
|
||||
addRaceBorder();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -6,7 +6,6 @@ import javafx.collections.FXCollections;
|
||||
import javafx.collections.ObservableList;
|
||||
import javafx.fxml.FXML;
|
||||
import javafx.fxml.FXMLLoader;
|
||||
import javafx.geometry.Side;
|
||||
import javafx.scene.Scene;
|
||||
import javafx.scene.chart.LineChart;
|
||||
import javafx.scene.chart.NumberAxis;
|
||||
@@ -442,49 +441,6 @@ public class RaceViewController extends Thread implements ImportantAnnotationDel
|
||||
return displayFps;
|
||||
}
|
||||
|
||||
/**
|
||||
* Display the important annotations for a specific BoatGroup
|
||||
*
|
||||
* @param bg The boat group to set the annotations for
|
||||
*/
|
||||
private void setBoatGroupImportantAnnotations(BoatGroup bg) {
|
||||
if (importantAnnotations.getAnnotationState(Annotation.NAME)) {
|
||||
bg.setTeamNameObjectVisible(true);
|
||||
} else {
|
||||
bg.setTeamNameObjectVisible(false);
|
||||
}
|
||||
|
||||
if (importantAnnotations.getAnnotationState(Annotation.SPEED)) {
|
||||
bg.setVelocityObjectVisible(true);
|
||||
} else {
|
||||
bg.setVelocityObjectVisible(false);
|
||||
}
|
||||
|
||||
if (importantAnnotations.getAnnotationState(Annotation.TRACK)) {
|
||||
bg.setLineGroupVisible(true);
|
||||
} else {
|
||||
bg.setLineGroupVisible(false);
|
||||
}
|
||||
|
||||
if (importantAnnotations.getAnnotationState(Annotation.WAKE)) {
|
||||
bg.setWakeVisible(true);
|
||||
} else {
|
||||
bg.setWakeVisible(false);
|
||||
}
|
||||
//TODO fix boat annotations with new boatgroup
|
||||
if (importantAnnotations.getAnnotationState(Annotation.ESTTIMETONEXTMARK)) {
|
||||
bg.setEstTimeToNextMarkObjectVisible(true);
|
||||
} else {
|
||||
bg.setEstTimeToNextMarkObjectVisible(false);
|
||||
}
|
||||
|
||||
if (importantAnnotations.getAnnotationState(Annotation.LEGTIME)) {
|
||||
bg.setLegTimeObjectVisible(true);
|
||||
} else {
|
||||
bg.setLegTimeObjectVisible(false);
|
||||
}
|
||||
}
|
||||
|
||||
private void setAnnotations(Integer annotationLevel) {
|
||||
switch (annotationLevel) {
|
||||
// No Annotations
|
||||
|
||||
@@ -6,12 +6,8 @@ import javafx.scene.control.Button;
|
||||
import javafx.scene.control.CheckBox;
|
||||
import javafx.scene.layout.AnchorPane;
|
||||
import javafx.stage.Stage;
|
||||
import seng302.controllers.RaceViewController;
|
||||
import seng302.controllers.annotations.Annotation;
|
||||
|
||||
import java.net.URL;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
import java.net.URL;;
|
||||
import java.util.ResourceBundle;
|
||||
|
||||
public class ImportantAnnotationController implements Initializable {
|
||||
|
||||
@@ -5,7 +5,6 @@ import javafx.scene.Group;
|
||||
import javafx.scene.paint.Color;
|
||||
import javafx.scene.shape.Rectangle;
|
||||
import javafx.scene.text.Text;
|
||||
import seng302.controllers.annotations.Annotation;
|
||||
import seng302.models.Yacht;
|
||||
import seng302.models.stream.StreamParser;
|
||||
|
||||
|
||||
@@ -1,19 +1,10 @@
|
||||
package seng302.models;
|
||||
|
||||
import javafx.beans.InvalidationListener;
|
||||
import javafx.beans.property.*;
|
||||
import javafx.beans.value.ChangeListener;
|
||||
import javafx.beans.value.ObservableValue;
|
||||
import javafx.fxml.Initializable;
|
||||
|
||||
import javafx.scene.paint.Color;
|
||||
import seng302.controllers.RaceViewController;
|
||||
|
||||
import java.text.DateFormat;
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.time.Year;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* Yacht class for the racing boat.
|
||||
|
||||
Reference in New Issue
Block a user