Issue #239 Got reprojection event working

Former-commit-id: 005beff18a [formerly 99e432cd258c9bf570a66be4702d28ac68204052]
Former-commit-id: 29f24e3ec5
This commit is contained in:
Max Schenkelberg 2012-04-18 13:45:39 -05:00
parent c986c29e6c
commit 6efccf10a5
6 changed files with 145 additions and 7 deletions

View file

@ -1,5 +1,6 @@
com.raytheon.uf.viz.collaboration.ui.editor.SharedEditorData
com.raytheon.uf.viz.collaboration.ui.editor.SharedResource
com.raytheon.uf.viz.collaboration.ui.editor.ReprojectEditor
com.raytheon.uf.viz.collaboration.ui.rsc.CollaborationResourceData
com.raytheon.uf.viz.collaboration.ui.rsc.CollaborationWrapperResourceData
com.raytheon.uf.viz.collaboration.ui.telestrator.CollaborationPathDrawingResourceData

View file

@ -186,6 +186,7 @@ public class EditorSetup {
.getVenueDescription());
rsc.setSubject(((IVenueSession) session).getVenue().getInfo()
.getVenueSubject());
rsc.setSession(session);
}
}

View file

@ -0,0 +1,72 @@
/**
* This software was developed and / or modified by Raytheon Company,
* pursuant to Contract DG133W-05-CQ-1067 with the US Government.
*
* U.S. EXPORT CONTROLLED TECHNICAL DATA
* This software product contains export-restricted data whose
* export/transfer/disclosure is restricted by U.S. law. Dissemination
* to non-U.S. persons whether in the United States or abroad requires
* an export license or other authorization.
*
* Contractor Name: Raytheon Company
* Contractor Address: 6825 Pine Street, Suite 340
* Mail Stop B8
* Omaha, NE 68106
* 402.291.0100
*
* See the AWIPS II Master Rights File ("Master Rights File.pdf") for
* further licensing information.
**/
package com.raytheon.uf.viz.collaboration.ui.editor;
import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlRootElement;
import javax.xml.bind.annotation.adapters.XmlJavaTypeAdapter;
import org.geotools.coverage.grid.GeneralGridGeometry;
import com.raytheon.uf.common.serialization.ISerializableObject;
import com.raytheon.uf.common.serialization.adapters.GridGeometryAdapter;
/**
* Collaboration event to reproject the viewing editor
*
* <pre>
*
* SOFTWARE HISTORY
*
* Date Ticket# Engineer Description
* ------------ ---------- ----------- --------------------------
* Apr 18, 2012 mschenke Initial creation
*
* </pre>
*
* @author mschenke
* @version 1.0
*/
@XmlRootElement
@XmlAccessorType(XmlAccessType.NONE)
public class ReprojectEditor implements ISerializableObject {
@XmlElement
@XmlJavaTypeAdapter(value = GridGeometryAdapter.class)
private GeneralGridGeometry targetGeometry;
/**
* @return the targetGeometry
*/
public GeneralGridGeometry getTargetGeometry() {
return targetGeometry;
}
/**
* @param targetGeometry
* the targetGeometry to set
*/
public void setTargetGeometry(GeneralGridGeometry targetGeometry) {
this.targetGeometry = targetGeometry;
}
}

View file

@ -22,6 +22,7 @@ package com.raytheon.uf.viz.collaboration.ui.role;
import com.google.common.eventbus.Subscribe;
import com.raytheon.uf.common.status.IUFStatusHandler;
import com.raytheon.uf.common.status.UFStatus;
import com.raytheon.uf.common.status.UFStatus.Priority;
import com.raytheon.uf.viz.collaboration.comm.identity.ISharedDisplaySession;
import com.raytheon.uf.viz.collaboration.comm.identity.user.ParticipantRole;
import com.raytheon.uf.viz.collaboration.comm.provider.TransferRoleCommand;
@ -29,13 +30,17 @@ import com.raytheon.uf.viz.collaboration.data.CollaborationDataManager;
import com.raytheon.uf.viz.collaboration.data.SharedDisplaySessionMgr;
import com.raytheon.uf.viz.collaboration.ui.editor.CollaborationEditor;
import com.raytheon.uf.viz.collaboration.ui.editor.EditorSetup;
import com.raytheon.uf.viz.collaboration.ui.editor.ReprojectEditor;
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.rsc.CollaborationResource;
import com.raytheon.uf.viz.collaboration.ui.rsc.CollaborationResourceData;
import com.raytheon.uf.viz.core.IDisplayPane;
import com.raytheon.uf.viz.core.VizApp;
import com.raytheon.uf.viz.core.drawables.AbstractDescriptor;
import com.raytheon.uf.viz.core.drawables.IDescriptor;
import com.raytheon.uf.viz.core.drawables.ResourcePair;
import com.raytheon.uf.viz.core.exception.VizException;
import com.raytheon.uf.viz.core.rsc.ResourceProperties;
/**
@ -94,6 +99,34 @@ public class ParticipantEventController extends AbstractRoleEventController {
super.activateTelestrator(); // TODO should this be elsewhere?
}
@Subscribe
public void reprojectEditor(final ReprojectEditor event) {
VizApp.runAsync(new Runnable() {
@Override
public void run() {
CollaborationEditor editor = SharedDisplaySessionMgr
.getSessionContainer(session.getSessionId())
.getCollaborationEditor();
for (IDisplayPane pane : editor.getDisplayPanes()) {
IDescriptor desc = pane.getDescriptor();
if (desc instanceof AbstractDescriptor) {
try {
((AbstractDescriptor) desc).setGridGeometry(event
.getTargetGeometry());
} catch (VizException e) {
statusHandler.handle(Priority.PROBLEM,
"Error reprojecting collaboration display: "
+ e.getLocalizedMessage(), e);
}
}
pane.setZoomLevel(1.0);
pane.scaleToClientArea();
pane.refresh();
}
}
});
}
@Subscribe
public void resourceDataArrived(SharedResource sr) {
ResourcePair rp = sr.getResource();

View file

@ -19,6 +19,13 @@
**/
package com.raytheon.uf.viz.collaboration.ui.rsc;
import org.opengis.referencing.crs.CoordinateReferenceSystem;
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.editor.ReprojectEditor;
import com.raytheon.uf.viz.core.IGraphicsTarget;
import com.raytheon.uf.viz.core.drawables.IDescriptor;
import com.raytheon.uf.viz.core.drawables.PaintProperties;
@ -52,6 +59,8 @@ public class SharedEditorIndicatorRsc extends
protected String subject;
protected ISharedDisplaySession session;
public SharedEditorIndicatorRsc(GenericResourceData resourceData,
LoadProperties loadProperties) {
super(resourceData, loadProperties);
@ -59,23 +68,41 @@ public class SharedEditorIndicatorRsc extends
@Override
protected void disposeInternal() {
// TODO Auto-generated method stub
}
@Override
protected void paintInternal(IGraphicsTarget target,
PaintProperties paintProps) throws VizException {
// TODO Auto-generated method stub
}
@Override
protected void initInternal(IGraphicsTarget target) throws VizException {
// TODO Auto-generated method stub
}
/*
* (non-Javadoc)
*
* @see
* com.raytheon.uf.viz.core.rsc.AbstractVizResource#project(org.opengis.
* referencing.crs.CoordinateReferenceSystem)
*/
@Override
public void project(CoordinateReferenceSystem crs) throws VizException {
ReprojectEditor event = new ReprojectEditor();
event.setTargetGeometry(descriptor.getGridGeometry());
try {
session.sendObjectToVenue(event);
} catch (CollaborationException e) {
Activator.statusHandler.handle(
Priority.PROBLEM,
"Error sending reprojection event: "
+ e.getLocalizedMessage(), e);
}
}
public String getName() {
String text = "Sharing with " + roomName;
if (!"".equals(subject)) {
@ -92,4 +119,8 @@ public class SharedEditorIndicatorRsc extends
this.subject = subject;
}
public void setSession(ISharedDisplaySession session) {
this.session = session;
}
}

View file

@ -241,12 +241,11 @@ public class ResourcePair implements ISerializableObject {
this.loadProperties = new LoadProperties();
}
setResource(this.resourceData
.construct(this.loadProperties, descriptor));
if (this.resource == null) {
AbstractVizResource rsc = this.resourceData.construct(
this.loadProperties, descriptor);
if (rsc == null) {
success = false;
} else {
AbstractVizResource rsc = this.resource;
rsc.setDescriptor(descriptor);
if (this.resourceData instanceof IResourceGroup) {
ResourceList rscList = ((IResourceGroup) this.resourceData)
@ -258,6 +257,7 @@ public class ResourcePair implements ISerializableObject {
}
}
}
setResource(rsc);
if (fireListeners) {
descriptor.getResourceList().firePreAddListeners(this);