From 69e29a89dd8ddcc52f81ef3d3dfefffe1e8e122b Mon Sep 17 00:00:00 2001 From: Alexander Ries Date: Thu, 22 Jan 2015 13:32:11 +0100 Subject: [PATCH] removed all TODOs and System.out.println from com.sap.sailing.dashboards.gwt --- .../gwt/client/RibDashboardDataRetriever.java | 1 - .../CompetitorSelectionPopup.java | 1 - .../StartlineAnalysisComponent.java | 1 - ...tartAnalysisStartRankTableTeamCollumn.java | 1 - .../compass/LocationPointerCompass.java | 1 - .../gwt/server/RibDashboardServiceImpl.java | 545 ++++++------------ .../gwt/server/StartAnalysisRacesStore.java | 14 +- .../dto/startanalysis/StartAnalysisDTO.java | 1 - 8 files changed, 163 insertions(+), 402 deletions(-) diff --git a/java/com.sap.sailing.dashboards.gwt/src/main/java/com/sap/sailing/dashboards/gwt/client/RibDashboardDataRetriever.java b/java/com.sap.sailing.dashboards.gwt/src/main/java/com/sap/sailing/dashboards/gwt/client/RibDashboardDataRetriever.java index dfa2bf9a79c..687caafd639 100644 --- a/java/com.sap.sailing.dashboards.gwt/src/main/java/com/sap/sailing/dashboards/gwt/client/RibDashboardDataRetriever.java +++ b/java/com.sap.sailing.dashboards.gwt/src/main/java/com/sap/sailing/dashboards/gwt/client/RibDashboardDataRetriever.java @@ -242,7 +242,6 @@ public class RibDashboardDataRetriever implements RacingNotYetStartedPopupListen @Override public void didClickedOKWithCompetitorName(String competitorName) { - System.out.println("Did clicked with competitor " + competitorName); this.selectedTeamName = competitorName; Cookies.setCookie(KEY_SLECTED_TEAM_COOKIE, competitorName, new Date(new Date().getTime() + SLECTED_TEAM_COOKIE_EXPIRE_TIME_IN_MILLIS)); diff --git a/java/com.sap.sailing.dashboards.gwt/src/main/java/com/sap/sailing/dashboards/gwt/client/popups/competitorselection/CompetitorSelectionPopup.java b/java/com.sap.sailing.dashboards.gwt/src/main/java/com/sap/sailing/dashboards/gwt/client/popups/competitorselection/CompetitorSelectionPopup.java index 4f704d04eee..d8ad99da411 100644 --- a/java/com.sap.sailing.dashboards.gwt/src/main/java/com/sap/sailing/dashboards/gwt/client/popups/competitorselection/CompetitorSelectionPopup.java +++ b/java/com.sap.sailing.dashboards.gwt/src/main/java/com/sap/sailing/dashboards/gwt/client/popups/competitorselection/CompetitorSelectionPopup.java @@ -136,7 +136,6 @@ public class CompetitorSelectionPopup extends Composite implements HasWidgets, C @Override public void didSelectedRowWithCompetitorName(String competitorName) { - // TODO Auto-generated method stub button.getElement().addClassName(style.buttonshow()); currentCompetitorSelected = competitorName; } diff --git a/java/com.sap.sailing.dashboards.gwt/src/main/java/com/sap/sailing/dashboards/gwt/client/startanalysis/StartlineAnalysisComponent.java b/java/com.sap.sailing.dashboards.gwt/src/main/java/com/sap/sailing/dashboards/gwt/client/startanalysis/StartlineAnalysisComponent.java index 6d3877550c9..0170556c899 100644 --- a/java/com.sap.sailing.dashboards.gwt/src/main/java/com/sap/sailing/dashboards/gwt/client/startanalysis/StartlineAnalysisComponent.java +++ b/java/com.sap.sailing.dashboards.gwt/src/main/java/com/sap/sailing/dashboards/gwt/client/startanalysis/StartlineAnalysisComponent.java @@ -231,7 +231,6 @@ public class StartlineAnalysisComponent extends Composite implements HasWidgets, @Override public void bottomNotificationClicked() { - // TODO Auto-generated method stub scrollToLast(); } diff --git a/java/com.sap.sailing.dashboards.gwt/src/main/java/com/sap/sailing/dashboards/gwt/client/startanalysis/rankingtable/StartAnalysisStartRankTableTeamCollumn.java b/java/com.sap.sailing.dashboards.gwt/src/main/java/com/sap/sailing/dashboards/gwt/client/startanalysis/rankingtable/StartAnalysisStartRankTableTeamCollumn.java index 8c69a2a8e43..b3fc3121acf 100644 --- a/java/com.sap.sailing.dashboards.gwt/src/main/java/com/sap/sailing/dashboards/gwt/client/startanalysis/rankingtable/StartAnalysisStartRankTableTeamCollumn.java +++ b/java/com.sap.sailing.dashboards.gwt/src/main/java/com/sap/sailing/dashboards/gwt/client/startanalysis/rankingtable/StartAnalysisStartRankTableTeamCollumn.java @@ -7,7 +7,6 @@ public abstract class StartAnalysisStartRankTableTeamCollumn extends Column racingEventServiceTracker; - private final com.sap.sailing.domain.base.DomainFactory baseDomainFactory; - private final BundleContext context; - private static final Logger logger = Logger - .getLogger(RibDashboardServiceImpl.class.getName()); + /** + * Variable contains last {@link TrackedRace} that is or was live + * */ + private TrackedRace runningRace; - /** - * Variable contains last {@link TrackedRace} that is or was live - * */ - private TrackedRace runningRace; + /** + * {@link MovingAverage} of last 400 start line advantage values during the last races. See initialization at + * {@link #RibDashboardServiceImpl()}) Advantage by wind is the advantage in meters that a boat, starting a the pin + * end of the line, has, compared to a boat starting at the very right side of the line. + * */ + private MovingAverage averageStartLineAdvantageByWind; - /** - * {@link MovingAverage} of last 400 start line advantage values during the - * last races. See initialization at {@link #RibDashboardServiceImpl()}) - * Advantage by wind is the advantage in meters that a boat, starting a the - * pin end of the line, has, compared to a boat starting at the very right - * side of the line. - * */ - private MovingAverage averageStartLineAdvantageByWind; + /** + * {@link MovingAverage} of last 400 start line advantage values during the last races. See initialization at + * {@link #RibDashboardServiceImpl()}) Advantage by geometry is the delta in meters of the distance from race + * committee boat to first mark and pin end mark to first mark. Wind has no influence on the value. + * */ + private MovingAverage averageStartLineAdvantageByGeometry; - /** - * {@link MovingAverage} of last 400 start line advantage values during the - * last races. See initialization at {@link #RibDashboardServiceImpl()}) - * Advantage by geometry is the delta in meters of the distance from race - * committee boat to first mark and pin end mark to first mark. Wind has no - * influence on the value. - * */ - private MovingAverage averageStartLineAdvantageByGeometry; + /** + * The map values contain a Pair, whose first value is a {@link MovingAverage} for the true wind speed and the + * second one contains an average for the true wind direction for a wind bot. + * */ - /** - * The map values contain a Pair, whose first value is a - * {@link MovingAverage} for the true wind speed and the second one contains - * an average for the true wind direction for a wind bot. - * */ + private Map> startAnalysisDTOsForCompetitor; + private StartAnalysisRacesStore startAnalysisRacesStore; + + private final ServiceTracker racingEventServiceTracker; + private final com.sap.sailing.domain.base.DomainFactory baseDomainFactory; + private final BundleContext context; + + private static final Logger logger = Logger.getLogger(RibDashboardServiceImpl.class.getName()); - private Map> startAnalysisDTOsForCompetitor; - private StartAnalysisRacesStore startAnalysisRacesStore; - public RibDashboardServiceImpl() { - context = Activator.getDefault(); - racingEventServiceTracker = createAndOpenRacingEventServiceTracker(context); - baseDomainFactory = getRacingEventService().getBaseDomainFactory(); + public RibDashboardServiceImpl() { + context = Activator.getDefault(); + racingEventServiceTracker = createAndOpenRacingEventServiceTracker(context); + baseDomainFactory = getRacingEventService().getBaseDomainFactory(); - startAnalysisRacesStore = new StartAnalysisRacesStore(getRacingEventService()); - startAnalysisRacesStore.addStartAnalyisisRacesStoreListener(this); - - startAnalysisDTOsForCompetitor = new HashMap>(); - averageStartLineAdvantageByWind = new MovingAverage(400); - averageStartLineAdvantageByGeometry = new MovingAverage(400); - } + startAnalysisRacesStore = new StartAnalysisRacesStore(getRacingEventService()); + startAnalysisRacesStore.addStartAnalyisisRacesStoreListener(this); - protected RacingEventService getRacingEventService() { - return racingEventServiceTracker.getService(); // grab the service - } + startAnalysisDTOsForCompetitor = new HashMap>(); + averageStartLineAdvantageByWind = new MovingAverage(400); + averageStartLineAdvantageByGeometry = new MovingAverage(400); + } - protected ServiceTracker createAndOpenRacingEventServiceTracker( - BundleContext context) { - ServiceTracker result = new ServiceTracker( - context, RacingEventService.class.getName(), null); - result.open(); - return result; - } + protected RacingEventService getRacingEventService() { + return racingEventServiceTracker.getService(); // grab the service + } - /** - * leaderboardGroupName is used to retrieve the live running - * race with the method {@link #getLiveRaceFromLeaderboardName(String)}. - * competitorName If competitorName is null, the response - * contains only a list of competitors in the live race. Otherwise the - * parameter is used to return the right startanalysis for a specific - * competitor with in the returned {@link RibDashboardRaceInfoDTO}. - * */ - @Override - public RibDashboardRaceInfoDTO getLiveRaceInfo(String leaderboardGroupName, - String competitorName) { - RibDashboardRaceInfoDTO lRInfo = new RibDashboardRaceInfoDTO(); - if (leaderboardGroupName != null) { - TimePoint timePointOfRequest = MillisecondsTimePoint.now(); - if (checkIfRaceIsStillRunning(timePointOfRequest, - leaderboardGroupName)) { - if (competitorName == null) { - fillLiveRaceInfoDTOWithRaceData(lRInfo, timePointOfRequest); - logger.log(Level.INFO, "NO_COMPETITOR_SELECTED"); - lRInfo.responseMessage = ResponseMessage.NO_COMPETITOR_SELECTED; - return lRInfo; - } else { - fillLiveRaceInfoDTOWithRaceData(lRInfo, timePointOfRequest); - fillLiveRaceInfoDTOWithStartLineAdavantageData(lRInfo, - timePointOfRequest); - fillLiveRaceInfoDTOWithStartAnalysisData(lRInfo, - competitorName); - lRInfo.responseMessage = ResponseMessage.OK; - } - } else { - lRInfo.responseMessage = ResponseMessage.NO_RACE_LIVE; - } - return lRInfo; - } else { - lRInfo.responseMessage = ResponseMessage.NO_RACE_LIVE; - return lRInfo; - } - } + protected ServiceTracker createAndOpenRacingEventServiceTracker( + BundleContext context) { + ServiceTracker result = new ServiceTracker( + context, RacingEventService.class.getName(), null); + result.open(); + return result; + } - private void fillLiveRaceInfoDTOWithRaceData( - RibDashboardRaceInfoDTO lRInfo, TimePoint now) { - if (runningRace != null) { - lRInfo.idOfLastTrackedRace = runningRace.getRaceIdentifier(); - try { - List competitors = runningRace - .getCompetitorsFromBestToWorst(now); - List competitorNames = new ArrayList(); - for (Competitor competitor : competitors) { - competitorNames.add(competitor.getName()); - } - Collections.sort(competitorNames); - lRInfo.competitorNamesFromLastTrackedRace = competitorNames; - } catch (NoWindException e) { - // TODO Auto-generated catch block - e.printStackTrace(); - } - } - } + /** + * leaderboardGroupName is used to retrieve the live running race with the method + * {@link #getLiveRaceFromLeaderboardName(String)}. competitorName If competitorName is null, the + * response contains only a list of competitors in the live race. Otherwise the parameter is used to return the + * right startanalysis for a specific competitor with in the returned {@link RibDashboardRaceInfoDTO}. + * */ + @Override + public RibDashboardRaceInfoDTO getLiveRaceInfo(String leaderboardGroupName, String competitorName) { + RibDashboardRaceInfoDTO lRInfo = new RibDashboardRaceInfoDTO(); + if (leaderboardGroupName != null) { + TimePoint timePointOfRequest = MillisecondsTimePoint.now(); + if (checkIfRaceIsStillRunning(timePointOfRequest, leaderboardGroupName)) { + if (competitorName == null) { + fillLiveRaceInfoDTOWithRaceData(lRInfo, timePointOfRequest); + logger.log(Level.INFO, "NO_COMPETITOR_SELECTED"); + lRInfo.responseMessage = ResponseMessage.NO_COMPETITOR_SELECTED; + return lRInfo; + } else { + fillLiveRaceInfoDTOWithRaceData(lRInfo, timePointOfRequest); + fillLiveRaceInfoDTOWithStartLineAdavantageData(lRInfo, timePointOfRequest); + fillLiveRaceInfoDTOWithStartAnalysisData(lRInfo, competitorName); + lRInfo.responseMessage = ResponseMessage.OK; + } + } else { + lRInfo.responseMessage = ResponseMessage.NO_RACE_LIVE; + } + return lRInfo; + } else { + lRInfo.responseMessage = ResponseMessage.NO_RACE_LIVE; + return lRInfo; + } + } - private void fillLiveRaceInfoDTOWithStartAnalysisData( - RibDashboardRaceInfoDTO lRInfo, String competiorName) { - lRInfo.startAnalysisDTOList = startAnalysisDTOsForCompetitor - .get(competiorName); - } + private void fillLiveRaceInfoDTOWithRaceData(RibDashboardRaceInfoDTO lRInfo, TimePoint now) { + if (runningRace != null) { + lRInfo.idOfLastTrackedRace = runningRace.getRaceIdentifier(); + try { + List competitors = runningRace.getCompetitorsFromBestToWorst(now); + List competitorNames = new ArrayList(); + for (Competitor competitor : competitors) { + competitorNames.add(competitor.getName()); + } + Collections.sort(competitorNames); + lRInfo.competitorNamesFromLastTrackedRace = competitorNames; + } catch (NoWindException e) { + e.printStackTrace(); + } + } + } - // returns true if race is still live - private boolean checkIfRaceIsStillRunning(TimePoint now, - String leaderboardGroupName) { - if (runningRace == null || !(runningRace.isLive(now))) { - runningRace = getLiveRaceFromLeaderboardName(leaderboardGroupName); - if (runningRace == null) { - return false; - } else { - startAnalysisRacesStore.addAsListener(runningRace); - return true; - } - } else { - return true; - } - } + private void fillLiveRaceInfoDTOWithStartAnalysisData(RibDashboardRaceInfoDTO lRInfo, String competiorName) { + lRInfo.startAnalysisDTOList = startAnalysisDTOsForCompetitor.get(competiorName); + } - private TrackedRace getLiveRaceFromLeaderboardName( - String leaderboardGroupName) { - TrackedRace result = null; - Leaderboard lb = getRacingEventService().getLeaderboardByName( - leaderboardGroupName); - if (lb != null) { - for (RaceColumn column : lb.getRaceColumns()) { - for (Fleet fleet : column.getFleets()) { - TrackedRace race = column.getTrackedRace(fleet); - if (race != null - && race.isLive(new MillisecondsTimePoint(new Date()))) { - result = race; - } - } - } - } - return result; - } + // returns true if race is still live + private boolean checkIfRaceIsStillRunning(TimePoint now, String leaderboardGroupName) { + if (runningRace == null || !(runningRace.isLive(now))) { + runningRace = getLiveRaceFromLeaderboardName(leaderboardGroupName); + if (runningRace == null) { + return false; + } else { + startAnalysisRacesStore.addAsListener(runningRace); + return true; + } + } else { + return true; + } + } - private void fillLiveRaceInfoDTOWithStartLineAdavantageData( - RibDashboardRaceInfoDTO lRInfo, TimePoint timepoint) { - if (runningRace != null && timepoint != null) { - StartLineAdvantageDTO startLineAdvantageDTO = new StartLineAdvantageDTO(); - startLineAdvantageDTO.liveWindStartLineAdvantage = getWindStartLineAdvantageAtTimePoint( - runningRace, timepoint); - startLineAdvantageDTO.liveGeometricStartLineAdvantage = getGeometricStartLineAdvantageAtTimePoint( - runningRace, timepoint); - startLineAdvantageDTO.averageWindStartLineAdvantage = averageStartLineAdvantageByWind - .getAverage(); - startLineAdvantageDTO.averageGeometricStartLineAdvantage = averageStartLineAdvantageByGeometry - .getAverage(); - lRInfo.startLineAdvantageDTO = startLineAdvantageDTO; - } - } + private TrackedRace getLiveRaceFromLeaderboardName(String leaderboardGroupName) { + TrackedRace result = null; + Leaderboard lb = getRacingEventService().getLeaderboardByName(leaderboardGroupName); + if (lb != null) { + for (RaceColumn column : lb.getRaceColumns()) { + for (Fleet fleet : column.getFleets()) { + TrackedRace race = column.getTrackedRace(fleet); + if (race != null && race.isLive(new MillisecondsTimePoint(new Date()))) { + result = race; + } + } + } + } + return result; + } - private double getWindStartLineAdvantageAtTimePoint( - TrackedRace trackedRace, TimePoint timePoint) { - double result = trackedRace.getStartLine(timePoint).getAdvantage() - .getMeters(); - averageStartLineAdvantageByWind.add(result); - return result; - } + private void fillLiveRaceInfoDTOWithStartLineAdavantageData(RibDashboardRaceInfoDTO lRInfo, TimePoint timepoint) { + if (runningRace != null && timepoint != null) { + StartLineAdvantageDTO startLineAdvantageDTO = new StartLineAdvantageDTO(); + startLineAdvantageDTO.liveWindStartLineAdvantage = getWindStartLineAdvantageAtTimePoint(runningRace, + timepoint); + startLineAdvantageDTO.liveGeometricStartLineAdvantage = getGeometricStartLineAdvantageAtTimePoint( + runningRace, timepoint); + startLineAdvantageDTO.averageWindStartLineAdvantage = averageStartLineAdvantageByWind.getAverage(); + startLineAdvantageDTO.averageGeometricStartLineAdvantage = averageStartLineAdvantageByGeometry.getAverage(); + lRInfo.startLineAdvantageDTO = startLineAdvantageDTO; + } + } - private double getGeometricStartLineAdvantageAtTimePoint( - TrackedRace trackedRace, TimePoint timePoint) { - double result = trackedRace.getStartLine(timePoint) - .getGeometricAdvantage().getMeters(); - averageStartLineAdvantageByGeometry.add(result); - return result; - } + private double getWindStartLineAdvantageAtTimePoint(TrackedRace trackedRace, TimePoint timePoint) { + double result = trackedRace.getStartLine(timePoint).getAdvantage().getMeters(); + averageStartLineAdvantageByWind.add(result); + return result; + } - protected com.sap.sailing.domain.base.DomainFactory getBaseDomainFactory() { - return baseDomainFactory; - } + private double getGeometricStartLineAdvantageAtTimePoint(TrackedRace trackedRace, TimePoint timePoint) { + double result = trackedRace.getStartLine(timePoint).getGeometricAdvantage().getMeters(); + averageStartLineAdvantageByGeometry.add(result); + return result; + } - private interface PositionAtTimeProvider { - Position getPosition(TimePoint at); - } + protected com.sap.sailing.domain.base.DomainFactory getBaseDomainFactory() { + return baseDomainFactory; + } - protected WindDTO createWindDTOFromAlreadyAveraged(Wind wind, - TimePoint requestTimepoint) { - WindDTO windDTO = new WindDTO(); - windDTO.requestTimepoint = requestTimepoint.asMillis(); - windDTO.trueWindBearingDeg = wind.getBearing().getDegrees(); - windDTO.trueWindFromDeg = wind.getBearing().reverse().getDegrees(); - windDTO.trueWindSpeedInKnots = wind.getKnots(); - windDTO.trueWindSpeedInMetersPerSecond = wind.getMetersPerSecond(); - windDTO.dampenedTrueWindBearingDeg = wind.getBearing().getDegrees(); - windDTO.dampenedTrueWindFromDeg = wind.getBearing().reverse() - .getDegrees(); - windDTO.dampenedTrueWindSpeedInKnots = wind.getKnots(); - windDTO.dampenedTrueWindSpeedInMetersPerSecond = wind - .getMetersPerSecond(); - if (wind.getPosition() != null) { - windDTO.position = new PositionDTO(wind.getPosition().getLatDeg(), - wind.getPosition().getLngDeg()); - } - if (wind.getTimePoint() != null) { - windDTO.measureTimepoint = wind.getTimePoint().asMillis(); - } - return windDTO; - } + public TrackedRace getExistingTrackedRace(RegattaAndRaceIdentifier regattaNameAndRaceName) { + return null; + } - private WindTrackInfoDTO createWindTrackInfoDTO(TimePoint from, - long millisecondsStepWidth, int numberOfFixes, - TrackedRace trackedRace, boolean onlyUpToNewestEvent, - TimePoint newestEvent, WindSource windSource, - PositionAtTimeProvider positionProvider) { - WindTrack windTrack = trackedRace.getOrCreateWindTrack(windSource); - WindTrackInfoDTO windTrackInfoDTO = new WindTrackInfoDTO(); - windTrackInfoDTO.windFixes = new ArrayList(); - windTrackInfoDTO.dampeningIntervalInMilliseconds = windTrack - .getMillisecondsOverWhichToAverageWind(); - TimePoint timePoint = from; - - for (int i = 0; i < numberOfFixes - && (!onlyUpToNewestEvent || (newestEvent != null && timePoint - .before(newestEvent))); i++) { - WindWithConfidence> averagedWindWithConfidence = windTrack - .getAveragedWindWithConfidence( - positionProvider.getPosition(timePoint), timePoint); - if (averagedWindWithConfidence != null) { - WindDTO windDTO = createWindDTOFromAlreadyAveraged( - averagedWindWithConfidence.getObject(), timePoint); - windTrackInfoDTO.windFixes.add(windDTO); - } else { - } - timePoint = new MillisecondsTimePoint(timePoint.asMillis() - + millisecondsStepWidth); - } - return windTrackInfoDTO; - } - - @Override - public void startAnalyisisRacesChanged( - Map> startAnalysisDTOCompetitorMap) { - startAnalysisDTOsForCompetitor = startAnalysisDTOCompetitorMap; - } - - /** - * @param to - * if null, data is returned up to end of race; if - * the end of race is not known and null is used for - * this parameter, null is returned. - * @param onlyUpToNewestEvent - * if true, no wind data will be returned for time - * points later than - * {@link TrackedRace#getTimePointOfNewestEvent() - * trackedRace.getTimePointOfNewestEvent()}. This is helpful in - * case the client wants to populate a chart during live mode. If - * false, the "best effort" readings are provided - * for the time interval requested, no matter if based on any - * sensor evidence or not, regardless of - * {@link TrackedRace#getTimePointOfNewestEvent() - * trackedRace.getTimePointOfNewestEvent()}. - */ - public WindInfoForRaceDTO getAveragedWindInfo( - RegattaAndRaceIdentifier raceIdentifier, Date from, Date to, - long resolutionInMilliseconds, - Collection windSourceTypeNames, boolean onlyUpToNewestEvent) { - TrackedRace trackedRace = getExistingTrackedRace(raceIdentifier); - WindInfoForRaceDTO result = null; - if (trackedRace != null) { - TimePoint fromTimePoint = from == null ? trackedRace - .getStartOfTracking() : new MillisecondsTimePoint(from); - TimePoint toTimePoint = to == null ? trackedRace.getEndOfRace() == null ? MillisecondsTimePoint - .now().minus(trackedRace.getDelayToLiveInMillis()) - : trackedRace.getEndOfRace() - : new MillisecondsTimePoint(to); - if (fromTimePoint != null && toTimePoint != null) { - int numberOfFixes = (int) ((toTimePoint.asMillis() - fromTimePoint - .asMillis()) / resolutionInMilliseconds); - result = getAveragedWindInfo(fromTimePoint, - resolutionInMilliseconds, numberOfFixes, - windSourceTypeNames, trackedRace, onlyUpToNewestEvent, /* includeCombinedWindForAllLegMiddles */ - false); - } - } - return result; - } - - public TrackedRace getExistingTrackedRace( - RegattaAndRaceIdentifier regattaNameAndRaceName) { - return null; - } - - /** - * @param onlyUpToNewestEvent - * if true, no wind data will be returned for time - * points later than - * {@link TrackedRace#getTimePointOfNewestEvent() - * trackedRace.getTimePointOfNewestEvent()}. This is helpful in - * case the client wants to populate a chart during live mode. If - * false, the "best effort" readings are provided - * for the time interval requested, no matter if based on any - * sensor evidence or not, regardless of - * {@link TrackedRace#getTimePointOfNewestEvent() - * trackedRace.getTimePointOfNewestEvent()}. - * @param includeCombinedWindForAllLegMiddles - * if true, the result will return non- - * null results for calls to - * {@link WindInfoForRaceDTO#getCombinedWindOnLegMiddle(int)}. - */ - private WindInfoForRaceDTO getAveragedWindInfo(TimePoint from, - long millisecondsStepWidth, int numberOfFixes, - Collection windSourceTypeNames, TrackedRace trackedRace, - boolean onlyUpToNewestEvent, - boolean includeCombinedWindForAllLegMiddles) { - WindInfoForRaceDTO result = null; - if (trackedRace != null) { - TimePoint newestEvent = trackedRace.getTimePointOfNewestEvent(); - result = new WindInfoForRaceDTO(); - result.raceIsKnownToStartUpwind = trackedRace - .raceIsKnownToStartUpwind(); - List windSourcesToExclude = new ArrayList(); - for (WindSource windSourceToExclude : trackedRace - .getWindSourcesToExclude()) { - windSourcesToExclude.add(windSourceToExclude); - } - result.windSourcesToExclude = windSourcesToExclude; - Map windTrackInfoDTOs = new HashMap(); - result.windTrackInfoByWindSource = windTrackInfoDTOs; - List windSourcesToDeliver = new ArrayList(); - Util.addAll(trackedRace.getWindSources(), windSourcesToDeliver); - final WindSource combinedWindSource = new WindSourceImpl( - WindSourceType.COMBINED); - windSourcesToDeliver.add(combinedWindSource); - for (WindSource windSource : windSourcesToDeliver) { - // TODO consider parallelizing - if (windSourceTypeNames == null - || windSourceTypeNames.contains(windSource.getType() - .name())) { - WindTrackInfoDTO windTrackInfoDTO = createWindTrackInfoDTO( - from, millisecondsStepWidth, numberOfFixes, - trackedRace, onlyUpToNewestEvent, newestEvent, - windSource, new PositionAtTimeProvider() { - @Override - public Position getPosition(TimePoint at) { - return null; - } - }); - windTrackInfoDTOs.put(windSource, windTrackInfoDTO); - } - } - if (includeCombinedWindForAllLegMiddles) { - int zeroBasedLegNumber = 0; - for (final TrackedLeg trackedLeg : trackedRace.getTrackedLegs()) { - WindTrackInfoDTO windTrackInfoForLegMiddle = createWindTrackInfoDTO( - from, millisecondsStepWidth, numberOfFixes, - trackedRace, onlyUpToNewestEvent, newestEvent, - combinedWindSource, new PositionAtTimeProvider() { - @Override - public Position getPosition(TimePoint at) { - return trackedLeg.getMiddleOfLeg(at); - } - }); - result.addWindOnLegMiddle(zeroBasedLegNumber, - windTrackInfoForLegMiddle); - zeroBasedLegNumber++; - } - } - } - return result; - } + @Override + public void startAnalyisisRacesChanged(Map> startAnalysisDTOCompetitorMap) { + startAnalysisDTOsForCompetitor = startAnalysisDTOCompetitorMap; + } } \ No newline at end of file diff --git a/java/com.sap.sailing.dashboards.gwt/src/main/java/com/sap/sailing/dashboards/gwt/server/StartAnalysisRacesStore.java b/java/com.sap.sailing.dashboards.gwt/src/main/java/com/sap/sailing/dashboards/gwt/server/StartAnalysisRacesStore.java index 254fa019132..ae69027869e 100644 --- a/java/com.sap.sailing.dashboards.gwt/src/main/java/com/sap/sailing/dashboards/gwt/server/StartAnalysisRacesStore.java +++ b/java/com.sap.sailing.dashboards.gwt/src/main/java/com/sap/sailing/dashboards/gwt/server/StartAnalysisRacesStore.java @@ -63,15 +63,6 @@ public class StartAnalysisRacesStore { * */ private Map> startAnalysisDTOListForCompetitorName; - /** - * Contains {@link StartAnalysisCompetitorDTO}s for every competitor name in every race. This map gets created for a - * tracked race when the first mark one rounding of a tracked race gets received. Caching - * {@link StartAnalysisCompetitorDTO}s brings the advantage of faster code at creating finished - * {@link #startAnalysisDTOListForCompetitorName} - * */ - // private Map> - // startAnalysisCompetitorDTOsForCompetitorNameForTrackedRace; - /** * Contains a ranking list of competitor at mark one for every race * */ @@ -104,7 +95,6 @@ public class StartAnalysisRacesStore { startAnalysisDTOListForCompetitorName = new HashMap>(); rankingListAtMarkOneForTrackedRace = new HashMap>(); gpsFixesPathBeforeStartForCompetitor = new HashMap>>(); - } /** @@ -182,7 +172,6 @@ public class StartAnalysisRacesStore { fromPerCompetitorIdAsString.put(competitor.getId().toString(), fiveSecondsBeforeStart); } } catch (NoWindException e) { - // TODO Auto-generated catch block e.printStackTrace(); } return fromPerCompetitorIdAsString; @@ -400,7 +389,6 @@ public class StartAnalysisRacesStore { .asMillis())), true)); } } catch (NoWindException e) { - // TODO Auto-generated catch block e.printStackTrace(); } return gpsFixesPathBeforeStartForCompetitor.get(trackedRace); @@ -461,7 +449,7 @@ public class StartAnalysisRacesStore { } } } - } } + } \ No newline at end of file diff --git a/java/com.sap.sailing.dashboards.gwt/src/main/java/com/sap/sailing/dashboards/gwt/shared/dto/startanalysis/StartAnalysisDTO.java b/java/com.sap.sailing.dashboards.gwt/src/main/java/com/sap/sailing/dashboards/gwt/shared/dto/startanalysis/StartAnalysisDTO.java index 6f301b06429..f05da59da5b 100644 --- a/java/com.sap.sailing.dashboards.gwt/src/main/java/com/sap/sailing/dashboards/gwt/shared/dto/startanalysis/StartAnalysisDTO.java +++ b/java/com.sap.sailing.dashboards.gwt/src/main/java/com/sap/sailing/dashboards/gwt/shared/dto/startanalysis/StartAnalysisDTO.java @@ -22,7 +22,6 @@ public class StartAnalysisDTO implements Serializable, Comparable