#Issue 239 Got bulk event sending and only sending events when previous frame changes.
Former-commit-id: 4ac2f1ac53970f57936d3b8cd5dfcd90f718c6ce
This commit is contained in:
parent
d84865ced9
commit
001c52bd3a
21 changed files with 568 additions and 153 deletions
|
@ -19,12 +19,15 @@
|
|||
**/
|
||||
package com.raytheon.uf.viz.collaboration.radar.mosaic;
|
||||
|
||||
import java.util.Arrays;
|
||||
|
||||
import com.raytheon.uf.viz.core.DrawableImage;
|
||||
import com.raytheon.uf.viz.core.IExtent;
|
||||
import com.raytheon.uf.viz.core.drawables.ColorMapParameters;
|
||||
import com.raytheon.uf.viz.core.drawables.ext.IImagingExtension;
|
||||
import com.raytheon.uf.viz.remote.graphics.Dispatcher;
|
||||
import com.raytheon.uf.viz.remote.graphics.events.RemoteGraphicsEventFactory;
|
||||
import com.raytheon.uf.viz.remote.graphics.events.imagery.PaintImageEvent;
|
||||
import com.raytheon.uf.viz.remote.graphics.events.imagery.PaintImagesEvent;
|
||||
import com.raytheon.uf.viz.remote.graphics.objects.DispatchingColormappedImage;
|
||||
import com.raytheon.viz.radar.rsc.mosaic.ext.IRadarMosaicImageExtension.IMosaicImage;
|
||||
|
@ -50,6 +53,8 @@ import com.raytheon.viz.radar.rsc.mosaic.ext.IRadarMosaicImageExtension.IMosaicI
|
|||
public class DispatchingMosaicImage extends
|
||||
DispatchingColormappedImage<IMosaicImage> implements IMosaicImage {
|
||||
|
||||
private PaintImageEvent[] imagesToMosaic;
|
||||
|
||||
/**
|
||||
* @param targetObject
|
||||
* @param extensionClass
|
||||
|
@ -70,12 +75,17 @@ public class DispatchingMosaicImage extends
|
|||
*/
|
||||
@Override
|
||||
public void setImagesToMosaic(DrawableImage... images) {
|
||||
UpdateImagesToMosaic event = RemoteGraphicsEventFactory.createEvent(
|
||||
UpdateImagesToMosaic.class, this);
|
||||
event.setImagesToMosaic(PaintImagesEvent.toPaintEvents(images));
|
||||
wrappedObject.setImagesToMosaic(PaintImagesEvent
|
||||
.extractTargetImages(images));
|
||||
dispatch(event);
|
||||
PaintImageEvent[] imagesToMosaic = PaintImagesEvent
|
||||
.toPaintEvents(images);
|
||||
if (Arrays.equals(imagesToMosaic, this.imagesToMosaic) == false) {
|
||||
this.imagesToMosaic = imagesToMosaic;
|
||||
UpdateImagesToMosaic event = RemoteGraphicsEventFactory
|
||||
.createEvent(UpdateImagesToMosaic.class, this);
|
||||
event.setImagesToMosaic(imagesToMosaic);
|
||||
wrappedObject.setImagesToMosaic(PaintImagesEvent
|
||||
.extractTargetImages(images));
|
||||
dispatch(event);
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
|
|
|
@ -45,7 +45,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.role.dataprovider.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;
|
||||
|
|
|
@ -0,0 +1,200 @@
|
|||
/**
|
||||
* 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.dataprovider;
|
||||
|
||||
import java.util.ArrayList;
|
||||
|
||||
import com.raytheon.uf.common.serialization.SerializationUtil;
|
||||
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.comm.provider.Tools;
|
||||
import com.raytheon.uf.viz.collaboration.ui.Activator;
|
||||
import com.raytheon.uf.viz.collaboration.ui.role.dataprovider.event.IPersistedEvent;
|
||||
import com.raytheon.uf.viz.collaboration.ui.role.dataprovider.event.RenderFrameEvent;
|
||||
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.DispatchingObject;
|
||||
import com.raytheon.uf.viz.remote.graphics.events.AbstractDispatchingObjectEvent;
|
||||
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.ICreationEvent;
|
||||
import com.raytheon.uf.viz.remote.graphics.events.IRenderEvent;
|
||||
import com.raytheon.uf.viz.remote.graphics.events.RemoteGraphicsEventFactory;
|
||||
|
||||
/**
|
||||
* 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", 1, true);
|
||||
|
||||
private static final boolean PERSISTENCE = true;
|
||||
|
||||
private static final int IMMEDIATE_SEND_SIZE = 1024;
|
||||
|
||||
private ISharedDisplaySession session;
|
||||
|
||||
private IObjectEventPersistance persistance;
|
||||
|
||||
private DispatchingObject<?> frameObject;
|
||||
|
||||
private RenderFrameEvent previousFrame;
|
||||
|
||||
private RenderFrameEvent currentFrame;
|
||||
|
||||
public CollaborationDispatcher(ISharedDisplaySession session)
|
||||
throws CollaborationException {
|
||||
this.session = session;
|
||||
this.persistance = CollaborationObjectEventStorage
|
||||
.createPersistanceObject(session);
|
||||
}
|
||||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
*
|
||||
* @see
|
||||
* com.raytheon.uf.viz.remote.graphics.Dispatcher#dispatch(com.raytheon.
|
||||
* uf.viz.remote.graphics.AbstractRemoteGraphicsEvent)
|
||||
*/
|
||||
@Override
|
||||
public void dispatch(AbstractRemoteGraphicsEvent eventObject) {
|
||||
// Set PERSISTENCE to true if testing persisting capabilities
|
||||
if (PERSISTENCE
|
||||
&& eventObject instanceof AbstractDispatchingObjectEvent
|
||||
&& eventObject instanceof IRenderEvent == false) {
|
||||
boolean immediateSend = true;
|
||||
if (eventObject instanceof ICreationEvent == false) {
|
||||
// Not a creation event, check event size. All creation events
|
||||
// are sent immediately to avoid false negatives
|
||||
try {
|
||||
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,
|
||||
"Error determing size of eventObject: "
|
||||
+ eventObject, e);
|
||||
}
|
||||
}
|
||||
final AbstractDispatchingObjectEvent toPersist = (AbstractDispatchingObjectEvent) eventObject;
|
||||
final boolean[] sendPersisted = new boolean[] { !immediateSend };
|
||||
persistPool.schedule(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
try {
|
||||
IPersistedEvent event = persistance
|
||||
.persistEvent(toPersist);
|
||||
// If was no immediateSend, send now
|
||||
if (sendPersisted[0]) {
|
||||
send(event);
|
||||
}
|
||||
} catch (CollaborationException e) {
|
||||
Activator.statusHandler.handle(Priority.PROBLEM,
|
||||
e.getLocalizedMessage(), e);
|
||||
}
|
||||
}
|
||||
});
|
||||
// Need to immediately send eventObject
|
||||
if (immediateSend) {
|
||||
send(eventObject);
|
||||
}
|
||||
} else if (eventObject instanceof IRenderEvent) {
|
||||
if (eventObject instanceof BeginFrameEvent && currentFrame == null) {
|
||||
frameObject = new DispatchingObject<Object>(null, this);
|
||||
currentFrame = RemoteGraphicsEventFactory.createEvent(
|
||||
RenderFrameEvent.class, frameObject);
|
||||
}
|
||||
|
||||
currentFrame.addEvent((IRenderEvent) eventObject);
|
||||
if (eventObject instanceof EndFrameEvent) {
|
||||
if (currentFrame.equals(previousFrame)) {
|
||||
// No change in render, send event to render
|
||||
send(createRenderFrameEvent());
|
||||
currentFrame.getRenderEvents().clear();
|
||||
} else {
|
||||
// New info, send current frame with new render events as
|
||||
// new object to avoid unwanted data pointer manipulation
|
||||
RenderFrameEvent frameEvent = RemoteGraphicsEventFactory
|
||||
.createEvent(RenderFrameEvent.class, frameObject);
|
||||
frameEvent.setRenderEvents(new ArrayList<IRenderEvent>(
|
||||
currentFrame.getRenderEvents()));
|
||||
send(frameEvent);
|
||||
previousFrame = currentFrame;
|
||||
currentFrame = createRenderFrameEvent();
|
||||
}
|
||||
}
|
||||
} else {
|
||||
Activator.statusHandler.handle(Priority.PROBLEM,
|
||||
"Unable to handle event type: " + eventObject);
|
||||
}
|
||||
}
|
||||
|
||||
private RenderFrameEvent createRenderFrameEvent() {
|
||||
return RemoteGraphicsEventFactory.createEvent(RenderFrameEvent.class,
|
||||
frameObject);
|
||||
}
|
||||
|
||||
private void send(Object obj) {
|
||||
try {
|
||||
session.sendObjectToVenue(obj);
|
||||
} catch (CollaborationException e) {
|
||||
Activator.statusHandler.handle(Priority.PROBLEM,
|
||||
e.getLocalizedMessage(), e);
|
||||
}
|
||||
}
|
||||
|
||||
public void dispose() {
|
||||
try {
|
||||
persistance.dispose();
|
||||
} catch (CollaborationException e) {
|
||||
Activator.statusHandler.handle(Priority.PROBLEM,
|
||||
e.getLocalizedMessage(), e);
|
||||
}
|
||||
}
|
||||
}
|
|
@ -17,7 +17,7 @@
|
|||
* See the AWIPS II Master Rights File ("Master Rights File.pdf") for
|
||||
* further licensing information.
|
||||
**/
|
||||
package com.raytheon.uf.viz.collaboration.ui.role.event;
|
||||
package com.raytheon.uf.viz.collaboration.ui.role.dataprovider;
|
||||
|
||||
import java.net.URI;
|
||||
|
||||
|
@ -37,6 +37,9 @@ import com.raytheon.uf.common.serialization.annotations.DynamicSerializeElement;
|
|||
import com.raytheon.uf.viz.collaboration.comm.identity.CollaborationException;
|
||||
import com.raytheon.uf.viz.collaboration.comm.identity.ISharedDisplaySession;
|
||||
import com.raytheon.uf.viz.collaboration.comm.provider.Tools;
|
||||
import com.raytheon.uf.viz.collaboration.ui.Activator;
|
||||
import com.raytheon.uf.viz.collaboration.ui.prefs.CollabPrefConstants;
|
||||
import com.raytheon.uf.viz.collaboration.ui.role.dataprovider.event.IPersistedEvent;
|
||||
import com.raytheon.uf.viz.remote.graphics.events.AbstractDispatchingObjectEvent;
|
||||
import com.raytheon.uf.viz.remote.graphics.events.DisposeObjectEvent;
|
||||
import com.raytheon.uf.viz.remote.graphics.events.ICreationEvent;
|
||||
|
@ -61,6 +64,10 @@ import com.raytheon.uf.viz.remote.graphics.events.ICreationEvent;
|
|||
public class CollaborationObjectEventStorage implements
|
||||
IObjectEventPersistance, IObjectEventRetrieval {
|
||||
|
||||
private static final String SESSION_DATA_URL_FORMAT_STRING = "http://%s:%d/session_data/";
|
||||
|
||||
private static final int SESSION_DATA_PORT = 80;
|
||||
|
||||
private volatile long EVENT_ID_COUNTER = 0;
|
||||
|
||||
public static IObjectEventPersistance createPersistanceObject(
|
||||
|
@ -78,8 +85,7 @@ public class CollaborationObjectEventStorage implements
|
|||
|
||||
private ISharedDisplaySession session;
|
||||
|
||||
// TODO: Get Collaboration server to build URL
|
||||
private String baseUrl = "http://edexproxy:9582/collab/";
|
||||
private String sessionDataURL;
|
||||
|
||||
private HttpClient client;
|
||||
|
||||
|
@ -89,9 +95,18 @@ public class CollaborationObjectEventStorage implements
|
|||
}
|
||||
|
||||
private void setupStorage() throws CollaborationException {
|
||||
createFolder(session.getSessionId());
|
||||
// Successful creation of session folder, add to base url
|
||||
baseUrl += session.getSessionId() + "/";
|
||||
String collaborationServer = Activator.getDefault()
|
||||
.getPreferenceStore().getString(CollabPrefConstants.P_SERVER);
|
||||
if (collaborationServer != null) {
|
||||
sessionDataURL = String.format(SESSION_DATA_URL_FORMAT_STRING,
|
||||
collaborationServer, SESSION_DATA_PORT);
|
||||
createFolder(session.getSessionId());
|
||||
// Successful creation of session folder, add to base url
|
||||
sessionDataURL += session.getSessionId() + "/";
|
||||
} else {
|
||||
throw new CollaborationException(
|
||||
"Could not retrieve collaboration server from preferences");
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -108,7 +123,8 @@ public class CollaborationObjectEventStorage implements
|
|||
if (event instanceof ICreationEvent) {
|
||||
createFolder(String.valueOf(event.getObjectId()));
|
||||
} else if (event instanceof DisposeObjectEvent) {
|
||||
deleteResource(URI.create(baseUrl + event.getObjectId() + "/"));
|
||||
deleteResource(URI.create(sessionDataURL + event.getObjectId()
|
||||
+ "/"));
|
||||
CollaborationWrappedEvent wrapped = new CollaborationWrappedEvent();
|
||||
wrapped.setEvent(event);
|
||||
return wrapped;
|
||||
|
@ -116,9 +132,10 @@ public class CollaborationObjectEventStorage implements
|
|||
|
||||
try {
|
||||
CollaborationHttpPersistedEvent wrapped = new CollaborationHttpPersistedEvent();
|
||||
String eventObjectURL = baseUrl + event.getObjectId() + "/"
|
||||
String eventObjectURL = sessionDataURL + event.getObjectId() + "/"
|
||||
+ (++EVENT_ID_COUNTER) + ".obj";
|
||||
HttpPut put = new HttpPut(eventObjectURL);
|
||||
|
||||
put.setEntity(new ByteArrayEntity(Tools.compress(SerializationUtil
|
||||
.transformToThrift(event))));
|
||||
HttpClientResponse response = executeRequest(put);
|
||||
|
@ -146,7 +163,7 @@ public class CollaborationObjectEventStorage implements
|
|||
*/
|
||||
@Override
|
||||
public void dispose() throws CollaborationException {
|
||||
deleteResource(URI.create(baseUrl));
|
||||
deleteResource(URI.create(sessionDataURL));
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -208,7 +225,7 @@ public class CollaborationObjectEventStorage implements
|
|||
return "MKCOL";
|
||||
}
|
||||
};
|
||||
mkcol.setURI(URI.create(baseUrl + folderPath));
|
||||
mkcol.setURI(URI.create(sessionDataURL + folderPath));
|
||||
HttpClientResponse rsp = executeRequest(mkcol);
|
||||
if (rsp.code != 201) {
|
||||
throw new CollaborationException("Folder creation failed for "
|
||||
|
@ -218,8 +235,10 @@ 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
|
||||
if (rsp.code != 200 && rsp.code != 202 && rsp.code != 204) {
|
||||
// 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) {
|
||||
throw new CollaborationException("Folder creation failed for "
|
||||
+ uri + ": " + new String(rsp.data));
|
||||
}
|
|
@ -17,9 +17,10 @@
|
|||
* See the AWIPS II Master Rights File ("Master Rights File.pdf") for
|
||||
* further licensing information.
|
||||
**/
|
||||
package com.raytheon.uf.viz.collaboration.ui.role.event;
|
||||
package com.raytheon.uf.viz.collaboration.ui.role.dataprovider;
|
||||
|
||||
import com.raytheon.uf.viz.collaboration.comm.identity.CollaborationException;
|
||||
import com.raytheon.uf.viz.collaboration.ui.role.dataprovider.event.IPersistedEvent;
|
||||
import com.raytheon.uf.viz.remote.graphics.events.AbstractDispatchingObjectEvent;
|
||||
|
||||
/**
|
|
@ -17,9 +17,10 @@
|
|||
* See the AWIPS II Master Rights File ("Master Rights File.pdf") for
|
||||
* further licensing information.
|
||||
**/
|
||||
package com.raytheon.uf.viz.collaboration.ui.role.event;
|
||||
package com.raytheon.uf.viz.collaboration.ui.role.dataprovider;
|
||||
|
||||
import com.raytheon.uf.viz.collaboration.comm.identity.CollaborationException;
|
||||
import com.raytheon.uf.viz.collaboration.ui.role.dataprovider.event.IPersistedEvent;
|
||||
import com.raytheon.uf.viz.remote.graphics.events.AbstractDispatchingObjectEvent;
|
||||
|
||||
/**
|
|
@ -17,7 +17,7 @@
|
|||
* See the AWIPS II Master Rights File ("Master Rights File.pdf") for
|
||||
* further licensing information.
|
||||
**/
|
||||
package com.raytheon.uf.viz.collaboration.ui.role.event;
|
||||
package com.raytheon.uf.viz.collaboration.ui.role.dataprovider.event;
|
||||
|
||||
/**
|
||||
* Interface for distinguishing events that are persisted and should be
|
|
@ -0,0 +1,93 @@
|
|||
/**
|
||||
* 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.dataprovider.event;
|
||||
|
||||
import java.util.LinkedList;
|
||||
import java.util.List;
|
||||
|
||||
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.IRenderEvent;
|
||||
|
||||
/**
|
||||
* TODO Add Description
|
||||
*
|
||||
* <pre>
|
||||
*
|
||||
* SOFTWARE HISTORY
|
||||
*
|
||||
* Date Ticket# Engineer Description
|
||||
* ------------ ---------- ----------- --------------------------
|
||||
* Apr 24, 2012 mschenke Initial creation
|
||||
*
|
||||
* </pre>
|
||||
*
|
||||
* @author mschenke
|
||||
* @version 1.0
|
||||
*/
|
||||
@DynamicSerialize
|
||||
public class RenderFrameEvent extends AbstractDispatchingObjectEvent {
|
||||
|
||||
@DynamicSerializeElement
|
||||
private List<IRenderEvent> renderEvents = new LinkedList<IRenderEvent>();
|
||||
|
||||
/**
|
||||
* @return the renderEvents
|
||||
*/
|
||||
public List<IRenderEvent> getRenderEvents() {
|
||||
return renderEvents;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param renderEvents
|
||||
* the renderEvents to set
|
||||
*/
|
||||
public void setRenderEvents(List<IRenderEvent> renderEvents) {
|
||||
this.renderEvents = renderEvents;
|
||||
}
|
||||
|
||||
public void addEvent(IRenderEvent event) {
|
||||
renderEvents.add(event);
|
||||
}
|
||||
|
||||
/*
|
||||
* (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;
|
||||
RenderFrameEvent other = (RenderFrameEvent) obj;
|
||||
if (renderEvents == null) {
|
||||
if (other.renderEvents != null)
|
||||
return false;
|
||||
} else if (!renderEvents.equals(other.renderEvents))
|
||||
return false;
|
||||
return true;
|
||||
}
|
||||
|
||||
}
|
|
@ -1,123 +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.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.AbstractDispatchingObjectEvent;
|
||||
import com.raytheon.uf.viz.remote.graphics.events.ICreationEvent;
|
||||
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", 1, true);
|
||||
|
||||
private ISharedDisplaySession session;
|
||||
|
||||
private IObjectEventPersistance persistance;
|
||||
|
||||
public CollaborationDispatcher(ISharedDisplaySession session)
|
||||
throws CollaborationException {
|
||||
this.session = session;
|
||||
this.persistance = CollaborationObjectEventStorage
|
||||
.createPersistanceObject(session);
|
||||
}
|
||||
|
||||
private static final boolean PERSISTENCE = false;
|
||||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
*
|
||||
* @see
|
||||
* com.raytheon.uf.viz.remote.graphics.Dispatcher#dispatch(com.raytheon.
|
||||
* uf.viz.remote.graphics.AbstractRemoteGraphicsEvent)
|
||||
*/
|
||||
@Override
|
||||
public void dispatch(AbstractRemoteGraphicsEvent eventObject) {
|
||||
// Set PERSISTENCE to true if testing persisting capabilities
|
||||
if (PERSISTENCE
|
||||
&& eventObject instanceof AbstractDispatchingObjectEvent
|
||||
&& eventObject instanceof IRenderEvent == false) {
|
||||
final AbstractDispatchingObjectEvent toPersist = (AbstractDispatchingObjectEvent) eventObject;
|
||||
persistPool.schedule(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
try {
|
||||
IPersistedEvent event = persistance
|
||||
.persistEvent(toPersist);
|
||||
// Creation events are sent immediately to avoid false
|
||||
// negatives
|
||||
if (toPersist instanceof ICreationEvent == false) {
|
||||
send(event);
|
||||
}
|
||||
} catch (CollaborationException e) {
|
||||
Activator.statusHandler.handle(Priority.PROBLEM,
|
||||
e.getLocalizedMessage(), e);
|
||||
}
|
||||
}
|
||||
});
|
||||
if (eventObject instanceof ICreationEvent) {
|
||||
send(eventObject);
|
||||
}
|
||||
} else {
|
||||
send(eventObject);
|
||||
}
|
||||
}
|
||||
|
||||
private void send(Object obj) {
|
||||
try {
|
||||
session.sendObjectToVenue(obj);
|
||||
} catch (CollaborationException e) {
|
||||
Activator.statusHandler.handle(Priority.PROBLEM,
|
||||
e.getLocalizedMessage(), e);
|
||||
}
|
||||
}
|
||||
|
||||
public void dispose() {
|
||||
try {
|
||||
persistance.dispose();
|
||||
} catch (CollaborationException e) {
|
||||
Activator.statusHandler.handle(Priority.PROBLEM,
|
||||
e.getLocalizedMessage(), e);
|
||||
}
|
||||
}
|
||||
}
|
|
@ -30,7 +30,8 @@ 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.IPersistedEvent;
|
||||
import com.raytheon.uf.viz.collaboration.ui.role.dataprovider.event.IPersistedEvent;
|
||||
import com.raytheon.uf.viz.collaboration.ui.role.dataprovider.event.RenderFrameEvent;
|
||||
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;
|
||||
|
@ -142,6 +143,24 @@ public class CollaborationResource extends
|
|||
}
|
||||
}
|
||||
|
||||
@Subscribe
|
||||
public void renderFrameEvent(RenderFrameEvent event) {
|
||||
List<IRenderEvent> eventList = event.getRenderEvents();
|
||||
if (eventList == null) {
|
||||
// Check for previous event list
|
||||
event = dataManager.getRenderableObject(event.getObjectId(),
|
||||
RenderFrameEvent.class);
|
||||
} else {
|
||||
dataManager.putRenderableObject(event.getObjectId(), event);
|
||||
}
|
||||
if (event != null) {
|
||||
for (IRenderEvent re : event.getRenderEvents()) {
|
||||
// TODO: Unsafe casting, figure better way
|
||||
renderableArrived((AbstractRemoteGraphicsEvent) re);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Subscribe
|
||||
public void persitableArrived(final IPersistedEvent event) {
|
||||
retrievePool.schedule(new Runnable() {
|
||||
|
|
|
@ -39,9 +39,9 @@ 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.collaboration.ui.role.event.CollaborationObjectEventStorage;
|
||||
import com.raytheon.uf.viz.collaboration.ui.role.event.IObjectEventRetrieval;
|
||||
import com.raytheon.uf.viz.collaboration.ui.role.event.IPersistedEvent;
|
||||
import com.raytheon.uf.viz.collaboration.ui.role.dataprovider.CollaborationObjectEventStorage;
|
||||
import com.raytheon.uf.viz.collaboration.ui.role.dataprovider.IObjectEventRetrieval;
|
||||
import com.raytheon.uf.viz.collaboration.ui.role.dataprovider.event.IPersistedEvent;
|
||||
import com.raytheon.uf.viz.core.IGraphicsTarget;
|
||||
import com.raytheon.uf.viz.core.drawables.PaintProperties;
|
||||
import com.raytheon.uf.viz.remote.graphics.events.AbstractDispatchingObjectEvent;
|
||||
|
|
|
@ -39,7 +39,7 @@ import com.raytheon.uf.common.serialization.annotations.DynamicSerializeElement;
|
|||
* @version 1.0
|
||||
*/
|
||||
@DynamicSerialize
|
||||
public class AbstractRemoteGraphicsEvent {
|
||||
public abstract class AbstractRemoteGraphicsEvent {
|
||||
|
||||
@DynamicSerializeElement
|
||||
private int displayId;
|
||||
|
|
|
@ -19,7 +19,6 @@
|
|||
**/
|
||||
package com.raytheon.uf.viz.remote.graphics;
|
||||
|
||||
|
||||
/**
|
||||
* TODO Add Description
|
||||
*
|
||||
|
@ -45,7 +44,7 @@ public class DispatchingObject<T> {
|
|||
|
||||
protected T wrappedObject;
|
||||
|
||||
protected DispatchingObject(T targetObject, Dispatcher dispatcher) {
|
||||
public DispatchingObject(T targetObject, Dispatcher dispatcher) {
|
||||
this.wrappedObject = targetObject;
|
||||
this.dispatcher = dispatcher;
|
||||
objectId = dispatcher.newObjectId();
|
||||
|
|
|
@ -19,6 +19,8 @@
|
|||
**/
|
||||
package com.raytheon.uf.viz.remote.graphics.events;
|
||||
|
||||
import java.util.Arrays;
|
||||
|
||||
import com.raytheon.uf.common.serialization.annotations.DynamicSerialize;
|
||||
import com.raytheon.uf.common.serialization.annotations.DynamicSerializeElement;
|
||||
import com.raytheon.uf.viz.remote.graphics.AbstractRemoteGraphicsEvent;
|
||||
|
@ -79,4 +81,26 @@ public class BeginFrameEvent extends AbstractRemoteGraphicsEvent implements
|
|||
this.extentCenter = extentCenter;
|
||||
}
|
||||
|
||||
/*
|
||||
* (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;
|
||||
BeginFrameEvent other = (BeginFrameEvent) obj;
|
||||
if (!Arrays.equals(extentCenter, other.extentCenter))
|
||||
return false;
|
||||
if (Double.doubleToLongBits(extentFactor) != Double
|
||||
.doubleToLongBits(other.extentFactor))
|
||||
return false;
|
||||
return true;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -42,4 +42,20 @@ import com.raytheon.uf.viz.remote.graphics.AbstractRemoteGraphicsEvent;
|
|||
public class EndFrameEvent extends AbstractRemoteGraphicsEvent implements
|
||||
IRenderEvent {
|
||||
|
||||
/*
|
||||
* (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;
|
||||
return true;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -22,7 +22,7 @@ package com.raytheon.uf.viz.remote.graphics.events;
|
|||
/**
|
||||
* Interface for objects that events for actually rendering an object. These
|
||||
* types of events can be skipped over unlike data events which are required to
|
||||
* execute at some point
|
||||
* execute at some point. Render events must implements equals
|
||||
*
|
||||
* <pre>
|
||||
*
|
||||
|
@ -40,4 +40,7 @@ package com.raytheon.uf.viz.remote.graphics.events;
|
|||
|
||||
public interface IRenderEvent {
|
||||
|
||||
@Override
|
||||
public abstract boolean equals(Object obj);
|
||||
|
||||
}
|
||||
|
|
|
@ -142,4 +142,48 @@ public class PaintImageEvent extends AbstractDispatchingObjectEvent implements
|
|||
this.ur = coverage.getUr();
|
||||
this.ul = coverage.getUl();
|
||||
}
|
||||
|
||||
/*
|
||||
* (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;
|
||||
PaintImageEvent other = (PaintImageEvent) obj;
|
||||
if (meshId == other.meshId && meshId != -1) {
|
||||
// If meshes are set, compare them only
|
||||
return true;
|
||||
} else if (meshId == other.meshId) {
|
||||
// Compare extents if no meshes set (-1)
|
||||
if (ll == null) {
|
||||
if (other.ll != null)
|
||||
return false;
|
||||
} else if (!ll.equals(other.ll))
|
||||
return false;
|
||||
if (lr == null) {
|
||||
if (other.lr != null)
|
||||
return false;
|
||||
} else if (!lr.equals(other.lr))
|
||||
return false;
|
||||
if (ul == null) {
|
||||
if (other.ul != null)
|
||||
return false;
|
||||
} else if (!ul.equals(other.ul))
|
||||
return false;
|
||||
if (ur == null) {
|
||||
if (other.ur != null)
|
||||
return false;
|
||||
} else if (!ur.equals(other.ur))
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -19,6 +19,8 @@
|
|||
**/
|
||||
package com.raytheon.uf.viz.remote.graphics.events.imagery;
|
||||
|
||||
import java.util.Arrays;
|
||||
|
||||
import com.raytheon.uf.common.serialization.annotations.DynamicSerialize;
|
||||
import com.raytheon.uf.common.serialization.annotations.DynamicSerializeElement;
|
||||
import com.raytheon.uf.viz.core.DrawableImage;
|
||||
|
@ -152,4 +154,26 @@ public class PaintImagesEvent extends AbstractRemoteGraphicsEvent implements
|
|||
}
|
||||
return targeted;
|
||||
}
|
||||
|
||||
/*
|
||||
* (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;
|
||||
PaintImagesEvent other = (PaintImagesEvent) obj;
|
||||
if (Float.floatToIntBits(alpha) != Float.floatToIntBits(other.alpha))
|
||||
return false;
|
||||
if (!Arrays.equals(imageEvents, other.imageEvents))
|
||||
return false;
|
||||
return true;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -19,6 +19,8 @@
|
|||
**/
|
||||
package com.raytheon.uf.viz.remote.graphics.events.offscreen;
|
||||
|
||||
import java.util.Arrays;
|
||||
|
||||
import com.raytheon.uf.common.serialization.annotations.DynamicSerialize;
|
||||
import com.raytheon.uf.common.serialization.annotations.DynamicSerializeElement;
|
||||
import com.raytheon.uf.viz.core.IExtent;
|
||||
|
@ -86,4 +88,23 @@ public class RenderOffscreenEvent extends AbstractDispatchingObjectEvent
|
|||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* (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;
|
||||
RenderOffscreenEvent other = (RenderOffscreenEvent) obj;
|
||||
if (!Arrays.equals(extent, other.extent))
|
||||
return false;
|
||||
return true;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -43,4 +43,20 @@ import com.raytheon.uf.viz.remote.graphics.events.IRenderEvent;
|
|||
public class RenderOnscreenEvent extends AbstractRemoteGraphicsEvent implements
|
||||
IRenderEvent {
|
||||
|
||||
/*
|
||||
* (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;
|
||||
return true;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -188,4 +188,52 @@ public class RenderWireframeShapeEvent extends AbstractDispatchingObjectEvent
|
|||
}
|
||||
return color;
|
||||
}
|
||||
|
||||
/*
|
||||
* (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;
|
||||
RenderWireframeShapeEvent other = (RenderWireframeShapeEvent) obj;
|
||||
if (alpha == null) {
|
||||
if (other.alpha != null)
|
||||
return false;
|
||||
} else if (!alpha.equals(other.alpha))
|
||||
return false;
|
||||
if (blue == null) {
|
||||
if (other.blue != null)
|
||||
return false;
|
||||
} else if (!blue.equals(other.blue))
|
||||
return false;
|
||||
if (fontId == null) {
|
||||
if (other.fontId != null)
|
||||
return false;
|
||||
} else if (!fontId.equals(other.fontId))
|
||||
return false;
|
||||
if (green == null) {
|
||||
if (other.green != null)
|
||||
return false;
|
||||
} else if (!green.equals(other.green))
|
||||
return false;
|
||||
if (lineStyle != other.lineStyle)
|
||||
return false;
|
||||
if (Float.floatToIntBits(lineWidth) != Float
|
||||
.floatToIntBits(other.lineWidth))
|
||||
return false;
|
||||
if (red == null) {
|
||||
if (other.red != null)
|
||||
return false;
|
||||
} else if (!red.equals(other.red))
|
||||
return false;
|
||||
return true;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue