Issue #239 Fixed mosaic bug, refactored dispatching colormap images so

mosaic could resuse

Former-commit-id: 40ca446e53 [formerly aea5c30443970933bf1517ced6d7e91a1008c9d5]
Former-commit-id: 29184d46ce
This commit is contained in:
Max Schenkelberg 2012-04-17 13:09:07 -05:00
parent 9a81f16961
commit a82f07b25d
14 changed files with 256 additions and 284 deletions

View file

@ -4,6 +4,7 @@ import java.nio.Buffer;
import com.raytheon.uf.viz.core.IExtent;
import com.raytheon.uf.viz.core.drawables.ColorMapParameters;
import com.raytheon.uf.viz.core.drawables.IColormappedImage;
import com.raytheon.uf.viz.core.drawables.IImage;
import com.raytheon.uf.viz.core.drawables.ext.GraphicsExtension.IGraphicsExtensionInterface;
import com.raytheon.uf.viz.core.exception.VizException;
@ -61,8 +62,9 @@ public interface IOffscreenRenderingExtension extends
* @return
* @throws VizException
*/
public IImage constructOffscreenImage(Class<? extends Buffer> dataType,
int[] dimensions) throws VizException;
public IColormappedImage constructOffscreenImage(
Class<? extends Buffer> dataType, int[] dimensions)
throws VizException;
/**
* Construct an offscreen image for given Buffer type and size, applying
@ -74,7 +76,7 @@ public interface IOffscreenRenderingExtension extends
* @return
* @throws VizException
*/
public IImage constructOffscreenImage(Class<? extends Buffer> dataType,
int[] dimensions, ColorMapParameters parameters)
throws VizException;
public IColormappedImage constructOffscreenImage(
Class<? extends Buffer> dataType, int[] dimensions,
ColorMapParameters parameters) throws VizException;
}

View file

@ -23,8 +23,8 @@ import java.util.ArrayList;
import java.util.Collection;
import java.util.Collections;
import java.util.Comparator;
import java.util.HashSet;
import java.util.Iterator;
import java.util.LinkedHashSet;
import java.util.LinkedList;
import java.util.List;
import java.util.Set;
@ -98,10 +98,10 @@ public class ResourceList extends CopyOnWriteArrayList<ResourcePair> implements
};
public ResourceList() {
preAddListeners = new HashSet<AddListener>();
postAddListeners = new HashSet<AddListener>();
preRemoveListeners = new HashSet<RemoveListener>();
postRemoveListeners = new HashSet<RemoveListener>();
preAddListeners = new LinkedHashSet<AddListener>();
postAddListeners = new LinkedHashSet<AddListener>();
preRemoveListeners = new LinkedHashSet<RemoveListener>();
postRemoveListeners = new LinkedHashSet<RemoveListener>();
addPostAddListener(new AddListener() {
@Override

View file

@ -20,7 +20,9 @@
package com.raytheon.uf.viz.radar.gl.mosaic;
import com.raytheon.uf.viz.core.DrawableImage;
import com.raytheon.viz.core.gl.images.AbstractGLImage;
import com.raytheon.uf.viz.core.IExtent;
import com.raytheon.uf.viz.core.drawables.ColorMapParameters;
import com.raytheon.viz.core.gl.images.GLColormappedImage;
import com.raytheon.viz.core.gl.images.GLDelegateImage;
import com.raytheon.viz.radar.rsc.mosaic.ext.IRadarMosaicImageExtension.IMosaicImage;
@ -42,8 +44,8 @@ import com.raytheon.viz.radar.rsc.mosaic.ext.IRadarMosaicImageExtension.IMosaicI
* @version 1.0
*/
public class GLMosaicImage extends GLDelegateImage<AbstractGLImage> implements
IMosaicImage {
public class GLMosaicImage extends GLDelegateImage<GLColormappedImage>
implements IMosaicImage {
private DrawableImage[] images;
@ -51,14 +53,18 @@ public class GLMosaicImage extends GLDelegateImage<AbstractGLImage> implements
private int[] bounds;
private IExtent extent;
/**
* @param target
* @param image
* @param extensionClass
*/
public GLMosaicImage(AbstractGLImage image, int[] bounds) {
public GLMosaicImage(GLColormappedImage image, int[] bounds,
IExtent imageExtent) {
super(image, GLRadarMosaicImageExtension.class);
this.bounds = bounds;
this.extent = imageExtent;
}
/*
@ -104,4 +110,56 @@ public class GLMosaicImage extends GLDelegateImage<AbstractGLImage> implements
this.images = images;
repaint = true;
}
/*
* (non-Javadoc)
*
* @see
* com.raytheon.viz.radar.rsc.mosaic.ext.IRadarMosaicImageExtension.IMosaicImage
* #setImageExtent(com.raytheon.uf.viz.core.IExtent)
*/
@Override
public void setImageExtent(IExtent imageExtent) {
this.extent = imageExtent;
}
public IExtent getImageExtent() {
return extent;
}
/*
* (non-Javadoc)
*
* @see
* com.raytheon.uf.viz.core.drawables.IColormappedImage#getColorMapParameters
* ()
*/
@Override
public ColorMapParameters getColorMapParameters() {
return image.getColorMapParameters();
}
/*
* (non-Javadoc)
*
* @see
* com.raytheon.uf.viz.core.drawables.IColormappedImage#setColorMapParameters
* (com.raytheon.uf.viz.core.drawables.ColorMapParameters)
*/
@Override
public void setColorMapParameters(ColorMapParameters params) {
image.setColorMapParameters(params);
}
/*
* (non-Javadoc)
*
* @see com.raytheon.uf.viz.core.drawables.IColormappedImage#getValue(int,
* int)
*/
@Override
public double getValue(int x, int y) {
return image.getValue(x, y);
}
}

View file

@ -24,6 +24,7 @@ import java.nio.ByteBuffer;
import javax.media.opengl.GL;
import com.raytheon.uf.viz.core.DrawableImage;
import com.raytheon.uf.viz.core.IExtent;
import com.raytheon.uf.viz.core.PixelCoverage;
import com.raytheon.uf.viz.core.drawables.ColorMapParameters;
import com.raytheon.uf.viz.core.drawables.IImage;
@ -60,10 +61,11 @@ public class GLRadarMosaicImageExtension extends AbstractGLSLImagingExtension
private AbstractGLImage writeToImage;
public GLMosaicImage initializeRaster(int[] imageBounds,
ColorMapParameters params) throws VizException {
IExtent imageExtent, ColorMapParameters params) throws VizException {
return new GLMosaicImage(target.getExtension(
GLOffscreenRenderingExtension.class).constructOffscreenImage(
ByteBuffer.class, imageBounds, params), imageBounds);
ByteBuffer.class, imageBounds, params), imageBounds,
imageExtent);
}
/*
@ -96,14 +98,23 @@ public class GLRadarMosaicImageExtension extends AbstractGLSLImagingExtension
IOffscreenRenderingExtension extension = target
.getExtension(IOffscreenRenderingExtension.class);
try {
extension.renderOffscreen(mosaicImage);
extension.renderOffscreen(mosaicImage,
mosaicImage.getImageExtent());
DrawableImage[] imagesToMosaic = mosaicImage
.getImagesToMosaic();
// Make sure images are staged before we mosaic them
ImagingSupport.prepareImages(target, imagesToMosaic);
// Need to set repaint based on if drawing completed
mosaicImage.setRepaint(drawRasters(paintProps,
imagesToMosaic) == false);
boolean allPainted = true;
// Each image needs to draw separately due to gl issues when
// zoomed in very far, rendered parts near the corners don't
// show all the pixels for each image. Pushing and popping
// GL_TEXTURE_BIT before/after each render fixes this issue
for (DrawableImage di : imagesToMosaic) {
allPainted &= drawRasters(paintProps, di);
}
// Need to set repaint based on if drawing completed.
mosaicImage.setRepaint(allPainted == false);
} finally {
extension.renderOnscreen();
}
@ -117,7 +128,7 @@ public class GLRadarMosaicImageExtension extends AbstractGLSLImagingExtension
} else {
GL gl = target.getGl();
// activate on texture2 as 0 is radar image and 1 is colormap
gl.glActiveTexture(GL.GL_TEXTURE2);
gl.glActiveTexture(GL.GL_TEXTURE1);
gl.glBindTexture(writeToImage.getTextureStorageType(),
writeToImage.getTextureid());
return image;
@ -136,8 +147,8 @@ public class GLRadarMosaicImageExtension extends AbstractGLSLImagingExtension
public void postImageRender(PaintProperties paintProps,
AbstractGLImage image, Object data) throws VizException {
GL gl = target.getGl();
// activate on texture2 as 0 is radar image and 1 is colormap
gl.glActiveTexture(GL.GL_TEXTURE2);
// activate on texture2 as 0 is radar image
gl.glActiveTexture(GL.GL_TEXTURE1);
gl.glBindTexture(writeToImage.getTextureStorageType(), 0);
}
@ -154,7 +165,7 @@ public class GLRadarMosaicImageExtension extends AbstractGLSLImagingExtension
public void loadShaderData(GLShaderProgram program, IImage image,
PaintProperties paintProps) throws VizException {
program.setUniform("radarData", 0);
program.setUniform("mosaicTexture", 2);
program.setUniform("mosaicTexture", 1);
// pass in width and height
program.setUniform("height", (paintProps.getCanvasBounds().height));

View file

@ -25,4 +25,5 @@ Export-Package: com.raytheon.uf.viz.remote.graphics,
com.raytheon.uf.viz.remote.graphics.events.mesh,
com.raytheon.uf.viz.remote.graphics.events.offscreen,
com.raytheon.uf.viz.remote.graphics.events.wireframe,
com.raytheon.uf.viz.remote.graphics.extensions
com.raytheon.uf.viz.remote.graphics.extensions,
com.raytheon.uf.viz.remote.graphics.objects

View file

@ -24,8 +24,10 @@ import com.raytheon.uf.viz.core.drawables.ColorMapParameters;
import com.raytheon.uf.viz.core.drawables.IColormappedImage;
import com.raytheon.uf.viz.core.drawables.ext.colormap.IColormappedImageExtension;
import com.raytheon.uf.viz.core.exception.VizException;
import com.raytheon.uf.viz.remote.graphics.events.RemoteGraphicsEventFactory;
import com.raytheon.uf.viz.remote.graphics.events.colormap.ColorMapDataEvent;
import com.raytheon.uf.viz.remote.graphics.events.colormap.CreateColormappedImageEvent;
import com.raytheon.uf.viz.remote.graphics.objects.DispatchingColormappedImage;
import com.raytheon.uf.viz.remote.graphics.objects.DispatchingColormappedImage.DispatchingColormappedCallback;
/**
* TODO Add Description
@ -47,6 +49,35 @@ import com.raytheon.uf.viz.remote.graphics.objects.DispatchingColormappedImage.D
public class DispatchColormappedImageExtension extends
AbstractDispatchingImageExtension implements IColormappedImageExtension {
public class DispatchingColormappedCallback implements
IColorMapDataRetrievalCallback {
private IColorMapDataRetrievalCallback callback;
private DispatchingColormappedImage<?> image;
public DispatchingColormappedCallback(
IColorMapDataRetrievalCallback callback) {
this.callback = callback;
}
/*
* (non-Javadoc)
*
* @see com.raytheon.uf.viz.core.data.IColorMapDataRetrievalCallback#
* getColorMapData()
*/
@Override
public ColorMapData getColorMapData() throws VizException {
ColorMapData data = callback.getColorMapData();
ColorMapDataEvent event = RemoteGraphicsEventFactory.createEvent(
ColorMapDataEvent.class, image);
event.setColorMapData(data);
image.dispatch(event);
return data;
}
}
/*
* (non-Javadoc)
*
@ -73,8 +104,22 @@ public class DispatchColormappedImageExtension extends
dataCallback);
IColormappedImage actualImage = targetExt.initializeRaster(wrapper,
colorMapParameters);
return new DispatchingColormappedImage(actualImage, wrapper,
target.getDispatcher());
DispatchingColormappedImage<IColormappedImage> image = new DispatchingColormappedImage<IColormappedImage>(
actualImage, DispatchColormappedImageExtension.class,
target.getDispatcher(), colorMapParameters);
wrapper.image = image;
// Send creation event
CreateColormappedImageEvent creation = RemoteGraphicsEventFactory
.createEvent(CreateColormappedImageEvent.class, image);
if (colorMapParameters != null) {
creation.setColorMapParameters(DispatchingColormappedImage
.createColorMapParametersUpdateEvent(image));
}
target.dispatch(creation);
// Return image
return image;
}
}

View file

@ -23,6 +23,7 @@ import java.nio.Buffer;
import com.raytheon.uf.viz.core.IExtent;
import com.raytheon.uf.viz.core.drawables.ColorMapParameters;
import com.raytheon.uf.viz.core.drawables.IColormappedImage;
import com.raytheon.uf.viz.core.drawables.IImage;
import com.raytheon.uf.viz.core.drawables.ext.GraphicsExtension;
import com.raytheon.uf.viz.core.drawables.ext.IOffscreenRenderingExtension;
@ -34,7 +35,8 @@ import com.raytheon.uf.viz.remote.graphics.events.offscreen.CreateOffscreenImage
import com.raytheon.uf.viz.remote.graphics.events.offscreen.RenderOffscreenEvent;
import com.raytheon.uf.viz.remote.graphics.events.offscreen.RenderOnscreenEvent;
import com.raytheon.uf.viz.remote.graphics.objects.AbstractDispatchingImage;
import com.raytheon.uf.viz.remote.graphics.objects.DispatchingOffscreenImage;
import com.raytheon.uf.viz.remote.graphics.objects.DispatchingColormappedImage;
import com.raytheon.uf.viz.remote.graphics.objects.DispatchingImage;
/**
* Offscreen rendering extension that creates remote images for offscreen
@ -127,8 +129,9 @@ public class DispatchingOffscreenRenderingExtension extends
* constructOffscreenImage(java.lang.Class, int[])
*/
@Override
public IImage constructOffscreenImage(Class<? extends Buffer> dataType,
int[] dimensions) throws VizException {
public IColormappedImage constructOffscreenImage(
Class<? extends Buffer> dataType, int[] dimensions)
throws VizException {
return constructOffscreenImage(dataType, dimensions, null);
}
@ -140,21 +143,30 @@ public class DispatchingOffscreenRenderingExtension extends
* com.raytheon.uf.viz.core.drawables.ColorMapParameters)
*/
@Override
public IImage constructOffscreenImage(Class<? extends Buffer> dataType,
int[] dimensions, ColorMapParameters parameters)
throws VizException {
IImage offscreenImage = target.getWrappedObject()
public IColormappedImage constructOffscreenImage(
Class<? extends Buffer> dataType, int[] dimensions,
ColorMapParameters parameters) throws VizException {
IColormappedImage offscreenImage = target.getWrappedObject()
.getExtension(IOffscreenRenderingExtension.class)
.constructOffscreenImage(dataType, dimensions, parameters);
return createOffscreenImage(offscreenImage, dataType, dimensions,
parameters);
return (IColormappedImage) createOffscreenImage(offscreenImage,
dataType, dimensions, parameters);
}
private DispatchingOffscreenImage createOffscreenImage(IImage wrapped,
private IImage createOffscreenImage(IImage wrapped,
Class<? extends Buffer> dataType, int[] dimensions,
ColorMapParameters parameters) {
DispatchingOffscreenImage wrapper = new DispatchingOffscreenImage(
wrapped, target.getDispatcher(), parameters);
AbstractDispatchingImage<?> wrapper = null;
if (dataType == null) {
wrapper = new DispatchingImage(wrapped,
DispatchingImagingExtension.class, null,
target.getDispatcher());
} else {
wrapper = new DispatchingColormappedImage<IColormappedImage>(
(IColormappedImage) wrapped,
DispatchColormappedImageExtension.class,
target.getDispatcher(), parameters);
}
// Send event of offscreen image creation
CreateOffscreenImageEvent event = RemoteGraphicsEventFactory
.createEvent(CreateOffscreenImageEvent.class, wrapper);

View file

@ -1,99 +0,0 @@
/**
* This software was developed and / or modified by Raytheon Company,
* pursuant to Contract DG133W-05-CQ-1067 with the US Government.
*
* U.S. EXPORT CONTROLLED TECHNICAL DATA
* This software product contains export-restricted data whose
* export/transfer/disclosure is restricted by U.S. law. Dissemination
* to non-U.S. persons whether in the United States or abroad requires
* an export license or other authorization.
*
* Contractor Name: Raytheon Company
* Contractor Address: 6825 Pine Street, Suite 340
* Mail Stop B8
* Omaha, NE 68106
* 402.291.0100
*
* See the AWIPS II Master Rights File ("Master Rights File.pdf") for
* further licensing information.
**/
package com.raytheon.uf.viz.remote.graphics.objects;
import com.raytheon.uf.common.colormap.IColorMap;
import com.raytheon.uf.viz.core.drawables.ColorMapParameters;
import com.raytheon.uf.viz.core.drawables.IColorMapParametersListener;
import com.raytheon.uf.viz.core.drawables.IImage;
import com.raytheon.uf.viz.core.drawables.ext.IImagingExtension;
import com.raytheon.uf.viz.remote.graphics.Dispatcher;
import com.raytheon.uf.viz.remote.graphics.events.colormap.UpdateColorMapParametersEvent;
/**
* TODO Add Description
*
* <pre>
*
* SOFTWARE HISTORY
*
* Date Ticket# Engineer Description
* ------------ ---------- ----------- --------------------------
* Mar 29, 2012 mschenke Initial creation
*
* </pre>
*
* @author mschenke
* @version 1.0
*/
public abstract class AbstractDispatchingColormappedImage<T extends IImage>
extends AbstractDispatchingImage<T> implements
IColorMapParametersListener {
private IColorMap colorMap;
/**
* @param targetObject
* @param extensionClass
* @param dispatcher
*/
public AbstractDispatchingColormappedImage(T targetObject,
Class<? extends IImagingExtension> extensionClass,
Dispatcher dispatcher, ColorMapParameters parameters) {
super(targetObject, extensionClass, dispatcher);
if (parameters != null) {
parameters.addListener(this);
}
}
public abstract ColorMapParameters getColorMapParameters();
/*
* (non-Javadoc)
*
* @see com.raytheon.uf.viz.core.drawables.IColorMapParametersListener#
* colorMapChanged()
*/
@Override
public void colorMapChanged() {
ColorMapParameters parameters = getColorMapParameters();
if (parameters != null) {
dispatch(createColorMapParametersUpdateEvent(parameters));
}
}
protected UpdateColorMapParametersEvent createColorMapParametersUpdateEvent(
ColorMapParameters parameters) {
UpdateColorMapParametersEvent event = UpdateColorMapParametersEvent
.createEvent(this, parameters);
if (parameters.getColorMap() == colorMap && colorMap != null) {
// Same colormap, discard cm data
event.setRed(null);
event.setBlue(null);
event.setGreen(null);
event.setAlpha(null);
} else {
colorMap = parameters.getColorMap();
}
return event;
}
}

View file

@ -19,15 +19,13 @@
**/
package com.raytheon.uf.viz.remote.graphics.objects;
import com.raytheon.uf.viz.core.data.IColorMapDataRetrievalCallback;
import com.raytheon.uf.common.colormap.IColorMap;
import com.raytheon.uf.viz.core.drawables.ColorMapParameters;
import com.raytheon.uf.viz.core.drawables.IColorMapParametersListener;
import com.raytheon.uf.viz.core.drawables.IColormappedImage;
import com.raytheon.uf.viz.core.exception.VizException;
import com.raytheon.uf.viz.core.drawables.ext.IImagingExtension;
import com.raytheon.uf.viz.remote.graphics.Dispatcher;
import com.raytheon.uf.viz.remote.graphics.events.RemoteGraphicsEventFactory;
import com.raytheon.uf.viz.remote.graphics.events.colormap.ColorMapDataEvent;
import com.raytheon.uf.viz.remote.graphics.events.colormap.CreateColormappedImageEvent;
import com.raytheon.uf.viz.remote.graphics.extensions.DispatchColormappedImageExtension;
import com.raytheon.uf.viz.remote.graphics.events.colormap.UpdateColorMapParametersEvent;
/**
* Dispatching colormapped image object created from graphics image and forwards
@ -47,58 +45,24 @@ import com.raytheon.uf.viz.remote.graphics.extensions.DispatchColormappedImageEx
* @version 1.0
*/
public class DispatchingColormappedImage extends
AbstractDispatchingColormappedImage<IColormappedImage> implements
public class DispatchingColormappedImage<T extends IColormappedImage> extends
AbstractDispatchingImage<T> implements IColorMapParametersListener,
IColormappedImage {
public static class DispatchingColormappedCallback implements
IColorMapDataRetrievalCallback {
private IColorMapDataRetrievalCallback callback;
private DispatchingColormappedImage image;
public DispatchingColormappedCallback(
IColorMapDataRetrievalCallback callback) {
this.callback = callback;
}
/*
* (non-Javadoc)
*
* @see com.raytheon.uf.viz.core.data.IColorMapDataRetrievalCallback#
* getColorMapData()
*/
@Override
public ColorMapData getColorMapData() throws VizException {
ColorMapData data = callback.getColorMapData();
ColorMapDataEvent event = RemoteGraphicsEventFactory.createEvent(
ColorMapDataEvent.class, image);
event.setColorMapData(data);
image.dispatch(event);
return data;
}
}
private IColorMap colorMap;
/**
* @param targetObject
* @param extensionClass
* @param dispatcher
*/
public DispatchingColormappedImage(IColormappedImage targetObject,
DispatchingColormappedCallback callback, Dispatcher dispatcher) {
super(targetObject, DispatchColormappedImageExtension.class,
dispatcher, targetObject.getColorMapParameters());
callback.image = this;
ColorMapParameters parameters = targetObject.getColorMapParameters();
// Send creation event
CreateColormappedImageEvent creation = RemoteGraphicsEventFactory
.createEvent(CreateColormappedImageEvent.class, this);
public DispatchingColormappedImage(T targetObject,
Class<? extends IImagingExtension> extensionClass,
Dispatcher dispatcher, ColorMapParameters parameters) {
super(targetObject, extensionClass, dispatcher);
if (parameters != null) {
creation.setColorMapParameters(createColorMapParametersUpdateEvent(parameters));
parameters.addListener(this);
}
dispatch(creation);
}
/*
@ -130,7 +94,7 @@ public class DispatchingColormappedImage extends
wrappedObject.setColorMapParameters(params);
if (params != null) {
params.addListener(this);
dispatch(createColorMapParametersUpdateEvent(params));
dispatch(createColorMapParametersUpdateEvent(this));
}
}
}
@ -146,4 +110,52 @@ public class DispatchingColormappedImage extends
return wrappedObject.getValue(x, y);
}
/*
* (non-Javadoc)
*
* @see com.raytheon.uf.viz.core.drawables.IColorMapParametersListener#
* colorMapChanged()
*/
@Override
public void colorMapChanged() {
ColorMapParameters parameters = getColorMapParameters();
if (parameters != null) {
dispatch(createColorMapParametersUpdateEvent(this));
}
}
public static UpdateColorMapParametersEvent createColorMapParametersUpdateEvent(
DispatchingColormappedImage<?> image) {
ColorMapParameters parameters = image.getColorMapParameters();
UpdateColorMapParametersEvent event = UpdateColorMapParametersEvent
.createEvent(image, parameters);
if (parameters.getColorMap() == image.colorMap
&& image.colorMap != null) {
// Same colormap, discard cm data
event.setRed(null);
event.setBlue(null);
event.setGreen(null);
event.setAlpha(null);
} else {
image.colorMap = parameters.getColorMap();
}
return event;
}
/*
* (non-Javadoc)
*
* @see
* com.raytheon.uf.viz.remote.graphics.objects.AbstractDispatchingImage#
* dispose()
*/
@Override
public void dispose() {
super.dispose();
ColorMapParameters params = getColorMapParameters();
if (params != null) {
params.removeListener(this);
}
}
}

View file

@ -84,7 +84,9 @@ public class DispatchingImage extends AbstractDispatchingImage<IImage> {
Class<? extends IImagingExtension> extension,
DispatchingRenderedImageCallback callback, Dispatcher dispatcher) {
super(targetObject, extension, dispatcher);
callback.image = this;
if (callback != null) {
callback.image = this;
}
}
}

View file

@ -1,87 +0,0 @@
/**
* This software was developed and / or modified by Raytheon Company,
* pursuant to Contract DG133W-05-CQ-1067 with the US Government.
*
* U.S. EXPORT CONTROLLED TECHNICAL DATA
* This software product contains export-restricted data whose
* export/transfer/disclosure is restricted by U.S. law. Dissemination
* to non-U.S. persons whether in the United States or abroad requires
* an export license or other authorization.
*
* Contractor Name: Raytheon Company
* Contractor Address: 6825 Pine Street, Suite 340
* Mail Stop B8
* Omaha, NE 68106
* 402.291.0100
*
* See the AWIPS II Master Rights File ("Master Rights File.pdf") for
* further licensing information.
**/
package com.raytheon.uf.viz.remote.graphics.objects;
import com.raytheon.uf.viz.core.drawables.ColorMapParameters;
import com.raytheon.uf.viz.core.drawables.IImage;
import com.raytheon.uf.viz.remote.graphics.Dispatcher;
import com.raytheon.uf.viz.remote.graphics.extensions.DispatchingImagingExtension;
/**
* TODO Add Description
*
* <pre>
*
* SOFTWARE HISTORY
*
* Date Ticket# Engineer Description
* ------------ ---------- ----------- --------------------------
* Mar 29, 2012 mschenke Initial creation
*
* </pre>
*
* @author mschenke
* @version 1.0
*/
public class DispatchingOffscreenImage extends
AbstractDispatchingColormappedImage<IImage> {
private ColorMapParameters parameters;
/**
* @param targetObject
* @param extensionClass
* @param dispatcher
*/
public DispatchingOffscreenImage(IImage targetObject,
Dispatcher dispatcher, ColorMapParameters parameters) {
super(targetObject, DispatchingImagingExtension.class, dispatcher,
parameters);
this.parameters = parameters;
}
/*
* (non-Javadoc)
*
* @see com.raytheon.uf.viz.remote.graphics.objects.
* AbstractDispatchingColormappedImage#getColorMapParameters()
*/
@Override
public ColorMapParameters getColorMapParameters() {
return parameters;
}
/*
* (non-Javadoc)
*
* @see
* com.raytheon.uf.viz.remote.graphics.objects.AbstractDispatchingImage#
* dispose()
*/
@Override
public void dispose() {
super.dispose();
if (parameters != null) {
parameters.removeListener(this);
}
}
}

View file

@ -23,6 +23,7 @@ import com.raytheon.viz.core.gl.dataformat.AbstractGLColorMapDataFormat;
import com.raytheon.viz.core.gl.dataformat.GLByteDataFormat;
import com.raytheon.viz.core.gl.dataformat.IGLColorMapDataFormatProvider;
import com.raytheon.viz.core.gl.images.AbstractGLImage;
import com.raytheon.viz.core.gl.images.GLColormappedImage;
import com.raytheon.viz.core.gl.internal.GLView2D;
import com.raytheon.viz.core.gl.internal.ext.GLColormappedImageExtension;
@ -163,7 +164,7 @@ public class GLOffscreenRenderingExtension extends GraphicsExtension<IGLTarget>
* constructOffscreenImage(java.lang.Class, java.awt.Rectangle)
*/
@Override
public AbstractGLImage constructOffscreenImage(
public GLColormappedImage constructOffscreenImage(
Class<? extends Buffer> dataType, int[] dimensions)
throws VizException {
return constructOffscreenImage(dataType, dimensions, null);
@ -176,7 +177,7 @@ public class GLOffscreenRenderingExtension extends GraphicsExtension<IGLTarget>
* constructOffscreenImage(java.lang.Class, java.awt.Rectangle)
*/
@Override
public AbstractGLImage constructOffscreenImage(
public GLColormappedImage constructOffscreenImage(
Class<? extends Buffer> dataType, final int[] dimensions,
ColorMapParameters parameters) throws VizException {
int width = dimensions[0];
@ -193,7 +194,7 @@ public class GLOffscreenRenderingExtension extends GraphicsExtension<IGLTarget>
}
if (imageBuffer != null) {
AbstractGLImage image = null;
GLColormappedImage image = null;
final Buffer buffer = imageBuffer;
GLColormappedImageExtension cmapExt = target
.getExtension(GLColormappedImageExtension.class);

View file

@ -149,6 +149,7 @@ public class RadarMosaicRenderer implements IRadarMosaicRenderer,
writeTo.setImagesToMosaic(images
.toArray(new DrawableImage[images.size()]));
lastExtent = paintProps.getView().getExtent().clone();
writeTo.setImageExtent(lastExtent);
Coordinate ul = new Coordinate(lastExtent.getMinX(),
lastExtent.getMaxY());
@ -180,7 +181,8 @@ public class RadarMosaicRenderer implements IRadarMosaicRenderer,
writeTo = target.getExtension(IRadarMosaicImageExtension.class)
.initializeRaster(
new int[] { paintProps.getCanvasBounds().width,
paintProps.getCanvasBounds().height }, params);
paintProps.getCanvasBounds().height },
paintProps.getView().getExtent(), params);
}
@Override

View file

@ -20,8 +20,9 @@
package com.raytheon.viz.radar.rsc.mosaic.ext;
import com.raytheon.uf.viz.core.DrawableImage;
import com.raytheon.uf.viz.core.IExtent;
import com.raytheon.uf.viz.core.drawables.ColorMapParameters;
import com.raytheon.uf.viz.core.drawables.IImage;
import com.raytheon.uf.viz.core.drawables.IColormappedImage;
import com.raytheon.uf.viz.core.drawables.ext.IImagingExtension;
import com.raytheon.uf.viz.core.exception.VizException;
@ -44,13 +45,24 @@ import com.raytheon.uf.viz.core.exception.VizException;
public interface IRadarMosaicImageExtension extends IImagingExtension {
public static interface IMosaicImage extends IImage {
public static interface IMosaicImage extends IColormappedImage {
public void setImagesToMosaic(DrawableImage... images);
public void setImageExtent(IExtent imageExtent);
}
/**
* Creates a mosaic image with the given imageBounds and imageExtent
*
* @param imageBounds
* @param imageExtent
* @param params
* @return
* @throws VizException
*/
public IMosaicImage initializeRaster(int[] imageBounds,
ColorMapParameters params) throws VizException;
IExtent imageExtent, ColorMapParameters params) throws VizException;
}