- more than one visualiser can now connect to the mock.
- Created class ConnectionAcceptor that will accept and allocate to each socket
- Issue of sockets connecting after the race starts then disconnecting will use a socket slot.
#story[1010]
Sprint5 refactor
This branch refactors most of the codebase and merges everything into a single module (racevisionGame).
This has feature parity with the master branch from what I can tell, and fixes a few bugs/issues.
However, the sparkline y axis labelling isn't exactly the same. Instead of being labelled 1, 2, 3, 4, 5, 6, it's labelled (1, 7).
Acceptance criteria:
1. Feature parity with master branch. (There's an app class in each of the mock and visualiser packages.
2. Tests all pass.
3. Code is actually tidier and easier to reason about, and documented.
See merge request !16
Made network.MessageEncoders.RaceVisionByteEncoder methods static (they were effectively static already).
shared.dataInput.XMLReader#readXMLFileToString(..) now throws an XMLReaderException if the file cannot be found.
visualiser.Controllers.StartController assumed XML messages were resource paths instead of file contents - fixed.
Testing:
networking tests now work again.
Added shared.enums.XMLFileType, which is used to specify if a string contains a file path or file contents.
Updated the XML readers to use it.
Testing:
Moved the networking tests and resources into racevisionGame module.
Moved the remaining tests from visualiser into racevisionGame, and added a few empty tests to implement later.
Did the bare minimum to get the mock.model, mock.dataInput, shared.model tests working - many of them need to be tidied/refactored/moved as they don't take into account most of the refactorings.
Refactored Sparkline a bit. Now listens to our data model instead of being manually updated. Boat position labels don't work currently, though.
VisualiserRace now also tracks the order in which boats pass each leg.
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.
Moved FPS tracking to Race class, so both VisualiserRace and MockRace can monitor their FPS.
LatestMessages is now observable. It notifies observers when an XMLMessage is received.
Boat now has StringProperty for name and country/abbreviation.
Moved the MockRace timescale value to Constants.RaceTimeScale. This is passed in to MockRace on construction.
Tidied up StartController.
Copied the visualiser's resources into the resources folder.
Refactored RaceClock. Added comments. Tidied code a bit. Moved to shared.model.
Started work on RaceController.
MockOutput now uses LatestMessages for xml messages.
Moved xml message encoding into RaceVisionByteEncoder. Removed XMLMessageEncoder.
Moved XML message sub types into an enumeration (XMLMessageType).
XMLMessage can now be queried for its attributes (like timestamp, length, etc...).
VisualiserInput now uses LatestMessages.
VisualiserInput now (as it did previously) uses switch statements for checking packet type, instead of if statements.
VisualiserRace now uses LatestMessages instead of VisualiserInput.
Race stores a reference to it. MockRace writes to it, and eventually, VisualiserRace will read from it.
Updated MockRace, MockOutput, Event to use it.
Angle now implements hashCode().
Fixed the networking imports.
Race now keeps a reference to its Race, Boat, and Regatta data sources.
VisualiserRace can be provided with new Race/Boat/Regatta data sources during runtime. Currently it updates boundary and legs with a new RaceDataSource, and marker boats with a new BoatDataSource.
RaceStatus can provide windspeed in knots in addition to mm/sec.
RaceDataSource now provides a list of participating boat sourceIDs instead of boats.
Added a RegattaDataSource interface.
Angle, Azimuth, Bearing and mutable - careful.
Boat has positionInRace.
CompoundMarks have an ID and name.
Marks can be moved (setPosition(...)).
Refactored Mock.Race, Visualiser.StreamedCourse, Visualiser.StreamedRace, into (shared) Race, MockRace, VisualiserRace.
VisualiserBoat has color.
Added xml and polar files into resources folder.
Moved Boat/MockBoat/VisualiserBoat into it.
Moved Polars, polarParser, VMG, and polar exception.
Moved the networking stuff into it.
Moved angle, azimuth, bearing into it.
Moved gpscoordinate into it.
Moved mark/compoundMark into it.
Moved leg into it.
Moved trackpoint into it.
- Removed some default templates (eg: created by X)
- Wrote JavaDoc for classes that had none
- Made JavaDoc more clear for classes
- Linked JavaDoc to other classes
- Minor spelling errors fixed
- BoatInRace and BoatInRaceTest commented out (to be removed)
#story[1003]
- Removed references to Constants class from other classes and tests
- ArrowController, Constants, Regatta removed
- Removed imports from various classes no longer used
#story[1003]
- arrow shows wind direction as from instead of to
- removed old unused displayArrow method
- renamed displayFancyArrow to displayWindArrow
- removed coordinates parameter not used
#story[882, 1003]
Fix time since last marker
Visualiser:
Fixed the issue where a boat's time since last mark started counting from when the race screen loaded.
It now starts counting when the race actually starts.
See merge request !13
- Wind arrow for the bermuda race is bound between 215 and 235 degrees
- annotations will not correctly highlight what they are showing
#story[877] #story[882]
Fixed the issue where a boat's time since last mark started counting from when the race screen loaded.
It now starts counting when the race actually starts.
- Wind arrow for the bermuda race is bound between 215 and 235 degrees
- annotations will not correctly highlight what they are showing
#story[877] story[882]
Fixes some issues with tacking/gybing.
Boats no longer go out of bounds, and only tack every 15 seconds.
Tested with all wind angles between [0,360] at 45 degree increments.
Also contains the visualiser wind scalar bug fix.
See merge request !12
# Conflicts:
# mock/src/main/java/seng302/Model/Race.java
Resolved.
Also reverted the change to the prestart and preparatory time, as they had gotten flipped around (prestart is > 3min to start, preparatory is < 1 min to start).