mirror of
https://github.com/eclipse-sailing-analytics/sailing-analytics.git
synced 2026-10-30 15:57:11 +00:00
added MediaType enum literal case statements for image and unknown;
my impression is that so far, MediaType was primarily for video source identification, not for images; this may be a mismatch Conflicts: java/com.sap.sailing.domain.common/src/com/sap/sailing/domain/common/media/MediaType.java
This commit is contained in:
1 parent
ecb4ac2ccb
commit
e13d2232a2
2 files changed
+35
-17
No files matched your search
+23
-17
@@ -165,58 +165,64 @@ public class DomainFactoryImpl extends SharedDomainFactoryImpl implements Domain
|
|||||||
public TrackedRaceStatisticsDTO createTrackedRaceStatisticsDTO(TrackedRace trackedRace, Leaderboard leaderboard,
|
public TrackedRaceStatisticsDTO createTrackedRaceStatisticsDTO(TrackedRace trackedRace, Leaderboard leaderboard,
|
||||||
RaceColumn raceColumn, Fleet fleet, Collection<MediaTrack> mediaTracks) {
|
RaceColumn raceColumn, Fleet fleet, Collection<MediaTrack> mediaTracks) {
|
||||||
TrackedRaceStatisticsDTO statisticsDTO = new TrackedRaceStatisticsDTO();
|
TrackedRaceStatisticsDTO statisticsDTO = new TrackedRaceStatisticsDTO();
|
||||||
|
|
||||||
// GPS data
|
// GPS data
|
||||||
statisticsDTO.hasGPSData = trackedRace.hasGPSData();
|
statisticsDTO.hasGPSData = trackedRace.hasGPSData();
|
||||||
|
|
||||||
Competitor leaderOrWinner = null;
|
Competitor leaderOrWinner = null;
|
||||||
TimePoint now = MillisecondsTimePoint.now();
|
TimePoint now = MillisecondsTimePoint.now();
|
||||||
try {
|
try {
|
||||||
if(trackedRace.isLive(now)) {
|
if (trackedRace.isLive(now)) {
|
||||||
leaderOrWinner = trackedRace.getOverallLeader(now);
|
leaderOrWinner = trackedRace.getOverallLeader(now);
|
||||||
} else if (trackedRace.getEndOfRace() != null) {
|
} else if (trackedRace.getEndOfRace() != null) {
|
||||||
for(Competitor competitor: leaderboard.getCompetitorsFromBestToWorst(raceColumn, now)) {
|
for (Competitor competitor : leaderboard.getCompetitorsFromBestToWorst(raceColumn, now)) {
|
||||||
Fleet fleetOfCompetitor = raceColumn.getFleetOfCompetitor(competitor);
|
Fleet fleetOfCompetitor = raceColumn.getFleetOfCompetitor(competitor);
|
||||||
if(fleetOfCompetitor != null && fleetOfCompetitor.equals(fleet)) {
|
if (fleetOfCompetitor != null && fleetOfCompetitor.equals(fleet)) {
|
||||||
leaderOrWinner = competitor;
|
leaderOrWinner = competitor;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if(leaderOrWinner != null) {
|
if (leaderOrWinner != null) {
|
||||||
statisticsDTO.hasLeaderOrWinnerData = true;
|
statisticsDTO.hasLeaderOrWinnerData = true;
|
||||||
statisticsDTO.leaderOrWinner = convertToCompetitorDTO(leaderOrWinner);
|
statisticsDTO.leaderOrWinner = convertToCompetitorDTO(leaderOrWinner);
|
||||||
GPSFixTrack<Competitor, GPSFixMoving> track = trackedRace.getTrack(leaderOrWinner);
|
GPSFixTrack<Competitor, GPSFixMoving> track = trackedRace.getTrack(leaderOrWinner);
|
||||||
if(track != null) {
|
if (track != null) {
|
||||||
statisticsDTO.averageGPSDataSampleInterval = track.getAverageIntervalBetweenFixes();
|
statisticsDTO.averageGPSDataSampleInterval = track.getAverageIntervalBetweenFixes();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} catch (NoWindException e) {
|
} catch (NoWindException e) {
|
||||||
}
|
}
|
||||||
|
|
||||||
// Measured wind sources data
|
// Measured wind sources data
|
||||||
statisticsDTO.measuredWindSourcesCount = Util.size(trackedRace.getWindSources(WindSourceType.EXPEDITION));
|
statisticsDTO.measuredWindSourcesCount = Util.size(trackedRace.getWindSources(WindSourceType.EXPEDITION));
|
||||||
statisticsDTO.hasMeasuredWindData = statisticsDTO.measuredWindSourcesCount > 0;
|
statisticsDTO.hasMeasuredWindData = statisticsDTO.measuredWindSourcesCount > 0;
|
||||||
|
|
||||||
// leg progress data
|
// leg progress data
|
||||||
RaceDefinition race = trackedRace.getRace();
|
RaceDefinition race = trackedRace.getRace();
|
||||||
if(race.getCourse() != null) {
|
if (race.getCourse() != null) {
|
||||||
statisticsDTO.hasLegProgressData = true;
|
statisticsDTO.hasLegProgressData = true;
|
||||||
statisticsDTO.totalLegsCount = race.getCourse().getLegs().size();
|
statisticsDTO.totalLegsCount = race.getCourse().getLegs().size();
|
||||||
statisticsDTO.currentLegNo = trackedRace.getLastLegStarted(MillisecondsTimePoint.now());
|
statisticsDTO.currentLegNo = trackedRace.getLastLegStarted(MillisecondsTimePoint.now());
|
||||||
}
|
}
|
||||||
|
|
||||||
// media data
|
// media data
|
||||||
if(mediaTracks != null) {
|
if (mediaTracks != null) {
|
||||||
for(MediaTrack track: mediaTracks) {
|
for (MediaTrack track : mediaTracks) {
|
||||||
switch(track.mimeType.mediaType) {
|
switch (track.mimeType.mediaType) {
|
||||||
case audio:
|
case audio:
|
||||||
statisticsDTO.hasAudioData = true;
|
statisticsDTO.hasAudioData = true;
|
||||||
statisticsDTO.audioTracksCount = statisticsDTO.audioTracksCount == null ? 1 : statisticsDTO.audioTracksCount++;
|
statisticsDTO.audioTracksCount = statisticsDTO.audioTracksCount == null ? 1
|
||||||
|
: statisticsDTO.audioTracksCount++;
|
||||||
break;
|
break;
|
||||||
case video:
|
case video:
|
||||||
statisticsDTO.hasVideoData = true;
|
statisticsDTO.hasVideoData = true;
|
||||||
statisticsDTO.videoTracksCount = statisticsDTO.videoTracksCount == null ? 1 : statisticsDTO.videoTracksCount++;
|
statisticsDTO.videoTracksCount = statisticsDTO.videoTracksCount == null ? 1
|
||||||
|
: statisticsDTO.videoTracksCount++;
|
||||||
|
break;
|
||||||
|
case image: // TODO should this add to an image count?
|
||||||
|
break;
|
||||||
|
case unknown: // TODO should this add to an "unknown media" count? Probably not
|
||||||
|
break;
|
||||||
|
default:
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
+12
@@ -123,6 +123,12 @@ public class MediaManagementControl extends AbstractMediaSelectionControl implem
|
|||||||
} else {
|
} else {
|
||||||
reachableAudioTracks.add(mediaTrack);
|
reachableAudioTracks.add(mediaTrack);
|
||||||
}
|
}
|
||||||
|
case image: // no image media tracks produced by an image
|
||||||
|
break;
|
||||||
|
case unknown: // we won't overlay an unknown media source
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -144,6 +150,12 @@ public class MediaManagementControl extends AbstractMediaSelectionControl implem
|
|||||||
} else {
|
} else {
|
||||||
reachableAudioTracks.add(mediaTrack);
|
reachableAudioTracks.add(mediaTrack);
|
||||||
}
|
}
|
||||||
|
case image: // images don't play as video tracks
|
||||||
|
break;
|
||||||
|
case unknown: // unknown formats won't be played either
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in new issue
Block a user