bprocessor-commit Mailing List for B-processor (Page 124)
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: Michael L. <he...@us...> - 2006-05-03 14:12:34
|
Update of /cvsroot/bprocessor/gl/src/net/sourceforge/bprocessor/gl/tool In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv18980a/src/net/sourceforge/bprocessor/gl/tool Modified Files: ExtrudeTool.java Log Message: Surface/Edge intersections implemented Index: ExtrudeTool.java =================================================================== RCS file: /cvsroot/bprocessor/gl/src/net/sourceforge/bprocessor/gl/tool/ExtrudeTool.java,v retrieving revision 1.17 retrieving revision 1.18 diff -C2 -d -r1.17 -r1.18 *** ExtrudeTool.java 10 Apr 2006 15:34:19 -0000 1.17 --- ExtrudeTool.java 3 May 2006 14:12:25 -0000 1.18 *************** *** 331,336 **** if (mode == UNDICIDED) { findTarget(e); ! if (target instanceof Surface) { ! glv.getView().makeTarget(target); } } else if (mode == MOVE_MODE) { --- 331,340 ---- if (mode == UNDICIDED) { findTarget(e); ! if (target != null) { ! if (target instanceof Surface) { ! glv.getView().makeTarget(target); ! } ! } else { ! glv.getView().makeTarget(null); } } else if (mode == MOVE_MODE) { |
From: Michael L. <he...@us...> - 2006-05-03 11:01:35
|
Update of /cvsroot/bprocessor/gl/src/net/sourceforge/bprocessor/gl/tool In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv32366/src/net/sourceforge/bprocessor/gl/tool Modified Files: AbstractPencil.java Log Message: Coloring intersection-points Index: AbstractPencil.java =================================================================== RCS file: /cvsroot/bprocessor/gl/src/net/sourceforge/bprocessor/gl/tool/AbstractPencil.java,v retrieving revision 1.26 retrieving revision 1.27 diff -C2 -d -r1.26 -r1.27 *** AbstractPencil.java 3 May 2006 10:04:38 -0000 1.26 --- AbstractPencil.java 3 May 2006 11:01:27 -0000 1.27 *************** *** 23,26 **** --- 23,27 ---- import net.sourceforge.bprocessor.gl.GLView; import net.sourceforge.bprocessor.gl.model.Intersection; + import net.sourceforge.bprocessor.gl.view.View; import net.sourceforge.bprocessor.model.Edge; import net.sourceforge.bprocessor.model.Geometry; *************** *** 31,36 **** import net.sourceforge.bprocessor.model.Vertex; import net.sourceforge.bprocessor.model.Camera; - import net.sourceforge.bprocessor.model.Entity; - import org.apache.log4j.Logger; --- 32,35 ---- *************** *** 542,545 **** --- 541,546 ---- if (intersection != null) { Object target = null; + float[] targetColor = View.TARGET_COLOR; + Vertex current = intersection.vertex(); switch (intersection.type()) { *************** *** 551,557 **** --- 552,560 ---- if (edge.getConstructor()) { target = current; + targetColor = View.CONSTRUCTOR_COLOR; } else { target = intersection.object(); } + break; case Intersection.SURFACE: *************** *** 561,579 **** case Intersection.EDGE_MIDPOINT: target = current; ! glv.getView().changeColor((Entity)target, new float[] {255.0f / 255.0f, ! 99.0f / 255.0f, ! 71.0f / 255.0f}); break; case Intersection.EDGE_INTERSECTION: target = current; ! glv.getView().changeColor((Entity)target, new float[] {118.0f / 255.0f, ! 238.0f / 255.0f, ! 0.0f}); break; case Intersection.SURFACE_INTERSECTION: target = current; ! glv.getView().changeColor((Entity)target, new float[] {30.0f / 255.0f, ! 144.0f / 255.0f, ! 255.0f / 255.0f}); break; case Intersection.PLANE_INTERSECTION: --- 564,576 ---- case Intersection.EDGE_MIDPOINT: target = current; ! targetColor = View.EDGE_MIDPOINT_COLOR; break; case Intersection.EDGE_INTERSECTION: target = current; ! targetColor = View.EDGE_INTERSECTION_COLOR; break; case Intersection.SURFACE_INTERSECTION: target = current; ! targetColor = View.EDGE_INTERSECTION_COLOR; break; case Intersection.PLANE_INTERSECTION: *************** *** 582,586 **** break; } ! glv.getView().makeTarget(target); } } --- 579,583 ---- break; } ! glv.getView().makeTarget(target, targetColor); } } |
From: Michael L. <he...@us...> - 2006-05-03 11:01:35
|
Update of /cvsroot/bprocessor/gl/src/net/sourceforge/bprocessor/gl/view In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv32366/src/net/sourceforge/bprocessor/gl/view Modified Files: View.java Log Message: Coloring intersection-points Index: View.java =================================================================== RCS file: /cvsroot/bprocessor/gl/src/net/sourceforge/bprocessor/gl/view/View.java,v retrieving revision 1.83 retrieving revision 1.84 diff -C2 -d -r1.83 -r1.84 *** View.java 3 May 2006 10:11:25 -0000 1.83 --- View.java 3 May 2006 11:01:27 -0000 1.84 *************** *** 99,102 **** --- 99,109 ---- public static final float[] TARGET_COLOR = new float[] {0.8f, 0.8f, 0.1f}; + /** Used for vertices on edges */ + public static final float[] EDGE_MIDPOINT_COLOR = new float[] {0.1f, 0.8f, 0.8f}; + + /** Used for vertices on edge-intersections */ + public static final float[] EDGE_INTERSECTION_COLOR = new float[] {0.8f, 0.1f, 0.8f}; + + /** Used for constructor objects */ public static final float [] CONSTRUCTOR_COLOR = new float[] {0.8f, 0.7f, 0.6f, 0.50f}; *************** *** 706,714 **** // draw target if (target != null) { ! if (colorMap.containsKey(target)) { ! gl.glColor3fv((float[])colorMap.get(target)); ! } else { ! gl.glColor3fv(targetColor); ! } drawObject(target); } --- 713,717 ---- // draw target if (target != null) { ! gl.glColor3fv(targetColor); drawObject(target); } |
From: Nordholt <nor...@us...> - 2006-05-03 10:14:18
|
Update of /cvsroot/bprocessor/gui/src/net/sourceforge/bprocessor/gui/treeview In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv27913 Modified Files: GenericTreeView.java Log Message: added checkpoint after deleting a space Index: GenericTreeView.java =================================================================== RCS file: /cvsroot/bprocessor/gui/src/net/sourceforge/bprocessor/gui/treeview/GenericTreeView.java,v retrieving revision 1.23 retrieving revision 1.24 diff -C2 -d -r1.23 -r1.24 *** GenericTreeView.java 21 Apr 2006 15:16:38 -0000 1.23 --- GenericTreeView.java 3 May 2006 10:14:01 -0000 1.24 *************** *** 388,391 **** --- 388,392 ---- info("deleting: " + entity); entity.delete(); + Project.getInstance().checkpoint(); } } |
From: Nordholt <nor...@us...> - 2006-05-03 10:12:44
|
Update of /cvsroot/bprocessor/model/src/net/sourceforge/bprocessor/model In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv26938 Modified Files: Space.java Log Message: added method for copying a space Index: Space.java =================================================================== RCS file: /cvsroot/bprocessor/model/src/net/sourceforge/bprocessor/model/Space.java,v retrieving revision 1.28 retrieving revision 1.29 diff -C2 -d -r1.28 -r1.29 *** Space.java 1 May 2006 09:55:15 -0000 1.28 --- Space.java 3 May 2006 10:12:34 -0000 1.29 *************** *** 16,19 **** --- 16,20 ---- import java.util.List; import java.util.Set; + import java.util.Map; import org.apache.log4j.Logger; *************** *** 911,913 **** --- 912,1015 ---- Project.getInstance().delete(this); } + + /** + * Copy this space and return the copy + * @return the copy of this space + */ + public Space copy() { + Map copiedVertices = new HashMap(); + Map copiedEdges = new HashMap(); + Map copiedSurfaces = new HashMap(); + Map copiedSpaces = new HashMap(); + + + Space copy = new Space("*copy of " + this.getName() + "*", + this.getType(), + this.isContainer()); + + /* Copying the envelope of this space */ + + /* vertices */ + Iterator it = this.collect().iterator(); + while (it.hasNext()) { + Vertex v = (Vertex)it.next(); + Vertex newVertex = v.copy(); + if (vertices.values().contains(v)) { + copy.add(newVertex); + } else { + Project.getInstance().add(newVertex); + } + copiedVertices.put(v, newVertex); + } + + /* surfaces and edges */ + it = this.envelope.iterator(); + while (it.hasNext()) { + Surface s = (Surface)it.next(); + Iterator edgeIt = s.getEdges().iterator(); + List newEdges = new LinkedList(); + while (edgeIt.hasNext()) { + Edge e = (Edge)edgeIt.next(); + if (copiedEdges.keySet().contains(e)) { + newEdges.add(copiedEdges.get(e)); + } else { + Edge newEdge = new Edge((Vertex)copiedVertices.get(e.getTo()), + (Vertex)copiedVertices.get(e.getFrom())); + Project.getInstance().add(newEdge); + copiedEdges.put(e, newEdge); + newEdges.add(newEdge); + } + } + Surface newSurface = new Surface(newEdges); + Space worldEmpty = Project.getInstance().world().getEmpty(); + if (s.getBackDomain() == this) { + newSurface.setBackDomain(copy); + } else { + newSurface.setBackDomain(worldEmpty); + } + + if (s.getFrontDomain() == this) { + newSurface.setFrontDomain(copy); + } else { + newSurface.setFrontDomain(worldEmpty); + } + copiedSurfaces.put(s, newSurface); + Project.getInstance().add(newSurface); + } + + Set newSurfaces = new HashSet(copiedSurfaces.values()); + copy.setEnvelope(newSurfaces); + Project.getInstance().add(copy); + + /* Copying elements of this space */ + + /* edges */ + it = edges.values().iterator(); + while (it.hasNext()) { + Edge e = (Edge)it.next(); + Edge elementEdge = new Edge((Vertex)copiedVertices.get(e.getTo()), + (Vertex)copiedVertices.get(e.getFrom())); + copiedEdges.put(e, elementEdge); + copy.add(elementEdge); + } + + /* surfaces */ + it = surfaces.values().iterator(); + while (it.hasNext()) { + Surface s = (Surface)it.next(); + List edgeCopies = new LinkedList(); + Iterator edgeIt = s.getEdges().iterator(); + while (edgeIt.hasNext()) { + Edge e = (Edge)edgeIt.next(); + edgeCopies.add(copiedEdges.get(e)); + } + Surface elementSurface = new Surface(edgeCopies); + elementSurface.setBackDomain(s.getBackDomain()); + elementSurface.setFrontDomain(s.getFrontDomain()); + copiedSurfaces.put(s, elementSurface); + copy.add(elementSurface); + } + + return copy; + } } |
From: Nordholt <nor...@us...> - 2006-05-03 10:11:33
|
Update of /cvsroot/bprocessor/gl/src/net/sourceforge/bprocessor/gl/view In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv26163 Modified Files: View.java Log Message: sorting out conflicts on target coloring Index: View.java =================================================================== RCS file: /cvsroot/bprocessor/gl/src/net/sourceforge/bprocessor/gl/view/View.java,v retrieving revision 1.82 retrieving revision 1.83 diff -C2 -d -r1.82 -r1.83 *** View.java 3 May 2006 09:59:19 -0000 1.82 --- View.java 3 May 2006 10:11:25 -0000 1.83 *************** *** 704,710 **** } ! if (target != null) { ! gl.glColor3fv(targetColor); drawObject(target); } --- 704,714 ---- } ! // draw target if (target != null) { ! if (colorMap.containsKey(target)) { ! gl.glColor3fv((float[])colorMap.get(target)); ! } else { ! gl.glColor3fv(targetColor); ! } drawObject(target); } |
From: Nordholt <nor...@us...> - 2006-05-03 10:04:49
|
Update of /cvsroot/bprocessor/gl/src/net/sourceforge/bprocessor/gl/tool In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv20891 Modified Files: AbstractPencil.java MoveTool.java Log Message: color coded intersection vertices. Changed direction lock to use hold-shift/capslock. Index: MoveTool.java =================================================================== RCS file: /cvsroot/bprocessor/gl/src/net/sourceforge/bprocessor/gl/tool/MoveTool.java,v retrieving revision 1.55 retrieving revision 1.56 diff -C2 -d -r1.55 -r1.56 *** MoveTool.java 26 Apr 2006 15:29:07 -0000 1.55 --- MoveTool.java 3 May 2006 10:04:38 -0000 1.56 *************** *** 102,105 **** --- 102,106 ---- moveEntities.addAll(selection); } + excluded(getAffected(moveEntities)); if (!moveEntities.isEmpty()) { *************** *** 222,225 **** --- 223,238 ---- } } + + /** + * Invoked when a key has been released. + * @param e The KeyEvent + */ + public void keyReleased(KeyEvent e) { + if (strategy != null) { + strategy.keyReleased(e); + } else { + super.keyReleased(e); + } + } /** Index: AbstractPencil.java =================================================================== RCS file: /cvsroot/bprocessor/gl/src/net/sourceforge/bprocessor/gl/tool/AbstractPencil.java,v retrieving revision 1.25 retrieving revision 1.26 diff -C2 -d -r1.25 -r1.26 *** AbstractPencil.java 1 May 2006 09:58:02 -0000 1.25 --- AbstractPencil.java 3 May 2006 10:04:38 -0000 1.26 *************** *** 31,34 **** --- 31,35 ---- import net.sourceforge.bprocessor.model.Vertex; import net.sourceforge.bprocessor.model.Camera; + import net.sourceforge.bprocessor.model.Entity; *************** *** 53,56 **** --- 54,60 ---- protected Collection constructors = new HashSet(); + /** The aligning elements */ + protected Collection aligners = new HashSet(); + /** Current intersection */ protected Intersection current; *************** *** 64,69 **** /** Locked */ protected Vertex locked; ! /** wherther or not the tool is locked */ protected boolean lock; --- 68,76 ---- /** Locked */ protected Vertex locked; + + /** Wherther or not unaligned constructors are showing */ + protected boolean showing; ! /** Wherther or not the tool is locked */ protected boolean lock; *************** *** 87,90 **** --- 94,98 ---- timer.setRepeats(false); lock = false; + showing = true; plane = new Plane (0, 0, 1, 0); } *************** *** 129,133 **** lockedcopy.scale(locked.dot(unlocked)); lockedcopy = lockedcopy.add(start.vertex()); ! return new Intersection(lockedcopy, Intersection.VERTEX, lockedcopy); } else { return intersection; --- 137,141 ---- lockedcopy.scale(locked.dot(unlocked)); lockedcopy = lockedcopy.add(start.vertex()); ! return new Intersection(lockedcopy, intersection.type(), intersection.object()); } else { return intersection; *************** *** 219,224 **** Vertex to = ((Edge) edges.get(edges.size() - 1)).getTo(); - - if (from == to) { List actual = new LinkedList(); --- 227,230 ---- *************** *** 365,372 **** constructors.add(parrallel); } ! if (plane != null) { ! info(plane); ! info("origin = " + plane.origin()); ! } } } --- 371,385 ---- constructors.add(parrallel); } ! //if (plane != null) { ! //info(plane); ! //info("origin = " + plane.origin()); ! //} ! } ! } ! if (!showing) { ! aligners(constructors); ! constructors = new LinkedList(); ! if (current.object() instanceof Edge) { ! constructors.add(current.object()); } } *************** *** 405,408 **** --- 418,452 ---- /** + * Show aligners + */ + protected void showAligners() { + Iterator iter = aligners.iterator(); + while (iter.hasNext()) { + Edge current = (Edge) iter.next(); + glv.getView().addTempEdge(current); + } + } + + /** + * Hide aligners + */ + protected void hideAligners() { + Iterator iter = aligners.iterator(); + while (iter.hasNext()) { + Edge current = (Edge) iter.next(); + glv.getView().removeTempEdge(current); + } + } + + /** + * Supply the aligner elements + * @param feed Collection of edges + */ + protected void aligners(Collection feed) { + aligners.clear(); + aligners.addAll(feed); + } + + /** * Get the plane out of the XY XZ and YZ planes that is best aligned * with screen. *************** *** 517,526 **** --- 561,579 ---- case Intersection.EDGE_MIDPOINT: target = current; + glv.getView().changeColor((Entity)target, new float[] {255.0f / 255.0f, + 99.0f / 255.0f, + 71.0f / 255.0f}); break; case Intersection.EDGE_INTERSECTION: target = current; + glv.getView().changeColor((Entity)target, new float[] {118.0f / 255.0f, + 238.0f / 255.0f, + 0.0f}); break; case Intersection.SURFACE_INTERSECTION: target = current; + glv.getView().changeColor((Entity)target, new float[] {30.0f / 255.0f, + 144.0f / 255.0f, + 255.0f / 255.0f}); break; case Intersection.PLANE_INTERSECTION: *************** *** 569,573 **** /** ! * Invoked when a key has been pressed. Lets user delete what is selected. * @param e The KeyEvent */ --- 622,626 ---- /** ! * Invoked when a key has been pressed. * @param e The KeyEvent */ *************** *** 601,604 **** --- 654,663 ---- locked = start.vertex().minus(current.vertex()); locked.scale(1 / locked.length()); + lock = true; + } + } else if (e.getKeyCode() == KeyEvent.VK_CAPS_LOCK) { + if (start != null && current != null) { + locked = start.vertex().minus(current.vertex()); + locked.scale(1 / locked.length()); } lock = !lock; *************** *** 677,681 **** } } ! /** * Clean up --- 736,750 ---- } } ! ! /** ! * Invoked when a key has been released. ! * @param e The KeyEvent ! */ ! public void keyReleased(KeyEvent e) { ! if (e.getKeyCode() == KeyEvent.VK_SHIFT) { ! lock = false; ! } ! } ! /** * Clean up *************** *** 686,689 **** --- 755,759 ---- current = null; incident = null; + lock = false; constructors(new LinkedList()); feedback(new LinkedList()); |
From: Nordholt <nor...@us...> - 2006-05-03 10:01:29
|
Update of /cvsroot/bprocessor/gl/src/net/sourceforge/bprocessor/gl/tool In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv18268 Modified Files: SpaceTool.java Log Message: Added a copy option in the space tool popup Index: SpaceTool.java =================================================================== RCS file: /cvsroot/bprocessor/gl/src/net/sourceforge/bprocessor/gl/tool/SpaceTool.java,v retrieving revision 1.18 retrieving revision 1.19 diff -C2 -d -r1.18 -r1.19 *** SpaceTool.java 19 Apr 2006 16:13:54 -0000 1.18 --- SpaceTool.java 3 May 2006 10:01:20 -0000 1.19 *************** *** 140,144 **** */ protected JPopupMenu makeSelectionMenu() { - if (target instanceof String) { String type = (String) target; --- 140,143 ---- *************** *** 449,456 **** } }); ! ! ! ! JMenu funcMenu = new JMenu("Functional " + category + "s"); --- 448,462 ---- } }); ! JMenuItem copySpaceItem = new JMenuItem("Copy Space"); ! copySpaceItem.addActionListener(new SpaceAction(space) { ! public void actionPerformed(ActionEvent arg0) { ! if (space != null) { ! selection.clear(); ! Space spaceCopy = space.copy(); ! selection.clear(); ! selection.add(spaceCopy); ! } ! } ! }); JMenu funcMenu = new JMenu("Functional " + category + "s"); *************** *** 482,485 **** --- 488,492 ---- menu.addSeparator(); menu.add(voidItem); + menu.add(copySpaceItem); menu.add(editSpaceItem); menu.addPopupMenuListener(spl); |
From: Michael L. <he...@us...> - 2006-05-03 09:59:25
|
Update of /cvsroot/bprocessor/gl/src/net/sourceforge/bprocessor/gl/view In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv16503/src/net/sourceforge/bprocessor/gl/view Modified Files: View.java Log Message: Removed more unused code Implemented mechanism for assigning a color to target Index: View.java =================================================================== RCS file: /cvsroot/bprocessor/gl/src/net/sourceforge/bprocessor/gl/view/View.java,v retrieving revision 1.81 retrieving revision 1.82 diff -C2 -d -r1.81 -r1.82 *** View.java 3 May 2006 08:49:24 -0000 1.81 --- View.java 3 May 2006 09:59:19 -0000 1.82 *************** *** 63,69 **** private static Logger log = Logger.getLogger(View.class); - /** Specify if lone vertices are displayed */ - private static final boolean DRAW_LONE_VERTICES = false; - /** the color of the x axis */ public static final float[] X_AXIS_COLOR = new float[] {0.1f, 0.8f, 0.1f}; --- 63,66 ---- *************** *** 166,175 **** public static final int VIEW_3D = 6; - /** The Snap vertex */ - protected static Vertex snapVertex = null; - - /** The current vertex */ - protected static Vertex currentVertex = null; - /** The current background color */ protected static float[] bgColor; --- 163,166 ---- *************** *** 186,189 **** --- 177,183 ---- /** The target */ protected static Object target = null; + + /** The target color */ + protected static float[] targetColor = null; /** The GL */ *************** *** 453,457 **** gl.glClearColor(bgColor[0], bgColor[1], bgColor[2], bgColor[3]); - Plane xy = new Plane(0, 0, 1, 0); gl = gld.getGL(); gl.glClear(GL.GL_COLOR_BUFFER_BIT | GL.GL_DEPTH_BUFFER_BIT); --- 447,450 ---- *************** *** 711,759 **** } ! // draw target ! gl.glColor3fv(TARGET_COLOR); if (target != null) { drawObject(target); } gl.glDisable(GL.GL_DEPTH_TEST); - Vertex to = null; - - if (to == null) { - to = currentVertex; - } - if (snapVertex != null && to != null) { - boolean doDraw = true; - if (cmp(snapVertex.getY(), to.getY()) && cmp(snapVertex.getZ(), to.getZ())) { - gl.glColor3fv(X_AXIS_COLOR); - } else if (cmp(snapVertex.getX(), to.getX()) && cmp(snapVertex.getZ(), to.getZ())) { - gl.glColor3fv(Y_AXIS_COLOR); - } else if (cmp(snapVertex.getX(), to.getX()) && cmp(snapVertex.getY(), to.getY())) { - gl.glColor3fv(Z_AXIS_COLOR); - } else { - doDraw = false; - } - if (doDraw) { - gl.glEnable(GL.GL_LINE_STIPPLE); - gl.glLineWidth(1.0f); - gl.glBegin(GL.GL_LINES); - gl.glVertex3d(snapVertex.getX(), snapVertex.getY(), snapVertex.getZ()); - gl.glVertex3d(to.getX(), to.getY(), to.getZ()); - gl.glEnd(); - gl.glDisable(GL.GL_LINE_STIPPLE); - } - } - - - // draw snap point if any - if (snapVertex != null) { - gl.glDisable(GL.GL_DEPTH_TEST); - gl.glColor3fv(TARGET_COLOR); - gl.glPointSize(5.0f); - gl.glBegin(GL.GL_POINTS); - gl.glVertex3d(snapVertex.getX(), snapVertex.getY(), snapVertex.getZ()); - gl.glEnd(); - gl.glPointSize(1.0f); - } { --- 704,714 ---- } ! if (target != null) { + gl.glColor3fv(targetColor); drawObject(target); } gl.glDisable(GL.GL_DEPTH_TEST); { *************** *** 845,868 **** } } - - /** - * Draw all surfaces - * @param gld The GLDrawable - * @param side The side of surfaces to draw - */ - private void drawSurfaces(GLDrawable gld, int side) { - drawSurfaces(gld, tempSurfaces, side); - - Space active = Project.getInstance().getActiveSpace(); - - if (active != null) { - drawSpaceSurfaces(gld, active, side); - } else { - Collection surfaces = Project.getInstance().getSurfaces(); - Collection spaces = Project.getInstance().getSpaces(); - drawSurfaces(gld, surfaces, side); - drawInteriorSurfaces(gld, side, spaces); - } - } /** --- 800,803 ---- *************** *** 954,971 **** /** - * Draw interior surfaces - * @param gld The GLDrawable - * @param side The side of surfaces to draw - * @param spaces The spaces - */ - private void drawInteriorSurfaces(GLDrawable gld, int side, Collection spaces) { - Iterator iter = spaces.iterator(); - while (iter.hasNext()) { - Space current = (Space) iter.next(); - drawSurfaces(gld, current.getSurfaces(), side); - } - } - - /** * * @param surface The surface --- 889,892 ---- *************** *** 1124,1129 **** */ public void reset() { - setSnapVertex(null); - setCurrentVertex(null); makeTarget(null); } --- 1045,1048 ---- *************** *** 1562,1575 **** /** - * Draw a Vertex - * @param v The Vertex to draw - */ - private void drawVertex(Vertex v) { - gl.glBegin(GL.GL_POINTS); - gl.glVertex3d(v.getX(), v.getY(), v.getZ()); - gl.glEnd(); - } - - /** * Draw a Vertex for hit-detection * @param v The Vertex to draw --- 1481,1484 ---- *************** *** 1582,1600 **** gl.glPointSize(1.0f); } - - /** - * Draw all edges - * @param gld The GLDrawable - * @param edges The edges - */ - private void drawEdges(GLDrawable gld, Collection edges) { - GL gl = gld.getGL(); - gl.glColor3fv(lineColor); - Iterator it = edges.iterator(); - while (it.hasNext()) { - Edge e = (Edge)it.next(); - drawEdge(e); - } - } /** --- 1491,1494 ---- *************** *** 1674,1714 **** /** ! * Getter for snapVertex ! * @return snapVertex ! */ ! public Vertex getSnapVertex() { ! return snapVertex; ! } ! ! /** ! * Setter for snapVertex ! * @param v The new snapVertex ! */ ! public void setSnapVertex(Vertex v) { ! snapVertex = v; ! } ! ! /** ! * Getter for currentVertex ! * @return currentVertex ! */ ! public Vertex getCurrentVertex() { ! return currentVertex; ! } ! ! /** ! * Setter for currentVertex ! * @param v The new currentVertex */ ! public void setCurrentVertex(Vertex v) { ! currentVertex = v; } ! /** ! * Setter for target * @param o The object to be target */ ! public void makeTarget(Object o) { target = o; } --- 1568,1586 ---- /** ! * Setter for target that uses default target color ! * @param o The object to be target */ ! public void makeTarget(Object o) { ! makeTarget(o, TARGET_COLOR); } ! /** ! * Setter for target that also assigns the color * @param o The object to be target + * @param color The color of the target */ ! public void makeTarget(Object o, float[] color) { target = o; + targetColor = color; } *************** *** 2411,2414 **** --- 2283,2289 ---- */ class ViewWireframe extends AbstractAction { + /** */ + private static final long serialVersionUID = 1L; + /** The GLView */ private GLView glv = null; *************** *** 2440,2443 **** --- 2315,2321 ---- */ class ViewSolid extends AbstractAction { + /** */ + private static final long serialVersionUID = 1L; + /** The GLView */ private GLView glv = null; *************** *** 2469,2472 **** --- 2347,2353 ---- */ class ViewLighting extends AbstractAction { + /** */ + private static final long serialVersionUID = 1L; + /** The GLView */ private GLView glv = null; |
From: Michael L. <he...@us...> - 2006-05-03 08:49:28
|
Update of /cvsroot/bprocessor/gl/src/net/sourceforge/bprocessor/gl/view In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv27413/src/net/sourceforge/bprocessor/gl/view Modified Files: View.java Log Message: Removed activeedge from view Index: View.java =================================================================== RCS file: /cvsroot/bprocessor/gl/src/net/sourceforge/bprocessor/gl/view/View.java,v retrieving revision 1.80 retrieving revision 1.81 diff -C2 -d -r1.80 -r1.81 *** View.java 3 May 2006 07:19:36 -0000 1.80 --- View.java 3 May 2006 08:49:24 -0000 1.81 *************** *** 150,156 **** protected static double gridSize = 25.0; - /** The Active edge */ - protected static Edge activeEdge = null; - /** */ public static final int WIREFRAME_MODE = 0; --- 150,153 ---- *************** *** 723,742 **** Vertex to = null; - if (activeEdge != null) { - to = activeEdge.getTo(); - Vertex from = activeEdge.getFrom(); - if (cmp(from.getY(), to.getY()) && cmp(from.getZ(), to.getZ())) { - gl.glColor3fv(X_AXIS_COLOR); - } else if (cmp(from.getX(), to.getX()) && cmp(from.getZ(), to.getZ())) { - gl.glColor3fv(Y_AXIS_COLOR); - } else if (cmp(from.getX(), to.getX()) && cmp(from.getY(), to.getY())) { - gl.glColor3fv(Z_AXIS_COLOR); - } else { - gl.glColor3fv(lineColor); - } - gl.glLineWidth(1.0f); - drawEdge(activeEdge); - } - if (to == null) { to = currentVertex; --- 720,723 ---- *************** *** 1691,1710 **** } } - - /** - * Getter for activeEdge - * @return activeEdge - */ - public Edge getActiveEdge() { - return activeEdge; - } - - /** - * Set activeEdge - * @param e The activeEdge - */ - public void setActiveEdge(Edge e) { - activeEdge = e; - } /** --- 1672,1675 ---- |
From: Michael L. <he...@us...> - 2006-05-03 08:07:21
|
Update of /cvsroot/bprocessor/gl/src/net/sourceforge/bprocessor/gl/tool In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv26816/src/net/sourceforge/bprocessor/gl/tool Removed Files: PencilTool.java Log Message: Removed old pencil-tool --- PencilTool.java DELETED --- |
From: Michael L. <he...@us...> - 2006-05-03 07:19:40
|
Update of /cvsroot/bprocessor/gl/src/net/sourceforge/bprocessor/gl/view In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv23632/src/net/sourceforge/bprocessor/gl/view Modified Files: View.java Log Message: Removed unused code from processselect Index: View.java =================================================================== RCS file: /cvsroot/bprocessor/gl/src/net/sourceforge/bprocessor/gl/view/View.java,v retrieving revision 1.79 retrieving revision 1.80 diff -C2 -d -r1.79 -r1.80 *** View.java 2 May 2006 07:09:38 -0000 1.79 --- View.java 3 May 2006 07:19:36 -0000 1.80 *************** *** 1794,1802 **** * @param intersections Are intersections wanted * @param xy The default interseection plane - * @param all Return all edges * @return Selection */ private Object processSelect(Collection unWantedEntities, ! boolean intersections, Plane xy, boolean all) { int bufferOffset = 0; int names = 0; --- 1794,1801 ---- * @param intersections Are intersections wanted * @param xy The default interseection plane * @return Selection */ private Object processSelect(Collection unWantedEntities, ! boolean intersections, Plane xy) { int bufferOffset = 0; int names = 0; *************** *** 1978,1989 **** return vertex; } else if (edge != null) { - if (all) { - // FIXME this is a temporary hack to make move work - List result = new LinkedList(); - result.add(edge); - edges.remove(edge); - result.addAll(edges); - return result; - } return edge; } else if (surface != null) { --- 1977,1980 ---- *************** *** 1991,1995 **** } } - return null; } --- 1982,1985 ---- *************** *** 2017,2021 **** glv.repaint(true); ! Object object = processSelect(unWantedEntities, intersections, xy, false); clearNames(); return object; --- 2007,2011 ---- glv.repaint(true); ! Object object = processSelect(unWantedEntities, intersections, xy); clearNames(); return object; *************** *** 2087,2117 **** /** - * Gets id of any Edges under a point. For use in selection. - * @param x the x coordinate of the point in mouse coordinates - * @param y the y coordinate of the point in mouse coordinates - * @return The object under the point, null if no object is there - */ - public List getEdgeAtPoint(double x, double y) { - this.x = x; - this.y = y; - - picking = 10; - selectMode = EDGES; - glv.repaint(true); - - List selection = new LinkedList(); - Object object = processSelect(new HashSet(), false, new Plane(0, 0, 1, 0), true); - if (object != null) { - if (object instanceof List) { - selection = (List) object; - } else { - selection.add(object); - } - } - clearNames(); - return selection; - } - - /** * Gets id of any Vertices under a point. For use in selection. * @param x the x coordinate of the point in mouse coordinates --- 2077,2080 ---- *************** *** 2128,2132 **** List selection = new LinkedList(); ! Object object = processSelect(new HashSet(), false, new Plane(0, 0, 1, 0), false); if (object != null) { selection.add(object); --- 2091,2095 ---- List selection = new LinkedList(); ! Object object = processSelect(new HashSet(), false, new Plane(0, 0, 1, 0)); if (object != null) { selection.add(object); |
From: Michael L. <he...@us...> - 2006-05-02 07:09:45
|
Update of /cvsroot/bprocessor/gl/src/net/sourceforge/bprocessor/gl/view In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv17045/src/net/sourceforge/bprocessor/gl/view Modified Files: View.java Log Message: Small fixes to the space-drawing algorithm Index: View.java =================================================================== RCS file: /cvsroot/bprocessor/gl/src/net/sourceforge/bprocessor/gl/view/View.java,v retrieving revision 1.78 retrieving revision 1.79 diff -C2 -d -r1.78 -r1.79 *** View.java 13 Apr 2006 13:55:23 -0000 1.78 --- View.java 2 May 2006 07:09:38 -0000 1.79 *************** *** 693,767 **** } ! { ! if (DRAW_LONE_VERTICES) { ! // Draw any Vertex that are not part of an edge ! Collection vertices = Project.getInstance().getVertices(); ! gl.glColor3fv(lineColor); ! Iterator it = vertices.iterator(); ! while (it.hasNext()) { ! Vertex v = (Vertex)it.next(); ! if (v.getEdges().isEmpty()) { ! gl.glColor3fv(lineColor); ! gl.glPointSize(5.0f); ! gl.glBegin(GL.GL_POINTS); ! gl.glVertex3d(v.getX(), v.getY(), v.getZ()); ! gl.glEnd(); ! gl.glPointSize(1.0f); ! } ! } ! // Draw any temporary vertex not part of an edge ! gl.glColor3fv(lineColor); ! it = tempVertices.iterator(); ! while (it.hasNext()) { ! Vertex v = (Vertex)it.next(); ! if (v.getEdges().isEmpty()) { ! gl.glColor3fv(lineColor); ! gl.glPointSize(5.0f); ! gl.glBegin(GL.GL_POINTS); ! gl.glVertex3d(v.getX(), v.getY(), v.getZ()); ! gl.glEnd(); ! gl.glPointSize(1.0f); ! } ! } ! } } - // Fill surfaces - switch (drawMode) { - case LIGHTING_MODE: { - gl.glEnable(GL.GL_LIGHTING); - gl.glEnable(GL.GL_POLYGON_OFFSET_FILL); - gl.glPolygonOffset(0.5f, 0.5f); - gl.glEnable(GL.GL_CULL_FACE); - - gl.glCullFace(GL.GL_BACK); - gl.glColor3fv(Defaults.getFrontColor()); - drawSurfaces(gld, FRONT); - - gl.glCullFace(GL.GL_FRONT); - gl.glColor3fv(Defaults.getBackColor()); - drawSurfaces(gld, BACK); - - gl.glDisable(GL.GL_CULL_FACE); - gl.glDisable(GL.GL_POLYGON_OFFSET_FILL); - gl.glDisable(GL.GL_LIGHTING); - break; - } - case WIREFRAME_MODE: { - // NOTHING TO DO - break; - } - case SOLID_MODE: { - gl.glEnable(GL.GL_POLYGON_OFFSET_FILL); - gl.glPolygonOffset(1.0f, 1.0f); - gl.glColor3fv(SURFACE_COLOR); - drawSurfaces(gld, BOTH); - gl.glDisable(GL.GL_POLYGON_OFFSET_FILL); - break; - } - } //Draw edges if (doDrawEdges) { ! drawEdges(gld); } --- 693,706 ---- } ! Space active = Project.getInstance().getActiveSpace(); ! if (active != null) { ! drawSpace(active, gld); ! } else { ! drawSpace(Project.getInstance().world(), gld); } //Draw edges if (doDrawEdges) { ! drawEdges(gld); } *************** *** 845,848 **** --- 784,839 ---- } + /** + * Draw space + * @param gld GLDrawable + * @param space The Space + */ + private void drawSpace(Space space, GLDrawable gld) { + + Collection surfaces = space.getSurfaces(); + switch (drawMode) { + case LIGHTING_MODE: { + gl.glEnable(GL.GL_LIGHTING); + gl.glEnable(GL.GL_POLYGON_OFFSET_FILL); + gl.glPolygonOffset(0.5f, 0.5f); + gl.glEnable(GL.GL_CULL_FACE); + + gl.glCullFace(GL.GL_BACK); + gl.glColor3fv(Defaults.getFrontColor()); + drawSurfaces(gld, surfaces, FRONT); + + gl.glCullFace(GL.GL_FRONT); + gl.glColor3fv(Defaults.getBackColor()); + drawSurfaces(gld, surfaces, BACK); + + gl.glDisable(GL.GL_CULL_FACE); + gl.glDisable(GL.GL_POLYGON_OFFSET_FILL); + gl.glDisable(GL.GL_LIGHTING); + break; + } + case WIREFRAME_MODE: { + // NOTHING TO DO + break; + } + case SOLID_MODE: { + gl.glEnable(GL.GL_POLYGON_OFFSET_FILL); + gl.glPolygonOffset(1.0f, 1.0f); + gl.glColor3fv(SURFACE_COLOR); + drawSurfaces(gld, surfaces, BOTH); + gl.glDisable(GL.GL_POLYGON_OFFSET_FILL); + break; + } + } + if (doDrawEdges) { + drawGeneralEdges(gld, space.getEdges()); + } + Collection elements = space.getElements(); + Iterator iter = elements.iterator(); + while (iter.hasNext()) { + Space current = (Space) iter.next(); + drawSpace(current, gld); + } + } + /** *************** *** 895,899 **** /** ! * Draww all edges * @param gld The GLDrawable */ --- 886,890 ---- /** ! * Draw all edges * @param gld The GLDrawable */ *************** *** 923,929 **** } drawConstructionEdges(gld, edges); - drawGeneralEdges(gld, active.getEdges()); - } else { - drawGeneralEdges(gld, all); } } --- 914,917 ---- *************** *** 999,1002 **** --- 987,999 ---- /** + * + * @param surface The surface + * @return True if surface is hidden + */ + private boolean hide(Surface surface) { + return false; + } + + /** * Draw the surfaces * @param gld The GLDrawable *************** *** 1005,1014 **** */ private void drawSurfaces(GLDrawable gld, Collection surfaces, int side) { - Collection selection = glv.getTool().getSelection(); GL gl = gld.getGL(); Iterator it = surfaces.iterator(); while (it.hasNext()) { Surface s = (Surface)it.next(); ! if (!selection.contains(s)) { boolean visible = isVisible(s); if (side == BOTH) { --- 1002,1010 ---- */ private void drawSurfaces(GLDrawable gld, Collection surfaces, int side) { GL gl = gld.getGL(); Iterator it = surfaces.iterator(); while (it.hasNext()) { Surface s = (Surface)it.next(); ! if (!hide(s)) { boolean visible = isVisible(s); if (side == BOTH) { *************** *** 1622,1625 **** --- 1618,1630 ---- /** + * + * @param space The space + * @return True if empty + */ + private boolean isVisible(Space space) { + return (space.isConstructionSpace() && space.getSurfaces().isEmpty()); + } + + /** * Is the surface visible * @param surface The surface to test *************** *** 1629,1648 **** Space back = surface.getBackDomain(); Space front = surface.getFrontDomain(); ! if (front == null) { ! return true; ! } ! if (back == null) { return true; } - if ((front.isFunctionalSpace()) && (back.isFunctionalSpace())) { - return false; - } if (front == back) { return false; } ! if (!front.getSurfaces().isEmpty() || !back.getSurfaces().isEmpty()) { ! return false; ! } ! return true; } --- 1634,1644 ---- Space back = surface.getBackDomain(); Space front = surface.getFrontDomain(); ! if (front == null || back == null) { return true; } if (front == back) { return false; } ! return (isVisible(front) || isVisible(back)); } |
From: Michael L. <he...@us...> - 2006-05-02 07:09:45
|
Update of /cvsroot/bprocessor/gl/src/net/sourceforge/bprocessor/gl/tool In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv17045/src/net/sourceforge/bprocessor/gl/tool Modified Files: CameraTool.java Log Message: Small fixes to the space-drawing algorithm Index: CameraTool.java =================================================================== RCS file: /cvsroot/bprocessor/gl/src/net/sourceforge/bprocessor/gl/tool/CameraTool.java,v retrieving revision 1.8 retrieving revision 1.9 diff -C2 -d -r1.8 -r1.9 *** CameraTool.java 11 Feb 2006 17:22:17 -0000 1.8 --- CameraTool.java 2 May 2006 07:09:38 -0000 1.9 *************** *** 90,94 **** Camera.rotateVertically(c, angleY, pivot); } ! Project.getInstance().changed(c); } } --- 90,94 ---- Camera.rotateVertically(c, angleY, pivot); } ! //Project.getInstance().changed(c); } } |
From: rimestad <rim...@us...> - 2006-05-01 10:08:59
|
Update of /cvsroot/bprocessor/model/src/net/sourceforge/bprocessor/model In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv10104/src/net/sourceforge/bprocessor/model Modified Files: Surface.java Log Message: UPS Index: Surface.java =================================================================== RCS file: /cvsroot/bprocessor/model/src/net/sourceforge/bprocessor/model/Surface.java,v retrieving revision 1.94 retrieving revision 1.95 diff -C2 -d -r1.94 -r1.95 *** Surface.java 1 May 2006 10:04:10 -0000 1.94 --- Surface.java 1 May 2006 10:08:48 -0000 1.95 *************** *** 231,235 **** */ public void replace(Edge e1, Edge e2) { ! //FIXME not tested enough to be trusted 100% List lst = new ArrayList(); Edge[] edges = new Edge[getEdges().size()]; --- 231,235 ---- */ public void replace(Edge e1, Edge e2) { ! //FIXME not tested enough to be trusted 100% List lst = new ArrayList(); Edge[] edges = new Edge[getEdges().size()]; |
From: Nikolaj B. <nbr...@us...> - 2006-05-01 10:06:05
|
Update of /cvsroot/bprocessor/gl/src/net/sourceforge/bprocessor/gl/tool In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv7949/src/net/sourceforge/bprocessor/gl/tool Modified Files: CreateSpaceActionListener.java Log Message: Space names now how to be unique when created Index: CreateSpaceActionListener.java =================================================================== RCS file: /cvsroot/bprocessor/gl/src/net/sourceforge/bprocessor/gl/tool/CreateSpaceActionListener.java,v retrieving revision 1.7 retrieving revision 1.8 diff -C2 -d -r1.7 -r1.8 *** CreateSpaceActionListener.java 5 Apr 2006 09:36:16 -0000 1.7 --- CreateSpaceActionListener.java 1 May 2006 10:05:58 -0000 1.8 *************** *** 13,16 **** --- 13,17 ---- import java.awt.event.ActionEvent; import java.awt.event.ActionListener; + import java.util.Iterator; *************** *** 37,40 **** --- 38,44 ---- private boolean functional; + /** The current category */ + private String category; + /** * CreateSpaceActionListener *************** *** 56,60 **** public void actionPerformed(ActionEvent e) { String result; ! String category = null; if (surface.getOwner() == Project.getInstance().world()) { category = "Space"; --- 60,64 ---- public void actionPerformed(ActionEvent e) { String result; ! category = null; if (surface.getOwner() == Project.getInstance().world()) { category = "Space"; *************** *** 64,76 **** if (functional) { ! result = JOptionPane.showInputDialog(GUI.getInstance(), "Name", "Create Functional " + category, ! JOptionPane.QUESTION_MESSAGE); } else { ! result = JOptionPane.showInputDialog(GUI.getInstance(), "Name", "Create Construction " + category, ! JOptionPane.QUESTION_MESSAGE); } if (log.isDebugEnabled()) { --- 68,81 ---- if (functional) { ! result = checkName(JOptionPane.showInputDialog(GUI.getInstance(), "Name", "Create Functional " + category, ! JOptionPane.QUESTION_MESSAGE)); ! } else { ! result = checkName(JOptionPane.showInputDialog(GUI.getInstance(), "Name", "Create Construction " + category, ! JOptionPane.QUESTION_MESSAGE)); } if (log.isDebugEnabled()) { *************** *** 98,100 **** --- 103,134 ---- } } + + /** + * checkName checks if the name entered is not used + * @param result the name to check for uniqueness + * @return res a unique and verified name + */ + private String checkName(String result) { + String res = result; + boolean used = false; + Iterator it = Project.getInstance().getSpaces().iterator(); + while (it.hasNext()) { + Space current = (Space) it.next(); + if (current.getName().equals(result)) { + res = JOptionPane.showInputDialog(GUI.getInstance(), + "Please enter a unique name", + "Create Functional " + category, + JOptionPane.QUESTION_MESSAGE); + used = true; + } + } + if (used) { + res = checkName(res); + } + return res; + } + + + + } |
From: rimestad <rim...@us...> - 2006-05-01 10:04:23
|
Update of /cvsroot/bprocessor/model/src/net/sourceforge/bprocessor/model In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv6755/src/net/sourceforge/bprocessor/model Modified Files: Surface.java Log Message: Added a controlled extrude method and a method to exchange a edge with another (should be moved to Edge at some point). To make the controlled extrude work the mothod call in extrudeTool have to be changed, there is no modifier way of using it yet Index: Surface.java =================================================================== RCS file: /cvsroot/bprocessor/model/src/net/sourceforge/bprocessor/model/Surface.java,v retrieving revision 1.93 retrieving revision 1.94 diff -C2 -d -r1.93 -r1.94 *** Surface.java 24 Apr 2006 08:45:48 -0000 1.93 --- Surface.java 1 May 2006 10:04:10 -0000 1.94 *************** *** 151,161 **** vertices.add(current); Edge edge = (Edge) iter.next(); current = edge.otherVertex(current); if (current == null) { ! throw new Error("other vertex null"); } } } else { ! throw new Error("first vertex null"); } } --- 151,162 ---- vertices.add(current); Edge edge = (Edge) iter.next(); + Vertex prev = current; current = edge.otherVertex(current); if (current == null) { ! throw new Error("other vertex that " + prev + " null in surface " + this); } } } else { ! throw new Error("first vertex null in Surface " + this); } } *************** *** 225,228 **** --- 226,287 ---- /** + * Replace one edge e1 and its vertices with e2's + * @param e1 The edge to replace + * @param e2 The replacing edge + */ + public void replace(Edge e1, Edge e2) { + //FIXME not tested enough to be trusted 100% + List lst = new ArrayList(); + Edge[] edges = new Edge[getEdges().size()]; + getEdges().toArray(edges); + for (int i = 0; i < edges.length; i++) { + if (edges[i] == e1) { + log.info("Found the edge " + edges[i]); + Edge prev; + Edge next; + if (i == 0) { + if (edges[edges.length - 1].contains(e1.getFrom())) { + prev = edges[edges.length - 1]; + next = edges[i + 1]; + } else { + next = edges[edges.length - 1]; + prev = edges[i + 1]; + } + } else { + if (edges[(i + 1) % edges.length].contains(e1.getTo())) { + next = edges[(i + 1) % edges.length]; + prev = edges[i - 1]; + } else { + next = edges[i - 1]; + prev = edges[(i + 1) % edges.length]; + } + } + if (prev.getFrom() == e1.getFrom()) { + prev.setFrom(e2.getTo()); + } else if (prev.getTo() == e1.getFrom()) { + prev.setTo(e2.getTo()); + } else { + log.info("AHHH1 prev:" + prev + ", e1:" + e1 + ", e2:" + e2); + } + if (next.getTo() == e1.getTo()) { + next.setTo(e2.getFrom()); + } else if (next.getFrom() == e1.getTo()) { + next.setFrom(e2.getFrom()); + } else { + log.info("AHHH2 next:" + next + ", e1:" + e1 + ", e2:" + e2); + } + log.info("Next were " + next); + log.info("Prev were " + prev); + log.info("Replaced with " + e2); + lst.add(e2); + } else { + log.info("Just reinserted edge " + edges[i]); + lst.add(edges[i]); + } + } + setEdges(lst); + } + + /** * Replace the edge with the edges * @param edge The original edge *************** *** 474,478 **** } - // FIXME should return the sides instead of assigning // spaces here. --- 533,536 ---- *************** *** 515,518 **** --- 573,789 ---- } + return top; + } + + /** + * Make the new vertices, edges and surfaces for extrusion + * @param delta the direction of extrusion + * @param sides Will contain the sides that are created + * @param e2e a edge to new extruded parallel edge map + * @param v2e a vertex to orthogonal edge map + * @param e2s a edge to extruded surface map + * @param v2dir a vertex to direction map + * @return The top in the extruded surface + */ + public Surface extrudeControlled(double delta, Set sides, Map e2e, Map v2e, Map e2s, Map v2dir) { + Vertex normal = normal(); + boolean makeNewTop = true; + List vertices = getVertices(); + + List edges = getEdges(); + + int n = vertices.size(); + + Vertex[] v = new Vertex[n]; + Edge[] e = new Edge[n]; + + + Vertex[] vmap = new Vertex[n]; + Edge[] topmap = new Edge[n]; + Edge[] sidemap = new Edge[n]; + Surface[] facemap = new Surface[n]; + + Surface top = null; + + vertices.toArray(v); + edges.toArray(e); + + for (int i = 0; i < n; i++) { + if (isFree(v[i])) { + if (v2dir.containsKey(v[i])) { + Direction d = (Direction)v2dir.get(v[i]); + vmap[i] = d.getVertex(); + d.alterDirection(normal); + } else { + vmap[i] = v[i].copy(); + v2dir.put(v[i], new Direction(vmap[i], normal)); + getOwner().add(vmap[i]); + } + } else { + // We just have to move the existing surface + makeNewTop = false; + if (v2dir.containsKey(v[i])) { + Direction d = (Direction)v2dir.get(v[i]); + vmap[i] = d.getVertex(); + d.alterDirection(normal); + } else { + vmap[i] = v[i]; + v2dir.put(v[i], new Direction(v[i], normal)); + } + } + } + + for (int i = 0; i < n; i++) { + if (e2e.containsKey(e[i])) { + topmap[i] = (Edge)e2e.get(e[i]); + } else { + if (vmap[i] == v[i] || vmap[(i + 1) % n] == v[(i + 1) % n]) { + topmap[i] = e[i]; + } else { + topmap[i] = new Edge(vmap[i], vmap[(i + 1) % n]); + getOwner().add(topmap[i]); + } + e2e.put(e[i], topmap[i]); + } + } + + List lst = new LinkedList(); + for (int i = 0; i < n; i++) { + if (v2e.containsKey(v[i])) { + sidemap[i] = (Edge)v2e.get(v[i]); + } else { + if (v[i] == vmap[i]) { + if (i != 0 && sidemap[i - 1] == null) { + lst.add(e[i - 1]); + } + sidemap[i] = null; + if (i == n - 1 && sidemap[0] == null) { + lst.add(e[n - 1]); + } + } else { + if (!makeNewTop) { + Collection newE = new LinkedList(); + if (vmap[(i + 1) % n] == v[(i + 1) % n] && + vmap[(i + n - 1) % n] == v[(i + n - 1) % n]) { + // both the parent and previous edge have to be split + newE = e[(i + n - 1) % n].split(vmap[i]); + newE.addAll(e[i].split(vmap[i])); + } else if (vmap[(i + 1) % n] == v[(i + 1) % n]) { + //it is the next edge that is supposed to be split + newE = e[i].split(vmap[i]); + } else if (vmap[(i + n - 1) % n] == v[(i + n - 1) % n]) { + //it is the previous edges that is supposed to be split + newE = e[(i + n - 1) % n].split(vmap[i]); + } else { + sidemap[i] = new Edge(v[i], vmap[i]); + + } + if (vmap[(i + n - 1) % n] != v[(i + n - 1) % n]) { + //we have to add the new top edge between the prev and this to the list + lst.add(topmap[(i + n - 1) % n]); + } + Iterator iter = newE.iterator(); + while (iter.hasNext()) { + Edge current = (Edge)iter.next(); + if (current.contains(v[i])) { + //FIXME SHOULD only be one edge but is sometimes two + sidemap[i] = current; + } else { + lst.add(current); + } + } + } else { + sidemap[i] = new Edge(v[i], vmap[i]); + lst.add(e[i]); + } + v2e.put(v[i], sidemap[i]); + getOwner().add(sidemap[i]); + } + } + } + this.setEdges(lst); + + for (int i = 0; i < n; i++) { + if (e2s.containsKey(e[i])) { + facemap[i] = (Surface)e2s.get(e[i]); + } else { + if (sidemap[i] == null || sidemap[(i + 1) % n] == null) { + // We should not make a new surface + } else { + Edge b = e[i]; + Edge r = sidemap[i]; + Edge l = sidemap[(i + 1) % n]; + Edge t = topmap[i]; + List newEdges = new LinkedList(); + newEdges.add(r); + newEdges.add(t); + newEdges.add(l); + newEdges.add(b); + facemap[i] = new Surface(newEdges); + e2s.put(b, facemap[i]); + getOwner().insert(facemap[i]); + sides.add(facemap[i]); + } + } + } + + if (makeNewTop) { + List newEdges = new LinkedList(); + for (int i = 0; i < n; i++) { + newEdges.add(topmap[n - i - 1]); + } + top = new Surface(newEdges); + getOwner().insert(top); + } else { + top = this; + } + + // FIXME should return the sides instead of assigning + // spaces here. + boolean flip = false; + + if (exterior != null) { + Vertex n0 = normal(); + Vertex n1 = exterior.normal(); + Vertex o = n0.add(n1); + if (o.isZero()) { + flip = true; + } + } + + if (!makeNewTop) { + // We have to assign the other way arround + delta = -delta; + } + for (int i = 0; i < n; i++) { + if (facemap[i] != null) { + if (delta < 0) { + facemap[i].setBackDomain(getBackDomain()); + if (exterior != null) { + if (flip) { + facemap[i].setFrontDomain(exterior.getFrontDomain()); + } else { + facemap[i].setFrontDomain(exterior.getBackDomain()); + } + } + } else { + facemap[i].setFrontDomain(getFrontDomain()); + if (exterior != null) { + if (flip) { + facemap[i].setBackDomain(exterior.getBackDomain()); + } else { + facemap[i].setBackDomain(exterior.getFrontDomain()); + } + } + } + } + } + if (makeNewTop) { + if (delta < 0) { + top.setBackDomain(getBackDomain()); + } else { + top.setFrontDomain(getFrontDomain()); + } + } return top; *************** *** 520,523 **** --- 791,820 ---- /** + * Check if the given vertex is free, that is + * 1) it is only part of the parent surface (this) + * 2) if it is part of more surfaces two of these have to be coplanar (this have to be one) + * @param vertex The vertex to check + * @return True if the vertex is bounded and false otherwise + */ + private boolean isFree(Vertex vertex) { + Set sur = vertex.getSurfaces(); + if (sur.size() > 1) { + // we have to do further checks + Iterator iter = sur.iterator(); + while (iter.hasNext()) { + Surface cur = (Surface)iter.next(); + log.info(vertex + " Saw " + cur); + if (cur != this && this.plane().contains(cur)) { + return true; + } + } + // if the while loop does not return then return false + return false; + } else { + return true; + } + } + + /** * Adds a hole surface to this surface. * @param hole the hole to add. |
From: rimestad <rim...@us...> - 2006-05-01 09:59:12
|
Update of /cvsroot/bprocessor/gl/src/net/sourceforge/bprocessor/gl/tool In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv2342/src/net/sourceforge/bprocessor/gl/tool Modified Files: MultiExtrudeTool.java Log Message: Changed the tool to use abstract pencil instead of abstracttool. Ther are still many fixes to be made Index: MultiExtrudeTool.java =================================================================== RCS file: /cvsroot/bprocessor/gl/src/net/sourceforge/bprocessor/gl/tool/MultiExtrudeTool.java,v retrieving revision 1.16 retrieving revision 1.17 diff -C2 -d -r1.16 -r1.17 *** MultiExtrudeTool.java 19 Apr 2006 16:16:25 -0000 1.16 --- MultiExtrudeTool.java 1 May 2006 09:59:00 -0000 1.17 *************** *** 9,17 **** import java.awt.Cursor; - import java.awt.event.KeyEvent; import java.awt.event.MouseEvent; import java.util.Collection; import java.util.HashMap; import java.util.HashSet; import java.util.Map; import java.util.Set; --- 9,18 ---- import java.awt.Cursor; import java.awt.event.MouseEvent; import java.util.Collection; import java.util.HashMap; import java.util.HashSet; + import java.util.LinkedList; + import java.util.Map; import java.util.Set; *************** *** 21,29 **** import net.sourceforge.bprocessor.gl.GLView; ! import net.sourceforge.bprocessor.gl.view.Transformation; ! import net.sourceforge.bprocessor.gl.view.View; import net.sourceforge.bprocessor.model.Direction; - import net.sourceforge.bprocessor.model.Edge; - import net.sourceforge.bprocessor.model.Plane; import net.sourceforge.bprocessor.model.Project; import net.sourceforge.bprocessor.model.Selection; --- 22,27 ---- import net.sourceforge.bprocessor.gl.GLView; ! import net.sourceforge.bprocessor.gl.model.Intersection; import net.sourceforge.bprocessor.model.Direction; import net.sourceforge.bprocessor.model.Project; import net.sourceforge.bprocessor.model.Selection; *************** *** 34,43 **** * The ExtrudeTool */ ! public class MultiExtrudeTool extends AbstractTool { /** The logger */ private static Logger log = Logger.getLogger(MultiExtrudeTool.class); ! /** The dragSurface and extrudeSurface */ ! private Surface top, extrudeSurface; /** The surfaces to extrude */ --- 32,41 ---- * The ExtrudeTool */ ! public class MultiExtrudeTool extends AbstractPencil { /** The logger */ private static Logger log = Logger.getLogger(MultiExtrudeTool.class); ! /** The extrudeSurface */ ! private Surface extrudeSurface; /** The surfaces to extrude */ *************** *** 46,55 **** /** A vertex-direction map */ private Map v2dir; - - /** The Plane to draw in */ - private Plane dragPlane; - - /** The previous coordinate */ - private int pressX, pressY; /** The previous position of the drag */ --- 44,47 ---- *************** *** 61,70 **** /** The extrusion direction */ private double direction = 0.0; - - /** The length of the extrusion */ - private String number; - - /** The normal to drag along */ - private Vertex normal; /** --- 53,56 ---- *************** *** 75,79 **** --- 61,72 ---- public MultiExtrudeTool(GLView glv, Cursor cursor) { super(glv, cursor); + start = null; + t = 0; number = ""; + extrudeSurface = null; + direction = 0.0; + v2dir = null; + elements = new HashSet(); + surfaces = new HashSet(); } *************** *** 83,112 **** */ protected void pressed(MouseEvent e) { ! findTarget(e); ! t = 0; ! number = ""; ! extrudeSurface = null; ! direction = 0.0; ! normal = null; ! cleanUp(); ! if (target instanceof Surface) { ! if (Selection.primary().isEmpty() || Selection.primary().contains(target)) { ! extrudeSurface = (Surface)target; ! surfaces.addAll(Selection.primary()); ! surfaces.add(extrudeSurface); ! View view = glv.getView(); ! Transformation trans = view.transformation(); ! pressX = e.getX(); ! pressY = e.getY(); ! double x = pressX; ! double y = View.getHeight() - pressY; ! 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); ! normal = extrudeSurface.normal().copy(); ! normal.scale(-1); } } } --- 76,101 ---- */ protected void pressed(MouseEvent e) { ! if (start == null) { ! start = current; ! if (current.type() == Intersection.SURFACE) { ! Surface target = (Surface)current.object(); ! if (Selection.primary().isEmpty() || Selection.primary().contains(target)) { ! extrudeSurface = (Surface)target; ! surfaces.addAll(Selection.primary()); ! surfaces.add(extrudeSurface); ! Vertex normal = extrudeSurface.normal().copy(); ! normal.scale(-1); ! lock = true; ! locked = normal; ! } } + } else { + if (v2dir != null && Math.abs(t) < 0.1) { + deleteExtrusion(); + return; + } else if (v2dir != null) { + finishExtrusion(); + } + cleanUp(); } } *************** *** 117,209 **** */ protected void dragged(MouseEvent e) { ! if (extrudeSurface != null) { ! // it is possible to make an extrusion find the direction ! View view = glv.getView(); ! Vertex from = view.toPlaneCoords(new double[] {pressX, pressY}, dragPlane); ! Vertex to = view.toPlaneCoords(new double[] {e.getX(), e.getY()}, dragPlane); ! double normDotDelta = 0.0; ! if (to != null && from != null) { ! Vertex delta = to.minus(from); ! normDotDelta = normal.dot(delta); ! } ! if (v2dir == null) { ! direction = normDotDelta; ! elements = makeExtrusion(); ! } ! if (v2dir != null) { ! // The extrusion were succesfull move it ! // Find the move direction ! Set ignore = new HashSet(); ! if (elements != null) { ! ignore.addAll(elements); ! Iterator iter = elements.iterator(); ! while (iter.hasNext()) { ! Surface sur = (Surface)iter.next(); ! ignore.addAll(sur.getEdges()); ! } ! } ! ignore.add(extrudeSurface); ! ignore.removeAll(extrudeSurface.getEdges()); ! findTarget(e, ignore); ! if (target != null) { ! if (target instanceof Surface) { ! //If there are a target that is a surface drag to that surface ! Vertex origin = extrudeSurface.getFirstVertex(); ! Surface current = (Surface) target; ! if (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); ! moveTo(v2dir.values(), d); ! } ! } ! } else if (target instanceof Edge) { ! Edge tar = (Edge)target; ! Vertex ver = (tar).center(); ! Vertex origin = extrudeSurface.getFirstVertex(); ! if (!ignore.contains(tar)) { ! Vertex vector = ver.minus(origin); ! double d = vector.dot(normal); ! moveTo(v2dir.values(), d); ! } ! } ! } else { ! // otherwise do a normal extrude ! if (direction * normDotDelta > 0) { ! // the extrusion is still in the same direction ! moveTo(v2dir.values(), normDotDelta); ! } else { ! // we have to remove the extrusion and make a new one ! direction = normDotDelta; ! remove(elements); ! elements = makeExtrusion(); ! if (v2dir != null) { ! moveTo(v2dir.values(), normDotDelta); ! } ! } ! } ! } ! } } /** ! * Remove all the created extrusion elements ! * @param elem The elements to remove */ ! private void remove(Set elem) { ! if (elem != null) { ! Iterator iter = elem.iterator(); ! while (iter.hasNext()) { ! Object o = iter.next(); ! if (o instanceof Surface) { ! ((Surface)o).delete(); ! } ! } ! cleanUp(); ! } } /** --- 106,139 ---- */ protected void dragged(MouseEvent e) { ! current = findIntersection(e); ! makeTarget(current); } /** ! * Deletes the extrusion ! * */ ! private void deleteExtrusion() { ! excluded(new LinkedList()); ! Project.getInstance().undo(); ! cleanUp(); } + // + // /** + // * Remove all the created extrusion elements + // * @param elem The elements to remove + // */ + // private void remove(Set elem) { + // if (elem != null) { + // Iterator iter = elem.iterator(); + // while (iter.hasNext()) { + // Object o = iter.next(); + // if (o instanceof Surface) { + // ((Surface)o).delete(); + // } + // } + // cleanUp(); + // } + // } /** *************** *** 211,218 **** */ public void cleanUp() { ! top = null; v2dir = null; elements = new HashSet(); surfaces = new HashSet(); } --- 141,153 ---- */ public void cleanUp() { ! start = null; ! t = 0; ! number = ""; ! extrudeSurface = null; ! direction = 0.0; v2dir = null; elements = new HashSet(); surfaces = new HashSet(); + super.cleanUp(); } *************** *** 224,229 **** while (iter.hasNext()) { Surface current = (Surface) iter.next(); ! holeAnalysis(current); } Project.getInstance().changed(Project.getInstance()); Project.getInstance().checkpoint(); --- 159,167 ---- while (iter.hasNext()) { Surface current = (Surface) iter.next(); ! if (current != null) { ! holeAnalysis(current); ! } } + cleanUp(); Project.getInstance().changed(Project.getInstance()); Project.getInstance().checkpoint(); *************** *** 254,279 **** */ protected void released(MouseEvent e) { - findTarget(e); - if (top != null && Math.abs(t) < 0.1) { - remove(elements); - return; - } else if (v2dir != null) { - finishExtrusion(); - } } /** ! * 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 Map e2s = new HashMap(); // edge to surface map --- 192,206 ---- */ protected void released(MouseEvent e) { } /** ! * Make the extrusion from the given list of surfaces ! * @param c The collection of surfaces to extrude ! * @param direction The direction to extrude in ! * @return True if the surface were extruded */ ! private boolean makeExtrusion(Collection c, double direction) { ! Project.getInstance().checkpoint(); ! elements = new HashSet(); Map e2e = new HashMap(); // edge to edge map Map e2s = new HashMap(); // edge to surface map *************** *** 285,289 **** while (iter.hasNext()) { if (!(iter.next() instanceof Surface)) { ! return null; } } --- 212,216 ---- while (iter.hasNext()) { if (!(iter.next() instanceof Surface)) { ! return false; } } *************** *** 292,303 **** Surface cur = (Surface)iter.next(); Surface s = cur.extrude(-direction, elements, e2e, v2e, e2s, v2dir); - if (cur == extrudeSurface) { - // Set the top to the extruded surface of target - top = s; - } elements.add(s); } t = 0; ! return elements; } --- 219,226 ---- Surface cur = (Surface)iter.next(); Surface s = cur.extrude(-direction, elements, e2e, v2e, e2s, v2dir); elements.add(s); } t = 0; ! return true; } *************** *** 306,410 **** */ protected void moved(MouseEvent e) { ! findTarget(e); ! if (target instanceof Surface) { ! glv.getView().makeTarget(target); ! } else { ! glv.getView().makeTarget(null); } } /** ! * Log an object ! * @param message Object to log */ ! public static void info(Object message) { ! log.info(message); } /** ! * Apply extrusion ! * @param length The length */ ! private void apply(double length) { ! if (length != 0.0 && extrudeSurface != null) { ! if (direction * length <= 0.0) { ! direction = length; ! log.info("Changed dir to: " + direction); ! remove(elements); ! cleanUp(); ! } if (v2dir != null) { moveTo(v2dir.values(), length); } else { ! elements = makeExtrusion(); moveTo(v2dir.values(), length); } finishExtrusion(); - } else { - remove(elements); - cleanUp(); } } ! /** ! * 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_MINUS) { ! if (number.equals("")) { ! number += "-"; ! } ! } else if (e.getKeyCode() == KeyEvent.VK_ENTER) { ! if (!number.equals("")) { ! double length = glv.getLength(); ! apply(length); ! glv.repaint(); ! number = ""; ! } ! } 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); ! } } --- 229,352 ---- */ protected void moved(MouseEvent e) { ! current = findIntersection(e); ! makeTarget(current); ! if (start != null) { ! // do the shit ! modifyExtrusion(); } } /** ! * Do the appropiate changes to the extrusion */ ! private void modifyExtrusion() { ! if (extrudeSurface != null) { ! // it is possible to make an extrusion find the direction ! Vertex from = start.vertex(); ! Vertex to = current.vertex(); ! double normDotDelta = 0.0; ! if (to != null && from != null) { ! Vertex delta = to.minus(from); ! normDotDelta = -extrudeSurface.normal().dot(delta); ! } ! if (v2dir == null) { ! direction = normDotDelta; ! makeExtrusion(surfaces, direction); ! } ! if (v2dir != null) { ! // The extrusion were succesfull move it ! if (normDotDelta * direction < 0) { ! direction = normDotDelta; ! deleteExtrusion(); ! makeExtrusion(surfaces, direction); ! } ! moveTo(v2dir.values(), normDotDelta); ! } ! } } /** ! * Called when enter have been pressed */ ! public void onVertex() { ! if (start != null && current != null) { ! double length = (current.vertex().minus(start.vertex())).length(); if (v2dir != null) { + if (direction * length < 0) { + //the direction have changed + direction = length; + deleteExtrusion(); + makeExtrusion(surfaces, direction); + } moveTo(v2dir.values(), length); } else { ! direction = length; ! makeExtrusion(surfaces, direction); moveTo(v2dir.values(), length); } finishExtrusion(); } } ! // /** ! // * 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_MINUS) { ! // if (number.equals("")) { ! // number += "-"; ! // } ! // } else if (e.getKeyCode() == KeyEvent.VK_ENTER) { ! // if (!number.equals("")) { ! // double length = glv.getLength(); ! // apply(length); ! // glv.repaint(); ! // number = ""; ! // } ! // } 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: rimestad <rim...@us...> - 2006-05-01 09:58:19
|
Update of /cvsroot/bprocessor/gl/src/net/sourceforge/bprocessor/gl/tool In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv1492/src/net/sourceforge/bprocessor/gl/tool Modified Files: AbstractPencil.java Log Message: Made some small corrections in the code only estectic ones Index: AbstractPencil.java =================================================================== RCS file: /cvsroot/bprocessor/gl/src/net/sourceforge/bprocessor/gl/tool/AbstractPencil.java,v retrieving revision 1.24 retrieving revision 1.25 diff -C2 -d -r1.24 -r1.25 *** AbstractPencil.java 19 Apr 2006 16:13:54 -0000 1.24 --- AbstractPencil.java 1 May 2006 09:58:02 -0000 1.25 *************** *** 215,221 **** */ public void insertEdges(List edges) { - - - if (!edges.isEmpty()) { Vertex from = ((Edge) edges.get(0)).getFrom(); --- 215,218 ---- *************** *** 685,689 **** */ public void cleanUp() { ! plane = new Plane(0, 0, 1, 0);; start = null; current = null; --- 682,686 ---- */ public void cleanUp() { ! plane = new Plane(0, 0, 1, 0); start = null; current = null; *************** *** 691,694 **** --- 688,692 ---- constructors(new LinkedList()); feedback(new LinkedList()); + excluded(new LinkedList()); number = ""; glv.repaint(); |
From: rimestad <rim...@us...> - 2006-05-01 09:55:24
|
Update of /cvsroot/bprocessor/model/src/net/sourceforge/bprocessor/model In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv32078/src/net/sourceforge/bprocessor/model Modified Files: Space.java Log Message: remove of surface now update the information in the holes as well. Index: Space.java =================================================================== RCS file: /cvsroot/bprocessor/model/src/net/sourceforge/bprocessor/model/Space.java,v retrieving revision 1.27 retrieving revision 1.28 diff -C2 -d -r1.27 -r1.28 *** Space.java 21 Apr 2006 15:24:28 -0000 1.27 --- Space.java 1 May 2006 09:55:15 -0000 1.28 *************** *** 514,517 **** --- 514,528 ---- */ public void remove(Surface surface) { + if (surface.getHoles() != null) { + Iterator iter = surface.getHoles().iterator(); + while (iter.hasNext()) { + Surface curHole = (Surface)iter.next(); + if (surface.getExterior() != null) { + surface.getExterior().addHole(curHole); + } else { + curHole.setExterior(null); + } + } + } if (surface.getExterior() != null) { Surface exterior = surface.getExterior(); |
From: rimestad <rim...@us...> - 2006-05-01 09:53:44
|
Update of /cvsroot/bprocessor/model/src/net/sourceforge/bprocessor/model In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv30791a/src/net/sourceforge/bprocessor/model Modified Files: Edge.java Log Message: Changed split so that it returns the two edges that the edge have been split into Index: Edge.java =================================================================== RCS file: /cvsroot/bprocessor/model/src/net/sourceforge/bprocessor/model/Edge.java,v retrieving revision 1.44 retrieving revision 1.45 diff -C2 -d -r1.44 -r1.45 *** Edge.java 5 Apr 2006 10:23:22 -0000 1.44 --- Edge.java 1 May 2006 09:53:39 -0000 1.45 *************** *** 309,314 **** * accordingly. * @param vertex The vertex */ ! public void split(Vertex vertex) { // FIXME Why not split a constructor? if (!constructor) { --- 309,316 ---- * accordingly. * @param vertex The vertex + * @return a list containing the two new edges */ ! public Collection split(Vertex vertex) { ! List added = new ArrayList(); // FIXME Why not split a constructor? if (!constructor) { *************** *** 317,322 **** --- 319,326 ---- Edge e1 = new Edge(from, vertex); getOwner().add(e1); + added.add(e1); Edge e2 = new Edge(vertex, to); getOwner().add(e2); + added.add(e2); *************** *** 329,332 **** --- 333,337 ---- getOwner().remove(this); } + return added; } |
From: Michael L. <he...@us...> - 2006-04-28 11:29:18
|
Update of /cvsroot/bprocessor/build In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv31116 Modified Files: build.xml Log Message: Changed all build.xml files to compile using options -source 1.3 -target 1.2 to ensure that the compiled code can execute in 1.4.2 runtime environment Index: build.xml =================================================================== RCS file: /cvsroot/bprocessor/build/build.xml,v retrieving revision 1.16 retrieving revision 1.17 diff -C2 -d -r1.16 -r1.17 *** build.xml 5 Apr 2006 14:13:59 -0000 1.16 --- build.xml 28 Apr 2006 11:29:16 -0000 1.17 *************** *** 3,7 **** <target name="init"> <property name="project" value="bprocessor"/> ! <property name="version" value="M5"/> <property name="script.dir" value="${basedir}/bin"/> --- 3,7 ---- <target name="init"> <property name="project" value="bprocessor"/> ! <property name="version" value="M5-development"/> <property name="script.dir" value="${basedir}/bin"/> |
From: Michael L. <he...@us...> - 2006-04-28 11:29:15
|
Update of /cvsroot/bprocessor/gl/src In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv31081/src Modified Files: build.xml Log Message: Changed all build.xml files to compile using options -source 1.3 -target 1.2 to ensure that the compiled code can execute in 1.4.2 runtime environment Index: build.xml =================================================================== RCS file: /cvsroot/bprocessor/gl/src/build.xml,v retrieving revision 1.1.1.1 retrieving revision 1.2 diff -C2 -d -r1.1.1.1 -r1.2 *** build.xml 14 Jul 2005 09:49:59 -0000 1.1.1.1 --- build.xml 28 Apr 2006 11:29:12 -0000 1.2 *************** *** 14,18 **** <target name="compile" depends="dep"> <javac srcdir="${src.dir}" destdir="${build.dir}" deprecation="yes" ! debug="yes" includes="net/**"> <classpath refid="build.path"/> --- 14,18 ---- <target name="compile" depends="dep"> <javac srcdir="${src.dir}" destdir="${build.dir}" deprecation="yes" ! debug="yes" target="1.2" source="1.3" includes="net/**"> <classpath refid="build.path"/> |
From: Michael L. <he...@us...> - 2006-04-28 11:29:13
|
Update of /cvsroot/bprocessor/model/src In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv31025/src Modified Files: build.xml Log Message: Changed all build.xml files to compile using options -source 1.3 -target 1.2 to ensure that the compiled code can execute in 1.4.2 runtime environment Index: build.xml =================================================================== RCS file: /cvsroot/bprocessor/model/src/build.xml,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** build.xml 23 Mar 2006 12:24:03 -0000 1.5 --- build.xml 28 Apr 2006 11:29:09 -0000 1.6 *************** *** 15,19 **** <target name="compile" depends="dep"> <javac srcdir="${src.dir}" destdir="${build.dir}" deprecation="yes" ! debug="yes" includes="net/**"> <classpath refid="build.path"/> --- 15,19 ---- <target name="compile" depends="dep"> <javac srcdir="${src.dir}" destdir="${build.dir}" deprecation="yes" ! debug="yes" target="1.2" source="1.3" includes="net/**"> <classpath refid="build.path"/> |
From: Michael L. <he...@us...> - 2006-04-28 11:29:12
|
Update of /cvsroot/bprocessor/model In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv31025 Modified Files: build.xml Log Message: Changed all build.xml files to compile using options -source 1.3 -target 1.2 to ensure that the compiled code can execute in 1.4.2 runtime environment Index: build.xml =================================================================== RCS file: /cvsroot/bprocessor/model/build.xml,v retrieving revision 1.11 retrieving revision 1.12 diff -C2 -d -r1.11 -r1.12 *** build.xml 23 Mar 2006 12:24:02 -0000 1.11 --- build.xml 28 Apr 2006 11:29:09 -0000 1.12 *************** *** 80,84 **** </xjc> <javac srcdir="${build.dir}" destdir="${build.dir}" deprecation="yes" ! debug="yes" includes="net/**"> <classpath> --- 80,84 ---- </xjc> <javac srcdir="${build.dir}" destdir="${build.dir}" deprecation="yes" ! debug="yes" target="1.2" source="1.3" includes="net/**"> <classpath> |