Repository navigation
course editor
The course editor is where a club's officers place points, draw lines over a chart, put courses together from them, define races, and snapshot and publish. It is behind the officers' login (deployment). What the things it edits mean is in course-model; this page covers what is not obvious from using it.
The decisions it supports are visual and do not survive an interchange format such as GPX: an infinite
end's defining point is a handle whose only job is to put the line's midpoint where the fleet crosses,
and which end is port follows from the direction you intend boats to cross. Points could come from
anywhere; lines and courses are drawn here.
It saves as you go. Every finished edit — a field left, a drag released — is written straight back to the series file. Undo holds one edit, until the page is reloaded; the file's longer history is git's job.
The tab is the scope of the edit: the Points and Lines tabs change the club's shared geometry, the Courses tab changes one variant and asks before touching anything shared — see course-model.
A whole course can be moved or turned to follow a wind shift. The turn happens in a local metric frame: rotating latitude and longitude directly would squash the course, because a degree of longitude is shorter than a degree of latitude by cos(latitude). The pivot is the middle of the course's extent, and the angle snaps to whole degrees.
The same drawing code (coursedraw.js) serves the editor, the boat's overview, the race screen and the
front page, so the course a boat sees is the course it was designed as.
- Each crossing is a triangle with its base on the line and its apex pointing the way to cross, carrying the step's letter. Several crossings on one line are seated along it in course order.
- Legs are coloured by what they are for: green where a lap may begin, red where one may end, blue between. A cycle's entry lines are gold, being both a start and a finish.
- The track is not a sailed track. It runs from each triangle's apex to the next one's base to show order and crossing direction; it knows nothing of beating, laylines or tide.
- A rounding of a point is an arc about the mark, anticlockwise for port and clockwise for starboard, with an arrowhead and the step's letter outside it. The arc spans the outside of the turn, never less than a quarter circle, and each later rounding of the same mark is drawn further out.
Turns have a radius. A boat leaving a triangle is still on the crossing heading, so each leg is a turn–straight–turn path: an arc out of the apex, a straight that is an exact tangent to both turning circles, and an arc into the next base on the next crossing's heading. A rounding is joined the same way, into the tail of its arc and out of its head, each on the arc's own tangent. The radius shrinks on a short leg rather than overshooting.
Each turn may go either way, and the track avoids loops it does not need. Turning toward the next mark by the shorter way can draw a figure of eight — when the mark is nearly astern and a little to one side, or when a zig-zag's straight cuts back across the leg that just arrived. So all four combinations of turning left or right, out and in, are computed, and the one drawn is the one that crosses itself, the triangles either side, and the previous leg the fewest times, and is shortest among those.
A gate splits at the gate but joins well down the leg that follows: a choice is made at the gate and paid for over the next leg, so the two branches rejoin most of the way to the next mark.
The file is spliced, not serialised. A series file is documentation as well as data — it explains its own ends and senses in comments — and round-tripping it through a YAML library would destroy every comment on the first save. So the writer finds the block it changed, replaces exactly that, and copies every other byte through. Where a block ends is the subtle part: blank lines and comments before the next key belong to that key and are left alone.
-
A rename follows its references textually, whole words only: renaming a point updates
at:in the lines, renaming a line updatesline:in the courses. - Long notes are re-wrapped by whole words in a stable way, so saving twice changes nothing the second time.
- Anything added to the file must be added in four places: the model, the editor's payload, the writer, and the editor's change check. Miss the last and everything works on screen while nothing reaches the disk.
A race is defined on the Races tab: its date, how it starts (scratch, open or allocated), and for each
division a course, a variant, a start and a time limit. The form asks which race this one follows; the
file stores the reverse, next, because that is what the server reads when a boat finishes one race.
Choices that would fork the chain or make it loop are not offered. A race is made public only when every
division names a course and design. What happens on the day is the race screen's — see
client-server-dialog §12.