mirror of
https://github.com/eclipse-sailing-analytics/sailing-analytics.git
synced 2026-10-25 05:23:51 +00:00
slightly refactored creation of RaceCourseDTO; need to take care of MarkDTO position production now
This commit is contained in:
1 parent
db80dc9461
commit
66af27e6a2
2 files changed
+13
-25
No files matched your search
+12
-24
@@ -902,7 +902,7 @@ public class SailingServiceImpl extends ProxiedRemoteServiceServlet implements S
|
||||
|
||||
CourseBase lastCourse = state.getCourseDesign();
|
||||
if (lastCourse != null) {
|
||||
raceInfoDTO.lastCourseDesign = convertCourseDesignToRaceCourseDTO(lastCourse);
|
||||
raceInfoDTO.lastCourseDesign = convertToRaceCourseDTO(lastCourse);
|
||||
raceInfoDTO.lastCourseName = lastCourse.getName();
|
||||
}
|
||||
|
||||
@@ -952,20 +952,6 @@ public class SailingServiceImpl extends ProxiedRemoteServiceServlet implements S
|
||||
raceInfoDTO.startProcedureDTO = info;
|
||||
}
|
||||
|
||||
private RaceCourseDTO convertCourseDesignToRaceCourseDTO(CourseBase lastCourseDesign) {
|
||||
RaceCourseDTO result = new RaceCourseDTO(Collections.<WaypointDTO> emptyList());
|
||||
if (lastCourseDesign != null) {
|
||||
List<WaypointDTO> waypointDTOs = new ArrayList<WaypointDTO>();
|
||||
for (Waypoint waypoint : lastCourseDesign.getWaypoints()) {
|
||||
ControlPointDTO controlPointDTO = convertToControlPointDTO(waypoint.getControlPoint());
|
||||
WaypointDTO waypointDTO = new WaypointDTO(waypoint.getName(), controlPointDTO, waypoint.getPassingInstructions());
|
||||
waypointDTOs.add(waypointDTO);
|
||||
}
|
||||
result = new RaceCourseDTO(waypointDTOs);
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
private List<RaceWithCompetitorsDTO> convertToRaceDTOs(Regatta regatta) {
|
||||
List<RaceWithCompetitorsDTO> result = new ArrayList<RaceWithCompetitorsDTO>();
|
||||
for (RaceDefinition r : regatta.getAllRaces()) {
|
||||
@@ -5099,25 +5085,27 @@ public class SailingServiceImpl extends ProxiedRemoteServiceServlet implements S
|
||||
}
|
||||
|
||||
private RaceCourseDTO convertToRaceCourseDTO(CourseBase course) {
|
||||
List<WaypointDTO> waypointDTOs = new ArrayList<WaypointDTO>();
|
||||
Map<Serializable, ControlPointDTO> controlPointCache = new HashMap<>();
|
||||
RaceCourseDTO result = new RaceCourseDTO(waypointDTOs);
|
||||
for (Waypoint waypoint : course.getWaypoints()) {
|
||||
waypointDTOs.add(convertToWaypointDTO(waypoint, controlPointCache));
|
||||
final RaceCourseDTO result;
|
||||
if (course != null) {
|
||||
List<WaypointDTO> waypointDTOs = new ArrayList<WaypointDTO>();
|
||||
Map<Serializable, ControlPointDTO> controlPointCache = new HashMap<>();
|
||||
for (Waypoint waypoint : course.getWaypoints()) {
|
||||
waypointDTOs.add(convertToWaypointDTO(waypoint, controlPointCache));
|
||||
}
|
||||
result = new RaceCourseDTO(waypointDTOs);
|
||||
} else {
|
||||
result = new RaceCourseDTO(Collections.<WaypointDTO> emptyList());
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
@Override
|
||||
public RaceCourseDTO getLastCourseDefinitionInRaceLog(String leaderboardName, String raceColumnName,
|
||||
String fleetName) {
|
||||
public RaceCourseDTO getLastCourseDefinitionInRaceLog(String leaderboardName, String raceColumnName, String fleetName) {
|
||||
RaceLog raceLog = getRaceLog(leaderboardName, raceColumnName, fleetName);
|
||||
|
||||
CourseBase lastPublishedCourse = new LastPublishedCourseDesignFinder(raceLog).analyze();
|
||||
if (lastPublishedCourse == null) {
|
||||
lastPublishedCourse = new CourseDataImpl("");
|
||||
}
|
||||
|
||||
return convertToRaceCourseDTO(lastPublishedCourse);
|
||||
}
|
||||
|
||||
|
||||
+1
-1
@@ -8,7 +8,7 @@ import com.sap.sailing.domain.common.NauticalSide;
|
||||
import com.sap.sailing.domain.common.Position;
|
||||
|
||||
public class CoursePositionsDTO implements IsSerializable {
|
||||
public List<WaypointDTO> course;
|
||||
public List<RaceCourseDTO> course;
|
||||
public List<Position> waypointPositions;
|
||||
public List<Position> startMarkPositions;
|
||||
public List<Position> finishMarkPositions;
|
||||
|
||||
Reference in new issue
Block a user