Issue #1001 synchronize paint with add.

Former-commit-id: 2c9737ca5c [formerly 2c9737ca5c [formerly 825c08e6ce89b0c4b042c9e85f7abbc7b9a675ef]]
Former-commit-id: 798d26e954
Former-commit-id: e9cde98072
This commit is contained in:
Ben Steffensmeier 2012-08-03 14:10:04 -05:00
parent 5dc36127da
commit db95e6621b

View file

@ -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<double[]>(
bundle.posLatLonList.size());
currPosList = new ArrayList<double[]>(
bundle.negLatLonList.size());
synchronized (cacheObject.getMetadata()) {
LightningFrame bundle = cacheObject.getObjectAsync();
if (bundle == null) {
needsUpdate = true;
issueRefresh();
} else {
if (needsUpdate) {
needsUpdate = false;
currNegList = new ArrayList<double[]>(
bundle.posLatLonList.size());
currPosList = new ArrayList<double[]>(
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<double[]> positive = new ArrayList<double[]>(
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<double[]> negative = new ArrayList<double[]>(
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<double[]> positive = new ArrayList<double[]>(
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<double[]> negative = new ArrayList<double[]>(
currPosList.size());
for (double[] neg : currNegList) {
if (extent.contains(neg)) {
negative.add(neg);
}
}
negCount = negative.size();
target.drawPoints(negative, color, PointStyle.DASH,
magnification);
}
}
}