diff --git a/cave/com.raytheon.viz.lightning/src/com/raytheon/viz/lightning/LightningResource.java b/cave/com.raytheon.viz.lightning/src/com/raytheon/viz/lightning/LightningResource.java index 23ee4b4a41..b3215c3dac 100644 --- a/cave/com.raytheon.viz.lightning/src/com/raytheon/viz/lightning/LightningResource.java +++ b/cave/com.raytheon.viz.lightning/src/com/raytheon/viz/lightning/LightningResource.java @@ -359,57 +359,59 @@ public class LightningResource extends .get(this.lastPaintedTime); if (cacheObject != null) { - LightningFrame bundle = cacheObject.getObjectAsync(); - if (bundle == null) { - needsUpdate = true; - issueRefresh(); - } else { - if (needsUpdate) { - needsUpdate = false; - currNegList = new ArrayList( - bundle.posLatLonList.size()); - currPosList = new ArrayList( - bundle.negLatLonList.size()); + synchronized (cacheObject.getMetadata()) { + LightningFrame bundle = cacheObject.getObjectAsync(); + if (bundle == null) { + needsUpdate = true; + issueRefresh(); + } else { + if (needsUpdate) { + needsUpdate = false; + currNegList = new ArrayList( + bundle.posLatLonList.size()); + currPosList = new ArrayList( + bundle.negLatLonList.size()); + + if (resourceData.isHandlingPositiveStrikes()) { + for (double[] pos : bundle.posLatLonList) { + currPosList.add(descriptor.worldToPixel(pos)); + } + } + if (resourceData.isHandlingNegativeStrikes()) { + for (double[] neg : bundle.negLatLonList) { + currNegList.add(descriptor.worldToPixel(neg)); + } + } + } if (resourceData.isHandlingPositiveStrikes()) { - for (double[] pos : bundle.posLatLonList) { - currPosList.add(descriptor.worldToPixel(pos)); + List positive = new ArrayList( + currPosList.size()); + for (double[] pos : currPosList) { + if (extent.contains(pos)) { + positive.add(pos); + } } + posCount = positive.size(); + + target.drawPoints(positive, color, PointStyle.CROSS, + magnification); } + if (resourceData.isHandlingNegativeStrikes()) { - for (double[] neg : bundle.negLatLonList) { - currNegList.add(descriptor.worldToPixel(neg)); + List negative = new ArrayList( + currPosList.size()); + for (double[] neg : currNegList) { + if (extent.contains(neg)) { + negative.add(neg); + } } + negCount = negative.size(); + + target.drawPoints(negative, color, PointStyle.DASH, + magnification); } } - - if (resourceData.isHandlingPositiveStrikes()) { - List positive = new ArrayList( - currPosList.size()); - for (double[] pos : currPosList) { - if (extent.contains(pos)) { - positive.add(pos); - } - } - posCount = positive.size(); - - target.drawPoints(positive, color, PointStyle.CROSS, - magnification); - } - - if (resourceData.isHandlingNegativeStrikes()) { - List negative = new ArrayList( - currPosList.size()); - for (double[] neg : currNegList) { - if (extent.contains(neg)) { - negative.add(neg); - } - } - negCount = negative.size(); - - target.drawPoints(negative, color, PointStyle.DASH, - magnification); - } } }