Issue #1146 clone DrawableImages so they are impossible to dispose.
Former-commit-id:1109ee5694
[formerly1109ee5694
[formerly d2f1051380ce995126c31031dc1bbd85f31e0eb0]] Former-commit-id:ef6b9b0014
Former-commit-id:60891f4e02
This commit is contained in:
parent
b498ca1a65
commit
949d6017fe
4 changed files with 20 additions and 15 deletions
|
@ -99,11 +99,8 @@ public class KmlColormappedImageExtension extends
|
||||||
|
|
||||||
private static class Generator extends KmlGroundOverlayGenerator {
|
private static class Generator extends KmlGroundOverlayGenerator {
|
||||||
|
|
||||||
private final DrawableImage[] images;
|
|
||||||
|
|
||||||
public Generator(float alpha, DrawableImage[] images) {
|
public Generator(float alpha, DrawableImage[] images) {
|
||||||
super(alpha);
|
super(alpha, images);
|
||||||
this.images = images;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
@ -40,6 +40,8 @@ import com.raytheon.uf.common.geospatial.interpolation.Interpolation;
|
||||||
import com.raytheon.uf.common.geospatial.interpolation.NearestNeighborInterpolation;
|
import com.raytheon.uf.common.geospatial.interpolation.NearestNeighborInterpolation;
|
||||||
import com.raytheon.uf.common.geospatial.interpolation.data.DataSource;
|
import com.raytheon.uf.common.geospatial.interpolation.data.DataSource;
|
||||||
import com.raytheon.uf.common.geospatial.interpolation.data.FloatArrayWrapper;
|
import com.raytheon.uf.common.geospatial.interpolation.data.FloatArrayWrapper;
|
||||||
|
import com.raytheon.uf.viz.core.DrawableImage;
|
||||||
|
import com.raytheon.uf.viz.core.PixelCoverage;
|
||||||
import com.raytheon.uf.viz.core.data.IColorMapDataRetrievalCallback.ColorMapData;
|
import com.raytheon.uf.viz.core.data.IColorMapDataRetrievalCallback.ColorMapData;
|
||||||
import com.raytheon.uf.viz.core.data.prep.Colormapper;
|
import com.raytheon.uf.viz.core.data.prep.Colormapper;
|
||||||
import com.raytheon.uf.viz.core.drawables.ColorMapParameters;
|
import com.raytheon.uf.viz.core.drawables.ColorMapParameters;
|
||||||
|
@ -74,7 +76,21 @@ public abstract class KmlGroundOverlayGenerator extends KmlFeatureGenerator {
|
||||||
|
|
||||||
protected final double alpha;
|
protected final double alpha;
|
||||||
|
|
||||||
public KmlGroundOverlayGenerator(double alpha) {
|
protected final DrawableImage[] images;
|
||||||
|
|
||||||
|
public KmlGroundOverlayGenerator(double alpha, DrawableImage[] images) {
|
||||||
|
this.images = new DrawableImage[images.length];
|
||||||
|
for (int i = 0; i < images.length; i += 1) {
|
||||||
|
// Clone the DrawableImage so that if whatever is drawing modifies
|
||||||
|
// or disposes of it then when the generator runs it will still draw
|
||||||
|
// what was rendered.
|
||||||
|
PixelCoverage oldCov = images[i].getCoverage();
|
||||||
|
PixelCoverage newCov = new PixelCoverage(oldCov.getUl(),
|
||||||
|
oldCov.getUr(), oldCov.getLr(), oldCov.getLl());
|
||||||
|
newCov.setMesh(oldCov.getMesh());
|
||||||
|
this.images[i] = new DrawableImage(images[i].getImage(), newCov,
|
||||||
|
images[i].getMode());
|
||||||
|
}
|
||||||
this.alpha = alpha;
|
this.alpha = alpha;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -19,7 +19,6 @@
|
||||||
**/
|
**/
|
||||||
package com.raytheon.uf.viz.kml.export.graphics.ext;
|
package com.raytheon.uf.viz.kml.export.graphics.ext;
|
||||||
|
|
||||||
import java.nio.ByteBuffer;
|
|
||||||
import java.util.Arrays;
|
import java.util.Arrays;
|
||||||
import java.util.Comparator;
|
import java.util.Comparator;
|
||||||
|
|
||||||
|
@ -34,7 +33,6 @@ import org.opengis.referencing.operation.TransformException;
|
||||||
import com.raytheon.uf.common.geospatial.interpolation.Interpolation;
|
import com.raytheon.uf.common.geospatial.interpolation.Interpolation;
|
||||||
import com.raytheon.uf.common.geospatial.interpolation.NearestNeighborInterpolation;
|
import com.raytheon.uf.common.geospatial.interpolation.NearestNeighborInterpolation;
|
||||||
import com.raytheon.uf.common.geospatial.interpolation.data.AbstractDataWrapper;
|
import com.raytheon.uf.common.geospatial.interpolation.data.AbstractDataWrapper;
|
||||||
import com.raytheon.uf.common.geospatial.interpolation.data.ByteBufferWrapper;
|
|
||||||
import com.raytheon.uf.common.geospatial.interpolation.data.DataDestination;
|
import com.raytheon.uf.common.geospatial.interpolation.data.DataDestination;
|
||||||
import com.raytheon.uf.common.geospatial.interpolation.data.DataSource;
|
import com.raytheon.uf.common.geospatial.interpolation.data.DataSource;
|
||||||
import com.raytheon.uf.common.geospatial.interpolation.data.FloatArrayWrapper;
|
import com.raytheon.uf.common.geospatial.interpolation.data.FloatArrayWrapper;
|
||||||
|
@ -121,11 +119,8 @@ public class KmlMosaicImageExtension extends
|
||||||
|
|
||||||
private final ColorMapParameters parameters;
|
private final ColorMapParameters parameters;
|
||||||
|
|
||||||
private final DrawableImage[] images;
|
|
||||||
|
|
||||||
public Generator(float alpha, KmlMosaicImage image) {
|
public Generator(float alpha, KmlMosaicImage image) {
|
||||||
super(alpha);
|
super(alpha, image.getImagesToMosaic());
|
||||||
this.images = image.getImagesToMosaic();
|
|
||||||
this.parameters = image.getColorMapParameters();
|
this.parameters = image.getColorMapParameters();
|
||||||
this.mosaicComparator = image.getMosaicComparator();
|
this.mosaicComparator = image.getMosaicComparator();
|
||||||
}
|
}
|
||||||
|
|
|
@ -77,11 +77,8 @@ public class KmlRasterImageExtension extends
|
||||||
|
|
||||||
private static class Generator extends KmlGroundOverlayGenerator {
|
private static class Generator extends KmlGroundOverlayGenerator {
|
||||||
|
|
||||||
private final DrawableImage[] images;
|
|
||||||
|
|
||||||
public Generator(float alpha, DrawableImage[] images) {
|
public Generator(float alpha, DrawableImage[] images) {
|
||||||
super(alpha);
|
super(alpha, images);
|
||||||
this.images = images;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
Loading…
Add table
Reference in a new issue