Merge "Issue #1146 clone DrawableImages so they are impossible to dispose." into development
Former-commit-id:bcd6709455
[formerly e8079dd2bde60c6e6f2711549a344f01d5acd7f1] Former-commit-id:37d8f23073
This commit is contained in:
commit
16f2fed243
4 changed files with 20 additions and 15 deletions
|
@ -99,11 +99,8 @@ public class KmlColormappedImageExtension extends
|
|||
|
||||
private static class Generator extends KmlGroundOverlayGenerator {
|
||||
|
||||
private final DrawableImage[] images;
|
||||
|
||||
public Generator(float alpha, DrawableImage[] images) {
|
||||
super(alpha);
|
||||
this.images = images;
|
||||
super(alpha, images);
|
||||
}
|
||||
|
||||
@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.data.DataSource;
|
||||
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.prep.Colormapper;
|
||||
import com.raytheon.uf.viz.core.drawables.ColorMapParameters;
|
||||
|
@ -74,7 +76,21 @@ public abstract class KmlGroundOverlayGenerator extends KmlFeatureGenerator {
|
|||
|
||||
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;
|
||||
}
|
||||
|
||||
|
|
|
@ -19,7 +19,6 @@
|
|||
**/
|
||||
package com.raytheon.uf.viz.kml.export.graphics.ext;
|
||||
|
||||
import java.nio.ByteBuffer;
|
||||
import java.util.Arrays;
|
||||
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.NearestNeighborInterpolation;
|
||||
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.DataSource;
|
||||
import com.raytheon.uf.common.geospatial.interpolation.data.FloatArrayWrapper;
|
||||
|
@ -121,11 +119,8 @@ public class KmlMosaicImageExtension extends
|
|||
|
||||
private final ColorMapParameters parameters;
|
||||
|
||||
private final DrawableImage[] images;
|
||||
|
||||
public Generator(float alpha, KmlMosaicImage image) {
|
||||
super(alpha);
|
||||
this.images = image.getImagesToMosaic();
|
||||
super(alpha, image.getImagesToMosaic());
|
||||
this.parameters = image.getColorMapParameters();
|
||||
this.mosaicComparator = image.getMosaicComparator();
|
||||
}
|
||||
|
|
|
@ -77,11 +77,8 @@ public class KmlRasterImageExtension extends
|
|||
|
||||
private static class Generator extends KmlGroundOverlayGenerator {
|
||||
|
||||
private final DrawableImage[] images;
|
||||
|
||||
public Generator(float alpha, DrawableImage[] images) {
|
||||
super(alpha);
|
||||
this.images = images;
|
||||
super(alpha, images);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
Loading…
Add table
Reference in a new issue