#429 fix issue where dialog prevents collaboration view from opening, add collaboration drawing layer, use event bus for message handling, prep work for
Former-commit-id: be35f7e75bbeb89fe160e24d9ff691f62753c96b
This commit is contained in:
parent
c29a5a75d9
commit
8e16194370
21 changed files with 880 additions and 155 deletions
|
@ -21,5 +21,6 @@ Require-Bundle: com.raytheon.viz.ui,
|
|||
Import-Package: com.raytheon.uf.common.status,
|
||||
com.raytheon.uf.viz.core.maps.display,
|
||||
com.raytheon.uf.viz.core.maps.rsc,
|
||||
com.raytheon.uf.viz.drawing
|
||||
com.raytheon.uf.viz.drawing,
|
||||
com.raytheon.viz.awipstools.ui.display
|
||||
Bundle-ActivationPolicy: lazy
|
||||
|
|
Binary file not shown.
After Width: | Height: | Size: 346 B |
|
@ -19,6 +19,7 @@
|
|||
**/
|
||||
package com.raytheon.uf.viz.collaboration.data;
|
||||
|
||||
import java.util.Collection;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
|
@ -34,6 +35,8 @@ import org.eclipse.ui.IWorkbenchPage;
|
|||
import org.eclipse.ui.PartInitException;
|
||||
import org.eclipse.ui.PlatformUI;
|
||||
|
||||
import com.google.common.collect.HashMultimap;
|
||||
import com.google.common.collect.Multimap;
|
||||
import com.google.common.eventbus.Subscribe;
|
||||
import com.raytheon.uf.common.status.IUFStatusHandler;
|
||||
import com.raytheon.uf.common.status.UFStatus;
|
||||
|
@ -51,6 +54,7 @@ import com.raytheon.uf.viz.collaboration.ui.login.LoginDialog;
|
|||
import com.raytheon.uf.viz.collaboration.ui.role.AbstractRoleEventController;
|
||||
import com.raytheon.uf.viz.collaboration.ui.role.DataProviderEventController;
|
||||
import com.raytheon.uf.viz.collaboration.ui.role.ParticipantEventController;
|
||||
import com.raytheon.uf.viz.collaboration.ui.role.SessionLeaderEventController;
|
||||
import com.raytheon.uf.viz.collaboration.ui.session.CollaborationSessionView;
|
||||
import com.raytheon.uf.viz.core.VizApp;
|
||||
|
||||
|
@ -103,7 +107,7 @@ public class CollaborationDataManager {
|
|||
*/
|
||||
Map<String, IVenueSession> sessionsMap;
|
||||
|
||||
private Map<String, AbstractRoleEventController> roleEventControllersMap;
|
||||
private Multimap<String, AbstractRoleEventController> roleEventControllersMap;
|
||||
|
||||
Map<String, CollaborationEditor> editorsMap;
|
||||
|
||||
|
@ -132,7 +136,7 @@ public class CollaborationDataManager {
|
|||
linkCollaboration = false;
|
||||
usersMap = new HashMap<String, DataUser>();
|
||||
sessionsMap = new HashMap<String, IVenueSession>();
|
||||
roleEventControllersMap = new HashMap<String, AbstractRoleEventController>();
|
||||
roleEventControllersMap = HashMultimap.create();
|
||||
editorsMap = new HashMap<String, CollaborationEditor>();
|
||||
}
|
||||
|
||||
|
@ -302,10 +306,12 @@ public class CollaborationDataManager {
|
|||
}
|
||||
}
|
||||
|
||||
AbstractRoleEventController controller = roleEventControllersMap
|
||||
.remove(sessionId);
|
||||
Collection<AbstractRoleEventController> controller = roleEventControllersMap
|
||||
.removeAll(sessionId);
|
||||
if (controller != null) {
|
||||
controller.shutdown();
|
||||
for (AbstractRoleEventController cont : controller) {
|
||||
cont.shutdown();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -381,7 +387,11 @@ public class CollaborationDataManager {
|
|||
DataProviderEventController dpec = new DataProviderEventController(
|
||||
displaySession);
|
||||
dpec.startup();
|
||||
SessionLeaderEventController slec = new SessionLeaderEventController(
|
||||
displaySession);
|
||||
slec.startup();
|
||||
roleEventControllersMap.put(sessionId, dpec);
|
||||
roleEventControllersMap.put(sessionId, slec);
|
||||
// TODO set displaySession's data provider and session leader.
|
||||
}
|
||||
} catch (CollaborationException e) {
|
||||
|
@ -411,6 +421,9 @@ public class CollaborationDataManager {
|
|||
public void run() {
|
||||
IQualifiedID inviter = invitation.getInviter();
|
||||
IQualifiedID room = invitation.getRoomId();
|
||||
if (shell.isDisposed()) {
|
||||
shell = new Shell(Display.getCurrent());
|
||||
}
|
||||
MessageBox box = new MessageBox(shell, SWT.ICON_QUESTION
|
||||
| SWT.OK | SWT.CANCEL);
|
||||
box.setText("Invitation");
|
||||
|
|
|
@ -27,10 +27,6 @@ import java.util.List;
|
|||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
|
||||
import org.eclipse.core.runtime.IProgressMonitor;
|
||||
import org.eclipse.core.runtime.IStatus;
|
||||
import org.eclipse.core.runtime.Status;
|
||||
import org.eclipse.core.runtime.jobs.Job;
|
||||
import org.eclipse.jface.action.Action;
|
||||
import org.eclipse.jface.action.ActionContributionItem;
|
||||
import org.eclipse.jface.action.IMenuCreator;
|
||||
|
@ -98,9 +94,7 @@ import com.raytheon.uf.viz.collaboration.ui.session.AbstractSessionView;
|
|||
import com.raytheon.uf.viz.collaboration.ui.session.CollaborationSessionView;
|
||||
import com.raytheon.uf.viz.collaboration.ui.session.PeerToPeerView;
|
||||
import com.raytheon.uf.viz.collaboration.ui.session.SessionView;
|
||||
import com.raytheon.uf.viz.core.VizApp;
|
||||
import com.raytheon.uf.viz.core.icon.IconUtil;
|
||||
import com.raytheon.uf.viz.drawing.PathToolbar;
|
||||
import com.raytheon.viz.ui.perspectives.VizPerspectiveListener;
|
||||
|
||||
/**
|
||||
|
@ -193,22 +187,6 @@ public class CollaborationGroupView extends ViewPart implements IPartListener {
|
|||
if (CollaborationDataManager.getInstance().isConnected() == false) {
|
||||
usersTreeViewer.getTree().setEnabled(false);
|
||||
}
|
||||
|
||||
Job job = new Job("Opening draw toolbar") {
|
||||
|
||||
@Override
|
||||
protected IStatus run(IProgressMonitor monitor) {
|
||||
VizApp.runAsync(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
final PathToolbar toolbar = PathToolbar.getToolbar();
|
||||
toolbar.open();
|
||||
}
|
||||
});
|
||||
return Status.OK_STATUS;
|
||||
}
|
||||
};
|
||||
job.schedule();
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -31,6 +31,7 @@ import com.raytheon.uf.viz.collaboration.ui.editor.EditorSetup;
|
|||
import com.raytheon.uf.viz.collaboration.ui.editor.SharedEditor;
|
||||
import com.raytheon.uf.viz.core.VizApp;
|
||||
import com.raytheon.uf.viz.core.rsc.IInputHandler.InputPriority;
|
||||
import com.raytheon.uf.viz.drawing.PathToolbar;
|
||||
|
||||
/**
|
||||
* Handles the events of a session that are specific to the Participant role.
|
||||
|
@ -79,4 +80,35 @@ public class ParticipantEventController extends AbstractRoleEventController {
|
|||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
*
|
||||
* @see
|
||||
* com.raytheon.uf.viz.collaboration.ui.role.AbstractRoleEventController
|
||||
* #startup()
|
||||
*/
|
||||
@Override
|
||||
public void startup() {
|
||||
super.startup();
|
||||
VizApp.runAsync(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
PathToolbar toolbar = PathToolbar.getToolbar();
|
||||
toolbar.open();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
*
|
||||
* @see
|
||||
* com.raytheon.uf.viz.collaboration.ui.role.AbstractRoleEventController
|
||||
* #shutdown()
|
||||
*/
|
||||
@Override
|
||||
public void shutdown() {
|
||||
super.shutdown();
|
||||
PathToolbar.getToolbar().close();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -0,0 +1,85 @@
|
|||
/**
|
||||
* 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;
|
||||
|
||||
import com.raytheon.uf.viz.collaboration.comm.identity.ISharedDisplaySession;
|
||||
import com.raytheon.uf.viz.collaboration.ui.telestrator.CollaborationPathToolbar;
|
||||
import com.raytheon.uf.viz.core.VizApp;
|
||||
import com.raytheon.uf.viz.drawing.PathToolbar;
|
||||
|
||||
/**
|
||||
* TODO Add Description
|
||||
*
|
||||
* <pre>
|
||||
*
|
||||
* SOFTWARE HISTORY
|
||||
*
|
||||
* Date Ticket# Engineer Description
|
||||
* ------------ ---------- ----------- --------------------------
|
||||
* Apr 2, 2012 mnash Initial creation
|
||||
*
|
||||
* </pre>
|
||||
*
|
||||
* @author mnash
|
||||
* @version 1.0
|
||||
*/
|
||||
|
||||
public class SessionLeaderEventController extends AbstractRoleEventController {
|
||||
|
||||
/**
|
||||
* @param session
|
||||
*/
|
||||
public SessionLeaderEventController(ISharedDisplaySession session) {
|
||||
super(session);
|
||||
}
|
||||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
*
|
||||
* @see
|
||||
* com.raytheon.uf.viz.collaboration.ui.role.AbstractRoleEventController
|
||||
* #startup()
|
||||
*/
|
||||
@Override
|
||||
public void startup() {
|
||||
super.startup();
|
||||
VizApp.runAsync(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
PathToolbar toolbar = CollaborationPathToolbar.getToolbar();
|
||||
toolbar.open();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
*
|
||||
* @see
|
||||
* com.raytheon.uf.viz.collaboration.ui.role.AbstractRoleEventController
|
||||
* #shutdown()
|
||||
*/
|
||||
@Override
|
||||
public void shutdown() {
|
||||
super.shutdown();
|
||||
PathToolbar.getToolbar().close();
|
||||
}
|
||||
|
||||
}
|
|
@ -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.telestrator;
|
||||
|
||||
import java.util.Arrays;
|
||||
import java.util.Map;
|
||||
|
||||
import org.eclipse.swt.graphics.Color;
|
||||
|
||||
import com.google.common.collect.HashMultimap;
|
||||
import com.google.common.collect.Multimap;
|
||||
import com.raytheon.uf.viz.collaboration.comm.identity.IVenueSession;
|
||||
import com.raytheon.uf.viz.collaboration.data.CollaborationDataManager;
|
||||
import com.raytheon.uf.viz.core.IGraphicsTarget;
|
||||
import com.raytheon.uf.viz.core.drawables.IWireframeShape;
|
||||
import com.raytheon.uf.viz.core.drawables.PaintProperties;
|
||||
import com.raytheon.uf.viz.core.exception.VizException;
|
||||
import com.raytheon.uf.viz.core.rsc.LoadProperties;
|
||||
import com.raytheon.uf.viz.core.rsc.capabilities.ColorableCapability;
|
||||
import com.raytheon.uf.viz.core.rsc.capabilities.OutlineCapability;
|
||||
import com.raytheon.uf.viz.drawing.DrawingLayer;
|
||||
import com.raytheon.uf.viz.drawing.PathDrawingResourceData;
|
||||
import com.vividsolutions.jts.geom.LineString;
|
||||
|
||||
/**
|
||||
* A layer that extends Drawing Layer but allows other users to have things
|
||||
* drawn as well
|
||||
*
|
||||
* <pre>
|
||||
*
|
||||
* SOFTWARE HISTORY
|
||||
*
|
||||
* Date Ticket# Engineer Description
|
||||
* ------------ ---------- ----------- --------------------------
|
||||
* Apr 3, 2012 mnash Initial creation
|
||||
*
|
||||
* </pre>
|
||||
*
|
||||
* @author mnash
|
||||
* @version 1.0
|
||||
*/
|
||||
|
||||
public class CollaborationDrawingLayer extends DrawingLayer {
|
||||
|
||||
private Multimap<Color, IWireframeShape> collaboratorShapes;
|
||||
|
||||
/**
|
||||
* @param data
|
||||
* @param props
|
||||
*/
|
||||
public CollaborationDrawingLayer(PathDrawingResourceData data,
|
||||
LoadProperties props) {
|
||||
super(data, props);
|
||||
}
|
||||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
*
|
||||
* @see
|
||||
* com.raytheon.uf.viz.drawing.DrawingLayer#initInternal(com.raytheon.uf
|
||||
* .viz.core.IGraphicsTarget)
|
||||
*/
|
||||
@Override
|
||||
protected void initInternal(IGraphicsTarget target) throws VizException {
|
||||
super.initInternal(target);
|
||||
this.collaboratorShapes = HashMultimap.create();
|
||||
getCapabilities().removeCapability(ColorableCapability.class);
|
||||
}
|
||||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
*
|
||||
* @see
|
||||
* com.raytheon.uf.viz.drawing.DrawingLayer#paintInternal(com.raytheon.uf
|
||||
* .viz.core.IGraphicsTarget,
|
||||
* com.raytheon.uf.viz.core.drawables.PaintProperties)
|
||||
*/
|
||||
@Override
|
||||
protected void paintInternal(IGraphicsTarget target,
|
||||
PaintProperties paintProps) throws VizException {
|
||||
super.paintInternal(target, paintProps);
|
||||
|
||||
OutlineCapability outline = getCapability(OutlineCapability.class);
|
||||
// paint the shapes that come over from others
|
||||
for (Color color : collaboratorShapes.keySet()) {
|
||||
for (IWireframeShape sh : collaboratorShapes.get(color)) {
|
||||
target.drawWireframeShape(sh, color.getRGB(),
|
||||
outline.getOutlineWidth(), outline.getLineStyle());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
*
|
||||
* @see com.raytheon.uf.viz.drawing.DrawingLayer#disposeInternal()
|
||||
*/
|
||||
@Override
|
||||
protected void disposeInternal() {
|
||||
super.disposeInternal();
|
||||
for (IWireframeShape shape : collaboratorShapes.values()) {
|
||||
shape.dispose();
|
||||
}
|
||||
collaboratorShapes.clear();
|
||||
}
|
||||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
*
|
||||
* @see
|
||||
* com.raytheon.uf.viz.drawing.DrawingLayer#finalizeLine(com.vividsolutions
|
||||
* .jts.geom.LineString, java.lang.String)
|
||||
*/
|
||||
@Override
|
||||
public void finalizeLine(LineString line, String uuid) {
|
||||
super.finalizeLine(line, uuid);
|
||||
|
||||
Map<String, IVenueSession> sessions = CollaborationDataManager
|
||||
.getInstance().getSessions();
|
||||
|
||||
TelestratorLine tObject = new TelestratorLine();
|
||||
// set the coordinates of the TransferLine
|
||||
tObject.setCoordinates(Arrays.asList(line.getCoordinates()));
|
||||
// get the color of the user here, before sending it off
|
||||
tObject.setColor(null);
|
||||
// for (String str : sessions.keySet()) {
|
||||
// try {
|
||||
// ((ISharedDisplaySession) sessions.get(str)).sendEvent(tObject);
|
||||
// } catch (CollaborationException e) {
|
||||
// e.printStackTrace();
|
||||
// }
|
||||
// }
|
||||
}
|
||||
}
|
|
@ -0,0 +1,86 @@
|
|||
/**
|
||||
* 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.telestrator;
|
||||
|
||||
import com.raytheon.uf.viz.core.drawables.IDescriptor;
|
||||
import com.raytheon.uf.viz.core.exception.VizException;
|
||||
import com.raytheon.uf.viz.core.rsc.LoadProperties;
|
||||
import com.raytheon.uf.viz.drawing.DrawingLayer;
|
||||
import com.raytheon.uf.viz.drawing.PathDrawingResourceData;
|
||||
|
||||
/**
|
||||
* TODO Add Description
|
||||
*
|
||||
* <pre>
|
||||
*
|
||||
* SOFTWARE HISTORY
|
||||
*
|
||||
* Date Ticket# Engineer Description
|
||||
* ------------ ---------- ----------- --------------------------
|
||||
* Apr 3, 2012 mnash Initial creation
|
||||
*
|
||||
* </pre>
|
||||
*
|
||||
* @author mnash
|
||||
* @version 1.0
|
||||
*/
|
||||
|
||||
public class CollaborationPathDrawingResourceData extends
|
||||
PathDrawingResourceData {
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
*
|
||||
* @see
|
||||
* com.raytheon.uf.viz.drawing.PathDrawingResourceData#construct(com.raytheon
|
||||
* .uf.viz.core.rsc.LoadProperties,
|
||||
* com.raytheon.uf.viz.core.drawables.IDescriptor)
|
||||
*/
|
||||
@Override
|
||||
public DrawingLayer construct(LoadProperties loadProperties,
|
||||
IDescriptor descriptor) throws VizException {
|
||||
CollaborationDrawingLayer layer = new CollaborationDrawingLayer(this,
|
||||
loadProperties);
|
||||
return layer;
|
||||
}
|
||||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
*
|
||||
* @see
|
||||
* com.raytheon.viz.awipstools.ui.display.AwipsToolsResourceData#setClassT
|
||||
* (java.lang.String)
|
||||
*/
|
||||
@Override
|
||||
public String getClassT() {
|
||||
return this.getClass().getCanonicalName();
|
||||
}
|
||||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
*
|
||||
* @see
|
||||
* com.raytheon.viz.awipstools.ui.display.AwipsToolsResourceData#setClassT
|
||||
* (java.lang.String)
|
||||
*/
|
||||
@Override
|
||||
public void setClassT(String classT) {
|
||||
|
||||
}
|
||||
}
|
|
@ -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.telestrator;
|
||||
|
||||
import com.raytheon.uf.viz.core.rsc.AbstractResourceData;
|
||||
import com.raytheon.uf.viz.drawing.tools.PathDrawingTool;
|
||||
|
||||
/**
|
||||
* TODO Add Description
|
||||
*
|
||||
* <pre>
|
||||
*
|
||||
* SOFTWARE HISTORY
|
||||
*
|
||||
* Date Ticket# Engineer Description
|
||||
* ------------ ---------- ----------- --------------------------
|
||||
* Apr 3, 2012 mnash Initial creation
|
||||
*
|
||||
* </pre>
|
||||
*
|
||||
* @author mnash
|
||||
* @version 1.0
|
||||
*/
|
||||
|
||||
public class CollaborationPathDrawingTool extends PathDrawingTool {
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
*
|
||||
* @see com.raytheon.uf.viz.drawing.tools.PathDrawingTool#constructData()
|
||||
*/
|
||||
@Override
|
||||
public AbstractResourceData constructData() {
|
||||
CollaborationPathDrawingResourceData data = new CollaborationPathDrawingResourceData();
|
||||
return data;
|
||||
}
|
||||
}
|
|
@ -0,0 +1,109 @@
|
|||
/**
|
||||
* 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.telestrator;
|
||||
|
||||
import org.eclipse.swt.widgets.Display;
|
||||
import org.eclipse.swt.widgets.Shell;
|
||||
|
||||
import com.raytheon.uf.viz.drawing.PathToolbar;
|
||||
import com.raytheon.uf.viz.drawing.events.DrawingEventBus;
|
||||
import com.raytheon.uf.viz.drawing.tools.PathDrawingTool;
|
||||
|
||||
/**
|
||||
* TODO Add Description
|
||||
*
|
||||
* <pre>
|
||||
*
|
||||
* SOFTWARE HISTORY
|
||||
*
|
||||
* Date Ticket# Engineer Description
|
||||
* ------------ ---------- ----------- --------------------------
|
||||
* Apr 3, 2012 mnash Initial creation
|
||||
*
|
||||
* </pre>
|
||||
*
|
||||
* @author mnash
|
||||
* @version 1.0
|
||||
*/
|
||||
|
||||
public class CollaborationPathToolbar extends PathToolbar {
|
||||
|
||||
/**
|
||||
* @param parentShell
|
||||
*/
|
||||
protected CollaborationPathToolbar(Shell parentShell) {
|
||||
super(parentShell);
|
||||
}
|
||||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
*
|
||||
* @see com.raytheon.uf.viz.drawing.PathToolbar#startTool()
|
||||
*/
|
||||
@Override
|
||||
protected void startTool() {
|
||||
PathDrawingTool tool = new CollaborationPathDrawingTool();
|
||||
tool.activate();
|
||||
}
|
||||
|
||||
public static PathToolbar getToolbar() {
|
||||
if (pathToolbar == null) {
|
||||
pathToolbar = new CollaborationPathToolbar(new Shell(
|
||||
Display.getCurrent()));
|
||||
DrawingEventBus.register(PathToolbar.getToolbar());
|
||||
}
|
||||
return pathToolbar;
|
||||
}
|
||||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
*
|
||||
* @see
|
||||
* com.raytheon.uf.viz.drawing.PathToolbar#initializeComponents(org.eclipse
|
||||
* .swt.widgets.Shell)
|
||||
*/
|
||||
@Override
|
||||
protected void initializeComponents(Shell shell) {
|
||||
// allows for subclasses to add more items to the toolbar, in this case
|
||||
// allowing the user to turn off other collaborator drawings
|
||||
super.initializeComponents(shell);
|
||||
// ToolItem allowOthersItem = new ToolItem(toolbar, SWT.CHECK);
|
||||
// allowOthersItem.setText("Leader Only");
|
||||
// allowOthersItem.setImage(IconUtil.getImageDescriptor(
|
||||
// Activator.getDefault().getBundle(), "multiple_draw.gif")
|
||||
// .createImage());
|
||||
// allowOthersItem.setSelection(true);
|
||||
// allowOthersItem.addSelectionListener(new SelectionAdapter() {
|
||||
// @Override
|
||||
// public void widgetSelected(SelectionEvent e) {
|
||||
// AbstractEditor editor = EditorUtil
|
||||
// .getActiveEditorAs(AbstractEditor.class);
|
||||
// IDescriptor desc = editor.getActiveDisplayPane()
|
||||
// .getDescriptor();
|
||||
// for (ResourcePair pair : desc.getResourceList()) {
|
||||
// if (pair.getResource() instanceof CollaborationDrawingLayer) {
|
||||
// System.out.println("collaborating");
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
// });
|
||||
}
|
||||
|
||||
}
|
|
@ -17,14 +17,16 @@
|
|||
* See the AWIPS II Master Rights File ("Master Rights File.pdf") for
|
||||
* further licensing information.
|
||||
**/
|
||||
package com.raytheon.uf.viz.drawing.objects;
|
||||
package com.raytheon.uf.viz.collaboration.ui.telestrator;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import org.eclipse.swt.graphics.Color;
|
||||
|
||||
import com.vividsolutions.jts.geom.Coordinate;
|
||||
|
||||
/**
|
||||
* TODO Add Description
|
||||
* A line for the telestrator
|
||||
*
|
||||
* <pre>
|
||||
*
|
||||
|
@ -40,9 +42,28 @@ import com.vividsolutions.jts.geom.Coordinate;
|
|||
* @version 1.0
|
||||
*/
|
||||
|
||||
public class TransferLine {
|
||||
public class TelestratorLine extends TelestratorObject {
|
||||
// the color of the shape to be drawn
|
||||
private Color color;
|
||||
|
||||
// the coordinates to be converted into a wireframe shape
|
||||
private List<Coordinate> coordinates;
|
||||
|
||||
/**
|
||||
* @param color
|
||||
* the color to set
|
||||
*/
|
||||
public void setColor(Color color) {
|
||||
this.color = color;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the color
|
||||
*/
|
||||
public Color getColor() {
|
||||
return color;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param coordinates
|
||||
* the coordinates to set
|
|
@ -17,25 +17,27 @@
|
|||
* See the AWIPS II Master Rights File ("Master Rights File.pdf") for
|
||||
* further licensing information.
|
||||
**/
|
||||
package com.raytheon.uf.viz.drawing.objects;
|
||||
package com.raytheon.uf.viz.collaboration.ui.telestrator;
|
||||
|
||||
import com.raytheon.uf.viz.collaboration.comm.identity.event.IDisplayEvent;
|
||||
|
||||
/**
|
||||
* TODO Add Description
|
||||
*
|
||||
* <pre>
|
||||
*
|
||||
*
|
||||
* SOFTWARE HISTORY
|
||||
*
|
||||
*
|
||||
* Date Ticket# Engineer Description
|
||||
* ------------ ---------- ----------- --------------------------
|
||||
* Mar 26, 2012 mnash Initial creation
|
||||
*
|
||||
*
|
||||
* </pre>
|
||||
*
|
||||
*
|
||||
* @author mnash
|
||||
* @version 1.0
|
||||
* @version 1.0
|
||||
*/
|
||||
|
||||
public class TransferObject {
|
||||
public class TelestratorObject implements IDisplayEvent {
|
||||
|
||||
}
|
|
@ -11,11 +11,13 @@ Require-Bundle: org.eclipse.ui,
|
|||
com.raytheon.uf.viz.core.rsc;bundle-version="1.0.0",
|
||||
com.raytheon.uf.common.geospatial;bundle-version="1.12.1174",
|
||||
com.raytheon.viz.awipstools;bundle-version="1.12.1174",
|
||||
com.raytheon.viz.ui;bundle-version="1.12.1174"
|
||||
com.raytheon.viz.ui;bundle-version="1.12.1174",
|
||||
com.google.guava;bundle-version="1.0.0"
|
||||
Bundle-RequiredExecutionEnvironment: JavaSE-1.6
|
||||
Bundle-ActivationPolicy: lazy
|
||||
Import-Package: com.raytheon.uf.common.time,
|
||||
com.raytheon.viz.ui.cmenu,
|
||||
com.vividsolutions.jts.geom
|
||||
Export-Package: com.raytheon.uf.viz.drawing,
|
||||
com.raytheon.uf.viz.drawing.objects
|
||||
com.raytheon.uf.viz.drawing.events,
|
||||
com.raytheon.uf.viz.drawing.tools
|
||||
|
|
|
@ -26,13 +26,12 @@ import java.util.LinkedHashMap;
|
|||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import org.eclipse.jface.action.Action;
|
||||
import org.eclipse.jface.action.IMenuManager;
|
||||
import org.eclipse.swt.graphics.RGB;
|
||||
|
||||
import com.google.common.eventbus.EventBus;
|
||||
import com.raytheon.uf.viz.core.IGraphicsTarget;
|
||||
import com.raytheon.uf.viz.core.drawables.IWireframeShape;
|
||||
import com.raytheon.uf.viz.core.drawables.PaintProperties;
|
||||
import com.raytheon.uf.viz.core.drawables.ResourcePair;
|
||||
import com.raytheon.uf.viz.core.exception.VizException;
|
||||
import com.raytheon.uf.viz.core.map.MapDescriptor;
|
||||
import com.raytheon.uf.viz.core.rsc.AbstractResourceData;
|
||||
|
@ -41,14 +40,16 @@ import com.raytheon.uf.viz.core.rsc.LoadProperties;
|
|||
import com.raytheon.uf.viz.core.rsc.capabilities.ColorableCapability;
|
||||
import com.raytheon.uf.viz.core.rsc.capabilities.EditableCapability;
|
||||
import com.raytheon.uf.viz.core.rsc.capabilities.OutlineCapability;
|
||||
import com.raytheon.viz.ui.cmenu.IContextMenuContributor;
|
||||
import com.raytheon.uf.viz.drawing.events.DrawingEvent;
|
||||
import com.raytheon.uf.viz.drawing.events.DrawingEventBus;
|
||||
import com.raytheon.uf.viz.drawing.events.DrawingListener;
|
||||
import com.vividsolutions.jts.geom.Coordinate;
|
||||
import com.vividsolutions.jts.geom.Geometry;
|
||||
import com.vividsolutions.jts.geom.GeometryCollection;
|
||||
import com.vividsolutions.jts.geom.GeometryFactory;
|
||||
import com.vividsolutions.jts.geom.LineString;
|
||||
import com.vividsolutions.jts.geom.MultiLineString;
|
||||
import com.vividsolutions.jts.geom.Point;
|
||||
import com.vividsolutions.jts.geom.TopologyException;
|
||||
|
||||
/**
|
||||
* Implements a basic drawing layer
|
||||
|
@ -57,8 +58,7 @@ import com.vividsolutions.jts.geom.Point;
|
|||
*
|
||||
*/
|
||||
public class DrawingLayer extends
|
||||
AbstractVizResource<AbstractResourceData, MapDescriptor> implements
|
||||
IContextMenuContributor {
|
||||
AbstractVizResource<AbstractResourceData, MapDescriptor> {
|
||||
|
||||
protected List<Geometry> tempGeometries;
|
||||
|
||||
|
@ -70,9 +70,6 @@ public class DrawingLayer extends
|
|||
|
||||
protected IWireframeShape eraseWireframeShape;
|
||||
|
||||
// TODO take this out
|
||||
private List<IWireframeShape> erasedShapes;
|
||||
|
||||
protected IGraphicsTarget target;
|
||||
|
||||
protected boolean erase = false;
|
||||
|
@ -81,8 +78,21 @@ public class DrawingLayer extends
|
|||
|
||||
private boolean needsRefresh = false;
|
||||
|
||||
protected RGB color;
|
||||
|
||||
protected OutlineCapability outline;
|
||||
|
||||
// allowing for others to get events from the drawing tool, just having to
|
||||
// subscribe
|
||||
private EventBus eventBus;
|
||||
|
||||
private DrawingListener eventListener = null;
|
||||
|
||||
public DrawingLayer(PathDrawingResourceData data, LoadProperties props) {
|
||||
super(data, props);
|
||||
eventBus = DrawingEventBus.getEventBus();
|
||||
eventListener = DrawingEventBus.getDrawingListener();
|
||||
eventBus.register(eventListener);
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -107,11 +117,9 @@ public class DrawingLayer extends
|
|||
this.wireframeShapes = new LinkedHashMap<Geometry, IWireframeShape>();
|
||||
this.deletedShapes = new LinkedHashMap<Geometry, IWireframeShape>();
|
||||
|
||||
this.erasedShapes = new ArrayList<IWireframeShape>();
|
||||
this.target = target;
|
||||
|
||||
getCapability(OutlineCapability.class);
|
||||
getCapability(ColorableCapability.class);
|
||||
outline = getCapability(OutlineCapability.class);
|
||||
color = getCapability(ColorableCapability.class).getColor();
|
||||
getCapability(EditableCapability.class);
|
||||
}
|
||||
|
||||
|
@ -134,46 +142,27 @@ public class DrawingLayer extends
|
|||
getDescriptor());
|
||||
}
|
||||
|
||||
OutlineCapability outline = getCapability(OutlineCapability.class);
|
||||
ColorableCapability colorable = getCapability(ColorableCapability.class);
|
||||
outline = getCapability(OutlineCapability.class);
|
||||
color = getCapability(ColorableCapability.class).getColor();
|
||||
|
||||
// remove after debugging
|
||||
// MagnificationCapability magnification =
|
||||
// getCapability(MagnificationCapability.class);
|
||||
// for (Geometry ls : wireframeShapes.keySet()) {
|
||||
// if (ls instanceof LineString) {
|
||||
// LineString string = (LineString) ls;
|
||||
// for (int i = 0; i < string.getNumPoints(); i++) {
|
||||
// target.drawPoint(string.getPointN(i).getX(), string
|
||||
// .getPointN(i).getY(), 0, colorable.getColor(),
|
||||
// PointStyle.BOX, magnification.getMagnification()
|
||||
// .floatValue());
|
||||
// DrawableString dString = new DrawableString(string
|
||||
// .getPointN(i).getCoordinate().toString(),
|
||||
// colorable.getColor());
|
||||
// dString.basics.x = string.getPointN(i).getX();
|
||||
// dString.basics.y = string.getPointN(i).getY();
|
||||
// target.drawStrings(dString);
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
for (IWireframeShape sh : wireframeShapes.values()) {
|
||||
target.drawWireframeShape(sh, colorable.getColor(),
|
||||
target.drawWireframeShape(sh, color,
|
||||
(float) outline.getOutlineWidth(), outline.getLineStyle());
|
||||
}
|
||||
|
||||
for (Geometry g : this.tempGeometries) {
|
||||
drawTempLinePrimitive(g, tempWireframeShape);
|
||||
}
|
||||
// if (erase) {
|
||||
// target.drawWireframeShape(tempWireframeShape, new RGB(255, 0, 0),
|
||||
// 1.0f);
|
||||
// } else {
|
||||
target.drawWireframeShape(tempWireframeShape, colorable.getColor(),
|
||||
target.drawWireframeShape(tempWireframeShape, color,
|
||||
outline.getOutlineWidth(), outline.getLineStyle());
|
||||
// }
|
||||
}
|
||||
|
||||
/**
|
||||
* Add the geometry to the wireframe shape that is passed in
|
||||
*
|
||||
* @param shape
|
||||
* @param wShape
|
||||
*/
|
||||
private void drawTempLinePrimitive(Geometry shape, IWireframeShape wShape) {
|
||||
LineString line = (LineString) shape;
|
||||
|
||||
|
@ -225,6 +214,8 @@ public class DrawingLayer extends
|
|||
public void finalizeLine(LineString line, String uuid) {
|
||||
tempWireframeShape.compile();
|
||||
wireframeShapes.put(line, tempWireframeShape);
|
||||
DrawingEvent event = new DrawingEvent(line, null);
|
||||
eventBus.post(event);
|
||||
}
|
||||
|
||||
public void addTempDrawLine(LineString line) {
|
||||
|
@ -232,7 +223,7 @@ public class DrawingLayer extends
|
|||
}
|
||||
|
||||
public void addTempEraseLine(LineString line) {
|
||||
this.tempGeometries.add(line);
|
||||
// this.tempGeometries.add(line);
|
||||
Map<Geometry, IWireframeShape> shapes = new HashMap<Geometry, IWireframeShape>();
|
||||
shapes.putAll(wireframeShapes);
|
||||
for (Geometry geom : shapes.keySet()) {
|
||||
|
@ -244,7 +235,12 @@ public class DrawingLayer extends
|
|||
if (line.buffer(size / 2).intersects(geom)) {
|
||||
Geometry intersection = line.buffer(size / 2)
|
||||
.intersection(geom);
|
||||
Geometry finalGeom = geom.difference(intersection);
|
||||
Geometry finalGeom = null;
|
||||
try {
|
||||
finalGeom = geom.difference(intersection);
|
||||
} catch (TopologyException e) {
|
||||
continue;
|
||||
}
|
||||
deletedShapes.put(geom, wireframeShapes.remove(geom));
|
||||
|
||||
Geometry lString = null;
|
||||
|
@ -259,7 +255,6 @@ public class DrawingLayer extends
|
|||
drawTempLinePrimitive(lineString, eraseWireframeShape);
|
||||
this.wireframeShapes.put(lineString,
|
||||
eraseWireframeShape);
|
||||
erasedShapes.add(eraseWireframeShape);
|
||||
}
|
||||
}
|
||||
if (finalGeom instanceof LineString) {
|
||||
|
@ -273,14 +268,8 @@ public class DrawingLayer extends
|
|||
descriptor);
|
||||
drawTempLinePrimitive(lString, eraseWireframeShape);
|
||||
this.wireframeShapes.put(lString, eraseWireframeShape);
|
||||
erasedShapes.add(eraseWireframeShape);
|
||||
} else {
|
||||
lString = (GeometryCollection) finalGeom;
|
||||
// for (int j = 0; j < lString.getNumGeometries(); j++) {
|
||||
// System.out.println(lString.getGeometryN(j).getClass());
|
||||
// }
|
||||
// System.out.println(finalGeom.getClass() + " has "
|
||||
// + lString.getNumGeometries() + " geometries");
|
||||
// do nothing
|
||||
}
|
||||
}
|
||||
tempGeometries.clear();
|
||||
|
@ -293,8 +282,10 @@ public class DrawingLayer extends
|
|||
issueRefresh();
|
||||
}
|
||||
|
||||
/**
|
||||
* reset the temporary geometries so that we can start a new line
|
||||
*/
|
||||
public void resetTemp() {
|
||||
// this.tempWireframeShape.dispose();
|
||||
this.tempGeometries.clear();
|
||||
needsRefresh = true;
|
||||
}
|
||||
|
@ -344,23 +335,7 @@ public class DrawingLayer extends
|
|||
}
|
||||
|
||||
/**
|
||||
* Add items to the right click menu, in this case just a button to launch
|
||||
* the Drawing toolbar
|
||||
*/
|
||||
@Override
|
||||
public void addContextMenuItems(IMenuManager menuManager, int x, int y) {
|
||||
ResourcePair pair = new ResourcePair();
|
||||
pair.setResource(this);
|
||||
Action action = new Action("Draw Toolbar...") {
|
||||
public void run() {
|
||||
PathToolbar.getToolbar().open();
|
||||
};
|
||||
};
|
||||
menuManager.add(action);
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the erase
|
||||
* @return are you currently erasing
|
||||
*/
|
||||
public boolean isErase() {
|
||||
return erase;
|
||||
|
@ -368,23 +343,39 @@ public class DrawingLayer extends
|
|||
|
||||
/**
|
||||
* @param erase
|
||||
* the erase to set
|
||||
* to erase or not to erase
|
||||
*/
|
||||
public void setErase(boolean erase) {
|
||||
this.erase = erase;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the deletedShapes
|
||||
* @return the deletedShapes, these shapes will get disposed when the clear
|
||||
* button is selected
|
||||
*/
|
||||
public Map<Geometry, IWireframeShape> getDeletedShapes() {
|
||||
return deletedShapes;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the wireframeShapes
|
||||
* @return the wireframeShapes, these shapes will get disposed when the
|
||||
* clear button is selected
|
||||
*/
|
||||
public Map<Geometry, IWireframeShape> getWireframeShapes() {
|
||||
return wireframeShapes;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the eventBus
|
||||
*/
|
||||
public EventBus getEventBus() {
|
||||
return eventBus;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the eventListener
|
||||
*/
|
||||
public DrawingListener getEventListener() {
|
||||
return eventListener;
|
||||
}
|
||||
}
|
|
@ -37,7 +37,8 @@ import org.eclipse.ui.PlatformUI;
|
|||
import org.eclipse.ui.contexts.IContextActivation;
|
||||
import org.eclipse.ui.contexts.IContextService;
|
||||
|
||||
import com.raytheon.uf.viz.core.IDisplayPane;
|
||||
import com.google.common.eventbus.AllowConcurrentEvents;
|
||||
import com.google.common.eventbus.Subscribe;
|
||||
import com.raytheon.uf.viz.core.drawables.IDescriptor;
|
||||
import com.raytheon.uf.viz.core.drawables.ResourcePair;
|
||||
import com.raytheon.uf.viz.core.icon.IconUtil;
|
||||
|
@ -46,12 +47,12 @@ import com.raytheon.uf.viz.drawing.actions.ClearDrawingAction;
|
|||
import com.raytheon.uf.viz.drawing.actions.EraseObjectsAction;
|
||||
import com.raytheon.uf.viz.drawing.actions.RedoAddAction;
|
||||
import com.raytheon.uf.viz.drawing.actions.UndoAddAction;
|
||||
import com.raytheon.uf.viz.drawing.events.DrawingEvent;
|
||||
import com.raytheon.uf.viz.drawing.events.DrawingEventBus;
|
||||
import com.raytheon.uf.viz.drawing.tools.PathDrawingTool;
|
||||
import com.raytheon.viz.ui.EditorUtil;
|
||||
import com.raytheon.viz.ui.dialogs.CaveSWTDialog;
|
||||
import com.raytheon.viz.ui.editor.AbstractEditor;
|
||||
import com.raytheon.viz.ui.editor.ISelectedPanesChangedListener;
|
||||
import com.raytheon.viz.ui.editor.VizMultiPaneEditor;
|
||||
|
||||
/**
|
||||
* TODO Add Description
|
||||
|
@ -70,13 +71,14 @@ import com.raytheon.viz.ui.editor.VizMultiPaneEditor;
|
|||
* @version 1.0
|
||||
*/
|
||||
|
||||
public class PathToolbar extends CaveSWTDialog implements
|
||||
ISelectedPanesChangedListener {
|
||||
public class PathToolbar extends CaveSWTDialog {
|
||||
|
||||
private static PathToolbar toolbar;
|
||||
protected static PathToolbar pathToolbar;
|
||||
|
||||
// private Map<AbstractEditor, ResourcePair> layers;
|
||||
|
||||
protected ToolBar toolbar;
|
||||
|
||||
private ToolItem drawItem;
|
||||
|
||||
private ToolItem eraserItem;
|
||||
|
@ -90,10 +92,11 @@ public class PathToolbar extends CaveSWTDialog implements
|
|||
private IContextActivation drawingContext;
|
||||
|
||||
public static PathToolbar getToolbar() {
|
||||
if (toolbar == null) {
|
||||
toolbar = new PathToolbar(new Shell(Display.getCurrent()));
|
||||
if (pathToolbar == null) {
|
||||
pathToolbar = new PathToolbar(new Shell(Display.getCurrent()));
|
||||
DrawingEventBus.register(PathToolbar.getToolbar());
|
||||
}
|
||||
return toolbar;
|
||||
return pathToolbar;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -142,7 +145,7 @@ public class PathToolbar extends CaveSWTDialog implements
|
|||
layout.marginHeight = 0;
|
||||
layout.marginWidth = 0;
|
||||
|
||||
ToolBar toolbar = new ToolBar(comp, SWT.FLAT);
|
||||
toolbar = new ToolBar(comp, SWT.FLAT);
|
||||
|
||||
layout = new GridLayout();
|
||||
layout.marginHeight = 0;
|
||||
|
@ -169,8 +172,8 @@ public class PathToolbar extends CaveSWTDialog implements
|
|||
eraserItem.setSelection(false);
|
||||
}
|
||||
}
|
||||
PathDrawingTool tool = new PathDrawingTool();
|
||||
tool.activate();
|
||||
|
||||
startTool();
|
||||
// ((VizMultiPaneEditor) editor)
|
||||
// .addSelectedPaneChangedListener(PathToolbar
|
||||
// .getToolbar());
|
||||
|
@ -234,7 +237,6 @@ public class PathToolbar extends CaveSWTDialog implements
|
|||
executeAction(action);
|
||||
}
|
||||
});
|
||||
updateToolbar();
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -243,6 +245,7 @@ public class PathToolbar extends CaveSWTDialog implements
|
|||
.getWorkbench().getService(IContextService.class);
|
||||
drawingContext = contextService
|
||||
.activateContext("com.raytheon.uf.viz.drawing.context");
|
||||
updateToolbar();
|
||||
super.opened();
|
||||
}
|
||||
|
||||
|
@ -254,29 +257,14 @@ public class PathToolbar extends CaveSWTDialog implements
|
|||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
*
|
||||
* @see
|
||||
* com.raytheon.viz.ui.editor.ISelectedPanesChangedListener#selectedPanesChanged
|
||||
* (java.lang.String, com.raytheon.uf.viz.core.IDisplayPane[])
|
||||
*/
|
||||
@Override
|
||||
public void selectedPanesChanged(String id, IDisplayPane[] pane) {
|
||||
AbstractEditor editor = EditorUtil
|
||||
.getActiveEditorAs(AbstractEditor.class);
|
||||
IDescriptor desc = editor.getActiveDisplayPane().getDescriptor();
|
||||
((VizMultiPaneEditor) editor)
|
||||
.addSelectedPaneChangedListener(PathToolbar.getToolbar());
|
||||
for (ResourcePair pair : desc.getResourceList()) {
|
||||
if (pair.getResource() instanceof DrawingLayer) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
@AllowConcurrentEvents
|
||||
@Subscribe
|
||||
public void handleMessage(DrawingEvent event) {
|
||||
updateToolbar();
|
||||
}
|
||||
|
||||
private void updateToolbar() {
|
||||
if (true) {
|
||||
public void updateToolbar() {
|
||||
if (this.isDisposed()) {
|
||||
return;
|
||||
}
|
||||
AbstractEditor editor = EditorUtil
|
||||
|
@ -294,17 +282,13 @@ public class PathToolbar extends CaveSWTDialog implements
|
|||
} else {
|
||||
clearItem.setEnabled(true);
|
||||
if (layer.getDeletedShapes().isEmpty()) {
|
||||
undoItem.setEnabled(true);
|
||||
redoItem.setEnabled(false);
|
||||
} else {
|
||||
undoItem.setEnabled(false);
|
||||
redoItem.setEnabled(true);
|
||||
}
|
||||
if (layer.getWireframeShapes().isEmpty()) {
|
||||
redoItem.setEnabled(true);
|
||||
undoItem.setEnabled(false);
|
||||
} else {
|
||||
redoItem.setEnabled(false);
|
||||
undoItem.setEnabled(true);
|
||||
}
|
||||
}
|
||||
|
@ -312,4 +296,11 @@ public class PathToolbar extends CaveSWTDialog implements
|
|||
}
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
protected void startTool() {
|
||||
PathDrawingTool tool = new PathDrawingTool();
|
||||
tool.activate();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -26,6 +26,7 @@ import org.eclipse.core.commands.ExecutionException;
|
|||
import com.raytheon.uf.viz.core.drawables.ResourcePair;
|
||||
import com.raytheon.uf.viz.core.rsc.ResourceList;
|
||||
import com.raytheon.uf.viz.drawing.DrawingLayer;
|
||||
import com.raytheon.uf.viz.drawing.events.DrawingEvent;
|
||||
import com.raytheon.viz.ui.EditorUtil;
|
||||
import com.raytheon.viz.ui.editor.AbstractEditor;
|
||||
|
||||
|
@ -56,6 +57,8 @@ public class RedoAddAction extends AbstractHandler {
|
|||
for (ResourcePair pair : list) {
|
||||
if (pair.getResource() instanceof DrawingLayer) {
|
||||
((DrawingLayer) pair.getResource()).redoAdd();
|
||||
((DrawingLayer) pair.getResource()).getEventBus().post(
|
||||
new DrawingEvent(null, null));
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -26,6 +26,7 @@ import org.eclipse.core.commands.ExecutionException;
|
|||
import com.raytheon.uf.viz.core.drawables.ResourcePair;
|
||||
import com.raytheon.uf.viz.core.rsc.ResourceList;
|
||||
import com.raytheon.uf.viz.drawing.DrawingLayer;
|
||||
import com.raytheon.uf.viz.drawing.events.DrawingEvent;
|
||||
import com.raytheon.viz.ui.EditorUtil;
|
||||
import com.raytheon.viz.ui.editor.AbstractEditor;
|
||||
|
||||
|
@ -42,7 +43,6 @@ import com.raytheon.viz.ui.editor.AbstractEditor;
|
|||
*
|
||||
* </pre>
|
||||
*
|
||||
* @author mnash
|
||||
* @version 1.0
|
||||
*/
|
||||
|
||||
|
@ -56,6 +56,8 @@ public class UndoAddAction extends AbstractHandler {
|
|||
for (ResourcePair pair : list) {
|
||||
if (pair.getResource() instanceof DrawingLayer) {
|
||||
((DrawingLayer) pair.getResource()).undoAdd();
|
||||
((DrawingLayer) pair.getResource()).getEventBus().post(
|
||||
new DrawingEvent(null, null));
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -0,0 +1,66 @@
|
|||
/**
|
||||
* 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.drawing.events;
|
||||
|
||||
import com.raytheon.viz.ui.editor.AbstractEditor;
|
||||
import com.vividsolutions.jts.geom.Geometry;
|
||||
|
||||
/**
|
||||
* TODO Add Description
|
||||
*
|
||||
* <pre>
|
||||
*
|
||||
* SOFTWARE HISTORY
|
||||
*
|
||||
* Date Ticket# Engineer Description
|
||||
* ------------ ---------- ----------- --------------------------
|
||||
* Apr 2, 2012 mnash Initial creation
|
||||
*
|
||||
* </pre>
|
||||
*
|
||||
* @author mnash
|
||||
* @version 1.0
|
||||
*/
|
||||
|
||||
public class DrawingEvent {
|
||||
|
||||
private AbstractEditor editor;
|
||||
|
||||
private Geometry geom;
|
||||
|
||||
public DrawingEvent(Geometry geom, AbstractEditor editor) {
|
||||
this.geom = geom;
|
||||
this.editor = editor;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the geom
|
||||
*/
|
||||
public Geometry getGeom() {
|
||||
return geom;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the editor
|
||||
*/
|
||||
public AbstractEditor getEditor() {
|
||||
return editor;
|
||||
}
|
||||
}
|
|
@ -0,0 +1,74 @@
|
|||
/**
|
||||
* 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.drawing.events;
|
||||
|
||||
import com.google.common.eventbus.EventBus;
|
||||
|
||||
/**
|
||||
* TODO Add Description
|
||||
*
|
||||
* <pre>
|
||||
*
|
||||
* SOFTWARE HISTORY
|
||||
*
|
||||
* Date Ticket# Engineer Description
|
||||
* ------------ ---------- ----------- --------------------------
|
||||
* Apr 2, 2012 mnash Initial creation
|
||||
*
|
||||
* </pre>
|
||||
*
|
||||
* @author mnash
|
||||
* @version 1.0
|
||||
*/
|
||||
|
||||
public class DrawingEventBus {
|
||||
private static EventBus eventBus;
|
||||
|
||||
private static DrawingListener drawingListener;
|
||||
|
||||
/**
|
||||
* @return the eventBus
|
||||
*/
|
||||
public static EventBus getEventBus() {
|
||||
if (eventBus == null) {
|
||||
eventBus = new EventBus("DrawingEventBus");
|
||||
}
|
||||
return eventBus;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the drawingListener
|
||||
*/
|
||||
public static DrawingListener getDrawingListener() {
|
||||
if (drawingListener == null) {
|
||||
drawingListener = new DrawingListener();
|
||||
}
|
||||
return drawingListener;
|
||||
}
|
||||
|
||||
/**
|
||||
* Send in class to register in the event bus
|
||||
*
|
||||
* @param ob
|
||||
*/
|
||||
public static void register(Object ob) {
|
||||
getEventBus().register(ob);
|
||||
}
|
||||
}
|
|
@ -0,0 +1,46 @@
|
|||
/**
|
||||
* 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.drawing.events;
|
||||
|
||||
import com.google.common.eventbus.Subscribe;
|
||||
|
||||
/**
|
||||
* TODO Add Description
|
||||
*
|
||||
* <pre>
|
||||
*
|
||||
* SOFTWARE HISTORY
|
||||
*
|
||||
* Date Ticket# Engineer Description
|
||||
* ------------ ---------- ----------- --------------------------
|
||||
* Apr 2, 2012 mnash Initial creation
|
||||
*
|
||||
* </pre>
|
||||
*
|
||||
* @author mnash
|
||||
* @version 1.0
|
||||
*/
|
||||
|
||||
public class DrawingListener {
|
||||
|
||||
@Subscribe
|
||||
public void handleMessage(DrawingEvent event) {
|
||||
}
|
||||
}
|
|
@ -52,7 +52,8 @@ public class PathDrawingTool extends AbstractDrawingTool {
|
|||
protected IInputHandler theHandler;
|
||||
|
||||
public AbstractResourceData constructData() {
|
||||
return new PathDrawingResourceData();
|
||||
PathDrawingResourceData data = new PathDrawingResourceData();
|
||||
return data;
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -179,8 +180,26 @@ public class PathDrawingTool extends AbstractDrawingTool {
|
|||
theDrawingLayer.finalizeLine(ls, null);
|
||||
}
|
||||
}
|
||||
|
||||
// this probably should be put elsewhere or genericized in some
|
||||
// manner
|
||||
// PathToolbar.getToolbar().updateToolbar();
|
||||
|
||||
editor.refresh();
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
*
|
||||
* @see com.raytheon.viz.ui.tools.AbstractModalTool#activate()
|
||||
*/
|
||||
@Override
|
||||
public void activate() {
|
||||
super.activate();
|
||||
theDrawingLayer.getCapability(EditableCapability.class).setEditable(
|
||||
true);
|
||||
theDrawingLayer.issueRefresh();
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue