bprocessor-commit Mailing List for B-processor (Page 122)
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: rimestad <rim...@us...> - 2006-05-18 14:25:26
|
Update of /cvsroot/bprocessor/gl/src/net/sourceforge/bprocessor/gl/model In directory sc8-pr-cvs3.sourceforge.net:/tmp/cvs-serv24428/src/net/sourceforge/bprocessor/gl/model Modified Files: ClippingPlane.java Log Message: Calculate the silluete of cut surfaces and saves it in a list which can be fetched by getLines() Index: ClippingPlane.java =================================================================== RCS file: /cvsroot/bprocessor/gl/src/net/sourceforge/bprocessor/gl/model/ClippingPlane.java,v retrieving revision 1.8 retrieving revision 1.9 diff -C2 -d -r1.8 -r1.9 *** ClippingPlane.java 13 Apr 2006 13:52:26 -0000 1.8 --- ClippingPlane.java 18 May 2006 14:25:23 -0000 1.9 *************** *** 15,18 **** --- 15,19 ---- import net.sourceforge.bprocessor.model.CoordinateSystem; import net.sourceforge.bprocessor.model.Plane; + import net.sourceforge.bprocessor.model.Surface; import net.sourceforge.bprocessor.model.Vertex; import net.sourceforge.bprocessor.model.Edge; *************** *** 41,44 **** --- 42,48 ---- private ArrayList corners; + /** The silluet */ + private ArrayList silluet; + /** * The constructor *************** *** 114,126 **** public Collection findIntersections() { Collection edges = Project.getInstance().getEdges(); Collection res = new ArrayList(); Iterator it = edges.iterator(); while (it.hasNext()) { Edge e = (Edge)it.next(); ! Vertex v = plane.intersection(e); if (v != null) { res.add(v); } } return res; } --- 118,154 ---- public Collection findIntersections() { Collection edges = Project.getInstance().getEdges(); + silluet = new ArrayList(); Collection res = new ArrayList(); Iterator it = edges.iterator(); while (it.hasNext()) { Edge e = (Edge)it.next(); ! Vertex v = plane.intersection(e); if (v != null) { res.add(v); } } + Collection surfaces = Project.getInstance().getSurfaces(); + it = surfaces.iterator(); + while (it.hasNext()) { + Surface s = (Surface)it.next(); + Collection lines = s.getEdges(); + Iterator iter = lines.iterator(); + Vertex first = null; + while (iter.hasNext()) { + Edge e = (Edge)iter.next(); + Vertex v = plane.intersection(e); + if (v != null) { + if (first == null) { + first = v; + } else { + Edge newE = new Edge(first, v); + newE.setConstructor(true); + first = null; + silluet.add(newE); + break; + } + } + } + } return res; } *************** *** 220,222 **** --- 248,258 ---- return "[" + p[0] + ", " + p[1] + ", " + p[2] + ", " + p[3] + "]"; } + + /** + * Gettter for the intersected geometry + * @return The intersection edges + */ + public Collection getLines() { + return silluet; + } } |
From: rimestad <rim...@us...> - 2006-05-18 14:24:18
|
Update of /cvsroot/bprocessor/gl/src/net/sourceforge/bprocessor/gl/view In directory sc8-pr-cvs3.sourceforge.net:/tmp/cvs-serv24013/src/net/sourceforge/bprocessor/gl/view Modified Files: View.java Log Message: Changed the way clipplanes is drawn so that the edges cutting the geometry is rendered as well... now drawing of clipplanse always uses drawClipplanes and not drawClipplaneFrame (due to the clippingplane now drawn as filled) added clipplane as possible target Index: View.java =================================================================== RCS file: /cvsroot/bprocessor/gl/src/net/sourceforge/bprocessor/gl/view/View.java,v retrieving revision 1.90 retrieving revision 1.91 diff -C2 -d -r1.90 -r1.91 *** View.java 15 May 2006 12:09:39 -0000 1.90 --- View.java 18 May 2006 14:24:11 -0000 1.91 *************** *** 518,522 **** ClippingPlane cp = (ClippingPlane)clipit.next(); // draw the clipping planes ! drawClipplane(cp); } --- 518,532 ---- ClippingPlane cp = (ClippingPlane)clipit.next(); // draw the clipping planes ! Collection selection = glv.getTool().getSelection(); ! if (cp == target) { ! drawObject(cp); ! } else { ! if (selection.contains(cp)) { ! gl.glColor3fv(SELECTED_COLOR); ! } else { ! gl.glColor3fv(CLIP_PLANE_COLOR); ! } ! drawClipplane(cp); ! } } *************** *** 850,853 **** --- 860,868 ---- drawSurface(s); gl.glDisable(GL.GL_POLYGON_STIPPLE); + } else if (o instanceof ClippingPlane) { + gl.glDisable(GL.GL_DEPTH_TEST); + ClippingPlane cp = (ClippingPlane) o; + drawClipplane(cp); + gl.glEnable(GL.GL_DEPTH_TEST); } } *************** *** 1429,1433 **** ClippingPlane cp = (ClippingPlane)it.next(); pushName(gl, cp); ! drawClipplaneFrame(cp); popName(gl); } --- 1444,1448 ---- ClippingPlane cp = (ClippingPlane)it.next(); pushName(gl, cp); ! drawClipplane(cp); popName(gl); } *************** *** 1466,1478 **** */ private void drawClipplane(ClippingPlane clipplane) { - Collection selection = glv.getTool().getSelection(); - double[] d = clipplane.getPlane().getDoublev(); Collection corners = clipplane.getCorners(); { - if (selection.contains(clipplane)) { - gl.glColor3fv(SELECTED_COLOR); - } else { - gl.glColor3fv(CLIP_PLANE_COLOR); - } gl.glLineWidth(2.0f); gl.glBegin(GL.GL_LINE_STRIP); --- 1481,1486 ---- *************** *** 1490,1493 **** --- 1498,1507 ---- gl.glEnd(); } + Collection lines = clipplane.getLines(); + Iterator it = lines.iterator(); + while (it.hasNext()) { + Edge e = (Edge)it.next(); + drawConstructor(e); + } } |
From: Nordholt <nor...@us...> - 2006-05-17 17:20:46
|
Update of /cvsroot/bprocessor/gl/src/net/sourceforge/bprocessor/gl/tool In directory sc8-pr-cvs3.sourceforge.net:/tmp/cvs-serv18516 Modified Files: ToolFactory.java Log Message: added buttons for the zoom to entire model and orthogonal/persoective view Index: ToolFactory.java =================================================================== RCS file: /cvsroot/bprocessor/gl/src/net/sourceforge/bprocessor/gl/tool/ToolFactory.java,v retrieving revision 1.42 retrieving revision 1.43 diff -C2 -d -r1.42 -r1.43 *** ToolFactory.java 26 Apr 2006 15:29:56 -0000 1.42 --- ToolFactory.java 17 May 2006 17:20:41 -0000 1.43 *************** *** 10,13 **** --- 10,16 ---- import net.sourceforge.bprocessor.gui.Toolbar; + import net.sourceforge.bprocessor.model.Camera; + import net.sourceforge.bprocessor.model.Project; + import java.net.URL; import java.util.HashMap; *************** *** 212,215 **** --- 215,242 ---- flyBut = this.registerTool(Tool.FLY_TOOL, fly, "Biconfly.gif", "Fly"); walkBut = this.registerTool(Tool.WALK_TOOL, walk, "Biconwalk.gif", "Walk"); + + tb.addSeparator(); + + Action zoomAction = new AbstractAction("Zoom to model") { + public void actionPerformed(ActionEvent agr0) { + Project.getInstance().getCurrentCamera().viewEntireModel(); + } + }; + + Action orthoAction = new AbstractAction("Orthogonal view") { + public void actionPerformed(ActionEvent agr0) { + Project.getInstance().getCurrentCamera().setType(Camera.ORTHOGRAPHIC); + } + }; + Action perspAction = new AbstractAction("Perspective view") { + public void actionPerformed(ActionEvent agr0) { + Project.getInstance().getCurrentCamera().setType(Camera.PERSPECTIVE); + } + }; + + Toolbar.getInstance().registerAction(zoomAction); + ButtonGroup viewGroup = new ButtonGroup(); + viewGroup.add(Toolbar.getInstance().registerAction(orthoAction)); + viewGroup.add(Toolbar.getInstance().registerAction(perspAction)); } |
From: Nordholt <nor...@us...> - 2006-05-17 17:11:44
|
Update of /cvsroot/bprocessor/model/src/net/sourceforge/bprocessor/model In directory sc8-pr-cvs3.sourceforge.net:/tmp/cvs-serv14953 Modified Files: Camera.java Log Message: method to zoom out to view the entire model Index: Camera.java =================================================================== RCS file: /cvsroot/bprocessor/model/src/net/sourceforge/bprocessor/model/Camera.java,v retrieving revision 1.13 retrieving revision 1.14 diff -C2 -d -r1.13 -r1.14 *** Camera.java 11 Feb 2006 15:02:21 -0000 1.13 --- Camera.java 17 May 2006 17:11:41 -0000 1.14 *************** *** 10,13 **** --- 10,14 ---- import java.util.Iterator; import java.util.List; + import java.util.Set; import org.apache.log4j.Logger; *************** *** 388,391 **** --- 389,423 ---- /** + * Moves the camera to a position where the entire model is visible. + */ + public void viewEntireModel() { + Set allVertices = Project.getInstance().world().collect(); + if (!allVertices.isEmpty()) { + Vertex modelCenter = Project.getInstance().world().center(); + Iterator it = allVertices.iterator(); + double maxDistance = 0; + while (it.hasNext()) { + Vertex v = (Vertex) it.next(); + double distance = v.minus(modelCenter).length(); + if (distance > maxDistance) { + maxDistance = distance; + } + } + double cameraDistance = + maxDistance / Math.tan(Math.toRadians((this.getFocalwidth() / 2))); + Vertex cameraPos = new Vertex(1, 1, 1); + cameraPos.scale(cameraDistance / cameraPos.length()); + cameraPos = cameraPos.add(modelCenter); + setCenter(new double[] {modelCenter.getX(), + modelCenter.getY(), + modelCenter.getZ()}); + setCamera(new double[] {cameraPos.getX(), + cameraPos.getY(), + cameraPos.getZ()}); + setRoll(new double[] {-1, -1, 1}); + } + } + + /** * Print camera * @return String |
From: Nordholt <nor...@us...> - 2006-05-17 17:05:49
|
Update of /cvsroot/bprocessor/model/src/net/sourceforge/bprocessor/model In directory sc8-pr-cvs3.sourceforge.net:/tmp/cvs-serv12470 Modified Files: Space.java Log Message: fixed up the names of copied spaces Index: Space.java =================================================================== RCS file: /cvsroot/bprocessor/model/src/net/sourceforge/bprocessor/model/Space.java,v retrieving revision 1.35 retrieving revision 1.36 diff -C2 -d -r1.35 -r1.36 *** Space.java 17 May 2006 12:20:39 -0000 1.35 --- Space.java 17 May 2006 17:05:45 -0000 1.36 *************** *** 1078,1082 **** while (it.hasNext()) { Space sp = (Space)it.next(); - //make prettier if (sp != sp.getOwner().getEmpty()) { Space newSpace = sp.copy(copiedVertices, --- 1078,1081 ---- *************** *** 1086,1090 **** copiedSpaces.put(sp, newSpace); copy.add(newSpace); ! copy.setName(copy.getName() + "::" + copy.getId()); } } --- 1085,1089 ---- copiedSpaces.put(sp, newSpace); copy.add(newSpace); ! copy.setName(copy.getName()); } } |
From: Nikolaj B. <nbr...@us...> - 2006-05-17 12:20:57
|
Update of /cvsroot/bprocessor/model/src/net/sourceforge/bprocessor/model In directory sc8-pr-cvs3.sourceforge.net:/tmp/cvs-serv11495/src/net/sourceforge/bprocessor/model Modified Files: Surface.java Space.java Log Message: Att view now corretly shows if its space, element or a part surface that is seleceted. Index: Surface.java =================================================================== RCS file: /cvsroot/bprocessor/model/src/net/sourceforge/bprocessor/model/Surface.java,v retrieving revision 1.96 retrieving revision 1.97 diff -C2 -d -r1.96 -r1.97 *** Surface.java 15 May 2006 09:21:32 -0000 1.96 --- Surface.java 17 May 2006 12:20:39 -0000 1.97 *************** *** 1354,1358 **** */ public String getGeneralName() { ! return "Surface"; } } --- 1354,1366 ---- */ public String getGeneralName() { ! if (getOwner() == Project.getInstance().world()) { ! return "Space Surface"; ! } ! ! if (getOwner().getOwner() == Project.getInstance().world()) { ! return "Element Surface"; ! } else { ! return "Part Surface"; ! } } } Index: Space.java =================================================================== RCS file: /cvsroot/bprocessor/model/src/net/sourceforge/bprocessor/model/Space.java,v retrieving revision 1.34 retrieving revision 1.35 diff -C2 -d -r1.34 -r1.35 *** Space.java 17 May 2006 12:04:05 -0000 1.34 --- Space.java 17 May 2006 12:20:39 -0000 1.35 *************** *** 952,956 **** ArrayList res = new ArrayList(); res.add(new Attribute("Name", getName())); ! res.add(new Attribute("ID", getId().toString())); res.add(new Attribute("Description", getDescription())); return res; --- 952,956 ---- ArrayList res = new ArrayList(); res.add(new Attribute("Name", getName())); ! res.add(new Attribute("ID", getId().toString(), false)); res.add(new Attribute("Description", getDescription())); return res; |
From: Nikolaj B. <nbr...@us...> - 2006-05-17 12:04:16
|
Update of /cvsroot/bprocessor/model/src/net/sourceforge/bprocessor/model In directory sc8-pr-cvs3.sourceforge.net:/tmp/cvs-serv918/src/net/sourceforge/bprocessor/model Modified Files: Space.java Log Message: Fixed the sorting. Index: Space.java =================================================================== RCS file: /cvsroot/bprocessor/model/src/net/sourceforge/bprocessor/model/Space.java,v retrieving revision 1.33 retrieving revision 1.34 diff -C2 -d -r1.33 -r1.34 *** Space.java 15 May 2006 12:14:26 -0000 1.33 --- Space.java 17 May 2006 12:04:05 -0000 1.34 *************** *** 513,516 **** --- 513,518 ---- } + + /** * Add a surface |
From: Nikolaj B. <nbr...@us...> - 2006-05-17 12:04:00
|
Update of /cvsroot/bprocessor/gui/src/net/sourceforge/bprocessor/gui/treeview In directory sc8-pr-cvs3.sourceforge.net:/tmp/cvs-serv578/src/net/sourceforge/bprocessor/gui/treeview Modified Files: GenericTreeView.java SpaceTreeView.java SurfaceTreeView.java Log Message: Fixed the sorting. Index: SurfaceTreeView.java =================================================================== RCS file: /cvsroot/bprocessor/gui/src/net/sourceforge/bprocessor/gui/treeview/SurfaceTreeView.java,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** SurfaceTreeView.java 15 May 2006 12:11:58 -0000 1.5 --- SurfaceTreeView.java 17 May 2006 12:03:42 -0000 1.6 *************** *** 8,17 **** package net.sourceforge.bprocessor.gui.treeview; - import java.util.Collections; - import java.util.Comparator; - import java.util.LinkedList; - import net.sourceforge.bprocessor.model.Project; - import net.sourceforge.bprocessor.model.Surface; /** --- 8,12 ---- *************** *** 31,44 **** */ public void update() { - final Comparator alpha = - new Comparator() { - public int compare(Object s1, Object s2) { - return ((Surface) s1).getName().compareToIgnoreCase(((Surface) s2).getName()); - } - }; root.removeAllChildren(); ! LinkedList surfaces = new LinkedList(Project.getInstance().getSurfaces()); ! Collections.sort(surfaces, alpha); ! root.add(new SurfaceContainer("Surfaces", surfaces)); model.nodeStructureChanged(root); } --- 26,31 ---- */ public void update() { root.removeAllChildren(); ! root.add(new SurfaceContainer("Surfaces", Project.getInstance().getSurfaces())); model.nodeStructureChanged(root); } Index: GenericTreeView.java =================================================================== RCS file: /cvsroot/bprocessor/gui/src/net/sourceforge/bprocessor/gui/treeview/GenericTreeView.java,v retrieving revision 1.27 retrieving revision 1.28 diff -C2 -d -r1.27 -r1.28 *** GenericTreeView.java 15 May 2006 12:12:15 -0000 1.27 --- GenericTreeView.java 17 May 2006 12:03:42 -0000 1.28 *************** *** 15,20 **** --- 15,23 ---- import java.net.URL; import java.util.Collection; + import java.util.Collections; + import java.util.Comparator; import java.util.HashSet; import java.util.Iterator; + import java.util.LinkedList; import java.util.Set; *************** *** 613,617 **** public SpaceContainer(String name, Collection spaces) { super(name); ! Iterator iter = spaces.iterator(); while (iter.hasNext()) { Space current = (Space) iter.next(); --- 616,638 ---- public SpaceContainer(String name, Collection spaces) { super(name); ! final Comparator alpha = ! new Comparator() { ! public int compare(Object s1, Object s2) { ! return ((Space) s1).getName().compareToIgnoreCase(((Space) s2).getName()); ! } ! }; ! ! final Comparator num = ! new Comparator() { ! public int compare(Object s1, Object s2) { ! return ((Space) s1).getId().compareTo(((Space) s2).getId()); ! } ! }; ! ! LinkedList sort = new LinkedList(spaces); ! Collections.sort(sort, num); ! Collections.sort(sort, alpha); ! ! Iterator iter = sort.iterator(); while (iter.hasNext()) { Space current = (Space) iter.next(); *************** *** 646,650 **** public SurfaceContainer(String name, Collection surfaces) { super(name); ! Iterator iter = surfaces.iterator(); while (iter.hasNext()) { Surface current = (Surface) iter.next(); --- 667,679 ---- public SurfaceContainer(String name, Collection surfaces) { super(name); ! final Comparator num = ! new Comparator() { ! public int compare(Object s1, Object s2) { ! return ((Surface) s1).getId().compareTo(((Surface) s2).getId()); ! } ! }; ! LinkedList sort = new LinkedList(surfaces); ! Collections.sort(sort, num); ! Iterator iter = sort.iterator(); while (iter.hasNext()) { Surface current = (Surface) iter.next(); Index: SpaceTreeView.java =================================================================== RCS file: /cvsroot/bprocessor/gui/src/net/sourceforge/bprocessor/gui/treeview/SpaceTreeView.java,v retrieving revision 1.9 retrieving revision 1.10 diff -C2 -d -r1.9 -r1.10 *** SpaceTreeView.java 16 May 2006 15:42:14 -0000 1.9 --- SpaceTreeView.java 17 May 2006 12:03:42 -0000 1.10 *************** *** 9,16 **** import java.util.ArrayList; - import java.util.Collections; - import java.util.Comparator; import java.util.Enumeration; - import java.util.LinkedList; import javax.swing.tree.DefaultMutableTreeNode; --- 9,13 ---- *************** *** 18,22 **** import net.sourceforge.bprocessor.model.Project; - import net.sourceforge.bprocessor.model.Space; /** --- 15,18 ---- *************** *** 41,62 **** */ public void update() { - final Comparator alpha = - new Comparator() { - public int compare(Object s1, Object s2) { - return ((Space) s1).getName().compareToIgnoreCase(((Space) s2).getName()); - } - }; - LinkedList construction = new LinkedList(Project.getInstance().getConstructionSpaces()); - Collections.sort(construction, alpha); - LinkedList functional = new LinkedList(Project.getInstance().getFunctionalSpaces()); - Collections.sort(functional, alpha); - LinkedList constraints = new LinkedList(Project.getInstance().getConstraints()); - //Collections.sort(constraints, alpha); Enumeration e = getExpandedDescendants(new TreePath(root)); Object[] paths = findPaths(e); root.removeAllChildren(); ! root.add(new SpaceContainer("Functional", functional)); ! root.add(new SpaceContainer("Construction", construction)); ! root.add(new ConstraintContainer("Constraints", constraints)); root.add(new GeometryContainer("Geometry", Project.getInstance().world())); model.nodeStructureChanged(root); --- 37,46 ---- */ public void update() { Enumeration e = getExpandedDescendants(new TreePath(root)); Object[] paths = findPaths(e); root.removeAllChildren(); ! root.add(new SpaceContainer("Functional", Project.getInstance().getConstructionSpaces())); ! root.add(new SpaceContainer("Construction", Project.getInstance().getFunctionalSpaces())); ! root.add(new ConstraintContainer("Constraints", Project.getInstance().getConstraints())); root.add(new GeometryContainer("Geometry", Project.getInstance().world())); model.nodeStructureChanged(root); |
From: Nikolaj B. <nbr...@us...> - 2006-05-17 12:04:00
|
Update of /cvsroot/bprocessor/gui/src/net/sourceforge/bprocessor/gui/attrview In directory sc8-pr-cvs3.sourceforge.net:/tmp/cvs-serv578/src/net/sourceforge/bprocessor/gui/attrview Modified Files: LinkAttribute.java Log Message: Fixed the sorting. Index: LinkAttribute.java =================================================================== RCS file: /cvsroot/bprocessor/gui/src/net/sourceforge/bprocessor/gui/attrview/LinkAttribute.java,v retrieving revision 1.9 retrieving revision 1.10 diff -C2 -d -r1.9 -r1.10 *** LinkAttribute.java 15 May 2006 11:57:38 -0000 1.9 --- LinkAttribute.java 17 May 2006 12:03:42 -0000 1.10 *************** *** 401,412 **** final Comparator alpha = new Comparator() { ! public int compare(Object s1, Object s2) { ! return ((Space) s1).getName().compareToIgnoreCase(((Space) s2).getName()); ! } ! }; ! ! LinkedList sort = new LinkedList(Project.getInstance().getSpaces()); Collections.sort(sort, alpha); LinkedList matches = new LinkedList(); Iterator it = sort.iterator(); --- 401,420 ---- final Comparator alpha = new Comparator() { ! public int compare(Object s1, Object s2) { ! return ((Space) s1).getName().compareToIgnoreCase(((Space) s2).getName()); ! } ! }; ! final Comparator num = ! new Comparator() { ! public int compare(Object s1, Object s2) { ! return ((Space) s1).getId().compareTo(((Space) s2).getId()); ! } ! }; ! ! LinkedList sort = new LinkedList(Project.getInstance().getSpaces()); Collections.sort(sort, alpha); + Collections.sort(sort, num); + LinkedList matches = new LinkedList(); Iterator it = sort.iterator(); |
From: Michael L. <he...@us...> - 2006-05-16 15:42:17
|
Update of /cvsroot/bprocessor/gui/src/net/sourceforge/bprocessor/gui/treeview In directory sc8-pr-cvs3.sourceforge.net:/tmp/cvs-serv11671/src/net/sourceforge/bprocessor/gui/treeview Modified Files: SpaceTreeView.java Log Message: Constraints can now contain expressions (*, /, +, -, (), pi and e). Index: SpaceTreeView.java =================================================================== RCS file: /cvsroot/bprocessor/gui/src/net/sourceforge/bprocessor/gui/treeview/SpaceTreeView.java,v retrieving revision 1.8 retrieving revision 1.9 diff -C2 -d -r1.8 -r1.9 *** SpaceTreeView.java 15 May 2006 12:11:58 -0000 1.8 --- SpaceTreeView.java 16 May 2006 15:42:14 -0000 1.9 *************** *** 52,56 **** Collections.sort(functional, alpha); LinkedList constraints = new LinkedList(Project.getInstance().getConstraints()); ! Collections.sort(constraints, alpha); Enumeration e = getExpandedDescendants(new TreePath(root)); Object[] paths = findPaths(e); --- 52,56 ---- Collections.sort(functional, alpha); LinkedList constraints = new LinkedList(Project.getInstance().getConstraints()); ! //Collections.sort(constraints, alpha); Enumeration e = getExpandedDescendants(new TreePath(root)); Object[] paths = findPaths(e); |
From: Michael L. <he...@us...> - 2006-05-16 15:42:15
|
Update of /cvsroot/bprocessor/model/src/net/sourceforge/bprocessor/model/constraints In directory sc8-pr-cvs3.sourceforge.net:/tmp/cvs-serv11657/src/net/sourceforge/bprocessor/model/constraints Modified Files: OffsetConstraint.java Log Message: Constraints can now contain expressions (*, /, +, -, (), pi and e). Index: OffsetConstraint.java =================================================================== RCS file: /cvsroot/bprocessor/model/src/net/sourceforge/bprocessor/model/constraints/OffsetConstraint.java,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** OffsetConstraint.java 13 Feb 2006 21:16:47 -0000 1.2 --- OffsetConstraint.java 16 May 2006 15:42:10 -0000 1.3 *************** *** 8,11 **** --- 8,15 ---- package net.sourceforge.bprocessor.model.constraints; + + import java.io.Reader; + import java.io.StringReader; + import java.util.HashMap; import java.util.HashSet; import java.util.Iterator; *************** *** 14,17 **** --- 18,24 ---- import java.util.Set; + import antlr.RecognitionException; + import antlr.TokenStreamException; + import net.sourceforge.bprocessor.model.Attribute; import net.sourceforge.bprocessor.model.Constraint; *************** *** 21,24 **** --- 28,33 ---- import net.sourceforge.bprocessor.model.Surface; import net.sourceforge.bprocessor.model.Vertex; + import net.sourceforge.bprocessor.model.parser.ExpressionLexer; + import net.sourceforge.bprocessor.model.parser.ExpressionParser; /** *************** *** 26,31 **** */ public class OffsetConstraint extends Constraint implements Parametric { /** The offset */ ! private double offset; /** --- 35,44 ---- */ public class OffsetConstraint extends Constraint implements Parametric { + /** + * + */ + private static final long serialVersionUID = 1L; /** The offset */ ! private String offset; /** *************** *** 40,45 **** /** * Collect vertices from object ! * FIXME: Make reuable by moving somewhere accessible * @param o The object * @param vertices The vertices --- 53,82 ---- /** + * @return offset + */ + public double offset() { + Reader input = new StringReader(offset); + ExpressionLexer lexer = new ExpressionLexer(input); + ExpressionParser parser = new ExpressionParser(lexer); + HashMap env = new HashMap(); + env.put("pi", new Double(Math.PI)); + env.put("e", new Double(Math.E)); + env.put("wall", new Double(0.5)); + double value = 1.0; + try { + value = parser.expression(env); + } catch (RecognitionException e) { + // TODO Auto-generated catch block + e.printStackTrace(); + } catch (TokenStreamException e) { + // TODO Auto-generated catch block + e.printStackTrace(); + } + return value; + } + + /** * Collect vertices from object ! * FIXME: Make reusable by moving somewhere accessible * @param o The object * @param vertices The vertices *************** *** 79,83 **** Vertex u = v.minus(origin); double distance = n.dot(u); ! this.offset = distance; } --- 116,120 ---- Vertex u = v.minus(origin); double distance = n.dot(u); ! this.offset = String.valueOf(distance); } *************** *** 89,93 **** Surface slave = (Surface) getSlave(); CoordinateSystem system = master.coordinateSystem(); - Vertex origin = system.origin(); Vertex n = system.getN(); n.scale(1 / n.length()); --- 126,129 ---- *************** *** 99,103 **** Vertex current = (Vertex) iter.next(); Vertex p = system.translate(current); ! p.setZ(offset); p = system.unTranslate(p); current.setX(p.getX()); --- 135,139 ---- Vertex current = (Vertex) iter.next(); Vertex p = system.translate(current); ! p.setZ(offset()); p = system.unTranslate(p); current.setX(p.getX()); *************** *** 128,133 **** Attribute current = (Attribute) iter.next(); if (current.getName().equals("Offset")) { ! Double offset = (Double) current.getValue(); ! this.offset = offset.doubleValue(); update(this); Surface slave = (Surface) getSlave(); --- 164,168 ---- Attribute current = (Attribute) iter.next(); if (current.getName().equals("Offset")) { ! this.offset = (String) current.getValue(); update(this); Surface slave = (Surface) getSlave(); *************** *** 147,151 **** attributes.add(new Attribute("Master", master.getName())); attributes.add(new Attribute("Slave", slave.getName())); ! attributes.add(new Attribute("Offset", new Double(offset))); return attributes; } --- 182,186 ---- attributes.add(new Attribute("Master", master.getName())); attributes.add(new Attribute("Slave", slave.getName())); ! attributes.add(new Attribute("Offset", offset)); return attributes; } |
From: Michael L. <he...@us...> - 2006-05-16 13:34:36
|
Update of /cvsroot/bprocessor/model/src/etc In directory sc8-pr-cvs3.sourceforge.net:/tmp/cvs-serv28654/src/etc Modified Files: expression.g Log Message: Expression Parser and Evaluator supporting global variables implemented Index: expression.g =================================================================== RCS file: /cvsroot/bprocessor/model/src/etc/expression.g,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** expression.g 15 May 2006 15:21:59 -0000 1.1 --- expression.g 16 May 2006 13:34:29 -0000 1.2 *************** *** 1,7 **** header { package net.sourceforge.bprocessor.model.parser; } ! class ExprLexer extends Lexer; options { --- 1,8 ---- header { package net.sourceforge.bprocessor.model.parser; + import java.util.HashMap; } ! class ExpressionLexer extends Lexer; options { *************** *** 10,37 **** } ! LPAREN: '(' ; ! RPAREN: ')' ; ! PLUS : '+' ; ! MINUS : '-' ; ! STAR : '*' ; ! INT : ('0'..'9')+ ; ! WS : ( ' ' ! | '\r' '\n' ! | '\n' ! | '\t' ! ) ! {$setType(Token.SKIP);} ! ; ! class ExprParser extends Parser; - expr: mexpr ((PLUS|MINUS) mexpr)* - ; ! mexpr ! : atom (STAR atom)* ! ; ! atom: INT ! | LPAREN expr RPAREN ; --- 11,102 ---- } ! StartTerm: '(' ; ! EndTerm: ')' ; ! Plus : '+' ; ! Minus : '-' ; ! Multiply : '*' ; ! Divide : '/' ; ! Period : '.' ; ! End : ';' ; ! protected Letter ! : Upper | Lower ! ; ! ! protected Upper ! : 'A' .. 'Z' ! ; ! ! protected Lower ! : 'a' .. 'z' ! ; ! ! protected Digit : '0'..'9' ; ! protected Integer : (Digit)+ ; ! protected Real : Integer Period Integer ; ! Number : (Integer Period Integer) => Real | ( Integer ) => Integer ; ! ! Identifier ! : (Letter | '_' ) ( Letter | Digit | '_' )* ! ; ! ! ! ! WhiteSpace ! : ( ' ' ! | '\r' '\n' ! | '\n' ! | '\t' ! ) ! {$setType(Token.SKIP);} ! ; ! ! class ExpressionParser extends Parser; ! ! ! ! program[HashMap env] returns [double value = 0] ! : value = expression[env] End ! ; ! expression[HashMap env] returns [double value = 0] ! { double x; } ! : value = term[env] ! ( Plus x = term[env] { value += x; } ! | Minus x = term[env] { value -= x; } ! )* ! ; ! ! term[HashMap env] returns [double value = 0] ! { double x; } ! : value = atom[env] ! ( Multiply x = atom[env] { value *= x; } ! | Divide x = atom[env] { value /= x; } ! )* ! ; ! ! atom[HashMap env] returns [double value = 0] ! : value = literal ! | value = variable[env] ! | StartTerm value = expression[env] EndTerm ! | value = unary[env] ! ; ! ! unary[HashMap env] returns [double value = 0] ! : Plus value = atom[env] ! | Minus value = atom[env] { value = -value; } ! ; ! ! literal returns [double value = 0] ! : n:Number { value = Double.parseDouble(n.getText()); } ! ; ! ! variable[HashMap env] returns [double value = 0] ! : i:Identifier { Double d = (Double) env.get(i.getText()); ! if (d != null) { ! value = d.doubleValue(); ! } ! } ; |
From: rimestad <rim...@us...> - 2006-05-15 15:32:21
|
Update of /cvsroot/bprocessor/gl/src/net/sourceforge/bprocessor/gl/tool In directory sc8-pr-cvs3.sourceforge.net:/tmp/cvs-serv32042/src/net/sourceforge/bprocessor/gl/tool Modified Files: MultiExtrudeTool.java Log Message: Added and changed functionality to make it possible to make extrusion onto a other surface that is not co-planer. Repaired the move plane problem and added extrusion of holes... Index: MultiExtrudeTool.java =================================================================== RCS file: /cvsroot/bprocessor/gl/src/net/sourceforge/bprocessor/gl/tool/MultiExtrudeTool.java,v retrieving revision 1.17 retrieving revision 1.18 diff -C2 -d -r1.17 -r1.18 *** MultiExtrudeTool.java 1 May 2006 09:59:00 -0000 1.17 --- MultiExtrudeTool.java 15 May 2006 15:32:16 -0000 1.18 *************** *** 9,12 **** --- 9,14 ---- import java.awt.Cursor; + import java.awt.event.KeyEvent; + import java.awt.event.KeyListener; import java.awt.event.MouseEvent; import java.util.Collection; *************** *** 23,27 **** --- 25,33 ---- import net.sourceforge.bprocessor.gl.GLView; import net.sourceforge.bprocessor.gl.model.Intersection; + 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; *************** *** 32,36 **** * The ExtrudeTool */ ! public class MultiExtrudeTool extends AbstractPencil { /** The logger */ private static Logger log = Logger.getLogger(MultiExtrudeTool.class); --- 38,42 ---- * The ExtrudeTool */ ! public class MultiExtrudeTool extends AbstractPencil implements KeyListener { /** The logger */ private static Logger log = Logger.getLogger(MultiExtrudeTool.class); *************** *** 48,56 **** private double t; - /** The set of extruded elements*/ - private Set elements; - /** The extrusion direction */ private double direction = 0.0; /** --- 54,74 ---- private double t; /** The extrusion direction */ private double direction = 0.0; + + /** Tells if the extrude method is controlled or not */ + private boolean controlled = false; + + /** The constructor from start to current vertexes in AbstractPencil */ + private Edge moveConstructor; + + /** The direction constructior edge */ + private Edge dir; + + /** True if holes should also be extruded */ + private boolean extrudeAll; + + /** The created surfaces */ + private HashSet creations; /** *************** *** 69,72 **** --- 87,91 ---- elements = new HashSet(); surfaces = new HashSet(); + extrudeAll = true; } *************** *** 77,82 **** 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)) { --- 96,101 ---- protected void pressed(MouseEvent e) { if (start == null) { if (current.type() == Intersection.SURFACE) { + start = current; Surface target = (Surface)current.object(); if (Selection.primary().isEmpty() || Selection.primary().contains(target)) { *************** *** 86,91 **** --- 105,132 ---- Vertex normal = extrudeSurface.normal().copy(); normal.scale(-1); + log.info("Length of normal: " + normal.length()); lock = true; locked = normal; + Transformation trans = glv.getView().transformation(); + double x = e.getX(); + double y = View.getHeight() - e.getX(); + 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); + plane = extrudeSurface.plane().orthogonalPlane(ray); + log.info("Distance to ortho-plane from start " + plane.distance(start.vertex())); + log.info("Distance to plane from start " + + extrudeSurface.plane().distance(start.vertex())); + LinkedList planeinfo = new LinkedList(); + Vertex normalCopy = normal.copy(); + normalCopy.scale(20); + dir = new Edge(start.vertex().add(normalCopy), start.vertex().minus(normalCopy)); + dir.setConstructor(true); + glv.getView().changeColor(dir, new float[] {255f, 0, 0}); + planeinfo.add(dir); + constructors(planeinfo); + } else { + start = null; } } *************** *** 97,101 **** finishExtrusion(); } ! cleanUp(); } } --- 138,152 ---- finishExtrusion(); } ! start = null; ! t = 0; ! number = ""; ! extrudeSurface = null; ! direction = 0.0; ! v2dir = null; ! elements = new HashSet(); ! surfaces = new HashSet(); ! constructors(new LinkedList()); ! excluded(new LinkedList()); ! dir = null; } } *************** *** 115,139 **** */ 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(); - // } - // } /** --- 166,175 ---- */ private void deleteExtrusion() { ! Project.getInstance().resetState(); ! t = 0; ! elements = new HashSet(); ! surfaces = new HashSet(); ! v2dir = null; } /** *************** *** 141,147 **** */ public void cleanUp() { start = null; t = 0; - number = ""; extrudeSurface = null; direction = 0.0; --- 177,186 ---- */ public void cleanUp() { + if (extrudeSurface != null) { + extrudeSurface = null; + deleteExtrusion(); + } start = null; t = 0; extrudeSurface = null; direction = 0.0; *************** *** 149,152 **** --- 188,193 ---- elements = new HashSet(); surfaces = new HashSet(); + dir = null; + extrudeAll = true; super.cleanUp(); } *************** *** 156,160 **** */ private void finishExtrusion() { ! Iterator iter = elements.iterator(); while (iter.hasNext()) { Surface current = (Surface) iter.next(); --- 197,201 ---- */ private void finishExtrusion() { ! Iterator iter = creations.iterator(); while (iter.hasNext()) { Surface current = (Surface) iter.next(); *************** *** 163,167 **** } } - cleanUp(); Project.getInstance().changed(Project.getInstance()); Project.getInstance().checkpoint(); --- 204,207 ---- *************** *** 171,181 **** * Move a collection of vertex, direction pairs * @param which The colelction of pairs * @param to The amount of the direction each vertex should move */ ! private void moveTo(Collection which, double to) { ! double delta = t - to; Iterator iter = which.iterator(); while (iter.hasNext()) { Direction d = (Direction)iter.next(); Vertex movement = d.getDirection(); Vertex v = movement.copy(); --- 211,226 ---- * Move a collection of vertex, direction pairs * @param which The colelction of pairs + * @param normal For finding the already moved distance * @param to The amount of the direction each vertex should move */ ! private void moveTo(Collection which, double to, Vertex normal) { ! log.info("Move all"); Iterator iter = which.iterator(); + t = 0.0; while (iter.hasNext()) { Direction d = (Direction)iter.next(); + t = start.vertex().minus(d.getVertex()).dot(normal); + log.info(d.getVertex() + " were " + t + " away"); + double delta = t - to; Vertex movement = d.getDirection(); Vertex v = movement.copy(); *************** *** 183,187 **** d.getVertex().move(v.getX(), v.getY(), v.getZ()); } ! t = to; glv.setLength(t); } --- 228,249 ---- d.getVertex().move(v.getX(), v.getY(), v.getZ()); } ! glv.setLength(t); ! } ! ! /** ! * Move a collection of vertex, direction pairs ! * @param which The colelction of pairs ! * @param normal For finding the already moved distance ! * @param to The amount of the direction each vertex should move ! */ ! private void moveTo(Direction which, double to, Vertex normal) { ! log.info("move one"); ! t = start.vertex().minus(which.getVertex()).dot(normal); ! double delta = t - to; ! log.info(which.getVertex() + " were " + t + " away"); ! Vertex movement = which.getDirection(); ! Vertex v = movement.copy(); ! v.scale(delta); ! which.getVertex().move(v.getX(), v.getY(), v.getZ()); glv.setLength(t); } *************** *** 201,206 **** */ 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 --- 263,268 ---- */ private boolean makeExtrusion(Collection c, double direction) { ! log.info(extrudeSurface + "were extruded"); ! creations = new HashSet(); Map e2e = new HashMap(); // edge to edge map Map e2s = new HashMap(); // edge to surface map *************** *** 218,224 **** while (iter.hasNext()) { Surface cur = (Surface)iter.next(); ! Surface s = cur.extrude(-direction, elements, e2e, v2e, e2s, v2dir); ! elements.add(s); } t = 0; return true; --- 280,306 ---- while (iter.hasNext()) { Surface cur = (Surface)iter.next(); ! Surface s; ! if (controlled) { ! if (extrudeAll) { ! Iterator holes = cur.getHoles().iterator(); ! while (holes.hasNext()) { ! Surface hole = (Surface) holes.next(); ! creations.add(hole.extrudeControlled(-direction, creations, e2e, v2e, e2s, v2dir)); ! } ! } ! s = cur.extrudeControlled(-direction, creations, e2e, v2e, e2s, v2dir); ! } else { ! if (extrudeAll) { ! Iterator holes = cur.getHoles().iterator(); ! while (holes.hasNext()) { ! Surface hole = (Surface) holes.next(); ! creations.add(hole.extrude(-direction, creations, e2e, v2e, e2s, v2dir)); ! } ! } ! s = cur.extrude(-direction, creations, e2e, v2e, e2s, v2dir); ! } ! creations.add(s); } + excluded(getAffected(creations)); t = 0; return true; *************** *** 231,236 **** current = findIntersection(e); makeTarget(current); if (start != null) { - // do the shit modifyExtrusion(); } --- 313,319 ---- current = findIntersection(e); makeTarget(current); + timer.stop(); + updateConstructors(); if (start != null) { modifyExtrusion(); } *************** *** 238,241 **** --- 321,349 ---- /** + * + * Update constructors + */ + public void updateConstructors() { + if (start != null && current != null) { + //super.updateConstructors(); + moveConstructor = new Edge(start.vertex(), current.vertex()); + moveConstructor.setConstructor(true); + LinkedList constCopy = new LinkedList(); + constCopy.add(moveConstructor); + constCopy.add(dir); + LinkedList excl = new LinkedList(); + excl.addAll(excluded); + excl.add(moveConstructor); + constructors(constCopy); + excluded(excl); + } else { + constructors(new LinkedList()); + feedback(new LinkedList()); + } + number = ""; + updateLength(); + } + + /** * Do the appropiate changes to the extrusion */ *************** *** 250,258 **** 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) { --- 358,367 ---- normDotDelta = -extrudeSurface.normal().dot(delta); } ! if (v2dir == null && Math.abs(normDotDelta) > 0) { direction = normDotDelta; makeExtrusion(surfaces, direction); } if (v2dir != null) { + //log.info("Direction were " + direction + " and extrude were " + normDotDelta); // The extrusion were succesfull move it if (normDotDelta * direction < 0) { *************** *** 261,265 **** makeExtrusion(surfaces, direction); } ! moveTo(v2dir.values(), normDotDelta); } } --- 370,404 ---- makeExtrusion(surfaces, direction); } ! if (current.type() == Intersection.SURFACE) { ! // should extrude to the surface if it is possible ! log.info(current + " were hit"); ! Iterator dirs = v2dir.values().iterator(); ! boolean wereInside = true; ! LinkedList lengths = new LinkedList(); ! while (dirs.hasNext()) { ! Direction dir = (Direction)dirs.next(); ! Plane p = ((Surface)current.object()).plane(); ! Vertex v = p.intersection(dir.getVertex(), dir.getDirection()); ! if (v == null) { ! wereInside = false; ! break; ! } else { ! lengths.addLast(new Double(-extrudeSurface.normal().dot(v.minus(dir.getVertex())))); ! } ! } ! if (wereInside) { ! log.info(current + " Were a good target"); ! dirs = v2dir.values().iterator(); ! int i = 0; ! Vertex nor = extrudeSurface.normal(); ! while (dirs.hasNext()) { ! Direction dir = (Direction)dirs.next(); ! moveTo(dir, ((Double)lengths.get(i)).doubleValue(), nor); ! i++; ! } ! } ! } ! ! moveTo(v2dir.values(), normDotDelta, extrudeSurface.normal()); } } *************** *** 279,287 **** makeExtrusion(surfaces, direction); } ! moveTo(v2dir.values(), length); } else { direction = length; makeExtrusion(surfaces, direction); ! moveTo(v2dir.values(), length); } finishExtrusion(); --- 418,426 ---- makeExtrusion(surfaces, direction); } ! moveTo(v2dir.values(), length, extrudeSurface.normal()); } else { direction = length; makeExtrusion(surfaces, direction); ! moveTo(v2dir.values(), length, extrudeSurface.normal()); } finishExtrusion(); *************** *** 289,304 **** } ! // /** ! // * 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"; --- 428,465 ---- } ! /** ! * 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 ! */ ! if ((e.getModifiersEx() & KeyEvent.CTRL_DOWN_MASK) == KeyEvent.CTRL_DOWN_MASK) { ! controlled = !controlled; ! log.info("Controlle pressed"); ! } ! if ((e.getModifiersEx() & KeyEvent.ALT_DOWN_MASK) == KeyEvent.ALT_DOWN_MASK) { ! extrudeAll = false; ! log.info("Alt pressed"); ! } ! super.keyPressed(e); ! } ! ! /** ! * Invoked when a key has been pressed. ! * @param e The KeyEvent ! */ ! public void keyReleased(KeyEvent e) { ! /*a length can only be typed in if some surface is selected ! for extrusion, and if the "number"-variable has been initialised ! */ ! if ((e.getModifiersEx() & KeyEvent.ALT_DOWN_MASK) == KeyEvent.ALT_DOWN_MASK) { ! extrudeAll = true; ! log.info("Alt pressed"); ! } ! super.keyPressed(e); ! } ! } // } else if (e.getKeyCode() == KeyEvent.VK_2) { // number += "2"; *************** *** 348,352 **** // } // } ! // super.keyPressed(e); ! // } ! } --- 509,511 ---- // } // } ! |
From: rimestad <rim...@us...> - 2006-05-15 15:23:51
|
Update of /cvsroot/bprocessor/gl/src/net/sourceforge/bprocessor/gl/tool In directory sc8-pr-cvs3.sourceforge.net:/tmp/cvs-serv16907/src/net/sourceforge/bprocessor/gl/tool Modified Files: MoveTool.java AbstractPencil.java Log Message: refactored getaffected from movetool to abstractPencil and turned find best aligned plane off in findIntersection Index: MoveTool.java =================================================================== RCS file: /cvsroot/bprocessor/gl/src/net/sourceforge/bprocessor/gl/tool/MoveTool.java,v retrieving revision 1.56 retrieving revision 1.57 diff -C2 -d -r1.56 -r1.57 *** MoveTool.java 3 May 2006 10:04:38 -0000 1.56 --- MoveTool.java 15 May 2006 14:55:41 -0000 1.57 *************** *** 254,264 **** moveConstructor = new Edge(start.vertex(), current.vertex()); moveConstructor.setConstructor(true); - constructors.add(moveConstructor); - excluded.add(moveConstructor); Set constcopy = new HashSet(); constcopy.addAll(constructors); constructors(constcopy); Set excopy = new HashSet(); excopy.addAll(excluded); excluded(excopy); } else { --- 254,264 ---- moveConstructor = new Edge(start.vertex(), current.vertex()); moveConstructor.setConstructor(true); Set constcopy = new HashSet(); constcopy.addAll(constructors); + constcopy.add(moveConstructor); constructors(constcopy); Set excopy = new HashSet(); excopy.addAll(excluded); + excopy.add(moveConstructor); excluded(excopy); } else { *************** *** 269,294 **** /** - * Gets the set of elements that can be affected by moveing a - * set of elements. - * @param moveElements the elements to move - * @return the affected elements - */ - protected Set getAffected(Collection moveElements) { - HashSet affected = new HashSet(); - HashSet affectedEdges = new HashSet(); - HashSet affectedSurfaces = new HashSet(); - affected.addAll(collect(moveElements)); - Iterator it = affected.iterator(); - while (it.hasNext()) { - Vertex v = (Vertex)it.next(); - affectedEdges.addAll(v.getEdges()); - affectedSurfaces.addAll(v.getSurfaces()); - } - affected.addAll(affectedEdges); - affected.addAll(affectedSurfaces); - return affected; - } - - /** * Clean up */ --- 269,272 ---- Index: AbstractPencil.java =================================================================== RCS file: /cvsroot/bprocessor/gl/src/net/sourceforge/bprocessor/gl/tool/AbstractPencil.java,v retrieving revision 1.30 retrieving revision 1.31 diff -C2 -d -r1.30 -r1.31 *** AbstractPencil.java 8 May 2006 08:53:14 -0000 1.30 --- AbstractPencil.java 15 May 2006 14:55:41 -0000 1.31 *************** *** 107,111 **** */ protected Intersection findIntersection(MouseEvent e) { ! plane = bestAlignedPlane(); if (start != null) { Vertex planeNormal = plane.normal(); --- 107,111 ---- */ protected Intersection findIntersection(MouseEvent e) { ! //plane = bestAlignedPlane(); if (start != null) { Vertex planeNormal = plane.normal(); *************** *** 138,142 **** 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.type(), intersection.object()); --- 138,142 ---- Vertex lockedcopy = locked.copy(); Vertex unlocked = intersection.vertex().minus(start.vertex()); ! lockedcopy.scale(locked.dot(unlocked) / locked.length()); lockedcopy = lockedcopy.add(start.vertex()); return new Intersection(lockedcopy, intersection.type(), intersection.object()); *************** *** 805,808 **** --- 805,830 ---- /** + * Gets the set of elements that can be affected by moveing a + * set of elements. + * @param moveElements the elements to move + * @return the affected elements + */ + protected Set getAffected(Collection moveElements) { + HashSet affected = new HashSet(); + HashSet affectedEdges = new HashSet(); + HashSet affectedSurfaces = new HashSet(); + affected.addAll(collect(moveElements)); + Iterator it = affected.iterator(); + while (it.hasNext()) { + Vertex v = (Vertex)it.next(); + affectedEdges.addAll(v.getEdges()); + affectedSurfaces.addAll(v.getSurfaces()); + } + affected.addAll(affectedEdges); + affected.addAll(affectedSurfaces); + return affected; + } + + /** * info * @param info Info |
From: Michael L. <he...@us...> - 2006-05-15 15:22:07
|
Update of /cvsroot/bprocessor/model In directory sc8-pr-cvs3.sourceforge.net:/tmp/cvs-serv28303 Modified Files: .classpath build.xml Log Message: Added an expression grammar Index: .classpath =================================================================== RCS file: /cvsroot/bprocessor/model/.classpath,v retrieving revision 1.7 retrieving revision 1.8 diff -C2 -d -r1.7 -r1.8 *** .classpath 23 Mar 2006 12:24:02 -0000 1.7 --- .classpath 15 May 2006 15:21:59 -0000 1.8 *************** *** 6,9 **** --- 6,10 ---- <classpathentry exported="true" kind="lib" path="/tools/jaxb/jaxb.jar"/> <classpathentry kind="lib" path="build"/> + <classpathentry exported="true" kind="lib" path="/tools/antlr/antlr.jar"/> <classpathentry kind="output" path="bin"/> </classpath> Index: build.xml =================================================================== RCS file: /cvsroot/bprocessor/model/build.xml,v retrieving revision 1.12 retrieving revision 1.13 diff -C2 -d -r1.12 -r1.13 *** build.xml 28 Apr 2006 11:29:09 -0000 1.12 --- build.xml 15 May 2006 15:21:59 -0000 1.13 *************** *** 59,62 **** --- 59,67 ---- </fileset> </copy> + <copy todir="${lib.dir}"> + <fileset dir="${tools.dir}/antlr"> + <include name="**/antlr.jar"/> + </fileset> + </copy> <copy todir="${lib.dir}"> <fileset dir="${kernel.dir}/dist"> *************** *** 66,69 **** --- 71,84 ---- </target> + <target name="compile-grammar" depends="init"> + <mkdir dir="${build.dir}/net/sourceforge/bprocessor/model/parser"/> + <antlr target="${conf.dir}/expression.g" + outputdirectory="${build.dir}/net/sourceforge/bprocessor/model/parser"> + <classpath> + <pathelement location="${lib.dir}/antlr.jar"/> + </classpath> + </antlr> + </target> + <target name="compile-xml" depends="copylib"> <taskdef name="xjc" *************** *** 84,87 **** --- 99,103 ---- <classpath> <pathelement location="${lib.dir}/jaxb.jar"/> + <pathelement location="${lib.dir}/antlr.jar"/> </classpath> </javac> *************** *** 107,111 **** </target> ! <target name="compile" depends="checkstyle,copylib,compile-xml"> <ant dir="src" target="compile"/> </target> --- 123,127 ---- </target> ! <target name="compile" depends="checkstyle,copylib,compile-grammar,compile-xml"> <ant dir="src" target="compile"/> </target> |
From: Michael L. <he...@us...> - 2006-05-15 15:22:04
|
Update of /cvsroot/bprocessor/model/src/etc In directory sc8-pr-cvs3.sourceforge.net:/tmp/cvs-serv28303/src/etc Added Files: expression.g Log Message: Added an expression grammar --- NEW FILE: expression.g --- header { package net.sourceforge.bprocessor.model.parser; } class ExprLexer extends Lexer; options { k=2; // needed for newline junk charVocabulary='\u0000'..'\u007F'; // allow ascii } LPAREN: '(' ; RPAREN: ')' ; PLUS : '+' ; MINUS : '-' ; STAR : '*' ; INT : ('0'..'9')+ ; WS : ( ' ' | '\r' '\n' | '\n' | '\t' ) {$setType(Token.SKIP);} ; class ExprParser extends Parser; expr: mexpr ((PLUS|MINUS) mexpr)* ; mexpr : atom (STAR atom)* ; atom: INT | LPAREN expr RPAREN ; |
From: Nordholt <nor...@us...> - 2006-05-15 12:27:08
|
Update of /cvsroot/bprocessor/gl/src/net/sourceforge/bprocessor/gl/tool In directory sc8-pr-cvs3.sourceforge.net:/tmp/cvs-serv20145 Modified Files: SpaceTool.java Log Message: added 90degree counter clockwise rotation to options Index: SpaceTool.java =================================================================== RCS file: /cvsroot/bprocessor/gl/src/net/sourceforge/bprocessor/gl/tool/SpaceTool.java,v retrieving revision 1.19 retrieving revision 1.20 diff -C2 -d -r1.19 -r1.20 *** SpaceTool.java 3 May 2006 10:01:20 -0000 1.19 --- SpaceTool.java 15 May 2006 12:08:03 -0000 1.20 *************** *** 34,37 **** --- 34,38 ---- import net.sourceforge.bprocessor.model.Surface; import net.sourceforge.bprocessor.model.Vertex; + import net.sourceforge.bprocessor.model.Geometry; import net.sourceforge.bprocessor.model.constraints.OffsetConstraint; *************** *** 98,102 **** this.space = space; } - } --- 99,102 ---- *************** *** 452,459 **** public void actionPerformed(ActionEvent arg0) { if (space != null) { - selection.clear(); Space spaceCopy = space.copy(); selection.clear(); selection.add(spaceCopy); } } --- 452,476 ---- public void actionPerformed(ActionEvent arg0) { if (space != null) { Space spaceCopy = space.copy(); selection.clear(); selection.add(spaceCopy); + glv.changeTool(Tool.MOVE_TOOL); + } + } + }); + + JMenuItem flipSpaceItem = new JMenuItem("Rotate space 90degrees CCW"); + flipSpaceItem.addActionListener(new SpaceAction(space) { + public void actionPerformed(ActionEvent arg0) { + if (space != null) { + Iterator it = space.collect().iterator(); + Vertex center = space.center(); + while (it.hasNext()) { + Geometry.rotate(Math.PI / 2, + 0, 0, 1, + (Vertex)it.next(), + center); + } + space.changed(); } } *************** *** 490,493 **** --- 507,511 ---- menu.add(copySpaceItem); menu.add(editSpaceItem); + menu.add(flipSpaceItem); menu.addPopupMenuListener(spl); menu.pack(); |
From: Nordholt <nor...@us...> - 2006-05-15 12:15:29
|
Update of /cvsroot/bprocessor/model/src/net/sourceforge/bprocessor/model In directory sc8-pr-cvs3.sourceforge.net:/tmp/cvs-serv22978 Modified Files: Selection.java Log Message: added a logger to the selection class Index: Selection.java =================================================================== RCS file: /cvsroot/bprocessor/model/src/net/sourceforge/bprocessor/model/Selection.java,v retrieving revision 1.7 retrieving revision 1.8 diff -C2 -d -r1.7 -r1.8 *** Selection.java 22 Feb 2006 11:03:23 -0000 1.7 --- Selection.java 15 May 2006 12:15:23 -0000 1.8 *************** *** 14,17 **** --- 14,18 ---- import java.util.List; import java.util.Set; + import org.apache.log4j.Logger; /** *************** *** 21,24 **** --- 22,28 ---- */ public class Selection implements Collection { + /** The logger */ + private static Logger log = Logger.getLogger(Selection.class); + /** The collection of objects mark is used to test for membership */ private Set mark; |
From: Nordholt <nor...@us...> - 2006-05-15 12:14:31
|
Update of /cvsroot/bprocessor/model/src/net/sourceforge/bprocessor/model In directory sc8-pr-cvs3.sourceforge.net:/tmp/cvs-serv22614 Modified Files: Space.java Log Message: changed copying implementation Index: Space.java =================================================================== RCS file: /cvsroot/bprocessor/model/src/net/sourceforge/bprocessor/model/Space.java,v retrieving revision 1.32 retrieving revision 1.33 diff -C2 -d -r1.32 -r1.33 *** Space.java 15 May 2006 10:33:09 -0000 1.32 --- Space.java 15 May 2006 12:14:26 -0000 1.33 *************** *** 546,550 **** surface.getExterior().addHole(curHole); } else { ! curHole.setExterior(null); } } --- 546,550 ---- surface.getExterior().addHole(curHole); } else { ! curHole.setExterior(null); } } *************** *** 798,801 **** --- 798,802 ---- } elements.put(id, element); + element.setOwner(this); } else { throw new Error("adding element to non-container " + this); *************** *** 898,902 **** Iterator it = verts.iterator(); while (it.hasNext()) { ! average.add((Vertex)it.next()); } average.scale(1.0 / (double)verts.size()); --- 899,903 ---- Iterator it = verts.iterator(); while (it.hasNext()) { ! average = average.add((Vertex)it.next()); } average.scale(1.0 / (double)verts.size()); *************** *** 1017,1021 **** Space copy = this.copy(copiedVertices, copiedEdges, copiedSurfaces, copiedSpaces); ! Project.getInstance().add(copy); Project.getInstance().checkpoint(); return copy; --- 1018,1022 ---- Space copy = this.copy(copiedVertices, copiedEdges, copiedSurfaces, copiedSpaces); ! this.getOwner().add(copy); Project.getInstance().checkpoint(); return copy; *************** *** 1034,1040 **** Map copiedSurfaces, Map copiedSpaces) { ! Space copy = new Space("*copy of " + this.getName() + "*", this.getType(), this.isContainer()); Set envelopeCopy = copyEnvelope(copiedVertices, copiedEdges, --- 1035,1042 ---- Map copiedSurfaces, Map copiedSpaces) { ! Space copy = new Space("", this.getType(), this.isContainer()); + copy.setName(this.getName()); Set envelopeCopy = copyEnvelope(copiedVertices, copiedEdges, *************** *** 1074,1078 **** while (it.hasNext()) { Space sp = (Space)it.next(); ! if (!(sp.toString().equals("Void"))) { Space newSpace = sp.copy(copiedVertices, copiedEdges, --- 1076,1081 ---- while (it.hasNext()) { Space sp = (Space)it.next(); ! //make prettier ! if (sp != sp.getOwner().getEmpty()) { Space newSpace = sp.copy(copiedVertices, copiedEdges, *************** *** 1081,1084 **** --- 1084,1088 ---- copiedSpaces.put(sp, newSpace); copy.add(newSpace); + copy.setName(copy.getName() + "::" + copy.getId()); } } *************** *** 1116,1119 **** --- 1120,1142 ---- while (it.hasNext()) { Surface s = (Surface)it.next(); + copyInnerSurface(s, + copiedEdges, + copiedSurfaces, + copy); + } + } + + /** + * Copies a surface in the inner layers of the copy + * @param s the surface to copy + * @param copiedEdges map of edges and their copies. + * @param copiedSurfaces map of surfaces and their copies. + * @param copy the copy of this space + */ + private void copyInnerSurface(Surface s, + Map copiedEdges, + Map copiedSurfaces, + Space copy) { + if (!copiedSurfaces.keySet().contains(s)) { List newEdges = new LinkedList(); Iterator edgeIt = s.getEdges().iterator(); *************** *** 1122,1125 **** --- 1145,1159 ---- } Surface newSurface = new Surface(newEdges); + if (s.getExterior() != null) { + Surface exteriorCopy; + if (!copiedSurfaces.keySet().contains(s.getExterior())) { + copyInnerSurface(s.getExterior(), + copiedEdges, + copiedSurfaces, + copy); + } + exteriorCopy = (Surface)copiedSurfaces.get(s.getExterior()); + exteriorCopy.addHole(newSurface); + } newSurface.setFrontDomain(copy.getEmpty()); newSurface.setBackDomain(copy.getEmpty()); *************** *** 1150,1182 **** if (copiedSurfaces.keySet().contains(s)) { surfaceCopy = (Surface)copiedSurfaces.get(s); - envelopeCopy.add(surfaceCopy); } else { /* This should only apply to the outer layer */ ! Iterator edgeIt = s.getEdges().iterator(); ! List edgeCopies = new LinkedList(); ! while (edgeIt.hasNext()) { ! Edge e = (Edge)edgeIt.next(); ! if (!copiedVertices.keySet().contains(e.getTo())) { ! copiedVertices.put(e.getTo(), e.getTo().copy()); ! Project.getInstance().add((Vertex)copiedVertices.get(e.getTo())); ! } ! if (!copiedVertices.keySet().contains(e.getFrom())) { ! copiedVertices.put(e.getFrom(), e.getFrom().copy()); ! Project.getInstance().add((Vertex)copiedVertices.get(e.getFrom())); ! } ! if (!copiedEdges.keySet().contains(e)) { ! copiedEdges.put(e, new Edge((Vertex)copiedVertices.get(e.getFrom()), ! (Vertex)copiedVertices.get(e.getTo()))); ! } ! Project.getInstance().add((Edge)copiedEdges.get(e)); ! edgeCopies.add(copiedEdges.get(e)); ! } ! surfaceCopy = new Surface(edgeCopies); ! Project.getInstance().add(surfaceCopy); ! surfaceCopy.setFrontDomain(Project.getInstance().world().getEmpty()); ! surfaceCopy.setBackDomain(Project.getInstance().world().getEmpty()); ! envelopeCopy.add(surfaceCopy); ! copiedSurfaces.put(s, surfaceCopy); } if (s.getFrontDomain() == this) { surfaceCopy.setFrontDomain(copy); --- 1184,1195 ---- if (copiedSurfaces.keySet().contains(s)) { surfaceCopy = (Surface)copiedSurfaces.get(s); } else { /* This should only apply to the outer layer */ ! surfaceCopy = copyOuterSurface(s, copiedVertices, ! copiedEdges, ! copiedSurfaces); ! } + envelopeCopy.add(surfaceCopy); if (s.getFrontDomain() == this) { surfaceCopy.setFrontDomain(copy); *************** *** 1185,1191 **** surfaceCopy.setBackDomain(copy); } - surfaceCopy.getVertices(); } return envelopeCopy; } } --- 1198,1251 ---- surfaceCopy.setBackDomain(copy); } } return envelopeCopy; } + + /** + * Copies a surface in the outer layer of the copy + * @param s the surface to copy + * @param copiedVertices map of vertices and their copies. + * @param copiedEdges map of edges and their copies. + * @param copiedSurfaces map of surfaces and their copies. + * @return the copy of the surface + */ + private Surface copyOuterSurface(Surface s, + Map copiedVertices, + Map copiedEdges, + Map copiedSurfaces) { + Surface surfaceCopy; + { + Iterator edgeIt = s.getEdges().iterator(); + List edgeCopies = new LinkedList(); + while (edgeIt.hasNext()) { + Edge e = (Edge)edgeIt.next(); + if (!copiedVertices.keySet().contains(e.getTo())) { + copiedVertices.put(e.getTo(), e.getTo().copy()); + this.getOwner().add((Vertex)copiedVertices.get(e.getTo())); + } + if (!copiedVertices.keySet().contains(e.getFrom())) { + copiedVertices.put(e.getFrom(), e.getFrom().copy()); + this.getOwner().add((Vertex)copiedVertices.get(e.getFrom())); + } + if (!copiedEdges.keySet().contains(e)) { + copiedEdges.put(e, new Edge((Vertex)copiedVertices.get(e.getFrom()), + (Vertex)copiedVertices.get(e.getTo()))); + } + this.getOwner().add((Edge)copiedEdges.get(e)); + edgeCopies.add(copiedEdges.get(e)); + } + surfaceCopy = new Surface(edgeCopies); + this.getOwner().add(surfaceCopy); + surfaceCopy.setFrontDomain(this.getOwner().getEmpty()); + surfaceCopy.setBackDomain(this.getOwner().getEmpty()); + + copiedSurfaces.put(s, surfaceCopy); + } + Iterator it = s.getHoles().iterator(); + while (it.hasNext()) { + Surface hole = (Surface)it.next(); + surfaceCopy.addHole(copyOuterSurface(hole, copiedVertices, copiedEdges, copiedSurfaces)); + } + return surfaceCopy; + } } |
From: Nordholt <nor...@us...> - 2006-05-15 12:12:30
|
Update of /cvsroot/bprocessor/gui/src/net/sourceforge/bprocessor/gui/treeview In directory sc8-pr-cvs3.sourceforge.net:/tmp/cvs-serv21873/treeview Modified Files: GenericTreeView.java Log Message: added stuff from the space contex menu to the one in the treeview Index: GenericTreeView.java =================================================================== RCS file: /cvsroot/bprocessor/gui/src/net/sourceforge/bprocessor/gui/treeview/GenericTreeView.java,v retrieving revision 1.26 retrieving revision 1.27 diff -C2 -d -r1.26 -r1.27 *** GenericTreeView.java 15 May 2006 10:28:49 -0000 1.26 --- GenericTreeView.java 15 May 2006 12:12:15 -0000 1.27 *************** *** 46,49 **** --- 46,50 ---- import net.sourceforge.bprocessor.model.Surface; import net.sourceforge.bprocessor.model.Vertex; + import net.sourceforge.bprocessor.model.Geometry; /** *************** *** 351,355 **** } ! /** * Context menu for this EntityNode * @return the menu --- 352,356 ---- } ! /** * Context menu for this EntityNode * @return the menu *************** *** 358,398 **** JPopupMenu pm = new JPopupMenu(); Object object = this.getUserObject(); ! if (object instanceof Entity) { ! pm.add(new EntityDeleteAction((Entity)object)); } return pm; } } ! /** ! * The Entity delete action */ ! public class EntityDeleteAction extends AbstractAction { ! ! /** ! * The entity ! */ ! private Entity entity; /** * The constructor * @param ent the entity */ ! public EntityDeleteAction(Entity ent) { ! super("Delte"); this.entity = ent; } ! ! /** ! * Invoked when a action is performed ! * @param event ActionEvent ! */ ! public void actionPerformed(ActionEvent event) { ! info("deleting: " + entity); ! entity.delete(); ! Project.getInstance().checkpoint(); ! } ! } ! /** * SpaceNode --- 359,395 ---- JPopupMenu pm = new JPopupMenu(); Object object = this.getUserObject(); ! if (object instanceof Entity) { ! AbstractAction delete = new EntityAction((Entity)object, "Delete") { ! public void actionPerformed(ActionEvent arg0) { ! if (entity != null) { ! entity.delete(); ! Project.getInstance().checkpoint(); ! } ! } ! }; ! pm.add(delete); } return pm; } } ! /** ! * Actions for a entity */ ! public abstract class EntityAction extends AbstractAction { ! /** The entity */ ! protected Entity entity; /** * The constructor * @param ent the entity + * @param name the name of the action */ ! public EntityAction(Entity ent, String name) { ! super(name); this.entity = ent; } ! } ! /** * SpaceNode *************** *** 437,440 **** --- 434,480 ---- return spaceicon; } + + /** + * Context menu for this SpaceNode + * @return the menu + */ + public JPopupMenu menu() { + JPopupMenu pm = super.menu(); + Object object = this.getUserObject(); + if (object != null) { + AbstractAction copy = new EntityAction((Entity)object, "Copy") { + public void actionPerformed(ActionEvent arg0) { + if (entity != null) { + Space spaceCopy = ((Space)entity).copy(); + select(spaceCopy); + } + } + }; + pm.add(copy); + AbstractAction edit = new EntityAction((Entity)object, "Edit") { + public void actionPerformed(ActionEvent arg0) { + Selection.primary().clear(); + Project.getInstance().setActiveSpace((Space)entity); + } + }; + pm.add(edit); + AbstractAction flip = new EntityAction((Entity)object, "Rotate 90degrees CCW") { + public void actionPerformed(ActionEvent arg0) { + Space space = (Space)entity; + Iterator it = space.collect().iterator(); + Vertex center = space.center(); + while (it.hasNext()) { + Geometry.rotate(Math.PI / 2, + 0, 0, 1, + (Vertex)it.next(), + center); + } + space.changed(); + } + }; + pm.add(flip); + } + return pm; + } } *************** *** 802,806 **** DefaultMutableTreeNode node = (DefaultMutableTreeNode) object; Object target = node.getUserObject(); - log.info("value-changed " + event); select(target); } --- 842,845 ---- |
From: Nikolaj B. <nbr...@us...> - 2006-05-15 12:12:12
|
Update of /cvsroot/bprocessor/gui/src/net/sourceforge/bprocessor/gui/treeview In directory sc8-pr-cvs3.sourceforge.net:/tmp/cvs-serv21560/src/net/sourceforge/bprocessor/gui/treeview Modified Files: SpaceTreeView.java SurfaceTreeView.java Log Message: The tree now sorts nodes by names in alpha order. Index: SurfaceTreeView.java =================================================================== RCS file: /cvsroot/bprocessor/gui/src/net/sourceforge/bprocessor/gui/treeview/SurfaceTreeView.java,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** SurfaceTreeView.java 23 Jan 2006 10:16:26 -0000 1.4 --- SurfaceTreeView.java 15 May 2006 12:11:58 -0000 1.5 *************** *** 8,13 **** package net.sourceforge.bprocessor.gui.treeview; ! import java.util.Collection; import net.sourceforge.bprocessor.model.Project; /** --- 8,17 ---- package net.sourceforge.bprocessor.gui.treeview; ! import java.util.Collections; ! import java.util.Comparator; ! import java.util.LinkedList; ! import net.sourceforge.bprocessor.model.Project; + import net.sourceforge.bprocessor.model.Surface; /** *************** *** 27,32 **** */ public void update() { root.removeAllChildren(); ! Collection surfaces = Project.getInstance().getSurfaces(); root.add(new SurfaceContainer("Surfaces", surfaces)); model.nodeStructureChanged(root); --- 31,43 ---- */ public void update() { + final Comparator alpha = + new Comparator() { + public int compare(Object s1, Object s2) { + return ((Surface) s1).getName().compareToIgnoreCase(((Surface) s2).getName()); + } + }; root.removeAllChildren(); ! LinkedList surfaces = new LinkedList(Project.getInstance().getSurfaces()); ! Collections.sort(surfaces, alpha); root.add(new SurfaceContainer("Surfaces", surfaces)); model.nodeStructureChanged(root); Index: SpaceTreeView.java =================================================================== RCS file: /cvsroot/bprocessor/gui/src/net/sourceforge/bprocessor/gui/treeview/SpaceTreeView.java,v retrieving revision 1.7 retrieving revision 1.8 diff -C2 -d -r1.7 -r1.8 *** SpaceTreeView.java 12 Apr 2006 15:10:09 -0000 1.7 --- SpaceTreeView.java 15 May 2006 12:11:58 -0000 1.8 *************** *** 9,14 **** import java.util.ArrayList; ! import java.util.Collection; import java.util.Enumeration; import javax.swing.tree.DefaultMutableTreeNode; --- 9,16 ---- import java.util.ArrayList; ! import java.util.Collections; ! import java.util.Comparator; import java.util.Enumeration; + import java.util.LinkedList; import javax.swing.tree.DefaultMutableTreeNode; *************** *** 16,19 **** --- 18,22 ---- import net.sourceforge.bprocessor.model.Project; + import net.sourceforge.bprocessor.model.Space; /** *************** *** 38,44 **** */ 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); --- 41,56 ---- */ public void update() { ! final Comparator alpha = ! new Comparator() { ! public int compare(Object s1, Object s2) { ! return ((Space) s1).getName().compareToIgnoreCase(((Space) s2).getName()); ! } ! }; ! LinkedList construction = new LinkedList(Project.getInstance().getConstructionSpaces()); ! Collections.sort(construction, alpha); ! LinkedList functional = new LinkedList(Project.getInstance().getFunctionalSpaces()); ! Collections.sort(functional, alpha); ! LinkedList constraints = new LinkedList(Project.getInstance().getConstraints()); ! Collections.sort(constraints, alpha); Enumeration e = getExpandedDescendants(new TreePath(root)); Object[] paths = findPaths(e); |
From: Nordholt <nor...@us...> - 2006-05-15 12:09:43
|
Update of /cvsroot/bprocessor/gl/src/net/sourceforge/bprocessor/gl/view In directory sc8-pr-cvs3.sourceforge.net:/tmp/cvs-serv20730 Modified Files: View.java Log Message: clipplane interiors is no longer drawn Index: View.java =================================================================== RCS file: /cvsroot/bprocessor/gl/src/net/sourceforge/bprocessor/gl/view/View.java,v retrieving revision 1.89 retrieving revision 1.90 diff -C2 -d -r1.89 -r1.90 *** View.java 8 May 2006 07:14:34 -0000 1.89 --- View.java 15 May 2006 12:09:39 -0000 1.90 *************** *** 1470,1486 **** Collection corners = clipplane.getCorners(); { - gl.glColor4fv(CLIP_PLANE_INTERIOR_COLOR); - gl.glBegin(GL.GL_QUADS); - gl.glNormal3d(d[0], d[1], d[2]); - Iterator it = corners.iterator(); - while (it.hasNext()) { - Vertex v = (Vertex)it.next(); - gl.glVertex3d(v.getX(), - v.getY(), - v.getZ()); - } - gl.glEnd(); - } - { if (selection.contains(clipplane)) { gl.glColor3fv(SELECTED_COLOR); --- 1470,1473 ---- |
From: Nikolaj B. <nbr...@us...> - 2006-05-15 11:57:44
|
Update of /cvsroot/bprocessor/gui/src/net/sourceforge/bprocessor/gui/attrview In directory sc8-pr-cvs3.sourceforge.net:/tmp/cvs-serv15712/src/net/sourceforge/bprocessor/gui/attrview Modified Files: LinkAttribute.java Log Message: The autocompletion now first make an alpha sort Index: LinkAttribute.java =================================================================== RCS file: /cvsroot/bprocessor/gui/src/net/sourceforge/bprocessor/gui/attrview/LinkAttribute.java,v retrieving revision 1.8 retrieving revision 1.9 diff -C2 -d -r1.8 -r1.9 *** LinkAttribute.java 15 May 2006 10:27:53 -0000 1.8 --- LinkAttribute.java 15 May 2006 11:57:38 -0000 1.9 *************** *** 15,18 **** --- 15,20 ---- import java.awt.event.MouseListener; import java.net.URL; + import java.util.Collections; + import java.util.Comparator; import java.util.Iterator; import java.util.LinkedList; *************** *** 397,402 **** public String autocomplete(String string) { if (!string.equalsIgnoreCase("")) { ! List sort = new LinkedList(Project.getInstance().getSpaces()); ! //Collections.sort((List) sort); LinkedList matches = new LinkedList(); Iterator it = sort.iterator(); --- 399,412 ---- public String autocomplete(String string) { if (!string.equalsIgnoreCase("")) { ! final Comparator alpha = ! new Comparator() { ! public int compare(Object s1, Object s2) { ! return ((Space) s1).getName().compareToIgnoreCase(((Space) s2).getName()); ! } ! }; ! ! ! LinkedList sort = new LinkedList(Project.getInstance().getSpaces()); ! Collections.sort(sort, alpha); LinkedList matches = new LinkedList(); Iterator it = sort.iterator(); |
From: Nikolaj B. <nbr...@us...> - 2006-05-15 10:33:13
|
Update of /cvsroot/bprocessor/model/src/net/sourceforge/bprocessor/model In directory sc8-pr-cvs3.sourceforge.net:/tmp/cvs-serv17607/src/net/sourceforge/bprocessor/model Modified Files: Space.java Log Message: Materials can now be saved and loaded, and there is a "global" monitoring of all materials. Index: Space.java =================================================================== RCS file: /cvsroot/bprocessor/model/src/net/sourceforge/bprocessor/model/Space.java,v retrieving revision 1.31 retrieving revision 1.32 diff -C2 -d -r1.31 -r1.32 *** Space.java 7 May 2006 16:58:53 -0000 1.31 --- Space.java 15 May 2006 10:33:09 -0000 1.32 *************** *** 82,85 **** --- 82,90 ---- private long nextSurfaceId; + /** The materials */ + private HashMap materials; + /** The next surface id */ + private long nextMaterialId; + /** The modellor */ private Modellor modellor; *************** *** 112,115 **** --- 117,121 ---- surfaces = new HashMap(); elements = new HashMap(); + materials = new HashMap(); empty = new Space("Void", FUNCTIONAL, false); this.add(empty); *************** *** 614,617 **** --- 620,685 ---- /** + * Add a material + * @param material The material + */ + public void add(Material material) { + if (container) { + Long id = new Long(nextMaterialId++); + material.setId(id); + materials.put(id, material); + } else { + throw new Error("adding material to non-container " + this); + } + } + + /** + * Remove a material + * @param material The material + */ + public void remove(Material material) { + edges.remove(material.getId()); + material.setId(null); + } + + /** + * Insert a material + * @param material The material + * @return The material + */ + public Material insert(Material material) { + add(material); + return material; + } + + /** + * Delete a material + * @param material The material + */ + public void delete(Material material) { + remove(material); + } + + /** + * Return the materials + * @return The materials + */ + public Collection getMaterials() { + if (container) { + return materials.values(); + } else { + return EMPTY; + } + } + + /** + * Return the material + * @param id The id + * @return The material + */ + public Material getMaterial(long id) { + return (Material) materials.get(new Long(id)); + } + + /** * Find vertex based upon location and delta * @param x The x coordinate *************** *** 881,884 **** --- 949,953 ---- ArrayList res = new ArrayList(); res.add(new Attribute("Name", getName())); + res.add(new Attribute("ID", getId().toString())); res.add(new Attribute("Description", getDescription())); return res; |
From: Nikolaj B. <nbr...@us...> - 2006-05-15 10:32:13
|
Update of /cvsroot/bprocessor/model/src/net/sourceforge/bprocessor/model In directory sc8-pr-cvs3.sourceforge.net:/tmp/cvs-serv17233/src/net/sourceforge/bprocessor/model Modified Files: Project.java Log Message: Materials can now be saved and loaded, and there is a "global" monitoring of all materials. Index: Project.java =================================================================== RCS file: /cvsroot/bprocessor/model/src/net/sourceforge/bprocessor/model/Project.java,v retrieving revision 1.56 retrieving revision 1.57 diff -C2 -d -r1.56 -r1.57 *** Project.java 7 May 2006 09:33:36 -0000 1.56 --- Project.java 15 May 2006 10:32:10 -0000 1.57 *************** *** 482,485 **** --- 482,529 ---- /** + * Add a material + * @param material The material + */ + public void add(Material material) { + world.add(material); + changed(this); + } + + /** + * Remove a material + * @param material The material + */ + public void remove(Material material) { + world.remove(material); + changed(this); + } + + /** + * Delete a material + * @param material The material to delete + */ + public void delete(Material material) { + world.delete(material); + changed(this); + } + + /** + * Find all Materials + * @return The Material + */ + public Collection getMaterials() { + return world.getMaterials(); + } + + /** + * Find Material by id + * @param id The id + * @return The Material + */ + public Material findMaterialById(long id) { + return (Material)world.getMaterial(id); + } + + /** * Add a camera * @param c The camera |