mirror of
https://github.com/eclipse-sailing-analytics/sailing-analytics.git
synced 2026-09-30 17:36:40 +00:00
fixed result of TrackedRaceImpl.getStartFinishPlacemarks in case finish is close to start
This commit is contained in:
1 parent
a1d26fa780
commit
8d5b6f87a8
1 file changed
+17
-14
+17
-14
@@ -1203,21 +1203,24 @@ public abstract class TrackedRaceImpl implements TrackedRace, CourseListener {
|
||||
GPSFix finishBuoyFix = finishBuoys.hasNext() ? getOrCreateTrack(finishBuoys.next()).getLastRawFix() : null;
|
||||
Position finishPosition = finishBuoyFix != null ? finishBuoyFix.getPosition() : null;
|
||||
if (startPosition != null
|
||||
&& finishPosition != null
|
||||
&& startPosition.getDistance(finishPosition).getKilometers() > ReverseGeocoder.POSITION_CACHE_DISTANCE_LIMIT_IN_KM) {
|
||||
try {
|
||||
// Get distance to nearest placemark and calculate the search radius
|
||||
Placemark finishNearest = ReverseGeocoder.INSTANCE.getPlacemarkNearest(finishPosition);
|
||||
Distance finishNearestDistance = finishNearest.distanceFrom(finishPosition);
|
||||
double finishRadius = finishNearestDistance.getKilometers() * GEONAMES_RADIUS_CACLCULATION_FACTOR;
|
||||
&& finishPosition != null) {
|
||||
if (startPosition.getDistance(finishPosition).getKilometers() <= ReverseGeocoder.POSITION_CACHE_DISTANCE_LIMIT_IN_KM) {
|
||||
finishBest = startBest;
|
||||
} else {
|
||||
try {
|
||||
// Get distance to nearest placemark and calculate the search radius
|
||||
Placemark finishNearest = ReverseGeocoder.INSTANCE.getPlacemarkNearest(finishPosition);
|
||||
Distance finishNearestDistance = finishNearest.distanceFrom(finishPosition);
|
||||
double finishRadius = finishNearestDistance.getKilometers() * GEONAMES_RADIUS_CACLCULATION_FACTOR;
|
||||
|
||||
// Get the estimated best finish place
|
||||
finishBest = ReverseGeocoder.INSTANCE.getPlacemarkLast(finishPosition, finishRadius,
|
||||
new Placemark.ByPopulationDistanceRatio(finishPosition));
|
||||
} catch (IOException e) {
|
||||
logger.throwing(TrackedRaceImpl.class.getName(), "getPlaceOrder()", e);
|
||||
} catch (ParseException e) {
|
||||
logger.throwing(TrackedRaceImpl.class.getName(), "getPlaceOrder()", e);
|
||||
// Get the estimated best finish place
|
||||
finishBest = ReverseGeocoder.INSTANCE.getPlacemarkLast(finishPosition, finishRadius,
|
||||
new Placemark.ByPopulationDistanceRatio(finishPosition));
|
||||
} catch (IOException e) {
|
||||
logger.throwing(TrackedRaceImpl.class.getName(), "getPlaceOrder()", e);
|
||||
} catch (ParseException e) {
|
||||
logger.throwing(TrackedRaceImpl.class.getName(), "getPlaceOrder()", e);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user