[Bprocessor-commit] gl/src/net/sourceforge/bprocessor/gl/tool OffsetTool.java, 1.12, 1.13 MoveTool.
Status: Pre-Alpha
Brought to you by:
henryml
|
From: Michael L. <he...@us...> - 2006-11-15 09:53:29
|
Update of /cvsroot/bprocessor/gl/src/net/sourceforge/bprocessor/gl/tool In directory sc8-pr-cvs3.sourceforge.net:/tmp/cvs-serv23519/src/net/sourceforge/bprocessor/gl/tool Modified Files: OffsetTool.java MoveTool.java ExtrusionTool.java ConstructorTool.java TapeMeasure.java Log Message: Lengthfield should now work in all geometric tools Index: MoveTool.java =================================================================== RCS file: /cvsroot/bprocessor/gl/src/net/sourceforge/bprocessor/gl/tool/MoveTool.java,v retrieving revision 1.72 retrieving revision 1.73 diff -C2 -d -r1.72 -r1.73 *** MoveTool.java 22 Oct 2006 14:32:55 -0000 1.72 --- MoveTool.java 15 Nov 2006 09:53:17 -0000 1.73 *************** *** 143,155 **** current = findIntersection(e); if (current != null) { ! current = current.copy(); ! to = current.vertex(); ! if (Selection.primary().size() < 2) { ! last = move(entities, to.minus(last)).add(last); ! } else { ! last = move(vertices, to.minus(last)).add(last); ! } ! update(); ! updateFeedback(); } } --- 143,147 ---- current = findIntersection(e); if (current != null) { ! move(); } } *************** *** 158,161 **** --- 150,185 ---- /** + * Move + * + */ + private void move() { + current = current.copy(); + to = current.vertex(); + if (Selection.primary().size() < 2) { + last = move(entities, to.minus(last)).add(last); + } else { + last = move(vertices, to.minus(last)).add(last); + } + update(); + updateFeedback(); + } + + /** + * Finish + * + */ + private void finish() { + Collection surfaces = Edge.surfaces(Vertex.edges(vertices)); + Iterator iter = surfaces.iterator(); + while (iter.hasNext()) { + Surface current = (Surface) iter.next(); + holeAnalysis(current); + } + Project.getInstance().changed(vertices); + Project.getInstance().checkpoint(); + cleanUp(); + } + + /** * @see net.sourceforge.bprocessor.gl.tool.AbstractTool#pressed() */ *************** *** 192,204 **** } } else { ! Collection surfaces = Edge.surfaces(Vertex.edges(vertices)); ! Iterator iter = surfaces.iterator(); ! while (iter.hasNext()) { ! Surface current = (Surface) iter.next(); ! holeAnalysis(current); ! } ! Project.getInstance().changed(vertices); ! Project.getInstance().checkpoint(); ! cleanUp(); moved(e); } --- 216,220 ---- } } else { ! finish(); moved(e); } *************** *** 206,209 **** --- 222,235 ---- /** + * + */ + public void onVertex() { + if (active) { + move(); + finish(); + } + } + + /** * @see net.sourceforge.bprocessor.gl.tool.AbstractPencil#cleanUp() */ Index: ConstructorTool.java =================================================================== RCS file: /cvsroot/bprocessor/gl/src/net/sourceforge/bprocessor/gl/tool/ConstructorTool.java,v retrieving revision 1.12 retrieving revision 1.13 diff -C2 -d -r1.12 -r1.13 *** ConstructorTool.java 10 Oct 2006 15:00:43 -0000 1.12 --- ConstructorTool.java 15 Nov 2006 09:53:17 -0000 1.13 *************** *** 136,143 **** } /** * @param e MouseEvent */ ! protected void pressed(MouseEvent e) { if (p1 == null) { p1 = current; --- 136,145 ---- } + /** + * Process click * @param e MouseEvent */ ! private void process(MouseEvent e) { if (p1 == null) { p1 = current; *************** *** 148,152 **** insertPoint(current.vertex().copy()); cleanUp(); ! moved(e); return; } else if (p2 == null) { --- 150,156 ---- insertPoint(current.vertex().copy()); cleanUp(); ! if (e != null) { ! moved(e); ! } return; } else if (p2 == null) { *************** *** 156,165 **** insertLine(p1.vertex().copy(), p2.vertex().copy()); cleanUp(); ! moved(e); return; } else { insertPlane(p1.vertex().copy(), p2.vertex().copy(), current.vertex().copy()); cleanUp(); ! moved(e); return; } --- 160,173 ---- insertLine(p1.vertex().copy(), p2.vertex().copy()); cleanUp(); ! if (e != null) { ! moved(e); ! } return; } else { insertPlane(p1.vertex().copy(), p2.vertex().copy(), current.vertex().copy()); cleanUp(); ! if (e != null) { ! moved(e); ! } return; } *************** *** 168,170 **** --- 176,192 ---- updateFeedback(); } + + /** + * @param e MouseEvent + */ + protected void pressed(MouseEvent e) { + process(e); + } + + /** + * On Vertex + */ + public void onVertex() { + process(null); + } } Index: OffsetTool.java =================================================================== RCS file: /cvsroot/bprocessor/gl/src/net/sourceforge/bprocessor/gl/tool/OffsetTool.java,v retrieving revision 1.12 retrieving revision 1.13 diff -C2 -d -r1.12 -r1.13 *** OffsetTool.java 16 Oct 2006 15:07:00 -0000 1.12 --- OffsetTool.java 15 Nov 2006 09:53:17 -0000 1.13 *************** *** 132,135 **** --- 132,136 ---- feedback(feedback); } + updateLength(); makeTarget(current); timer.stop(); Index: ExtrusionTool.java =================================================================== RCS file: /cvsroot/bprocessor/gl/src/net/sourceforge/bprocessor/gl/tool/ExtrusionTool.java,v retrieving revision 1.42 retrieving revision 1.43 diff -C2 -d -r1.42 -r1.43 *** ExtrusionTool.java 7 Nov 2006 09:54:11 -0000 1.42 --- ExtrusionTool.java 15 Nov 2006 09:53:17 -0000 1.43 *************** *** 159,162 **** --- 159,163 ---- extrude(distance, all, false); } + updateLength(); } *************** *** 211,214 **** --- 212,231 ---- } } + + /** + * Update length + */ + public void updateLength() { + if (extrudesurface == null) { + glv.setLengthValue(""); + } else { + double value = distance; + if (value < 0) { + value = -value; + } + this.setLength(value); + } + } + /** * Index: TapeMeasure.java =================================================================== RCS file: /cvsroot/bprocessor/gl/src/net/sourceforge/bprocessor/gl/tool/TapeMeasure.java,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** TapeMeasure.java 14 Nov 2006 15:10:05 -0000 1.1 --- TapeMeasure.java 15 Nov 2006 09:53:17 -0000 1.2 *************** *** 17,20 **** --- 17,21 ---- import net.sourceforge.bprocessor.model.Geometry; import net.sourceforge.bprocessor.model.Line; + import net.sourceforge.bprocessor.model.Project; import net.sourceforge.bprocessor.model.Vertex; *************** *** 98,101 **** --- 99,111 ---- } } + + /** + * Insert a line + * @param line Line + */ + private void insert(Line line) { + Geometry.insertConstructor(line); + Project.getInstance().checkpoint(); + } /** *************** *** 111,119 **** if (originalEdge != null) { Line line = new Line(current.vertex(), originalEdge.getDirection(), true, false); ! Geometry.insertConstructor(line); } else { if (lengthEdge != null) { Line line = new Line(start.vertex(), lengthEdge.getDirection(), true, false); ! Geometry.insertConstructor(line); } } --- 121,129 ---- if (originalEdge != null) { Line line = new Line(current.vertex(), originalEdge.getDirection(), true, false); ! insert(line); } else { if (lengthEdge != null) { Line line = new Line(start.vertex(), lengthEdge.getDirection(), true, false); ! insert(line); } } *************** *** 145,152 **** Vertex origin = start.vertex().add(direction); Line line = new Line(origin, originalEdge.getDirection(), true, false); ! Geometry.insertConstructor(line); } else { Line line = new Line(start.vertex(), lengthEdge.getDirection(), true, false); ! Geometry.insertConstructor(line); } cleanUp(); --- 155,162 ---- Vertex origin = start.vertex().add(direction); Line line = new Line(origin, originalEdge.getDirection(), true, false); ! insert(line); } else { Line line = new Line(start.vertex(), lengthEdge.getDirection(), true, false); ! insert(line); } cleanUp(); |