Additional small changes for WWA layer

- check the values() array for null, before attempting to cycle through it
- calculate the text positions the first time the display strings are created
- set the current zoom after drawing all the entries
This commit is contained in:
srcarter3 2023-03-29 11:09:00 -07:00
parent 7e7ff7e1e6
commit 54e0274844

View file

@ -452,7 +452,7 @@ public abstract class AbstractWWAResource extends
int index = info.getFrameIndex();
boolean framesChanged = false;
//only do the frame logic if the frame has changed
if(currentFrameIdx == Integer.MIN_VALUE || currentFrameIdx != index) {
if(currentFrameIdx != index) {
framesChanged = true;
currentFrameIdx = index;
currentCandidates.clear();
@ -502,6 +502,11 @@ public abstract class AbstractWWAResource extends
}
}
}
//If there are no entries, end here
if(currentCandidates.values() == null) {
return;
}
for (WarningEntry entry : currentCandidates.values()) {
AbstractWarningRecord record = entry.record;
boolean drawShape = true;
@ -632,6 +637,7 @@ public abstract class AbstractWWAResource extends
entry.textStr = fullText[0];
entry.timeStr = fullText[1];
calculateTextPosition(entry, paintProps);
}
//if zoom has changed, recalucate text positions
if(currentZoom != paintProps.getZoomLevel()) {
@ -656,6 +662,7 @@ public abstract class AbstractWWAResource extends
}
}
currentZoom = paintProps.getZoomLevel();
}
}