mirror of
https://github.com/eclipse-sailing-analytics/sailing-analytics.git
synced 2026-10-12 07:10:55 +00:00
start analysis working in leaderboard; fixed Tack names and moved them to localization
This commit is contained in:
1 parent
426cebc599
commit
1337e60f65
13 files changed
+49
-24
No files matched your search
@@ -58,7 +58,7 @@ public class TackTest extends StoredTrackBasedTestWithTrackedRace {
|
||||
MillisecondsTimePoint now = MillisecondsTimePoint.now();
|
||||
hassosTrack.addGPSFix(new GPSFixMovingImpl(new DegreePosition(54.4680424, 10.234451), now,
|
||||
new KnotSpeedWithBearingImpl(10, new DegreeBearingImpl(45))));
|
||||
assertEquals(Tack.STARBOARD, getTrackedRace().getTack(competitor, now));
|
||||
assertEquals(Tack.PORT, getTrackedRace().getTack(competitor, now));
|
||||
}
|
||||
|
||||
@Test
|
||||
@@ -67,7 +67,7 @@ public class TackTest extends StoredTrackBasedTestWithTrackedRace {
|
||||
MillisecondsTimePoint now = MillisecondsTimePoint.now();
|
||||
hassosTrack.addGPSFix(new GPSFixMovingImpl(new DegreePosition(54.4680424, 10.234451), now,
|
||||
new KnotSpeedWithBearingImpl(10, new DegreeBearingImpl(270))));
|
||||
assertEquals(Tack.PORT, getTrackedRace().getTack(competitor, now));
|
||||
assertEquals(Tack.STARBOARD, getTrackedRace().getTack(competitor, now));
|
||||
}
|
||||
|
||||
@Test
|
||||
@@ -76,7 +76,7 @@ public class TackTest extends StoredTrackBasedTestWithTrackedRace {
|
||||
MillisecondsTimePoint now = MillisecondsTimePoint.now();
|
||||
hassosTrack.addGPSFix(new GPSFixMovingImpl(new DegreePosition(54.4680424, 10.234451), now,
|
||||
new KnotSpeedWithBearingImpl(10, new DegreeBearingImpl(180))));
|
||||
assertEquals(Tack.STARBOARD, getTrackedRace().getTack(competitor, now));
|
||||
assertEquals(Tack.PORT, getTrackedRace().getTack(competitor, now));
|
||||
}
|
||||
|
||||
}
|
||||
+2
-2
@@ -1,10 +1,10 @@
|
||||
package com.sap.sailing.domain.tracking;
|
||||
|
||||
import com.sap.sailing.domain.base.Waypoint;
|
||||
import com.sap.sailing.domain.common.Tack;
|
||||
import com.sap.sailing.domain.common.NauticalSide;
|
||||
|
||||
public interface MarkPassingManeuver extends Maneuver {
|
||||
Waypoint getWaypointPassed();
|
||||
|
||||
Tack getSide();
|
||||
NauticalSide getSide();
|
||||
}
|
||||
+4
-3
@@ -4,6 +4,7 @@ import com.sap.sailing.domain.base.SpeedWithBearing;
|
||||
import com.sap.sailing.domain.base.Waypoint;
|
||||
import com.sap.sailing.domain.common.Distance;
|
||||
import com.sap.sailing.domain.common.ManeuverType;
|
||||
import com.sap.sailing.domain.common.NauticalSide;
|
||||
import com.sap.sailing.domain.common.Position;
|
||||
import com.sap.sailing.domain.common.Tack;
|
||||
import com.sap.sailing.domain.common.TimePoint;
|
||||
@@ -12,11 +13,11 @@ import com.sap.sailing.domain.tracking.MarkPassingManeuver;
|
||||
public class MarkPassingManeuverImpl extends ManeuverImpl implements MarkPassingManeuver {
|
||||
private static final long serialVersionUID = 8935348908557191614L;
|
||||
private final Waypoint waypointPassed;
|
||||
private final Tack side;
|
||||
private final NauticalSide side;
|
||||
|
||||
public MarkPassingManeuverImpl(ManeuverType type, Tack newTack, Position position, TimePoint timePoint,
|
||||
SpeedWithBearing speedWithBearingBefore, SpeedWithBearing speedWithBearingAfter,
|
||||
double directionChangeInDegrees, Distance maneuverLoss, Waypoint waypointPassed, Tack side) {
|
||||
double directionChangeInDegrees, Distance maneuverLoss, Waypoint waypointPassed, NauticalSide side) {
|
||||
super(type, newTack, position, timePoint, speedWithBearingBefore, speedWithBearingAfter,
|
||||
directionChangeInDegrees, maneuverLoss);
|
||||
this.waypointPassed = waypointPassed;
|
||||
@@ -29,7 +30,7 @@ public class MarkPassingManeuverImpl extends ManeuverImpl implements MarkPassing
|
||||
}
|
||||
|
||||
@Override
|
||||
public Tack getSide() {
|
||||
public NauticalSide getSide() {
|
||||
return side;
|
||||
}
|
||||
|
||||
|
||||
+3
-2
@@ -49,6 +49,7 @@ import com.sap.sailing.domain.common.Bearing;
|
||||
import com.sap.sailing.domain.common.Distance;
|
||||
import com.sap.sailing.domain.common.LegType;
|
||||
import com.sap.sailing.domain.common.ManeuverType;
|
||||
import com.sap.sailing.domain.common.NauticalSide;
|
||||
import com.sap.sailing.domain.common.NoWindError;
|
||||
import com.sap.sailing.domain.common.NoWindException;
|
||||
import com.sap.sailing.domain.common.Position;
|
||||
@@ -2034,7 +2035,7 @@ public abstract class TrackedRaceImpl implements TrackedRace, CourseListener {
|
||||
TrackedLegOfCompetitor legBeforeManeuver = getTrackedLeg(competitor, timePointBeforeManeuver);
|
||||
TrackedLegOfCompetitor legAfterManeuver = getTrackedLeg(competitor, timePointAfterManeuver);
|
||||
Waypoint waypointPassed = null; // set for MARK_PASSING maneuvers only
|
||||
Tack sideToWhichWaypointWasPassed = null; // set for MARK_PASSING maneuvers only
|
||||
NauticalSide sideToWhichWaypointWasPassed = null; // set for MARK_PASSING maneuvers only
|
||||
// check for mask passing first; a tacking / jibe-setting mark rounding thus takes precedence over being detected as a penalty circle
|
||||
if (legBeforeManeuver != legAfterManeuver
|
||||
// a maneuver at the start line is not to be considered a MARK_PASSING maneuver; show a tack as a tack
|
||||
@@ -2042,7 +2043,7 @@ public abstract class TrackedRaceImpl implements TrackedRace, CourseListener {
|
||||
&& legAfterManeuver.getLeg().getFrom() != getRace().getCourse().getFirstWaypoint()) {
|
||||
maneuverType = ManeuverType.MARK_PASSING;
|
||||
waypointPassed = legAfterManeuver.getLeg().getFrom();
|
||||
sideToWhichWaypointWasPassed = totalCourseChangeInDegrees < 0 ? Tack.PORT : Tack.STARBOARD;
|
||||
sideToWhichWaypointWasPassed = totalCourseChangeInDegrees < 0 ? NauticalSide.PORT : NauticalSide.STARBOARD;
|
||||
} else if (Math.abs(totalCourseChangeInDegrees) > PENALTY_CIRCLE_DEGREES_THRESHOLD) {
|
||||
maneuverType = ManeuverType.PENALTY_CIRCLE;
|
||||
if (legBeforeManeuver != null) {
|
||||
|
||||
+6
@@ -765,4 +765,10 @@ public class MockedTrackedRace implements DynamicTrackedRace {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public Distance getDistanceToStartLine(Competitor competitor, TimePoint timePoint) {
|
||||
// TODO Auto-generated method stub
|
||||
return null;
|
||||
}
|
||||
|
||||
}
|
||||
+4
@@ -542,4 +542,8 @@ public interface StringMessages extends Messages {
|
||||
String speedOverGroundWhenPassingStartTooltip();
|
||||
String startTack();
|
||||
String startTackTooltip();
|
||||
String portTack();
|
||||
String starboardTack();
|
||||
String portSide();
|
||||
String starboardSide();
|
||||
}
|
||||
+4
@@ -545,3 +545,7 @@ speedOverGroundAtRaceStartTooltip=Speed over ground at race start time
|
||||
speedOverGroundWhenPassingStartTooltip=Speed over ground when the competitor passed the start
|
||||
startTack=Start Tack
|
||||
startTackTooltip=Tack on which the competitor started
|
||||
portTack=Port
|
||||
starboardTack=Starboard
|
||||
portSide=Port
|
||||
starboardSide=Starboard
|
||||
+4
@@ -542,3 +542,7 @@ speedOverGroundWhenPassingStart=FüG beim Starten
|
||||
speedOverGroundWhenPassingStartTooltip=Fahrt über Grund, als der Teilnehmer den Start passiert hat
|
||||
startTack=Startbug
|
||||
startTackTooltip=Bug, auf dem der Teilnehmer gestartet ist
|
||||
portTack=Steuerbord
|
||||
starboardTack=Backbord
|
||||
portSide=Backbord
|
||||
starboardSide=Steuerbord
|
||||
+1
-1
@@ -1290,7 +1290,7 @@ public class LeaderboardPanel extends FormPanel implements TimeListener, PlaySta
|
||||
|
||||
@Override
|
||||
public String getValue(LeaderboardRowDTO row) {
|
||||
return getField().get(row) == null ? null : getField().get(row).name();
|
||||
return getField().get(row) == null ? null : getField().get(row) == Tack.PORT ? stringMessages.portTack() : stringMessages.starboardTack();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
+4
-4
@@ -10,8 +10,8 @@ import com.google.gwt.user.cellview.client.Header;
|
||||
import com.sap.sailing.domain.common.DetailType;
|
||||
import com.sap.sailing.domain.common.InvertibleComparator;
|
||||
import com.sap.sailing.domain.common.ManeuverType;
|
||||
import com.sap.sailing.domain.common.NauticalSide;
|
||||
import com.sap.sailing.domain.common.SortingOrder;
|
||||
import com.sap.sailing.domain.common.Tack;
|
||||
import com.sap.sailing.domain.common.impl.InvertibleComparatorAdapter;
|
||||
import com.sap.sailing.gwt.ui.client.StringMessages;
|
||||
import com.sap.sailing.gwt.ui.leaderboard.DetailTypeColumn.LegDetailField;
|
||||
@@ -102,9 +102,9 @@ public class LegColumn extends ExpandableSortableColumn<String> {
|
||||
}
|
||||
}
|
||||
|
||||
private class SideToWhichMarkAtLegStartWasRounded extends AbstractLegDetailField<Tack> {
|
||||
private class SideToWhichMarkAtLegStartWasRounded extends AbstractLegDetailField<NauticalSide> {
|
||||
@Override
|
||||
protected Tack getFromNonNullEntry(LegEntryDTO entry) {
|
||||
protected NauticalSide getFromNonNullEntry(LegEntryDTO entry) {
|
||||
return entry.sideToWhichMarkAtLegStartWasRounded;
|
||||
}
|
||||
}
|
||||
@@ -261,7 +261,7 @@ public class LegColumn extends ExpandableSortableColumn<String> {
|
||||
|
||||
result.put(DetailType.SIDE_TO_WHICH_MARK_AT_LEG_START_WAS_ROUNDED,
|
||||
new SideToWhichMarkAtLegStartWasRoundedColumn(stringMessages.sideToWhichMarkAtLegStartWasRounded(),
|
||||
new SideToWhichMarkAtLegStartWasRounded(), detailHeaderStyle, detailColumnStyle));
|
||||
new SideToWhichMarkAtLegStartWasRounded(), detailHeaderStyle, detailColumnStyle, stringMessages));
|
||||
|
||||
result.put(DetailType.VELOCITY_MADE_GOOD_IN_KNOTS,
|
||||
new FormattedDoubleDetailTypeColumn(DetailType.VELOCITY_MADE_GOOD_IN_KNOTS, new VelocityMadeGoodInKnots(), detailHeaderStyle, detailColumnStyle));
|
||||
|
||||
+8
-4
@@ -2,16 +2,20 @@ package com.sap.sailing.gwt.ui.leaderboard;
|
||||
|
||||
import com.google.gwt.cell.client.TextCell;
|
||||
import com.sap.sailing.domain.common.DetailType;
|
||||
import com.sap.sailing.domain.common.Tack;
|
||||
import com.sap.sailing.domain.common.NauticalSide;
|
||||
import com.sap.sailing.gwt.ui.client.StringMessages;
|
||||
import com.sap.sailing.gwt.ui.shared.LeaderboardRowDTO;
|
||||
|
||||
public class SideToWhichMarkAtLegStartWasRoundedColumn extends DetailTypeColumn<Tack, String> {
|
||||
public SideToWhichMarkAtLegStartWasRoundedColumn(String title, LegDetailField<Tack> field, String headerStyle, String columnStyle) {
|
||||
public class SideToWhichMarkAtLegStartWasRoundedColumn extends DetailTypeColumn<NauticalSide, String> {
|
||||
private final StringMessages stringMessages;
|
||||
|
||||
public SideToWhichMarkAtLegStartWasRoundedColumn(String title, LegDetailField<NauticalSide> field, String headerStyle, String columnStyle, StringMessages stringMessages) {
|
||||
super(DetailType.SIDE_TO_WHICH_MARK_AT_LEG_START_WAS_ROUNDED, field, new TextCell(), headerStyle, columnStyle);
|
||||
this.stringMessages = stringMessages;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getValue(LeaderboardRowDTO row) {
|
||||
return getField().get(row) == null ? null : getField().get(row).name();
|
||||
return getField().get(row) == null ? null : getField().get(row) == NauticalSide.PORT ? stringMessages.portSide() : stringMessages.starboardSide();
|
||||
}
|
||||
}
|
||||
+2
-2
@@ -4,7 +4,7 @@ import java.util.Map;
|
||||
|
||||
import com.google.gwt.user.client.rpc.IsSerializable;
|
||||
import com.sap.sailing.domain.common.ManeuverType;
|
||||
import com.sap.sailing.domain.common.Tack;
|
||||
import com.sap.sailing.domain.common.NauticalSide;
|
||||
|
||||
/**
|
||||
* Holds data about one competitor's performance in one leg of one race represented in the
|
||||
@@ -20,7 +20,7 @@ public class LegEntryDTO implements IsSerializable {
|
||||
public int rank;
|
||||
public Double gapToLeaderInSeconds;
|
||||
public Double gapChangeSinceLegStartInSeconds;
|
||||
public Tack sideToWhichMarkAtLegStartWasRounded;
|
||||
public NauticalSide sideToWhichMarkAtLegStartWasRounded;
|
||||
public Double estimatedTimeToNextWaypointInSeconds;
|
||||
|
||||
/**
|
||||
|
||||
+4
-3
@@ -3,17 +3,18 @@ package com.sap.sailing.gwt.ui.shared;
|
||||
import java.util.Date;
|
||||
|
||||
import com.sap.sailing.domain.common.ManeuverType;
|
||||
import com.sap.sailing.domain.common.NauticalSide;
|
||||
import com.sap.sailing.domain.common.Tack;
|
||||
import com.sap.sailing.gwt.ui.client.StringMessages;
|
||||
|
||||
public class MarkpassingManeuverDTO extends ManeuverDTO {
|
||||
public Tack side;
|
||||
public NauticalSide side;
|
||||
|
||||
MarkpassingManeuverDTO() {}
|
||||
|
||||
public MarkpassingManeuverDTO(ManeuverType type, Tack newTack, PositionDTO position, Date timepoint,
|
||||
SpeedWithBearingDTO speedWithBearingBefore, SpeedWithBearingDTO speedWithBearingAfter,
|
||||
double directionChangeInDegrees, Double maneuverLossInMeters, Tack side) {
|
||||
double directionChangeInDegrees, Double maneuverLossInMeters, NauticalSide side) {
|
||||
super(type, newTack, position, timepoint, speedWithBearingBefore, speedWithBearingAfter, directionChangeInDegrees,
|
||||
maneuverLossInMeters);
|
||||
this.side = side;
|
||||
@@ -23,7 +24,7 @@ public class MarkpassingManeuverDTO extends ManeuverDTO {
|
||||
public String toString(StringMessages stringMessages) {
|
||||
StringBuilder result = new StringBuilder(super.toString(stringMessages));
|
||||
result.append(", ");
|
||||
result.append(stringMessages.passedTo(side.name()));
|
||||
result.append(stringMessages.passedTo(side==null ? "" : side == NauticalSide.PORT ? stringMessages.portSide() : stringMessages.starboardSide()));
|
||||
return result.toString();
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user