bprocessor-commit Mailing List for B-processor (Page 126)
Status: Pre-Alpha
Brought to you by:
henryml
You can subscribe to this list here.
2005 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
(12) |
Jul
(117) |
Aug
(151) |
Sep
(157) |
Oct
(81) |
Nov
(117) |
Dec
(119) |
---|---|---|---|---|---|---|---|---|---|---|---|---|
2006 |
Jan
(183) |
Feb
(130) |
Mar
(117) |
Apr
(61) |
May
(82) |
Jun
(45) |
Jul
(149) |
Aug
(173) |
Sep
(199) |
Oct
(165) |
Nov
(107) |
Dec
(137) |
2007 |
Jan
(124) |
Feb
(58) |
Mar
(123) |
Apr
(80) |
May
(130) |
Jun
(64) |
Jul
(31) |
Aug
(42) |
Sep
(114) |
Oct
(167) |
Nov
(239) |
Dec
(200) |
2008 |
Jan
(43) |
Feb
(43) |
Mar
(4) |
Apr
(9) |
May
(5) |
Jun
(1) |
Jul
(3) |
Aug
(3) |
Sep
(13) |
Oct
(9) |
Nov
(12) |
Dec
|
2009 |
Jan
|
Feb
(20) |
Mar
(7) |
Apr
(12) |
May
(34) |
Jun
(72) |
Jul
|
Aug
(3) |
Sep
(31) |
Oct
(2) |
Nov
(8) |
Dec
(4) |
2010 |
Jan
(5) |
Feb
(32) |
Mar
(8) |
Apr
(7) |
May
(36) |
Jun
|
Jul
(11) |
Aug
(15) |
Sep
(7) |
Oct
(2) |
Nov
(13) |
Dec
(80) |
2011 |
Jan
|
Feb
|
Mar
(8) |
Apr
(12) |
May
(32) |
Jun
(9) |
Jul
(5) |
Aug
|
Sep
(2) |
Oct
|
Nov
|
Dec
(8) |
2012 |
Jan
|
Feb
|
Mar
(3) |
Apr
(5) |
May
(2) |
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
2013 |
Jan
|
Feb
|
Mar
|
Apr
|
May
(22) |
Jun
(5) |
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
From: Nordholt <nor...@us...> - 2006-04-13 13:36:18
|
Update of /cvsroot/bprocessor/gl/src/net/sourceforge/bprocessor/gl/tool In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv28074 Modified Files: ControlledMoveStrategy.java Log Message: now controlled move works when a surface has holes aswell Index: ControlledMoveStrategy.java =================================================================== RCS file: /cvsroot/bprocessor/gl/src/net/sourceforge/bprocessor/gl/tool/ControlledMoveStrategy.java,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** ControlledMoveStrategy.java 5 Apr 2006 10:24:56 -0000 1.3 --- ControlledMoveStrategy.java 13 Apr 2006 13:36:10 -0000 1.4 *************** *** 242,246 **** private Map createSlideMap(Surface surface) { Collection verts = surface.getVertices(); ! Iterator it = vertices.iterator(); boolean bound = false; Map map = new HashMap(); --- 242,246 ---- private Map createSlideMap(Surface surface) { Collection verts = surface.getVertices(); ! Iterator it = verts.iterator(); boolean bound = false; Map map = new HashMap(); *************** *** 259,267 **** bound = otherEdges > 1; } } if (!bound) { return map; } - return null; } --- 259,281 ---- bound = otherEdges > 1; } + bound = otherEdges > 1; + } + + Collection holes = surface.getHoles(); + it = holes.iterator(); + while (it.hasNext() && !bound) { + Map holeMap = createSlideMap((Surface)it.next()); + if (holeMap != null) { + map.putAll(holeMap); + } else { + bound = true; + } } + if (!bound) { return map; + } else { + return null; } } *************** *** 307,311 **** } } ! } } --- 321,325 ---- } } ! } } |
From: Nordholt <nor...@us...> - 2006-04-13 13:35:15
|
Update of /cvsroot/bprocessor/gl/src/net/sourceforge/bprocessor/gl/tool In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv26793 Modified Files: AbstractPencil.java Log Message: Finds better workplanes. Can lock a direction using the shift key. Changed the color of the parrallel aligning constructor to orange for better visibility Index: AbstractPencil.java =================================================================== RCS file: /cvsroot/bprocessor/gl/src/net/sourceforge/bprocessor/gl/tool/AbstractPencil.java,v retrieving revision 1.22 retrieving revision 1.23 diff -C2 -d -r1.22 -r1.23 *** AbstractPencil.java 5 Apr 2006 10:49:09 -0000 1.22 --- AbstractPencil.java 13 Apr 2006 13:34:56 -0000 1.23 *************** *** 30,33 **** --- 30,35 ---- import net.sourceforge.bprocessor.model.Surface; import net.sourceforge.bprocessor.model.Vertex; + import net.sourceforge.bprocessor.model.Camera; + import org.apache.log4j.Logger; *************** *** 60,63 **** --- 62,71 ---- protected Intersection incident; + /** Locked */ + protected Vertex locked; + + /** wherther or not the tool is locked */ + protected boolean lock; + /** Work plane */ protected Plane plane; *************** *** 78,81 **** --- 86,91 ---- timer = new Timer(500, new TargetAction()); timer.setRepeats(false); + lock = false; + plane = new Plane (0, 0, 1, 0); } *************** *** 98,108 **** */ protected Intersection findIntersection(MouseEvent e) { Collection unwanted = new HashSet(); unwanted.addAll(elements); unwanted.addAll(excluded); ! Intersection intersection = (Intersection) glv.getView().getObjectAtPoint(e.getX(), e.getY(), ! unwanted, true, new Plane(0, 0, 1, 0)); return intersection; } /** * Insert a vertex into model --- 108,150 ---- */ protected Intersection findIntersection(MouseEvent e) { + plane = bestAlignedPlane(); + if (start != null) { + Vertex planeNormal = plane.normal(); + plane = new Plane(planeNormal.getX(), + planeNormal.getY(), + planeNormal.getZ(), + -(planeNormal.getX() * start.vertex().getX() + + planeNormal.getY() * start.vertex().getY() + + planeNormal.getZ() * start.vertex().getZ())); + } Collection unwanted = new HashSet(); unwanted.addAll(elements); unwanted.addAll(excluded); ! Intersection intersection = ! (Intersection) glv.getView().getObjectAtPoint(e.getX(), e.getY(), ! unwanted, true, plane); ! if (lock) { ! intersection = lockedIntersection(intersection); ! } return intersection; } + + /** + * If the tool is locked correct the intersection + * @param intersection the original intersection + * @return the corrected intersection + */ + private Intersection lockedIntersection(Intersection intersection) { + if (start != null) { + Vertex lockedcopy = locked.copy(); + Vertex unlocked = intersection.vertex().minus(start.vertex()); + lockedcopy.scale(locked.dot(unlocked)); + lockedcopy = lockedcopy.add(start.vertex()); + return new Intersection(lockedcopy, Intersection.VERTEX, lockedcopy); + } else { + return intersection; + } + } + /** * Insert a vertex into model *************** *** 335,339 **** if (!isAxisAligned(parrallel)) { parrallel.setConstructor(true); ! glv.getView().changeColor(parrallel, new float[] {1, 1, 0}); constructors.add(parrallel); } --- 377,381 ---- if (!isAxisAligned(parrallel)) { parrallel.setConstructor(true); ! glv.getView().changeColor(parrallel, new float[] {255f / 255f, 153f / 255f, 0}); constructors.add(parrallel); } *************** *** 376,379 **** --- 418,456 ---- excluded.addAll(feed); } + + /** + * Get the plane out of the XY XZ and YZ planes that is best aligned + * with screen. + * @return the plane + */ + protected Plane bestAlignedPlane() { + Camera camera = Project.getInstance().getCurrentCamera(); + double[] centerPoint = camera.getCenter(); + double[] cameraPoint = camera.getCamera(); + + Vertex eyeVector = new Vertex(cameraPoint[0] - centerPoint[0], + cameraPoint[1] - centerPoint[1], + cameraPoint[2] - centerPoint[2]); + eyeVector.scale(1 / eyeVector.length()); + + Vertex normal; + Vertex xyNormal = new Vertex(0, 0, 1); + Vertex xzNormal = new Vertex(0, 1, 0); + Vertex yzNormal = new Vertex(1, 0, 0); + if (Math.abs(eyeVector.dot(xyNormal)) > + Math.abs(eyeVector.dot(xzNormal))) { + normal = xyNormal; + } else { + normal = xzNormal; + } + if (Math.abs(eyeVector.dot(yzNormal)) > + Math.abs(eyeVector.dot(normal))) { + normal = yzNormal; + } + return new Plane(normal.getX(), + normal.getY(), + normal.getZ(), 0); + } + /** *************** *** 451,455 **** case Intersection.SURFACE: target = intersection.object(); ! plane = ((Surface) target).plane(); break; case Intersection.EDGE_MIDPOINT: --- 528,532 ---- case Intersection.SURFACE: target = intersection.object(); ! //plane = ((Surface) target).plane(); break; case Intersection.EDGE_MIDPOINT: *************** *** 464,468 **** case Intersection.PLANE_INTERSECTION: target = null; ! plane = (Plane) intersection.object(); break; } --- 541,545 ---- case Intersection.PLANE_INTERSECTION: target = null; ! //plane = (Plane) intersection.object(); break; } *************** *** 535,538 **** --- 612,621 ---- } glv.repaint(); + } else if (e.getKeyCode() == KeyEvent.VK_SHIFT) { + if (start != null && current != null) { + locked = start.vertex().minus(current.vertex()); + locked.scale(1 / locked.length()); + } + lock = !lock; } else if (e.getKeyCode() == KeyEvent.VK_ESCAPE) { cleanUp(); *************** *** 590,594 **** v.scale((d / 1000) / v.length()); Vertex to = before.add(v); ! current = new Intersection(to, Intersection.VERTEX, null); onVertex(); number = ""; --- 673,677 ---- v.scale((d / 1000) / v.length()); Vertex to = before.add(v); ! current = new Intersection(to, Intersection.VERTEX, to); onVertex(); number = ""; *************** *** 614,618 **** */ public void cleanUp() { ! plane = null; start = null; current = null; --- 697,701 ---- */ public void cleanUp() { ! plane = new Plane(0, 0, 1, 0);; start = null; current = null; |
From: rimestad <rim...@us...> - 2006-04-12 15:10:16
|
Update of /cvsroot/bprocessor/gui/src/net/sourceforge/bprocessor/gui/treeview In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv2741/src/net/sourceforge/bprocessor/gui/treeview Modified Files: SpaceTreeView.java Log Message: Keeps the tree in the databaseview in the same way always Index: SpaceTreeView.java =================================================================== RCS file: /cvsroot/bprocessor/gui/src/net/sourceforge/bprocessor/gui/treeview/SpaceTreeView.java,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** SpaceTreeView.java 5 Apr 2006 09:35:50 -0000 1.6 --- SpaceTreeView.java 12 Apr 2006 15:10:09 -0000 1.7 *************** *** 8,12 **** --- 8,17 ---- package net.sourceforge.bprocessor.gui.treeview; + import java.util.ArrayList; import java.util.Collection; + import java.util.Enumeration; + + import javax.swing.tree.DefaultMutableTreeNode; + import javax.swing.tree.TreePath; import net.sourceforge.bprocessor.model.Project; *************** *** 33,40 **** */ public void update() { - root.removeAllChildren(); Collection construction = Project.getInstance().getConstructionSpaces(); Collection functional = Project.getInstance().getFunctionalSpaces(); Collection constraints = Project.getInstance().getConstraints(); root.add(new SpaceContainer("Functional", functional)); root.add(new SpaceContainer("Construction", construction)); --- 38,47 ---- */ public void update() { Collection construction = Project.getInstance().getConstructionSpaces(); Collection functional = Project.getInstance().getFunctionalSpaces(); Collection constraints = Project.getInstance().getConstraints(); + Enumeration e = getExpandedDescendants(new TreePath(root)); + Object[] paths = findPaths(e); + root.removeAllChildren(); root.add(new SpaceContainer("Functional", functional)); root.add(new SpaceContainer("Construction", construction)); *************** *** 42,45 **** --- 49,112 ---- root.add(new GeometryContainer("Geometry", Project.getInstance().world())); model.nodeStructureChanged(root); + openPaths(paths); + } + + /** + * Find the paths + * @param e and enumerator of open nodes + * @return And array of arrays of objects + */ + private Object[] findPaths(Enumeration e) { + if (e != null) { + ArrayList res = new ArrayList(); + while (e.hasMoreElements()) { + Object o = e.nextElement(); + if (o instanceof TreePath) { + TreePath tp = (TreePath)o; + Object[] os = tp.getPath(); + Object[] temp = new Object[os.length]; + for (int i = 0; i < os.length; i++) { + temp[i] = ((DefaultMutableTreeNode)os[i]).getUserObject(); + } + res.add(temp); + } + } + return res.toArray(); + } + return null; + } + + /** + * Open the paths of the given objects + * @param paths The open paths + */ + public void openPaths(Object[] paths) { + if (paths != null) { + for (int i = 0; i < paths.length; i++) { + Object[] route = (Object[])paths[i]; + if (route.length > 1) { + openPath(root, 1, route); + } + } + } + } + + /** + * Open one path in the tree + * @param depth The depth reached in this call (< route.length) + * @param node The node to check in + * @param route The path to open + */ + private void openPath(DefaultMutableTreeNode node, int depth, Object[] route) { + Enumeration e = node.children(); + while (e.hasMoreElements()) { + DefaultMutableTreeNode current = (DefaultMutableTreeNode)e.nextElement(); + if (current.getUserObject() == route[depth]) { + expandPath(new TreePath(current.getPath())); + if (depth + 1 < route.length) { + openPath(current, depth + 1, route); + } + } + } } } |
From: rimestad <rim...@us...> - 2006-04-12 14:29:34
|
Update of /cvsroot/bprocessor/model/src/net/sourceforge/bprocessor/model In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv7753/src/net/sourceforge/bprocessor/model Modified Files: Vertex.java Constraint.java Space.java LayerModellor.java Entity.java Log Message: Added the method delete() to entity and thereby all classes that extends entity Index: Space.java =================================================================== RCS file: /cvsroot/bprocessor/model/src/net/sourceforge/bprocessor/model/Space.java,v retrieving revision 1.24 retrieving revision 1.25 diff -C2 -d -r1.24 -r1.25 *** Space.java 5 Apr 2006 09:35:58 -0000 1.24 --- Space.java 12 Apr 2006 14:29:27 -0000 1.25 *************** *** 830,832 **** --- 830,840 ---- return "Space"; } + + /** + * Delete the entity + */ + public void delete() { + clear(); + Project.getInstance().delete(this); + } } Index: Vertex.java =================================================================== RCS file: /cvsroot/bprocessor/model/src/net/sourceforge/bprocessor/model/Vertex.java,v retrieving revision 1.33 retrieving revision 1.34 diff -C2 -d -r1.33 -r1.34 *** Vertex.java 5 Apr 2006 14:10:15 -0000 1.33 --- Vertex.java 12 Apr 2006 14:29:27 -0000 1.34 *************** *** 385,387 **** --- 385,394 ---- return true; } + + /** + * Remove the entity + */ + public void delete() { + getOwner().delete(this); + } } Index: Constraint.java =================================================================== RCS file: /cvsroot/bprocessor/model/src/net/sourceforge/bprocessor/model/Constraint.java,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** Constraint.java 30 Jan 2006 15:08:39 -0000 1.2 --- Constraint.java 12 Apr 2006 14:29:27 -0000 1.3 *************** *** 117,119 **** --- 117,125 ---- } + /** + * Delete the entity + */ + public void delete() { + Project.getInstance().remove(this); + } } Index: Entity.java =================================================================== RCS file: /cvsroot/bprocessor/model/src/net/sourceforge/bprocessor/model/Entity.java,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** Entity.java 17 Mar 2006 09:30:34 -0000 1.6 --- Entity.java 12 Apr 2006 14:29:27 -0000 1.7 *************** *** 55,57 **** --- 55,63 ---- */ public abstract Vertex center(); + + /** + * Delete the entity from the model + * + */ + public abstract void delete(); } Index: LayerModellor.java =================================================================== RCS file: /cvsroot/bprocessor/model/src/net/sourceforge/bprocessor/model/LayerModellor.java,v retrieving revision 1.8 retrieving revision 1.9 diff -C2 -d -r1.8 -r1.9 *** LayerModellor.java 29 Mar 2006 07:23:07 -0000 1.8 --- LayerModellor.java 12 Apr 2006 14:29:27 -0000 1.9 *************** *** 105,107 **** --- 105,115 ---- return attributes; } + + /** + * Delete the entity + */ + public void delete() { + space.clear(); + + } } |
From: rimestad <rim...@us...> - 2006-04-12 14:28:11
|
Update of /cvsroot/bprocessor/gui/src/net/sourceforge/bprocessor/gui/treeview In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv6604/src/net/sourceforge/bprocessor/gui/treeview Modified Files: GenericTreeView.java Log Message: Added (but have temporary disabled) key listener to the database view to enable deletion of all entities... Index: GenericTreeView.java =================================================================== RCS file: /cvsroot/bprocessor/gui/src/net/sourceforge/bprocessor/gui/treeview/GenericTreeView.java,v retrieving revision 1.21 retrieving revision 1.22 diff -C2 -d -r1.21 -r1.22 *** GenericTreeView.java 5 Apr 2006 09:35:49 -0000 1.21 --- GenericTreeView.java 12 Apr 2006 14:27:54 -0000 1.22 *************** *** 9,16 **** --- 9,19 ---- import java.awt.Component; import java.awt.event.ActionListener; + import java.awt.event.KeyEvent; + import java.awt.event.KeyListener; import java.awt.event.MouseAdapter; import java.awt.event.MouseEvent; import java.net.URL; import java.util.Collection; + import java.util.HashSet; import java.util.Iterator; import java.util.Set; *************** *** 173,176 **** --- 176,180 ---- this.addTreeSelectionListener(new SelectionListener()); this.addMouseListener(new GenericMouseAdapter()); + //this.addKeyListener(new GenericKeyListener()); model = (DefaultTreeModel) getModel(); root = (DefaultMutableTreeNode) model.getRoot(); *************** *** 768,771 **** --- 772,818 ---- /** + * GenericKeyListener + */ + private class GenericKeyListener implements KeyListener { + /** + * Invoked when a key is pressed + * @param e Key info + */ + public void keyPressed(KeyEvent e) { + if (e.getKeyCode() == KeyEvent.VK_DELETE || e.getKeyCode() == KeyEvent.VK_BACK_SPACE) { + TreePath tp = selectionModel.getSelectionPath(); + Object o = tp.getLastPathComponent(); + System.out.println("The object were " + o); + if (o instanceof GenericNode) { + GenericNode node = (GenericNode) o; + o = node.getUserObject(); + System.out.println("The object were " + o); + if (o instanceof Entity) { + HashSet set = new HashSet(); + set.add(o); + //Selection.primary().clear(); + Project.getInstance().delete(set); + Project.getInstance().checkpoint(); + } + } + } + } + + /** + * Invoked when a key is released + * @param e Key info + */ + public void keyReleased(KeyEvent e) { + } + + /** + * Invoked when a key is typed + * @param e Key info + */ + public void keyTyped(KeyEvent e) { + } + } + + /** * Update * @param object The changed object |
From: rimestad <rim...@us...> - 2006-04-10 15:34:22
|
Update of /cvsroot/bprocessor/gl/src/net/sourceforge/bprocessor/gl/tool In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv31474/src/net/sourceforge/bprocessor/gl/tool Modified Files: ExtrudeTool.java Log Message: Now the extrude tool have both click-click and drag mouse support Index: ExtrudeTool.java =================================================================== RCS file: /cvsroot/bprocessor/gl/src/net/sourceforge/bprocessor/gl/tool/ExtrudeTool.java,v retrieving revision 1.16 retrieving revision 1.17 diff -C2 -d -r1.16 -r1.17 *** ExtrudeTool.java 10 Apr 2006 07:55:09 -0000 1.16 --- ExtrudeTool.java 10 Apr 2006 15:34:19 -0000 1.17 *************** *** 33,36 **** --- 33,48 ---- static final boolean LIMIT = false; + /** If the mode has not been decided */ + static final int UNDICIDED = 0; + + /** If the input mode is dragging */ + static final int DRAG_MODE = 1; + + /** If the input mode is press - press */ + static final int MOVE_MODE = 2; + + /** Tool mode */ + private int mode = UNDICIDED; + /** The dragSurface */ private Surface top; *************** *** 91,111 **** */ protected void pressed(MouseEvent e) { - cleanUp(); prevX = e.getX(); prevY = e.getY(); ! findTarget(e); ! ! if (target instanceof Surface) { ! sides = new HashSet(); ! extrudeSurface = (Surface) target; ! View view = glv.getView(); ! Transformation trans = view.transformation(); ! double x = prevX; ! double y = View.getHeight() - prevY; ! Vertex near = new Vertex(x, y, 0.0); ! Vertex far = new Vertex(x, y, 1.0); ! Edge ray = new Edge(near, far); ! ray = trans.unProject(ray); ! dragplane = extrudeSurface.plane().orthogonalPlane(ray); } } --- 103,129 ---- */ protected void pressed(MouseEvent e) { prevX = e.getX(); prevY = e.getY(); ! if (mode == UNDICIDED) { ! cleanUp(); ! findTarget(e); ! if (target instanceof Surface) { ! sides = new HashSet(); ! extrudeSurface = (Surface) target; ! View view = glv.getView(); ! Transformation trans = view.transformation(); ! double x = prevX; ! double y = View.getHeight() - prevY; ! Vertex near = new Vertex(x, y, 0.0); ! Vertex far = new Vertex(x, y, 1.0); ! Edge ray = new Edge(near, far); ! ray = trans.unProject(ray); ! dragplane = extrudeSurface.plane().orthogonalPlane(ray); ! mode = MOVE_MODE; ! } ! } else { ! if (mode == MOVE_MODE) { ! finishExtrusion(); ! } } } *************** *** 171,174 **** --- 189,193 ---- sides = null; } + mode = UNDICIDED; } *************** *** 185,188 **** --- 204,208 ---- length = -length; } + t = length; top = extrudeSurface.extrude(length, sides); if (extrudeAll) { *************** *** 210,220 **** */ private void finishExtrusion() { ! holeAnalysis(top); ! Iterator iter = sides.iterator(); ! while (iter.hasNext()) { ! Surface current = (Surface) iter.next(); ! holeAnalysis(current); } ! Project.getInstance().checkpoint(); } --- 230,245 ---- */ private void finishExtrusion() { ! if (Math.abs(t) > 0.00000001) { ! holeAnalysis(top); ! Iterator iter = sides.iterator(); ! while (iter.hasNext()) { ! Surface current = (Surface) iter.next(); ! holeAnalysis(current); ! } ! Project.getInstance().checkpoint(); ! } else { ! removeExtrusion(); } ! mode = UNDICIDED; } *************** *** 304,318 **** */ protected void moved(MouseEvent e) { ! findTarget(e); ! if (target instanceof Surface) { ! glv.getView().makeTarget(target); } } ! /** ! * Invoked when the mouse is held pressed and moved ! * @param e The MouseEvent object */ ! protected void dragged(MouseEvent e) { if (extrudeSurface != null) { Vertex normal; --- 329,347 ---- */ protected void moved(MouseEvent e) { ! if (mode == UNDICIDED) { ! findTarget(e); ! if (target instanceof Surface) { ! glv.getView().makeTarget(target); ! } ! } else if (mode == MOVE_MODE) { ! doThing(e); } } ! /** ! * Do the common extrusion check / extrusion ! * @param e The event */ ! private void doThing(MouseEvent e) { if (extrudeSurface != null) { Vertex normal; *************** *** 393,396 **** --- 422,438 ---- } } + + /** + * Invoked when the mouse is held pressed and moved + * @param e The MouseEvent object + */ + protected void dragged(MouseEvent e) { + if (Math.abs(prevX - e.getX()) + Math.abs(prevY - e.getY()) > 10) { + mode = DRAG_MODE; + } + if (mode == DRAG_MODE) { + doThing(e); + } + } /** *************** *** 399,405 **** */ protected void released(MouseEvent e) { ! if (Math.abs(t) < 0.0000001) { ! removeExtrusion(); ! } else { finishExtrusion(); } --- 441,445 ---- */ protected void released(MouseEvent e) { ! if (mode == DRAG_MODE) { finishExtrusion(); } *************** *** 447,450 **** --- 487,493 ---- number = number.substring(0, length - 1); } + } else if (e.getKeyCode() == KeyEvent.VK_ESCAPE) { + removeExtrusion(); + cleanUp(); } } |
From: Nikolaj B. <nbr...@us...> - 2006-04-10 14:57:28
|
Update of /cvsroot/bprocessor/model/src/net/sourceforge/bprocessor/model In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv30351/src/net/sourceforge/bprocessor/model Modified Files: Surface.java Log Message: Removed Fixme comments Index: Surface.java =================================================================== RCS file: /cvsroot/bprocessor/model/src/net/sourceforge/bprocessor/model/Surface.java,v retrieving revision 1.90 retrieving revision 1.91 diff -C2 -d -r1.90 -r1.91 *** Surface.java 10 Apr 2006 11:53:51 -0000 1.90 --- Surface.java 10 Apr 2006 14:57:19 -0000 1.91 *************** *** 991,996 **** res.add(new Attribute("Space", "None", false)); } ! // FIXME The material attribute should be ... a material! ! // The id does not work if this is not a toplevel surface. if (getFrontMaterial() != null) { res.add(new Attribute("Front Material", getFrontMaterial())); --- 991,995 ---- res.add(new Attribute("Space", "None", false)); } ! if (getFrontMaterial() != null) { res.add(new Attribute("Front Material", getFrontMaterial())); *************** *** 1011,1016 **** } - // FIXME The material attribute should be ... a material! - // The id does not work if this is not a toplevel surface. if (getBackMaterial() != null) { res.add(new Attribute("Back Material", getBackMaterial())); --- 1010,1013 ---- |
From: Nikolaj B. <nbr...@us...> - 2006-04-10 11:55:46
|
Update of /cvsroot/bprocessor/gl/src/net/sourceforge/bprocessor/gl/view In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv17409/src/net/sourceforge/bprocessor/gl/view Modified Files: View.java Log Message: Materials are now handled correct when displayed in attribute view: Index: View.java =================================================================== RCS file: /cvsroot/bprocessor/gl/src/net/sourceforge/bprocessor/gl/view/View.java,v retrieving revision 1.76 retrieving revision 1.77 diff -C2 -d -r1.76 -r1.77 *** View.java 5 Apr 2006 09:36:17 -0000 1.76 --- View.java 10 Apr 2006 11:55:43 -0000 1.77 *************** *** 11,18 **** import net.sourceforge.bprocessor.gl.model.ClippingPlane; import net.sourceforge.bprocessor.gl.model.Intersection; - import net.sourceforge.bprocessor.gui.Defaults; import net.sourceforge.bprocessor.gui.Toolbar; import net.sourceforge.bprocessor.model.CoordinateSystem; import net.sourceforge.bprocessor.model.Plane; import net.sourceforge.bprocessor.model.Camera; --- 11,18 ---- import net.sourceforge.bprocessor.gl.model.ClippingPlane; import net.sourceforge.bprocessor.gl.model.Intersection; import net.sourceforge.bprocessor.gui.Toolbar; import net.sourceforge.bprocessor.model.CoordinateSystem; + import net.sourceforge.bprocessor.model.Defaults; import net.sourceforge.bprocessor.model.Plane; import net.sourceforge.bprocessor.model.Camera; |
From: Nikolaj B. <nbr...@us...> - 2006-04-10 11:54:43
|
Update of /cvsroot/bprocessor/gui/src/net/sourceforge/bprocessor/gui/attrview In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv16506/src/net/sourceforge/bprocessor/gui/attrview Modified Files: AttributePanel.java MaterialAttribute.java GenericPanel.java Log Message: Materials are now handled correct when displayed in attribute view: Index: GenericPanel.java =================================================================== RCS file: /cvsroot/bprocessor/gui/src/net/sourceforge/bprocessor/gui/attrview/GenericPanel.java,v retrieving revision 1.15 retrieving revision 1.16 diff -C2 -d -r1.15 -r1.16 *** GenericPanel.java 16 Mar 2006 10:16:55 -0000 1.15 --- GenericPanel.java 10 Apr 2006 11:54:39 -0000 1.16 *************** *** 29,32 **** --- 29,33 ---- import net.sourceforge.bprocessor.model.Description; import net.sourceforge.bprocessor.model.Entity; + import net.sourceforge.bprocessor.model.Material; import net.sourceforge.bprocessor.model.Parametric; import net.sourceforge.bprocessor.model.Project; *************** *** 158,162 **** }); where.add(new AttributeRow(la)); ! } else if (a.getName().equals("Front Material") || a.getName().equals("Back Material")) { // Handles the materials MaterialAttribute ma = new MaterialAttribute(a); --- 159,163 ---- }); where.add(new AttributeRow(la)); ! } else if (a.getValue() instanceof Material) { // Handles the materials MaterialAttribute ma = new MaterialAttribute(a); Index: MaterialAttribute.java =================================================================== RCS file: /cvsroot/bprocessor/gui/src/net/sourceforge/bprocessor/gui/attrview/MaterialAttribute.java,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** MaterialAttribute.java 8 Mar 2006 14:22:05 -0000 1.2 --- MaterialAttribute.java 10 Apr 2006 11:54:39 -0000 1.3 *************** *** 24,34 **** import javax.swing.border.Border; - import net.sourceforge.bprocessor.gui.Defaults; import net.sourceforge.bprocessor.gui.GUI; import net.sourceforge.bprocessor.model.Attribute; import net.sourceforge.bprocessor.model.Material; - import net.sourceforge.bprocessor.model.Project; - import net.sourceforge.bprocessor.model.Space; - import net.sourceforge.bprocessor.model.Surface; /** --- 24,30 ---- *************** *** 46,55 **** private JComponent component; - /** The current surface */ - private Surface surface; - - /** The current side */ - private boolean side; - /** The editor, when this EditableAttribute is being edited */ private JTextField editor; --- 42,45 ---- *************** *** 124,143 **** private JComponent createValueLabel(Attribute a) { JPanel valueLabel = new JPanel(); ! surface = Project.getInstance().findSurfaceById(Long.parseLong(a.getValue().toString())); ! if (a.getName().equals("Front Material")) { ! side = true; ! float[] frontColor = getFrontColor(surface); ! valueLabel.setOpaque(true); ! Border blackline = BorderFactory.createLineBorder(Color.black); ! valueLabel.setBorder(blackline); ! valueLabel.setBackground(makeAWTColor(frontColor)); ! } else { ! side = false; ! float[] backColor = getBackColor(surface); ! valueLabel.setOpaque(true); ! Border blackline = BorderFactory.createLineBorder(Color.black); ! valueLabel.setBorder(blackline); ! valueLabel.setBackground(makeAWTColor(backColor)); ! } return valueLabel; } --- 114,122 ---- private JComponent createValueLabel(Attribute a) { JPanel valueLabel = new JPanel(); ! float[] frontColor = ((Material) a.getValue()).getColor(); ! valueLabel.setOpaque(true); ! Border blackline = BorderFactory.createLineBorder(Color.black); ! valueLabel.setBorder(blackline); ! valueLabel.setBackground(makeAWTColor(frontColor)); return valueLabel; } *************** *** 155,191 **** * Start editing the value by replacing the label with an editor */ ! public void startEditing() { ! Color defaultColor = Color.white; ! Material newMaterial; ! ! if (side) { ! if (surface.getFrontDomain() != null) { ! if (surface.getFrontMaterial() != null) { ! defaultColor = getMaterialColor(surface.getFrontMaterial()); ! } ! Color frontColor = JColorChooser.showDialog(GUI.getInstance(), ! "Surface Color", ! defaultColor); ! if (frontColor != null) { ! newMaterial = new Material("temp", frontColor.getRGBColorComponents(null)); ! surface.setFrontMaterial(newMaterial); ! surface.changed(); ! } ! } ! } else { ! if (surface.getBackDomain() != null) { ! if (surface.getBackMaterial() != null) { ! defaultColor = getMaterialColor(surface.getBackMaterial()); ! } ! Color backColor = JColorChooser.showDialog(GUI.getInstance(), ! "Surface Color", ! defaultColor); ! if (backColor != null) { ! newMaterial = new Material("temp", backColor.getRGBColorComponents(null)); ! surface.setBackMaterial(newMaterial); ! surface.changed(); ! } ! } ! } } --- 134,143 ---- * Start editing the value by replacing the label with an editor */ ! public void startEditing() { ! Color frontColor = JColorChooser.showDialog(GUI.getInstance(), ! "Surface Color", ! makeAWTColor(((Material) attribute.getValue()).getColor())); ! attribute.setValue(new Material("temp", frontColor.getRGBColorComponents(null))); ! valueChanged(); } *************** *** 238,293 **** private Color makeAWTColor(float[] rgb) { return new Color(rgb[0], rgb[1], rgb[2]); ! } ! ! ! /** ! * Return front color for surface ! * @param surface The surface ! * @return The color ! */ ! private float[] getFrontColor(Surface surface) { ! if (surface.getFrontDomain() == null) { ! return Defaults.getNoneColor(); ! } else { ! if (surface.getFrontMaterial() == null) { ! Space space = surface.getFrontDomain(); ! if (space.isConstructionSpace()) { ! return Defaults.getFrontColor(); ! } ! if (space.isFunctionalSpace()) { ! return Defaults.getBackColor(); ! } ! return Defaults.getNoneColor(); ! } else { ! return surface.getFrontMaterial().getColor(); ! } ! } ! } ! ! ! /** ! * Return back color for surface ! * @param surface The surface ! * @return The color ! */ ! private float[] getBackColor(Surface surface) { ! if (surface.getBackDomain() == null) { ! return Defaults.getNoneColor(); ! } else { ! if (surface.getBackMaterial() == null) { ! Space space = surface.getBackDomain(); ! if (space.isConstructionSpace()) { ! return Defaults.getFrontColor(); ! } ! if (space.isFunctionalSpace()) { ! return Defaults.getBackColor(); ! } ! return Defaults.getNoneColor(); ! } else { ! return surface.getBackMaterial().getColor(); ! } ! } ! } ! /** --- 190,194 ---- private Color makeAWTColor(float[] rgb) { return new Color(rgb[0], rgb[1], rgb[2]); ! } /** Index: AttributePanel.java =================================================================== RCS file: /cvsroot/bprocessor/gui/src/net/sourceforge/bprocessor/gui/attrview/AttributePanel.java,v retrieving revision 1.7 retrieving revision 1.8 diff -C2 -d -r1.7 -r1.8 *** AttributePanel.java 1 Mar 2006 11:58:36 -0000 1.7 --- AttributePanel.java 10 Apr 2006 11:54:38 -0000 1.8 *************** *** 19,24 **** import javax.swing.border.Border; - import net.sourceforge.bprocessor.gui.Defaults; import net.sourceforge.bprocessor.model.Camera; import net.sourceforge.bprocessor.model.Edge; import net.sourceforge.bprocessor.model.Material; --- 19,24 ---- import javax.swing.border.Border; import net.sourceforge.bprocessor.model.Camera; + import net.sourceforge.bprocessor.model.Defaults; import net.sourceforge.bprocessor.model.Edge; import net.sourceforge.bprocessor.model.Material; *************** *** 33,36 **** --- 33,39 ---- */ class AttributePanel extends JPanel { + /** Default serial-version-uid */ + private static final long serialVersionUID = 1L; + /** The logger */ private static Logger log = Logger.getLogger(AttributePanel.class); |
From: Nikolaj B. <nbr...@us...> - 2006-04-10 11:54:43
|
Update of /cvsroot/bprocessor/gui/src/net/sourceforge/bprocessor/gui In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv16506/src/net/sourceforge/bprocessor/gui Removed Files: Defaults.java Log Message: Materials are now handled correct when displayed in attribute view: --- Defaults.java DELETED --- |
From: Nikolaj B. <nbr...@us...> - 2006-04-10 11:54:09
|
Update of /cvsroot/bprocessor/model/src/net/sourceforge/bprocessor/model In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv15648/src/net/sourceforge/bprocessor/model Modified Files: Surface.java Added Files: Defaults.java Log Message: Materials are now handled correct when displayed in attribute view: Index: Surface.java =================================================================== RCS file: /cvsroot/bprocessor/model/src/net/sourceforge/bprocessor/model/Surface.java,v retrieving revision 1.89 retrieving revision 1.90 diff -C2 -d -r1.89 -r1.90 *** Surface.java 10 Apr 2006 07:14:35 -0000 1.89 --- Surface.java 10 Apr 2006 11:53:51 -0000 1.90 *************** *** 16,19 **** --- 16,21 ---- import java.util.Set; import java.util.HashSet; + + import org.apache.log4j.Logger; *************** *** 963,967 **** } else if (a.getName().equals("Exterior")) { continue; ! } else if (a.getName().equals("Holes")) { continue; } else if (a.getName().equals("Space")) { --- 965,973 ---- } else if (a.getName().equals("Exterior")) { continue; ! } else if (a.getName().equals("Front Material")) { ! setFrontMaterial((Material) a.getValue()); ! } else if (a.getName().equals("Back Material")) { ! setBackMaterial((Material) a.getValue()); ! } else if (a.getName().equals("Holes")) { continue; } else if (a.getName().equals("Space")) { *************** *** 987,992 **** // FIXME The material attribute should be ... a material! // The id does not work if this is not a toplevel surface. ! if (getOwner() == Project.getInstance().world()) { ! res.add(new Attribute("Front Material", getId())); } --- 993,1006 ---- // FIXME The material attribute should be ... a material! // The id does not work if this is not a toplevel surface. ! if (getFrontMaterial() != null) { ! res.add(new Attribute("Front Material", getFrontMaterial())); ! } else { ! if (getFrontDomain().isConstructionSpace()) { ! res.add(new Attribute("Front Material", new Material("", Defaults.getFrontColor()))); ! } else if (getFrontDomain().isFunctionalSpace()) { ! res.add(new Attribute("Front Material", new Material("", Defaults.getBackColor()))); ! } else { ! res.add(new Attribute("Front Material", new Material("", Defaults.getNoneColor()))); ! } } *************** *** 996,1003 **** res.add(new Attribute("Space", "None", false)); } // FIXME The material attribute should be ... a material! // The id does not work if this is not a toplevel surface. ! if (getOwner() == Project.getInstance().world()) { ! res.add(new Attribute("Back Material", getId())); } if (isInner()) { --- 1010,1026 ---- res.add(new Attribute("Space", "None", false)); } + // FIXME The material attribute should be ... a material! // The id does not work if this is not a toplevel surface. ! if (getBackMaterial() != null) { ! res.add(new Attribute("Back Material", getBackMaterial())); ! } else { ! if (getBackDomain().isConstructionSpace()) { ! res.add(new Attribute("Back Material", new Material("", Defaults.getFrontColor()))); ! } else if (getBackDomain().isFunctionalSpace()) { ! res.add(new Attribute("Back Material", new Material("", Defaults.getBackColor()))); ! } else { ! res.add(new Attribute("Back Material", new Material("", Defaults.getNoneColor()))); ! } } if (isInner()) { --- NEW FILE: Defaults.java --- //--------------------------------------------------------------------------------- // $Id: Defaults.java,v 1.1 2006/04/10 11:53:51 nbramsen Exp $ // // Copyright (c) 2005 The BProcessor Team (http://bprocessor.sourceforge.net) // Released under the Lesser GNU Public License v2.1 //--------------------------------------------------------------------------------- package net.sourceforge.bprocessor.model; /** * The Defaults */ public class Defaults { /** Front color for surfaces */ private static float[] frontColor = new float[] {0.90f, 0.90f, 0.90f}; /** NONE color for surfaces */ private static float[] noneColor = new float[] {0.40f, 0.58f, 0.93f}; /** Back color for surfaces */ private static float[] backColor = new float[] {0.96f, 0.87f, 0.70f}; /** * Return front color * @return The front color */ public static float[] getFrontColor() { return frontColor; } /** * Return back color * @return The back color */ public static float[] getBackColor() { return backColor; } /** * Return none color * @return The none color */ public static float[] getNoneColor() { return noneColor; } /** * Constructor for Defaults */ public Defaults() { super(); } } |
From: rimestad <rim...@us...> - 2006-04-10 07:55:16
|
Update of /cvsroot/bprocessor/gl/src/net/sourceforge/bprocessor/gl/tool In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv16950/src/net/sourceforge/bprocessor/gl/tool Modified Files: ExtrudeTool.java Log Message: Now the tool does extrude holes as well unless ALT is pressed at extrusion start. Have done some refactoring of methods so there now are startExtrusion and beginExtrusion methods and a removeExtrusion method. Made a cleanUp method Index: ExtrudeTool.java =================================================================== RCS file: /cvsroot/bprocessor/gl/src/net/sourceforge/bprocessor/gl/tool/ExtrudeTool.java,v retrieving revision 1.15 retrieving revision 1.16 diff -C2 -d -r1.15 -r1.16 *** ExtrudeTool.java 5 Apr 2006 09:36:16 -0000 1.15 --- ExtrudeTool.java 10 Apr 2006 07:55:09 -0000 1.16 *************** *** 70,73 **** --- 70,79 ---- private int direction = 0; + /** Tells if holes are supposed to be extruded */ + private boolean extrudeAll = true; + + /** The sides of the extruded holes */ + private Set holeSides; + /** * Constructor *************** *** 85,97 **** */ protected void pressed(MouseEvent e) { ! t = 0.0; ! upperLimit = 0.0; ! lowerLimit = 0.0; ! extrudeSurface = null; ! top = null; ! sides = null; prevX = e.getX(); prevY = e.getY(); - number = new String(); findTarget(e); --- 91,97 ---- */ protected void pressed(MouseEvent e) { ! cleanUp(); prevX = e.getX(); prevY = e.getY(); findTarget(e); *************** *** 141,155 **** /** ! * */ private void removeExtrusion() { if (top != null) { top.delete(); top = null; ! Iterator iter = sides.iterator(); while (iter.hasNext()) { Surface current = (Surface) iter.next(); current.delete(); } sides = null; } --- 141,172 ---- /** ! * Remove the current extrusion */ private void removeExtrusion() { if (top != null) { + Collection c = top.getHoles(); + Set holes = new HashSet(); + holes.addAll(c); + Iterator iter = holes.iterator(); + while (iter.hasNext()) { + Surface hole = (Surface)iter.next(); + hole.delete(); + } top.delete(); top = null; ! iter = sides.iterator(); while (iter.hasNext()) { Surface current = (Surface) iter.next(); current.delete(); } + + if (holeSides != null) { + iter = holeSides.iterator(); + while (iter.hasNext()) { + Surface current = (Surface) iter.next(); + current.delete(); + } + holeSides = null; + } sides = null; } *************** *** 162,173 **** private void apply(double length) { removeExtrusion(); ! if (extrudeSurface != null) { sides = new HashSet(); if (direction > 0) { length = -length; } top = extrudeSurface.extrude(length, sides); ! holeAnalysis(top); ! Project.getInstance().checkpoint(); } } --- 179,251 ---- private void apply(double length) { removeExtrusion(); ! if (extrudeSurface != null && length > 0) { sides = new HashSet(); + holeSides = null; if (direction > 0) { length = -length; } top = extrudeSurface.extrude(length, sides); ! if (extrudeAll) { ! extrudeHoles(extrudeSurface, length); ! } ! finishExtrusion(); ! } ! } ! ! /** ! * Begin the extrusion ! * @param s The surface to extrude ! * @param d The length of the extrusion ! */ ! private void startExtrusion(Surface s, double d) { ! top = s.extrude(d, sides); ! if (extrudeAll) { ! holeSides = new HashSet(); ! extrudeHoles(s, d); ! } ! } ! ! /** ! * Complete the Extrusion ! */ ! private void finishExtrusion() { ! holeAnalysis(top); ! Iterator iter = sides.iterator(); ! while (iter.hasNext()) { ! Surface current = (Surface) iter.next(); ! holeAnalysis(current); ! } ! Project.getInstance().checkpoint(); ! } ! ! /** Do tool cleanup */ ! public void cleanUp() { ! t = 0.0; ! upperLimit = 0.0; ! lowerLimit = 0.0; ! extrudeSurface = null; ! top = null; ! sides = null; ! holeSides = null; ! number = new String(); ! } ! ! /** ! * Extrude the holes of the given surface ! * @param s The surface whose holes are supposed to be extruded ! * @param length The length of extrusion ! */ ! private void extrudeHoles(Surface s, double length) { ! Collection holes = s.getHoles(); ! Iterator it = holes.iterator(); ! while (it.hasNext()) { ! Surface hole = (Surface)(it.next()); ! Set temp = new HashSet(); ! Surface holeTop = hole.extrude(length, temp); ! /* Add all surfaces that the hole generates to the holeSides set */ ! holeSides.addAll(temp); ! holeSides.add(holeTop); ! holeAnalysis(holeTop); ! extrudeHoles(hole, length); } } *************** *** 254,258 **** double y = e.getY() - prevY; if (x * x + y * y > 16) { ! top = extrudeSurface.extrude(normDotDelta, sides); t = -normDotDelta; if (t > 0) { --- 332,336 ---- double y = e.getY() - prevY; if (x * x + y * y > 16) { ! startExtrusion(extrudeSurface, normDotDelta); t = -normDotDelta; if (t > 0) { *************** *** 271,274 **** --- 349,355 ---- elements.addAll(sides); elements.add(top); + if (extrudeAll) { + elements.addAll(holeSides); + } Iterator iter = elements.iterator(); while (iter.hasNext()) { *************** *** 312,316 **** } } ! /** * Invoked when a mouse button has been released on a component. --- 393,397 ---- } } ! /** * Invoked when a mouse button has been released on a component. *************** *** 321,334 **** removeExtrusion(); } else { ! holeAnalysis(top); ! Iterator iter = sides.iterator(); ! while (iter.hasNext()) { ! Surface current = (Surface) iter.next(); ! holeAnalysis(current); ! } ! Project.getInstance().checkpoint(); } } ! /** * Invoked when a key has been pressed. --- 402,409 ---- removeExtrusion(); } else { ! finishExtrusion(); } } ! /** * Invoked when a key has been pressed. *************** *** 374,377 **** --- 449,456 ---- } } + if ((e.getModifiersEx() & KeyEvent.ALT_DOWN_MASK) == KeyEvent.ALT_DOWN_MASK) { + // Alt were pressed so holes are not supposed to be extruded + extrudeAll = false; + } if (number.equals("") || number.equals("-")) { *************** *** 386,389 **** } super.keyPressed(e); ! } } --- 465,479 ---- } super.keyPressed(e); ! } ! ! /** ! * Called when a key is released ! * @param e The KeyEvent object ! */ ! public void keyReleased(KeyEvent e) { ! if ((e.getModifiersEx() & KeyEvent.ALT_DOWN_MASK) == 0) { ! /* Alt were not pressed so we should extrude holes anyway */ ! extrudeAll = true; ! } ! } } |
From: rimestad <rim...@us...> - 2006-04-10 07:14:38
|
Update of /cvsroot/bprocessor/model/src/net/sourceforge/bprocessor/model In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv11723/src/net/sourceforge/bprocessor/model Modified Files: Surface.java Log Message: Changed the addHole method to flip the hole so that the normal of the hole is the same as the normal of the surface it is inserted into Index: Surface.java =================================================================== RCS file: /cvsroot/bprocessor/model/src/net/sourceforge/bprocessor/model/Surface.java,v retrieving revision 1.88 retrieving revision 1.89 diff -C2 -d -r1.88 -r1.89 *** Surface.java 5 Apr 2006 14:10:15 -0000 1.88 --- Surface.java 10 Apr 2006 07:14:35 -0000 1.89 *************** *** 533,550 **** Space front = getFrontDomain(); Space back = getBackDomain(); ! if (dot > 0) { ! if (hole.getFrontDomain() == null) { ! hole.setFrontDomain(front); ! } ! if (hole.getBackDomain() == null) { ! hole.setBackDomain(back); ! } ! } else { ! if (hole.getFrontDomain() == null) { ! hole.setFrontDomain(back); ! } ! if (hole.getBackDomain() == null) { ! hole.setBackDomain(front); ! } } changed(); --- 533,545 ---- Space front = getFrontDomain(); Space back = getBackDomain(); ! if (dot < 0) { ! /* If the normal of the hole is not the same the hole is reversed */ ! hole.flip(); ! } ! if (hole.getFrontDomain() == null) { ! hole.setFrontDomain(front); ! } ! if (hole.getBackDomain() == null) { ! hole.setBackDomain(back); } changed(); |
From: rimestad <rim...@us...> - 2006-04-10 07:12:43
|
Update of /cvsroot/bprocessor/gl/src/net/sourceforge/bprocessor/gl In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv9978/src/net/sourceforge/bprocessor/gl Modified Files: GLView.java Log Message: Added methods to input two doubles to the length field Index: GLView.java =================================================================== RCS file: /cvsroot/bprocessor/gl/src/net/sourceforge/bprocessor/gl/GLView.java,v retrieving revision 1.36 retrieving revision 1.37 diff -C2 -d -r1.36 -r1.37 *** GLView.java 23 Mar 2006 10:43:44 -0000 1.36 --- GLView.java 10 Apr 2006 07:12:40 -0000 1.37 *************** *** 190,193 **** --- 190,202 ---- lengthField.setText(length); } + + /** + * Set the lengthField display to two parameters + * @param x The first parameter + * @param y The second parameter + */ + public void setLength(double x, double y) { + lengthField.setText(x, y); + } /** *************** *** 257,260 **** --- 266,280 ---- super.setText(Integer.toString(mm)); } + + /** + * Set the text in the field to two commaseparated value x and y + * @param x the first value + * @param y the second value + */ + public void setText(double x, double y) { + int xmm = (int) (x * 1000.0); + int ymm = (int) (y * 1000.0); + super.setText(Integer.toString(xmm) + ", " + Integer.toString(ymm)); + } /** |
From: rimestad <rim...@us...> - 2006-04-10 07:11:25
|
Update of /cvsroot/bprocessor/gl/src/net/sourceforge/bprocessor/gl/tool In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv8812/src/net/sourceforge/bprocessor/gl/tool Modified Files: RectTool.java Log Message: Show the widht / height in the length field when drawing a rect, it is not possible to input a desired box size in the length field yet Index: RectTool.java =================================================================== RCS file: /cvsroot/bprocessor/gl/src/net/sourceforge/bprocessor/gl/tool/RectTool.java,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** RectTool.java 29 Mar 2006 08:23:11 -0000 1.5 --- RectTool.java 10 Apr 2006 07:11:19 -0000 1.6 *************** *** 21,24 **** --- 21,26 ---- */ public class RectTool extends AbstractPencil { + /** The edges in the rectangle */ + private Edge e1, e2, e3, e4; /** *************** *** 64,71 **** } if (v1 != null) { ! Edge e1 = new Edge(v1, v2); ! Edge e2 = new Edge(v2, v3); ! Edge e3 = new Edge(v3, v4); ! Edge e4 = new Edge(v4, v1); edges.add(e1); edges.add(e2); --- 66,73 ---- } if (v1 != null) { ! e1 = new Edge(v1, v2); ! e2 = new Edge(v2, v3); ! e3 = new Edge(v3, v4); ! e4 = new Edge(v4, v1); edges.add(e1); edges.add(e2); *************** *** 93,96 **** --- 95,110 ---- makeTarget(current); } + + /** + * Update the length field + */ + protected void updateLength() { + if (e1 != null && e2 != null) { + glv.setLength(e1.getLength(), e2.getLength()); + } else { + glv.setLength(0.0, 0.0); + } + } + /** * @param e MouseEvent *************** *** 110,113 **** --- 124,128 ---- if (start == null) { start = current; + cleanUp(); } else { insertEdges(createRect(start.vertex(), current.vertex())); *************** *** 132,134 **** --- 147,158 ---- } + /** + * Clean up + */ + public void cleanUp() { + e1 = null; + e2 = null; + e3 = null; + e4 = null; + } } |
From: Michael L. <he...@us...> - 2006-04-05 14:14:10
|
Update of /cvsroot/bprocessor/build/doc In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv23167/doc Modified Files: Changelog Log Message: Release M5 versionnumber Index: Changelog =================================================================== RCS file: /cvsroot/bprocessor/build/doc/Changelog,v retrieving revision 1.8 retrieving revision 1.9 diff -C2 -d -r1.8 -r1.9 *** Changelog 28 Feb 2006 20:53:46 -0000 1.8 --- Changelog 5 Apr 2006 14:13:59 -0000 1.9 *************** *** 2,5 **** --- 2,13 ---- ========== + + 2006/3/5: Release M5 + + - Substantial reengeneering of most geometric tools. + - Undo/Redo + - Element-modelling of space, elements and parts etc. + + 2006/2/28: Release M4 |
From: Michael L. <he...@us...> - 2006-04-05 14:14:10
|
Update of /cvsroot/bprocessor/build In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv23167 Modified Files: build.xml Log Message: Release M5 versionnumber Index: build.xml =================================================================== RCS file: /cvsroot/bprocessor/build/build.xml,v retrieving revision 1.15 retrieving revision 1.16 diff -C2 -d -r1.15 -r1.16 *** build.xml 5 Apr 2006 09:36:35 -0000 1.15 --- build.xml 5 Apr 2006 14:13:59 -0000 1.16 *************** *** 3,7 **** <target name="init"> <property name="project" value="bprocessor"/> ! <property name="version" value="M4-development"/> <property name="script.dir" value="${basedir}/bin"/> --- 3,7 ---- <target name="init"> <property name="project" value="bprocessor"/> ! <property name="version" value="M5"/> <property name="script.dir" value="${basedir}/bin"/> |
From: Michael L. <he...@us...> - 2006-04-05 14:10:26
|
Update of /cvsroot/bprocessor/model/src/net/sourceforge/bprocessor/model In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv20209/src/net/sourceforge/bprocessor/model Modified Files: Vertex.java Surface.java Log Message: Better hole-analysis Index: Surface.java =================================================================== RCS file: /cvsroot/bprocessor/model/src/net/sourceforge/bprocessor/model/Surface.java,v retrieving revision 1.87 retrieving revision 1.88 diff -C2 -d -r1.87 -r1.88 *** Surface.java 5 Apr 2006 10:23:22 -0000 1.87 --- Surface.java 5 Apr 2006 14:10:15 -0000 1.88 *************** *** 621,626 **** while (iter.hasNext()) { Vertex current = (Vertex) iter.next(); ! if (!surrounds(current)) { ! return false; } } --- 621,628 ---- while (iter.hasNext()) { Vertex current = (Vertex) iter.next(); ! if (!onBoundary(current)) { ! if (!surrounds(current)) { ! return false; ! } } } *************** *** 822,825 **** --- 824,855 ---- /** + * Test if vertex is on boundary of this Surfce + * @param v The vertex + * @return True if on boundary + */ + public boolean onBoundary(Vertex v) { + { + List vertices = this.getVertices(); + Iterator iter = vertices.iterator(); + while (iter.hasNext()) { + Vertex vertex = (Vertex) iter.next(); + if (vertex.coincides(v)) { + return true; + } + } + } + { + Iterator iter = edges.iterator(); + while (iter.hasNext()) { + Edge edge = (Edge) iter.next(); + if (edge.coincides(v)) { + return true; + } + } + } + return false; + } + + /** * Tells whether or not a Vertex is contained inside the surface. * @param v the vertex Index: Vertex.java =================================================================== RCS file: /cvsroot/bprocessor/model/src/net/sourceforge/bprocessor/model/Vertex.java,v retrieving revision 1.32 retrieving revision 1.33 diff -C2 -d -r1.32 -r1.33 *** Vertex.java 5 Apr 2006 10:23:22 -0000 1.32 --- Vertex.java 5 Apr 2006 14:10:15 -0000 1.33 *************** *** 364,366 **** --- 364,387 ---- return "Vertex"; } + + /** + * Test of the other vertex concides with this vertex + * @param v The vertex + * @return True if coincides + */ + public boolean coincides(Vertex v) { + double dx = v.x - x; + double dy = v.y - y; + double dz = v.z - z; + if (Math.abs(dx) > 0.0000001) { + return false; + } + if (Math.abs(dy) > 0.0000001) { + return false; + } + if (Math.abs(dz) > 0.0000001) { + return false; + } + return true; + } } |
From: Michael L. <he...@us...> - 2006-04-05 10:49:14
|
Update of /cvsroot/bprocessor/gl/src/net/sourceforge/bprocessor/gl/tool In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv30905/src/net/sourceforge/bprocessor/gl/tool Modified Files: AbstractPencil.java Log Message: Improved handling of holes Index: AbstractPencil.java =================================================================== RCS file: /cvsroot/bprocessor/gl/src/net/sourceforge/bprocessor/gl/tool/AbstractPencil.java,v retrieving revision 1.21 retrieving revision 1.22 diff -C2 -d -r1.21 -r1.22 *** AbstractPencil.java 5 Apr 2006 09:36:16 -0000 1.21 --- AbstractPencil.java 5 Apr 2006 10:49:09 -0000 1.22 *************** *** 108,114 **** * Insert a vertex into model * @param vertex Vertex * @return Vertex from model */ ! public Vertex insertVertex(Vertex vertex) { Space space = mesh(); --- 108,115 ---- * Insert a vertex into model * @param vertex Vertex + * @param split Split * @return Vertex from model */ ! public Vertex insertVertex(Vertex vertex, boolean split) { Space space = mesh(); *************** *** 131,141 **** if (actual.getOwner() == null) { mesh().add(actual); ! Set es = mesh().findEdge(actual); ! if (es.size() > 0) { ! Iterator iter = es.iterator(); ! while (iter.hasNext()) { ! Edge e = (Edge) iter.next(); ! if (!e.getConstructor()) { ! e.split(actual); } } --- 132,144 ---- if (actual.getOwner() == null) { mesh().add(actual); ! if (split) { ! Set es = mesh().findEdge(actual); ! if (es.size() > 0) { ! Iterator iter = es.iterator(); ! while (iter.hasNext()) { ! Edge e = (Edge) iter.next(); ! if (!e.getConstructor()) { ! e.split(actual); ! } } } *************** *** 149,158 **** * Insert an edge into model * @param edge Edge * @return Edge from model */ ! public Edge insertEdge(Edge edge) { Edge actual = edge; ! edge.setFrom(insertVertex(edge.getFrom())); ! edge.setTo(insertVertex(edge.getTo())); { Collection edges = mesh().getEdges(); --- 152,162 ---- * Insert an edge into model * @param edge Edge + * @param split Split * @return Edge from model */ ! public Edge insertEdge(Edge edge, boolean split) { Edge actual = edge; ! edge.setFrom(insertVertex(edge.getFrom(), split)); ! edge.setTo(insertVertex(edge.getTo(), split)); { Collection edges = mesh().getEdges(); *************** *** 181,199 **** */ public void insertEdges(List edges) { - Iterator iter = edges.iterator(); - List actual = new LinkedList(); - while (iter.hasNext()) { - Edge current = (Edge) iter.next(); - actual.add(insertEdge(current)); - } ! if (!actual.isEmpty()) { ! Vertex from = ((Edge) actual.get(0)).getFrom(); ! Vertex to = ((Edge) actual.get(edges.size() - 1)).getTo(); if (from == to) { Surface surface = new Surface(actual); mesh().insert(surface); holeAnalysis(surface); } else { Geometry.insert(actual); } --- 185,214 ---- */ public void insertEdges(List edges) { ! ! ! if (!edges.isEmpty()) { ! Vertex from = ((Edge) edges.get(0)).getFrom(); ! Vertex to = ((Edge) edges.get(edges.size() - 1)).getTo(); ! ! ! if (from == to) { + List actual = new LinkedList(); + Iterator iter = edges.iterator(); + while (iter.hasNext()) { + Edge current = (Edge) iter.next(); + actual.add(insertEdge(current, false)); + } Surface surface = new Surface(actual); mesh().insert(surface); holeAnalysis(surface); } else { + List actual = new LinkedList(); + Iterator iter = edges.iterator(); + while (iter.hasNext()) { + Edge current = (Edge) iter.next(); + actual.add(insertEdge(current, true)); + } Geometry.insert(actual); } |
From: Nordholt <nor...@us...> - 2006-04-05 10:26:47
|
Update of /cvsroot/bprocessor/gl/src/net/sourceforge/bprocessor/gl/tool In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv14463 Modified Files: AbstractTool.java Log Message: added a collect method using the new collect methods of geometric objects Index: AbstractTool.java =================================================================== RCS file: /cvsroot/bprocessor/gl/src/net/sourceforge/bprocessor/gl/tool/AbstractTool.java,v retrieving revision 1.67 retrieving revision 1.68 diff -C2 -d -r1.67 -r1.68 *** AbstractTool.java 5 Apr 2006 09:36:16 -0000 1.67 --- AbstractTool.java 5 Apr 2006 10:26:40 -0000 1.68 *************** *** 11,14 **** --- 11,15 ---- import net.sourceforge.bprocessor.model.Entity; import net.sourceforge.bprocessor.model.Geometry; + import net.sourceforge.bprocessor.model.Geometric; import net.sourceforge.bprocessor.model.Plane; import net.sourceforge.bprocessor.model.Project; *************** *** 20,23 **** --- 21,25 ---- import net.sourceforge.bprocessor.gl.GLView; + import java.awt.Cursor; import java.awt.Image; *************** *** 609,612 **** --- 611,631 ---- return; } + + /** + * Collect all vertices from a collection of geometrics + * @param geometrics Collection of objects + * @return Set of vertices + */ + protected Set collect(Collection geometrics) { + Iterator it = geometrics.iterator(); + Set result = new HashSet(); + while (it.hasNext()) { + Object o = it.next(); + if (o instanceof Geometric) { + result.addAll(((Geometric)o).collect()); + } + } + return result; + } /** |
From: Nordholt <nor...@us...> - 2006-04-05 10:25:13
|
Update of /cvsroot/bprocessor/gl/src/net/sourceforge/bprocessor/gl/tool In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv13148 Modified Files: VectorMoveStrategy.java ControlledMoveStrategy.java MoveTool.java Log Message: large changes due to cvs outage Index: MoveTool.java =================================================================== RCS file: /cvsroot/bprocessor/gl/src/net/sourceforge/bprocessor/gl/tool/MoveTool.java,v retrieving revision 1.51 retrieving revision 1.52 diff -C2 -d -r1.51 -r1.52 *** MoveTool.java 30 Mar 2006 08:03:40 -0000 1.51 --- MoveTool.java 5 Apr 2006 10:24:56 -0000 1.52 *************** *** 13,24 **** import net.sourceforge.bprocessor.model.Edge; import net.sourceforge.bprocessor.model.Entity; - import net.sourceforge.bprocessor.model.Plane; import net.sourceforge.bprocessor.model.Project; import net.sourceforge.bprocessor.model.Vertex; import net.sourceforge.bprocessor.model.Surface; - import net.sourceforge.bprocessor.gl.view.Transformation; - import net.sourceforge.bprocessor.gl.view.View; - import java.awt.Cursor; import java.awt.event.MouseEvent; --- 13,20 ---- *************** *** 30,37 **** import java.util.HashSet; import java.util.LinkedList; - //import java.util.Timer; - import java.util.TimerTask; - - import org.apache.log4j.Logger; --- 26,29 ---- *************** *** 44,50 **** private static Logger log = Logger.getLogger(MoveTool.class); - /** The initial movepoint */ - protected Vertex initial; - /** The location to move from */ protected Vertex from; --- 36,39 ---- *************** *** 56,62 **** protected Vertex lastMoveDirection; - /** Number typed when using the length field */ - protected String number; - /** The Collection of entities being moved*/ protected Collection moveEntities; --- 45,48 ---- *************** *** 65,81 **** private MoveTool strategy; ! /** The move vector */ ! protected Edge moveVector; ! ! /** The aligning edge */ ! protected Edge alignEdge; ! ! /** Number of clicks when in 3 click mode */ ! protected int numberOfClicks; - /** The plane that the movevector ends - in if nothing else is hit */ - protected Plane currentPlane; - /** * The Constructor --- 51,57 ---- private MoveTool strategy; ! /** Move constructor */ ! protected Edge moveConstructor; /** * The Constructor *************** *** 87,94 **** strategy = null; lastMoveDirection = null; - alignEdge = null; - numberOfClicks = 1; - currentPlane = null; start = null; } --- 63,68 ---- strategy = null; lastMoveDirection = null; start = null; + moveConstructor = null; } *************** *** 132,214 **** excluded(getAffected(moveEntities)); if (!moveEntities.isEmpty()) { ! start = current; } } else { start = null; moveEntities = null; excluded(new HashSet()); } } - /* - findTarget(e); - if (numberOfClicks == 1) { - moveEntities = new HashSet(); - if (target != null) { - Vertex moveStart = findInitial(target, e); - moveVector = new Edge(moveStart, moveStart); - moveVector.setConstructor(true); - glv.getView().addTempEdgeOnTop(moveVector); - initial = moveStart.copy(); - from = moveStart.copy(); - numberOfClicks = 2; - number = ""; - } - if (selection.isEmpty() && target != null) { - moveEntities.add(target); - } else if (!selection.isEmpty()) { - moveEntities.addAll(selection); - } - } else if (numberOfClicks == 2) { - glv.getView().removeEntityOnTop(moveVector); - moveVector = null; - if (alignEdge != null) { - glv.getView().removeTempEdge(alignEdge); - alignEdge = null; - } - update(); - numberOfClicks = 1; - } - }*/ - } - - /** - * Finds the point clicked. - * @param entity the entity clicked - * @param e the mouse event associated with the click. - * @return the point. - */ - protected Vertex findInitial(Object entity, MouseEvent e) { - double x = e.getX(); - double y = View.getHeight() - e.getY(); - View v = glv.getView(); - Transformation transformation = v.transformation(); - Vertex near = new Vertex(x, y, 0.0); - Vertex far = new Vertex(x, y, 1.0); - Edge ray = new Edge(near, far); - ray = transformation.unProject(ray); - if (entity instanceof Vertex) { - return ((Vertex)entity).copy(); - } else if (entity instanceof Surface) { - Plane plane = ((Surface)entity).plane(); - return plane.intersection(ray); - } else if (entity instanceof Edge) { - Edge edge = (Edge) entity; - Edge intersection = edge.intersection(ray); - if (intersection != null) { - return intersection.getFrom(); - } else { - return null; - } - } else if (entity instanceof ClippingPlane) { - Plane plane = ((ClippingPlane) entity).getPlane(); - return plane.intersection(ray); - } else if (entity instanceof Plane) { - Plane plane = (Plane)entity; - return plane.intersection(ray); - } else if (entity instanceof Intersection) { - return ((Intersection)entity).vertex(); - } - log.warn("The object is not an Entity"); - return null; } --- 106,127 ---- excluded(getAffected(moveEntities)); if (!moveEntities.isEmpty()) { ! vertices = collect(moveEntities); ! start = new Intersection(current.vertex().copy(), ! current.type(), ! current.object()); ! from = start.vertex().copy(); ! vertices.add(from); ! incident = null; ! } else { ! moveEntities = null; } } else { start = null; moveEntities = null; + incident = null; + vertices = null; excluded(new HashSet()); } } } *************** *** 238,304 **** current = findIntersection(e); if (current != null && ! oldCurrent != null && moveEntities != null) { ! move(moveEntities, current.vertex().minus(oldCurrent.vertex())); } updateConstructors(); } - /* - if (numberOfClicks == 2) { - boolean showAlign = false; - Set moveConstructors = makeXYZConerConstructors(new Vertex(0, 0, 0)); - displayConstructors(moveConstructors); - glv.getView().removeEntityOnTop(moveVector); - if (alignEdge != null) { - glv.getView().addTempEdge(alignEdge); - } - findTarget(e, (Set)moveEntities); - glv.getView().makeTarget(target); - if (target != null) { - if (target instanceof Edge) { - Edge targetEdge = (Edge)target; - if (!targetEdge.equals(alignEdge)) { - Timer alignTimer = new Timer(); - TimerTask alignTask = new AlignTask(targetEdge); - alignTimer.schedule(alignTask, 300); - } - if (alignEdge != null) { - Vertex alignDir = alignEdge.getDirection(); - Vertex targetDir = targetEdge.getDirection(); - Vertex dirCross = alignDir.cross(targetDir); - showAlign = dirCross.length() < 0.000001; - } - } - } - Intersection endPoint = - (Intersection)glv.getView().getObjectAtPoint(e.getX(), e.getY(), - (Set)moveEntities, true, - currentPlane); - Vertex to = endPoint.vertex(); - if (to != null) { - moveVector.setTo(to); - lastMoveDirection = to.minus(initial).copy(); - glv.setLength(lastMoveDirection.length()); - //Do we really want this to move also? - Vertex movement = to.minus(from); - if (vertices != null) { - move(vertices, movement); - } - from = to; - } - - if (moveVector != null) { - glv.getView().addTempEdgeOnTop(moveVector); - } - if (!showAlign) { - glv.getView().removeTempEdge(alignEdge); - } - clearConstructors(moveConstructors); - } else { - findTarget(e); - glv.getView().makeTarget(target); - } - } - */ } --- 151,160 ---- current = findIntersection(e); if (current != null && ! from != null && moveEntities != null) { ! move(vertices, current.vertex().minus(from)); } updateConstructors(); } } *************** *** 311,338 **** if (strategy != null) { strategy.dragged(e); - } - } - - /** - * Corrects a movement vector to make the - * movement snap to the initial position of - * the moved object(s). - * @param delta the movement vector. - * @return the corrected movement vector. - */ - protected Vertex snapToInitial(Vertex delta) { - Vertex parentPos = from.add(delta); - Vertex v = initial.minus(parentPos); - Vertex appr = initial.minus(from); - if (Math.abs(v.getX()) < .25) { - delta.setX(appr.getX()); - } - if (Math.abs(v.getY()) < .25) { - delta.setY(appr.getY()); } - if (Math.abs(v.getZ()) < .25) { - delta.setZ(appr.getZ()); - } - return delta; } --- 167,171 ---- *************** *** 342,346 **** * @param delta The movement */ ! protected void move(Collection sel, Vertex delta) { Iterator it = sel.iterator(); while (it.hasNext()) { --- 175,179 ---- * @param delta The movement */ ! protected void move(Set sel, Vertex delta) { Iterator it = sel.iterator(); while (it.hasNext()) { *************** *** 366,369 **** --- 199,203 ---- */ public void keyPressed(KeyEvent e) { + /* if (strategy != null) { strategy.keyPressed(e); *************** *** 400,404 **** double length = glv.getLength(); Vertex delta = initial.minus(from); ! if (delta.length() > 0) { delta.scale((delta.length() - length) / delta.length()); } else { --- 234,238 ---- double length = glv.getLength(); Vertex delta = initial.minus(from); ! if (delta.length( 0) { delta.scale((delta.length() - length) / delta.length()); } else { *************** *** 431,434 **** --- 265,269 ---- glv.repaint(true); } + */ } *************** *** 448,455 **** if (start != null && current != null) { super.updateConstructors(); ! Edge edge = new Edge(start.vertex(), current.vertex()); ! edge.setConstructor(true); ! constructors.add(edge); ! excluded.add(edge); Set constcopy = new HashSet(); constcopy.addAll(constructors); --- 283,290 ---- if (start != null && current != null) { super.updateConstructors(); ! moveConstructor = new Edge(start.vertex(), current.vertex()); ! moveConstructor.setConstructor(true); ! constructors.add(moveConstructor); ! excluded.add(moveConstructor); Set constcopy = new HashSet(); constcopy.addAll(constructors); *************** *** 458,462 **** excopy.addAll(excluded); excluded(excopy); ! glv.setLength(edge.getLength()); } else { constructors(new LinkedList()); --- 293,297 ---- excopy.addAll(excluded); excluded(excopy); ! glv.setLength(moveConstructor.getLength()); } else { constructors(new LinkedList()); *************** *** 472,476 **** * @return the affected elements */ ! private Collection getAffected(Collection moveElements) { HashSet affected = new HashSet(); HashSet affectedEdges = new HashSet(); --- 307,311 ---- * @return the affected elements */ ! protected Set getAffected(Collection moveElements) { HashSet affected = new HashSet(); HashSet affectedEdges = new HashSet(); *************** *** 479,484 **** Iterator it = affected.iterator(); while (it.hasNext()) { ! affectedEdges.addAll(((Vertex)it.next()).getEdges()); ! affectedSurfaces.addAll(((Vertex)it.next()).getSurfaces()); } affected.addAll(affectedEdges); --- 314,320 ---- Iterator it = affected.iterator(); while (it.hasNext()) { ! Vertex v = (Vertex)it.next(); ! affectedEdges.addAll(v.getEdges()); ! affectedSurfaces.addAll(v.getSurfaces()); } affected.addAll(affectedEdges); *************** *** 486,528 **** return affected; } - - - /** - * Class for handeling the task of assigning an alignedge. - */ - protected class AlignTask extends TimerTask { - /** The edge candidate to become the alignedge */ - private Edge candidateEdge; - - /** - * Constructor - * @param candidate the candidate to become alignedge - */ - public AlignTask(Edge candidate) { - super(); - candidateEdge = candidate; - } - - /** - * checks if the target is still the same edge, - * thus making it the alignedge - */ - public void run() { - - if (target instanceof Edge) { - candidateEdge.equals((Edge)target); - - Vertex direction = candidateEdge.getDirection(); - Vertex alignTo = direction.copy(); - Vertex alignFrom = direction.copy(); - alignFrom.scale(-1000); - alignTo.scale(1000); - glv.getView().removeTempEdge(alignEdge); - alignEdge = new Edge(alignFrom.add(initial), alignTo.add(initial)); - alignEdge.setConstructor(true); - glv.getView().addTempEdge(alignEdge); - glv.repaint(true); - } - } - } } --- 322,324 ---- Index: VectorMoveStrategy.java =================================================================== RCS file: /cvsroot/bprocessor/gl/src/net/sourceforge/bprocessor/gl/tool/VectorMoveStrategy.java,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** VectorMoveStrategy.java 29 Mar 2006 18:39:25 -0000 1.2 --- VectorMoveStrategy.java 5 Apr 2006 10:24:56 -0000 1.3 *************** *** 9,15 **** import net.sourceforge.bprocessor.gl.GLView; ! import net.sourceforge.bprocessor.model.Plane; ! import java.util.HashSet; import java.awt.event.MouseEvent; --- 9,15 ---- import net.sourceforge.bprocessor.gl.GLView; ! //import net.sourceforge.bprocessor.model.Plane; ! //import java.util.HashSet; import java.awt.event.MouseEvent; *************** *** 35,39 **** public VectorMoveStrategy(GLView glv, Cursor cursor) { super(glv, cursor); - currentPlane = new Plane(0, 0, 1, 0); } --- 35,38 ---- *************** *** 44,51 **** protected void pressed(MouseEvent e) { super.pressed(e); - if (numberOfClicks == 2) { - vertices = new HashSet(); - collect(moveEntities, vertices); - } } --- 43,46 ---- Index: ControlledMoveStrategy.java =================================================================== RCS file: /cvsroot/bprocessor/gl/src/net/sourceforge/bprocessor/gl/tool/ControlledMoveStrategy.java,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** ControlledMoveStrategy.java 29 Mar 2006 18:39:25 -0000 1.2 --- ControlledMoveStrategy.java 5 Apr 2006 10:24:56 -0000 1.3 *************** *** 12,21 **** import net.sourceforge.bprocessor.model.Surface; import net.sourceforge.bprocessor.model.Vertex; - import net.sourceforge.bprocessor.model.Entity; import net.sourceforge.bprocessor.model.Plane; ! import net.sourceforge.bprocessor.model.Project; ! import net.sourceforge.bprocessor.model.Camera; import java.util.HashSet; import java.util.HashMap; import java.util.List; --- 12,21 ---- import net.sourceforge.bprocessor.model.Surface; import net.sourceforge.bprocessor.model.Vertex; import net.sourceforge.bprocessor.model.Plane; ! import net.sourceforge.bprocessor.model.Geometric; import java.util.HashSet; + import java.util.Set; + import java.util.Map; import java.util.HashMap; import java.util.List; *************** *** 27,31 **** import java.awt.event.KeyEvent; - import org.apache.log4j.Logger; --- 27,30 ---- *************** *** 40,51 **** private HashMap slideMap; ! /** The entity to be moved controlled */ ! private Entity controlled; /** The plane to drag according to */ private Plane dragPlane; ! /** Vector to restrict movement in one direction */ ! private Vertex restrictionVector; /** --- 39,50 ---- private HashMap slideMap; ! /** The geometric to be moved controlled */ ! private Geometric controlled; /** The plane to drag according to */ private Plane dragPlane; ! /** Direction of the controlled movement */ ! private Vertex direction; /** *************** *** 56,61 **** public ControlledMoveStrategy(GLView glv, Cursor cursor) { super(glv, cursor); ! slideMap = new HashMap(); ! restrictionVector = null; } --- 55,60 ---- public ControlledMoveStrategy(GLView glv, Cursor cursor) { super(glv, cursor); ! slideMap = null; ! direction = null; } *************** *** 66,83 **** protected void pressed(MouseEvent e) { super.pressed(e); ! if (numberOfClicks == 2) { ! slideMap = new HashMap(); ! vertices = new HashSet(); ! ! if (!moveEntities.isEmpty()) { ! Iterator it = moveEntities.iterator(); ! controlled = (Entity)it.next(); ! } ! moveEntities.clear(); ! moveEntities.add(controlled); ! collect(moveEntities, vertices); ! } else if (numberOfClicks == 1) { slideMap = null; - controlled = null; } } --- 65,70 ---- protected void pressed(MouseEvent e) { super.pressed(e); ! if (start == null) { slideMap = null; } } *************** *** 88,96 **** */ protected void moved(MouseEvent e) { ! if (dragPlane == null) { ! findRestrictions(e); ! } ! if (dragPlane != null) { ! super.moved(e); } } --- 75,94 ---- */ protected void moved(MouseEvent e) { ! super.moved(e); ! if (slideMap == null && moveEntities != null) { ! if (createSlideMap(e)) { ! Iterator it = moveEntities.iterator(); ! boolean found = false; ! while (it.hasNext() && !found) { ! direction = direction((Geometric)it.next()); ! found = direction != null; ! } ! if (!found) { ! slideMap = null; ! } else { ! slideMap.put(from, direction); ! super.moved(e); ! } ! } } } *************** *** 105,235 **** /** ! * Set up the restriction to make the movement controlled ! * @param e a mouse event. */ ! private void findRestrictions(MouseEvent e) { ! if (controlled != null) { ! if (slideMap.isEmpty()) { ! findTarget(e); ! if (controlled instanceof Edge) { ! Edge controlledEdge = (Edge)controlled; ! if (target instanceof Surface) { ! Surface targetSurface = (Surface)target; ! if (controlledEdge.getSurfaces().contains(targetSurface)) { ! glv.getView().makeTarget(target); ! dragPlane = targetSurface.plane(); ! currentPlane = dragPlane; ! Vertex controlledDir = controlledEdge.getDirection(); ! Vertex surfaceNormal = targetSurface.normal(); ! restrictionVector = controlledDir.cross(surfaceNormal); ! restrictionVector.scale(1 / restrictionVector.length()); ! ! List edges = targetSurface.getEdges(); ! int index = edges.indexOf(controlledEdge); ! Edge leftEdge; ! Edge rightEdge; ! if (index == 0) { ! leftEdge = (Edge)edges.get(edges.size() - 1); ! rightEdge = (Edge)edges.get(index + 1); ! } else if (index == (edges.size() - 1)) { ! leftEdge = (Edge)edges.get(index - 1); ! rightEdge = (Edge)edges.get(0); ! } else { ! leftEdge = (Edge)edges.get(index - 1); ! rightEdge = (Edge)edges.get(index + 1); ! } ! Edge toSlideEdge = null; ! Edge fromSlideEdge = null; ! if (controlledDir.cross(leftEdge.getDirection()).length() > 0.00001 && ! controlledDir.cross(rightEdge.getDirection()).length() > 0.00001) { ! Vertex to = controlledEdge.getTo(); ! Vertex from = controlledEdge.getFrom(); ! if (to.getEdges().contains(leftEdge) && ! from.getEdges().contains(rightEdge)) { ! toSlideEdge = leftEdge; ! fromSlideEdge = rightEdge; ! } else if (from.getEdges().contains(leftEdge) && ! to.getEdges().contains(rightEdge)) { ! fromSlideEdge = leftEdge; ! toSlideEdge = rightEdge; ! } ! slideMap = new HashMap(); ! slideMap.put(controlledEdge.getTo(), toSlideEdge.getDirection()); ! slideMap.put(controlledEdge.getFrom(), fromSlideEdge.getDirection()); ! } else { ! dragPlane = null; ! restrictionVector = null; ! log.warn("This edge is bound"); ! } ! } ! } ! } else if (controlled instanceof Vertex) { ! Vertex controlledVertex = (Vertex)controlled; ! if (target instanceof Edge && ! controlledVertex.getEdges().contains((Edge)target)) { ! Edge targetEdge = (Edge)target; ! slideMap = new HashMap(); ! slideMap.put(controlledVertex, targetEdge.getDirection()); ! restrictionVector = targetEdge.getDirection(); ! findRestrictionPlane(); ! } ! } else if (controlled instanceof Surface) { ! Surface controlledSurface = (Surface)controlled; ! restrictionVector = controlledSurface.normal(); ! findRestrictionPlane(); ! slideMap = new HashMap(); ! Collection vertices = controlledSurface.getVertices(); ! Iterator it = vertices.iterator(); ! boolean bound = false; ! while (it.hasNext() && !bound) { ! Vertex vertex = (Vertex)it.next(); ! slideMap.put(vertex, restrictionVector); ! Collection edges = vertex.getEdges(); ! Iterator edgeIt = edges.iterator(); ! int otherEdges = 0; ! while (edgeIt.hasNext() && !bound) { ! Edge edge = (Edge)edgeIt.next(); ! if (!controlledSurface.getEdges().contains(edge)) { ! otherEdges++; ! slideMap.put(vertex, edge.getDirection()); ! } ! bound = otherEdges > 1; ! } ! } ! if (bound) { ! slideMap = new HashMap(); ! restrictionVector = null; ! dragPlane = null; ! log.warn("this surface is bound!"); ! } } } } } /** ! * Sets an appropriate dragPlane that aligned with the ! * restrictionvector and containing a specified point to ! * make reasonable movements. */ ! protected void findRestrictionPlane() { ! Camera camera = Project.getInstance().getCurrentCamera(); ! double[] centerPoint = camera.getCenter(); ! double[] cameraPoint = camera.getCamera(); ! ! Vertex eyeVector = new Vertex(cameraPoint[0] - centerPoint[0], ! cameraPoint[1] - centerPoint[1], ! cameraPoint[2] - centerPoint[2]); ! Vertex cross = restrictionVector.cross(eyeVector); ! Vertex planeNormal; ! if (cross.isZero()) { ! double[] rollVector = camera.getRoll(); ! planeNormal = new Vertex(rollVector[0], rollVector[1], rollVector[2]); ! } else { ! planeNormal = (restrictionVector.cross(eyeVector)).cross(restrictionVector); } ! dragPlane = new Plane(planeNormal.getX(), planeNormal.getY(), planeNormal.getZ(), ! -planeNormal.dot(initial)); ! currentPlane = dragPlane; } --- 103,267 ---- /** ! * Finds the direction of the controlled movement. ! * @param geo a geometric object. ! * @return the direction. */ ! private Vertex direction(Geometric geo) { ! if (geo instanceof Surface) { ! Surface surface = (Surface)geo; ! return surface.normal(); ! } else if (geo instanceof Edge) { ! Edge edge = (Edge)geo; ! if (current.object() instanceof Surface) { ! Surface surface = (Surface)current.object(); ! if (edge.getSurfaces().contains(surface)) { ! Vertex edgeDir = edge.getDirection(); ! Vertex normal = surface.normal(); ! Vertex dir = edgeDir.cross(normal); ! dir.scale(1 / dir.length()); ! return dir; } } + } else if (geo instanceof Vertex) { + return (Vertex)slideMap.get(geo); } + return null; } + /** ! * Trys to create the slideMap, returns true if it is succesfull, ! * false otherwise. ! * @param e the mouse event ! * @return werther the creation of the map is succesfull. */ ! private boolean createSlideMap(MouseEvent e) { ! Set ex = new HashSet(moveEntities); ! ex.add(moveConstructor); ! excluded(ex); ! current = findIntersection(e); ! ex = getAffected(moveEntities); ! ex.add(moveConstructor); ! excluded(ex); ! ! slideMap = new HashMap(); ! if (moveEntities != null) { ! Iterator it = moveEntities.iterator(); ! while (it.hasNext()) { ! Geometric geo = (Geometric)it.next(); ! Map map = null; ! if (geo instanceof Edge) { ! map = createSlideMap((Edge)geo); ! } else if (geo instanceof Surface) { ! map = createSlideMap((Surface)geo); ! } else if (geo instanceof Vertex) { ! map = createSlideMap((Vertex)geo); ! } ! if (map != null) { ! slideMap.putAll(map); ! } else { ! slideMap = null; ! return false; ! } ! } ! return true; } ! slideMap = null; ! return false; ! } ! ! /** ! * Finds the slidemap for an edge. ! * @param edge the edge ! * @return a map for edge, null if none can be found ! */ ! private Map createSlideMap(Edge edge) { ! if (current.object() instanceof Surface) { ! Surface surface = (Surface)current.object(); ! if (edge.getSurfaces().contains(surface)) { ! dragPlane = surface.plane(); ! ! List edges = surface.getEdges(); ! int index = edges.indexOf(edge); ! Edge leftEdge; ! Edge rightEdge; ! if (index == 0) { ! leftEdge = (Edge)edges.get(edges.size() - 1); ! rightEdge = (Edge)edges.get(index + 1); ! } else if (index == (edges.size() - 1)) { ! leftEdge = (Edge)edges.get(index - 1); ! rightEdge = (Edge)edges.get(0); ! } else { ! leftEdge = (Edge)edges.get(index - 1); ! rightEdge = (Edge)edges.get(index + 1); ! } ! Edge toSlideEdge = null; ! Edge fromSlideEdge = null; ! Vertex to = edge.getTo(); ! Vertex from = edge.getFrom(); ! if (to.getEdges().contains(leftEdge) && ! from.getEdges().contains(rightEdge)) { ! toSlideEdge = leftEdge; ! fromSlideEdge = rightEdge; ! } else if (from.getEdges().contains(leftEdge) && ! to.getEdges().contains(rightEdge)) { ! fromSlideEdge = leftEdge; ! toSlideEdge = rightEdge; ! } ! Map map = new HashMap(); ! map.put(edge.getTo(), toSlideEdge.getDirection()); ! map.put(edge.getFrom(), fromSlideEdge.getDirection()); ! return map; ! } ! } ! return null; ! } ! ! /** ! * Finds the slide map for a vertex. ! * @param vertex the vertex ! * @return a map for the vertex, or null if none could be found. ! */ ! private Map createSlideMap(Vertex vertex) { ! if (current.object() instanceof Edge) { ! Edge edge = (Edge)current.object(); ! if (vertex.getEdges().contains(edge)) { ! Map map = new HashMap(); ! map.put(vertex, edge.getDirection()); ! return map; ! } ! } ! return null; ! } ! ! /** ! * Finds the slide map for a surface. ! * @param surface the surface ! * @return the map, or null if none could be found. ! */ ! private Map createSlideMap(Surface surface) { ! Collection verts = surface.getVertices(); ! Iterator it = vertices.iterator(); ! boolean bound = false; ! Map map = new HashMap(); ! while (it.hasNext() && !bound) { ! Vertex vertex = (Vertex)it.next(); ! map.put(vertex, surface.normal()); ! Collection edges = vertex.getEdges(); ! Iterator edgeIt = edges.iterator(); ! int otherEdges = 0; ! while (edgeIt.hasNext() && !bound) { ! Edge edge = (Edge)edgeIt.next(); ! if (!surface.getEdges().contains(edge)) { ! otherEdges++; ! map.put(vertex, edge.getDirection()); ! } ! bound = otherEdges > 1; ! } ! } ! if (!bound) { ! return map; ! } ! return null; } *************** *** 240,274 **** * @param delta the movement. */ ! protected void move(Collection vertices, Vertex delta) { ! Vertex restrictCopy = restrictionVector.copy(); ! restrictCopy.scale(1 / restrictCopy.length()); ! restrictCopy.scale(delta.dot(restrictCopy)); ! delta = restrictCopy; ! Vertex deltaUnit = delta.copy(); ! deltaUnit.scale(1 / delta.length()); ! Iterator it = vertices.iterator(); ! while (it.hasNext()) { ! Vertex vertex = (Vertex)it.next(); ! Vertex slideDir = ((Vertex)slideMap.get(vertex)).copy(); ! slideDir.scale(1 / slideDir.length()); ! double slideScale; ! if (delta == null) { ! log.info("delta null"); ! } ! if (slideDir == null) { ! log.info("slideDir null"); ! } ! if (deltaUnit == null) { ! log.info("deltaUnit null"); ! } ! if (delta.getX() != 0) { ! slideScale = delta.getX() / (slideDir.dot(deltaUnit) * deltaUnit.getX()); ! } else if (delta.getY() != 0) { ! slideScale = delta.getY() / (slideDir.dot(deltaUnit) * deltaUnit.getY()); ! } else { ! slideScale = delta.getZ() / (slideDir.dot(deltaUnit) * deltaUnit.getZ()); } - slideDir.scale(slideScale); - vertex.move(slideDir.getX(), slideDir.getY(), slideDir.getZ()); } } --- 272,310 ---- * @param delta the movement. */ ! protected void move(Set vertices, Vertex delta) { ! if (slideMap != null && slideMap.keySet().containsAll(vertices)) { ! Vertex directionCopy = direction.copy(); ! directionCopy.scale(1 / directionCopy.length()); ! directionCopy.scale(delta.dot(directionCopy)); ! delta = directionCopy; ! if (delta.length() != 0) { ! Vertex deltaUnit = delta.copy(); ! deltaUnit.scale(1 / delta.length()); ! Iterator it = vertices.iterator(); ! while (it.hasNext()) { ! Vertex vertex = (Vertex)it.next(); ! Vertex slideDir = ((Vertex)slideMap.get(vertex)).copy(); ! slideDir.scale(1 / slideDir.length()); ! double slideScale; ! if (delta == null) { ! log.info("delta null"); ! } ! if (slideDir == null) { ! log.info("slideDir null"); ! } ! if (deltaUnit == null) { ! log.info("deltaUnit null"); ! } ! if (delta.getX() != 0) { ! slideScale = delta.getX() / (slideDir.dot(deltaUnit) * deltaUnit.getX()); ! } else if (delta.getY() != 0) { ! slideScale = delta.getY() / (slideDir.dot(deltaUnit) * deltaUnit.getY()); ! } else { ! slideScale = delta.getZ() / (slideDir.dot(deltaUnit) * deltaUnit.getZ()); ! } ! slideDir.scale(slideScale); ! vertex.move(slideDir.getX(), slideDir.getY(), slideDir.getZ()); ! } } } } |
From: rimestad <rim...@us...> - 2006-04-05 10:23:38
|
Update of /cvsroot/bprocessor/gl/src/net/sourceforge/bprocessor/gl/tool In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv12112/src/net/sourceforge/bprocessor/gl/tool Modified Files: MultiExtrudeTool.java Log Message: Index: MultiExtrudeTool.java =================================================================== RCS file: /cvsroot/bprocessor/gl/src/net/sourceforge/bprocessor/gl/tool/MultiExtrudeTool.java,v retrieving revision 1.14 retrieving revision 1.15 diff -C2 -d -r1.14 -r1.15 *** MultiExtrudeTool.java 5 Apr 2006 10:22:11 -0000 1.14 --- MultiExtrudeTool.java 5 Apr 2006 10:23:27 -0000 1.15 *************** *** 160,164 **** (e.getY() - pressY) * (e.getY() - pressY) > 16) { direction = normDotDelta; ! elements = makeExtrusion(surfaces); } } --- 160,164 ---- (e.getY() - pressY) * (e.getY() - pressY) > 16) { direction = normDotDelta; ! elements = makeExtrusion(); } } *************** *** 170,174 **** //If there are a target that is a surface drag to that surface Vertex origin = extrudeSurface.getFirstVertex(); ! Surface current = (Surface) o; if (current != extrudeSurface && current != top && !elements.contains(current)) { Vertex n = current.normal(); --- 170,174 ---- //If there are a target that is a surface drag to that surface Vertex origin = extrudeSurface.getFirstVertex(); ! Surface current = (Surface) target; if (current != extrudeSurface && current != top && !elements.contains(current)) { Vertex n = current.normal(); |
From: Nordholt <nor...@us...> - 2006-04-05 10:23:37
|
Update of /cvsroot/bprocessor/model/src/net/sourceforge/bprocessor/model In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv12025 Modified Files: Geometric.java Edge.java Surface.java Vertex.java Log Message: added method for collecting the set of vertices in a geometric Index: Surface.java =================================================================== RCS file: /cvsroot/bprocessor/model/src/net/sourceforge/bprocessor/model/Surface.java,v retrieving revision 1.86 retrieving revision 1.87 diff -C2 -d -r1.86 -r1.87 *** Surface.java 5 Apr 2006 09:35:58 -0000 1.86 --- Surface.java 5 Apr 2006 10:23:22 -0000 1.87 *************** *** 901,904 **** --- 901,919 ---- return null; } + + /** + * Collects the set of vertices in this surface + * @return the set of vertices + */ + public Set collect() { + Set result = new HashSet(this.getVertices()); + if (holes != null) { + Iterator it = holes.iterator(); + while (it.hasNext()) { + result.addAll(((Geometric)it.next()).collect()); + } + } + return result; + } /** Index: Edge.java =================================================================== RCS file: /cvsroot/bprocessor/model/src/net/sourceforge/bprocessor/model/Edge.java,v retrieving revision 1.43 retrieving revision 1.44 diff -C2 -d -r1.43 -r1.44 *** Edge.java 29 Mar 2006 13:18:35 -0000 1.43 --- Edge.java 5 Apr 2006 10:23:22 -0000 1.44 *************** *** 459,462 **** --- 459,473 ---- return to.minus(from); } + + /** + * Collects the set of vertices in this edge + * @return the set of vertices + */ + public Set collect() { + Set result = new HashSet(); + result.add(this.to); + result.add(this.from); + return result; + } /** Index: Vertex.java =================================================================== RCS file: /cvsroot/bprocessor/model/src/net/sourceforge/bprocessor/model/Vertex.java,v retrieving revision 1.31 retrieving revision 1.32 diff -C2 -d -r1.31 -r1.32 *** Vertex.java 25 Mar 2006 18:08:32 -0000 1.31 --- Vertex.java 5 Apr 2006 10:23:22 -0000 1.32 *************** *** 311,314 **** --- 311,324 ---- return this; } + + /** + * Collects this vertex + * @return the set containing this vertex + */ + public Set collect() { + Set result = new HashSet(); + result.add(this); + return result; + } /** Index: Geometric.java =================================================================== RCS file: /cvsroot/bprocessor/model/src/net/sourceforge/bprocessor/model/Geometric.java,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** Geometric.java 25 Mar 2006 18:08:32 -0000 1.4 --- Geometric.java 5 Apr 2006 10:23:22 -0000 1.5 *************** *** 8,11 **** --- 8,13 ---- package net.sourceforge.bprocessor.model; + import java.util.Set; + /** * The Geometric as a super class for geometric entities *************** *** 46,49 **** --- 48,57 ---- } + /** + * Collects the set of vertices in this geometric + * @return the set of vertices + */ + public abstract Set collect(); + } |
From: rimestad <rim...@us...> - 2006-04-05 10:22:23
|
Update of /cvsroot/bprocessor/gl/src/net/sourceforge/bprocessor/gl/tool In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv11040/src/net/sourceforge/bprocessor/gl/tool Modified Files: MultiExtrudeTool.java Log Message: Added length measuring Index: MultiExtrudeTool.java =================================================================== RCS file: /cvsroot/bprocessor/gl/src/net/sourceforge/bprocessor/gl/tool/MultiExtrudeTool.java,v retrieving revision 1.13 retrieving revision 1.14 diff -C2 -d -r1.13 -r1.14 *** MultiExtrudeTool.java 5 Apr 2006 09:36:16 -0000 1.13 --- MultiExtrudeTool.java 5 Apr 2006 10:22:11 -0000 1.14 *************** *** 9,12 **** --- 9,13 ---- import java.awt.Cursor; + import java.awt.event.KeyEvent; import java.awt.event.MouseEvent; import java.util.Collection; *************** *** 41,50 **** private static final boolean SNAPPING = false; ! /** The dragSurface and extrudesurface */ private Surface top, extrudeSurface; ! /** The surfaces to extrude */ private Set surfaces; ! /** A vertex-direction map */ private Map v2dir; --- 42,51 ---- private static final boolean SNAPPING = false; ! /** The dragSurface and extrudeSurface */ private Surface top, extrudeSurface; ! /** The surfaces to extrude */ private Set surfaces; ! /** A vertex-direction map */ private Map v2dir; *************** *** 59,67 **** private double t; ! /** The set of extruded elements and the top surfaces of the extrusion*/ ! private Set elements, tops; /** The extrusion direction */ private double direction = 0.0; /** --- 60,71 ---- private double t; ! /** The set of extruded elements*/ ! private Set elements; /** The extrusion direction */ private double direction = 0.0; + + /** The length of the extrusion */ + private String number; /** *************** *** 72,75 **** --- 76,80 ---- public MultiExtrudeTool(GLView glv, Cursor cursor) { super(glv, cursor); + number = ""; } *************** *** 85,90 **** v2dir = null; elements = new HashSet(); ! surfaces = new HashSet(); ! if (target instanceof Surface) { if (Selection.primary().isEmpty() || Selection.primary().contains(target)) { --- 90,95 ---- v2dir = null; elements = new HashSet(); ! number = ""; ! if (target instanceof Surface) { if (Selection.primary().isEmpty() || Selection.primary().contains(target)) { *************** *** 146,157 **** } ! //if (direction == 0) { //we have never set the direction; ! //direction = normDotDelta; ! //} if (top == null) { // there are no extrusion make one if we move the mouse if ((e.getX() - pressX) * (e.getX() - pressX) + ! (e.getY() - pressY) * (e.getY() - pressY) > 32) { direction = normDotDelta; elements = makeExtrusion(surfaces); --- 151,162 ---- } ! if (direction == 0) { //we have never set the direction; ! direction = normDotDelta; ! } if (top == null) { // there are no extrusion make one if we move the mouse if ((e.getX() - pressX) * (e.getX() - pressX) + ! (e.getY() - pressY) * (e.getY() - pressY) > 16) { direction = normDotDelta; elements = makeExtrusion(surfaces); *************** *** 165,175 **** //If there are a target that is a surface drag to that surface Vertex origin = extrudeSurface.getFirstVertex(); ! Surface current = (Surface) target; if (current != extrudeSurface && current != top && !elements.contains(current)) { Vertex n = current.normal(); Vertex cross = normal.cross(n); if (cross.isZero()) { ! Vertex o = current.getFirstVertex(); ! Vertex vector = o.minus(origin); double d = vector.dot(normal); if (Math.abs(d) > 0.0000001) { --- 170,180 ---- //If there are a target that is a surface drag to that surface Vertex origin = extrudeSurface.getFirstVertex(); ! Surface current = (Surface) o; if (current != extrudeSurface && current != top && !elements.contains(current)) { Vertex n = current.normal(); Vertex cross = normal.cross(n); if (cross.isZero()) { ! Vertex cur = current.getFirstVertex(); ! Vertex vector = cur.minus(origin); double d = vector.dot(normal); if (Math.abs(d) > 0.0000001) { *************** *** 187,191 **** // we have to remove the extrusion and make a new one remove(elements); ! elements = makeExtrusion(surfaces); direction = normDotDelta; if (v2dir != null) { --- 192,196 ---- // we have to remove the extrusion and make a new one remove(elements); ! elements = makeExtrusion(); direction = normDotDelta; if (v2dir != null) { *************** *** 202,206 **** */ private void remove(Set elem) { - if (elem != null) { Iterator iter = elem.iterator(); --- 207,210 ---- *************** *** 220,224 **** */ private void moveTo(Collection which, double to) { - Project.info("move-to " + to); double delta = t - to; Iterator iter = which.iterator(); --- 224,227 ---- *************** *** 255,263 **** /** ! * Make the extrusion from a set of surfaces ! * @param c the collection of surfaces to extrude * @return the elements created for extrusion */ ! private Set makeExtrusion(Collection c) { Set elements = new HashSet(); Map e2e = new HashMap(); // edge to edge map --- 258,272 ---- /** ! * Make the extrusion from either a set of surfaces * @return the elements created for extrusion */ ! private Set makeExtrusion() { ! Collection c; ! if (Selection.primary().size() == 0) { ! c = new HashSet(); ! c.add(extrudeSurface); ! } else { ! c = Selection.primary(); ! } Set elements = new HashSet(); Map e2e = new HashMap(); // edge to edge map *************** *** 265,269 **** v2dir = new HashMap(); // vertex to direction map Map v2e = new HashMap(); // vertex to edge map - tops = new HashSet(); // Check for selection of only surfaces --- 274,277 ---- *************** *** 277,281 **** while (iter.hasNext()) { Surface cur = (Surface)iter.next(); - Project.info("extruding in " + direction); Surface s = cur.extrude(direction, elements, e2e, v2e, e2s, v2dir); if (cur == extrudeSurface) { --- 285,288 ---- *************** *** 283,287 **** top = s; } - tops.add(s); elements.add(s); } --- 290,293 ---- *************** *** 289,293 **** return elements; } ! /** * @param e MouseEvent --- 295,299 ---- return elements; } ! /** * @param e MouseEvent *************** *** 309,311 **** --- 315,391 ---- log.info(message); } + + /** + * Apply extrusion + * @param length The length + */ + private void apply(double length) { + if (v2dir != null) { + moveTo(v2dir.values(), length); + } else { + makeExtrusion(); + moveTo(v2dir.values(), length); + } + Iterator iter = elements.iterator(); + while (iter.hasNext()) { + holeAnalysis((Surface)(iter.next())); + } + } + + /** + * Invoked when a key has been pressed. + * @param e The KeyEvent + */ + public void keyPressed(KeyEvent e) { + /*a length can only be typed in if some surface is selected + for extrusion, and if the "number"-variable has been initialised + */ + super.keyPressed(e); + if (extrudeSurface != null && number != null) { + if (e.getKeyCode() == KeyEvent.VK_1) { + number += "1"; + } else if (e.getKeyCode() == KeyEvent.VK_2) { + number += "2"; + } else if (e.getKeyCode() == KeyEvent.VK_3) { + number += "3"; + } else if (e.getKeyCode() == KeyEvent.VK_4) { + number += "4"; + } else if (e.getKeyCode() == KeyEvent.VK_5) { + number += "5"; + } else if (e.getKeyCode() == KeyEvent.VK_6) { + number += "6"; + } else if (e.getKeyCode() == KeyEvent.VK_7) { + number += "7"; + } else if (e.getKeyCode() == KeyEvent.VK_8) { + number += "8"; + } else if (e.getKeyCode() == KeyEvent.VK_9) { + number += "9"; + } else if (e.getKeyCode() == KeyEvent.VK_0) { + number += "0"; + } else if (e.getKeyCode() == KeyEvent.VK_ENTER) { + if (!number.equals("")) { + double length = glv.getLength(); + apply(length); + glv.repaint(); + } + } else if (e.getKeyCode() == KeyEvent.VK_BACK_SPACE) { + int length = number.length(); + if (length > 0) { + number = number.substring(0, length - 1); + } + } + } + + if (number.equals("") || number.equals("-")) { + glv.setLength(0); + } else { + try { + double d = Double.parseDouble(number); + glv.setLength(d / 1000); + } catch (NumberFormatException exp) { + System.out.println(exp); + } + } + super.keyPressed(e); + } } |
From: Michael L. <he...@us...> - 2006-04-05 09:36:38
|
Update of /cvsroot/bprocessor/build In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv8774 Modified Files: build.xml Log Message: A large amount of changes because of the CVS outage at sourceforge. Element-modelling now completet Index: build.xml =================================================================== RCS file: /cvsroot/bprocessor/build/build.xml,v retrieving revision 1.14 retrieving revision 1.15 diff -C2 -d -r1.14 -r1.15 *** build.xml 15 Mar 2006 11:00:54 -0000 1.14 --- build.xml 5 Apr 2006 09:36:35 -0000 1.15 *************** *** 3,7 **** <target name="init"> <property name="project" value="bprocessor"/> ! <property name="version" value="M4-developmen"/> <property name="script.dir" value="${basedir}/bin"/> --- 3,7 ---- <target name="init"> <property name="project" value="bprocessor"/> ! <property name="version" value="M4-development"/> <property name="script.dir" value="${basedir}/bin"/> |