I had accidentally broken the raceXML construction - fixed it.
Fixed a few issues where boat didn't have nextMark/previousMark times under certain circumstances. LatestMessages wasn't actually notifying properly - fixed. The various XML readers now treat a string constructor as containing file contents, not file name - this was how it was mostly already used. Fixed some issues in RaceXMLReader, including where element.getChildNodes() was used instead of element.getElementsByName(...). Boat: changes speed to a doubleProperty. Changed leg to a Property<Leg>. Race.lastFps is now an IntegerProperty. Added breaks to the case statements in VisualiserInput. Whoops. ResizableRaceCanvas now handles drawing the race boundary. Tidied up code a bit. Removed ResizableRaceMap. Started refactoring Sparkline. Currently doesn't work.
This commit is contained in:
@@ -7,46 +7,44 @@ import javafx.scene.canvas.GraphicsContext;
|
||||
* The abstract class for the resizable race canvases.
|
||||
*/
|
||||
public abstract class ResizableCanvas extends Canvas {
|
||||
|
||||
/**
|
||||
* The {@link GraphicsContext} to draw to.
|
||||
*/
|
||||
protected final GraphicsContext gc;
|
||||
|
||||
/**
|
||||
* Ctor.
|
||||
*/
|
||||
public ResizableCanvas(){
|
||||
this.gc = this.getGraphicsContext2D();
|
||||
|
||||
// Redraw canvas when size changes.
|
||||
widthProperty().addListener(evt -> draw());
|
||||
heightProperty().addListener(evt -> draw());
|
||||
|
||||
}
|
||||
|
||||
abstract void draw();
|
||||
|
||||
|
||||
/**
|
||||
* Set the Canvas to resizable.
|
||||
*
|
||||
* @return That the Canvas is resizable.
|
||||
* Draws desired contents onto the canvas.
|
||||
* Subclasses implement this to decide what to draw.
|
||||
*/
|
||||
public abstract void draw();
|
||||
|
||||
|
||||
|
||||
|
||||
@Override
|
||||
public boolean isResizable() {
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the preferred width of the Canvas
|
||||
*
|
||||
* @param width of canvas
|
||||
* @return Returns the width of the Canvas
|
||||
*/
|
||||
|
||||
@Override
|
||||
public double prefWidth(double width) {
|
||||
return getWidth();
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the preferred height of the Canvas
|
||||
*
|
||||
* @param height of canvas
|
||||
* @return Returns the height of the Canvas
|
||||
*/
|
||||
@Override
|
||||
public double prefHeight(double height) {
|
||||
return getHeight();
|
||||
|
||||
Reference in New Issue
Block a user