Update of /cvsroot/bprocessor/gl/src/net/sourceforge/bprocessor/gl/tool
In directory sc8-pr-cvs3.sourceforge.net:/tmp/cvs-serv27284/src/net/sourceforge/bprocessor/gl/tool
Modified Files:
ToolFactory.java OffsetTool.java
Log Message:
Made offsettool work better with line offset, and give better feedback when something illligal happens
Index: ToolFactory.java
===================================================================
RCS file: /cvsroot/bprocessor/gl/src/net/sourceforge/bprocessor/gl/tool/ToolFactory.java,v
retrieving revision 1.82
retrieving revision 1.83
diff -C2 -d -r1.82 -r1.83
*** ToolFactory.java 3 Sep 2007 13:36:52 -0000 1.82
--- ToolFactory.java 3 Sep 2007 16:00:13 -0000 1.83
***************
*** 170,173 ****
--- 170,175 ----
private JToggleButton altRectBut;
+ protected static Cursor errorCursor;
+
/**
* Constructor
***************
*** 185,189 ****
Cursor pencilcursor
= Toolkit.getDefaultToolkit().createCustomCursor(pencilimage, new Point(7, 8), "Pencil");
!
url = cl.getResource("Bcursorrotcam.gif");
Image rotationImage = Toolkit.getDefaultToolkit().getImage(url);
--- 187,196 ----
Cursor pencilcursor
= Toolkit.getDefaultToolkit().createCustomCursor(pencilimage, new Point(7, 8), "Pencil");
!
! url = cl.getResource("BcursorError.gif");
! Image errorImage = Toolkit.getDefaultToolkit().getImage(url);
! errorCursor
! = Toolkit.getDefaultToolkit().createCustomCursor(errorImage, new Point(7, 8), "Error");
!
url = cl.getResource("Bcursorrotcam.gif");
Image rotationImage = Toolkit.getDefaultToolkit().getImage(url);
Index: OffsetTool.java
===================================================================
RCS file: /cvsroot/bprocessor/gl/src/net/sourceforge/bprocessor/gl/tool/OffsetTool.java,v
retrieving revision 1.15
retrieving revision 1.16
diff -C2 -d -r1.15 -r1.16
*** OffsetTool.java 20 Jun 2007 13:17:55 -0000 1.15
--- OffsetTool.java 3 Sep 2007 16:00:13 -0000 1.16
***************
*** 90,98 ****
surfaceFound = true;
Surface surface = (Surface)current.object();
! List edges = new LinkedList();
edges.addAll(surface.getEdges());
Collection selection = Selection.primary();
if (selection.size() > 0 && edges.containsAll(selection)) {
! System.out.println("Did contain all");
edges.clear();
edges.addAll(selection);
--- 90,98 ----
surfaceFound = true;
Surface surface = (Surface)current.object();
! List<Edge> edges = new LinkedList<Edge>();
edges.addAll(surface.getEdges());
Collection selection = Selection.primary();
if (selection.size() > 0 && edges.containsAll(selection)) {
! log.info("Did contain all");
edges.clear();
edges.addAll(selection);
***************
*** 126,134 ****
if (start == null && current.object() instanceof Surface) {
Surface s = (Surface)current.object();
! edge = s.findClosestEdge(current.vertex());
! edgePoint = edge.intersection(current.vertex());
! LinkedList feedback = new LinkedList();
! feedback.add(new Point(edgePoint));
! feedback(feedback);
}
updateLength();
--- 126,146 ----
if (start == null && current.object() instanceof Surface) {
Surface s = (Surface)current.object();
! if (Selection.primary().isEmpty()) {
! edge = s.findClosestEdge(current.vertex(), s.getEdges());
! } else {
! edge = s.findClosestEdge(current.vertex(), Selection.primary());
! }
! if (edge != null) {
! glv.setCursor(this.getCursor());
! edgePoint = edge.intersection(current.vertex());
! LinkedList feedback = new LinkedList();
! feedback.add(new Point(edgePoint));
! feedback(feedback);
! setTip(initialTip());
! } else {
! setTip(errorString());
! glv.setCursor(ToolFactory.errorCursor);
! current = null;
! }
}
updateLength();
***************
*** 138,141 ****
--- 150,161 ----
/**
+ * Tip when the selection is wrong
+ * @return
+ */
+ private String errorString() {
+ return "All selected edges have to be part of same surface";
+ }
+
+ /**
* Moves the offset contour by the sepcified length
* @param length the length to move the offset
|