diff --git a/cave/com.raytheon.uf.viz.collaboration.radar/src/com/raytheon/uf/viz/collaboration/radar/mosaic/CreateMosaicImageEvent.java b/cave/com.raytheon.uf.viz.collaboration.radar/src/com/raytheon/uf/viz/collaboration/radar/mosaic/CreateMosaicImageEvent.java index 09b237966c..eaabdb0904 100644 --- a/cave/com.raytheon.uf.viz.collaboration.radar/src/com/raytheon/uf/viz/collaboration/radar/mosaic/CreateMosaicImageEvent.java +++ b/cave/com.raytheon.uf.viz.collaboration.radar/src/com/raytheon/uf/viz/collaboration/radar/mosaic/CreateMosaicImageEvent.java @@ -23,6 +23,7 @@ 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; import com.raytheon.uf.viz.remote.graphics.events.ICreationEvent; +import com.raytheon.uf.viz.remote.graphics.events.colormap.UpdateColorMapEvent; import com.raytheon.uf.viz.remote.graphics.events.colormap.UpdateColorMapParametersEvent; /** @@ -54,6 +55,9 @@ public class CreateMosaicImageEvent extends AbstractDispatchingObjectEvent @DynamicSerializeElement private UpdateColorMapParametersEvent colorMapParameters; + @DynamicSerializeElement + private UpdateColorMapEvent colorMap; + /** * @return the bounds */ @@ -100,4 +104,19 @@ public class CreateMosaicImageEvent extends AbstractDispatchingObjectEvent this.colorMapParameters = colorMapParameters; } + /** + * @return the colorMap + */ + public UpdateColorMapEvent getColorMap() { + return colorMap; + } + + /** + * @param colorMap + * the colorMap to set + */ + public void setColorMap(UpdateColorMapEvent colorMap) { + this.colorMap = colorMap; + } + } diff --git a/cave/com.raytheon.uf.viz.collaboration.radar/src/com/raytheon/uf/viz/collaboration/radar/mosaic/DispatchingMosaicImage.java b/cave/com.raytheon.uf.viz.collaboration.radar/src/com/raytheon/uf/viz/collaboration/radar/mosaic/DispatchingMosaicImage.java index ef62a14dbb..b7fbf42a3b 100644 --- a/cave/com.raytheon.uf.viz.collaboration.radar/src/com/raytheon/uf/viz/collaboration/radar/mosaic/DispatchingMosaicImage.java +++ b/cave/com.raytheon.uf.viz.collaboration.radar/src/com/raytheon/uf/viz/collaboration/radar/mosaic/DispatchingMosaicImage.java @@ -55,6 +55,8 @@ public class DispatchingMosaicImage extends private PaintImageEvent[] imagesToMosaic; + private IExtent imageExtent; + /** * @param targetObject * @param extensionClass @@ -62,8 +64,10 @@ public class DispatchingMosaicImage extends */ public DispatchingMosaicImage(IMosaicImage targetObject, Class extensionClass, - Dispatcher dispatcher, ColorMapParameters parameters) { + Dispatcher dispatcher, ColorMapParameters parameters, + IExtent imageExtent) { super(targetObject, extensionClass, dispatcher, parameters); + this.imageExtent = imageExtent; } /* @@ -75,6 +79,8 @@ public class DispatchingMosaicImage extends */ @Override public void setImagesToMosaic(DrawableImage... images) { + wrappedObject.setImagesToMosaic(PaintImagesEvent + .extractTargetImages(images)); PaintImageEvent[] imagesToMosaic = PaintImagesEvent .toPaintEvents(images); if (Arrays.equals(imagesToMosaic, this.imagesToMosaic) == false) { @@ -82,8 +88,6 @@ public class DispatchingMosaicImage extends UpdateImagesToMosaic event = RemoteGraphicsEventFactory .createEvent(UpdateImagesToMosaic.class, this); event.setImagesToMosaic(imagesToMosaic); - wrappedObject.setImagesToMosaic(PaintImagesEvent - .extractTargetImages(images)); dispatch(event); } } @@ -98,10 +102,13 @@ public class DispatchingMosaicImage extends @Override public void setImageExtent(IExtent imageExtent) { wrappedObject.setImageExtent(imageExtent); - UpdateMosaicExtent extentUpdate = RemoteGraphicsEventFactory - .createEvent(UpdateMosaicExtent.class, this); - extentUpdate.setIExtent(imageExtent); - dispatch(extentUpdate); + if (imageExtent.equals(this.imageExtent) == false) { + this.imageExtent = imageExtent; + UpdateMosaicExtent extentUpdate = RemoteGraphicsEventFactory + .createEvent(UpdateMosaicExtent.class, this); + extentUpdate.setIExtent(imageExtent); + dispatch(extentUpdate); + } } } diff --git a/cave/com.raytheon.uf.viz.collaboration.radar/src/com/raytheon/uf/viz/collaboration/radar/mosaic/DispatchingRadarMosaicExtension.java b/cave/com.raytheon.uf.viz.collaboration.radar/src/com/raytheon/uf/viz/collaboration/radar/mosaic/DispatchingRadarMosaicExtension.java index b8ff3d36a2..715893ce82 100644 --- a/cave/com.raytheon.uf.viz.collaboration.radar/src/com/raytheon/uf/viz/collaboration/radar/mosaic/DispatchingRadarMosaicExtension.java +++ b/cave/com.raytheon.uf.viz.collaboration.radar/src/com/raytheon/uf/viz/collaboration/radar/mosaic/DispatchingRadarMosaicExtension.java @@ -23,6 +23,8 @@ import com.raytheon.uf.viz.core.IExtent; import com.raytheon.uf.viz.core.drawables.ColorMapParameters; 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.UpdateColorMapEvent; +import com.raytheon.uf.viz.remote.graphics.events.colormap.UpdateColorMapParametersEvent; import com.raytheon.uf.viz.remote.graphics.extensions.AbstractDispatchingImageExtension; import com.raytheon.viz.radar.rsc.mosaic.ext.IRadarMosaicImageExtension; @@ -62,14 +64,16 @@ public class DispatchingRadarMosaicExtension extends .getExtension(IRadarMosaicImageExtension.class) .initializeRaster(imageBounds, imageExtent, params), DispatchingRadarMosaicExtension.class, target.getDispatcher(), - params); + params, imageExtent); // Send creation event CreateMosaicImageEvent creation = RemoteGraphicsEventFactory .createEvent(CreateMosaicImageEvent.class, image); creation.setBounds(imageBounds); if (params != null) { - creation.setColorMapParameters(DispatchingMosaicImage - .createColorMapParametersUpdateEvent(image)); + creation.setColorMapParameters(UpdateColorMapParametersEvent + .createEvent(image, params)); + creation.setColorMap(UpdateColorMapEvent.createEvent(image, + params.getColorMap())); } if (imageExtent != null) { UpdateMosaicExtent extentUpdate = RemoteGraphicsEventFactory diff --git a/cave/com.raytheon.uf.viz.collaboration.radar/src/com/raytheon/uf/viz/collaboration/radar/rendering/RadarGraphicsExtRenderingHandler.java b/cave/com.raytheon.uf.viz.collaboration.radar/src/com/raytheon/uf/viz/collaboration/radar/rendering/RadarGraphicsExtRenderingHandler.java index b47d530f3c..debed428af 100644 --- a/cave/com.raytheon.uf.viz.collaboration.radar/src/com/raytheon/uf/viz/collaboration/radar/rendering/RadarGraphicsExtRenderingHandler.java +++ b/cave/com.raytheon.uf.viz.collaboration.radar/src/com/raytheon/uf/viz/collaboration/radar/rendering/RadarGraphicsExtRenderingHandler.java @@ -76,7 +76,10 @@ public class RadarGraphicsExtRenderingHandler extends imageExtent = event.getExtent().getIExtent(); } if (event.getColorMapParameters() != null) { - parameters = event.getColorMapParameters().asColorMapParameters(); + parameters = event.getColorMapParameters().getColorMapParameters(); + if (event.getColorMap() != null && parameters != null) { + parameters.setColorMap(event.getColorMap().getColorMap()); + } } dataManager.putRenderableObject( imageId, diff --git a/cave/com.raytheon.uf.viz.collaboration.ui/META-INF/MANIFEST.MF b/cave/com.raytheon.uf.viz.collaboration.ui/META-INF/MANIFEST.MF index 9f768617dd..6bf61541e0 100644 --- a/cave/com.raytheon.uf.viz.collaboration.ui/META-INF/MANIFEST.MF +++ b/cave/com.raytheon.uf.viz.collaboration.ui/META-INF/MANIFEST.MF @@ -19,7 +19,8 @@ Require-Bundle: com.raytheon.viz.ui, com.raytheon.viz.core;bundle-version="1.12.1174", com.raytheon.uf.viz.drawing;bundle-version="1.0.0", com.raytheon.uf.viz.remote.graphics;bundle-version="1.0.0", - com.raytheon.uf.common.comm;bundle-version="1.12.1174" + com.raytheon.uf.common.comm;bundle-version="1.12.1174", + com.raytheon.uf.common.colormap;bundle-version="1.12.1174" Import-Package: com.raytheon.uf.common.status, com.raytheon.uf.viz.core.maps.display, com.raytheon.uf.viz.core.maps.rsc, diff --git a/cave/com.raytheon.uf.viz.collaboration.ui/src/com/raytheon/uf/viz/collaboration/ui/role/dataprovider/CollaborationDispatcher.java b/cave/com.raytheon.uf.viz.collaboration.ui/src/com/raytheon/uf/viz/collaboration/ui/role/dataprovider/CollaborationDispatcher.java index 2d1c08c1dd..891ce513a2 100644 --- a/cave/com.raytheon.uf.viz.collaboration.ui/src/com/raytheon/uf/viz/collaboration/ui/role/dataprovider/CollaborationDispatcher.java +++ b/cave/com.raytheon.uf.viz.collaboration.ui/src/com/raytheon/uf/viz/collaboration/ui/role/dataprovider/CollaborationDispatcher.java @@ -103,18 +103,7 @@ public class CollaborationDispatcher extends Dispatcher { byte[] data = Tools.compress(SerializationUtil .transformToThrift(eventObject)); if (data.length > IMMEDIATE_SEND_SIZE) { - System.err.println("Object: " - + eventObject.getClass().getSimpleName() - + " is too large to send immediately, size is " - + data.length + " bytes"); immediateSend = false; - } else { - System.out - .println("Object: " - + eventObject.getClass() - .getSimpleName() - + " is small enough to send immediately, size is " - + data.length + " bytes"); } } catch (Exception e) { Activator.statusHandler.handle(Priority.PROBLEM, diff --git a/cave/com.raytheon.uf.viz.collaboration.ui/src/com/raytheon/uf/viz/collaboration/ui/role/dataprovider/CollaborationObjectEventStorage.java b/cave/com.raytheon.uf.viz.collaboration.ui/src/com/raytheon/uf/viz/collaboration/ui/role/dataprovider/CollaborationObjectEventStorage.java index d9fb5e7030..3a8a653623 100644 --- a/cave/com.raytheon.uf.viz.collaboration.ui/src/com/raytheon/uf/viz/collaboration/ui/role/dataprovider/CollaborationObjectEventStorage.java +++ b/cave/com.raytheon.uf.viz.collaboration.ui/src/com/raytheon/uf/viz/collaboration/ui/role/dataprovider/CollaborationObjectEventStorage.java @@ -68,8 +68,6 @@ public class CollaborationObjectEventStorage implements private static final int SESSION_DATA_PORT = 80; - private volatile long EVENT_ID_COUNTER = 0; - public static IObjectEventPersistance createPersistanceObject( ISharedDisplaySession session) throws CollaborationException { CollaborationObjectEventStorage persistance = new CollaborationObjectEventStorage( @@ -133,13 +131,13 @@ public class CollaborationObjectEventStorage implements try { CollaborationHttpPersistedEvent wrapped = new CollaborationHttpPersistedEvent(); String eventObjectURL = sessionDataURL + event.getObjectId() + "/" - + (++EVENT_ID_COUNTER) + ".obj"; + + event.getClass().getName() + ".obj"; HttpPut put = new HttpPut(eventObjectURL); put.setEntity(new ByteArrayEntity(Tools.compress(SerializationUtil .transformToThrift(event)))); HttpClientResponse response = executeRequest(put); - if (response.code != 201) { + if (isSuccess(response.code) == false) { throw new CollaborationException( "Error uploading event object to server @ " + eventObjectURL + " : " @@ -182,7 +180,7 @@ public class CollaborationObjectEventStorage implements .getResourceURL(); HttpGet get = new HttpGet(objectURL); HttpClientResponse response = executeRequest(get); - if (response.code == 200) { + if (isSuccess(response.code)) { try { return (AbstractDispatchingObjectEvent) SerializationUtil .transformFromThrift(Tools @@ -227,7 +225,7 @@ public class CollaborationObjectEventStorage implements }; mkcol.setURI(URI.create(sessionDataURL + folderPath)); HttpClientResponse rsp = executeRequest(mkcol); - if (rsp.code != 201) { + if (isSuccess(rsp.code) == false) { throw new CollaborationException("Folder creation failed for " + folderPath + ": " + new String(rsp.data)); } @@ -235,10 +233,8 @@ public class CollaborationObjectEventStorage implements private void deleteResource(URI uri) throws CollaborationException { HttpClientResponse rsp = executeRequest(new HttpDelete(uri)); - // Valid DELETE return codes are 200, 202, and 204, 404 means resource - // has already been deleted - if (rsp.code != 200 && rsp.code != 202 && rsp.code != 204 - && rsp.code != 404) { + // If request was success or resource doesn't exist, we are good + if (isSuccess(rsp.code) == false && isNotExists(rsp.code) == false) { throw new CollaborationException("Folder creation failed for " + uri + ": " + new String(rsp.data)); } @@ -253,6 +249,14 @@ public class CollaborationObjectEventStorage implements } } + private boolean isSuccess(int code) { + return code >= 200 && code < 300; + } + + private boolean isNotExists(int code) { + return code == 404 || code == 410; + } + @DynamicSerialize public static class CollaborationHttpPersistedEvent implements IPersistedEvent { diff --git a/cave/com.raytheon.uf.viz.collaboration.ui/src/com/raytheon/uf/viz/collaboration/ui/role/dataprovider/event/RenderFrameEvent.java b/cave/com.raytheon.uf.viz.collaboration.ui/src/com/raytheon/uf/viz/collaboration/ui/role/dataprovider/event/RenderFrameEvent.java index bbf54f54e9..0ad0247d57 100644 --- a/cave/com.raytheon.uf.viz.collaboration.ui/src/com/raytheon/uf/viz/collaboration/ui/role/dataprovider/event/RenderFrameEvent.java +++ b/cave/com.raytheon.uf.viz.collaboration.ui/src/com/raytheon/uf/viz/collaboration/ui/role/dataprovider/event/RenderFrameEvent.java @@ -77,6 +77,8 @@ public class RenderFrameEvent extends AbstractDispatchingObjectEvent { public boolean equals(Object obj) { if (this == obj) return true; + if (!super.equals(obj)) + return false; if (obj == null) return false; if (getClass() != obj.getClass()) diff --git a/cave/com.raytheon.uf.viz.collaboration.ui/src/com/raytheon/uf/viz/collaboration/ui/rsc/rendering/ImagingRenderingHandler.java b/cave/com.raytheon.uf.viz.collaboration.ui/src/com/raytheon/uf/viz/collaboration/ui/rsc/rendering/ImagingRenderingHandler.java index e22d581ad0..4501836876 100644 --- a/cave/com.raytheon.uf.viz.collaboration.ui/src/com/raytheon/uf/viz/collaboration/ui/rsc/rendering/ImagingRenderingHandler.java +++ b/cave/com.raytheon.uf.viz.collaboration.ui/src/com/raytheon/uf/viz/collaboration/ui/rsc/rendering/ImagingRenderingHandler.java @@ -24,6 +24,7 @@ import java.util.ArrayList; import java.util.List; import com.google.common.eventbus.Subscribe; +import com.raytheon.uf.common.colormap.IColorMap; import com.raytheon.uf.viz.core.DrawableImage; import com.raytheon.uf.viz.core.IGraphicsTarget; import com.raytheon.uf.viz.core.IMesh; @@ -41,6 +42,7 @@ import com.raytheon.uf.viz.core.exception.VizException; import com.raytheon.uf.viz.core.map.IMapMeshExtension; 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.events.colormap.UpdateColorMapEvent; import com.raytheon.uf.viz.remote.graphics.events.colormap.UpdateColorMapParametersEvent; import com.raytheon.uf.viz.remote.graphics.events.imagery.CreateIImageEvent; import com.raytheon.uf.viz.remote.graphics.events.imagery.CreateSingleColorImage; @@ -71,6 +73,8 @@ import com.raytheon.uf.viz.remote.graphics.events.mesh.ReprojectMeshEvent; public class ImagingRenderingHandler extends CollaborationRenderingHandler { + private Object colorMapLock = new Object(); + @Subscribe public void renderImages(PaintImagesEvent event) throws VizException { PaintProperties paintProps = getPaintProperties(); @@ -188,10 +192,14 @@ public class ImagingRenderingHandler extends CollaborationRenderingHandler { IGraphicsTarget target = getTarget(); int imageId = event.getObjectId(); IColorMapDataRetrievalCallback callback = new ColorMapDataCallback(); - UpdateColorMapParametersEvent cmapEvent = event.getColorMapParameters(); + UpdateColorMapParametersEvent cmapParamEvent = event + .getColorMapParameters(); ColorMapParameters params = null; - if (cmapEvent != null) { - params = cmapEvent.asColorMapParameters(); + if (cmapParamEvent != null) { + params = cmapParamEvent.getColorMapParameters(); + if (event.getColorMap() != null && params != null) { + params.setColorMap(event.getColorMap().getColorMap()); + } } IColormappedImage image = target.getExtension( IColormappedImageExtension.class).initializeRaster(callback, @@ -200,6 +208,41 @@ public class ImagingRenderingHandler extends CollaborationRenderingHandler { new Object[] { image, callback }); } + @Subscribe + public void updateColorMapParameters(UpdateColorMapParametersEvent event) { + IColormappedImage image = dataManager.getRenderableObject( + event.getObjectId(), IColormappedImage.class); + if (image != null) { + ColorMapParameters newParams = event.getColorMapParameters(); + synchronized (colorMapLock) { + ColorMapParameters params = image.getColorMapParameters(); + if (params != null && newParams != null) { + newParams.setColorMap(params.getColorMap()); + } + image.setColorMapParameters(newParams); + } + } + } + + @Subscribe + public void updateColorMap(UpdateColorMapEvent event) { + IColormappedImage image = dataManager.getRenderableObject( + event.getObjectId(), IColormappedImage.class); + if (image != null) { + IColorMap colorMap = event.getColorMap(); + synchronized (colorMapLock) { + ColorMapParameters params = image.getColorMapParameters(); + if (params == null && colorMap != null) { + params = new ColorMapParameters(); + params.setColorMap(colorMap); + image.setColorMapParameters(params); + } else if (params != null) { + params.setColorMap(colorMap); + } + } + } + } + @Subscribe public void dataArrived(ColorMapDataEvent event) { ColorMapDataCallback callback = dataManager.getRenderableObject( diff --git a/cave/com.raytheon.uf.viz.collaboration.ui/src/com/raytheon/uf/viz/collaboration/ui/rsc/rendering/OffscreenRenderingHandler.java b/cave/com.raytheon.uf.viz.collaboration.ui/src/com/raytheon/uf/viz/collaboration/ui/rsc/rendering/OffscreenRenderingHandler.java index cc0c75ff2e..e394a9e053 100644 --- a/cave/com.raytheon.uf.viz.collaboration.ui/src/com/raytheon/uf/viz/collaboration/ui/rsc/rendering/OffscreenRenderingHandler.java +++ b/cave/com.raytheon.uf.viz.collaboration.ui/src/com/raytheon/uf/viz/collaboration/ui/rsc/rendering/OffscreenRenderingHandler.java @@ -64,7 +64,7 @@ public class OffscreenRenderingHandler extends CollaborationRenderingHandler { if (event.getColorMapParamters() != null) { offscreenImage = ext.constructOffscreenImage(bufferType, dims, event.getColorMapParamters() - .asColorMapParameters()); + .getColorMapParameters()); } else { offscreenImage = ext.constructOffscreenImage(bufferType, dims); diff --git a/cave/com.raytheon.uf.viz.collaboration.ui/src/com/raytheon/uf/viz/collaboration/ui/rsc/rendering/WireframeShapeRenderingHandler.java b/cave/com.raytheon.uf.viz.collaboration.ui/src/com/raytheon/uf/viz/collaboration/ui/rsc/rendering/WireframeShapeRenderingHandler.java index 90ec64afe5..5a817077ee 100644 --- a/cave/com.raytheon.uf.viz.collaboration.ui/src/com/raytheon/uf/viz/collaboration/ui/rsc/rendering/WireframeShapeRenderingHandler.java +++ b/cave/com.raytheon.uf.viz.collaboration.ui/src/com/raytheon/uf/viz/collaboration/ui/rsc/rendering/WireframeShapeRenderingHandler.java @@ -28,9 +28,8 @@ import com.raytheon.uf.viz.remote.graphics.events.wireframe.AllocatePointsEvent; 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.events.wireframe.SimpleWireframeShapeEvent; -import com.raytheon.uf.viz.remote.graphics.events.wireframe.UpdateWireframeShapeEvent; -import com.raytheon.uf.viz.remote.graphics.events.wireframe.WireframeShapeData; -import com.raytheon.uf.viz.remote.graphics.events.wireframe.WireframeShapeData.Label; +import com.raytheon.uf.viz.remote.graphics.events.wireframe.WireframeShapeDataEvent; +import com.raytheon.uf.viz.remote.graphics.events.wireframe.WireframeShapeDataEvent.Label; /** * Handles render events for wireframe shapes @@ -86,15 +85,15 @@ public class WireframeShapeRenderingHandler extends } @Subscribe - public void updateWireframeShapeData(UpdateWireframeShapeEvent event) { + public void wireframeShapeDataArrived(WireframeShapeDataEvent event) { IWireframeShape shape = dataManager.getRenderableObject( event.getObjectId(), IWireframeShape.class); if (shape != null) { - WireframeShapeData data = event.getWireframeData(); - for (Label label : data.getLabels()) { + shape.reset(); + for (Label label : event.getLabels()) { shape.addLabel(label.getText(), label.getPoint()); } - for (double[][] coords : data.getCoordinates()) { + for (double[][] coords : event.getCoordinates()) { shape.addLineSegment(coords); } } diff --git a/cave/com.raytheon.uf.viz.radar.gl/src/com/raytheon/uf/viz/radar/gl/mosaic/GLMosaicImage.java b/cave/com.raytheon.uf.viz.radar.gl/src/com/raytheon/uf/viz/radar/gl/mosaic/GLMosaicImage.java index 7f1b5114f2..6f9143b56b 100644 --- a/cave/com.raytheon.uf.viz.radar.gl/src/com/raytheon/uf/viz/radar/gl/mosaic/GLMosaicImage.java +++ b/cave/com.raytheon.uf.viz.radar.gl/src/com/raytheon/uf/viz/radar/gl/mosaic/GLMosaicImage.java @@ -121,6 +121,7 @@ public class GLMosaicImage extends GLDelegateImage @Override public void setImageExtent(IExtent imageExtent) { this.extent = imageExtent; + repaint = true; } public IExtent getImageExtent() { diff --git a/cave/com.raytheon.uf.viz.remote.graphics/src/com/raytheon/uf/viz/remote/graphics/DispatchGraphicsTarget.java b/cave/com.raytheon.uf.viz.remote.graphics/src/com/raytheon/uf/viz/remote/graphics/DispatchGraphicsTarget.java index eb373731b2..33abd7f8d3 100644 --- a/cave/com.raytheon.uf.viz.remote.graphics/src/com/raytheon/uf/viz/remote/graphics/DispatchGraphicsTarget.java +++ b/cave/com.raytheon.uf.viz.remote.graphics/src/com/raytheon/uf/viz/remote/graphics/DispatchGraphicsTarget.java @@ -489,7 +489,7 @@ public class DispatchGraphicsTarget extends DispatchingObject private void sendDrawWireframeShapeEvent(DispatchingWireframeShape shape, RGB color, float lineWidth, LineStyle lineStyle, IFont font, Float alpha) { - shape.updateState(); + shape.flushState(); RenderWireframeShapeEvent event = RemoteGraphicsEventFactory .createEvent(RenderWireframeShapeEvent.class, shape); event.setColor(color); diff --git a/cave/com.raytheon.uf.viz.remote.graphics/src/com/raytheon/uf/viz/remote/graphics/DispatchingObject.java b/cave/com.raytheon.uf.viz.remote.graphics/src/com/raytheon/uf/viz/remote/graphics/DispatchingObject.java index 12f140959a..c5308bec19 100644 --- a/cave/com.raytheon.uf.viz.remote.graphics/src/com/raytheon/uf/viz/remote/graphics/DispatchingObject.java +++ b/cave/com.raytheon.uf.viz.remote.graphics/src/com/raytheon/uf/viz/remote/graphics/DispatchingObject.java @@ -19,6 +19,7 @@ **/ package com.raytheon.uf.viz.remote.graphics; + /** * TODO Add Description * diff --git a/cave/com.raytheon.uf.viz.remote.graphics/src/com/raytheon/uf/viz/remote/graphics/events/AbstractDispatchingObjectEvent.java b/cave/com.raytheon.uf.viz.remote.graphics/src/com/raytheon/uf/viz/remote/graphics/events/AbstractDispatchingObjectEvent.java index 75528f805a..966d483d48 100644 --- a/cave/com.raytheon.uf.viz.remote.graphics/src/com/raytheon/uf/viz/remote/graphics/events/AbstractDispatchingObjectEvent.java +++ b/cave/com.raytheon.uf.viz.remote.graphics/src/com/raytheon/uf/viz/remote/graphics/events/AbstractDispatchingObjectEvent.java @@ -69,4 +69,23 @@ public abstract class AbstractDispatchingObjectEvent extends this.objectId = objectId; } + /* + * (non-Javadoc) + * + * @see java.lang.Object#equals(java.lang.Object) + */ + @Override + public boolean equals(Object obj) { + if (this == obj) + return true; + if (obj == null) + return false; + if (getClass() != obj.getClass()) + return false; + AbstractDispatchingObjectEvent other = (AbstractDispatchingObjectEvent) obj; + if (objectId != other.objectId) + return false; + return true; + } + } diff --git a/cave/com.raytheon.uf.viz.remote.graphics/src/com/raytheon/uf/viz/remote/graphics/events/colormap/ColorMapDataEvent.java b/cave/com.raytheon.uf.viz.remote.graphics/src/com/raytheon/uf/viz/remote/graphics/events/colormap/ColorMapDataEvent.java index 2155860933..0dcb980ea7 100644 --- a/cave/com.raytheon.uf.viz.remote.graphics/src/com/raytheon/uf/viz/remote/graphics/events/colormap/ColorMapDataEvent.java +++ b/cave/com.raytheon.uf.viz.remote.graphics/src/com/raytheon/uf/viz/remote/graphics/events/colormap/ColorMapDataEvent.java @@ -19,25 +19,18 @@ **/ package com.raytheon.uf.viz.remote.graphics.events.colormap; -import java.nio.Buffer; -import java.nio.ByteBuffer; -import java.nio.FloatBuffer; -import java.nio.IntBuffer; -import java.nio.ShortBuffer; - -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.SerializationUtil; import com.raytheon.uf.common.serialization.annotations.DynamicSerialize; -import com.raytheon.uf.common.serialization.annotations.DynamicSerializeTypeAdapter; +import com.raytheon.uf.common.serialization.annotations.DynamicSerializeElement; +import com.raytheon.uf.common.status.UFStatus.Priority; import com.raytheon.uf.viz.core.data.IColorMapDataRetrievalCallback.ColorMapData; -import com.raytheon.uf.viz.core.data.IColorMapDataRetrievalCallback.ColorMapDataType; +import com.raytheon.uf.viz.remote.graphics.Activator; import com.raytheon.uf.viz.remote.graphics.events.AbstractDispatchingObjectEvent; -import com.raytheon.uf.viz.remote.graphics.events.colormap.ColorMapDataEvent.ColorMapDataEventAdapter; /** - * TODO Add Description + * Event for sending ColorMapData, serializes object immediately to avoid + * concurrency issues with other threads using the buffer async * *
  * 
@@ -53,117 +46,41 @@ import com.raytheon.uf.viz.remote.graphics.events.colormap.ColorMapDataEvent.Col
  * @version 1.0
  */
 @DynamicSerialize
-@DynamicSerializeTypeAdapter(factory = ColorMapDataEventAdapter.class)
 public class ColorMapDataEvent extends AbstractDispatchingObjectEvent {
 
-    public static class ColorMapDataEventAdapter implements
-            ISerializationTypeAdapter {
+    @DynamicSerializeElement
+    private byte[] serializedColorMapData;
 
-        /*
-         * (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,
-                ColorMapDataEvent object) throws SerializationException {
-            serializer.writeI32(object.getDisplayId());
-            serializer.writeI32(object.getObjectId());
-            ColorMapData colorMapData = object.getColorMapData();
-            serializer.writeString(colorMapData.getDataType().name());
-            int[] dimensions = colorMapData.getDimensions();
-            serializer.writeI32(dimensions[0]);
-            serializer.writeI32(dimensions[1]);
-            Buffer buffer = colorMapData.getBuffer();
-            serializer.writeBool(buffer.isDirect());
-            buffer.position(0);
-            ByteBuffer bb = null;
-            byte[] bytes = null;
-            switch (colorMapData.getDataType()) {
-            case BYTE:
-            case SIGNED_BYTE:
-                bytes = new byte[buffer.capacity()];
-                bb = ByteBuffer.wrap(bytes);
-                bb.put((ByteBuffer) buffer);
-                break;
-            case SHORT:
-            case UNSIGNED_SHORT:
-                bytes = new byte[2 * buffer.capacity()];
-                bb = ByteBuffer.wrap(bytes);
-                bb.asShortBuffer().put((ShortBuffer) buffer);
-                break;
-            case FLOAT:
-                bytes = new byte[4 * buffer.capacity()];
-                bb = ByteBuffer.wrap(bytes);
-                bb.asFloatBuffer().put((FloatBuffer) buffer);
-                break;
-            case INT:
-                bytes = new byte[4 * buffer.capacity()];
-                bb = ByteBuffer.wrap(bytes);
-                bb.asIntBuffer().put((IntBuffer) buffer);
-                break;
-            }
-            serializer.writeBinary(bb.array());
-        }
-
-        /*
-         * (non-Javadoc)
-         * 
-         * @see com.raytheon.uf.common.serialization.ISerializationTypeAdapter#
-         * deserialize
-         * (com.raytheon.uf.common.serialization.IDeserializationContext)
-         */
-        @Override
-        public ColorMapDataEvent deserialize(
-                IDeserializationContext deserializer)
-                throws SerializationException {
-            ColorMapDataEvent event = new ColorMapDataEvent();
-            event.setDisplayId(deserializer.readI32());
-            event.setObjectId(deserializer.readI32());
-            ColorMapDataType dataType = ColorMapDataType.valueOf(deserializer
-                    .readString());
-            int[] dimensions = new int[] { deserializer.readI32(),
-                    deserializer.readI32() };
-            boolean direct = deserializer.readBool();
-            byte[] bytes = deserializer.readBinary();
-            ByteBuffer buffer = direct ? ByteBuffer
-                    .allocateDirect(bytes.length) : ByteBuffer
-                    .allocate(bytes.length);
-            buffer.put(bytes);
-            buffer.rewind();
-            Buffer dataBuffer = null;
-            switch (dataType) {
-            case BYTE:
-            case SIGNED_BYTE:
-                dataBuffer = buffer;
-                break;
-            case SHORT:
-            case UNSIGNED_SHORT:
-                dataBuffer = buffer.asShortBuffer();
-                break;
-            case INT:
-                dataBuffer = buffer.asIntBuffer();
-                break;
-            case FLOAT:
-                dataBuffer = buffer.asFloatBuffer();
-                break;
-            }
-            event.setColorMapData(new ColorMapData(dataBuffer, dimensions,
-                    dataType));
-            return event;
-        }
+    /**
+     * @return the serializedColorMapData
+     */
+    public byte[] getSerializedColorMapData() {
+        return serializedColorMapData;
     }
 
-    private ColorMapData colorMapData;
+    /**
+     * @param serializedColorMapData
+     *            the serializedColorMapData to set
+     */
+    public void setSerializedColorMapData(byte[] serializedColorMapData) {
+        this.serializedColorMapData = serializedColorMapData;
+    }
 
     /**
      * @return the colorMapData
      */
     public ColorMapData getColorMapData() {
-        return colorMapData;
+        if (serializedColorMapData != null) {
+            try {
+                ColorMapDataWrapper wrapper = (ColorMapDataWrapper) SerializationUtil
+                        .transformFromThrift(serializedColorMapData);
+                return wrapper.getColorMapData();
+            } catch (SerializationException e) {
+                Activator.statusHandler.handle(Priority.PROBLEM,
+                        e.getLocalizedMessage(), e);
+            }
+        }
+        return null;
     }
 
     /**
@@ -171,7 +88,15 @@ public class ColorMapDataEvent extends AbstractDispatchingObjectEvent {
      *            the colorMapData to set
      */
     public void setColorMapData(ColorMapData colorMapData) {
-        this.colorMapData = colorMapData;
+        ColorMapDataWrapper wrapper = new ColorMapDataWrapper();
+        wrapper.setColorMapData(colorMapData);
+        try {
+            serializedColorMapData = SerializationUtil
+                    .transformToThrift(wrapper);
+        } catch (SerializationException e) {
+            Activator.statusHandler.handle(Priority.PROBLEM,
+                    e.getLocalizedMessage(), e);
+        }
     }
 
 }
diff --git a/cave/com.raytheon.uf.viz.remote.graphics/src/com/raytheon/uf/viz/remote/graphics/events/colormap/ColorMapDataWrapper.java b/cave/com.raytheon.uf.viz.remote.graphics/src/com/raytheon/uf/viz/remote/graphics/events/colormap/ColorMapDataWrapper.java
new file mode 100644
index 0000000000..708d7830c2
--- /dev/null
+++ b/cave/com.raytheon.uf.viz.remote.graphics/src/com/raytheon/uf/viz/remote/graphics/events/colormap/ColorMapDataWrapper.java
@@ -0,0 +1,172 @@
+/**
+ * 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.colormap;
+
+import java.nio.Buffer;
+import java.nio.ByteBuffer;
+import java.nio.FloatBuffer;
+import java.nio.IntBuffer;
+import java.nio.ShortBuffer;
+
+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.DynamicSerializeTypeAdapter;
+import com.raytheon.uf.viz.core.data.IColorMapDataRetrievalCallback.ColorMapData;
+import com.raytheon.uf.viz.core.data.IColorMapDataRetrievalCallback.ColorMapDataType;
+import com.raytheon.uf.viz.remote.graphics.events.colormap.ColorMapDataWrapper.ColorMapDataWrapperAdapter;
+
+/**
+ * Object that wraps ColorMapData
+ * 
+ * 
+ * 
+ * SOFTWARE HISTORY
+ * 
+ * Date         Ticket#    Engineer    Description
+ * ------------ ---------- ----------- --------------------------
+ * Apr 25, 2012            mschenke     Initial creation
+ * 
+ * 
+ * + * @author mschenke + * @version 1.0 + */ +@DynamicSerialize +@DynamicSerializeTypeAdapter(factory = ColorMapDataWrapperAdapter.class) +public class ColorMapDataWrapper { + + public static class ColorMapDataWrapperAdapter implements + ISerializationTypeAdapter { + + /* + * (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, + ColorMapDataWrapper object) throws SerializationException { + ColorMapData colorMapData = object.getColorMapData(); + serializer.writeString(colorMapData.getDataType().name()); + int[] dimensions = colorMapData.getDimensions(); + serializer.writeI32(dimensions[0]); + serializer.writeI32(dimensions[1]); + Buffer buffer = colorMapData.getBuffer(); + serializer.writeBool(buffer.isDirect()); + buffer.position(0); + ByteBuffer bb = null; + byte[] bytes = null; + switch (colorMapData.getDataType()) { + case BYTE: + case SIGNED_BYTE: + bytes = new byte[buffer.capacity()]; + bb = ByteBuffer.wrap(bytes); + bb.put((ByteBuffer) buffer); + break; + case SHORT: + case UNSIGNED_SHORT: + bytes = new byte[2 * buffer.capacity()]; + bb = ByteBuffer.wrap(bytes); + bb.asShortBuffer().put((ShortBuffer) buffer); + break; + case FLOAT: + bytes = new byte[4 * buffer.capacity()]; + bb = ByteBuffer.wrap(bytes); + bb.asFloatBuffer().put((FloatBuffer) buffer); + break; + case INT: + bytes = new byte[4 * buffer.capacity()]; + bb = ByteBuffer.wrap(bytes); + bb.asIntBuffer().put((IntBuffer) buffer); + break; + } + serializer.writeBinary(bb.array()); + } + + /* + * (non-Javadoc) + * + * @see com.raytheon.uf.common.serialization.ISerializationTypeAdapter# + * deserialize + * (com.raytheon.uf.common.serialization.IDeserializationContext) + */ + @Override + public ColorMapDataWrapper deserialize( + IDeserializationContext deserializer) + throws SerializationException { + ColorMapDataWrapper wrapper = new ColorMapDataWrapper(); + ColorMapDataType dataType = ColorMapDataType.valueOf(deserializer + .readString()); + int[] dimensions = new int[] { deserializer.readI32(), + deserializer.readI32() }; + boolean direct = deserializer.readBool(); + byte[] bytes = deserializer.readBinary(); + ByteBuffer buffer = direct ? ByteBuffer + .allocateDirect(bytes.length) : ByteBuffer + .allocate(bytes.length); + buffer.put(bytes); + buffer.rewind(); + Buffer dataBuffer = null; + switch (dataType) { + case BYTE: + case SIGNED_BYTE: + dataBuffer = buffer; + break; + case SHORT: + case UNSIGNED_SHORT: + dataBuffer = buffer.asShortBuffer(); + break; + case INT: + dataBuffer = buffer.asIntBuffer(); + break; + case FLOAT: + dataBuffer = buffer.asFloatBuffer(); + break; + } + wrapper.setColorMapData(new ColorMapData(dataBuffer, dimensions, + dataType)); + return wrapper; + } + } + + private ColorMapData colorMapData; + + /** + * @return the colorMapData + */ + public ColorMapData getColorMapData() { + return colorMapData; + } + + /** + * @param colorMapData + * the colorMapData to set + */ + public void setColorMapData(ColorMapData colorMapData) { + this.colorMapData = colorMapData; + } + +} diff --git a/cave/com.raytheon.uf.viz.remote.graphics/src/com/raytheon/uf/viz/remote/graphics/events/colormap/CreateColormappedImageEvent.java b/cave/com.raytheon.uf.viz.remote.graphics/src/com/raytheon/uf/viz/remote/graphics/events/colormap/CreateColormappedImageEvent.java index 3f42c49b33..e74e8f9aa4 100644 --- a/cave/com.raytheon.uf.viz.remote.graphics/src/com/raytheon/uf/viz/remote/graphics/events/colormap/CreateColormappedImageEvent.java +++ b/cave/com.raytheon.uf.viz.remote.graphics/src/com/raytheon/uf/viz/remote/graphics/events/colormap/CreateColormappedImageEvent.java @@ -47,6 +47,9 @@ public class CreateColormappedImageEvent extends AbstractDispatchingObjectEvent @DynamicSerializeElement private UpdateColorMapParametersEvent colorMapParameters; + @DynamicSerializeElement + private UpdateColorMapEvent colorMap; + /** * @return the colorMapParameters */ @@ -63,4 +66,19 @@ public class CreateColormappedImageEvent extends AbstractDispatchingObjectEvent this.colorMapParameters = colorMapParameters; } + /** + * @return the colorMap + */ + public UpdateColorMapEvent getColorMap() { + return colorMap; + } + + /** + * @param colorMap + * the colorMap to set + */ + public void setColorMap(UpdateColorMapEvent colorMap) { + this.colorMap = colorMap; + } + } \ No newline at end of file diff --git a/cave/com.raytheon.uf.viz.remote.graphics/src/com/raytheon/uf/viz/remote/graphics/events/colormap/UpdateColorMapEvent.java b/cave/com.raytheon.uf.viz.remote.graphics/src/com/raytheon/uf/viz/remote/graphics/events/colormap/UpdateColorMapEvent.java new file mode 100644 index 0000000000..9597862c5a --- /dev/null +++ b/cave/com.raytheon.uf.viz.remote.graphics/src/com/raytheon/uf/viz/remote/graphics/events/colormap/UpdateColorMapEvent.java @@ -0,0 +1,149 @@ +/** + * 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.colormap; + +import com.raytheon.uf.common.colormap.ColorMap; +import com.raytheon.uf.common.colormap.IColorMap; +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; +import com.raytheon.uf.viz.remote.graphics.events.RemoteGraphicsEventFactory; +import com.raytheon.uf.viz.remote.graphics.objects.AbstractDispatchingImage; + +/** + * Event for updating the IColorMap on an IColormappedImage + * + *
+ * 
+ * SOFTWARE HISTORY
+ * 
+ * Date         Ticket#    Engineer    Description
+ * ------------ ---------- ----------- --------------------------
+ * Apr 25, 2012            mschenke     Initial creation
+ * 
+ * 
+ * + * @author mschenke + * @version 1.0 + */ +@DynamicSerialize +public class UpdateColorMapEvent extends AbstractDispatchingObjectEvent { + + @DynamicSerializeElement + private float[] red; + + @DynamicSerializeElement + private float[] blue; + + @DynamicSerializeElement + private float[] green; + + @DynamicSerializeElement + private float[] alpha; + + /** + * @return the red + */ + public float[] getRed() { + return red; + } + + /** + * @param red + * the red to set + */ + public void setRed(float[] red) { + this.red = red; + } + + /** + * @return the blue + */ + public float[] getBlue() { + return blue; + } + + /** + * @param blue + * the blue to set + */ + public void setBlue(float[] blue) { + this.blue = blue; + } + + /** + * @return the green + */ + public float[] getGreen() { + return green; + } + + /** + * @param green + * the green to set + */ + public void setGreen(float[] green) { + this.green = green; + } + + /** + * @return the alpha + */ + public float[] getAlpha() { + return alpha; + } + + /** + * @param alpha + * the alpha to set + */ + public void setAlpha(float[] alpha) { + this.alpha = alpha; + } + + public IColorMap getColorMap() { + if (red != null && green != null && blue != null && alpha != null) { + return new ColorMap("" + getObjectId(), red, green, blue, alpha); + } + return null; + } + + public void setColorMap(IColorMap colorMap) { + if (colorMap != null) { + red = colorMap.getRed(); + green = colorMap.getGreen(); + blue = colorMap.getBlue(); + alpha = colorMap.getAlpha(); + } + } + + /** + * @param wrapper + * @param parameters + * @return + */ + public static UpdateColorMapEvent createEvent( + AbstractDispatchingImage wrapper, IColorMap colorMap) { + UpdateColorMapEvent event = RemoteGraphicsEventFactory.createEvent( + UpdateColorMapEvent.class, wrapper); + event.setColorMap(colorMap); + return event; + } +} diff --git a/cave/com.raytheon.uf.viz.remote.graphics/src/com/raytheon/uf/viz/remote/graphics/events/colormap/UpdateColorMapParametersEvent.java b/cave/com.raytheon.uf.viz.remote.graphics/src/com/raytheon/uf/viz/remote/graphics/events/colormap/UpdateColorMapParametersEvent.java index 838f6243eb..e46592af8f 100644 --- a/cave/com.raytheon.uf.viz.remote.graphics/src/com/raytheon/uf/viz/remote/graphics/events/colormap/UpdateColorMapParametersEvent.java +++ b/cave/com.raytheon.uf.viz.remote.graphics/src/com/raytheon/uf/viz/remote/graphics/events/colormap/UpdateColorMapParametersEvent.java @@ -19,17 +19,15 @@ **/ package com.raytheon.uf.viz.remote.graphics.events.colormap; -import com.raytheon.uf.common.colormap.ColorMap; -import com.raytheon.uf.common.colormap.IColorMap; import com.raytheon.uf.common.serialization.annotations.DynamicSerialize; import com.raytheon.uf.common.serialization.annotations.DynamicSerializeElement; import com.raytheon.uf.viz.core.drawables.ColorMapParameters; -import com.raytheon.uf.viz.remote.graphics.DispatchingObject; import com.raytheon.uf.viz.remote.graphics.events.AbstractDispatchingObjectEvent; import com.raytheon.uf.viz.remote.graphics.events.RemoteGraphicsEventFactory; +import com.raytheon.uf.viz.remote.graphics.objects.AbstractDispatchingImage; /** - * TODO Add Description + * Event for updating the ColorMapParameters on an IColormappedImage * *
  * 
@@ -51,18 +49,6 @@ public class UpdateColorMapParametersEvent extends
     @DynamicSerializeElement
     private byte[] alphaMask;
 
-    @DynamicSerializeElement
-    private float[] red;
-
-    @DynamicSerializeElement
-    private float[] blue;
-
-    @DynamicSerializeElement
-    private float[] green;
-
-    @DynamicSerializeElement
-    private float[] alpha;
-
     @DynamicSerializeElement
     private float colorMapMax;
 
@@ -102,66 +88,6 @@ public class UpdateColorMapParametersEvent extends
         this.alphaMask = alphaMask;
     }
 
-    /**
-     * @return the red
-     */
-    public float[] getRed() {
-        return red;
-    }
-
-    /**
-     * @param red
-     *            the red to set
-     */
-    public void setRed(float[] red) {
-        this.red = red;
-    }
-
-    /**
-     * @return the blue
-     */
-    public float[] getBlue() {
-        return blue;
-    }
-
-    /**
-     * @param blue
-     *            the blue to set
-     */
-    public void setBlue(float[] blue) {
-        this.blue = blue;
-    }
-
-    /**
-     * @return the green
-     */
-    public float[] getGreen() {
-        return green;
-    }
-
-    /**
-     * @param green
-     *            the green to set
-     */
-    public void setGreen(float[] green) {
-        this.green = green;
-    }
-
-    /**
-     * @return the alpha
-     */
-    public float[] getAlpha() {
-        return alpha;
-    }
-
-    /**
-     * @param alpha
-     *            the alpha to set
-     */
-    public void setAlpha(float[] alpha) {
-        this.alpha = alpha;
-    }
-
     /**
      * @return the colorMapMax
      */
@@ -282,12 +208,31 @@ public class UpdateColorMapParametersEvent extends
         this.useMask = useMask;
     }
 
+    /**
+     * Set the ColorMapParameters for the event
+     * 
+     * @param parameters
+     */
+    public void setColorMapParameters(ColorMapParameters parameters) {
+        if (parameters != null) {
+            setAlphaMask(parameters.getAlphaMask());
+            setColorMapMin(parameters.getColorMapMin());
+            setColorMapMax(parameters.getColorMapMax());
+            setDataMin(parameters.getDataMin());
+            setDataMax(parameters.getDataMax());
+            setLogarithmic(parameters.isLogarithmic());
+            setLogFactor(parameters.getLogFactor());
+            setMirror(parameters.isMirror());
+            setUseMask(parameters.isUseMask());
+        }
+    }
+
     /**
      * Get the update colormap parameters event as ColorMapParameters object
      * 
      * @return
      */
-    public ColorMapParameters asColorMapParameters() {
+    public ColorMapParameters getColorMapParameters() {
         ColorMapParameters params = new ColorMapParameters();
         params.setAlphaMask(getAlphaMask());
         params.setColorMapMin(getColorMapMin());
@@ -298,33 +243,19 @@ public class UpdateColorMapParametersEvent extends
         params.setLogFactor(getLogFactor());
         params.setMirror(isMirror());
         params.setUseMask(isUseMask());
-        if (red != null && green != null && blue != null && alpha != null) {
-            params.setColorMap(new ColorMap("" + getObjectId(), red, green,
-                    blue, alpha));
-        }
         return params;
     }
 
+    /**
+     * @param wrapper
+     * @param parameters
+     * @return
+     */
     public static UpdateColorMapParametersEvent createEvent(
-            DispatchingObject creator, ColorMapParameters parameters) {
+            AbstractDispatchingImage wrapper, ColorMapParameters parameters) {
         UpdateColorMapParametersEvent event = RemoteGraphicsEventFactory
-                .createEvent(UpdateColorMapParametersEvent.class, creator);
-        event.setAlphaMask(parameters.getAlphaMask());
-        IColorMap cmap = parameters.getColorMap();
-        if (cmap != null) {
-            event.setRed(cmap.getRed());
-            event.setBlue(cmap.getBlue());
-            event.setGreen(cmap.getGreen());
-            event.setAlpha(cmap.getAlpha());
-        }
-        event.setColorMapMin(parameters.getColorMapMin());
-        event.setColorMapMax(parameters.getColorMapMax());
-        event.setDataMin(parameters.getDataMin());
-        event.setDataMax(parameters.getDataMax());
-        event.setLogarithmic(parameters.isLogarithmic());
-        event.setLogFactor(parameters.getLogFactor());
-        event.setMirror(parameters.isMirror());
-        event.setUseMask(parameters.isUseMask());
+                .createEvent(UpdateColorMapParametersEvent.class, wrapper);
+        event.setColorMapParameters(parameters);
         return event;
     }
 
diff --git a/cave/com.raytheon.uf.viz.remote.graphics/src/com/raytheon/uf/viz/remote/graphics/events/imagery/PaintImageEvent.java b/cave/com.raytheon.uf.viz.remote.graphics/src/com/raytheon/uf/viz/remote/graphics/events/imagery/PaintImageEvent.java
index cbd8c393dd..e6f7a78fdb 100644
--- a/cave/com.raytheon.uf.viz.remote.graphics/src/com/raytheon/uf/viz/remote/graphics/events/imagery/PaintImageEvent.java
+++ b/cave/com.raytheon.uf.viz.remote.graphics/src/com/raytheon/uf/viz/remote/graphics/events/imagery/PaintImageEvent.java
@@ -152,6 +152,8 @@ public class PaintImageEvent extends AbstractDispatchingObjectEvent implements
     public boolean equals(Object obj) {
         if (this == obj)
             return true;
+        if (!super.equals(obj))
+            return false;
         if (obj == null)
             return false;
         if (getClass() != obj.getClass())
diff --git a/cave/com.raytheon.uf.viz.remote.graphics/src/com/raytheon/uf/viz/remote/graphics/events/offscreen/RenderOffscreenEvent.java b/cave/com.raytheon.uf.viz.remote.graphics/src/com/raytheon/uf/viz/remote/graphics/events/offscreen/RenderOffscreenEvent.java
index 812c70a444..24904cc220 100644
--- a/cave/com.raytheon.uf.viz.remote.graphics/src/com/raytheon/uf/viz/remote/graphics/events/offscreen/RenderOffscreenEvent.java
+++ b/cave/com.raytheon.uf.viz.remote.graphics/src/com/raytheon/uf/viz/remote/graphics/events/offscreen/RenderOffscreenEvent.java
@@ -97,7 +97,7 @@ public class RenderOffscreenEvent extends AbstractDispatchingObjectEvent
     public boolean equals(Object obj) {
         if (this == obj)
             return true;
-        if (obj == null)
+        if (!super.equals(obj))
             return false;
         if (getClass() != obj.getClass())
             return false;
diff --git a/cave/com.raytheon.uf.viz.remote.graphics/src/com/raytheon/uf/viz/remote/graphics/events/wireframe/RenderWireframeShapeEvent.java b/cave/com.raytheon.uf.viz.remote.graphics/src/com/raytheon/uf/viz/remote/graphics/events/wireframe/RenderWireframeShapeEvent.java
index f642d1086d..6ab03ed44c 100644
--- a/cave/com.raytheon.uf.viz.remote.graphics/src/com/raytheon/uf/viz/remote/graphics/events/wireframe/RenderWireframeShapeEvent.java
+++ b/cave/com.raytheon.uf.viz.remote.graphics/src/com/raytheon/uf/viz/remote/graphics/events/wireframe/RenderWireframeShapeEvent.java
@@ -198,6 +198,8 @@ public class RenderWireframeShapeEvent extends AbstractDispatchingObjectEvent
     public boolean equals(Object obj) {
         if (this == obj)
             return true;
+        if (!super.equals(obj))
+            return false;
         if (obj == null)
             return false;
         if (getClass() != obj.getClass())
diff --git a/cave/com.raytheon.uf.viz.remote.graphics/src/com/raytheon/uf/viz/remote/graphics/events/wireframe/UpdateWireframeShapeEvent.java b/cave/com.raytheon.uf.viz.remote.graphics/src/com/raytheon/uf/viz/remote/graphics/events/wireframe/UpdateWireframeShapeEvent.java
deleted file mode 100644
index f6dc0dc122..0000000000
--- a/cave/com.raytheon.uf.viz.remote.graphics/src/com/raytheon/uf/viz/remote/graphics/events/wireframe/UpdateWireframeShapeEvent.java
+++ /dev/null
@@ -1,63 +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.events.wireframe;
-
-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;
-
-/**
- * TODO Add Description
- * 
- * 
- * 
- * SOFTWARE HISTORY
- * 
- * Date         Ticket#    Engineer    Description
- * ------------ ---------- ----------- --------------------------
- * Mar 29, 2012            mschenke     Initial creation
- * 
- * 
- * - * @author mschenke - * @version 1.0 - */ -@DynamicSerialize -public class UpdateWireframeShapeEvent extends AbstractDispatchingObjectEvent { - - @DynamicSerializeElement - private WireframeShapeData wireframeData; - - /** - * @return the wireframeData - */ - public WireframeShapeData getWireframeData() { - return wireframeData; - } - - /** - * @param wireframeData - * the wireframeData to set - */ - public void setWireframeData(WireframeShapeData wireframeData) { - this.wireframeData = wireframeData; - } - -} diff --git a/cave/com.raytheon.uf.viz.remote.graphics/src/com/raytheon/uf/viz/remote/graphics/events/wireframe/WireframeShapeData.java b/cave/com.raytheon.uf.viz.remote.graphics/src/com/raytheon/uf/viz/remote/graphics/events/wireframe/WireframeShapeDataEvent.java similarity index 89% rename from cave/com.raytheon.uf.viz.remote.graphics/src/com/raytheon/uf/viz/remote/graphics/events/wireframe/WireframeShapeData.java rename to cave/com.raytheon.uf.viz.remote.graphics/src/com/raytheon/uf/viz/remote/graphics/events/wireframe/WireframeShapeDataEvent.java index 1649d8bcc2..5a7475c476 100644 --- a/cave/com.raytheon.uf.viz.remote.graphics/src/com/raytheon/uf/viz/remote/graphics/events/wireframe/WireframeShapeData.java +++ b/cave/com.raytheon.uf.viz.remote.graphics/src/com/raytheon/uf/viz/remote/graphics/events/wireframe/WireframeShapeDataEvent.java @@ -29,7 +29,8 @@ 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.wireframe.WireframeShapeData.WireframeShapeDataAdapter; +import com.raytheon.uf.viz.remote.graphics.events.AbstractDispatchingObjectEvent; +import com.raytheon.uf.viz.remote.graphics.events.wireframe.WireframeShapeDataEvent.WireframeShapeDataAdapter; /** * Wireframe shape data event which contains coordinates and labels to add to @@ -50,10 +51,10 @@ import com.raytheon.uf.viz.remote.graphics.events.wireframe.WireframeShapeData.W */ @DynamicSerialize @DynamicSerializeTypeAdapter(factory = WireframeShapeDataAdapter.class) -public class WireframeShapeData { +public class WireframeShapeDataEvent extends AbstractDispatchingObjectEvent { public static class WireframeShapeDataAdapter implements - ISerializationTypeAdapter { + ISerializationTypeAdapter { /* * (non-Javadoc) * @@ -64,7 +65,9 @@ public class WireframeShapeData { */ @Override public void serialize(ISerializationContext serializer, - WireframeShapeData object) throws SerializationException { + WireframeShapeDataEvent object) throws SerializationException { + serializer.writeI32(object.getDisplayId()); + serializer.writeI32(object.getObjectId()); serializer.writeI32(object.labels.size()); for (Label l : object.labels) { serializer.writeString(l.getText()); @@ -87,10 +90,12 @@ public class WireframeShapeData { * (com.raytheon.uf.common.serialization.IDeserializationContext) */ @Override - public WireframeShapeData deserialize( + public WireframeShapeDataEvent deserialize( IDeserializationContext deserializer) throws SerializationException { - WireframeShapeData data = new WireframeShapeData(); + WireframeShapeDataEvent data = new WireframeShapeDataEvent(); + data.setDisplayId(deserializer.readI32()); + data.setObjectId(deserializer.readI32()); int size = deserializer.readI32(); for (int i = 0; i < size; ++i) { data.addLabel(deserializer.readString(), diff --git a/cave/com.raytheon.uf.viz.remote.graphics/src/com/raytheon/uf/viz/remote/graphics/extensions/DispatchColormappedImageExtension.java b/cave/com.raytheon.uf.viz.remote.graphics/src/com/raytheon/uf/viz/remote/graphics/extensions/DispatchColormappedImageExtension.java index 29906d0a93..1839581c7b 100644 --- a/cave/com.raytheon.uf.viz.remote.graphics/src/com/raytheon/uf/viz/remote/graphics/extensions/DispatchColormappedImageExtension.java +++ b/cave/com.raytheon.uf.viz.remote.graphics/src/com/raytheon/uf/viz/remote/graphics/extensions/DispatchColormappedImageExtension.java @@ -27,10 +27,13 @@ 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.events.colormap.UpdateColorMapEvent; +import com.raytheon.uf.viz.remote.graphics.events.colormap.UpdateColorMapParametersEvent; import com.raytheon.uf.viz.remote.graphics.objects.DispatchingColormappedImage; /** - * TODO Add Description + * IColormappedImageExtension that is responsible for creating and dispatching + * events for IColormappedImages * *
  * 
@@ -113,13 +116,14 @@ public class DispatchColormappedImageExtension extends
         CreateColormappedImageEvent creation = RemoteGraphicsEventFactory
                 .createEvent(CreateColormappedImageEvent.class, image);
         if (colorMapParameters != null) {
-            creation.setColorMapParameters(DispatchingColormappedImage
-                    .createColorMapParametersUpdateEvent(image));
+            creation.setColorMapParameters(UpdateColorMapParametersEvent
+                    .createEvent(image, colorMapParameters));
+            creation.setColorMap(UpdateColorMapEvent.createEvent(image,
+                    colorMapParameters.getColorMap()));
         }
         target.dispatch(creation);
 
         // Return image
         return image;
     }
-
 }
diff --git a/cave/com.raytheon.uf.viz.remote.graphics/src/com/raytheon/uf/viz/remote/graphics/objects/DispatchingColormappedImage.java b/cave/com.raytheon.uf.viz.remote.graphics/src/com/raytheon/uf/viz/remote/graphics/objects/DispatchingColormappedImage.java
index e39e46458d..7580e02927 100644
--- a/cave/com.raytheon.uf.viz.remote.graphics/src/com/raytheon/uf/viz/remote/graphics/objects/DispatchingColormappedImage.java
+++ b/cave/com.raytheon.uf.viz.remote.graphics/src/com/raytheon/uf/viz/remote/graphics/objects/DispatchingColormappedImage.java
@@ -25,6 +25,7 @@ import com.raytheon.uf.viz.core.drawables.IColorMapParametersListener;
 import com.raytheon.uf.viz.core.drawables.IColormappedImage;
 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.UpdateColorMapEvent;
 import com.raytheon.uf.viz.remote.graphics.events.colormap.UpdateColorMapParametersEvent;
 
 /**
@@ -94,7 +95,7 @@ public class DispatchingColormappedImage extends
             wrappedObject.setColorMapParameters(params);
             if (params != null) {
                 params.addListener(this);
-                dispatch(createColorMapParametersUpdateEvent(this));
+                updateColorMapParameters();
             }
         }
     }
@@ -120,26 +121,17 @@ public class DispatchingColormappedImage extends
     public void colorMapChanged() {
         ColorMapParameters parameters = getColorMapParameters();
         if (parameters != null) {
-            dispatch(createColorMapParametersUpdateEvent(this));
+            updateColorMapParameters();
         }
     }
 
-    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();
+    public void updateColorMapParameters() {
+        ColorMapParameters parameters = getColorMapParameters();
+        dispatch(UpdateColorMapParametersEvent.createEvent(this, parameters));
+        if (parameters.getColorMap() != colorMap) {
+            colorMap = parameters.getColorMap();
+            dispatch(UpdateColorMapEvent.createEvent(this, colorMap));
         }
-        return event;
     }
 
     /*
diff --git a/cave/com.raytheon.uf.viz.remote.graphics/src/com/raytheon/uf/viz/remote/graphics/objects/DispatchingWireframeShape.java b/cave/com.raytheon.uf.viz.remote.graphics/src/com/raytheon/uf/viz/remote/graphics/objects/DispatchingWireframeShape.java
index a9590ed8ab..5ebe671d2a 100644
--- a/cave/com.raytheon.uf.viz.remote.graphics/src/com/raytheon/uf/viz/remote/graphics/objects/DispatchingWireframeShape.java
+++ b/cave/com.raytheon.uf.viz.remote.graphics/src/com/raytheon/uf/viz/remote/graphics/objects/DispatchingWireframeShape.java
@@ -19,6 +19,8 @@
  **/
 package com.raytheon.uf.viz.remote.graphics.objects;
 
+import java.util.ArrayList;
+
 import org.geotools.coverage.grid.GeneralGridGeometry;
 import org.geotools.referencing.operation.DefaultMathTransformFactory;
 import org.opengis.referencing.operation.MathTransform;
@@ -35,8 +37,8 @@ import com.raytheon.uf.viz.remote.graphics.events.RemoteGraphicsEventFactory;
 import com.raytheon.uf.viz.remote.graphics.events.wireframe.AllocatePointsEvent;
 import com.raytheon.uf.viz.remote.graphics.events.wireframe.SimpleWireframeShapeEvent;
 import com.raytheon.uf.viz.remote.graphics.events.wireframe.SimpleWireframeShapeEvent.EventAction;
-import com.raytheon.uf.viz.remote.graphics.events.wireframe.UpdateWireframeShapeEvent;
-import com.raytheon.uf.viz.remote.graphics.events.wireframe.WireframeShapeData;
+import com.raytheon.uf.viz.remote.graphics.events.wireframe.WireframeShapeDataEvent;
+import com.raytheon.uf.viz.remote.graphics.events.wireframe.WireframeShapeDataEvent.Label;
 import com.vividsolutions.jts.geom.Coordinate;
 
 /**
@@ -62,7 +64,7 @@ public class DispatchingWireframeShape extends
 
     private MathTransform worldToTargetGrid;
 
-    private WireframeShapeData shapeData;
+    private WireframeShapeDataEvent updateEvent;
 
     private boolean dirty = true;
 
@@ -73,7 +75,7 @@ public class DispatchingWireframeShape extends
     public DispatchingWireframeShape(IWireframeShape targetObject,
             Dispatcher dispatcher, GeneralGridGeometry targetGeometry) {
         super(targetObject, dispatcher);
-        this.shapeData = new WireframeShapeData();
+        this.updateEvent = createNewUpdateEvent();
         MathTransform worldToCRS = AbstractDescriptor
                 .getWorldToCRSTransform(targetGeometry);
         if (worldToCRS != null) {
@@ -97,22 +99,31 @@ public class DispatchingWireframeShape extends
     public void compile() {
         wrappedObject.compile();
         // flush data
-        updateState();
+        flushState();
+        // Event if original shape was mutable, once compiled we should not
+        // accept more data
+        updateEvent = null;
         // Send compile event
         sendSimpleEvent(EventAction.COMPILE);
     }
 
     /**
-     * 
+     * Flush the new data for the wireframe shape
      */
-    public void updateState() {
+    public void flushState() {
         if (dirty) {
-            if (shapeData != null) {
-                UpdateWireframeShapeEvent event = RemoteGraphicsEventFactory
-                        .createEvent(UpdateWireframeShapeEvent.class, this);
-                event.setWireframeData(shapeData);
-                shapeData = new WireframeShapeData();
-                dispatch(event);
+            if (updateEvent != null) {
+                WireframeShapeDataEvent toSend = updateEvent;
+                if (wrappedObject.isMutable()) {
+                    toSend = createNewUpdateEvent();
+                    toSend.setCoordinates(new ArrayList(updateEvent
+                            .getCoordinates()));
+                    toSend.setLabels(new ArrayList