Issue #239 Got plots working
Former-commit-id:859262ea98
[formerly859262ea98
[formerly 9c93f3670bd8c3a7a5e5330b160d5f2206b979b3]] Former-commit-id:04ab27895d
Former-commit-id:adba2b8aeb
This commit is contained in:
parent
95b91438ff
commit
9b5481968f
12 changed files with 551 additions and 52 deletions
|
@ -56,7 +56,7 @@ public class CollaborationDisposingHandler {
|
|||
}
|
||||
|
||||
@Subscribe
|
||||
public void disposed(ColorMapDataCallback callback) {
|
||||
public void disposeColorMapCallback(ColorMapDataCallback callback) {
|
||||
callback.setData(null);
|
||||
}
|
||||
|
||||
|
|
|
@ -43,6 +43,8 @@ import com.raytheon.uf.viz.core.drawables.IImage;
|
|||
import com.raytheon.uf.viz.core.drawables.IWireframeShape;
|
||||
import com.raytheon.uf.viz.core.drawables.PaintProperties;
|
||||
import com.raytheon.uf.viz.core.drawables.ext.IOffscreenRenderingExtension;
|
||||
import com.raytheon.uf.viz.core.drawables.ext.ISingleColorImageExtension;
|
||||
import com.raytheon.uf.viz.core.drawables.ext.ISingleColorImageExtension.ISingleColorImage;
|
||||
import com.raytheon.uf.viz.core.drawables.ext.colormap.IColormappedImageExtension;
|
||||
import com.raytheon.uf.viz.core.exception.VizException;
|
||||
import com.raytheon.uf.viz.core.map.IMapMeshExtension;
|
||||
|
@ -53,9 +55,11 @@ import com.raytheon.uf.viz.remote.graphics.events.colormap.CreateColormappedImag
|
|||
import com.raytheon.uf.viz.remote.graphics.events.colormap.UpdateColorMapParametersEvent;
|
||||
import com.raytheon.uf.viz.remote.graphics.events.fonts.CreateFontEvent;
|
||||
import com.raytheon.uf.viz.remote.graphics.events.fonts.UpdateFontDataEvent;
|
||||
import com.raytheon.uf.viz.remote.graphics.events.imagery.CreateSingleColorImage;
|
||||
import com.raytheon.uf.viz.remote.graphics.events.imagery.PaintImageEvent;
|
||||
import com.raytheon.uf.viz.remote.graphics.events.imagery.PaintImagesEvent;
|
||||
import com.raytheon.uf.viz.remote.graphics.events.imagery.UpdateImageDataEvent;
|
||||
import com.raytheon.uf.viz.remote.graphics.events.imagery.UpdateSingleColorImage;
|
||||
import com.raytheon.uf.viz.remote.graphics.events.mesh.CreateMeshEvent;
|
||||
import com.raytheon.uf.viz.remote.graphics.events.mesh.ReprojectMeshEvent;
|
||||
import com.raytheon.uf.viz.remote.graphics.events.offscreen.CreateOffscreenImageEvent;
|
||||
|
@ -186,7 +190,7 @@ public class CollaborationRenderingHandler {
|
|||
*/
|
||||
@Subscribe
|
||||
public void disposeRenderable(DisposeObjectEvent event) {
|
||||
Object[] toDispose = renderableObjectMap.remove(event);
|
||||
Object[] toDispose = renderableObjectMap.remove(event.getObjectId());
|
||||
if (toDispose != null) {
|
||||
dispose(toDispose);
|
||||
}
|
||||
|
@ -517,4 +521,25 @@ public class CollaborationRenderingHandler {
|
|||
font.setScaleFont(event.getScaleFont());
|
||||
}
|
||||
}
|
||||
|
||||
// ================== ISingleColorImage events ==================
|
||||
|
||||
@Subscribe
|
||||
public void createSingleColorImage(CreateSingleColorImage event)
|
||||
throws VizException {
|
||||
int imageId = event.getObjectId();
|
||||
ISingleColorImage image = target.getExtension(
|
||||
ISingleColorImageExtension.class).constructImage(
|
||||
event.getRenderedImage(), event.getColor());
|
||||
putRenderableObject(imageId, image);
|
||||
}
|
||||
|
||||
@Subscribe
|
||||
public void updateSingleColorImage(UpdateSingleColorImage event) {
|
||||
ISingleColorImage image = getRenderableObject(event.getObjectId(),
|
||||
ISingleColorImage.class);
|
||||
if (image != null) {
|
||||
image.setColor(event.getColor());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -6,6 +6,7 @@ Bundle-Version: 1.0.0.qualifier
|
|||
Bundle-Activator: com.raytheon.uf.viz.remote.graphics.Activator
|
||||
Bundle-Vendor: RAYTHEON
|
||||
Eclipse-RegisterBuddy: com.raytheon.uf.viz.core
|
||||
Eclipse-BuddyPolicy: ext, global
|
||||
Require-Bundle: org.eclipse.ui,
|
||||
org.eclipse.core.runtime,
|
||||
com.raytheon.uf.viz.core;bundle-version="1.12.1174",
|
||||
|
@ -23,4 +24,5 @@ Export-Package: com.raytheon.uf.viz.remote.graphics,
|
|||
com.raytheon.uf.viz.remote.graphics.events.imagery,
|
||||
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.events.wireframe,
|
||||
com.raytheon.uf.viz.remote.graphics.extensions
|
||||
|
|
|
@ -34,5 +34,8 @@
|
|||
<graphicsExtension
|
||||
class="com.raytheon.uf.viz.remote.graphics.extensions.DispatchingImagingExtension">
|
||||
</graphicsExtension>
|
||||
<graphicsExtension
|
||||
class="com.raytheon.uf.viz.remote.graphics.extensions.DispatchingSingleColorImageExtension">
|
||||
</graphicsExtension>
|
||||
</extension>
|
||||
</plugin>
|
|
@ -70,6 +70,7 @@ import com.raytheon.uf.viz.remote.graphics.events.EndFrameEvent;
|
|||
import com.raytheon.uf.viz.remote.graphics.events.RemoteGraphicsEventFactory;
|
||||
import com.raytheon.uf.viz.remote.graphics.events.wireframe.CreateWireframeShapeEvent;
|
||||
import com.raytheon.uf.viz.remote.graphics.events.wireframe.RenderWireframeShapeEvent;
|
||||
import com.raytheon.uf.viz.remote.graphics.extensions.DispatchingImagingExtension;
|
||||
import com.raytheon.uf.viz.remote.graphics.objects.DispatchingFont;
|
||||
import com.raytheon.uf.viz.remote.graphics.objects.DispatchingImage;
|
||||
import com.raytheon.uf.viz.remote.graphics.objects.DispatchingImage.DispatchingRenderedImageCallback;
|
||||
|
@ -172,7 +173,8 @@ public class DispatchGraphicsTarget extends DispatchingObject<IGraphicsTarget>
|
|||
// Create image from wrapped target and return DispatchingImage
|
||||
return new DispatchingImage(
|
||||
wrappedObject.initializeRaster(wrappedCallback),
|
||||
wrappedCallback, getDispatcher());
|
||||
DispatchingImagingExtension.class, wrappedCallback,
|
||||
getDispatcher());
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -0,0 +1,78 @@
|
|||
/**
|
||||
* 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.events.imagery;
|
||||
|
||||
import java.awt.image.RenderedImage;
|
||||
|
||||
import com.raytheon.uf.common.serialization.annotations.DynamicSerialize;
|
||||
import com.raytheon.uf.common.serialization.annotations.DynamicSerializeElement;
|
||||
|
||||
/**
|
||||
* TODO Add Description
|
||||
*
|
||||
* <pre>
|
||||
*
|
||||
* SOFTWARE HISTORY
|
||||
*
|
||||
* Date Ticket# Engineer Description
|
||||
* ------------ ---------- ----------- --------------------------
|
||||
* Apr 13, 2012 mschenke Initial creation
|
||||
*
|
||||
* </pre>
|
||||
*
|
||||
* @author mschenke
|
||||
* @version 1.0
|
||||
*/
|
||||
@DynamicSerialize
|
||||
public class CreateSingleColorImage extends UpdateSingleColorImage {
|
||||
|
||||
@DynamicSerializeElement
|
||||
private RenderedImageWrapper wrapper = new RenderedImageWrapper();
|
||||
|
||||
/**
|
||||
* @return the wrapper
|
||||
*/
|
||||
public RenderedImageWrapper getWrapper() {
|
||||
return wrapper;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param wrapper
|
||||
* the wrapper to set
|
||||
*/
|
||||
public void setWrapper(RenderedImageWrapper wrapper) {
|
||||
this.wrapper = wrapper;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the renderedImage
|
||||
*/
|
||||
public RenderedImage getRenderedImage() {
|
||||
return wrapper.getWrappedImage();
|
||||
}
|
||||
|
||||
/**
|
||||
* @param renderedImage
|
||||
* the renderedImage to set
|
||||
*/
|
||||
public void setRenderedImage(RenderedImage renderedImage) {
|
||||
wrapper.setWrappedImage(renderedImage);
|
||||
}
|
||||
}
|
|
@ -20,13 +20,6 @@
|
|||
package com.raytheon.uf.viz.remote.graphics.events.imagery;
|
||||
|
||||
import java.awt.image.RenderedImage;
|
||||
import java.io.ByteArrayInputStream;
|
||||
import java.io.ByteArrayOutputStream;
|
||||
import java.io.IOException;
|
||||
import java.io.ObjectInputStream;
|
||||
import java.io.ObjectOutputStream;
|
||||
|
||||
import javax.media.jai.remote.SerializableRenderedImage;
|
||||
|
||||
import com.raytheon.uf.common.serialization.annotations.DynamicSerialize;
|
||||
import com.raytheon.uf.common.serialization.annotations.DynamicSerializeElement;
|
||||
|
@ -53,42 +46,28 @@ import com.raytheon.uf.viz.remote.graphics.events.AbstractDispatchingObjectEvent
|
|||
public class RenderedImageEvent extends AbstractDispatchingObjectEvent {
|
||||
|
||||
@DynamicSerializeElement
|
||||
private byte[] serializedRenderedImage;
|
||||
|
||||
private RenderedImage renderedImage;
|
||||
private RenderedImageWrapper wrapper = new RenderedImageWrapper();
|
||||
|
||||
/**
|
||||
* @return the renderedImage
|
||||
* @return the wrapper
|
||||
*/
|
||||
public byte[] getSerializedRenderedImage() {
|
||||
return serializedRenderedImage;
|
||||
public RenderedImageWrapper getWrapper() {
|
||||
return wrapper;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param renderedImage
|
||||
* the renderedImage to set
|
||||
* @param wrapper
|
||||
* the wrapper to set
|
||||
*/
|
||||
public void setSerializedRenderedImage(byte[] renderedImage) {
|
||||
this.serializedRenderedImage = renderedImage;
|
||||
public void setWrapper(RenderedImageWrapper wrapper) {
|
||||
this.wrapper = wrapper;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the renderedImage
|
||||
*/
|
||||
public RenderedImage getRenderedImage() {
|
||||
if (renderedImage == null && serializedRenderedImage != null) {
|
||||
// deserialize bytes into rendered image
|
||||
try {
|
||||
ObjectInputStream oin = new ObjectInputStream(
|
||||
new ByteArrayInputStream(serializedRenderedImage));
|
||||
renderedImage = (RenderedImage) oin.readObject();
|
||||
} catch (Exception e) {
|
||||
throw new RuntimeException(
|
||||
"Error deserializing rendered image: "
|
||||
+ e.getLocalizedMessage(), e);
|
||||
}
|
||||
}
|
||||
return renderedImage;
|
||||
return wrapper.getWrappedImage();
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -96,22 +75,7 @@ public class RenderedImageEvent extends AbstractDispatchingObjectEvent {
|
|||
* the renderedImage to set
|
||||
*/
|
||||
public void setRenderedImage(RenderedImage renderedImage) {
|
||||
if (this.renderedImage != renderedImage) {
|
||||
if (renderedImage instanceof SerializableRenderedImage == false) {
|
||||
renderedImage = new SerializableRenderedImage(renderedImage);
|
||||
}
|
||||
this.renderedImage = renderedImage;
|
||||
// serialize rendered image into bytes
|
||||
try {
|
||||
ByteArrayOutputStream bytes = new ByteArrayOutputStream();
|
||||
ObjectOutputStream oos = new ObjectOutputStream(bytes);
|
||||
oos.writeObject(renderedImage);
|
||||
serializedRenderedImage = bytes.toByteArray();
|
||||
} catch (IOException e) {
|
||||
throw new RuntimeException("Error serializing rendered image",
|
||||
e);
|
||||
}
|
||||
}
|
||||
wrapper.setWrappedImage(renderedImage);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -0,0 +1,136 @@
|
|||
/**
|
||||
* 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.events.imagery;
|
||||
|
||||
import java.awt.image.RenderedImage;
|
||||
import java.io.ByteArrayInputStream;
|
||||
import java.io.ByteArrayOutputStream;
|
||||
import java.io.IOException;
|
||||
import java.io.ObjectInputStream;
|
||||
import java.io.ObjectOutputStream;
|
||||
|
||||
import javax.media.jai.remote.SerializableRenderedImage;
|
||||
|
||||
import com.raytheon.uf.common.serialization.IDeserializationContext;
|
||||
import com.raytheon.uf.common.serialization.ISerializationContext;
|
||||
import com.raytheon.uf.common.serialization.ISerializationTypeAdapter;
|
||||
import com.raytheon.uf.common.serialization.SerializationException;
|
||||
import com.raytheon.uf.common.serialization.annotations.DynamicSerialize;
|
||||
import com.raytheon.uf.common.serialization.annotations.DynamicSerializeElement;
|
||||
import com.raytheon.uf.common.serialization.annotations.DynamicSerializeTypeAdapter;
|
||||
import com.raytheon.uf.viz.remote.graphics.events.imagery.RenderedImageWrapper.RenderedImageSerializer;
|
||||
|
||||
/**
|
||||
* Wraps a RenderedImage for dynamic serialization
|
||||
*
|
||||
* <pre>
|
||||
*
|
||||
* SOFTWARE HISTORY
|
||||
*
|
||||
* Date Ticket# Engineer Description
|
||||
* ------------ ---------- ----------- --------------------------
|
||||
* Apr 13, 2012 mschenke Initial creation
|
||||
*
|
||||
* </pre>
|
||||
*
|
||||
* @author mschenke
|
||||
* @version 1.0
|
||||
*/
|
||||
@DynamicSerialize
|
||||
@DynamicSerializeTypeAdapter(factory = RenderedImageSerializer.class)
|
||||
public class RenderedImageWrapper {
|
||||
|
||||
public static class RenderedImageSerializer implements
|
||||
ISerializationTypeAdapter<RenderedImageWrapper> {
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
*
|
||||
* @see
|
||||
* com.raytheon.uf.common.serialization.ISerializationTypeAdapter#serialize
|
||||
* (com.raytheon.uf.common.serialization.ISerializationContext,
|
||||
* java.lang.Object)
|
||||
*/
|
||||
@Override
|
||||
public void serialize(ISerializationContext serializer,
|
||||
RenderedImageWrapper object) throws SerializationException {
|
||||
RenderedImage image = object.getWrappedImage();
|
||||
if (image instanceof SerializableRenderedImage == false) {
|
||||
image = new SerializableRenderedImage(image);
|
||||
}
|
||||
// serialize rendered image into bytes
|
||||
try {
|
||||
ByteArrayOutputStream bytes = new ByteArrayOutputStream();
|
||||
ObjectOutputStream oos = new ObjectOutputStream(bytes);
|
||||
oos.writeObject(image);
|
||||
oos.close();
|
||||
serializer.writeBinary(bytes.toByteArray());
|
||||
} catch (IOException e) {
|
||||
throw new SerializationException(
|
||||
"Error serializing rendered image", e);
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
*
|
||||
* @see com.raytheon.uf.common.serialization.ISerializationTypeAdapter#
|
||||
* deserialize
|
||||
* (com.raytheon.uf.common.serialization.IDeserializationContext)
|
||||
*/
|
||||
@Override
|
||||
public RenderedImageWrapper deserialize(
|
||||
IDeserializationContext deserializer)
|
||||
throws SerializationException {
|
||||
RenderedImageWrapper wrapper = new RenderedImageWrapper();
|
||||
byte[] data = deserializer.readBinary();
|
||||
// deserialize bytes into rendered image
|
||||
try {
|
||||
ObjectInputStream oin = new ObjectInputStream(
|
||||
new ByteArrayInputStream(data));
|
||||
wrapper.setWrappedImage((RenderedImage) oin.readObject());
|
||||
oin.close();
|
||||
} catch (Exception e) {
|
||||
throw new SerializationException(
|
||||
"Error deserializing rendered image: "
|
||||
+ e.getLocalizedMessage(), e);
|
||||
}
|
||||
return wrapper;
|
||||
}
|
||||
}
|
||||
|
||||
@DynamicSerializeElement
|
||||
private RenderedImage wrappedImage;
|
||||
|
||||
/**
|
||||
* @return the wrappedImage
|
||||
*/
|
||||
public RenderedImage getWrappedImage() {
|
||||
return wrappedImage;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param wrappedImage
|
||||
* the wrappedImage to set
|
||||
*/
|
||||
public void setWrappedImage(RenderedImage wrappedImage) {
|
||||
this.wrappedImage = wrappedImage;
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,114 @@
|
|||
/**
|
||||
* 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.events.imagery;
|
||||
|
||||
import org.eclipse.swt.graphics.RGB;
|
||||
|
||||
import com.raytheon.uf.common.serialization.annotations.DynamicSerialize;
|
||||
import com.raytheon.uf.common.serialization.annotations.DynamicSerializeElement;
|
||||
import com.raytheon.uf.viz.remote.graphics.events.AbstractDispatchingObjectEvent;
|
||||
|
||||
/**
|
||||
* Creates a new single color image with given color or updates a single color
|
||||
* images color
|
||||
*
|
||||
* <pre>
|
||||
*
|
||||
* SOFTWARE HISTORY
|
||||
*
|
||||
* Date Ticket# Engineer Description
|
||||
* ------------ ---------- ----------- --------------------------
|
||||
* Apr 12, 2012 mschenke Initial creation
|
||||
*
|
||||
* </pre>
|
||||
*
|
||||
* @author mschenke
|
||||
* @version 1.0
|
||||
*/
|
||||
@DynamicSerialize
|
||||
public class UpdateSingleColorImage extends AbstractDispatchingObjectEvent {
|
||||
|
||||
@DynamicSerializeElement
|
||||
private int red;
|
||||
|
||||
@DynamicSerializeElement
|
||||
private int green;
|
||||
|
||||
@DynamicSerializeElement
|
||||
private int blue;
|
||||
|
||||
/**
|
||||
* @return the red
|
||||
*/
|
||||
public int getRed() {
|
||||
return red;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param red
|
||||
* the red to set
|
||||
*/
|
||||
public void setRed(int red) {
|
||||
this.red = red;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the green
|
||||
*/
|
||||
public int getGreen() {
|
||||
return green;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param green
|
||||
* the green to set
|
||||
*/
|
||||
public void setGreen(int green) {
|
||||
this.green = green;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the blue
|
||||
*/
|
||||
public int getBlue() {
|
||||
return blue;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param blue
|
||||
* the blue to set
|
||||
*/
|
||||
public void setBlue(int blue) {
|
||||
this.blue = blue;
|
||||
}
|
||||
|
||||
public void setColor(RGB color) {
|
||||
if (color != null) {
|
||||
red = color.red;
|
||||
green = color.green;
|
||||
blue = color.blue;
|
||||
}
|
||||
}
|
||||
|
||||
public RGB getColor() {
|
||||
return new RGB(red, green, blue);
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,72 @@
|
|||
/**
|
||||
* 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.extensions;
|
||||
|
||||
import java.awt.image.RenderedImage;
|
||||
|
||||
import org.eclipse.swt.graphics.RGB;
|
||||
|
||||
import com.raytheon.uf.viz.core.drawables.ext.ISingleColorImageExtension;
|
||||
import com.raytheon.uf.viz.core.exception.VizException;
|
||||
import com.raytheon.uf.viz.remote.graphics.objects.DispatchingSingleColorImage;
|
||||
|
||||
/**
|
||||
* TODO Add Description
|
||||
*
|
||||
* <pre>
|
||||
*
|
||||
* SOFTWARE HISTORY
|
||||
*
|
||||
* Date Ticket# Engineer Description
|
||||
* ------------ ---------- ----------- --------------------------
|
||||
* Apr 12, 2012 mschenke Initial creation
|
||||
*
|
||||
* </pre>
|
||||
*
|
||||
* @author mschenke
|
||||
* @version 1.0
|
||||
*/
|
||||
|
||||
public class DispatchingSingleColorImageExtension extends
|
||||
AbstractDispatchingImageExtension implements ISingleColorImageExtension {
|
||||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
*
|
||||
* @see com.raytheon.uf.viz.core.drawables.ext.ISingleColorImageExtension#
|
||||
* constructImage(java.awt.image.RenderedImage,
|
||||
* org.eclipse.swt.graphics.RGB)
|
||||
*/
|
||||
@Override
|
||||
public ISingleColorImage constructImage(RenderedImage image, RGB color) {
|
||||
try {
|
||||
return new DispatchingSingleColorImage(target.getWrappedObject()
|
||||
.getExtension(ISingleColorImageExtension.class)
|
||||
.constructImage(image, color),
|
||||
DispatchColormappedImageExtension.class,
|
||||
target.getDispatcher(), color,
|
||||
new RenderedImage[] { image });
|
||||
} catch (VizException e) {
|
||||
throw new RuntimeException(
|
||||
"Error constring dispatching single color image", e);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
|
@ -23,11 +23,11 @@ import java.awt.image.RenderedImage;
|
|||
|
||||
import com.raytheon.uf.viz.core.data.IRenderedImageCallback;
|
||||
import com.raytheon.uf.viz.core.drawables.IImage;
|
||||
import com.raytheon.uf.viz.core.drawables.ext.IImagingExtension;
|
||||
import com.raytheon.uf.viz.core.exception.VizException;
|
||||
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.imagery.RenderedImageEvent;
|
||||
import com.raytheon.uf.viz.remote.graphics.extensions.DispatchingImagingExtension;
|
||||
|
||||
/**
|
||||
* Dispatching image object created from existing image and forwards key events
|
||||
|
@ -81,8 +81,9 @@ public class DispatchingImage extends AbstractDispatchingImage<IImage> {
|
|||
* @param dispatcher
|
||||
*/
|
||||
public DispatchingImage(IImage targetObject,
|
||||
Class<? extends IImagingExtension> extension,
|
||||
DispatchingRenderedImageCallback callback, Dispatcher dispatcher) {
|
||||
super(targetObject, DispatchingImagingExtension.class, dispatcher);
|
||||
super(targetObject, extension, dispatcher);
|
||||
callback.image = this;
|
||||
}
|
||||
|
||||
|
|
|
@ -0,0 +1,102 @@
|
|||
/**
|
||||
* 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 java.awt.image.RenderedImage;
|
||||
|
||||
import org.eclipse.swt.graphics.RGB;
|
||||
|
||||
import com.raytheon.uf.viz.core.drawables.ext.IImagingExtension;
|
||||
import com.raytheon.uf.viz.core.drawables.ext.ISingleColorImageExtension.ISingleColorImage;
|
||||
import com.raytheon.uf.viz.core.exception.VizException;
|
||||
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.imagery.CreateSingleColorImage;
|
||||
import com.raytheon.uf.viz.remote.graphics.events.imagery.UpdateSingleColorImage;
|
||||
|
||||
/**
|
||||
* TODO Add Description
|
||||
*
|
||||
* <pre>
|
||||
*
|
||||
* SOFTWARE HISTORY
|
||||
*
|
||||
* Date Ticket# Engineer Description
|
||||
* ------------ ---------- ----------- --------------------------
|
||||
* Apr 12, 2012 mschenke Initial creation
|
||||
*
|
||||
* </pre>
|
||||
*
|
||||
* @author mschenke
|
||||
* @version 1.0
|
||||
*/
|
||||
|
||||
public class DispatchingSingleColorImage extends DispatchingImage implements
|
||||
ISingleColorImage {
|
||||
|
||||
private RGB color;
|
||||
|
||||
/**
|
||||
* @param targetObject
|
||||
* @param extensionClass
|
||||
* @param dispatcher
|
||||
*/
|
||||
public DispatchingSingleColorImage(ISingleColorImage targetObject,
|
||||
Class<? extends IImagingExtension> extensionClass,
|
||||
Dispatcher dispatcher, RGB startingColor,
|
||||
final RenderedImage[] renderedImage) {
|
||||
super(targetObject, extensionClass,
|
||||
new DispatchingRenderedImageCallback(null) {
|
||||
@Override
|
||||
public RenderedImage getImage() throws VizException {
|
||||
RenderedImage image = renderedImage[0];
|
||||
if (image != null) {
|
||||
renderedImage[0] = null;
|
||||
}
|
||||
return image;
|
||||
}
|
||||
}, dispatcher);
|
||||
color = startingColor;
|
||||
CreateSingleColorImage event = RemoteGraphicsEventFactory.createEvent(
|
||||
CreateSingleColorImage.class, this);
|
||||
event.setColor(color);
|
||||
event.setRenderedImage(renderedImage[0]);
|
||||
dispatch(event);
|
||||
}
|
||||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
*
|
||||
* @see com.raytheon.uf.viz.core.drawables.ext.ISingleColorImageExtension.
|
||||
* ISingleColorImage#setColor(org.eclipse.swt.graphics.RGB)
|
||||
*/
|
||||
@Override
|
||||
public void setColor(RGB color) {
|
||||
if (color.equals(this.color) == false) {
|
||||
this.color = color;
|
||||
((ISingleColorImage) wrappedObject).setColor(color);
|
||||
UpdateSingleColorImage event = RemoteGraphicsEventFactory
|
||||
.createEvent(UpdateSingleColorImage.class, this);
|
||||
event.setColor(color);
|
||||
dispatch(event);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
Loading…
Add table
Reference in a new issue