Issue #429 added wrong cursor code
Former-commit-id: 88143adba6d493b49f87da30773bdd205a6e7948
This commit is contained in:
parent
9beef61917
commit
3d81840532
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.EditableCapability;
|
||||
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.vividsolutions.jts.geom.Geometry;
|
||||
import com.vividsolutions.jts.geom.GeometryFactory;
|
||||
|
@ -143,6 +139,9 @@ public class DrawingLayer extends
|
|||
}
|
||||
target.drawWireframeShape(tempWireframeShape, colorable.getColor(),
|
||||
outline.getOutlineWidth(), outline.getLineStyle());
|
||||
|
||||
// target.drawWireframeShape(eraseWireframeShape, new RGB(255, 0, 0),
|
||||
// 4.0f);
|
||||
}
|
||||
|
||||
private void drawTempLinePrimitive(Geometry shape, IGraphicsTarget target,
|
||||
|
@ -191,7 +190,7 @@ public class DrawingLayer extends
|
|||
Point point = factory
|
||||
.createPoint(line.getCoordinates()[line
|
||||
.getNumPoints() - 1]);
|
||||
Geometry intersection = point.buffer(8).intersection(geom);
|
||||
Geometry intersection = point.buffer(1).intersection(geom);
|
||||
Geometry finalGeom = geom.difference(intersection);
|
||||
deletedShapes.put(geom, wireframeShapes.remove(geom));
|
||||
|
||||
|
@ -200,6 +199,8 @@ public class DrawingLayer extends
|
|||
for (int j = 0; j < mLineString.getNumGeometries(); j++) {
|
||||
LineString lineString = (LineString) mLineString
|
||||
.getGeometryN(j);
|
||||
eraseWireframeShape = target.createWireframeShape(
|
||||
true, descriptor);
|
||||
int pts = lineString.getNumPoints();
|
||||
for (int i = 1; i < pts; i++) {
|
||||
double[] p1 = this.descriptor
|
||||
|
@ -217,11 +218,24 @@ public class DrawingLayer extends
|
|||
coords[0][1] = p1[1];
|
||||
coords[1][0] = p2[0];
|
||||
coords[1][1] = p2[1];
|
||||
System.out.println(i);
|
||||
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,
|
||||
eraseWireframeShape);
|
||||
// try {
|
||||
// target.drawWireframeShape(eraseWireframeShape,
|
||||
// new RGB(0, 0, 255), 10.0f);
|
||||
// } catch (VizException e) {
|
||||
// e.printStackTrace();
|
||||
// }
|
||||
issueRefresh();
|
||||
}
|
||||
}
|
||||
|
@ -254,6 +268,8 @@ public class DrawingLayer extends
|
|||
for (IWireframeShape shape : this.deletedShapes.values()) {
|
||||
shape.dispose();
|
||||
}
|
||||
|
||||
this.eraseWireframeShape.dispose();
|
||||
this.wireframeShapes.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.drawables.IDescriptor;
|
||||
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.EraseObjectsAction;
|
||||
import com.raytheon.uf.viz.drawing.actions.RedoAddAction;
|
||||
import com.raytheon.uf.viz.drawing.actions.UndoAddAction;
|
||||
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.dialogs.CaveSWTDialog;
|
||||
import com.raytheon.viz.ui.editor.AbstractEditor;
|
||||
|
@ -131,8 +131,8 @@ public class PathToolbar extends CaveSWTDialog implements
|
|||
|
||||
drawItem = new ToolItem(toolbar, SWT.NONE);
|
||||
drawItem.setText("Draw");
|
||||
drawItem.setImage(ToolsUtils.getImageDescriptor("draw.gif")
|
||||
.createImage());
|
||||
drawItem.setImage(IconUtil.getImageDescriptor(
|
||||
Activator.getDefault().getBundle(), "draw.gif").createImage());
|
||||
|
||||
drawItem.addSelectionListener(new SelectionAdapter() {
|
||||
@Override
|
||||
|
@ -156,6 +156,7 @@ public class PathToolbar extends CaveSWTDialog implements
|
|||
for (ResourcePair pair : desc.getResourceList()) {
|
||||
if (pair.getResource() instanceof DrawingLayer) {
|
||||
layers.put(editor, pair);
|
||||
eraserItem.setEnabled(true);
|
||||
// drawItem.setEnabled(false);
|
||||
}
|
||||
}
|
||||
|
@ -164,8 +165,8 @@ public class PathToolbar extends CaveSWTDialog implements
|
|||
|
||||
ToolItem undoItem = new ToolItem(toolbar, SWT.FLAT);
|
||||
undoItem.setText("Undo");
|
||||
undoItem.setImage(ToolsUtils.getImageDescriptor("undo.gif")
|
||||
.createImage());
|
||||
undoItem.setImage(IconUtil.getImageDescriptor(
|
||||
Activator.getDefault().getBundle(), "undo.gif").createImage());
|
||||
undoItem.addSelectionListener(new SelectionAdapter() {
|
||||
@Override
|
||||
public void widgetSelected(SelectionEvent e) {
|
||||
|
@ -180,8 +181,8 @@ public class PathToolbar extends CaveSWTDialog implements
|
|||
|
||||
ToolItem redoItem = new ToolItem(toolbar, SWT.FLAT);
|
||||
redoItem.setText("Redo");
|
||||
redoItem.setImage(ToolsUtils.getImageDescriptor("redo.gif")
|
||||
.createImage());
|
||||
redoItem.setImage(IconUtil.getImageDescriptor(
|
||||
Activator.getDefault().getBundle(), "redo.gif").createImage());
|
||||
redoItem.addSelectionListener(new SelectionAdapter() {
|
||||
@Override
|
||||
public void widgetSelected(SelectionEvent e) {
|
||||
|
@ -196,8 +197,10 @@ public class PathToolbar extends CaveSWTDialog implements
|
|||
|
||||
ToolItem clearItem = new ToolItem(toolbar, SWT.FLAT);
|
||||
clearItem.setText("Clear");
|
||||
clearItem.setImage(ToolsUtils.getImageDescriptor("remove.gif")
|
||||
.createImage());
|
||||
clearItem
|
||||
.setImage(IconUtil.getImageDescriptor(
|
||||
Activator.getDefault().getBundle(), "remove.gif")
|
||||
.createImage());
|
||||
clearItem.addSelectionListener(new SelectionAdapter() {
|
||||
@Override
|
||||
public void widgetSelected(SelectionEvent e) {
|
||||
|
@ -212,8 +215,10 @@ public class PathToolbar extends CaveSWTDialog implements
|
|||
|
||||
eraserItem = new ToolItem(toolbar, SWT.CHECK);
|
||||
eraserItem.setText("Eraser");
|
||||
eraserItem.setImage(ToolsUtils.getImageDescriptor("eraser.png")
|
||||
.createImage());
|
||||
eraserItem
|
||||
.setImage(IconUtil.getImageDescriptor(
|
||||
Activator.getDefault().getBundle(), "eraser.png")
|
||||
.createImage());
|
||||
eraserItem.setEnabled(false);
|
||||
eraserItem.addSelectionListener(new SelectionAdapter() {
|
||||
@Override
|
||||
|
@ -236,12 +241,6 @@ public class PathToolbar extends CaveSWTDialog implements
|
|||
}
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
private void dispose() {
|
||||
}
|
||||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
*
|
||||
|
@ -256,14 +255,11 @@ public class PathToolbar extends CaveSWTDialog implements
|
|||
IDescriptor desc = editor.getActiveDisplayPane().getDescriptor();
|
||||
((VizMultiPaneEditor) editor)
|
||||
.addSelectedPaneChangedListener(PathToolbar.getToolbar());
|
||||
boolean hasLayer = false;
|
||||
for (ResourcePair pair : desc.getResourceList()) {
|
||||
if (pair.getResource() instanceof DrawingLayer) {
|
||||
hasLayer = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
// drawItem.setEnabled(hasLayer);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -56,7 +56,8 @@ public class EraseObjectsAction extends AbstractHandler {
|
|||
for (ResourcePair pair : list) {
|
||||
if (pair.getResource() instanceof DrawingLayer) {
|
||||
((DrawingLayer) pair.getResource())
|
||||
.setErase(((DrawingLayer) pair.getResource()).isErase());
|
||||
.setErase(!((DrawingLayer) pair.getResource())
|
||||
.isErase());
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -25,14 +25,14 @@ import java.util.List;
|
|||
|
||||
import org.eclipse.swt.SWT;
|
||||
import org.eclipse.swt.graphics.Cursor;
|
||||
import org.eclipse.swt.graphics.Image;
|
||||
import org.eclipse.swt.graphics.ImageData;
|
||||
import org.eclipse.swt.graphics.ImageLoader;
|
||||
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.IInputHandler;
|
||||
import com.raytheon.uf.viz.drawing.AbstractDrawingTool;
|
||||
import com.raytheon.uf.viz.drawing.Activator;
|
||||
import com.raytheon.uf.viz.drawing.PathDrawingResourceData;
|
||||
import com.raytheon.viz.ui.input.InputAdapter;
|
||||
import com.vividsolutions.jts.geom.Coordinate;
|
||||
|
@ -88,16 +88,13 @@ public class PathDrawingTool extends AbstractDrawingTool {
|
|||
|
||||
Cursor cursor = null;
|
||||
if (theDrawingLayer.isErase()) {
|
||||
ImageData data = ToolsUtils
|
||||
.getImageDescriptor("eraser_box.gif").getImageData();
|
||||
ImageData data = IconUtil.getImageDescriptor(
|
||||
Activator.getDefault().getBundle(), "eraser_box.gif")
|
||||
.getImageData();
|
||||
data.alpha = 255;
|
||||
cursor = new Cursor(Display.getCurrent(), data, 8, 8);
|
||||
} else {
|
||||
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);
|
||||
|
|
|
@ -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