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
9844761bd9
commit
617c88ca3d
1 file changed
+17
-14
+17
-14
@@ -1156,21 +1156,24 @@ public abstract class TrackedRaceImpl implements TrackedRace, CourseListener {
|
|||||||
GPSFix finishBuoyFix = finishBuoys.hasNext() ? getOrCreateTrack(finishBuoys.next()).getLastRawFix() : null;
|
GPSFix finishBuoyFix = finishBuoys.hasNext() ? getOrCreateTrack(finishBuoys.next()).getLastRawFix() : null;
|
||||||
Position finishPosition = finishBuoyFix != null ? finishBuoyFix.getPosition() : null;
|
Position finishPosition = finishBuoyFix != null ? finishBuoyFix.getPosition() : null;
|
||||||
if (startPosition != null
|
if (startPosition != null
|
||||||
&& finishPosition != null
|
&& finishPosition != null) {
|
||||||
&& startPosition.getDistance(finishPosition).getKilometers() > ReverseGeocoder.POSITION_CACHE_DISTANCE_LIMIT_IN_KM) {
|
if (startPosition.getDistance(finishPosition).getKilometers() <= ReverseGeocoder.POSITION_CACHE_DISTANCE_LIMIT_IN_KM) {
|
||||||
try {
|
finishBest = startBest;
|
||||||
// Get distance to nearest placemark and calculate the search radius
|
} else {
|
||||||
Placemark finishNearest = ReverseGeocoder.INSTANCE.getPlacemarkNearest(finishPosition);
|
try {
|
||||||
Distance finishNearestDistance = finishNearest.distanceFrom(finishPosition);
|
// Get distance to nearest placemark and calculate the search radius
|
||||||
double finishRadius = finishNearestDistance.getKilometers() * GEONAMES_RADIUS_CACLCULATION_FACTOR;
|
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
|
// Get the estimated best finish place
|
||||||
finishBest = ReverseGeocoder.INSTANCE.getPlacemarkLast(finishPosition, finishRadius,
|
finishBest = ReverseGeocoder.INSTANCE.getPlacemarkLast(finishPosition, finishRadius,
|
||||||
new Placemark.ByPopulationDistanceRatio(finishPosition));
|
new Placemark.ByPopulationDistanceRatio(finishPosition));
|
||||||
} catch (IOException e) {
|
} catch (IOException e) {
|
||||||
logger.throwing(TrackedRaceImpl.class.getName(), "getPlaceOrder()", e);
|
logger.throwing(TrackedRaceImpl.class.getName(), "getPlaceOrder()", e);
|
||||||
} catch (ParseException e) {
|
} catch (ParseException e) {
|
||||||
logger.throwing(TrackedRaceImpl.class.getName(), "getPlaceOrder()", e);
|
logger.throwing(TrackedRaceImpl.class.getName(), "getPlaceOrder()", e);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in new issue
Block a user