mirror of
https://github.com/eclipse-sailing-analytics/sailing-analytics.git
synced 2026-10-25 21:43:49 +00:00
Merge branch 'master' into tw2015
This commit is contained in:
commit
e1294bb048
10 files changed
+44
-23
No files matched your search
Binary file not shown.
+2
-2
@@ -1493,7 +1493,7 @@ public class SailingServiceImpl extends ProxiedRemoteServiceServlet implements S
|
||||
rcDTO.coursePositions.waypointPositions = new ArrayList<Position>();
|
||||
rcDTO.coursePositions.waypointPositions.add(simulationResults.getStartPosition());
|
||||
rcDTO.coursePositions.waypointPositions.add(simulationResults.getEndPosition());
|
||||
result = new SimulatorResultsDTO(simulationResults.hashCode(), simulationResults.getStartTime(), simulationResults.getTimeStep(),
|
||||
result = new SimulatorResultsDTO(simulationResults.getVersion().asMillis(), legIdentifier.getLegNumber()+1, simulationResults.getStartTime(), simulationResults.getTimeStep(),
|
||||
simulationResults.getLegDuration(), rcDTO, pathDTOs, null, null);
|
||||
}
|
||||
return result;
|
||||
@@ -1577,7 +1577,7 @@ public class SailingServiceImpl extends ProxiedRemoteServiceServlet implements S
|
||||
final CoursePositionsDTO coursePositions = getCoursePositions(raceIdentifier, date);
|
||||
final List<SidelineDTO> courseSidelines = getCourseSidelines(raceIdentifier, date);
|
||||
final QuickRanksDTO quickRanks = getQuickRanks(raceIdentifier, date);
|
||||
int simulationResultVersion = 0;
|
||||
long simulationResultVersion = 0;
|
||||
if (simulationLegIdentifier != null) {
|
||||
SimulationService simulationService = getService().getSimulationService();
|
||||
simulationResultVersion = simulationService.getSimulationResultsVersion(simulationLegIdentifier);
|
||||
|
||||
+3
-3
@@ -63,8 +63,8 @@ import com.sap.sailing.simulator.Grid;
|
||||
import com.sap.sailing.simulator.Path;
|
||||
import com.sap.sailing.simulator.PathType;
|
||||
import com.sap.sailing.simulator.PolarDiagram;
|
||||
import com.sap.sailing.simulator.Simulator;
|
||||
import com.sap.sailing.simulator.SimulationParameters;
|
||||
import com.sap.sailing.simulator.Simulator;
|
||||
import com.sap.sailing.simulator.TimedPosition;
|
||||
import com.sap.sailing.simulator.TimedPositionWithSpeed;
|
||||
import com.sap.sailing.simulator.impl.ConfigurationManager;
|
||||
@@ -73,8 +73,8 @@ import com.sap.sailing.simulator.impl.PathGenerator1Turner;
|
||||
import com.sap.sailing.simulator.impl.PathImpl;
|
||||
import com.sap.sailing.simulator.impl.PolarDiagramCSV;
|
||||
import com.sap.sailing.simulator.impl.ReadingConfigurationFileStatus;
|
||||
import com.sap.sailing.simulator.impl.SimulatorImpl;
|
||||
import com.sap.sailing.simulator.impl.SimulationParametersImpl;
|
||||
import com.sap.sailing.simulator.impl.SimulatorImpl;
|
||||
import com.sap.sailing.simulator.impl.TimedPositionImpl;
|
||||
import com.sap.sailing.simulator.impl.TimedPositionWithSpeedImpl;
|
||||
import com.sap.sailing.simulator.util.SailingSimulatorConstants;
|
||||
@@ -312,7 +312,7 @@ public class SimulatorServiceImpl extends RemoteServiceServlet implements Simula
|
||||
// params.getSeedLines());
|
||||
}
|
||||
|
||||
return new SimulatorResultsDTO(0, null, timeStep.asMillis(), 0, rcDTO, pathDTOs, windFieldDTO,
|
||||
return new SimulatorResultsDTO(0, 0, null, timeStep.asMillis(), 0, rcDTO, pathDTOs, windFieldDTO,
|
||||
simulatedPaths.notificationMessage);
|
||||
}
|
||||
|
||||
|
||||
+2
-2
@@ -28,12 +28,12 @@ public class CompactRaceMapDataDTO implements IsSerializable {
|
||||
private List<SidelineDTO> courseSidelines;
|
||||
private List<CompactQuickRankDTO> quickRanks;
|
||||
private LinkedHashMap<String, Integer> competitorsInOrderOfWindwardDistanceTraveledFarthestFirstIdAsStringAndOneBasedLegNumber;
|
||||
private int simulationResultVersion;
|
||||
private long simulationResultVersion;
|
||||
|
||||
CompactRaceMapDataDTO() {}
|
||||
|
||||
public CompactRaceMapDataDTO(Map<CompetitorDTO, List<GPSFixDTO>> boatPositions, CoursePositionsDTO coursePositions,
|
||||
List<SidelineDTO> courseSidelines, QuickRanksDTO quickRanks, int simulationResultVersion) {
|
||||
List<SidelineDTO> courseSidelines, QuickRanksDTO quickRanks, long simulationResultVersion) {
|
||||
this.boatPositionsByCompetitorIdAsString = new HashMap<String, List<GPSFixDTO>>();
|
||||
for (Map.Entry<CompetitorDTO, List<GPSFixDTO>> e : boatPositions.entrySet()) {
|
||||
this.boatPositionsByCompetitorIdAsString.put(e.getKey().getIdAsString(), e.getValue());
|
||||
|
||||
+1
-1
@@ -13,5 +13,5 @@ public class RaceMapDataDTO implements IsSerializable {
|
||||
public List<SidelineDTO> courseSidelines;
|
||||
public LinkedHashMap<CompetitorDTO, QuickRankDTO> quickRanks;
|
||||
public LinkedHashMap<CompetitorDTO, Integer> competitorsInOrderOfWindwardDistanceTraveledWithOneBasedLegNumber;
|
||||
public int simulationResultVersion;
|
||||
public long simulationResultVersion;
|
||||
}
|
||||
+10
-3
@@ -6,7 +6,8 @@ import com.google.gwt.user.client.rpc.IsSerializable;
|
||||
|
||||
public class SimulatorResultsDTO implements IsSerializable {
|
||||
|
||||
private int version;
|
||||
private long version;
|
||||
private int leg;
|
||||
private Date startTime;
|
||||
private long timeStep;
|
||||
private long legDuration;
|
||||
@@ -17,6 +18,7 @@ public class SimulatorResultsDTO implements IsSerializable {
|
||||
|
||||
public SimulatorResultsDTO(){
|
||||
this.version = 0;
|
||||
this.leg = 0;
|
||||
this.startTime = null;
|
||||
this.timeStep = 0;
|
||||
this.legDuration = 0;
|
||||
@@ -26,8 +28,9 @@ public class SimulatorResultsDTO implements IsSerializable {
|
||||
this.notificationMessage = "";
|
||||
}
|
||||
|
||||
public SimulatorResultsDTO(final int version, final Date startTime, final long timeStep, final long legDuration, final RaceMapDataDTO raceCourse, final PathDTO[] paths, final WindFieldDTO windField, final String notificationMessage) {
|
||||
public SimulatorResultsDTO(final long version, final int leg, final Date startTime, final long timeStep, final long legDuration, final RaceMapDataDTO raceCourse, final PathDTO[] paths, final WindFieldDTO windField, final String notificationMessage) {
|
||||
this.version = version;
|
||||
this.leg = leg;
|
||||
this.startTime = startTime;
|
||||
this.timeStep = timeStep;
|
||||
this.legDuration = legDuration;
|
||||
@@ -37,10 +40,14 @@ public class SimulatorResultsDTO implements IsSerializable {
|
||||
this.notificationMessage = notificationMessage;
|
||||
}
|
||||
|
||||
public int getVersion() {
|
||||
public long getVersion() {
|
||||
return this.version;
|
||||
}
|
||||
|
||||
public int getLeg() {
|
||||
return this.leg;
|
||||
}
|
||||
|
||||
public void setVersion(int version) {
|
||||
this.version = version;
|
||||
}
|
||||
|
||||
+11
-5
@@ -60,6 +60,7 @@ public class RaceSimulationOverlay extends FullCanvasOverlay {
|
||||
private Boolean[] visiblePaths;
|
||||
private PathDTO racePath;
|
||||
private int raceLeg = 0;
|
||||
private long requestedSimulationVersion = 0;
|
||||
private Canvas simulationLegend;
|
||||
|
||||
public RaceSimulationOverlay(MapWidget map, int zIndex, RegattaAndRaceIdentifier raceIdentifier, SailingServiceAsync sailingService, StringMessages stringMessages, AsyncActionsExecutor asyncActionsExecutor, CoordinateSystem coordinateSystem) {
|
||||
@@ -71,9 +72,14 @@ public class RaceSimulationOverlay extends FullCanvasOverlay {
|
||||
this.colors = new ColorPaletteGenerator();
|
||||
}
|
||||
|
||||
public void updateLeg(int newLeg, boolean clearCanvas, int newVersion) {
|
||||
if (((newLeg != raceLeg)||((newLeg == raceLeg)&&(newVersion != (simulationResult==null ? 0 : simulationResult.getVersion())))) && (this.isVisible())) {
|
||||
raceLeg = newLeg;
|
||||
public void updateLeg(int newLeg, boolean clearCanvas, long newVersion) {
|
||||
if (((newLeg != raceLeg)||((newLeg == raceLeg)&&(newVersion > this.getVersion()))) && (this.isVisible())) {
|
||||
if (newLeg != raceLeg) {
|
||||
raceLeg = newLeg;
|
||||
requestedSimulationVersion = 0;
|
||||
} else {
|
||||
requestedSimulationVersion = newVersion;
|
||||
}
|
||||
if (clearCanvas) {
|
||||
this.clearCanvas();
|
||||
}
|
||||
@@ -85,7 +91,7 @@ public class RaceSimulationOverlay extends FullCanvasOverlay {
|
||||
return new LegIdentifierImpl(raceIdentifier, String.valueOf(raceLeg));
|
||||
}
|
||||
|
||||
public int getVersion() {
|
||||
public long getVersion() {
|
||||
if (this.simulationResult == null) {
|
||||
return 0;
|
||||
} else {
|
||||
@@ -340,7 +346,7 @@ public class RaceSimulationOverlay extends FullCanvasOverlay {
|
||||
public void onSuccess(SimulatorResultsDTO result) {
|
||||
// store results
|
||||
if (result != null) {
|
||||
if (result.getPaths() != null) {
|
||||
if ((result.getPaths() != null) && (result.getVersion() >= requestedSimulationVersion) && (result.getLeg() == raceLeg)) {
|
||||
simulationResult = result;
|
||||
PathDTO[] paths = result.getPaths();
|
||||
if (result.getLegDuration() > 0) {
|
||||
|
||||
+1
-1
@@ -11,7 +11,7 @@ import com.sap.sailing.simulator.SimulationResults;
|
||||
|
||||
public interface SimulationService {
|
||||
|
||||
int getSimulationResultsVersion(LegIdentifier legIdentifier);
|
||||
long getSimulationResultsVersion(LegIdentifier legIdentifier);
|
||||
|
||||
SimulationResults getSimulationResults(LegIdentifier legIdentifier);
|
||||
|
||||
|
||||
+6
-5
@@ -85,7 +85,7 @@ public class SimulationServiceImpl implements SimulationService {
|
||||
public SimulationResults computeCacheUpdate(LegIdentifier key, SmartFutureCache.EmptyUpdateInterval updateInterval) throws Exception {
|
||||
logger.info("Simulation Started: \"" + key.toString() + "\"");
|
||||
SimulationResults results = computeSimulationResults(key);
|
||||
logger.info("Simulation Finished: \"" + key.toString() + "\", Results-Version: "+ (results==null?0:results.hashCode()));
|
||||
logger.info("Simulation Finished: \"" + key.toString() + "\", Results-Version: "+ (results==null?0:results.getVersion().asMillis()));
|
||||
return results;
|
||||
}
|
||||
}, "SmartFutureCache.simulationService (" + racingEventService.toString() + ")");
|
||||
@@ -260,10 +260,10 @@ public class SimulationServiceImpl implements SimulationService {
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getSimulationResultsVersion(LegIdentifier legIdentifier) {
|
||||
public long getSimulationResultsVersion(LegIdentifier legIdentifier) {
|
||||
SimulationResults result = cache.get(legIdentifier, false);
|
||||
int version = (result == null ? 0 : result.hashCode());
|
||||
logger.fine("Simulation Results-Version: " + + version);
|
||||
long version = (result == null ? 0 : result.getVersion().asMillis());
|
||||
logger.fine("Simulation Results-Version: " + version);
|
||||
return version;
|
||||
}
|
||||
|
||||
@@ -320,6 +320,7 @@ public class SimulationServiceImpl implements SimulationService {
|
||||
|
||||
public SimulationResults computeSimulationResults(LegIdentifier legIdentifier) throws InterruptedException,
|
||||
ExecutionException {
|
||||
TimePoint simulationStartTime = MillisecondsTimePoint.now();
|
||||
SimulationResults result = null;
|
||||
TrackedRace trackedRace = racingEventService.getTrackedRace(legIdentifier);
|
||||
if (trackedRace != null) {
|
||||
@@ -418,7 +419,7 @@ public class SimulationServiceImpl implements SimulationService {
|
||||
}
|
||||
// prepare simulator-results
|
||||
result = new SimulationResults(startTimePoint.asDate(), timeStep.asMillis(), legDuration, startPosition,
|
||||
endPosition, paths, null);
|
||||
endPosition, paths, null, simulationStartTime);
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
@@ -4,6 +4,7 @@ import java.util.Date;
|
||||
import java.util.Map;
|
||||
|
||||
import com.sap.sailing.domain.common.Position;
|
||||
import com.sap.sse.common.TimePoint;
|
||||
|
||||
public class SimulationResults {
|
||||
|
||||
@@ -14,6 +15,7 @@ public class SimulationResults {
|
||||
private Position endPosition;
|
||||
private Map<PathType, Path> paths;
|
||||
private String notificationMessage;
|
||||
private TimePoint version;
|
||||
|
||||
public SimulationResults(){
|
||||
this.startTime = null;
|
||||
@@ -23,7 +25,7 @@ public class SimulationResults {
|
||||
this.notificationMessage = "";
|
||||
}
|
||||
|
||||
public SimulationResults(final Date startTime, final long timeStep, final long legDuration, final Position startPosition, final Position endPosition, final Map<PathType, Path> paths, final String notificationMessage) {
|
||||
public SimulationResults(final Date startTime, final long timeStep, final long legDuration, final Position startPosition, final Position endPosition, final Map<PathType, Path> paths, final String notificationMessage, final TimePoint version) {
|
||||
this.startTime = startTime;
|
||||
this.timeStep = timeStep;
|
||||
this.legDuration = legDuration;
|
||||
@@ -31,6 +33,7 @@ public class SimulationResults {
|
||||
this.endPosition = endPosition;
|
||||
this.paths = paths;
|
||||
this.notificationMessage = notificationMessage;
|
||||
this.version = version;
|
||||
}
|
||||
|
||||
public Date getStartTime() {
|
||||
@@ -88,4 +91,8 @@ public class SimulationResults {
|
||||
public void setNotificationMessage(final String notificationMessage) {
|
||||
this.notificationMessage = notificationMessage;
|
||||
}
|
||||
|
||||
public TimePoint getVersion() {
|
||||
return this.version;
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user