Omaha #1798 fixed collaboration drawing issues when leader shares new map
fixed cursor icon not updating properly fixed attempting to draw to inactive layer Change-Id: Ic0f29feddbd611d918ba9d7e5a515a7624bf72aa Former-commit-id:309900daab
[formerly0125117d9c
] [formerly88ba6b47ad
] [formerlyfc70dbc86e
[formerly88ba6b47ad
[formerly 4df0a485d285a920a53e812bec204683f5ff29f6]]] Former-commit-id:fc70dbc86e
Former-commit-id: a1b5881328dc0f2810d69ead13548d6326a348b7 [formerly44f8b3dce1
] Former-commit-id:b186894f32
This commit is contained in:
parent
570bf42f89
commit
7ffa3c80c1
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
|
||||
* May 05, 2014 3076 bclement old CLEAR_ALL is now DISPOSE_ALL,
|
||||
* added clearLayers() and getAllDrawingLayers()
|
||||
* Jun 30, 2014 1798 bclement added getManager()
|
||||
*
|
||||
* </pre>
|
||||
*
|
||||
|
@ -482,4 +483,12 @@ public class CollaborationDrawingResource extends
|
|||
// Though I hate this methods exists, it serves its purpose
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the manager
|
||||
*/
|
||||
public CollaborationDrawingUIManager getManager() {
|
||||
return manager;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -42,6 +42,7 @@ import com.vividsolutions.jts.geom.Geometry;
|
|||
* Date Ticket# Engineer Description
|
||||
* ------------ ---------- ----------- --------------------------
|
||||
* May 24, 2012 mschenke Initial creation
|
||||
* Jun 30, 2014 1798 bclement added getResource(), made fields final
|
||||
*
|
||||
* </pre>
|
||||
*
|
||||
|
@ -51,9 +52,9 @@ import com.vividsolutions.jts.geom.Geometry;
|
|||
|
||||
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
|
||||
|
@ -190,4 +191,12 @@ public class CollaborationDrawingToolLayer extends DrawingToolLayer {
|
|||
}
|
||||
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.CollaborationDrawingResource;
|
||||
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.core.ContextManager;
|
||||
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
|
||||
* Apr 15, 2014 2822 bclement only allow transfer leader if participant is using shared display
|
||||
* May 05, 2014 3076 bclement added clear all action
|
||||
* Jun 30, 2014 1798 bclement added disableCurrentLayer()
|
||||
*
|
||||
* </pre>
|
||||
*
|
||||
|
@ -765,7 +768,9 @@ public class CollaborationSessionView extends SessionView implements
|
|||
// TODO this method has more to do with displays than the view,
|
||||
// would be good to separate it out somehow
|
||||
|
||||
/* a null remoteDisplay means DEACTIVATE */
|
||||
if (remoteDisplay == null) {
|
||||
disableCurrentLayer();
|
||||
currentDisplay = null;
|
||||
VizApp.runAsync(actionUpdater);
|
||||
return;
|
||||
|
@ -826,20 +831,7 @@ public class CollaborationSessionView extends SessionView implements
|
|||
*/
|
||||
CollaborationDrawingResource resource = getCurrentDrawingResource();
|
||||
if (resource != null) {
|
||||
DrawingToolLayer layer = getCurrentLayer();
|
||||
if (layer != null) {
|
||||
switch (layer.getDrawMode()) {
|
||||
case DRAW:
|
||||
layer.doneDrawing();
|
||||
break;
|
||||
case ERASE:
|
||||
layer.doneErasing();
|
||||
break;
|
||||
default:
|
||||
// not drawing
|
||||
}
|
||||
layer.setDrawMode(DrawMode.NONE);
|
||||
}
|
||||
disableCurrentLayer();
|
||||
}
|
||||
currentDisplay = display;
|
||||
|
||||
|
@ -864,6 +856,7 @@ public class CollaborationSessionView extends SessionView implements
|
|||
listener.dispose();
|
||||
}
|
||||
if (display == currentDisplay) {
|
||||
disableCurrentLayer();
|
||||
currentDisplay = null;
|
||||
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
|
||||
* 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
|
||||
* ------------ ---------- ----------- --------------------------
|
||||
* 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>
|
||||
*
|
||||
|
@ -137,12 +139,38 @@ public class DrawingToolUIManager extends InputAdapter {
|
|||
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) {
|
||||
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) {
|
||||
if (shell == null) {
|
||||
return;
|
||||
|
@ -159,9 +187,11 @@ public class DrawingToolUIManager extends InputAdapter {
|
|||
}
|
||||
break;
|
||||
default:
|
||||
// normal never gets set and thus will always be null, this is
|
||||
// the desired behavior
|
||||
shell.setCursor(normal);
|
||||
/*
|
||||
* only active layers (draw mode not equal to NONE) need to update
|
||||
* the cursor. cursor will have already been cleared by
|
||||
* handleMouseExit()
|
||||
*/
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -218,6 +248,8 @@ public class DrawingToolUIManager extends InputAdapter {
|
|||
case ERASE:
|
||||
drawingLayer.doneErasing();
|
||||
break;
|
||||
default:
|
||||
/* no action */
|
||||
}
|
||||
container.refresh();
|
||||
handlingInput = false;
|
||||
|
|
Loading…
Add table
Reference in a new issue