mirror of
https://github.com/eclipse-sailing-analytics/sailing-analytics.git
synced 2026-10-08 21:30:57 +00:00
avoid redundant expensive re-calculation of average wind in WindJsonGetServlet
This commit is contained in:
1 parent
4fc4d4adee
commit
ae2cfcc862
1 file changed
+4
-8
+4
-8
@@ -125,14 +125,10 @@ public class WindJsonGetServlet extends AbstractJsonHttpServlet {
|
||||
jsonWind.put("meterspersecondspeed", wind.getMetersPerSecond());
|
||||
if (wind.getTimePoint() != null) {
|
||||
jsonWind.put("timepoint", wind.getTimePoint().asMillis());
|
||||
jsonWind.put("dampenedtruebearingdeg",
|
||||
windTrack.getAveragedWind(wind.getPosition(), wind.getTimePoint()).getBearing()
|
||||
.getDegrees());
|
||||
jsonWind.put("dampenedknotspeed",
|
||||
windTrack.getAveragedWind(wind.getPosition(), wind.getTimePoint()).getKnots());
|
||||
jsonWind.put("dampenedmeterspersecondspeed",
|
||||
windTrack.getAveragedWind(wind.getPosition(), wind.getTimePoint())
|
||||
.getMetersPerSecond());
|
||||
final Wind averagedWind = windTrack.getAveragedWind(wind.getPosition(), wind.getTimePoint());
|
||||
jsonWind.put("dampenedtruebearingdeg", averagedWind.getBearing().getDegrees());
|
||||
jsonWind.put("dampenedknotspeed", averagedWind.getKnots());
|
||||
jsonWind.put("dampenedmeterspersecondspeed", averagedWind.getMetersPerSecond());
|
||||
}
|
||||
if (wind.getPosition() != null) {
|
||||
jsonWind.put("latdeg", wind.getPosition().getLatDeg());
|
||||
|
||||
Reference in new issue
Block a user