mirror of
https://github.com/eclipse-sailing-analytics/sailing-analytics.git
synced 2026-10-04 19:33:52 +00:00
pulled up approximate to TrackedRaceImpl; preparing Maneuver analysis
This commit is contained in:
1 parent
f796f24858
commit
ea001468d0
4 files changed
+86
-8
No files matched your search
+22
@@ -0,0 +1,22 @@
|
||||
package com.sap.sailing.domain.tracking;
|
||||
|
||||
import com.sap.sailing.domain.base.SpeedWithBearing;
|
||||
import com.sap.sailing.domain.base.Timed;
|
||||
|
||||
public interface Maneuver extends Timed, Positioned {
|
||||
enum Type { HEAD_UP, BEAR_AWAY, TACK, JIBE, PENALTY_CIRCLE }
|
||||
|
||||
Type getType();
|
||||
|
||||
SpeedWithBearing getSpeedWithBearingBefore();
|
||||
|
||||
SpeedWithBearing getSpeedWithBearingAfter();
|
||||
|
||||
/**
|
||||
* This assumes that a maneuver usually slows a boat down. This method tries to find out how long
|
||||
* after the {@link #getTimePoint() time of the maneuver} it took for the boat to reach a roughly
|
||||
* constant speed again.
|
||||
*/
|
||||
long getTimeInMillisecondsUntilBackToConstantSpeed();
|
||||
|
||||
}
|
||||
-8
@@ -3,7 +3,6 @@ package com.sap.sailing.domain.tracking.impl;
|
||||
import java.util.Collection;
|
||||
import java.util.HashSet;
|
||||
import java.util.Iterator;
|
||||
import java.util.List;
|
||||
import java.util.NavigableSet;
|
||||
import java.util.Set;
|
||||
import java.util.logging.Level;
|
||||
@@ -11,12 +10,10 @@ import java.util.logging.Logger;
|
||||
|
||||
import com.sap.sailing.domain.base.Buoy;
|
||||
import com.sap.sailing.domain.base.Competitor;
|
||||
import com.sap.sailing.domain.base.Distance;
|
||||
import com.sap.sailing.domain.base.Leg;
|
||||
import com.sap.sailing.domain.base.RaceDefinition;
|
||||
import com.sap.sailing.domain.base.TimePoint;
|
||||
import com.sap.sailing.domain.base.Waypoint;
|
||||
import com.sap.sailing.domain.base.impl.DouglasPeucker;
|
||||
import com.sap.sailing.domain.base.impl.MillisecondsTimePoint;
|
||||
import com.sap.sailing.domain.tracking.DynamicGPSFixTrack;
|
||||
import com.sap.sailing.domain.tracking.DynamicTrackedEvent;
|
||||
@@ -284,9 +281,4 @@ public class DynamicTrackedRaceImpl extends TrackedRaceImpl implements
|
||||
return (DynamicTrackedEvent) super.getTrackedEvent();
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<GPSFixMoving> approximate(Competitor competitor, Distance maxDistance, TimePoint from, TimePoint to) {
|
||||
DouglasPeucker<Competitor, GPSFixMoving> douglasPeucker = new DouglasPeucker<Competitor, GPSFixMoving>(getTrack(competitor));
|
||||
return douglasPeucker.approximate(maxDistance, from, to);
|
||||
}
|
||||
}
|
||||
+57
@@ -0,0 +1,57 @@
|
||||
package com.sap.sailing.domain.tracking.impl;
|
||||
|
||||
import com.sap.sailing.domain.base.Position;
|
||||
import com.sap.sailing.domain.base.SpeedWithBearing;
|
||||
import com.sap.sailing.domain.base.TimePoint;
|
||||
import com.sap.sailing.domain.tracking.Maneuver;
|
||||
|
||||
public class ManeuverImpl implements Maneuver {
|
||||
private final Type type;
|
||||
private final Position position;
|
||||
private final TimePoint timePoint;
|
||||
private final SpeedWithBearing speedWithBearingBefore;
|
||||
private final SpeedWithBearing speedWithBearingAfter;
|
||||
private final long timeInMillisecondsUntilBackToConstantSpeed;
|
||||
|
||||
public ManeuverImpl(Type type, Position position, TimePoint timePoint, SpeedWithBearing speedWithBearingBefore,
|
||||
SpeedWithBearing speedWithBearingAfter, long timeInMillisecondsUntilBackToConstantSpeed) {
|
||||
super();
|
||||
this.type = type;
|
||||
this.position = position;
|
||||
this.timePoint = timePoint;
|
||||
this.speedWithBearingBefore = speedWithBearingBefore;
|
||||
this.speedWithBearingAfter = speedWithBearingAfter;
|
||||
this.timeInMillisecondsUntilBackToConstantSpeed = timeInMillisecondsUntilBackToConstantSpeed;
|
||||
}
|
||||
|
||||
@Override
|
||||
public long getTimeInMillisecondsUntilBackToConstantSpeed() {
|
||||
return timeInMillisecondsUntilBackToConstantSpeed;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Type getType() {
|
||||
return type;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Position getPosition() {
|
||||
return position;
|
||||
}
|
||||
|
||||
@Override
|
||||
public TimePoint getTimePoint() {
|
||||
return timePoint;
|
||||
}
|
||||
|
||||
@Override
|
||||
public SpeedWithBearing getSpeedWithBearingBefore() {
|
||||
return speedWithBearingBefore;
|
||||
}
|
||||
|
||||
@Override
|
||||
public SpeedWithBearing getSpeedWithBearingAfter() {
|
||||
return speedWithBearingAfter;
|
||||
}
|
||||
|
||||
}
|
||||
+7
@@ -23,6 +23,7 @@ import com.sap.sailing.domain.base.Tack;
|
||||
import com.sap.sailing.domain.base.TimePoint;
|
||||
import com.sap.sailing.domain.base.Waypoint;
|
||||
import com.sap.sailing.domain.base.impl.DegreeBearingImpl;
|
||||
import com.sap.sailing.domain.base.impl.DouglasPeucker;
|
||||
import com.sap.sailing.domain.base.impl.KnotSpeedWithBearingImpl;
|
||||
import com.sap.sailing.domain.base.impl.MillisecondsTimePoint;
|
||||
import com.sap.sailing.domain.tracking.GPSFix;
|
||||
@@ -633,4 +634,10 @@ public abstract class TrackedRaceImpl implements TrackedRace, CourseListener {
|
||||
public String toString() {
|
||||
return "TrackedRace for "+getRace();
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<GPSFixMoving> approximate(Competitor competitor, Distance maxDistance, TimePoint from, TimePoint to) {
|
||||
DouglasPeucker<Competitor, GPSFixMoving> douglasPeucker = new DouglasPeucker<Competitor, GPSFixMoving>(getTrack(competitor));
|
||||
return douglasPeucker.approximate(maxDistance, from, to);
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user