mirror of
https://github.com/eclipse-sailing-analytics/sailing-analytics.git
synced 2026-10-08 21:30:57 +00:00
Merge branch 'racecommittee_app' into racecommittee_wind
Conflicts: java/com.sap.sailing.domain.shared.android/src/com/sap/sailing/domain/tracking/Positioned.java mobile/com.sap.sailing.racecommittee.app/src/com/sap/sailing/racecommittee/app/ui/fragments/dialogs/ClassicCourseDesignDialogFragment.java
This commit is contained in:
commit
838dd9f01a
36 files changed
+532
-357
No files matched your search
@@ -374,10 +374,11 @@ if [[ "$@" == "install" ]] || [[ "$@" == "all" ]]; then
|
||||
# Make sure this script is up2date at least for the next run
|
||||
cp -v $PROJECT_HOME/configuration/buildAndUpdateProduct.sh $ACDIR/
|
||||
|
||||
echo $VERSION_INFO > $ACDIR/configuration/jetty/version.txt
|
||||
|
||||
# make sure to save the information from env.sh
|
||||
. $ACDIR/env.sh
|
||||
|
||||
echo "$VERSION_INFO-$MONGDB_PORT-$MEMORY-$REPLICATION_CHANNEL" > $ACDIR/configuration/jetty/version.txt
|
||||
|
||||
sed -i "s/mongo.port=.*$/mongo.port=$MONGODB_PORT/g" $ACDIR/configuration/config.ini
|
||||
sed -i "s/expedition.udp.port=.*$/expedition.udp.port=$EXPEDITION_PORT/g" $ACDIR/configuration/config.ini
|
||||
sed -i "s/replication.exchangeName=.*$/replication.exchangeName=$REPLICATION_CHANNEL/g" $ACDIR/configuration/config.ini
|
||||
|
||||
-99
@@ -1,99 +0,0 @@
|
||||
package com.sap.sailing.domain.common.coursedesign;
|
||||
|
||||
import java.util.EnumMap;
|
||||
import java.util.Map;
|
||||
import java.util.TreeMap;
|
||||
|
||||
public enum BoatClassType {
|
||||
@SuppressWarnings("serial")
|
||||
boatClass470er("470er", new EnumMap<CourseLayout, Integer>(CourseLayout.class) {
|
||||
{
|
||||
put(CourseLayout.innerLoopTrapezoid, 60);
|
||||
put(CourseLayout.outerLoopTrapezoid, 60);
|
||||
put(CourseLayout.windWardLeewardLeeward, 30);
|
||||
put(CourseLayout.windWardLeewardWindward, 30);
|
||||
}
|
||||
}, new TreeMap<WindRange, Map<PointOfSail, Float>>() {
|
||||
{
|
||||
put(new WindRange(5, 8), new EnumMap<PointOfSail, Float>(PointOfSail.class) {
|
||||
{
|
||||
put(PointOfSail.Upwind, 15f);
|
||||
put(PointOfSail.Downwind, 11f);
|
||||
put(PointOfSail.Reach, 8f);
|
||||
}
|
||||
});
|
||||
put(new WindRange(8, 12), new EnumMap<PointOfSail, Float>(PointOfSail.class) {
|
||||
{
|
||||
put(PointOfSail.Upwind, 13f);
|
||||
put(PointOfSail.Downwind, 10f);
|
||||
put(PointOfSail.Reach, 7f);
|
||||
}
|
||||
});
|
||||
put(new WindRange(12, 15), new EnumMap<PointOfSail, Float>(PointOfSail.class) {
|
||||
{
|
||||
put(PointOfSail.Upwind, 11f);
|
||||
put(PointOfSail.Downwind, 7.5f);
|
||||
put(PointOfSail.Reach, 5.5f);
|
||||
}
|
||||
});
|
||||
put(new WindRange(15, 99), new EnumMap<PointOfSail, Float>(PointOfSail.class) {
|
||||
{
|
||||
put(PointOfSail.Upwind, 10f);
|
||||
put(PointOfSail.Downwind, 6.5f);
|
||||
put(PointOfSail.Reach, 5.5f);
|
||||
}
|
||||
});
|
||||
}
|
||||
}), @SuppressWarnings("serial")
|
||||
boatClass49er("49er", new EnumMap<CourseLayout, Integer>(CourseLayout.class) {
|
||||
{
|
||||
put(CourseLayout.windWardLeewardLeeward, 30);
|
||||
put(CourseLayout.windWardLeewardWindward, 30);
|
||||
}
|
||||
}, new TreeMap<WindRange, Map<PointOfSail, Float>>() {
|
||||
{
|
||||
put(new WindRange(5, 8), new EnumMap<PointOfSail, Float>(PointOfSail.class) {
|
||||
{
|
||||
put(PointOfSail.Upwind, 15f);
|
||||
put(PointOfSail.Downwind, 11f);
|
||||
}
|
||||
});
|
||||
put(new WindRange(8, 12), new EnumMap<PointOfSail, Float>(PointOfSail.class) {
|
||||
{
|
||||
put(PointOfSail.Upwind, 11f);
|
||||
put(PointOfSail.Downwind, 5.5f);
|
||||
}
|
||||
});
|
||||
put(new WindRange(12, 15), new EnumMap<PointOfSail, Float>(PointOfSail.class) {
|
||||
{
|
||||
put(PointOfSail.Upwind, 9f);
|
||||
put(PointOfSail.Downwind, 4.5f);
|
||||
}
|
||||
});
|
||||
put(new WindRange(15, 99), new EnumMap<PointOfSail, Float>(PointOfSail.class) {
|
||||
{
|
||||
put(PointOfSail.Upwind, 7.5f);
|
||||
put(PointOfSail.Downwind, 4f);
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
|
||||
private String displayName;
|
||||
private Map<CourseLayout, Integer> possipleCourseLayoutsWithStandardTargetTime;
|
||||
|
||||
private BoatClassType(String displayName, Map<CourseLayout, Integer> possipleCourseLayoutsWithStandardTargetTime,
|
||||
Map<WindRange, Map<PointOfSail, Float>> boatSpeedTable) {
|
||||
this.displayName = displayName;
|
||||
this.possipleCourseLayoutsWithStandardTargetTime = possipleCourseLayoutsWithStandardTargetTime;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return displayName;
|
||||
}
|
||||
|
||||
public Map<CourseLayout, Integer> getPossibleCourseLayoutsWithTargetTime() {
|
||||
return possipleCourseLayoutsWithStandardTargetTime;
|
||||
}
|
||||
}
|
||||
-5
@@ -1,5 +0,0 @@
|
||||
package com.sap.sailing.domain.common.coursedesign;
|
||||
|
||||
public class CourseDesign {
|
||||
|
||||
}
|
||||
-25
@@ -1,25 +0,0 @@
|
||||
package com.sap.sailing.domain.common.coursedesign;
|
||||
|
||||
public enum CourseLayout {
|
||||
windWardLeewardWindward("Windward/Leeward with Windward finish", "W"),
|
||||
windWardLeewardLeeward("Windward/Leeward with Leeward finish", "W"),
|
||||
innerLoopTrapezoid("Trapezoid Inner Loop", "I"),
|
||||
outerLoopTrapezoid("Trapezoid Outer Loop", "O");
|
||||
|
||||
private String displayName;
|
||||
private String shortName;
|
||||
|
||||
public String getShortName() {
|
||||
return shortName;
|
||||
}
|
||||
|
||||
private CourseLayout(String displayName, String shortName){
|
||||
this.displayName = displayName;
|
||||
this.shortName = shortName;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString(){
|
||||
return displayName;
|
||||
}
|
||||
}
|
||||
+27
@@ -0,0 +1,27 @@
|
||||
package com.sap.sailing.domain.coursedesign;
|
||||
|
||||
import com.sap.sailing.domain.common.Position;
|
||||
import com.sap.sailing.domain.common.impl.DegreePosition;
|
||||
|
||||
|
||||
public abstract class AbstractCourseDesignFactory implements CourseDesignFactory{
|
||||
|
||||
@Override
|
||||
public abstract CourseDesign createCourseDesign(Position startBoatPosition, Double windSpeed, Integer windDirection,
|
||||
BoatClassType boatClass, CourseLayouts courseLayout, NumberOfRounds numberOfRounds, TargetTime targetTime);
|
||||
|
||||
protected Position getPositionForGivenPointDistanceAndBearing(Position givenPoint, int ditanceInMeters,
|
||||
float bearingInDegree) {
|
||||
double bearingInRad = Math.toRadians(bearingInDegree);
|
||||
final int earthRadiusInMeters = 6371000;
|
||||
double lat = Math.asin(Math.sin(givenPoint.getLatDeg()) * Math.cos(ditanceInMeters / earthRadiusInMeters)
|
||||
+ Math.cos(givenPoint.getLatDeg()) * Math.sin(ditanceInMeters / earthRadiusInMeters)
|
||||
* Math.cos(bearingInRad));
|
||||
double lon = givenPoint.getLngDeg()
|
||||
+ Math.atan2(
|
||||
Math.sin(bearingInRad) * Math.sin(ditanceInMeters / earthRadiusInMeters)
|
||||
* Math.cos(givenPoint.getLatDeg()),
|
||||
Math.cos(ditanceInMeters / earthRadiusInMeters) - Math.sin(givenPoint.getLatDeg()) * Math.sin(lat));
|
||||
return new DegreePosition(lat, lon);
|
||||
}
|
||||
}
|
||||
+144
@@ -0,0 +1,144 @@
|
||||
package com.sap.sailing.domain.coursedesign;
|
||||
|
||||
import java.util.EnumMap;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
import java.util.TreeMap;
|
||||
@SuppressWarnings("serial")
|
||||
public enum BoatClassType {
|
||||
boatClass470erMen("470er Men", new HashMap<CourseLayouts, Integer>() {
|
||||
{
|
||||
put(TrapezoidCourseLayouts.innerLoopTrapezoid60, 60);
|
||||
put(TrapezoidCourseLayouts.outerLoopTrapezoid60, 60);
|
||||
put(LeewardWindWardCourseLayouts.windWardLeewardLeeward, 30);
|
||||
put(LeewardWindWardCourseLayouts.windWardLeewardWindward, 30);
|
||||
}
|
||||
}, new TreeMap<WindRange, Map<PointOfSail, Float>>() {
|
||||
{
|
||||
put(new WindRange(5, 8), new EnumMap<PointOfSail, Float>(PointOfSail.class) {
|
||||
{
|
||||
put(PointOfSail.Upwind, 15f);
|
||||
put(PointOfSail.Downwind, 11f);
|
||||
put(PointOfSail.Reach, 8f);
|
||||
}
|
||||
});
|
||||
put(new WindRange(8, 12), new EnumMap<PointOfSail, Float>(PointOfSail.class) {
|
||||
{
|
||||
put(PointOfSail.Upwind, 13f);
|
||||
put(PointOfSail.Downwind, 10f);
|
||||
put(PointOfSail.Reach, 7f);
|
||||
}
|
||||
});
|
||||
put(new WindRange(12, 15), new EnumMap<PointOfSail, Float>(PointOfSail.class) {
|
||||
{
|
||||
put(PointOfSail.Upwind, 11f);
|
||||
put(PointOfSail.Downwind, 7.5f);
|
||||
put(PointOfSail.Reach, 5.5f);
|
||||
}
|
||||
});
|
||||
put(new WindRange(15, 99), new EnumMap<PointOfSail, Float>(PointOfSail.class) {
|
||||
{
|
||||
put(PointOfSail.Upwind, 10f);
|
||||
put(PointOfSail.Downwind, 6.5f);
|
||||
put(PointOfSail.Reach, 5.5f);
|
||||
}
|
||||
});
|
||||
}
|
||||
}, 290),
|
||||
boatClass470eromen("470er Women", new HashMap<CourseLayouts, Integer>() {
|
||||
{
|
||||
put(TrapezoidCourseLayouts.innerLoopTrapezoid60, 60);
|
||||
put(TrapezoidCourseLayouts.outerLoopTrapezoid60, 60);
|
||||
put(LeewardWindWardCourseLayouts.windWardLeewardLeeward, 30);
|
||||
put(LeewardWindWardCourseLayouts.windWardLeewardWindward, 30);
|
||||
}
|
||||
}, new TreeMap<WindRange, Map<PointOfSail, Float>>() {
|
||||
{
|
||||
put(new WindRange(5, 8), new EnumMap<PointOfSail, Float>(PointOfSail.class) {
|
||||
{
|
||||
put(PointOfSail.Upwind, 15f);
|
||||
put(PointOfSail.Downwind, 11f);
|
||||
put(PointOfSail.Reach, 8f);
|
||||
}
|
||||
});
|
||||
put(new WindRange(8, 12), new EnumMap<PointOfSail, Float>(PointOfSail.class) {
|
||||
{
|
||||
put(PointOfSail.Upwind, 13f);
|
||||
put(PointOfSail.Downwind, 10f);
|
||||
put(PointOfSail.Reach, 7f);
|
||||
}
|
||||
});
|
||||
put(new WindRange(12, 15), new EnumMap<PointOfSail, Float>(PointOfSail.class) {
|
||||
{
|
||||
put(PointOfSail.Upwind, 11f);
|
||||
put(PointOfSail.Downwind, 7.5f);
|
||||
put(PointOfSail.Reach, 5.5f);
|
||||
}
|
||||
});
|
||||
put(new WindRange(15, 99), new EnumMap<PointOfSail, Float>(PointOfSail.class) {
|
||||
{
|
||||
put(PointOfSail.Upwind, 10f);
|
||||
put(PointOfSail.Downwind, 6.5f);
|
||||
put(PointOfSail.Reach, 5.5f);
|
||||
}
|
||||
});
|
||||
}
|
||||
}, 110),
|
||||
boatClass49er("49er", new HashMap<CourseLayouts, Integer>() {
|
||||
{
|
||||
put(LeewardWindWardCourseLayouts.windWardLeewardLeeward, 30);
|
||||
put(LeewardWindWardCourseLayouts.windWardLeewardWindward, 30);
|
||||
}
|
||||
}, new TreeMap<WindRange, Map<PointOfSail, Float>>() {
|
||||
{
|
||||
put(new WindRange(5, 8), new EnumMap<PointOfSail, Float>(PointOfSail.class) {
|
||||
{
|
||||
put(PointOfSail.Upwind, 15f);
|
||||
put(PointOfSail.Downwind, 11f);
|
||||
}
|
||||
});
|
||||
put(new WindRange(8, 12), new EnumMap<PointOfSail, Float>(PointOfSail.class) {
|
||||
{
|
||||
put(PointOfSail.Upwind, 11f);
|
||||
put(PointOfSail.Downwind, 5.5f);
|
||||
}
|
||||
});
|
||||
put(new WindRange(12, 15), new EnumMap<PointOfSail, Float>(PointOfSail.class) {
|
||||
{
|
||||
put(PointOfSail.Upwind, 9f);
|
||||
put(PointOfSail.Downwind, 4.5f);
|
||||
}
|
||||
});
|
||||
put(new WindRange(15, 99), new EnumMap<PointOfSail, Float>(PointOfSail.class) {
|
||||
{
|
||||
put(PointOfSail.Upwind, 7.5f);
|
||||
put(PointOfSail.Downwind, 4f);
|
||||
}
|
||||
});
|
||||
}
|
||||
}, 255);
|
||||
|
||||
private String displayName;
|
||||
private Map<CourseLayouts, Integer> possipleCourseLayoutsWithStandardTargetTime;
|
||||
private Integer startLineLengthInMeters;
|
||||
|
||||
private BoatClassType(String displayName, Map<CourseLayouts, Integer> possipleCourseLayoutsWithStandardTargetTime,
|
||||
Map<WindRange, Map<PointOfSail, Float>> boatSpeedTable, Integer startLineLengthInMeters) {
|
||||
this.displayName = displayName;
|
||||
this.possipleCourseLayoutsWithStandardTargetTime = possipleCourseLayoutsWithStandardTargetTime;
|
||||
this.startLineLengthInMeters = startLineLengthInMeters;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return displayName;
|
||||
}
|
||||
|
||||
public Map<CourseLayouts, Integer> getPossibleCourseLayoutsWithTargetTime() {
|
||||
return possipleCourseLayoutsWithStandardTargetTime;
|
||||
}
|
||||
|
||||
public Integer getStartLineLengthInMeters() {
|
||||
return startLineLengthInMeters;
|
||||
}
|
||||
}
|
||||
+6
@@ -0,0 +1,6 @@
|
||||
package com.sap.sailing.domain.coursedesign;
|
||||
|
||||
public interface CourseDesign {
|
||||
PositionedMark getPinEnd();
|
||||
public void setPinEnd(PositionedMark pinEnd);
|
||||
}
|
||||
+8
@@ -0,0 +1,8 @@
|
||||
package com.sap.sailing.domain.coursedesign;
|
||||
|
||||
import com.sap.sailing.domain.common.Position;
|
||||
|
||||
|
||||
public interface CourseDesignFactory {
|
||||
CourseDesign createCourseDesign(Position startBoatPosition, Double windSpeed, Integer windDirection, BoatClassType boatClass, CourseLayouts courseLayout, NumberOfRounds numberOfRounds, TargetTime targetTime);
|
||||
}
|
||||
+6
@@ -0,0 +1,6 @@
|
||||
package com.sap.sailing.domain.coursedesign;
|
||||
|
||||
public interface CourseLayouts {
|
||||
public String getShortName();
|
||||
public Class<? extends CourseDesignFactory> getCourseDesignFactoryClass();
|
||||
}
|
||||
+31
@@ -0,0 +1,31 @@
|
||||
package com.sap.sailing.domain.coursedesign;
|
||||
|
||||
public enum LeewardWindWardCourseLayouts implements CourseLayouts{
|
||||
windWardLeewardWindward("Windward/Leeward with Windward finish", "W", WindWardLeewardCourseDesignFactoryImpl.class),
|
||||
windWardLeewardLeeward("Windward/Leeward with Leeward finish", "L", WindWardLeewardCourseDesignFactoryImpl.class);
|
||||
|
||||
private String displayName;
|
||||
private String shortName;
|
||||
private Class<? extends CourseDesignFactory> courseDesignFactoryClass;
|
||||
|
||||
@Override
|
||||
public String getShortName() {
|
||||
return shortName;
|
||||
}
|
||||
|
||||
private LeewardWindWardCourseLayouts(String displayName, String shortName, Class<? extends CourseDesignFactory> courseDesignFactoryClass){
|
||||
this.courseDesignFactoryClass = courseDesignFactoryClass;
|
||||
this.displayName = displayName;
|
||||
this.shortName = shortName;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString(){
|
||||
return displayName;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Class<? extends CourseDesignFactory> getCourseDesignFactoryClass() {
|
||||
return this.courseDesignFactoryClass;
|
||||
}
|
||||
}
|
||||
+1
-1
@@ -1,4 +1,4 @@
|
||||
package com.sap.sailing.domain.common.coursedesign;
|
||||
package com.sap.sailing.domain.coursedesign;
|
||||
|
||||
public enum NumberOfRounds {
|
||||
TWO(2),
|
||||
+1
-1
@@ -1,4 +1,4 @@
|
||||
package com.sap.sailing.domain.common.coursedesign;
|
||||
package com.sap.sailing.domain.coursedesign;
|
||||
|
||||
public enum PointOfSail{
|
||||
Upwind,
|
||||
+8
@@ -0,0 +1,8 @@
|
||||
package com.sap.sailing.domain.coursedesign;
|
||||
|
||||
import com.sap.sailing.domain.base.Mark;
|
||||
import com.sap.sailing.domain.tracking.Positioned;
|
||||
|
||||
public interface PositionedMark extends Mark, Positioned {
|
||||
|
||||
}
|
||||
+49
@@ -0,0 +1,49 @@
|
||||
package com.sap.sailing.domain.coursedesign;
|
||||
|
||||
import com.sap.sailing.domain.base.impl.MarkImpl;
|
||||
import com.sap.sailing.domain.common.MarkType;
|
||||
import com.sap.sailing.domain.common.Position;
|
||||
|
||||
public class PositionedMarkImpl extends MarkImpl implements PositionedMark {
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
private static final long serialVersionUID = -7903960088124343841L;
|
||||
private Position position;
|
||||
|
||||
public PositionedMarkImpl(String name, Position position) {
|
||||
super(name);
|
||||
this.position = position;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Position getPosition() {
|
||||
return this.position;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getColor() {
|
||||
// TODO Auto-generated method stub
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getShape() {
|
||||
// TODO Auto-generated method stub
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getPattern() {
|
||||
// TODO Auto-generated method stub
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public MarkType getType() {
|
||||
// TODO Auto-generated method stub
|
||||
return null;
|
||||
}
|
||||
|
||||
}
|
||||
+1
-1
@@ -1,4 +1,4 @@
|
||||
package com.sap.sailing.domain.common.coursedesign;
|
||||
package com.sap.sailing.domain.coursedesign;
|
||||
|
||||
public enum TargetTime {
|
||||
thirty(30),
|
||||
+37
@@ -0,0 +1,37 @@
|
||||
package com.sap.sailing.domain.coursedesign;
|
||||
|
||||
public enum TrapezoidCourseLayouts implements CourseLayouts{
|
||||
innerLoopTrapezoid60("Trapezoid 60° Inner Loop", "I", 60),
|
||||
outerLoopTrapezoid60("Trapezoid 60° Outer Loop", "O", 60),
|
||||
innerLoopTrapezoid70("Trapezoid 70° Inner Loop", "I", 70),
|
||||
outerLoopTrapezoid70("Trapezoid 70° Outer Loop", "O", 70);
|
||||
|
||||
private String displayName;
|
||||
private String shortName;
|
||||
private Integer reachAngle;
|
||||
private Class<? extends CourseDesignFactory> courseDesignFactoryClass;
|
||||
|
||||
public Integer getReachAngle() {
|
||||
return reachAngle;
|
||||
}
|
||||
@Override
|
||||
public String getShortName() {
|
||||
return shortName;
|
||||
}
|
||||
|
||||
private TrapezoidCourseLayouts(String displayName, String shortName, Integer reachAngle){
|
||||
this.displayName = displayName;
|
||||
this.shortName = shortName;
|
||||
this.reachAngle = reachAngle;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString(){
|
||||
return displayName;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Class<? extends CourseDesignFactory> getCourseDesignFactoryClass() {
|
||||
return this.courseDesignFactoryClass;
|
||||
}
|
||||
}
|
||||
+1
-1
@@ -1,4 +1,4 @@
|
||||
package com.sap.sailing.domain.common.coursedesign;
|
||||
package com.sap.sailing.domain.coursedesign;
|
||||
|
||||
public class WindRange implements Comparable<WindRange>{
|
||||
private final Integer lowerBound;
|
||||
+22
@@ -0,0 +1,22 @@
|
||||
package com.sap.sailing.domain.coursedesign;
|
||||
|
||||
import com.sap.sailing.domain.common.Position;
|
||||
|
||||
public class WindWardLeewardCourseDesignFactoryImpl extends AbstractCourseDesignFactory {
|
||||
|
||||
@Override
|
||||
public CourseDesign createCourseDesign(Position startBoatPosition, Double windSpeed, Integer windDirection,
|
||||
BoatClassType boatClass, CourseLayouts courseLayout, NumberOfRounds numberOfRounds, TargetTime targetTime) {
|
||||
CourseDesign windWardLeewardCourseDesign = new WindwardLeewardCourseDesignImpl();
|
||||
setPinEnd(windWardLeewardCourseDesign, boatClass, startBoatPosition, windDirection);
|
||||
return windWardLeewardCourseDesign;
|
||||
}
|
||||
|
||||
private void setPinEnd(CourseDesign windWardLeewardCourseDesign, BoatClassType boatClass,
|
||||
Position startBoatPosition, Integer windDirection) {
|
||||
PositionedMark pinEnd = new PositionedMarkImpl("pinEnd", getPositionForGivenPointDistanceAndBearing(
|
||||
startBoatPosition, boatClass.getStartLineLengthInMeters(), windDirection));
|
||||
windWardLeewardCourseDesign.setPinEnd(pinEnd);
|
||||
}
|
||||
|
||||
}
|
||||
+16
@@ -0,0 +1,16 @@
|
||||
package com.sap.sailing.domain.coursedesign;
|
||||
|
||||
public class WindwardLeewardCourseDesignImpl implements CourseDesign{
|
||||
|
||||
PositionedMark pinEnd;
|
||||
|
||||
@Override
|
||||
public PositionedMark getPinEnd() {
|
||||
return pinEnd;
|
||||
}
|
||||
@Override
|
||||
public void setPinEnd(PositionedMark pinEnd) {
|
||||
this.pinEnd = pinEnd;
|
||||
}
|
||||
|
||||
}
|
||||
+3
-1
@@ -134,7 +134,9 @@ public class WindEstimationOnConstructedTracksTest extends StoredTrackBasedTest
|
||||
assertEquals(180., estimatedWindDirection.getBearing().getDegrees(), 0.00000001);
|
||||
CombinedWindTrackImpl combinedTrack = new CombinedWindTrackImpl(getTrackedRace(), WindSourceType.COMBINED.getBaseConfidence());
|
||||
Wind combinedWindDirection = combinedTrack.getAveragedWind(/* position */ null, now);
|
||||
assertEquals(180., combinedWindDirection.getBearing().getDegrees(), 0.00001);
|
||||
//Since the course layout makes a wind estimation around 7° and the confidence of the cluster based wind estimation is not
|
||||
// way higher that that of the course layout wind, we will not end up with exactly 180 deg.
|
||||
assertEquals(180.2, combinedWindDirection.getBearing().getDegrees(), 0.1);
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
+2
-3
@@ -1595,13 +1595,12 @@ public abstract class TrackedRaceImpl implements TrackedRace, CourseListener {
|
||||
if (!bearingClustersDownwind[0].isEmpty() && !bearingClustersDownwind[1].isEmpty()) {
|
||||
BearingWithConfidence<TimePoint> average0 = bearingClustersDownwind[0].getAverage(timePoint);
|
||||
BearingWithConfidence<TimePoint> average1 = bearingClustersDownwind[1].getAverage(timePoint);
|
||||
double downwindConfidence = Math.min(average0.getConfidence(), average1.getConfidence());
|
||||
downwindNumberOfRelevantBoats = Math.min(bearingClustersDownwind[0].size(),
|
||||
bearingClustersDownwind[1].size());
|
||||
confidence = Math.min(confidence, downwindConfidence)
|
||||
confidence = Math.min(average0.getConfidence(), average1.getConfidence())
|
||||
* getRace().getBoatClass().getDownwindWindEstimationConfidence(downwindNumberOfRelevantBoats);
|
||||
downwindAverage = new BearingWithConfidenceImpl<TimePoint>(average0.getObject().middle(
|
||||
average1.getObject()), downwindConfidence, timePoint);
|
||||
average1.getObject()), confidence, timePoint);
|
||||
}
|
||||
numberOfBoatsRelevantForEstimate = upwindNumberOfRelevantBoats + downwindNumberOfRelevantBoats;
|
||||
BearingWithConfidenceCluster<TimePoint> resultCluster = new BearingWithConfidenceCluster<TimePoint>(weigher);
|
||||
|
||||
+1
-1
@@ -598,7 +598,7 @@ public interface StringMessages extends Messages {
|
||||
/*Start of simulator related messages*/
|
||||
String simulator();
|
||||
String optionsBar();
|
||||
String update();
|
||||
String simulateButton();
|
||||
|
||||
String setup();
|
||||
String strength();
|
||||
|
||||
+1
-1
@@ -595,7 +595,7 @@ topNCompetitorsByRaceRank=Race Top {0}
|
||||
topNCompetitorsByTotalRank=Total Top {0}
|
||||
simulator=Simulator
|
||||
optionsBar=Optionsbar
|
||||
update=Update
|
||||
simulateButton=Predict
|
||||
setup=Setup
|
||||
strength=Strength (in kn)
|
||||
oscillation=Oscillation
|
||||
|
||||
+1
-1
@@ -593,7 +593,7 @@ topNCompetitorsByTotalRank=Gesamt Top {0}
|
||||
showHiddenRaces=Rennen im Status HIDDEN anzeigen
|
||||
simulator=Simulator
|
||||
optionsBar=Optionsbar
|
||||
update=Update
|
||||
simulateButton=Prognose
|
||||
setup=Setup
|
||||
strength=Strength(in kn)
|
||||
oscillation=Oscillation
|
||||
|
||||
-7
@@ -1,14 +1,9 @@
|
||||
package com.sap.sailing.gwt.ui.leaderboardedit;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
import java.util.Comparator;
|
||||
import java.util.Date;
|
||||
import java.util.HashMap;
|
||||
import java.util.HashSet;
|
||||
import java.util.List;
|
||||
import java.util.Map.Entry;
|
||||
import java.util.Set;
|
||||
|
||||
import com.google.gwt.cell.client.ButtonCell;
|
||||
import com.google.gwt.cell.client.Cell;
|
||||
@@ -48,7 +43,6 @@ import com.google.gwt.view.client.ListDataProvider;
|
||||
import com.sap.sailing.domain.common.InvertibleComparator;
|
||||
import com.sap.sailing.domain.common.MaxPointsReason;
|
||||
import com.sap.sailing.domain.common.SortingOrder;
|
||||
import com.sap.sailing.domain.common.dto.BoatClassDTO;
|
||||
import com.sap.sailing.domain.common.dto.CompetitorDTO;
|
||||
import com.sap.sailing.domain.common.dto.LeaderboardDTO;
|
||||
import com.sap.sailing.domain.common.dto.LeaderboardEntryDTO;
|
||||
@@ -72,7 +66,6 @@ import com.sap.sailing.gwt.ui.leaderboard.CompetitorFetcher;
|
||||
import com.sap.sailing.gwt.ui.leaderboard.LeaderboardPanel;
|
||||
import com.sap.sailing.gwt.ui.leaderboard.LeaderboardSettingsFactory;
|
||||
import com.sap.sailing.gwt.ui.leaderboard.SortableColumn;
|
||||
import com.sap.sailing.gwt.ui.shared.ScoreCorrectionProviderDTO;
|
||||
|
||||
/**
|
||||
* An editable version of the {@link LeaderboardPanel} which allows a user to enter carried / accumulated
|
||||
|
||||
+12
-6
@@ -82,9 +82,11 @@ public abstract class FullCanvasOverlay extends CanvasOverlay {
|
||||
|
||||
Context2d context2d = canvas.getContext2d();
|
||||
drawPoint(x, y);
|
||||
context2d.setFillStyle(textColor);
|
||||
context2d.fillText(text, x, y);
|
||||
|
||||
if (getMap().getZoomLevel() >= 11) {
|
||||
context2d.setFillStyle(textColor);
|
||||
context2d.fillText(text, x, y);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -112,10 +114,14 @@ public abstract class FullCanvasOverlay extends CanvasOverlay {
|
||||
protected void drawCircleWithText(double x, double y, double radius, String color, String text) {
|
||||
|
||||
Context2d context2d = canvas.getContext2d();
|
||||
context2d.setGlobalAlpha(0.9f);
|
||||
drawCircle(x, y,radius,color);
|
||||
context2d.setFillStyle(textColor);
|
||||
context2d.setFont("normal 12pt Calibri");
|
||||
context2d.fillText(text, x + 10., y + 4.);
|
||||
context2d.setGlobalAlpha(1.0f);
|
||||
if (getMap().getZoomLevel() >= 11) {
|
||||
context2d.setFillStyle(textColor);
|
||||
context2d.setFont("normal 12pt Calibri");
|
||||
context2d.fillText(text, x + 10., y + 4.);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
+6
@@ -2,6 +2,7 @@ package com.sap.sailing.gwt.ui.simulator;
|
||||
|
||||
import java.util.logging.Logger;
|
||||
|
||||
import com.google.gwt.canvas.dom.client.Context2d;
|
||||
import com.google.gwt.i18n.client.NumberFormat;
|
||||
import com.google.gwt.maps.client.InfoWindowContent;
|
||||
import com.google.gwt.maps.client.MapWidget;
|
||||
@@ -94,6 +95,8 @@ public class RaceCourseCanvasOverlay extends FullCanvasOverlay {
|
||||
}
|
||||
|
||||
private void setStartEndPoint(LatLng startPoint, LatLng endPoint) {
|
||||
int zoomLevel = map.getZoomLevel();
|
||||
racecourseBuoySize = 1.0 + (5.0 - 1.0)*(zoomLevel - 10.0)/(14.0 - 10.0);
|
||||
setStartPoint(startPoint);
|
||||
setEndPoint(endPoint);
|
||||
}
|
||||
@@ -227,8 +230,11 @@ public class RaceCourseCanvasOverlay extends FullCanvasOverlay {
|
||||
if (startPoint != null) {
|
||||
Point s = map.convertLatLngToDivPixel(startPoint);
|
||||
Point e = map.convertLatLngToDivPixel(currentPoint);
|
||||
Context2d context2d = canvas.getContext2d();
|
||||
context2d.setGlobalAlpha(0.4f);
|
||||
drawLine(s.getX() - getWidgetPosLeft(), s.getY() - getWidgetPosTop(), e.getX() - getWidgetPosLeft(),
|
||||
e.getY() - getWidgetPosTop(), 2.0, color);
|
||||
context2d.setGlobalAlpha(1.0f);
|
||||
double distanceInNmi = startPoint.distanceFrom(currentPoint) / Mile.METERS_PER_NAUTICAL_MILE;
|
||||
canvas.setTitle("Distance (nmi) " + NumberFormat.getFormat("0.00").format(distanceInNmi));
|
||||
}
|
||||
|
||||
+11
@@ -9,6 +9,7 @@ public class RegattaArea {
|
||||
LatLng centerPos;
|
||||
LatLng edgePos;
|
||||
String color;
|
||||
String colorText;
|
||||
|
||||
|
||||
public RegattaArea(String name, LatLng centerPos, double radius, String color) {
|
||||
@@ -17,6 +18,16 @@ public class RegattaArea {
|
||||
this.centerPos = centerPos;
|
||||
this.edgePos = this.getEdgePoint(centerPos, radius);
|
||||
this.color = color;
|
||||
this.colorText = color;
|
||||
}
|
||||
|
||||
public RegattaArea(String name, LatLng centerPos, double radius, String color, String colorText) {
|
||||
this.name = name;
|
||||
this.radius = radius;
|
||||
this.centerPos = centerPos;
|
||||
this.edgePos = this.getEdgePoint(centerPos, radius);
|
||||
this.color = color;
|
||||
this.colorText = colorText;
|
||||
}
|
||||
|
||||
protected LatLng getEdgePoint(LatLng pos, double dist) {
|
||||
|
||||
+53
-150
@@ -3,6 +3,7 @@ package com.sap.sailing.gwt.ui.simulator;
|
||||
import java.util.ArrayList;
|
||||
|
||||
import com.google.gwt.canvas.dom.client.Context2d;
|
||||
import com.google.gwt.canvas.dom.client.Context2d.TextAlign;
|
||||
import com.google.gwt.maps.client.MapWidget;
|
||||
import com.google.gwt.maps.client.event.MapMoveEndHandler;
|
||||
import com.google.gwt.maps.client.event.PolygonClickHandler;
|
||||
@@ -15,44 +16,31 @@ import com.sap.sailing.gwt.ui.shared.racemap.FullCanvasOverlay;
|
||||
|
||||
public class RegattaAreaCanvasOverlay extends FullCanvasOverlay {
|
||||
|
||||
SimulatorMap simulatorMap;
|
||||
public RaceCourseCanvasOverlay raceCourseCanvasOverlay;
|
||||
ArrayList<RegattaArea> regAreas;
|
||||
boolean pan;
|
||||
RegattaArea currentRegArea = null;
|
||||
double raceBearing = 0.0;
|
||||
double diffBearing = 0.0;
|
||||
|
||||
public RegattaAreaCanvasOverlay(SimulatorMap simMap) {
|
||||
private SimulatorMap simulatorMap;
|
||||
private RaceCourseCanvasOverlay raceCourseCanvasOverlay;
|
||||
private ArrayList<RegattaArea> regAreas;
|
||||
private boolean pan;
|
||||
private RegattaArea currentRegArea = null;
|
||||
private double raceBearing = 0.0;
|
||||
private double diffBearing = 0.0;
|
||||
|
||||
public RegattaAreaCanvasOverlay(SimulatorMap simulatorMap) {
|
||||
super();
|
||||
|
||||
simulatorMap = simMap;
|
||||
//System.out.println("Maps version: "+Maps.getVersion());
|
||||
|
||||
/*this.canvas.addMouseUpHandler(new MouseUpHandler() {
|
||||
public void onMouseUp(MouseUpEvent event) {
|
||||
int mousex = event.getRelativeX(canvas.getElement());
|
||||
int mousey = event.getRelativeY(canvas.getElement());
|
||||
System.out.println("Mouse x:"+mousex+" y:"+mousey);
|
||||
}
|
||||
});*/
|
||||
|
||||
this.simulatorMap = simulatorMap;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
protected Overlay copy() {
|
||||
// TODO Auto-generated method stub
|
||||
return null;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
protected void initialize(final MapWidget map) {
|
||||
super.initialize(map);
|
||||
|
||||
//drawRegattaAreas();
|
||||
setVisible(true);
|
||||
|
||||
LatLng cPos;
|
||||
regAreas = new ArrayList<RegattaArea>();
|
||||
|
||||
@@ -64,11 +52,11 @@ public class RegattaAreaCanvasOverlay extends FullCanvasOverlay {
|
||||
|
||||
// Golf
|
||||
cPos = LatLng.newInstance(54.41985556,10.19454167);
|
||||
regAreas.add(new RegattaArea("Golf", cPos, 0.35, "#F1F3EF"));
|
||||
regAreas.add(new RegattaArea("Golf", cPos, 0.35, "#F1F3EF","silver"));
|
||||
|
||||
// Foxtrott
|
||||
// Foxtrot
|
||||
cPos = LatLng.newInstance(54.445775,10.29223889);
|
||||
regAreas.add(new RegattaArea("Foxtrott", cPos, 0.65, "#B4287C"));
|
||||
regAreas.add(new RegattaArea("Foxtrot", cPos, 0.65, "#B4287C"));
|
||||
|
||||
// India
|
||||
cPos = LatLng.newInstance(54.44803611,10.20863611);
|
||||
@@ -82,9 +70,9 @@ public class RegattaAreaCanvasOverlay extends FullCanvasOverlay {
|
||||
cPos = LatLng.newInstance(54.47640278,10.20090556);
|
||||
regAreas.add(new RegattaArea("Echo", cPos, 0.60, "#1CADD9"));
|
||||
|
||||
// Klio
|
||||
// Kilo
|
||||
cPos = LatLng.newInstance(54.47808889,10.24033889);
|
||||
regAreas.add(new RegattaArea("Klio", cPos, 0.55, "#9FC269"));
|
||||
regAreas.add(new RegattaArea("Kilo", cPos, 0.55, "#9FC269"));
|
||||
|
||||
// Charlie
|
||||
cPos = LatLng.newInstance(54.49327222,10.17525833);
|
||||
@@ -102,6 +90,8 @@ public class RegattaAreaCanvasOverlay extends FullCanvasOverlay {
|
||||
cPos = LatLng.newInstance(54.52905,10.18515278);
|
||||
regAreas.add(new RegattaArea("Alfa", cPos, 1.00, "#D9699B"));
|
||||
|
||||
setVisible(true);
|
||||
|
||||
int regIdx = 0;
|
||||
for(RegattaArea regArea : regAreas) {
|
||||
this.drawCircleFromRadius(regIdx, regArea, 10);
|
||||
@@ -137,110 +127,27 @@ public class RegattaAreaCanvasOverlay extends FullCanvasOverlay {
|
||||
|
||||
clear();
|
||||
|
||||
//Circle circle = new Circle();
|
||||
//getMap().addOverlay(circle);
|
||||
|
||||
|
||||
/*if (windDTOList != null && windDTOList.size() > 1) {
|
||||
if (windDTOList.size() != xRes * yRes) {
|
||||
logger.warning("Error in WindGridCanvasOverlay wind field is not rectangular.");
|
||||
return;
|
||||
}
|
||||
// createPositionGrid(windDTOList);
|
||||
// createGridCell();
|
||||
updatePositionGrid(windDTOList);
|
||||
drawGridCell();
|
||||
|
||||
final String title = "Wind Grid at " + windDTOList.size() + " points.";
|
||||
getCanvas().setTitle(title);
|
||||
}*/
|
||||
|
||||
//LatLng positionLatLng = LatLng.newInstance(54.425022,10.183382);
|
||||
//final Point blPoint = getMap().convertLatLngToDivPixel(positionLatLng);
|
||||
|
||||
//Position posCenter = new DegreePosition(54.425022,10.183382);
|
||||
//Position posBorder = posCenter.translateGreatCircle(new DegreeBearingImpl(90.0), new MeterDistance(100.0));
|
||||
|
||||
//Gold
|
||||
//54.43439444 10.19659167
|
||||
//54.43428611 10.21073333
|
||||
|
||||
/*LatLng tvPos1 = LatLng.newInstance(54.4344,10.19659167);
|
||||
LatLng tvPos2 = LatLng.newInstance(54.43443056,10.21093611);
|
||||
|
||||
LatLng golfPos1 = LatLng.newInstance(54.41985556,10.19454167);
|
||||
LatLng golfPos2 = LatLng.newInstance(54.41984167,10.20470556);
|
||||
|
||||
LatLng foxPos1 = LatLng.newInstance(54.445775,10.29223889);
|
||||
LatLng foxPos2 = LatLng.newInstance(54.44591667,10.30548333);*/
|
||||
|
||||
LatLng cPos = LatLng.newInstance(54.4344,10.19659167);
|
||||
Point centerPoint = getMap().convertLatLngToDivPixel(cPos);
|
||||
Point borderPoint = getMap().convertLatLngToDivPixel(this.getEdgePoint(cPos, 0.015));
|
||||
Point diffPoint = Point.newInstance(centerPoint.getX()-borderPoint.getX(), centerPoint.getY()-borderPoint.getY());
|
||||
double pxStroke = Math.sqrt(diffPoint.getX()*diffPoint.getX() + diffPoint.getY()*diffPoint.getY());
|
||||
|
||||
//LatLng cPos = null;
|
||||
|
||||
double pxStroke = Math.pow(2.0, (getMap().getZoomLevel()-10.0)/2.0);
|
||||
|
||||
final Context2d context2d = canvas.getContext2d();
|
||||
context2d.setLineWidth(3);
|
||||
context2d.setStrokeStyle("Black");
|
||||
|
||||
//String[] colors = {"#EAB75A","#F1F3EF","#B4287C","#774741","#818585","#1CADD9","#9FC269","#0A5998","#179E8B","#CE3032","#D9699B"};
|
||||
|
||||
//LatLng positionLatLng = LatLng.newInstance(lat1/Math.PI*180,lon1/Math.PI*180);
|
||||
//Point centerPoint = getMap().convertLatLngToDivPixel(positionLatLng);
|
||||
|
||||
//positionLatLng = LatLng.newInstance(lat2/Math.PI*180,lon2/Math.PI*180);
|
||||
//Point borderPoint = getMap().convertLatLngToDivPixel(positionLatLng);
|
||||
|
||||
|
||||
/*positionLatLng = LatLng.newInstance(54.422925,10.192738);
|
||||
final Point tlPoint = getMap().convertLatLngToDivPixel(positionLatLng);
|
||||
|
||||
positionLatLng = LatLng.newInstance(54.420228,10.184755);
|
||||
final Point trPoint = getMap().convertLatLngToDivPixel(positionLatLng);*/
|
||||
|
||||
/*
|
||||
* Uncomment to see the center of the grid for debug drawCircle(blPoint.getX()-this.getWidgetPosLeft(),
|
||||
* blPoint.getY()-this.getWidgetPosTop(),2,"red"); drawCircle(brPoint.getX()-this.getWidgetPosLeft(),
|
||||
* brPoint.getY()-this.getWidgetPosTop(),2,"red"); drawCircle(tlPoint.getX()-this.getWidgetPosLeft(),
|
||||
* tlPoint.getY()-this.getWidgetPosTop(),2,"red"); drawCircle(trPoint.getX()-this.getWidgetPosLeft(),
|
||||
* trPoint.getY()-this.getWidgetPosTop(),2,"red");
|
||||
*/
|
||||
|
||||
for(RegattaArea regArea : regAreas) {
|
||||
//System.out.println("regArea"+regArea);
|
||||
centerPoint = getMap().convertLatLngToDivPixel(regArea.centerPos);
|
||||
borderPoint = getMap().convertLatLngToDivPixel(regArea.edgePos);
|
||||
drawRegattaAreaBackground(context2d, centerPoint, borderPoint, regArea.color, pxStroke);
|
||||
}
|
||||
|
||||
for(RegattaArea regArea : regAreas) {
|
||||
//System.out.println("regArea"+regArea);
|
||||
centerPoint = getMap().convertLatLngToDivPixel(regArea.centerPos);
|
||||
borderPoint = getMap().convertLatLngToDivPixel(regArea.edgePos);
|
||||
drawRegattaArea(regArea.name, context2d, centerPoint, borderPoint, regArea.color, pxStroke);
|
||||
drawRegattaArea(regArea.name, context2d, centerPoint, borderPoint, regArea.color, regArea.colorText, pxStroke);
|
||||
}
|
||||
|
||||
/*centerPoint = getMap().convertLatLngToDivPixel(golfPos1);
|
||||
borderPoint = getMap().convertLatLngToDivPixel(golfPos2);
|
||||
drawRegattaArea(context2d, centerPoint, borderPoint);
|
||||
|
||||
centerPoint = getMap().convertLatLngToDivPixel(foxPos1);
|
||||
borderPoint = getMap().convertLatLngToDivPixel(foxPos2);
|
||||
drawRegattaArea(context2d, centerPoint, borderPoint);*/
|
||||
|
||||
/*context2d.beginPath();
|
||||
context2d.moveTo(blPoint.getX() - this.getWidgetPosLeft(), blPoint.getY() - this.getWidgetPosTop());
|
||||
context2d.lineTo(brPoint.getX() - this.getWidgetPosLeft(), brPoint.getY() - this.getWidgetPosTop());
|
||||
context2d.lineTo(trPoint.getX() - this.getWidgetPosLeft(), trPoint.getY() - this.getWidgetPosTop());
|
||||
context2d.lineTo(tlPoint.getX() - this.getWidgetPosLeft(), tlPoint.getY() - this.getWidgetPosTop());
|
||||
context2d.lineTo(blPoint.getX() - this.getWidgetPosLeft(), blPoint.getY() - this.getWidgetPosTop());
|
||||
context2d.closePath();*/
|
||||
|
||||
// context2d.stroke(); // Dont show the lines
|
||||
|
||||
}
|
||||
|
||||
public void drawCircleFromRadius(int regIdx, RegattaArea regArea, int nbOfPoints) {
|
||||
@@ -265,43 +172,34 @@ public class RegattaAreaCanvasOverlay extends FullCanvasOverlay {
|
||||
a += step;
|
||||
}
|
||||
|
||||
// transparent circles to make regatta areas clickable
|
||||
// transparent circle-like polygons to make regatta areas clickable
|
||||
Polygon circle = new Polygon(circlePoints, "white", 1, 0.0, "green", 0.0);
|
||||
|
||||
final int regIdxFinal = regIdx;
|
||||
|
||||
/*circle.addPolygonMouseOverHandler( new PolygonMouseOverHandler() {
|
||||
7public void onMouseOver(PolygonMouseOverEvent e) {
|
||||
public void onMouseOver(PolygonMouseOverEvent e) {
|
||||
System.out.println("MouseOver: "+name);
|
||||
}
|
||||
});*/
|
||||
|
||||
circle.addPolygonClickHandler( new PolygonClickHandler() {
|
||||
public void onClick(PolygonClickEvent e) {
|
||||
//System.out.println("Click: "+currentRegArea.name);
|
||||
RegattaArea newRegArea = regAreas.get(regIdxFinal);
|
||||
|
||||
if (newRegArea != currentRegArea) {
|
||||
currentRegArea = newRegArea;
|
||||
//System.out.println("Click: "+currentRegArea.name);
|
||||
simulatorMap.clearOverlays();
|
||||
//MapWidget map = getMap();
|
||||
//map.setContinuousZoom(true);
|
||||
//map.setZoomLevel(14);
|
||||
//map.zoomIn();
|
||||
//map.panTo(regArea.centerPos);
|
||||
//map.setCenter(map.getCenter(), 14);
|
||||
|
||||
updateRaceCourse(0,0);
|
||||
raceCourseCanvasOverlay.redraw(true);
|
||||
//removeOverlays();
|
||||
// pathCanvasOverlays.clear();
|
||||
//replayPathCanvasOverlays.clear();
|
||||
//colorPalette.reset();
|
||||
simulatorMap.clearOverlays();
|
||||
updateRaceCourse(0,0);
|
||||
raceCourseCanvasOverlay.redraw(true);
|
||||
}
|
||||
|
||||
pan = true;
|
||||
map.panTo(currentRegArea.centerPos);
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
getMap().addOverlay(circle);
|
||||
getMap().addMapMoveEndHandler( new MapMoveEndHandler() {
|
||||
public void onMoveEnd(MapMoveEndEvent event) {
|
||||
@@ -314,11 +212,8 @@ public class RegattaAreaCanvasOverlay extends FullCanvasOverlay {
|
||||
}
|
||||
}
|
||||
|
||||
//synchronized(map) {
|
||||
// map.notify();
|
||||
//}
|
||||
};
|
||||
});
|
||||
});
|
||||
circle.setVisible(true);
|
||||
}
|
||||
|
||||
@@ -329,15 +224,17 @@ public class RegattaAreaCanvasOverlay extends FullCanvasOverlay {
|
||||
diffBearing = bearing;
|
||||
}
|
||||
if (currentRegArea != null) {
|
||||
//simulatorMap.getMainPanel().setUpdateButtonEnabled(true);
|
||||
raceCourseCanvasOverlay.startPoint = getDistantPoint(currentRegArea.centerPos, 0.9*currentRegArea.radius, 180.0 + raceBearing - diffBearing);
|
||||
raceCourseCanvasOverlay.endPoint = getDistantPoint(currentRegArea.centerPos, 0.9*currentRegArea.radius, 0.0 + raceBearing - diffBearing);
|
||||
} else {
|
||||
//simulatorMap.getMainPanel().setUpdateButtonEnabled(false);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
protected void drawRegattaAreaBackground(Context2d context2d, Point centerPoint, Point borderPoint, String color, double pxStroke) {
|
||||
|
||||
//context2d.setFillStyle("#a6c2dd");
|
||||
Point diffPoint = Point.newInstance(centerPoint.getX()-borderPoint.getX(), centerPoint.getY()-borderPoint.getY());
|
||||
double pxRadius = Math.sqrt(diffPoint.getX()*diffPoint.getX() + diffPoint.getY()*diffPoint.getY());
|
||||
|
||||
@@ -351,21 +248,12 @@ public class RegattaAreaCanvasOverlay extends FullCanvasOverlay {
|
||||
}
|
||||
|
||||
|
||||
protected void drawRegattaArea(String name, Context2d context2d, Point centerPoint, Point borderPoint, String color, double pxStroke) {
|
||||
protected void drawRegattaArea(String name, Context2d context2d, Point centerPoint, Point borderPoint, String color, String colorText, double pxStroke) {
|
||||
|
||||
//context2d.setFillStyle("#a6c2dd");
|
||||
Point diffPoint = Point.newInstance(centerPoint.getX()-borderPoint.getX(), centerPoint.getY()-borderPoint.getY());
|
||||
double pxRadius = Math.sqrt(diffPoint.getX()*diffPoint.getX() + diffPoint.getY()*diffPoint.getY());
|
||||
|
||||
/*context2d.setGlobalAlpha(1.0f);
|
||||
context2d.setFillStyle("#a6bfde"); // Google Blue
|
||||
context2d.beginPath();
|
||||
context2d.arc(centerPoint.getX() - this.getWidgetPosLeft(), centerPoint.getY() - this.getWidgetPosTop(), pxRadius*1.2, 0.0, 2*Math.PI);
|
||||
context2d.closePath();
|
||||
context2d.fill();*/
|
||||
|
||||
context2d.setGlobalAlpha(1.0f);
|
||||
//context2d.setFillStyle("#a6bfde"); // Google Blue
|
||||
context2d.setFillStyle("#DEDEDE");
|
||||
context2d.setLineWidth(pxStroke);
|
||||
context2d.setStrokeStyle(color);
|
||||
@@ -378,12 +266,23 @@ public class RegattaAreaCanvasOverlay extends FullCanvasOverlay {
|
||||
context2d.setGlobalAlpha(0.4f);
|
||||
context2d.setFillStyle(color);
|
||||
context2d.beginPath();
|
||||
//diffPoint = Point.newInstance(centerPoint.getX()-borderPoint.getX(), centerPoint.getY()-borderPoint.getY());
|
||||
//pxRadius = Math.sqrt(diffPoint.getX()*diffPoint.getX() + diffPoint.getY()*diffPoint.getY());
|
||||
context2d.arc(centerPoint.getX() - this.getWidgetPosLeft(), centerPoint.getY() - this.getWidgetPosTop(), pxRadius, 0.0, 2*Math.PI);
|
||||
context2d.closePath();
|
||||
context2d.fill();
|
||||
|
||||
if (getMap().getZoomLevel() >= 11) {
|
||||
context2d.setGlobalAlpha(0.8f);
|
||||
context2d.setFillStyle(colorText);
|
||||
|
||||
double fontsize = 14.0 + (32.0-14.0)*(getMap().getZoomLevel() - 11.0)/(14.0-11.0);
|
||||
context2d.setFont("bold "+fontsize+"px Calibri");
|
||||
//TextMetrics txtmet = context2d.measureText(name);
|
||||
context2d.setTextAlign(TextAlign.CENTER);
|
||||
context2d.fillText(name, centerPoint.getX() - this.getWidgetPosLeft(), centerPoint.getY()+0.32*fontsize - this.getWidgetPosTop());
|
||||
|
||||
context2d.setGlobalAlpha(1.0f);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
protected LatLng getEdgePoint(LatLng pos, double dist) {
|
||||
@@ -411,4 +310,8 @@ public class RegattaAreaCanvasOverlay extends FullCanvasOverlay {
|
||||
return result;
|
||||
}
|
||||
|
||||
public void setRaceCourseCanvas(RaceCourseCanvasOverlay rcCanvas) {
|
||||
this.raceCourseCanvasOverlay = rcCanvas;
|
||||
}
|
||||
|
||||
}
|
||||
+8
-1
@@ -806,7 +806,10 @@ public class SimulatorMainPanel extends SimplePanel {
|
||||
|
||||
private void initUpdateButton() {
|
||||
|
||||
this.updateButton = new Button(stringMessages.update());
|
||||
this.updateButton = new Button(stringMessages.simulateButton());
|
||||
if (mode == SailingSimulatorUtil.event) {
|
||||
this.updateButton.setEnabled(true);
|
||||
}
|
||||
this.updateButton.addClickHandler(new ClickHandler() {
|
||||
@Override
|
||||
public void onClick(ClickEvent arg0) {
|
||||
@@ -815,6 +818,10 @@ public class SimulatorMainPanel extends SimplePanel {
|
||||
});
|
||||
}
|
||||
|
||||
public void setUpdateButtonEnabled(boolean enabled) {
|
||||
this.updateButton.setEnabled(enabled);
|
||||
}
|
||||
|
||||
private void update() {
|
||||
|
||||
// int selectedBoatClassIndex = boatClassSelector.getSelectedIndex();
|
||||
|
||||
+5
-1
@@ -357,7 +357,7 @@ public class SimulatorMap extends AbsolutePanel implements RequiresDataInitializ
|
||||
this.raceCourseCanvasOverlay.getCanvas().getElement().setClassName("raceCourse");
|
||||
|
||||
if (this.mode == SailingSimulatorUtil.event) {
|
||||
this.regattaAreaCanvasOverlay.raceCourseCanvasOverlay = this.raceCourseCanvasOverlay;
|
||||
this.regattaAreaCanvasOverlay.setRaceCourseCanvas(this.raceCourseCanvasOverlay);
|
||||
this.regattaAreaCanvasOverlay.updateRaceCourse(0, 0);
|
||||
}
|
||||
|
||||
@@ -776,4 +776,8 @@ public class SimulatorMap extends AbsolutePanel implements RequiresDataInitializ
|
||||
return this.mapw;
|
||||
}
|
||||
|
||||
public SimulatorMainPanel getMainPanel() {
|
||||
return this.parent;
|
||||
}
|
||||
|
||||
}
|
||||
+2
-1
@@ -97,7 +97,8 @@ public class ParserTest {
|
||||
Calendar cal = new GregorianCalendar(2013, /* 3 means April; zero-based */ 3, 3, 11, 20, 23);
|
||||
cal.setTimeZone(TimeZone.getTimeZone("UTC"));
|
||||
TimePoint expectedTimePoint = new MillisecondsTimePoint(cal.getTime());
|
||||
assertEquals(expectedTimePoint, hasResultsFor.get("Star Men").iterator().next().getB());
|
||||
TimePoint xrrTimePoint = hasResultsFor.get("Star Men").iterator().next().getB();
|
||||
assertEquals(expectedTimePoint, xrrTimePoint);
|
||||
assertTrue(hasResultsFor.containsKey("Laser Men"));
|
||||
}
|
||||
|
||||
|
||||
+2
-6
@@ -1,7 +1,5 @@
|
||||
package com.sap.sailing.xrr.resultimport.impl;
|
||||
|
||||
import java.util.TimeZone;
|
||||
|
||||
import javax.xml.datatype.DatatypeConstants;
|
||||
import javax.xml.datatype.XMLGregorianCalendar;
|
||||
|
||||
@@ -25,10 +23,8 @@ public class XRRParserUtil {
|
||||
if(time.getTimezone() != DatatypeConstants.FIELD_UNDEFINED) {
|
||||
date.setTimezone(time.getTimezone());
|
||||
} else {
|
||||
// fallback is to take the timezone of the server
|
||||
TimeZone serverTimezone = TimeZone.getDefault();
|
||||
int timeZoneOffsetInMinutes = (serverTimezone.getOffset(date.getMillisecond()) + serverTimezone.getDSTSavings()) / 60000;
|
||||
date.setTimezone(timeZoneOffsetInMinutes);
|
||||
// fallback is to take the UTC
|
||||
date.setTimezone(0);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
+2
-4
@@ -11,8 +11,6 @@ SERVER_PORT=8888
|
||||
MONGODB_PORT=27017
|
||||
EXPEDITION_PORT=2010
|
||||
|
||||
if [[ "$JAVA_HOME" == "" ]]; then
|
||||
JAVA_HOME=$HOME/jdk1.7.0_02
|
||||
echo "Setting JAVA_HOME to $JAVA_HOME"
|
||||
fi
|
||||
JAVA_HOME=$HOME/jdk1.7.0_02
|
||||
echo "Setting JAVA_HOME to $JAVA_HOME"
|
||||
|
||||
+25
-12
@@ -1,17 +1,19 @@
|
||||
package com.sap.sailing.racecommittee.app.coursedesigner;
|
||||
|
||||
import com.google.android.gms.maps.model.LatLng;
|
||||
import com.sap.sailing.domain.common.coursedesign.BoatClassType;
|
||||
import com.sap.sailing.domain.common.coursedesign.CourseLayout;
|
||||
import com.sap.sailing.domain.common.coursedesign.NumberOfRounds;
|
||||
import com.sap.sailing.domain.common.coursedesign.TargetTime;
|
||||
import com.sap.sailing.domain.common.impl.DegreePosition;
|
||||
import com.sap.sailing.domain.coursedesign.BoatClassType;
|
||||
import com.sap.sailing.domain.coursedesign.CourseDesign;
|
||||
import com.sap.sailing.domain.coursedesign.CourseLayouts;
|
||||
import com.sap.sailing.domain.coursedesign.NumberOfRounds;
|
||||
import com.sap.sailing.domain.coursedesign.TargetTime;
|
||||
|
||||
public class CourseDesignComputer {
|
||||
private LatLng startBoatPosition;
|
||||
private Double windSpeed;
|
||||
private Integer windDirection;
|
||||
private BoatClassType boatClass;
|
||||
private CourseLayout courseLayout;
|
||||
private CourseLayouts courseLayout;
|
||||
private NumberOfRounds numberOfRounds;
|
||||
private TargetTime targetTime;
|
||||
|
||||
@@ -51,11 +53,11 @@ public class CourseDesignComputer {
|
||||
return this;
|
||||
}
|
||||
|
||||
public CourseLayout getCourseLayout() {
|
||||
public CourseLayouts getCourseLayout() {
|
||||
return courseLayout;
|
||||
}
|
||||
|
||||
public CourseDesignComputer setCourseLayout(CourseLayout courseLayout) {
|
||||
public CourseDesignComputer setCourseLayout(CourseLayouts courseLayout) {
|
||||
this.courseLayout = courseLayout;
|
||||
return this;
|
||||
}
|
||||
@@ -78,10 +80,21 @@ public class CourseDesignComputer {
|
||||
return this;
|
||||
}
|
||||
|
||||
public CourseDesignComputer compute() {
|
||||
if(startBoatPosition != null && windSpeed != null && windDirection != null && boatClass != null && courseLayout != null && numberOfRounds != null && targetTime != null)
|
||||
return null;
|
||||
else
|
||||
public CourseDesign compute() {
|
||||
CourseDesign computedCourseDesign = null;
|
||||
if (startBoatPosition != null && windSpeed != null && windDirection != null && boatClass != null
|
||||
&& courseLayout != null && numberOfRounds != null && targetTime != null) {
|
||||
try {
|
||||
computedCourseDesign = courseLayout.getCourseDesignFactoryClass().newInstance()
|
||||
.createCourseDesign(new DegreePosition(startBoatPosition.latitude, startBoatPosition.longitude), windSpeed, windDirection, boatClass, courseLayout, numberOfRounds, targetTime);
|
||||
} catch (InstantiationException e) {
|
||||
|
||||
e.printStackTrace();
|
||||
} catch (IllegalAccessException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
} else
|
||||
throw new IllegalStateException("At least one mandatory parameter was not set in the computer!");
|
||||
}
|
||||
return computedCourseDesign;
|
||||
}
|
||||
}
|
||||
+37
-27
@@ -25,12 +25,13 @@ import com.google.android.gms.maps.GoogleMap;
|
||||
import com.google.android.gms.maps.MapView;
|
||||
import com.google.android.gms.maps.MapsInitializer;
|
||||
import com.google.android.gms.maps.model.BitmapDescriptorFactory;
|
||||
import com.google.android.gms.maps.model.LatLng;
|
||||
import com.google.android.gms.maps.model.MarkerOptions;
|
||||
import com.sap.sailing.domain.common.coursedesign.BoatClassType;
|
||||
import com.sap.sailing.domain.common.coursedesign.CourseDesign;
|
||||
import com.sap.sailing.domain.common.coursedesign.CourseLayout;
|
||||
import com.sap.sailing.domain.common.coursedesign.NumberOfRounds;
|
||||
import com.sap.sailing.domain.common.coursedesign.TargetTime;
|
||||
import com.sap.sailing.domain.coursedesign.BoatClassType;
|
||||
import com.sap.sailing.domain.coursedesign.CourseDesign;
|
||||
import com.sap.sailing.domain.coursedesign.CourseLayouts;
|
||||
import com.sap.sailing.domain.coursedesign.NumberOfRounds;
|
||||
import com.sap.sailing.domain.coursedesign.TargetTime;
|
||||
import com.sap.sailing.domain.tracking.Wind;
|
||||
import com.sap.sailing.racecommittee.app.AppConstants;
|
||||
import com.sap.sailing.racecommittee.app.R;
|
||||
@@ -58,11 +59,11 @@ public class ClassicCourseDesignDialogFragment extends RaceDialogFragment {
|
||||
|
||||
private CourseDesignComputer courseDesignComputer;
|
||||
|
||||
private ArrayAdapter<CourseLayout> courseLayoutAdapter;
|
||||
private ArrayAdapter<CourseLayouts> courseLayoutAdapter;
|
||||
|
||||
// TODO determine this by given race
|
||||
private BoatClassType selectedBoatClass = BoatClassType.boatClass470er;
|
||||
private CourseLayout selectedCourseLayout = (CourseLayout) BoatClassType.boatClass470er
|
||||
private BoatClassType selectedBoatClass = BoatClassType.boatClass470erMen;
|
||||
private CourseLayouts selectedCourseLayout = (CourseLayouts) BoatClassType.boatClass470erMen
|
||||
.getPossibleCourseLayoutsWithTargetTime().keySet().toArray().clone()[0];
|
||||
private NumberOfRounds selectedNumberOfRounds = NumberOfRounds.TWO;
|
||||
private TargetTime selectedTargetTime = TargetTime.thirty;
|
||||
@@ -124,10 +125,10 @@ public class ClassicCourseDesignDialogFragment extends RaceDialogFragment {
|
||||
setupTargetTimeSpinner();
|
||||
|
||||
DataStore ds = InMemoryDataStore.INSTANCE;
|
||||
courseDesignComputer= new CourseDesignComputer().setStartBoatPosition(ds.getLastWindPosition()).setWindDirection(ds.getLastWindDirection())
|
||||
.setWindSpeed(ds.getLastWindSpeed()).setBoatClass(selectedBoatClass)
|
||||
.setCourseLayout(selectedCourseLayout).setNumberOfRounds(selectedNumberOfRounds)
|
||||
.setTargetTime(selectedTargetTime);
|
||||
courseDesignComputer = new CourseDesignComputer().setStartBoatPosition(ds.getLastWindPosition())
|
||||
.setWindDirection(ds.getLastWindDirection()).setWindSpeed(ds.getLastWindSpeed())
|
||||
.setBoatClass(selectedBoatClass).setCourseLayout(selectedCourseLayout)
|
||||
.setNumberOfRounds(selectedNumberOfRounds).setTargetTime(selectedTargetTime);
|
||||
setUpMapIfNeeded(getView());
|
||||
}
|
||||
|
||||
@@ -140,6 +141,9 @@ public class ClassicCourseDesignDialogFragment extends RaceDialogFragment {
|
||||
Wind windFix = (Wind) data.getSerializableExtra(AppConstants.EXTRAS_WIND_FIX);
|
||||
onWindEntered(windFix);
|
||||
}
|
||||
DataStore ds = InMemoryDataStore.INSTANCE;
|
||||
courseDesignComputer = courseDesignComputer.setStartBoatPosition(ds.getLastWindPosition())
|
||||
.setWindDirection(ds.getLastWindDirection()).setWindSpeed(ds.getLastWindSpeed());
|
||||
recomputeCourseDesign();
|
||||
}
|
||||
}
|
||||
@@ -151,19 +155,18 @@ public class ClassicCourseDesignDialogFragment extends RaceDialogFragment {
|
||||
}
|
||||
|
||||
private CourseDesign recomputeCourseDesign() {
|
||||
try{
|
||||
courseDesignComputer.compute();
|
||||
}catch (IllegalStateException ise){
|
||||
Toast.makeText(
|
||||
getActivity(),
|
||||
ise.getMessage(), Toast.LENGTH_LONG).show();
|
||||
CourseDesign courseDesign = null;
|
||||
try {
|
||||
courseDesign = courseDesignComputer.compute();
|
||||
} catch (IllegalStateException ise) {
|
||||
Toast.makeText(getActivity(), ise.getMessage(), Toast.LENGTH_LONG).show();
|
||||
}
|
||||
DataStore ds = InMemoryDataStore.INSTANCE;
|
||||
Toast.makeText(
|
||||
getActivity(),
|
||||
"" + ds.getLastWindPosition() + ds.getLastWindDirection() + ds.getLastWindSpeed() + selectedBoatClass
|
||||
+ selectedCourseLayout + selectedNumberOfRounds + selectedTargetTime, Toast.LENGTH_LONG).show();
|
||||
return null;
|
||||
/*
|
||||
* DataStore ds = InMemoryDataStore.INSTANCE; Toast.makeText( getActivity(), "" + ds.getLastWindPosition() +
|
||||
* ds.getLastWindDirection() + ds.getLastWindSpeed() + selectedBoatClass + selectedCourseLayout +
|
||||
* selectedNumberOfRounds + selectedTargetTime, Toast.LENGTH_LONG).show()
|
||||
*/;
|
||||
return courseDesign;
|
||||
|
||||
}
|
||||
|
||||
@@ -192,14 +195,14 @@ public class ClassicCourseDesignDialogFragment extends RaceDialogFragment {
|
||||
}
|
||||
|
||||
private void setupCourseLayoutSpinner() {
|
||||
courseLayoutAdapter = new ArrayAdapter<CourseLayout>(getActivity(),
|
||||
courseLayoutAdapter = new ArrayAdapter<CourseLayouts>(getActivity(),
|
||||
android.R.layout.simple_spinner_dropdown_item);
|
||||
courseLayoutAdapter.addAll(selectedBoatClass.getPossibleCourseLayoutsWithTargetTime().keySet());
|
||||
spinnerCourseLayout.setAdapter(courseLayoutAdapter);
|
||||
spinnerCourseLayout.setOnItemSelectedListener(new OnItemSelectedListener() {
|
||||
@Override
|
||||
public void onItemSelected(AdapterView<?> adapterView, View view, int position, long id) {
|
||||
selectedCourseLayout = (CourseLayout) adapterView.getItemAtPosition(position);
|
||||
selectedCourseLayout = (CourseLayouts) adapterView.getItemAtPosition(position);
|
||||
recomputeCourseDesign();
|
||||
}
|
||||
|
||||
@@ -296,7 +299,14 @@ public class ClassicCourseDesignDialogFragment extends RaceDialogFragment {
|
||||
.title(ds.getLastWindPosition() + ", " + ds.getLastWindSpeed() + "kn, " + ds.getLastWindDirection()
|
||||
+ "°"));
|
||||
}
|
||||
recomputeCourseDesign();
|
||||
CourseDesign courseDesign = recomputeCourseDesign();
|
||||
if (courseDesign != null) {
|
||||
LatLng pinEndPosition = new LatLng(courseDesign.getPinEnd().getPosition().getLatDeg(), courseDesign
|
||||
.getPinEnd().getPosition().getLngDeg());
|
||||
courseAreaMap.addMarker(new MarkerOptions().position(pinEndPosition)
|
||||
.icon(BitmapDescriptorFactory.fromResource(R.drawable.buoy_red)).draggable(false)
|
||||
.title(courseDesign.getPinEnd().getName()));
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user