Issue #239 Started persistable object event pattern. Made construction
of single color images cheaper to allow object construction to happen immediately Former-commit-id:9d0eecb9b1
[formerly523c90b697
] [formerly9d0eecb9b1
[formerly523c90b697
] [formerlyda5e17d6e3
[formerly 995ddaebb670eb1689aeb44e3cb760731db46e80]]] Former-commit-id:da5e17d6e3
Former-commit-id:baf778717f
[formerlyf05528979d
] Former-commit-id:04cf9dba60
This commit is contained in:
parent
4fa7c6a38f
commit
f6a582c033
15 changed files with 457 additions and 96 deletions
|
@ -38,6 +38,7 @@ import com.raytheon.uf.viz.collaboration.ui.editor.EditorSetup;
|
|||
import com.raytheon.uf.viz.collaboration.ui.editor.SharedEditorData;
|
||||
import com.raytheon.uf.viz.collaboration.ui.editor.SharedResource;
|
||||
import com.raytheon.uf.viz.collaboration.ui.editor.event.InputEvent;
|
||||
import com.raytheon.uf.viz.collaboration.ui.role.event.CollaborationDispatcher;
|
||||
import com.raytheon.uf.viz.collaboration.ui.rsc.CollaborationWrapperResource;
|
||||
import com.raytheon.uf.viz.collaboration.ui.rsc.CollaborationWrapperResourceData;
|
||||
import com.raytheon.uf.viz.core.IDisplayPane;
|
||||
|
@ -48,7 +49,6 @@ import com.raytheon.uf.viz.core.exception.VizException;
|
|||
import com.raytheon.uf.viz.core.rsc.ResourceList;
|
||||
import com.raytheon.uf.viz.core.rsc.ResourceList.AddListener;
|
||||
import com.raytheon.uf.viz.core.rsc.ResourceList.RemoveListener;
|
||||
import com.raytheon.uf.viz.remote.graphics.AbstractRemoteGraphicsEvent;
|
||||
import com.raytheon.uf.viz.remote.graphics.Dispatcher;
|
||||
import com.raytheon.uf.viz.remote.graphics.DispatcherFactory;
|
||||
import com.raytheon.uf.viz.remote.graphics.DispatchingGraphicsFactory;
|
||||
|
@ -233,19 +233,7 @@ public class DataProviderEventController extends AbstractRoleEventController {
|
|||
new DispatcherFactory() {
|
||||
@Override
|
||||
public Dispatcher createNewDispatcher() {
|
||||
Dispatcher dispatcher = new Dispatcher() {
|
||||
@Override
|
||||
public void dispatch(
|
||||
AbstractRemoteGraphicsEvent eventObject) {
|
||||
try {
|
||||
session.sendObjectToVenue(eventObject);
|
||||
} catch (CollaborationException e) {
|
||||
statusHandler.handle(Priority.PROBLEM,
|
||||
e.getLocalizedMessage(), e);
|
||||
}
|
||||
}
|
||||
};
|
||||
return dispatcher;
|
||||
return new CollaborationDispatcher(session);
|
||||
}
|
||||
});
|
||||
try {
|
||||
|
|
|
@ -0,0 +1,95 @@
|
|||
/**
|
||||
* 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.collaboration.ui.role.event;
|
||||
|
||||
import com.raytheon.uf.common.status.UFStatus.Priority;
|
||||
import com.raytheon.uf.viz.collaboration.comm.identity.CollaborationException;
|
||||
import com.raytheon.uf.viz.collaboration.comm.identity.ISharedDisplaySession;
|
||||
import com.raytheon.uf.viz.collaboration.ui.Activator;
|
||||
import com.raytheon.uf.viz.core.jobs.JobPool;
|
||||
import com.raytheon.uf.viz.remote.graphics.AbstractRemoteGraphicsEvent;
|
||||
import com.raytheon.uf.viz.remote.graphics.Dispatcher;
|
||||
import com.raytheon.uf.viz.remote.graphics.events.IRenderEvent;
|
||||
|
||||
/**
|
||||
* Dispatches graphics objects to participants in the collaboration session
|
||||
*
|
||||
* <pre>
|
||||
*
|
||||
* SOFTWARE HISTORY
|
||||
*
|
||||
* Date Ticket# Engineer Description
|
||||
* ------------ ---------- ----------- --------------------------
|
||||
* Apr 19, 2012 mschenke Initial creation
|
||||
*
|
||||
* </pre>
|
||||
*
|
||||
* @author mschenke
|
||||
* @version 1.0
|
||||
*/
|
||||
|
||||
public class CollaborationDispatcher extends Dispatcher {
|
||||
|
||||
private static JobPool persistPool = new JobPool("Persister", 4, true);
|
||||
|
||||
private ISharedDisplaySession session;
|
||||
|
||||
public CollaborationDispatcher(ISharedDisplaySession session) {
|
||||
this.session = session;
|
||||
}
|
||||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
*
|
||||
* @see
|
||||
* com.raytheon.uf.viz.remote.graphics.Dispatcher#dispatch(com.raytheon.
|
||||
* uf.viz.remote.graphics.AbstractRemoteGraphicsEvent)
|
||||
*/
|
||||
@Override
|
||||
public void dispatch(final AbstractRemoteGraphicsEvent eventObject) {
|
||||
if (eventObject instanceof IRenderEvent == false) {
|
||||
final PersistedObjectEvent persist = HttpPersistedObjectEvent
|
||||
.createNewObject(session.getSessionId());
|
||||
persistPool.schedule(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
try {
|
||||
persist.store(eventObject);
|
||||
send(persist);
|
||||
} catch (CollaborationException e) {
|
||||
Activator.statusHandler.handle(Priority.PROBLEM,
|
||||
e.getLocalizedMessage(), e);
|
||||
}
|
||||
}
|
||||
});
|
||||
} else {
|
||||
send(eventObject);
|
||||
}
|
||||
}
|
||||
|
||||
private void send(Object obj) {
|
||||
try {
|
||||
session.sendObjectToVenue(obj);
|
||||
} catch (CollaborationException e) {
|
||||
Activator.statusHandler.handle(Priority.PROBLEM,
|
||||
e.getLocalizedMessage(), e);
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,151 @@
|
|||
/**
|
||||
* 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.collaboration.ui.role.event;
|
||||
|
||||
import com.raytheon.uf.common.serialization.annotations.DynamicSerialize;
|
||||
import com.raytheon.uf.common.serialization.annotations.DynamicSerializeElement;
|
||||
import com.raytheon.uf.viz.remote.graphics.AbstractRemoteGraphicsEvent;
|
||||
|
||||
/**
|
||||
* TODO Add Description
|
||||
*
|
||||
* <pre>
|
||||
*
|
||||
* SOFTWARE HISTORY
|
||||
*
|
||||
* Date Ticket# Engineer Description
|
||||
* ------------ ---------- ----------- --------------------------
|
||||
* Apr 19, 2012 mschenke Initial creation
|
||||
*
|
||||
* </pre>
|
||||
*
|
||||
* @author mschenke
|
||||
* @version 1.0
|
||||
*/
|
||||
@DynamicSerialize
|
||||
public class HttpPersistedObjectEvent extends PersistedObjectEvent {
|
||||
|
||||
private static long eventIdCounter = 0;
|
||||
|
||||
public static synchronized HttpPersistedObjectEvent createNewObject(
|
||||
String sessionId) {
|
||||
HttpPersistedObjectEvent event = new HttpPersistedObjectEvent();
|
||||
event.sessionId = sessionId;
|
||||
event.eventId = ++eventIdCounter;
|
||||
return event;
|
||||
}
|
||||
|
||||
@DynamicSerializeElement
|
||||
private String sessionId;
|
||||
|
||||
@DynamicSerializeElement
|
||||
private int objectId;
|
||||
|
||||
@DynamicSerializeElement
|
||||
private long eventId;
|
||||
|
||||
@DynamicSerializeElement
|
||||
private AbstractRemoteGraphicsEvent event;
|
||||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
*
|
||||
* @see
|
||||
* com.raytheon.uf.viz.collaboration.ui.role.event.IPersistedObjectEvent
|
||||
* #store(com.raytheon.uf.viz.remote.graphics.AbstractRemoteGraphicsEvent)
|
||||
*/
|
||||
@Override
|
||||
public void store(AbstractRemoteGraphicsEvent event) {
|
||||
this.event = event;
|
||||
}
|
||||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
*
|
||||
* @see
|
||||
* com.raytheon.uf.viz.collaboration.ui.role.event.IPersistedObjectEvent
|
||||
* #retrieve()
|
||||
*/
|
||||
@Override
|
||||
public AbstractRemoteGraphicsEvent retrieve() {
|
||||
return event;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the sessionId
|
||||
*/
|
||||
public String getSessionId() {
|
||||
return sessionId;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param sessionId
|
||||
* the sessionId to set
|
||||
*/
|
||||
public void setSessionId(String sessionId) {
|
||||
this.sessionId = sessionId;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the objectId
|
||||
*/
|
||||
public int getObjectId() {
|
||||
return objectId;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param objectId
|
||||
* the objectId to set
|
||||
*/
|
||||
public void setObjectId(int objectId) {
|
||||
this.objectId = objectId;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the eventId
|
||||
*/
|
||||
public long getEventId() {
|
||||
return eventId;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param eventId
|
||||
* the eventId to set
|
||||
*/
|
||||
public void setEventId(long eventId) {
|
||||
this.eventId = eventId;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the event
|
||||
*/
|
||||
public AbstractRemoteGraphicsEvent getEvent() {
|
||||
return event;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param event
|
||||
* the event to set
|
||||
*/
|
||||
public void setEvent(AbstractRemoteGraphicsEvent event) {
|
||||
this.event = event;
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,53 @@
|
|||
/**
|
||||
* 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.collaboration.ui.role.event;
|
||||
|
||||
import com.raytheon.uf.common.serialization.annotations.DynamicSerialize;
|
||||
import com.raytheon.uf.viz.collaboration.comm.identity.CollaborationException;
|
||||
import com.raytheon.uf.viz.remote.graphics.AbstractRemoteGraphicsEvent;
|
||||
|
||||
/**
|
||||
* Interface for defining an object that can retrieve and store a single object.
|
||||
* Implementing objects need to be serializable so they can be sent over to
|
||||
* participants and retrieve their data
|
||||
*
|
||||
* <pre>
|
||||
*
|
||||
* SOFTWARE HISTORY
|
||||
*
|
||||
* Date Ticket# Engineer Description
|
||||
* ------------ ---------- ----------- --------------------------
|
||||
* Apr 19, 2012 mschenke Initial creation
|
||||
*
|
||||
* </pre>
|
||||
*
|
||||
* @author mschenke
|
||||
* @version 1.0
|
||||
*/
|
||||
@DynamicSerialize
|
||||
public abstract class PersistedObjectEvent {
|
||||
|
||||
public abstract void store(AbstractRemoteGraphicsEvent event)
|
||||
throws CollaborationException;
|
||||
|
||||
public abstract AbstractRemoteGraphicsEvent retrieve()
|
||||
throws CollaborationException;
|
||||
|
||||
}
|
|
@ -27,12 +27,17 @@ import org.eclipse.jface.action.IMenuManager;
|
|||
|
||||
import com.google.common.eventbus.EventBus;
|
||||
import com.google.common.eventbus.Subscribe;
|
||||
import com.raytheon.uf.common.status.UFStatus.Priority;
|
||||
import com.raytheon.uf.viz.collaboration.comm.identity.CollaborationException;
|
||||
import com.raytheon.uf.viz.collaboration.ui.Activator;
|
||||
import com.raytheon.uf.viz.collaboration.ui.role.event.PersistedObjectEvent;
|
||||
import com.raytheon.uf.viz.collaboration.ui.rsc.rendering.CollaborationRenderingDataManager;
|
||||
import com.raytheon.uf.viz.collaboration.ui.rsc.rendering.CollaborationRenderingHandler;
|
||||
import com.raytheon.uf.viz.core.IGraphicsTarget;
|
||||
import com.raytheon.uf.viz.core.drawables.IDescriptor;
|
||||
import com.raytheon.uf.viz.core.drawables.PaintProperties;
|
||||
import com.raytheon.uf.viz.core.exception.VizException;
|
||||
import com.raytheon.uf.viz.core.jobs.JobPool;
|
||||
import com.raytheon.uf.viz.core.rsc.AbstractVizResource;
|
||||
import com.raytheon.uf.viz.core.rsc.LoadProperties;
|
||||
import com.raytheon.uf.viz.core.rsc.RenderingOrderFactory.ResourceOrder;
|
||||
|
@ -64,6 +69,8 @@ public class CollaborationResource extends
|
|||
AbstractVizResource<CollaborationResourceData, IDescriptor> implements
|
||||
IContextMenuProvider {
|
||||
|
||||
private static JobPool retrievePool = new JobPool("Retriever", 4, true);
|
||||
|
||||
/** List of objects rendered in paint */
|
||||
private List<IRenderEvent> currentRenderables;
|
||||
|
||||
|
@ -134,6 +141,21 @@ public class CollaborationResource extends
|
|||
}
|
||||
}
|
||||
|
||||
@Subscribe
|
||||
public void persitableArrived(final PersistedObjectEvent event) {
|
||||
retrievePool.schedule(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
try {
|
||||
renderableArrived(event.retrieve());
|
||||
} catch (CollaborationException e) {
|
||||
Activator.statusHandler.handle(Priority.PROBLEM,
|
||||
e.getLocalizedMessage(), e);
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@Subscribe
|
||||
public void renderableArrived(AbstractRemoteGraphicsEvent event) {
|
||||
if (event instanceof IRenderEvent) {
|
||||
|
|
|
@ -19,6 +19,7 @@
|
|||
**/
|
||||
package com.raytheon.uf.viz.collaboration.ui.rsc.rendering;
|
||||
|
||||
import java.awt.image.RenderedImage;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
|
@ -28,6 +29,7 @@ import com.raytheon.uf.viz.core.IGraphicsTarget;
|
|||
import com.raytheon.uf.viz.core.IMesh;
|
||||
import com.raytheon.uf.viz.core.PixelCoverage;
|
||||
import com.raytheon.uf.viz.core.data.IColorMapDataRetrievalCallback;
|
||||
import com.raytheon.uf.viz.core.data.IRenderedImageCallback;
|
||||
import com.raytheon.uf.viz.core.drawables.ColorMapParameters;
|
||||
import com.raytheon.uf.viz.core.drawables.IColormappedImage;
|
||||
import com.raytheon.uf.viz.core.drawables.IImage;
|
||||
|
@ -40,9 +42,11 @@ 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.UpdateColorMapParametersEvent;
|
||||
import com.raytheon.uf.viz.remote.graphics.events.imagery.CreateIImageEvent;
|
||||
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.RenderedImageEvent;
|
||||
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;
|
||||
|
@ -126,6 +130,48 @@ public class ImagingRenderingHandler extends CollaborationRenderingHandler {
|
|||
image.dispose();
|
||||
}
|
||||
|
||||
// ================== RenderedImage events ==================
|
||||
|
||||
public class RenderedImageDataCallback implements IRenderedImageCallback {
|
||||
private RenderedImage image;
|
||||
|
||||
@Override
|
||||
public RenderedImage getImage() throws VizException {
|
||||
RenderedImage rval = image;
|
||||
if (image != null) {
|
||||
image = null;
|
||||
}
|
||||
return rval;
|
||||
}
|
||||
|
||||
public void setData(RenderedImage image) {
|
||||
this.image = image;
|
||||
}
|
||||
}
|
||||
|
||||
@Subscribe
|
||||
public void createImage(CreateIImageEvent event) {
|
||||
IGraphicsTarget target = getTarget();
|
||||
RenderedImageDataCallback callback = new RenderedImageDataCallback();
|
||||
IImage image = target.initializeRaster(callback);
|
||||
dataManager.putRenderableObject(event.getObjectId(), new Object[] {
|
||||
image, callback });
|
||||
}
|
||||
|
||||
@Subscribe
|
||||
public void disposeCallback(RenderedImageDataCallback callback) {
|
||||
callback.setData(null);
|
||||
}
|
||||
|
||||
@Subscribe
|
||||
public void handleRenderedImage(RenderedImageEvent event) {
|
||||
RenderedImageDataCallback callback = dataManager.getRenderableObject(
|
||||
event.getObjectId(), RenderedImageDataCallback.class);
|
||||
if (callback != null) {
|
||||
callback.setData(event.getRenderedImage());
|
||||
}
|
||||
}
|
||||
|
||||
// ================== IColormappedImage events ==================
|
||||
|
||||
/**
|
||||
|
@ -221,11 +267,13 @@ public class ImagingRenderingHandler extends CollaborationRenderingHandler {
|
|||
public void createSingleColorImage(CreateSingleColorImage event)
|
||||
throws VizException {
|
||||
IGraphicsTarget target = getTarget();
|
||||
RenderedImageDataCallback callback = new RenderedImageDataCallback();
|
||||
int imageId = event.getObjectId();
|
||||
ISingleColorImage image = target.getExtension(
|
||||
ISingleColorImageExtension.class).constructImage(
|
||||
event.getRenderedImage(), event.getColor());
|
||||
dataManager.putRenderableObject(imageId, image);
|
||||
ISingleColorImageExtension.class).constructImage(callback,
|
||||
event.getColor());
|
||||
dataManager.putRenderableObject(imageId,
|
||||
new Object[] { image, callback });
|
||||
}
|
||||
|
||||
@Subscribe
|
||||
|
|
|
@ -19,10 +19,9 @@
|
|||
**/
|
||||
package com.raytheon.uf.viz.core.drawables.ext;
|
||||
|
||||
import java.awt.image.RenderedImage;
|
||||
|
||||
import org.eclipse.swt.graphics.RGB;
|
||||
|
||||
import com.raytheon.uf.viz.core.data.IRenderedImageCallback;
|
||||
import com.raytheon.uf.viz.core.drawables.IImage;
|
||||
import com.raytheon.uf.viz.core.exception.VizException;
|
||||
|
||||
|
@ -60,6 +59,7 @@ public interface ISingleColorImageExtension extends IImagingExtension {
|
|||
* @return
|
||||
* @throws VizException
|
||||
*/
|
||||
public ISingleColorImage constructImage(RenderedImage image, RGB color);
|
||||
public ISingleColorImage constructImage(IRenderedImageCallback callback,
|
||||
RGB color);
|
||||
|
||||
}
|
||||
|
|
|
@ -68,6 +68,7 @@ import com.raytheon.uf.viz.core.geom.PixelCoordinate;
|
|||
import com.raytheon.uf.viz.remote.graphics.events.BeginFrameEvent;
|
||||
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.imagery.CreateIImageEvent;
|
||||
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;
|
||||
|
@ -171,10 +172,14 @@ public class DispatchGraphicsTarget extends DispatchingObject<IGraphicsTarget>
|
|||
DispatchingRenderedImageCallback wrappedCallback = new DispatchingRenderedImageCallback(
|
||||
imageCallback);
|
||||
// Create image from wrapped target and return DispatchingImage
|
||||
return new DispatchingImage(
|
||||
DispatchingImage image = new DispatchingImage(
|
||||
wrappedObject.initializeRaster(wrappedCallback),
|
||||
DispatchingImagingExtension.class, wrappedCallback,
|
||||
getDispatcher());
|
||||
// Send creation event
|
||||
dispatch(RemoteGraphicsEventFactory.createEvent(
|
||||
CreateIImageEvent.class, image));
|
||||
return image;
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -0,0 +1,44 @@
|
|||
/**
|
||||
* 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 com.raytheon.uf.common.serialization.annotations.DynamicSerialize;
|
||||
import com.raytheon.uf.viz.remote.graphics.events.AbstractDispatchingObjectEvent;
|
||||
|
||||
/**
|
||||
* Event for creating an IImage object
|
||||
*
|
||||
* <pre>
|
||||
*
|
||||
* SOFTWARE HISTORY
|
||||
*
|
||||
* Date Ticket# Engineer Description
|
||||
* ------------ ---------- ----------- --------------------------
|
||||
* Apr 19, 2012 mschenke Initial creation
|
||||
*
|
||||
* </pre>
|
||||
*
|
||||
* @author mschenke
|
||||
* @version 1.0
|
||||
*/
|
||||
@DynamicSerialize
|
||||
public class CreateIImageEvent extends AbstractDispatchingObjectEvent {
|
||||
|
||||
}
|
|
@ -19,10 +19,7 @@
|
|||
**/
|
||||
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
|
||||
|
@ -43,36 +40,4 @@ import com.raytheon.uf.common.serialization.annotations.DynamicSerializeElement;
|
|||
@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);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -19,12 +19,12 @@
|
|||
**/
|
||||
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.data.IRenderedImageCallback;
|
||||
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.DispatchingImage.DispatchingRenderedImageCallback;
|
||||
import com.raytheon.uf.viz.remote.graphics.objects.DispatchingSingleColorImage;
|
||||
|
||||
/**
|
||||
|
@ -55,14 +55,16 @@ public class DispatchingSingleColorImageExtension extends
|
|||
* org.eclipse.swt.graphics.RGB)
|
||||
*/
|
||||
@Override
|
||||
public ISingleColorImage constructImage(RenderedImage image, RGB color) {
|
||||
public ISingleColorImage constructImage(IRenderedImageCallback callback,
|
||||
RGB color) {
|
||||
try {
|
||||
DispatchingRenderedImageCallback wrapper = new DispatchingRenderedImageCallback(
|
||||
callback);
|
||||
return new DispatchingSingleColorImage(target.getWrappedObject()
|
||||
.getExtension(ISingleColorImageExtension.class)
|
||||
.constructImage(image, color),
|
||||
DispatchColormappedImageExtension.class,
|
||||
target.getDispatcher(), color,
|
||||
new RenderedImage[] { image });
|
||||
.constructImage(wrapper, color),
|
||||
DispatchingSingleColorImageExtension.class,
|
||||
target.getDispatcher(), color, wrapper);
|
||||
} catch (VizException e) {
|
||||
throw new RuntimeException(
|
||||
"Error constring dispatching single color image", e);
|
||||
|
|
|
@ -19,13 +19,10 @@
|
|||
**/
|
||||
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;
|
||||
|
@ -61,23 +58,12 @@ public class DispatchingSingleColorImage extends DispatchingImage implements
|
|||
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);
|
||||
DispatchingRenderedImageCallback callback) {
|
||||
super(targetObject, extensionClass, callback, dispatcher);
|
||||
color = startingColor;
|
||||
CreateSingleColorImage event = RemoteGraphicsEventFactory.createEvent(
|
||||
CreateSingleColorImage.class, this);
|
||||
event.setColor(color);
|
||||
event.setRenderedImage(renderedImage[0]);
|
||||
dispatch(event);
|
||||
}
|
||||
|
||||
|
|
|
@ -21,6 +21,7 @@ package com.raytheon.viz.core.gl.images;
|
|||
|
||||
import org.eclipse.swt.graphics.RGB;
|
||||
|
||||
import com.raytheon.uf.viz.core.data.IRenderedImageCallback;
|
||||
import com.raytheon.uf.viz.core.drawables.ext.ISingleColorImageExtension.ISingleColorImage;
|
||||
import com.raytheon.viz.core.gl.internal.ext.GLSingleColorImageExtension;
|
||||
|
||||
|
@ -42,13 +43,12 @@ import com.raytheon.viz.core.gl.internal.ext.GLSingleColorImageExtension;
|
|||
* @version 1.0
|
||||
*/
|
||||
|
||||
public class GLSingleColorImage extends GLDelegateImage<AbstractGLImage>
|
||||
implements ISingleColorImage {
|
||||
public class GLSingleColorImage extends GLImage implements ISingleColorImage {
|
||||
|
||||
private RGB color;
|
||||
|
||||
public GLSingleColorImage(AbstractGLImage image, RGB color) {
|
||||
super(image, GLSingleColorImageExtension.class);
|
||||
public GLSingleColorImage(IRenderedImageCallback callback, RGB color) {
|
||||
super(callback, GLSingleColorImageExtension.class);
|
||||
this.color = color;
|
||||
}
|
||||
|
||||
|
|
|
@ -19,8 +19,6 @@
|
|||
**/
|
||||
package com.raytheon.viz.core.gl.internal.ext;
|
||||
|
||||
import java.awt.image.RenderedImage;
|
||||
|
||||
import org.eclipse.swt.graphics.RGB;
|
||||
|
||||
import com.raytheon.uf.viz.core.data.IRenderedImageCallback;
|
||||
|
@ -30,7 +28,6 @@ import com.raytheon.uf.viz.core.drawables.ext.ISingleColorImageExtension;
|
|||
import com.raytheon.uf.viz.core.exception.VizException;
|
||||
import com.raytheon.viz.core.gl.glsl.AbstractGLSLImagingExtension;
|
||||
import com.raytheon.viz.core.gl.glsl.GLShaderProgram;
|
||||
import com.raytheon.viz.core.gl.images.GLImage;
|
||||
import com.raytheon.viz.core.gl.images.GLSingleColorImage;
|
||||
|
||||
/**
|
||||
|
@ -74,13 +71,9 @@ public class GLSingleColorImageExtension extends AbstractGLSLImagingExtension
|
|||
* org.eclipse.swt.graphics.RGB)
|
||||
*/
|
||||
@Override
|
||||
public ISingleColorImage constructImage(final RenderedImage image, RGB color) {
|
||||
return new GLSingleColorImage(new GLImage(new IRenderedImageCallback() {
|
||||
@Override
|
||||
public RenderedImage getImage() throws VizException {
|
||||
return image;
|
||||
}
|
||||
}, GLSingleColorImageExtension.class), color);
|
||||
public ISingleColorImage constructImage(IRenderedImageCallback callback,
|
||||
RGB color) {
|
||||
return new GLSingleColorImage(callback, color);
|
||||
}
|
||||
|
||||
/*
|
||||
|
|
|
@ -20,6 +20,7 @@
|
|||
package com.raytheon.viz.pointdata;
|
||||
|
||||
import java.awt.image.BufferedImage;
|
||||
import java.awt.image.RenderedImage;
|
||||
import java.util.Map;
|
||||
import java.util.concurrent.ConcurrentLinkedQueue;
|
||||
|
||||
|
@ -32,8 +33,10 @@ import org.eclipse.core.runtime.jobs.Job;
|
|||
import com.raytheon.uf.common.status.IUFStatusHandler;
|
||||
import com.raytheon.uf.common.status.UFStatus;
|
||||
import com.raytheon.uf.viz.core.IGraphicsTarget;
|
||||
import com.raytheon.uf.viz.core.data.IRenderedImageCallback;
|
||||
import com.raytheon.uf.viz.core.drawables.IImage;
|
||||
import com.raytheon.uf.viz.core.drawables.ext.ISingleColorImageExtension;
|
||||
import com.raytheon.uf.viz.core.exception.VizException;
|
||||
|
||||
/**
|
||||
* Job separated from PlotModelGenerator2 that creates the plot images.
|
||||
|
@ -88,8 +91,8 @@ public class PlotModelGeneratorJob extends Job {
|
|||
while (!taskQueue.isEmpty()) {
|
||||
try {
|
||||
PlotInfo[] infos = taskQueue.poll();
|
||||
BufferedImage bImage = plotCreator.getStationPlot(infos[0].pdv,
|
||||
infos[0].latitude, infos[0].longitude);
|
||||
final BufferedImage bImage = plotCreator.getStationPlot(
|
||||
infos[0].pdv, infos[0].latitude, infos[0].longitude);
|
||||
IImage image = null;
|
||||
if (bImage != null) {
|
||||
if (imageCache.containsKey(bImage)) {
|
||||
|
@ -103,7 +106,13 @@ public class PlotModelGeneratorJob extends Job {
|
|||
if (image == null) {
|
||||
image = target.getExtension(
|
||||
ISingleColorImageExtension.class)
|
||||
.constructImage(bImage, null);
|
||||
.constructImage(new IRenderedImageCallback() {
|
||||
@Override
|
||||
public RenderedImage getImage()
|
||||
throws VizException {
|
||||
return bImage;
|
||||
}
|
||||
}, null);
|
||||
if (plotCreator.isCachingImages()) {
|
||||
imageCache.put(bImage, image);
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue