diff --git a/plugins-dev/echosounder/src/java/pt/lsts/neptus/plugins/sidescan/SidescanPanel.java b/plugins-dev/echosounder/src/java/pt/lsts/neptus/plugins/sidescan/SidescanPanel.java index 609cc2c0fa..e51b685fbf 100644 --- a/plugins-dev/echosounder/src/java/pt/lsts/neptus/plugins/sidescan/SidescanPanel.java +++ b/plugins-dev/echosounder/src/java/pt/lsts/neptus/plugins/sidescan/SidescanPanel.java @@ -415,9 +415,7 @@ void updateImage(long currentTime, long lastUpdateTime) { ArrayList list = ssParser.getLinesBetween(firstPingTime + lastUpdateTime, firstPingTime + currentTime, subsystem, autoEGN ? SidescanHistogramNormalizer.HISTOGRAM_DEFAULT_PARAMATERS : sidescanParams); - ArrayList drawList = new ArrayList<>(list); - - for (SidescanLine l : drawList) { + for (SidescanLine l : list) { // Update the rangeMax to the ruler if (l.getRange() != getRangeForRuler()) { setRangeForRuler(l.getRange()); @@ -460,7 +458,7 @@ void updateImage(long currentTime, long lastUpdateTime) { int d = 0; - for (SidescanLine sidescanLine : drawList) { + for (SidescanLine sidescanLine : list) { sidescanLine.setYPos(yref - d); d += sidescanLine.getYSize(); if (sidescanLine.getData().length <= 0) { @@ -491,19 +489,17 @@ void updateImage(long currentTime, long lastUpdateTime) { // g2d.drawImage(sidescanLine.image, 0, sidescanLine.ypos, null); } synchronized (lineList) { - SidescanLine sidescanLine; // Must be in synchronized block for (SidescanLine line : lineList) { - sidescanLine = line; - sidescanLine.setYPos(sidescanLine.getYPos() + yref); - if (sidescanLine.getYPos() > image.getHeight()) - removeList.add(sidescanLine); + line.setYPos(line.getYPos() + yref); + if (line.getYPos() > image.getHeight()) + removeList.add(line); } - lineList.addAll(drawList); + lineList.addAll(list); lineList.removeAll(removeList); } - drawList.clear(); + list.clear(); removeList.clear(); }