mirror of
https://github.com/eclipse-sailing-analytics/sailing-analytics.git
synced 2026-10-28 23:07:11 +00:00
Fixes of wind field and UI
This commit is contained in:
1 parent
89994b8ce9
commit
1a7429d81c
5 files changed
+38
-21
No files matched your search
+2
-2
@@ -64,8 +64,8 @@ public abstract class FullCanvasOverlay extends CanvasOverlay {
|
||||
context2d.setStrokeStyle(pointColor);
|
||||
context2d.setLineWidth(3);
|
||||
context2d.beginPath();
|
||||
context2d.moveTo(x, y);
|
||||
context2d.lineTo(x, y);
|
||||
context2d.moveTo(x-1, y-1);
|
||||
context2d.lineTo(x+1, y+1);
|
||||
context2d.closePath();
|
||||
context2d.stroke();
|
||||
|
||||
|
||||
+2
-2
@@ -113,9 +113,9 @@ public class PathCanvasOverlay extends WindFieldCanvasOverlay {
|
||||
int x2 = canvasPositionInPx.getX() - this.getWidgetPosLeft();
|
||||
int y2 = canvasPositionInPx.getY() - this.getWidgetPosTop();
|
||||
|
||||
this.pointColor = pathColor;
|
||||
this.pointColor = "Black";
|
||||
drawPoint(x1, y1);
|
||||
drawLine(x1, y1, x2, y2, 1/* weight */, pathColor);
|
||||
drawLine(x1, y1, x2, y2, 3/* weight */, pathColor);
|
||||
drawPoint(x2, y2);
|
||||
}
|
||||
}
|
||||
+5
-3
@@ -105,7 +105,8 @@ public class RaceCourseCanvasOverlay extends FullCanvasOverlay {
|
||||
if (startMarker != null) {
|
||||
startMarker.setLatLng(startPoint);
|
||||
} else {
|
||||
startMarker = new Marker(startPoint);
|
||||
// default markers are too large cluttering race display
|
||||
/* startMarker = new Marker(startPoint);
|
||||
map.addOverlay(startMarker);
|
||||
/*
|
||||
* startMarker.addMarkerMouseOverHandler(new MarkerMouseOverHandler () {
|
||||
@@ -137,7 +138,8 @@ public class RaceCourseCanvasOverlay extends FullCanvasOverlay {
|
||||
if (endMarker != null) {
|
||||
endMarker.setLatLng(endPoint);
|
||||
} else {
|
||||
endMarker = new Marker(endPoint);
|
||||
// default markers are too large cluttering race display
|
||||
/* endMarker = new Marker(endPoint);
|
||||
map.addOverlay(endMarker);
|
||||
|
||||
endMarker.addMarkerMouseOverHandler(new RaceCourseMarkerMouseOverHandler());
|
||||
@@ -149,7 +151,7 @@ public class RaceCourseCanvasOverlay extends FullCanvasOverlay {
|
||||
map.getInfoWindow().close();
|
||||
}
|
||||
|
||||
});
|
||||
});*/
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
+18
-9
@@ -156,9 +156,12 @@ public class WindFieldCanvasOverlay extends FullCanvasOverlay implements TimeLis
|
||||
int index = 0;
|
||||
while (windDTOIter.hasNext()) {
|
||||
WindDTO windDTO = windDTOIter.next();
|
||||
int width = (int) Math.max(1, Math.min(2, Math.round(windDTO.trueWindSpeedInMetersPerSecond)));
|
||||
//int aWidth = (int) Math.max(1, Math.min(2, Math.round(windDTO.trueWindSpeedInMetersPerSecond)));
|
||||
double aWidth = Math.max(1., (windDTO.trueWindSpeedInMetersPerSecond/3.));
|
||||
double aLength = Math.max(10., (3.*windDTO.trueWindSpeedInMetersPerSecond));
|
||||
logger.info("windspeed: "+windDTO.trueWindSpeedInMetersPerSecond+", aWidth: "+aWidth+", aLength: "+aLength);
|
||||
DegreeBearingImpl dbi = new DegreeBearingImpl(windDTO.trueWindBearingDeg);
|
||||
drawArrow(windDTO, dbi.getRadians(), arrowLength, width, ++index);
|
||||
drawArrow(windDTO, dbi.getRadians(), aLength, aWidth, ++index);
|
||||
|
||||
}
|
||||
String title = "Wind Field at " + windDTOList.size() + " points.";
|
||||
@@ -191,7 +194,9 @@ public class WindFieldCanvasOverlay extends FullCanvasOverlay implements TimeLis
|
||||
|
||||
double theta = Math.atan2(-dy, dx);
|
||||
|
||||
drawHead(x1, y1, theta, length / 2, weight);
|
||||
double hLength = Math.max(6.,6.+(10./(60.-10.))*Math.max(length-6.,0));
|
||||
logger.info("headlength: "+hLength+", arrowlength: "+length);
|
||||
drawHead(x1, y1, theta, hLength, weight);
|
||||
//String text = "P" + index;// + NumberFormat.getFormat("0.00").format(windDTO.trueWindBearingDeg) + "°";
|
||||
//drawPointWithText(x, y, text);
|
||||
drawPoint(x, y);
|
||||
@@ -206,12 +211,16 @@ public class WindFieldCanvasOverlay extends FullCanvasOverlay implements TimeLis
|
||||
if (t2 <= (-Math.PI))
|
||||
t2 += 2 * Math.PI;
|
||||
|
||||
double x1 = Math.round(x - Math.cos(t) * headLength);
|
||||
double y1 = Math.round(y + Math.sin(t) * headLength);
|
||||
double x2 = Math.round(x - Math.cos(t2) * headLength);
|
||||
double y2 = Math.round(y + Math.sin(t2) * headLength);
|
||||
drawLine(x, y, x1, y1, weight, arrowHeadColor);
|
||||
drawLine(x, y, x2, y2, weight, arrowHeadColor);
|
||||
double x1 = (x - Math.cos(t) * headLength);
|
||||
double y1 = (y + Math.sin(t) * headLength);
|
||||
double x1o = (x + Math.cos(t) * weight/2);
|
||||
double y1o = (y - Math.sin(t) * weight/2);
|
||||
double x2 = (x - Math.cos(t2) * headLength);
|
||||
double y2 = (y + Math.sin(t2) * headLength);
|
||||
double x2o = (x + Math.cos(t2) * weight/2);
|
||||
double y2o = (y - Math.sin(t2) * weight/2);
|
||||
drawLine(x1o, y1o, x1, y1, weight, arrowHeadColor);
|
||||
drawLine(x2o, y2o, x2, y2, weight, arrowHeadColor);
|
||||
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user