Merge "Issue #429 added wrong cursor code" into 11-Collaboration
Former-commit-id:8da45f26b2
[formerly5f09f55f6b
] [formerlyb7fda1f852
] [formerly9ce74d9430
[formerlyb7fda1f852
[formerly d99655bcb8042378594ef31ad52305120808ca7e]]] Former-commit-id:9ce74d9430
Former-commit-id: 70699592bd222de1179b07bbb30d06b9f321ff7e [formerly25cf424a42
] Former-commit-id:2c4a626723
This commit is contained in:
commit
d0faddc33a
5 changed files with 45 additions and 95 deletions
|
@ -42,10 +42,6 @@ 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.ColorableCapability;
|
||||||
import com.raytheon.uf.viz.core.rsc.capabilities.EditableCapability;
|
import com.raytheon.uf.viz.core.rsc.capabilities.EditableCapability;
|
||||||
import com.raytheon.uf.viz.core.rsc.capabilities.OutlineCapability;
|
import com.raytheon.uf.viz.core.rsc.capabilities.OutlineCapability;
|
||||||
import com.raytheon.uf.viz.drawing.actions.ClearDrawingAction;
|
|
||||||
import com.raytheon.uf.viz.drawing.actions.RedoAddAction;
|
|
||||||
import com.raytheon.uf.viz.drawing.actions.UndoAddAction;
|
|
||||||
import com.raytheon.uf.viz.drawing.tools.ToolsUtils;
|
|
||||||
import com.raytheon.viz.ui.cmenu.IContextMenuContributor;
|
import com.raytheon.viz.ui.cmenu.IContextMenuContributor;
|
||||||
import com.vividsolutions.jts.geom.Geometry;
|
import com.vividsolutions.jts.geom.Geometry;
|
||||||
import com.vividsolutions.jts.geom.GeometryFactory;
|
import com.vividsolutions.jts.geom.GeometryFactory;
|
||||||
|
@ -143,6 +139,9 @@ public class DrawingLayer extends
|
||||||
}
|
}
|
||||||
target.drawWireframeShape(tempWireframeShape, colorable.getColor(),
|
target.drawWireframeShape(tempWireframeShape, colorable.getColor(),
|
||||||
outline.getOutlineWidth(), outline.getLineStyle());
|
outline.getOutlineWidth(), outline.getLineStyle());
|
||||||
|
|
||||||
|
// target.drawWireframeShape(eraseWireframeShape, new RGB(255, 0, 0),
|
||||||
|
// 4.0f);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void drawTempLinePrimitive(Geometry shape, IGraphicsTarget target,
|
private void drawTempLinePrimitive(Geometry shape, IGraphicsTarget target,
|
||||||
|
@ -191,7 +190,7 @@ public class DrawingLayer extends
|
||||||
Point point = factory
|
Point point = factory
|
||||||
.createPoint(line.getCoordinates()[line
|
.createPoint(line.getCoordinates()[line
|
||||||
.getNumPoints() - 1]);
|
.getNumPoints() - 1]);
|
||||||
Geometry intersection = point.buffer(8).intersection(geom);
|
Geometry intersection = point.buffer(1).intersection(geom);
|
||||||
Geometry finalGeom = geom.difference(intersection);
|
Geometry finalGeom = geom.difference(intersection);
|
||||||
deletedShapes.put(geom, wireframeShapes.remove(geom));
|
deletedShapes.put(geom, wireframeShapes.remove(geom));
|
||||||
|
|
||||||
|
@ -200,6 +199,8 @@ public class DrawingLayer extends
|
||||||
for (int j = 0; j < mLineString.getNumGeometries(); j++) {
|
for (int j = 0; j < mLineString.getNumGeometries(); j++) {
|
||||||
LineString lineString = (LineString) mLineString
|
LineString lineString = (LineString) mLineString
|
||||||
.getGeometryN(j);
|
.getGeometryN(j);
|
||||||
|
eraseWireframeShape = target.createWireframeShape(
|
||||||
|
true, descriptor);
|
||||||
int pts = lineString.getNumPoints();
|
int pts = lineString.getNumPoints();
|
||||||
for (int i = 1; i < pts; i++) {
|
for (int i = 1; i < pts; i++) {
|
||||||
double[] p1 = this.descriptor
|
double[] p1 = this.descriptor
|
||||||
|
@ -217,11 +218,24 @@ public class DrawingLayer extends
|
||||||
coords[0][1] = p1[1];
|
coords[0][1] = p1[1];
|
||||||
coords[1][0] = p2[0];
|
coords[1][0] = p2[0];
|
||||||
coords[1][1] = p2[1];
|
coords[1][1] = p2[1];
|
||||||
System.out.println(i);
|
|
||||||
eraseWireframeShape.addLineSegment(coords);
|
eraseWireframeShape.addLineSegment(coords);
|
||||||
|
// try {
|
||||||
|
// target.drawPoint(coords[0][0],
|
||||||
|
// coords[0][1], 0,
|
||||||
|
// new RGB(0, 0, 255),
|
||||||
|
// PointStyle.CIRCLE);
|
||||||
|
// } catch (VizException e) {
|
||||||
|
// e.printStackTrace();
|
||||||
|
// }
|
||||||
}
|
}
|
||||||
this.wireframeShapes.put(lineString,
|
this.wireframeShapes.put(lineString,
|
||||||
eraseWireframeShape);
|
eraseWireframeShape);
|
||||||
|
// try {
|
||||||
|
// target.drawWireframeShape(eraseWireframeShape,
|
||||||
|
// new RGB(0, 0, 255), 10.0f);
|
||||||
|
// } catch (VizException e) {
|
||||||
|
// e.printStackTrace();
|
||||||
|
// }
|
||||||
issueRefresh();
|
issueRefresh();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -254,6 +268,8 @@ public class DrawingLayer extends
|
||||||
for (IWireframeShape shape : this.deletedShapes.values()) {
|
for (IWireframeShape shape : this.deletedShapes.values()) {
|
||||||
shape.dispose();
|
shape.dispose();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
this.eraseWireframeShape.dispose();
|
||||||
this.wireframeShapes.clear();
|
this.wireframeShapes.clear();
|
||||||
this.deletedShapes.clear();
|
this.deletedShapes.clear();
|
||||||
}
|
}
|
||||||
|
|
|
@ -38,12 +38,12 @@ import org.eclipse.swt.widgets.ToolItem;
|
||||||
import com.raytheon.uf.viz.core.IDisplayPane;
|
import com.raytheon.uf.viz.core.IDisplayPane;
|
||||||
import com.raytheon.uf.viz.core.drawables.IDescriptor;
|
import com.raytheon.uf.viz.core.drawables.IDescriptor;
|
||||||
import com.raytheon.uf.viz.core.drawables.ResourcePair;
|
import com.raytheon.uf.viz.core.drawables.ResourcePair;
|
||||||
|
import com.raytheon.uf.viz.core.icon.IconUtil;
|
||||||
import com.raytheon.uf.viz.drawing.actions.ClearDrawingAction;
|
import com.raytheon.uf.viz.drawing.actions.ClearDrawingAction;
|
||||||
import com.raytheon.uf.viz.drawing.actions.EraseObjectsAction;
|
import com.raytheon.uf.viz.drawing.actions.EraseObjectsAction;
|
||||||
import com.raytheon.uf.viz.drawing.actions.RedoAddAction;
|
import com.raytheon.uf.viz.drawing.actions.RedoAddAction;
|
||||||
import com.raytheon.uf.viz.drawing.actions.UndoAddAction;
|
import com.raytheon.uf.viz.drawing.actions.UndoAddAction;
|
||||||
import com.raytheon.uf.viz.drawing.tools.PathDrawingTool;
|
import com.raytheon.uf.viz.drawing.tools.PathDrawingTool;
|
||||||
import com.raytheon.uf.viz.drawing.tools.ToolsUtils;
|
|
||||||
import com.raytheon.viz.ui.EditorUtil;
|
import com.raytheon.viz.ui.EditorUtil;
|
||||||
import com.raytheon.viz.ui.dialogs.CaveSWTDialog;
|
import com.raytheon.viz.ui.dialogs.CaveSWTDialog;
|
||||||
import com.raytheon.viz.ui.editor.AbstractEditor;
|
import com.raytheon.viz.ui.editor.AbstractEditor;
|
||||||
|
@ -131,8 +131,8 @@ public class PathToolbar extends CaveSWTDialog implements
|
||||||
|
|
||||||
drawItem = new ToolItem(toolbar, SWT.NONE);
|
drawItem = new ToolItem(toolbar, SWT.NONE);
|
||||||
drawItem.setText("Draw");
|
drawItem.setText("Draw");
|
||||||
drawItem.setImage(ToolsUtils.getImageDescriptor("draw.gif")
|
drawItem.setImage(IconUtil.getImageDescriptor(
|
||||||
.createImage());
|
Activator.getDefault().getBundle(), "draw.gif").createImage());
|
||||||
|
|
||||||
drawItem.addSelectionListener(new SelectionAdapter() {
|
drawItem.addSelectionListener(new SelectionAdapter() {
|
||||||
@Override
|
@Override
|
||||||
|
@ -156,6 +156,7 @@ public class PathToolbar extends CaveSWTDialog implements
|
||||||
for (ResourcePair pair : desc.getResourceList()) {
|
for (ResourcePair pair : desc.getResourceList()) {
|
||||||
if (pair.getResource() instanceof DrawingLayer) {
|
if (pair.getResource() instanceof DrawingLayer) {
|
||||||
layers.put(editor, pair);
|
layers.put(editor, pair);
|
||||||
|
eraserItem.setEnabled(true);
|
||||||
// drawItem.setEnabled(false);
|
// drawItem.setEnabled(false);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -164,8 +165,8 @@ public class PathToolbar extends CaveSWTDialog implements
|
||||||
|
|
||||||
ToolItem undoItem = new ToolItem(toolbar, SWT.FLAT);
|
ToolItem undoItem = new ToolItem(toolbar, SWT.FLAT);
|
||||||
undoItem.setText("Undo");
|
undoItem.setText("Undo");
|
||||||
undoItem.setImage(ToolsUtils.getImageDescriptor("undo.gif")
|
undoItem.setImage(IconUtil.getImageDescriptor(
|
||||||
.createImage());
|
Activator.getDefault().getBundle(), "undo.gif").createImage());
|
||||||
undoItem.addSelectionListener(new SelectionAdapter() {
|
undoItem.addSelectionListener(new SelectionAdapter() {
|
||||||
@Override
|
@Override
|
||||||
public void widgetSelected(SelectionEvent e) {
|
public void widgetSelected(SelectionEvent e) {
|
||||||
|
@ -180,8 +181,8 @@ public class PathToolbar extends CaveSWTDialog implements
|
||||||
|
|
||||||
ToolItem redoItem = new ToolItem(toolbar, SWT.FLAT);
|
ToolItem redoItem = new ToolItem(toolbar, SWT.FLAT);
|
||||||
redoItem.setText("Redo");
|
redoItem.setText("Redo");
|
||||||
redoItem.setImage(ToolsUtils.getImageDescriptor("redo.gif")
|
redoItem.setImage(IconUtil.getImageDescriptor(
|
||||||
.createImage());
|
Activator.getDefault().getBundle(), "redo.gif").createImage());
|
||||||
redoItem.addSelectionListener(new SelectionAdapter() {
|
redoItem.addSelectionListener(new SelectionAdapter() {
|
||||||
@Override
|
@Override
|
||||||
public void widgetSelected(SelectionEvent e) {
|
public void widgetSelected(SelectionEvent e) {
|
||||||
|
@ -196,8 +197,10 @@ public class PathToolbar extends CaveSWTDialog implements
|
||||||
|
|
||||||
ToolItem clearItem = new ToolItem(toolbar, SWT.FLAT);
|
ToolItem clearItem = new ToolItem(toolbar, SWT.FLAT);
|
||||||
clearItem.setText("Clear");
|
clearItem.setText("Clear");
|
||||||
clearItem.setImage(ToolsUtils.getImageDescriptor("remove.gif")
|
clearItem
|
||||||
.createImage());
|
.setImage(IconUtil.getImageDescriptor(
|
||||||
|
Activator.getDefault().getBundle(), "remove.gif")
|
||||||
|
.createImage());
|
||||||
clearItem.addSelectionListener(new SelectionAdapter() {
|
clearItem.addSelectionListener(new SelectionAdapter() {
|
||||||
@Override
|
@Override
|
||||||
public void widgetSelected(SelectionEvent e) {
|
public void widgetSelected(SelectionEvent e) {
|
||||||
|
@ -212,8 +215,10 @@ public class PathToolbar extends CaveSWTDialog implements
|
||||||
|
|
||||||
eraserItem = new ToolItem(toolbar, SWT.CHECK);
|
eraserItem = new ToolItem(toolbar, SWT.CHECK);
|
||||||
eraserItem.setText("Eraser");
|
eraserItem.setText("Eraser");
|
||||||
eraserItem.setImage(ToolsUtils.getImageDescriptor("eraser.png")
|
eraserItem
|
||||||
.createImage());
|
.setImage(IconUtil.getImageDescriptor(
|
||||||
|
Activator.getDefault().getBundle(), "eraser.png")
|
||||||
|
.createImage());
|
||||||
eraserItem.setEnabled(false);
|
eraserItem.setEnabled(false);
|
||||||
eraserItem.addSelectionListener(new SelectionAdapter() {
|
eraserItem.addSelectionListener(new SelectionAdapter() {
|
||||||
@Override
|
@Override
|
||||||
|
@ -236,12 +241,6 @@ public class PathToolbar extends CaveSWTDialog implements
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
private void dispose() {
|
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* (non-Javadoc)
|
* (non-Javadoc)
|
||||||
*
|
*
|
||||||
|
@ -256,14 +255,11 @@ public class PathToolbar extends CaveSWTDialog implements
|
||||||
IDescriptor desc = editor.getActiveDisplayPane().getDescriptor();
|
IDescriptor desc = editor.getActiveDisplayPane().getDescriptor();
|
||||||
((VizMultiPaneEditor) editor)
|
((VizMultiPaneEditor) editor)
|
||||||
.addSelectedPaneChangedListener(PathToolbar.getToolbar());
|
.addSelectedPaneChangedListener(PathToolbar.getToolbar());
|
||||||
boolean hasLayer = false;
|
|
||||||
for (ResourcePair pair : desc.getResourceList()) {
|
for (ResourcePair pair : desc.getResourceList()) {
|
||||||
if (pair.getResource() instanceof DrawingLayer) {
|
if (pair.getResource() instanceof DrawingLayer) {
|
||||||
hasLayer = true;
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// drawItem.setEnabled(hasLayer);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -56,7 +56,8 @@ public class EraseObjectsAction extends AbstractHandler {
|
||||||
for (ResourcePair pair : list) {
|
for (ResourcePair pair : list) {
|
||||||
if (pair.getResource() instanceof DrawingLayer) {
|
if (pair.getResource() instanceof DrawingLayer) {
|
||||||
((DrawingLayer) pair.getResource())
|
((DrawingLayer) pair.getResource())
|
||||||
.setErase(((DrawingLayer) pair.getResource()).isErase());
|
.setErase(!((DrawingLayer) pair.getResource())
|
||||||
|
.isErase());
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -25,14 +25,14 @@ import java.util.List;
|
||||||
|
|
||||||
import org.eclipse.swt.SWT;
|
import org.eclipse.swt.SWT;
|
||||||
import org.eclipse.swt.graphics.Cursor;
|
import org.eclipse.swt.graphics.Cursor;
|
||||||
import org.eclipse.swt.graphics.Image;
|
|
||||||
import org.eclipse.swt.graphics.ImageData;
|
import org.eclipse.swt.graphics.ImageData;
|
||||||
import org.eclipse.swt.graphics.ImageLoader;
|
|
||||||
import org.eclipse.swt.widgets.Display;
|
import org.eclipse.swt.widgets.Display;
|
||||||
|
|
||||||
|
import com.raytheon.uf.viz.core.icon.IconUtil;
|
||||||
import com.raytheon.uf.viz.core.rsc.AbstractResourceData;
|
import com.raytheon.uf.viz.core.rsc.AbstractResourceData;
|
||||||
import com.raytheon.uf.viz.core.rsc.IInputHandler;
|
import com.raytheon.uf.viz.core.rsc.IInputHandler;
|
||||||
import com.raytheon.uf.viz.drawing.AbstractDrawingTool;
|
import com.raytheon.uf.viz.drawing.AbstractDrawingTool;
|
||||||
|
import com.raytheon.uf.viz.drawing.Activator;
|
||||||
import com.raytheon.uf.viz.drawing.PathDrawingResourceData;
|
import com.raytheon.uf.viz.drawing.PathDrawingResourceData;
|
||||||
import com.raytheon.viz.ui.input.InputAdapter;
|
import com.raytheon.viz.ui.input.InputAdapter;
|
||||||
import com.vividsolutions.jts.geom.Coordinate;
|
import com.vividsolutions.jts.geom.Coordinate;
|
||||||
|
@ -88,16 +88,13 @@ public class PathDrawingTool extends AbstractDrawingTool {
|
||||||
|
|
||||||
Cursor cursor = null;
|
Cursor cursor = null;
|
||||||
if (theDrawingLayer.isErase()) {
|
if (theDrawingLayer.isErase()) {
|
||||||
ImageData data = ToolsUtils
|
ImageData data = IconUtil.getImageDescriptor(
|
||||||
.getImageDescriptor("eraser_box.gif").getImageData();
|
Activator.getDefault().getBundle(), "eraser_box.gif")
|
||||||
|
.getImageData();
|
||||||
data.alpha = 255;
|
data.alpha = 255;
|
||||||
cursor = new Cursor(Display.getCurrent(), data, 8, 8);
|
cursor = new Cursor(Display.getCurrent(), data, 8, 8);
|
||||||
} else {
|
} else {
|
||||||
cursor = new Cursor(Display.getCurrent(), SWT.CURSOR_HAND);
|
cursor = new Cursor(Display.getCurrent(), SWT.CURSOR_HAND);
|
||||||
Image image = new Image(cursor.getDevice(), 16, 16);
|
|
||||||
ImageLoader loader = new ImageLoader();
|
|
||||||
loader.data = new ImageData[] { image.getImageData() };
|
|
||||||
loader.save("/home/mnash/Desktop/hand.png", SWT.IMAGE_PNG);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
Display.getCurrent().getActiveShell().setCursor(cursor);
|
Display.getCurrent().getActiveShell().setCursor(cursor);
|
||||||
|
|
|
@ -1,60 +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.drawing.tools;
|
|
||||||
|
|
||||||
import java.io.File;
|
|
||||||
import java.net.URL;
|
|
||||||
|
|
||||||
import org.eclipse.core.runtime.FileLocator;
|
|
||||||
import org.eclipse.core.runtime.Path;
|
|
||||||
import org.eclipse.jface.resource.ImageDescriptor;
|
|
||||||
|
|
||||||
import com.raytheon.uf.viz.drawing.Activator;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* TODO Add Description
|
|
||||||
*
|
|
||||||
* <pre>
|
|
||||||
*
|
|
||||||
* SOFTWARE HISTORY
|
|
||||||
*
|
|
||||||
* Date Ticket# Engineer Description
|
|
||||||
* ------------ ---------- ----------- --------------------------
|
|
||||||
* Mar 26, 2012 mnash Initial creation
|
|
||||||
*
|
|
||||||
* </pre>
|
|
||||||
*
|
|
||||||
* @author mnash
|
|
||||||
* @version 1.0
|
|
||||||
*/
|
|
||||||
|
|
||||||
public class ToolsUtils {
|
|
||||||
|
|
||||||
public static ImageDescriptor getImageDescriptor(String string) {
|
|
||||||
String iconPath = "icons" + File.separator;
|
|
||||||
URL url = FileLocator.find(Activator.getDefault().getBundle(),
|
|
||||||
new Path(iconPath + string), null);
|
|
||||||
if (url != null && url.getFile() == null) {
|
|
||||||
url = FileLocator.find(Activator.getDefault().getBundle(),
|
|
||||||
new Path(".." + File.separator + iconPath + string), null);
|
|
||||||
}
|
|
||||||
return ImageDescriptor.createFromURL(url);
|
|
||||||
}
|
|
||||||
}
|
|
Loading…
Add table
Reference in a new issue