bug6098: when wind ladder image tile has been loaded, call redraw() and draw()

This commit is contained in:
Axel Uhl committed 2025-03-28 18:05:49 +01:00
1 parent 6f7b202a39
commit d4cb909d23
3 files changed
+13 -6

No files matched your search

@@ -41,8 +41,8 @@ public class WindLadder extends DoubleCanvasBuffer<WindLadderOverlay> {
super();
this.coordinateSystem = coordinateSystem;
this.buffer = new WindLadderOverlay[BUFFER_SIZE];
this.buffer[0] = new WindLadderOverlay(this, map, zIndex, coordinateSystem);
this.buffer[1] = new WindLadderOverlay(this, map, zIndex, coordinateSystem);
this.buffer[0] = new WindLadderOverlay(this, map, zIndex, coordinateSystem, "buffer-0");
this.buffer[1] = new WindLadderOverlay(this, map, zIndex, coordinateSystem, "buffer-1");
this.apply(overlay -> overlay.setVisible(false));
this.setVisible(true);
this.addToMap();
@@ -24,7 +24,7 @@ public class WindLadderOverlay extends FullCanvasOverlay {
protected WindLadder windLadder;
protected ImageTileGenerator tileGen = new ImageTileGenerator(RESOURCES.windLadderTexture(), this::redraw);
protected ImageTileGenerator tileGen = new ImageTileGenerator(RESOURCES.windLadderTexture(), ()->{ redraw(); draw(); });
protected Double windBearingRadians;
protected Position fixPosition;
@@ -36,12 +36,14 @@ public class WindLadderOverlay extends FullCanvasOverlay {
protected boolean redraw = true;
protected int transitionDisableCountdown;
private final String name;
public WindLadderOverlay(WindLadder windLadder, MapWidget map, int zIndex, CoordinateSystem coordinateSystem) {
public WindLadderOverlay(WindLadder windLadder, MapWidget map, int zIndex, CoordinateSystem coordinateSystem, String name) {
super(map, zIndex, coordinateSystem);
this.map.addZoomChangeHandler(event -> this.onZoomChange());
this.windLadder = windLadder;
getCanvas().getElement().setId("wind-ladder-display");
getCanvas().getElement().setId("wind-ladder-display-"+name);
this.name = name;
}
public boolean update(Double windBearingRadians, Position fixPosition, long timeForPositionTransitionMillis) {
@@ -259,4 +261,9 @@ public class WindLadderOverlay extends FullCanvasOverlay {
}
return mapHeight;
}
@Override
public String toString() {
return super.toString()+" "+name;
}
}
@@ -66,7 +66,7 @@ public abstract class FullCanvasOverlay extends CanvasOverlayV3 implements Requi
mapProjectionSet = true;
setCanvasSettings();
super.getOnDrawHandler().onDraw(methods);
return false;
return false; // don't repeat
}, /* delay */ 1000);
} else {
super.getOnDrawHandler().onDraw(methods);