Merge "Omaha #1798 fixed collaboration drawing issues when leader shares new map" into omaha_14.4.1
Former-commit-id:71025bcc3d
[formerly81ca7a9e9f
] [formerlyc0d36e9a69
] [formerly1183c0538e
[formerlyc0d36e9a69
[formerly 3d0df846090261417f9c9b2e75cf6c439f9b979f]]] Former-commit-id:1183c0538e
Former-commit-id: ad38ccbb38ccc3c1e25afc6279df150354266fb5 [formerlycb9e715aec
] Former-commit-id:52d5edac63
This commit is contained in:
commit
886348da08
4 changed files with 106 additions and 20 deletions
|
@ -69,6 +69,7 @@ import com.vividsolutions.jts.geom.Coordinate;
|
||||||
* Mar 18, 2014 2895 njensen Fix concurrent mod exception on dispose
|
* Mar 18, 2014 2895 njensen Fix concurrent mod exception on dispose
|
||||||
* May 05, 2014 3076 bclement old CLEAR_ALL is now DISPOSE_ALL,
|
* May 05, 2014 3076 bclement old CLEAR_ALL is now DISPOSE_ALL,
|
||||||
* added clearLayers() and getAllDrawingLayers()
|
* added clearLayers() and getAllDrawingLayers()
|
||||||
|
* Jun 30, 2014 1798 bclement added getManager()
|
||||||
*
|
*
|
||||||
* </pre>
|
* </pre>
|
||||||
*
|
*
|
||||||
|
@ -482,4 +483,12 @@ public class CollaborationDrawingResource extends
|
||||||
// Though I hate this methods exists, it serves its purpose
|
// Though I hate this methods exists, it serves its purpose
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return the manager
|
||||||
|
*/
|
||||||
|
public CollaborationDrawingUIManager getManager() {
|
||||||
|
return manager;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -42,6 +42,7 @@ import com.vividsolutions.jts.geom.Geometry;
|
||||||
* Date Ticket# Engineer Description
|
* Date Ticket# Engineer Description
|
||||||
* ------------ ---------- ----------- --------------------------
|
* ------------ ---------- ----------- --------------------------
|
||||||
* May 24, 2012 mschenke Initial creation
|
* May 24, 2012 mschenke Initial creation
|
||||||
|
* Jun 30, 2014 1798 bclement added getResource(), made fields final
|
||||||
*
|
*
|
||||||
* </pre>
|
* </pre>
|
||||||
*
|
*
|
||||||
|
@ -51,9 +52,9 @@ import com.vividsolutions.jts.geom.Geometry;
|
||||||
|
|
||||||
public class CollaborationDrawingToolLayer extends DrawingToolLayer {
|
public class CollaborationDrawingToolLayer extends DrawingToolLayer {
|
||||||
|
|
||||||
private CollaborationDrawingResource resource;
|
private final CollaborationDrawingResource resource;
|
||||||
|
|
||||||
private List<Coordinate> coordinates = new ArrayList<Coordinate>();
|
private final List<Coordinate> coordinates = new ArrayList<Coordinate>();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param targetGeometry
|
* @param targetGeometry
|
||||||
|
@ -190,4 +191,12 @@ public class CollaborationDrawingToolLayer extends DrawingToolLayer {
|
||||||
}
|
}
|
||||||
return data;
|
return data;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return the resource
|
||||||
|
*/
|
||||||
|
public CollaborationDrawingResource getResource() {
|
||||||
|
return resource;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -70,6 +70,8 @@ import com.raytheon.uf.viz.collaboration.display.rsc.telestrator.CollaborationDr
|
||||||
import com.raytheon.uf.viz.collaboration.display.rsc.telestrator.CollaborationDrawingEvent.CollaborationEventType;
|
import com.raytheon.uf.viz.collaboration.display.rsc.telestrator.CollaborationDrawingEvent.CollaborationEventType;
|
||||||
import com.raytheon.uf.viz.collaboration.display.rsc.telestrator.CollaborationDrawingResource;
|
import com.raytheon.uf.viz.collaboration.display.rsc.telestrator.CollaborationDrawingResource;
|
||||||
import com.raytheon.uf.viz.collaboration.display.rsc.telestrator.CollaborationDrawingResourceData;
|
import com.raytheon.uf.viz.collaboration.display.rsc.telestrator.CollaborationDrawingResourceData;
|
||||||
|
import com.raytheon.uf.viz.collaboration.display.rsc.telestrator.CollaborationDrawingToolLayer;
|
||||||
|
import com.raytheon.uf.viz.collaboration.display.rsc.telestrator.CollaborationDrawingUIManager;
|
||||||
import com.raytheon.uf.viz.collaboration.ui.Activator;
|
import com.raytheon.uf.viz.collaboration.ui.Activator;
|
||||||
import com.raytheon.uf.viz.core.ContextManager;
|
import com.raytheon.uf.viz.core.ContextManager;
|
||||||
import com.raytheon.uf.viz.core.VizApp;
|
import com.raytheon.uf.viz.core.VizApp;
|
||||||
|
@ -103,6 +105,7 @@ import com.raytheon.viz.ui.input.EditableManager;
|
||||||
* Mar 18, 2014 2895 njensen Fix lockAction enable/disable logic
|
* Mar 18, 2014 2895 njensen Fix lockAction enable/disable logic
|
||||||
* Apr 15, 2014 2822 bclement only allow transfer leader if participant is using shared display
|
* Apr 15, 2014 2822 bclement only allow transfer leader if participant is using shared display
|
||||||
* May 05, 2014 3076 bclement added clear all action
|
* May 05, 2014 3076 bclement added clear all action
|
||||||
|
* Jun 30, 2014 1798 bclement added disableCurrentLayer()
|
||||||
*
|
*
|
||||||
* </pre>
|
* </pre>
|
||||||
*
|
*
|
||||||
|
@ -765,7 +768,9 @@ public class CollaborationSessionView extends SessionView implements
|
||||||
// TODO this method has more to do with displays than the view,
|
// TODO this method has more to do with displays than the view,
|
||||||
// would be good to separate it out somehow
|
// would be good to separate it out somehow
|
||||||
|
|
||||||
|
/* a null remoteDisplay means DEACTIVATE */
|
||||||
if (remoteDisplay == null) {
|
if (remoteDisplay == null) {
|
||||||
|
disableCurrentLayer();
|
||||||
currentDisplay = null;
|
currentDisplay = null;
|
||||||
VizApp.runAsync(actionUpdater);
|
VizApp.runAsync(actionUpdater);
|
||||||
return;
|
return;
|
||||||
|
@ -826,20 +831,7 @@ public class CollaborationSessionView extends SessionView implements
|
||||||
*/
|
*/
|
||||||
CollaborationDrawingResource resource = getCurrentDrawingResource();
|
CollaborationDrawingResource resource = getCurrentDrawingResource();
|
||||||
if (resource != null) {
|
if (resource != null) {
|
||||||
DrawingToolLayer layer = getCurrentLayer();
|
disableCurrentLayer();
|
||||||
if (layer != null) {
|
|
||||||
switch (layer.getDrawMode()) {
|
|
||||||
case DRAW:
|
|
||||||
layer.doneDrawing();
|
|
||||||
break;
|
|
||||||
case ERASE:
|
|
||||||
layer.doneErasing();
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
// not drawing
|
|
||||||
}
|
|
||||||
layer.setDrawMode(DrawMode.NONE);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
currentDisplay = display;
|
currentDisplay = display;
|
||||||
|
|
||||||
|
@ -864,6 +856,7 @@ public class CollaborationSessionView extends SessionView implements
|
||||||
listener.dispose();
|
listener.dispose();
|
||||||
}
|
}
|
||||||
if (display == currentDisplay) {
|
if (display == currentDisplay) {
|
||||||
|
disableCurrentLayer();
|
||||||
currentDisplay = null;
|
currentDisplay = null;
|
||||||
VizApp.runAsync(actionUpdater);
|
VizApp.runAsync(actionUpdater);
|
||||||
}
|
}
|
||||||
|
@ -872,6 +865,49 @@ public class CollaborationSessionView extends SessionView implements
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* prevent the current layer from drawing/erasing and clear the cursor
|
||||||
|
*/
|
||||||
|
private void disableCurrentLayer() {
|
||||||
|
final DrawingToolLayer layer = getCurrentLayer();
|
||||||
|
if (layer != null) {
|
||||||
|
/*
|
||||||
|
* Set done to handle disabling when the user is currently
|
||||||
|
* drawing/erasing. Must be done before clearing cursor.
|
||||||
|
*/
|
||||||
|
switch (layer.getDrawMode()) {
|
||||||
|
case DRAW:
|
||||||
|
layer.doneDrawing();
|
||||||
|
break;
|
||||||
|
case ERASE:
|
||||||
|
layer.doneErasing();
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
// not drawing
|
||||||
|
}
|
||||||
|
/*
|
||||||
|
* Handles the case where the user has a draw/erase cursor, has the
|
||||||
|
* mouse over the map, and the layer gets deactivated.
|
||||||
|
*/
|
||||||
|
VizApp.runAsync(new Runnable() {
|
||||||
|
@Override
|
||||||
|
public void run() {
|
||||||
|
/* skip if we got a new layer which that updated the cursor */
|
||||||
|
if (getCurrentLayer() == null
|
||||||
|
&& layer instanceof CollaborationDrawingToolLayer) {
|
||||||
|
CollaborationDrawingToolLayer cdtl = (CollaborationDrawingToolLayer) layer;
|
||||||
|
CollaborationDrawingUIManager manager = cdtl
|
||||||
|
.getResource().getManager();
|
||||||
|
if (manager != null) {
|
||||||
|
manager.clearCursor();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
layer.setDrawMode(DrawMode.NONE);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Listener provides the view with information that the resource has become
|
* Listener provides the view with information that the resource has become
|
||||||
* editable or not, which will affect any mouse handlers associated with it
|
* editable or not, which will affect any mouse handlers associated with it
|
||||||
|
|
|
@ -43,6 +43,8 @@ import com.vividsolutions.jts.geom.Coordinate;
|
||||||
* Date Ticket# Engineer Description
|
* Date Ticket# Engineer Description
|
||||||
* ------------ ---------- ----------- --------------------------
|
* ------------ ---------- ----------- --------------------------
|
||||||
* May 23, 2012 mschenke Initial creation
|
* May 23, 2012 mschenke Initial creation
|
||||||
|
* Jun 30, 2014 1798 bclement updated clearCursor() to only clear its own cursor
|
||||||
|
* updateCursor() no longer clears cursor
|
||||||
*
|
*
|
||||||
* </pre>
|
* </pre>
|
||||||
*
|
*
|
||||||
|
@ -137,12 +139,38 @@ public class DrawingToolUIManager extends InputAdapter {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @see #getCurrentShell()
|
||||||
|
* @see #clearCursor(Shell)
|
||||||
|
*/
|
||||||
|
public void clearCursor() {
|
||||||
|
clearCursor(currentShell);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Clear cursor from shell if this manager set its current cursor
|
||||||
|
*
|
||||||
|
* @param shell
|
||||||
|
*/
|
||||||
protected void clearCursor(Shell shell) {
|
protected void clearCursor(Shell shell) {
|
||||||
if (shell != null) {
|
if (shell != null) {
|
||||||
shell.setCursor(normal);
|
Cursor cursor = shell.getCursor();
|
||||||
|
/*
|
||||||
|
* Only alternative to checking references is to check if the mouse
|
||||||
|
* is outside of this layer's map editor. This is to prevent this
|
||||||
|
* manager from clearing another session's cursor.
|
||||||
|
*/
|
||||||
|
if (cursor == erasor || cursor == pencil) {
|
||||||
|
shell.setCursor(normal);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Sets cursor icon according to draw mode
|
||||||
|
*
|
||||||
|
* @param shell
|
||||||
|
*/
|
||||||
protected void updateCursor(Shell shell) {
|
protected void updateCursor(Shell shell) {
|
||||||
if (shell == null) {
|
if (shell == null) {
|
||||||
return;
|
return;
|
||||||
|
@ -159,9 +187,11 @@ public class DrawingToolUIManager extends InputAdapter {
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
// normal never gets set and thus will always be null, this is
|
/*
|
||||||
// the desired behavior
|
* only active layers (draw mode not equal to NONE) need to update
|
||||||
shell.setCursor(normal);
|
* the cursor. cursor will have already been cleared by
|
||||||
|
* handleMouseExit()
|
||||||
|
*/
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -218,6 +248,8 @@ public class DrawingToolUIManager extends InputAdapter {
|
||||||
case ERASE:
|
case ERASE:
|
||||||
drawingLayer.doneErasing();
|
drawingLayer.doneErasing();
|
||||||
break;
|
break;
|
||||||
|
default:
|
||||||
|
/* no action */
|
||||||
}
|
}
|
||||||
container.refresh();
|
container.refresh();
|
||||||
handlingInput = false;
|
handlingInput = false;
|
||||||
|
|
Loading…
Add table
Reference in a new issue