bprocessor-commit Mailing List for B-processor (Page 99)
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-09-29 15:07:31
|
Update of /cvsroot/bprocessor/gui/src/net/sourceforge/bprocessor/gui In directory sc8-pr-cvs3.sourceforge.net:/tmp/cvs-serv13563/src/net/sourceforge/bprocessor/gui Modified Files: CameraView.java Log Message: Forgot to use checkstyle Index: CameraView.java =================================================================== RCS file: /cvsroot/bprocessor/gui/src/net/sourceforge/bprocessor/gui/CameraView.java,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** CameraView.java 29 Sep 2006 14:57:15 -0000 1.6 --- CameraView.java 29 Sep 2006 15:07:29 -0000 1.7 *************** *** 22,26 **** import net.sourceforge.bprocessor.model.Camera; import net.sourceforge.bprocessor.model.Project; - import net.sourceforge.bprocessor.model.Selection; /** --- 22,25 ---- |
Update of /cvsroot/bprocessor/model/src/net/sourceforge/bprocessor/model In directory sc8-pr-cvs3.sourceforge.net:/tmp/cvs-serv9629/src/net/sourceforge/bprocessor/model Modified Files: Constraint.java Line.java Camera.java Space.java Point.java Project.java CoordinateSystem.java Log Message: Changed the Tree view to update by recursive calls to keep selection and all open paths, as well as refactoring of the generictreeview structure Made all remove methods private in the model and let delete methods call remove and afterwards make a changed event. Index: CoordinateSystem.java =================================================================== RCS file: /cvsroot/bprocessor/model/src/net/sourceforge/bprocessor/model/CoordinateSystem.java,v retrieving revision 1.27 retrieving revision 1.28 diff -C2 -d -r1.27 -r1.28 *** CoordinateSystem.java 8 Sep 2006 13:25:59 -0000 1.27 --- CoordinateSystem.java 29 Sep 2006 14:57:24 -0000 1.28 *************** *** 310,314 **** */ public void delete() { ! getOwner().delete(this); } --- 310,314 ---- */ public void delete() { ! getOwner().remove(this); } Index: Camera.java =================================================================== RCS file: /cvsroot/bprocessor/model/src/net/sourceforge/bprocessor/model/Camera.java,v retrieving revision 1.22 retrieving revision 1.23 diff -C2 -d -r1.22 -r1.23 *** Camera.java 29 Aug 2006 08:49:25 -0000 1.22 --- Camera.java 29 Sep 2006 14:57:24 -0000 1.23 *************** *** 99,102 **** --- 99,107 ---- new double[]{c.roll[0], c.roll[1], c.roll[2]}, c.getType()); this.setFocalwidth(c.getFocalwidth()); + Iterator clips = c.getClipplanes().iterator(); + while(clips.hasNext()) { + ClippingPlane clip = (ClippingPlane)clips.next(); + this.addClipplane(clip); + } } Index: Point.java =================================================================== RCS file: /cvsroot/bprocessor/model/src/net/sourceforge/bprocessor/model/Point.java,v retrieving revision 1.10 retrieving revision 1.11 diff -C2 -d -r1.10 -r1.11 *** Point.java 18 Sep 2006 14:10:07 -0000 1.10 --- Point.java 29 Sep 2006 14:57:24 -0000 1.11 *************** *** 49,53 **** */ public void delete() { ! getOwner().delete(this); } --- 49,53 ---- */ public void delete() { ! getOwner().remove(this); } Index: Constraint.java =================================================================== RCS file: /cvsroot/bprocessor/model/src/net/sourceforge/bprocessor/model/Constraint.java,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** Constraint.java 12 Apr 2006 14:29:27 -0000 1.3 --- Constraint.java 29 Sep 2006 14:57:24 -0000 1.4 *************** *** 121,125 **** */ public void delete() { ! Project.getInstance().remove(this); } } --- 121,125 ---- */ public void delete() { ! Project.getInstance().delete(this); } } Index: Project.java =================================================================== RCS file: /cvsroot/bprocessor/model/src/net/sourceforge/bprocessor/model/Project.java,v retrieving revision 1.75 retrieving revision 1.76 diff -C2 -d -r1.75 -r1.76 *** Project.java 26 Sep 2006 09:52:24 -0000 1.75 --- Project.java 29 Sep 2006 14:57:24 -0000 1.76 *************** *** 243,251 **** Object next = iter.next(); if (next instanceof Edge) { ! world.delete((Edge)next); } else if (next instanceof Surface) { ! delete((Surface)next); } else if (next instanceof Vertex) { ! world.delete((Vertex)next); } else if (next instanceof Space) { remove((Space)next); --- 243,251 ---- Object next = iter.next(); if (next instanceof Edge) { ! remove((Edge)next); } else if (next instanceof Surface) { ! remove((Surface)next); } else if (next instanceof Vertex) { ! remove((Vertex)next); } else if (next instanceof Space) { remove((Space)next); *************** *** 268,278 **** /** ! * Remove a constraint * @param constraint The constraint to remove */ ! public void remove(Constraint constraint) { constraints.remove(constraint); constraint.setId(null); - changed(this); } --- 268,286 ---- /** ! * Remove a constraint and call change * @param constraint The constraint to remove */ ! public void delete(Constraint constraint) { ! remove(constraint); ! changed(this); ! } ! ! /** ! * Remove a constraint dont call change ! * @param constraint The constraint to remove ! */ ! private void remove(Constraint constraint) { constraints.remove(constraint); constraint.setId(null); } *************** *** 369,372 **** --- 377,381 ---- public void add(Space space) { world.add(space); + changed(this); } *************** *** 409,426 **** */ public void delete(Edge edge) { ! world.delete(edge); changed(this); } ! ! /** ! * Remove an edge * @param edge The edge */ ! public void remove(Edge edge) { ! world.delete(edge); ! changed(this); } ! /** * Find all edges --- 418,437 ---- */ public void delete(Edge edge) { ! remove(edge); changed(this); } ! /** ! * Remove an Edge * @param edge The edge */ ! private void remove(Edge edge) { ! if (edge.getOwner() != null) { ! edge.getOwner().delete(edge); ! } else { ! log.warn("Owner were null on " + edge); ! } } ! /** * Find all edges *************** *** 432,444 **** /** ! * Remove a space * @param space The space to remove */ ! public void remove(Space space) { ! world.remove(space); } /** ! * Delete a space * @param space The space to delete */ --- 443,459 ---- /** ! * Remove a space dont call changed * @param space The space to remove */ ! private void remove(Space space) { ! if (space.getOwner() != null) { ! space.getOwner().remove(space); ! } else { ! log.warn("Owner were null on " + space); ! } } /** ! * Delete a space and call changed * @param space The space to delete */ *************** *** 478,484 **** * @param surface The surface */ ! public void remove(Surface surface) { ! world.remove(surface); ! changed(this); } --- 493,498 ---- * @param surface The surface */ ! private void remove(Surface surface) { ! surface.delete(); } *************** *** 488,492 **** */ public void delete(Surface surface) { ! surface.delete(); changed(this); } --- 502,506 ---- */ public void delete(Surface surface) { ! remove(surface); changed(this); } *************** *** 520,537 **** /** ! * Remove a vertex * @param vertex The vertex */ ! public void remove(Vertex vertex) { ! world.remove(vertex); ! changed(this); } /** ! * Delete a vertex * @param vertex The vertex to delete */ public void delete(Vertex vertex) { ! world.delete(vertex); changed(this); } --- 534,552 ---- /** ! * Remove a vertex dont call changed * @param vertex The vertex */ ! private void remove(Vertex vertex) { ! if (vertex.getOwner() != null) { ! vertex.getOwner().delete(vertex); ! } } /** ! * Delete a vertex and call changed * @param vertex The vertex to delete */ public void delete(Vertex vertex) { ! remove(vertex); changed(this); } *************** *** 555,572 **** /** ! * 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); } --- 570,586 ---- /** ! * Remove a material dont call changed * @param material The material */ ! private void remove(Material material) { world.remove(material); } /** ! * Delete a material call changed * @param material The material to delete */ public void delete(Material material) { ! remove(material); changed(this); } Index: Space.java =================================================================== RCS file: /cvsroot/bprocessor/model/src/net/sourceforge/bprocessor/model/Space.java,v retrieving revision 1.68 retrieving revision 1.69 diff -C2 -d -r1.68 -r1.69 *** Space.java 29 Sep 2006 07:13:00 -0000 1.68 --- Space.java 29 Sep 2006 14:57:24 -0000 1.69 *************** *** 428,434 **** */ public void remove(Constructor c) { ! constructors.remove(c.getId()); ! c.setId(null); ! c.setOwner(null); } --- 428,436 ---- */ public void remove(Constructor c) { ! if (c.getId() != null && c != Project.getInstance().getActiveCoordinateSystem()) { ! constructors.remove(c.getId()); ! c.setId(null); ! c.setOwner(null); ! } } *************** *** 444,457 **** /** - * Delete a constructor - * @param c The constructor - */ - public void delete(Constructor c) { - if (c.getId() != null && c != Project.getInstance().getActiveCoordinateSystem()) { - remove(c); - } - } - - /** * Return the constructors * @return The constructors --- 446,449 ---- Index: Line.java =================================================================== RCS file: /cvsroot/bprocessor/model/src/net/sourceforge/bprocessor/model/Line.java,v retrieving revision 1.25 retrieving revision 1.26 diff -C2 -d -r1.25 -r1.26 *** Line.java 18 Sep 2006 14:35:47 -0000 1.25 --- Line.java 29 Sep 2006 14:57:24 -0000 1.26 *************** *** 115,119 **** */ public void delete() { ! getOwner().delete(this); } --- 115,119 ---- */ public void delete() { ! getOwner().remove(this); } |
From: rimestad <rim...@us...> - 2006-09-29 14:57:27
|
Update of /cvsroot/bprocessor/gui/src/net/sourceforge/bprocessor/gui/treeview In directory sc8-pr-cvs3.sourceforge.net:/tmp/cvs-serv9581/src/net/sourceforge/bprocessor/gui/treeview Modified Files: GenericTreeView.java SpaceTreeView.java CameraTreeView.java SurfaceTreeView.java Log Message: Changed the Tree view to update by recursive calls to keep selection and all open paths, as well as refactoring of the generictreeview structure Made all remove methods private in the model and let delete methods call remove and afterwards make a changed event. Index: SurfaceTreeView.java =================================================================== RCS file: /cvsroot/bprocessor/gui/src/net/sourceforge/bprocessor/gui/treeview/SurfaceTreeView.java,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** SurfaceTreeView.java 17 May 2006 12:03:42 -0000 1.6 --- SurfaceTreeView.java 29 Sep 2006 14:57:15 -0000 1.7 *************** *** 26,32 **** */ public void update() { ! root.removeAllChildren(); ! root.add(new SurfaceContainer("Surfaces", Project.getInstance().getSurfaces())); ! model.nodeStructureChanged(root); } } --- 26,35 ---- */ public void update() { ! if (root.getChildCount() == 0) { ! root.add(new SurfaceContainer("Surfaces", Project.getInstance().getSurfaces())); ! model.nodeStructureChanged(root); ! } else { ! ((GenericNode)root.getChildAt(0)).update(Project.getInstance().getSurfaces()); ! } } } Index: GenericTreeView.java =================================================================== RCS file: /cvsroot/bprocessor/gui/src/net/sourceforge/bprocessor/gui/treeview/GenericTreeView.java,v retrieving revision 1.49 retrieving revision 1.50 diff -C2 -d -r1.49 -r1.50 *** GenericTreeView.java 26 Sep 2006 09:50:54 -0000 1.49 --- GenericTreeView.java 29 Sep 2006 14:57:15 -0000 1.50 *************** *** 17,20 **** --- 17,21 ---- import java.util.Collections; import java.util.Comparator; + import java.util.Enumeration; import java.util.HashSet; import java.util.Iterator; *************** *** 274,278 **** * GenericNode */ ! public class GenericNode extends DefaultMutableTreeNode { /** * --- 275,279 ---- * GenericNode */ ! public abstract class GenericNode extends DefaultMutableTreeNode { /** * *************** *** 303,306 **** --- 304,318 ---- return null; } + + /** + * @param o the object to update with + */ + public void update(Object o) { + if (o != null) { + this.userObject = o; + } else { + log.warn("Tried to update with null on " + this); + } + } } *************** *** 354,357 **** --- 366,438 ---- public ImageIcon icon() { return genericgroupicon; + } + + /** + * Remove the children from container node + * @param children the children to remove + */ + protected void removeChildren(Collection children) { + Object[] rem = new Object[children.size()]; + int[] indices = new int[children.size()]; + int i= 0,reach = 0; + for (int n = 0; n < this.children.size(); n++) { + GenericNode s = (GenericNode)this.getChildAt(n); + if (children.contains(s)) { + rem[i] = s; + indices[i] = n; + i++; + } + } + for(int k=0; k < rem.length; k++) { + this.remove((GenericNode)rem[k]); + } + if (rem.length > 0) { + model.nodesWereRemoved(this, indices, rem); + } + } + + /** + * Update the container + */ + public void update(Object o) { + if (o instanceof Collection) { + Set elem = new HashSet((Collection)o); + Set children = new HashSet(); + Enumeration e = this.children(); + while (e.hasMoreElements()) { + GenericNode sn = (GenericNode)e.nextElement(); + if (elem.contains(sn.getUserObject())) { + //If the node is allready there then just update it + sn.update(sn.getUserObject()); + elem.remove(sn.getUserObject()); + } else { + children.add(sn); + } + } + if (elem.size() > 0) { + this.insertChildren(elem); + } + if (children.size() > 0) { + this.removeChildren(children); + } + } else { + log.warn("Were called with " + o + " and not a list"); + } + } + + /** + * Insert the given object into the node + * @param elem the elements + */ + public void insertChildren(Collection elem) { + int[] ins = new int[elem.size()]; + int i = 0; + Iterator iter = elem.iterator(); + while (iter.hasNext()) { + this.add(new EntityNode(iter.next())); + ins[i] = this.getChildCount() - 1; + i++; + } + model.nodesWereInserted(this, ins); } } *************** *** 400,403 **** --- 481,495 ---- return pm; } + + + /** + * + */ + public void update(Object o) { + if (o instanceof Entity || o instanceof Attribute) { + userObject = o; + model.nodeChanged(this); + } + } } *************** *** 410,414 **** */ private static final long serialVersionUID = 1L; ! /** * Constructor for SpaceNode --- 502,506 ---- */ private static final long serialVersionUID = 1L; ! /** * Constructor for SpaceNode *************** *** 419,423 **** Set surfaces = space.getEnvelope(); add(new SurfaceContainer("Surfaces", surfaces)); ! add(new ElementContainer("Elements", space)); add(new GeometryContainer("Geometry", space)); if (space.getModellor() != null) { --- 511,515 ---- Set surfaces = space.getEnvelope(); add(new SurfaceContainer("Surfaces", surfaces)); ! add(new ElementContainer("Elements", space.getElements())); add(new GeometryContainer("Geometry", space)); if (space.getModellor() != null) { *************** *** 426,429 **** --- 518,530 ---- } + public void update(Object o) { + if (o instanceof Space) { + Space s = (Space)o; + ((GenericNode)getChildAt(0)).update(s.getEnvelope()); + ((GenericNode)getChildAt(1)).update(s.getElements()); + ((GenericNode)getChildAt(2)).update(s); + } + } + /** * Return the displaystring for this EntityNode *************** *** 484,487 **** --- 585,598 ---- return surfaceicon; } + + /** + * + */ + public void update(Object o) { + if (o instanceof Surface) { + userObject = (Surface)o; + ((GenericNode)getChildAt(0)).update(((Surface)o).getEdges()); + } + } } *************** *** 538,541 **** --- 649,663 ---- return edgeicon; } + + public void update(Object o) { + if (o instanceof Edge) { + Edge e = (Edge)o; + userObject = e; + ((EntityNode)this.getChildAt(0)).update(e.getFrom()); + ((EntityNode)this.getChildAt(1)).update(e.getTo()); + } else { + log.warn("Should be a edge but weren't" + o); + } + } } *************** *** 586,669 **** /** - * CameraNode - */ - public class CameraNode extends EntityNode { - /** */ - private static final long serialVersionUID = 1L; - - /** - * Constructor for CameraNode - * @param camera The camera - */ - public CameraNode(Camera camera) { - super(camera); - } - } - - /** - * ProjectContainer - */ - public class ProjectContainer extends ContainerNode { - /** - * - */ - private static final long serialVersionUID = 1L; - - /** name */ - private String name; - - /** - * Constructor for ProjectContainer - * @param name Display name - * @param object The project - */ - public ProjectContainer(String name, Project object) { - super(object); - Collection spaces = object.getSpaces(); - this.name = 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(); - add(new SpaceNode(current)); - } - } - - /** - * Name - * @return String - */ - public String toString() { - return name; - } - - /** - * Return icon - * @return Icon - */ - public ImageIcon icon() { - return spacegroupicon; - } - - } - - /** * SurfaceContainer */ --- 708,711 ---- *************** *** 695,699 **** } } ! /** * Return icon --- 737,759 ---- } } ! ! /** ! * Insert the given object into the node ! * @param elem the elements ! */ ! public void insertChildren(Collection elem) { ! int[] ins = new int[elem.size()]; ! int i = 0; ! Iterator iter = elem.iterator(); ! while (iter.hasNext()) { ! Surface s = (Surface)iter.next(); ! this.add(new SurfaceNode(s)); ! ins[i] = this.getChildCount() - 1; ! i++; ! } ! model.nodesWereInserted(this, ins); ! } ! ! /** * Return icon *************** *** 703,707 **** return surfacegroupicon; } - } --- 763,766 ---- *************** *** 720,726 **** * @param space The space */ ! public ElementContainer(String name, Space space) { super(name); - Collection elements = space.getElements(); Iterator iter = elements.iterator(); while (iter.hasNext()) { --- 779,784 ---- * @param space The space */ ! public ElementContainer(String name, Collection elements) { super(name); Iterator iter = elements.iterator(); while (iter.hasNext()) { *************** *** 731,734 **** --- 789,810 ---- /** + * Insert the given object into the node + * @param elem the elements + */ + public void insertChildren(Collection elem) { + int[] ins = new int[elem.size()]; + int i = 0; + Iterator iter = elem.iterator(); + while (iter.hasNext()) { + Space s = (Space)iter.next(); + log.info("interted " + s); + this.add(new SpaceNode(s)); + ins[i] = this.getChildCount() - 1; + i++; + } + model.nodesWereInserted(this, ins); + } + + /** * Return icon * @return Icon *************** *** 760,763 **** --- 836,846 ---- add(new VertexContainer("Vertices", space.getVertices())); } + + public void update(Object o) { + Space s = (Space)o; + ((SurfaceContainer)this.getChildAt(0)).update(s.getSurfaces()); + ((EdgeContainer)this.getChildAt(1)).update(s.getEdges()); + ((VertexContainer)this.getChildAt(2)).update(s.getVertices()); + } } *************** *** 781,785 **** Iterator iter = constructors.iterator(); while (iter.hasNext()) { ! add(new ConstructorNode((Constructor)iter.next())); } } --- 864,869 ---- Iterator iter = constructors.iterator(); while (iter.hasNext()) { ! Constructor current = (Constructor) iter.next(); ! add(new ConstructorNode(current)); } } *************** *** 792,795 **** --- 876,896 ---- return constructorgroupicon; } + + /** + * Insert the given object into the node + * @param elem the elements + */ + public void insertChildren(Collection elem) { + int[] ins = new int[elem.size()]; + int i = 0; + Iterator iter = elem.iterator(); + while (iter.hasNext()) { + Constructor s = (Constructor)iter.next(); + this.add(new ConstructorNode(s)); + ins[i] = this.getChildCount() - 1; + i++; + } + model.nodesWereInserted(this, ins); + } } *************** *** 816,819 **** --- 917,937 ---- /** + * Insert the given object into the node + * @param elem the elements + */ + public void insertChildren(Collection elem) { + int[] ins = new int[elem.size()]; + int i = 0; + Iterator iter = elem.iterator(); + while (iter.hasNext()) { + Edge s = (Edge)iter.next(); + this.add(new EdgeNode(s)); + ins[i] = this.getChildCount() - 1; + i++; + } + model.nodesWereInserted(this, ins); + } + + /** * Return icon * @return Icon *************** *** 825,828 **** --- 943,972 ---- /** + * CameraNode + */ + public class CameraNode extends ContainerNode { + /** */ + private static final long serialVersionUID = 1L; + + /** + * Constructor for EdgeContainer + * @param name The name + * @param vertices The edges + */ + public CameraNode(Camera c) { + super(c); + update(c); + } + + public void update(Object o) { + if (o instanceof Camera) { + super.update(((Camera)o).getClipplanes()); + } else { + log.warn("Were a " + o + " not a Camera"); + } + } + } + + /** * VertexContainer */ *************** *** 852,872 **** return edgegroupicon; } ! } ! ! /** ! * ConstraintNode ! */ ! public class ConstraintNode extends EntityNode { ! /** ! * ! */ ! private static final long serialVersionUID = 1L; ! /** ! * Constructor for ConstraintNode ! * @param constraint The constraint */ ! public ConstraintNode(Constraint constraint) { ! super(constraint); } } --- 996,1016 ---- return edgegroupicon; } ! ! /** ! * Insert the given object into the node ! * @param elem the elements */ ! public void insertChildren(Collection elem) { ! int[] ins = new int[elem.size()]; ! int i = 0; ! Iterator iter = elem.iterator(); ! while (iter.hasNext()) { ! Vertex s = (Vertex)iter.next(); ! this.add(new VertexNode(s)); ! ins[i] = this.getChildCount() - 1; ! i++; ! } ! model.nodesWereInserted(this, ins); } } *************** *** 893,900 **** while (iter.hasNext()) { Attribute current = (Attribute) iter.next(); ! add(new AttributeNode(current)); } } /** * Name --- 1037,1050 ---- while (iter.hasNext()) { Attribute current = (Attribute) iter.next(); ! add(new EntityNode(current)); } } + public void update(Object o) { + if (o instanceof ParameterBlock) { + super.update(((ParameterBlock)o).getAttributes()); + } + } + /** * Name *************** *** 943,974 **** /** - * AttributeNode - */ - public class AttributeNode extends EntityNode { - /** */ - private static final long serialVersionUID = 1L; - - /** Attribute */ - private Attribute attribute; - - /** - * Constructor - * @param object Attribute - */ - public AttributeNode(Attribute object) { - super(object); - attribute = object; - } - - /** - * Name - * @return String - */ - public String toString() { - return attribute.getName(); - } - } - - /** * ConstraintContainer */ --- 1093,1096 ---- *************** *** 989,998 **** while (iter.hasNext()) { Constraint current = (Constraint) iter.next(); ! add(new ConstraintNode(current)); } } } - /** * Selection Listener --- 1111,1119 ---- while (iter.hasNext()) { Constraint current = (Constraint) iter.next(); ! add(new EntityNode(current)); } } } /** * Selection Listener Index: CameraTreeView.java =================================================================== RCS file: /cvsroot/bprocessor/gui/src/net/sourceforge/bprocessor/gui/treeview/CameraTreeView.java,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** CameraTreeView.java 25 Jul 2006 13:14:55 -0000 1.6 --- CameraTreeView.java 29 Sep 2006 14:57:15 -0000 1.7 *************** *** 9,25 **** import java.util.Collection; import java.util.Iterator; import java.util.Enumeration; ! import java.util.ArrayList; import javax.swing.event.TreeSelectionEvent; import javax.swing.event.TreeSelectionListener; - import javax.swing.tree.TreePath; import javax.swing.tree.DefaultMutableTreeNode; import net.sourceforge.bprocessor.model.Camera; import net.sourceforge.bprocessor.model.Project; ! import net.sourceforge.bprocessor.model.Entity; ! /** --- 9,25 ---- import java.util.Collection; + import java.util.HashSet; import java.util.Iterator; import java.util.Enumeration; ! import java.util.Set; import javax.swing.event.TreeSelectionEvent; import javax.swing.event.TreeSelectionListener; import javax.swing.tree.DefaultMutableTreeNode; + import javax.swing.tree.TreeSelectionModel; import net.sourceforge.bprocessor.model.Camera; import net.sourceforge.bprocessor.model.Project; ! import net.sourceforge.bprocessor.model.Selection; /** *************** *** 29,34 **** /** */ private static final long serialVersionUID = 1L; - /** The selected camera */ - private Camera selected; /** --- 29,32 ---- *************** *** 37,175 **** public CameraTreeView() { super(); this.addTreeSelectionListener(new SelectionListener()); ! selected = null; } - /** ! * Update the TreeView */ ! public void update() { ! selected = findSelectedCamera(); ! Enumeration e = getExpandedDescendants(new TreePath(root)); ! Object[] paths = findPaths(e); ! root.removeAllChildren(); ! Collection cameras = Project.getInstance().getCameras(); ! Collection defaultCams = Project.getInstance().getDefaultCameras(); ! Iterator iter = defaultCams.iterator(); ! while (iter.hasNext()) { ! Camera current = (Camera) iter.next(); ! GenericTreeView.CameraNode cn = new GenericTreeView.CameraNode(current); ! Iterator clipIt = current.getClipplanes().iterator(); ! while (clipIt.hasNext()) { ! cn.add(new EntityNode((Entity)clipIt.next())); } - root.add(cn); } ! iter = cameras.iterator(); ! while (iter.hasNext()) { ! Camera current = (Camera) iter.next(); ! if (!defaultCams.contains(current)) { ! GenericTreeView.CameraNode cn = new GenericTreeView.CameraNode(current); ! Iterator clipIt = current.getClipplanes().iterator(); ! while (clipIt.hasNext()) { ! cn.add(new EntityNode((Entity)clipIt.next())); ! } ! root.add(cn); ! } } - model.nodeStructureChanged(root); - openPaths(paths); - selectCamera(selected); } /** ! * Selects a given camera in the tree ! * @param cam the camera to select */ ! private void selectCamera(Camera cam) { ! Enumeration en = root.children(); ! while (en.hasMoreElements()) { ! Object o = en.nextElement(); ! if (o instanceof GenericTreeView.CameraNode) { ! GenericTreeView.CameraNode cn = (GenericTreeView.CameraNode)o; ! if (cn.getUserObject() == cam) { ! selectionModel.clearSelection(); ! selectionModel.addSelectionPath(new TreePath(new Object[] {root, cn})); ! break; } } ! } ! } ! ! /** ! * Finds the currently selected Camera ! * @return the selected camera if any else null ! */ ! private Camera findSelectedCamera() { ! Camera selected = null; ! if (selectionModel.getSelectionPath() != null) { ! Object o = selectionModel.getSelectionPath().getLastPathComponent(); ! if (o instanceof DefaultMutableTreeNode) { ! DefaultMutableTreeNode node = (DefaultMutableTreeNode)o; ! if (node.getUserObject() instanceof Camera) { ! selected = (Camera)node.getUserObject(); ! } } ! } ! return selected; ! } ! ! /** ! * Find the paths ! * @param e and enumerator of open nodes ! * @return And array of arrays of objects ! */ ! private Object[] findPaths(Enumeration e) { ! if (e != null) { ! ArrayList res = new ArrayList(); ! while (e.hasMoreElements()) { ! Object o = e.nextElement(); ! if (o instanceof TreePath) { ! TreePath tp = (TreePath)o; ! Object[] os = tp.getPath(); ! Object[] temp = new Object[os.length]; ! for (int i = 0; i < os.length; i++) { ! temp[i] = ((DefaultMutableTreeNode)os[i]).getUserObject(); ! } ! res.add(temp); ! } } - return res.toArray(); } - return null; } /** ! * Open the paths of the given objects ! * @param paths The open paths */ ! public void openPaths(Object[] paths) { ! if (paths != null) { ! for (int i = 0; i < paths.length; i++) { ! Object[] route = (Object[])paths[i]; ! if (route.length > 1) { ! openPath(root, 1, route); ! } ! } } } /** ! * Open one path in the tree ! * @param depth The depth reached in this call (< route.length) ! * @param node The node to check in ! * @param route The path to open */ ! private void openPath(DefaultMutableTreeNode node, int depth, Object[] route) { ! Enumeration e = node.children(); ! while (e.hasMoreElements()) { ! DefaultMutableTreeNode current = (DefaultMutableTreeNode)e.nextElement(); ! if (current.getUserObject() == route[depth]) { ! expandPath(new TreePath(current.getPath())); ! if (depth + 1 < route.length) { ! openPath(current, depth + 1, route); ! } ! } ! } } --- 35,116 ---- public CameraTreeView() { super(); + setShowsRootHandles(true); + getSelectionModel().setSelectionMode(TreeSelectionModel.SINGLE_TREE_SELECTION); this.addTreeSelectionListener(new SelectionListener()); ! update(Project.getInstance().getCameras(), root); ! model.nodeStructureChanged(root); } /** ! * Remove the children from container node ! * @param children the children to remove */ ! private void removeChildren(Collection children, DefaultMutableTreeNode where) { ! Object[] rem = new Object[children.size()]; ! int[] indices = new int[children.size()]; ! int i= 0; ! for (int n = 0; n < where.getChildCount(); n++) { ! GenericNode s = (GenericNode)where.getChildAt(n); ! if (children.contains(s)) { ! rem[i] = s; ! indices[i] = n; ! i++; } } ! for(int k=0; k < rem.length; k++) { ! where.remove((GenericNode)rem[k]); ! } ! if (rem.length > 0) { ! model.nodesWereRemoved(where, indices, rem); } } /** ! * Update the container */ ! private void update(Object o, DefaultMutableTreeNode where) { ! if (o instanceof Collection) { ! Set elem = new HashSet((Collection)o); ! Set children = new HashSet(); ! Enumeration e = where.children(); ! while (e.hasMoreElements()) { ! GenericNode sn = (GenericNode)e.nextElement(); ! if (elem.contains(sn.getUserObject())) { ! //If the node is allready there then just update it ! sn.update(sn.getUserObject()); ! elem.remove(sn.getUserObject()); ! } else { ! children.add(sn); } } ! if (elem.size() > 0) { ! insertChildren(elem, where); } ! if (children.size() > 0) { ! removeChildren(children, where); } } } /** ! * Insert the given object into the node ! * @param elem the elements */ ! private void insertChildren(Collection elem, DefaultMutableTreeNode where) { ! int[] ins = new int[elem.size()]; ! int i = 0; ! Iterator iter = elem.iterator(); ! while (iter.hasNext()) { ! where.add(new CameraNode((Camera)iter.next())); ! ins[i] = where.getChildCount() - 1; ! i++; } + model.nodesWereInserted(where, ins); } /** ! * Update the TreeView */ ! public void update() { ! update(Project.getInstance().getCameras(), root); } *************** *** 188,195 **** DefaultMutableTreeNode node = (DefaultMutableTreeNode) object; Object target = node.getUserObject(); ! if (target instanceof Camera && target != selected) { ! selected = (Camera)target; ! Project.getInstance().setCurrentCamera(new Camera(selected, ! "Current Camera")); } } --- 129,135 ---- DefaultMutableTreeNode node = (DefaultMutableTreeNode) object; Object target = node.getUserObject(); ! if (target instanceof Camera) { ! Camera c = new Camera((Camera)target, "Current Camera"); ! Project.getInstance().setCurrentCamera(c); } } Index: SpaceTreeView.java =================================================================== RCS file: /cvsroot/bprocessor/gui/src/net/sourceforge/bprocessor/gui/treeview/SpaceTreeView.java,v retrieving revision 1.13 retrieving revision 1.14 diff -C2 -d -r1.13 -r1.14 *** SpaceTreeView.java 11 Sep 2006 09:21:03 -0000 1.13 --- SpaceTreeView.java 29 Sep 2006 14:57:15 -0000 1.14 *************** *** 14,17 **** --- 14,18 ---- import javax.swing.tree.TreePath; + import net.sourceforge.bprocessor.model.Entity; import net.sourceforge.bprocessor.model.Project; *************** *** 37,50 **** */ public void update() { ! Enumeration e = getExpandedDescendants(new TreePath(root)); ! Object[] paths = findPaths(e); ! root.removeAllChildren(); ! root.add(new ProjectContainer("Project", Project.getInstance())); ! root.add(new ConstraintContainer("Constraints", Project.getInstance().getConstraints())); ! root.add(new ParameterBlockNode("Globals", Project.getInstance().getGlobals())); ! root.add(new GeometryContainer("Geometry", Project.getInstance().world())); ! root.add(new ConstructorContainer("Constructors", Project.getInstance().getConstructors())); ! model.nodeStructureChanged(root); ! openPaths(paths); } --- 38,64 ---- */ public void update() { ! if (root.getChildCount() == 5) { ! ((GenericNode)root.getChildAt(0)).update(Project.getInstance().getSpaces()); ! ((GenericNode)root.getChildAt(1)).update(Project.getInstance().getConstraints()); ! ((GenericNode)root.getChildAt(2)).update(Project.getInstance().getGlobals()); ! ((GenericNode)root.getChildAt(3)).update(Project.getInstance().world()); ! ((GenericNode)root.getChildAt(4)).update(Project.getInstance().getConstructors()); ! } else { ! Enumeration e = getExpandedDescendants(new TreePath(root)); ! Object[] paths = findPaths(e); ! root.removeAllChildren(); ! root.add(new ElementContainer("Project", Project.getInstance().getSpaces())); ! root.add(new ConstraintContainer("Constraints", Project.getInstance().getConstraints())); ! root.add(new ParameterBlockNode("Globals", Project.getInstance().getGlobals())); ! root.add(new GeometryContainer("Geometry", Project.getInstance().world())); ! root.add(new ConstructorContainer("Constructors", Project.getInstance().getConstructors())); ! model.nodeStructureChanged(root); ! openPaths(paths); ! } ! } ! ! public DefaultMutableTreeNode handleNode(DefaultMutableTreeNode node, Object which) { ! ! return null; } |
From: rimestad <rim...@us...> - 2006-09-29 14:57:26
|
Update of /cvsroot/bprocessor/gui/src/net/sourceforge/bprocessor/gui In directory sc8-pr-cvs3.sourceforge.net:/tmp/cvs-serv9581/src/net/sourceforge/bprocessor/gui Modified Files: CameraView.java Log Message: Changed the Tree view to update by recursive calls to keep selection and all open paths, as well as refactoring of the generictreeview structure Made all remove methods private in the model and let delete methods call remove and afterwards make a changed event. Index: CameraView.java =================================================================== RCS file: /cvsroot/bprocessor/gui/src/net/sourceforge/bprocessor/gui/CameraView.java,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** CameraView.java 25 Jul 2006 13:16:13 -0000 1.5 --- CameraView.java 29 Sep 2006 14:57:15 -0000 1.6 *************** *** 16,21 **** --- 16,23 ---- import javax.swing.JPanel; import javax.swing.JScrollPane; + import javax.swing.tree.TreePath; import net.sourceforge.bprocessor.gui.treeview.CameraTreeView; + import net.sourceforge.bprocessor.gui.treeview.GenericTreeView.CameraNode; import net.sourceforge.bprocessor.model.Camera; import net.sourceforge.bprocessor.model.Project; *************** *** 71,77 **** p.setCurrentCamera(c); } else if (which == remove) { ! Object[] tar = Selection.primary().toArray(); ! if (tar[0] instanceof Camera) { ! p.remove((Camera)tar[0]); } } --- 73,82 ---- p.setCurrentCamera(c); } else if (which == remove) { ! TreePath tp = ctv.getSelectionPath(); ! if (tp != null) { ! Object node = tp.getLastPathComponent(); ! if (node instanceof CameraNode) { ! p.remove((Camera)((CameraNode)node).getUserObject()); ! } } } |
From: rimestad <rim...@us...> - 2006-09-29 14:57:26
|
Update of /cvsroot/bprocessor/gui/src/net/sourceforge/bprocessor/gui/actions In directory sc8-pr-cvs3.sourceforge.net:/tmp/cvs-serv9581/src/net/sourceforge/bprocessor/gui/actions Modified Files: CreateFunctionalSpaceActionListener.java Log Message: Changed the Tree view to update by recursive calls to keep selection and all open paths, as well as refactoring of the generictreeview structure Made all remove methods private in the model and let delete methods call remove and afterwards make a changed event. Index: CreateFunctionalSpaceActionListener.java =================================================================== RCS file: /cvsroot/bprocessor/gui/src/net/sourceforge/bprocessor/gui/actions/CreateFunctionalSpaceActionListener.java,v retrieving revision 1.9 retrieving revision 1.10 diff -C2 -d -r1.9 -r1.10 *** CreateFunctionalSpaceActionListener.java 26 Sep 2006 09:50:54 -0000 1.9 --- CreateFunctionalSpaceActionListener.java 29 Sep 2006 14:57:15 -0000 1.10 *************** *** 47,50 **** --- 47,51 ---- Space fs = Project.getInstance().getActiveSpace().createFunctionalSpace(result.trim()); Project.getInstance().add(fs); + Project.getInstance().changed(Project.getInstance()); Project.getInstance().checkpoint(); } catch (Exception ex) { |
From: Nordholt <nor...@us...> - 2006-09-29 13:41:36
|
Update of /cvsroot/bprocessor/facade/src/net/sourceforge/bprocessor/facade/modellor In directory sc8-pr-cvs3.sourceforge.net:/tmp/cvs-serv11883/src/net/sourceforge/bprocessor/facade/modellor Modified Files: FacadeModellor.java Log Message: New way of drawing windows to make it possible to remove post segments Index: FacadeModellor.java =================================================================== RCS file: /cvsroot/bprocessor/facade/src/net/sourceforge/bprocessor/facade/modellor/FacadeModellor.java,v retrieving revision 1.16 retrieving revision 1.17 diff -C2 -d -r1.16 -r1.17 *** FacadeModellor.java 26 Sep 2006 10:01:11 -0000 1.16 --- FacadeModellor.java 29 Sep 2006 13:41:27 -0000 1.17 *************** *** 367,375 **** private void createPostConstructors() { if (front != null && front.getEdges().size() == 4 && depth > 0) { - //Finding horizontal and vertical edge - List edges = front.getEdges(); removeConstructors(); vertCons = new LinkedList(); horCons = new LinkedList(); Iterator it = edges.iterator(); Edge vertEdge = null; --- 367,375 ---- private void createPostConstructors() { if (front != null && front.getEdges().size() == 4 && depth > 0) { removeConstructors(); vertCons = new LinkedList(); horCons = new LinkedList(); + //Finding horizontal and vertical edge + List edges = front.getEdges(); Iterator it = edges.iterator(); Edge vertEdge = null; *************** *** 478,482 **** horSegs[i][j] = hSeg; vertSegs[i][j] = vSeg; ! drawSeg.put(hSeg, Boolean.TRUE); drawSeg.put(vSeg, Boolean.TRUE); h.connect(hSeg); --- 478,487 ---- horSegs[i][j] = hSeg; vertSegs[i][j] = vSeg; ! if (j > 0 && i < vertPosts + 1 && j < horPosts + 1 && ! i % 2 == 0) { ! drawSeg.put(hSeg, Boolean.FALSE); ! } else { ! drawSeg.put(hSeg, Boolean.TRUE); ! } drawSeg.put(vSeg, Boolean.TRUE); h.connect(hSeg); *************** *** 512,516 **** drawSeg = new HashMap(); } ! /** * Creates the holes for windows in the facade based on the post constructors, --- 517,521 ---- drawSeg = new HashMap(); } ! /** * Creates the holes for windows in the facade based on the post constructors, *************** *** 519,664 **** private void createWindows() { if (front != null && depth > 0) { ! removeWindows(); ! Vertex horDir = topBound.getDirection().copy(); ! horDir.scale(vertPostWidth / 2); ! Line oldV = leftBound; ! Line currentV = null; ! Iterator vIt = vertCons.iterator(); ! int i = 0; ! while (vIt.hasNext()) { ! Line vL = (Line)vIt.next(); ! currentV = new Line(vL.getOrigin().minus(horDir), vL.getDirection()); ! horizontalRun(oldV, currentV, i); ! oldV = new Line(vL.getOrigin().add(horDir), vL.getDirection()); ! //vL.connect(currentV); ! //vL.connect(oldV); ! i++; ! } ! horizontalRun(oldV, rightBound, i); ! } ! } ! ! /** ! * Runs through the horizontal constructors to create holes for windows. ! * @param oldV left boundry ! * @param currentV right boundry ! * @param i index of oldv ! */ ! private void horizontalRun(Line oldV, Line currentV, int i) { ! Line currentH; ! Vertex vertDir = leftBound.getDirection().copy(); ! vertDir.scale(horPostWidth / 2); ! Line oldH = topBound; ! int j = 0; ! Iterator hIt = horCons.iterator(); ! while (hIt.hasNext()) { ! Line hL = (Line)hIt.next(); ! Line copyOldV = new Line(oldV.getOrigin().copy(), oldV.getDirection().copy()); ! Line copyCurrentV = new Line(currentV.getOrigin().copy(), currentV.getDirection().copy()); ! currentH = new Line(hL.getOrigin().minus(vertDir), hL.getDirection()); ! createHole(copyOldV, copyCurrentV, oldH, currentH); ! horSegs[i][j].connect(oldH); ! horSegs[i][j + 1].connect(currentH); ! vertSegs[i][j].connect(copyOldV); ! vertSegs[i + 1][j].connect(copyCurrentV); ! oldH = new Line(hL.getOrigin().add(vertDir), hL.getDirection()); ! //hL.connect(currentH); ! //hL.connect(oldH); ! j++; ! } ! Line copyOldV = new Line(oldV.getOrigin().copy(), oldV.getDirection().copy()); ! Line copyCurrentV = new Line(currentV.getOrigin().copy(), currentV.getDirection().copy()); ! createHole(copyOldV, copyCurrentV, oldH, bottomBound); ! horSegs[i][j].connect(oldH); ! vertSegs[i][j].connect(copyOldV); ! vertSegs[i + 1][j].connect(copyCurrentV); ! } ! ! /** ! * Creates a hole based on four boundry lines ! * @param left left line ! * @param right right line ! * @param top top line ! * @param bottom bottom line ! */ ! private void createHole(Line left, Line right, Line top, Line bottom) { ! Vertex c1 = top.intersection(left); ! space.add(c1); ! Vertex c2 = top.intersection(right); ! space.add(c2); ! Vertex c3 = bottom.intersection(right); ! space.add(c3); ! Vertex c4 = bottom.intersection(left); ! space.add(c4); ! if (c1 != null && c2 != null && c3 != null && c4 != null) { ! List edges = new LinkedList(); ! Edge e1 = new Edge(c1, c2); ! space.add(e1); ! edges.add(e1); ! Edge e2 = new Edge(c2, c3); ! space.add(e2); ! edges.add(e2); ! Edge e3 = new Edge(c3, c4); ! space.add(e3); ! edges.add(e3); ! Edge e4 = new Edge(c4, c1); ! space.add(e4); ! edges.add(e4); ! Surface s = new Surface(edges); ! windows.add(s); ! space.add(s); ! Geometry.holeAnalysis(s); ! if (type == DOUBLE_BAR) { ! Vertex sn = s.normal(); ! Vertex fn = front.normal(); ! Space wf = new Space("Window", Space.CONSTRUCTION, Space.ELEMENT_LEVEL, true); ! space.add(wf); ! windowElements.add(wf); ! if (sn.dot(fn) > 0) { ! if (front.getFrontDomain() == space) { ! s.setFrontDomain(wf); ! } else { ! s.setBackDomain(wf); ! } ! } else { ! if (front.getBackDomain() == space) { ! s.setFrontDomain(wf); ! } else { ! s.setBackDomain(wf); ! } ! } ! Modellor wm = new WindowModellor(wf, s); ! wf.setModellor(wm); ! windowModellors.add(wm); ! top.connect(e1); ! right.connect(e2); ! bottom.connect(e3); ! left.connect(e4); ! } else { ! Set sides = new HashSet(); ! Surface t = extrudeIntoSpace(s, depth, sides); ! windows.add(t); ! windows.addAll(sides); ! Iterator it = sides.iterator(); ! while (it.hasNext()) { ! Surface side = (Surface)it.next(); ! if (side.contains(e1)) { ! top.connect(side); ! } else if (side.contains(e2)) { ! right.connect(side); ! } else if (side.contains(e3)) { ! bottom.connect(side); ! } else if (side.contains(e4)) { ! left.connect(side); } - space.add(side); } ! Geometry.holeAnalysis(t); ! } ! } else { ! log.warn("Unable to create windows, some intersections were NULL"); } } ! /** * Removes the windows of the facade. --- 524,649 ---- private void createWindows() { if (front != null && depth > 0) { ! Space oldActive = Project.getInstance().getActiveSpace(); ! Project.getInstance().setActiveSpace(space); ! Vertex vDir = vertSegs[0][0].getDirection(); ! vDir = vDir.copy((vertPostWidth / 2) / vDir.length()); ! Vertex hDir = horSegs[0][0].getDirection(); ! hDir = hDir.copy((horPostWidth / 2) / hDir.length()); ! //List slist = new LinkedList(); ! for (int i = 0; i < vertPosts + 1; i++) { ! for (int j = 0; j < horPosts + 1; j++) { ! Line v = vertSegs[i][j]; ! Line h = horSegs[i][j]; ! boolean drawV = ((Boolean)drawSeg.get(v)).booleanValue(); ! boolean drawH = ((Boolean)drawSeg.get(h)).booleanValue(); ! if (drawV && drawH) { ! List edges = new LinkedList(); ! int di = 1; ! int dj = 0; ! int stepI = 1; ! int stepJ = 0; ! Vertex start = h.intersection(v); ! start = start.add(vDir).add(hDir); ! Vertex last = start = Geometry.insertVertex(start, false); ! Vertex next = vertSegs[i + di][j].intersection(h); ! next = Geometry.insertVertex(next.add(vDir), false); ! Map connectMap = new HashMap(); ! //make edges till we are back at the start-vertex ! while (di != 0 || dj != 0) { ! boolean dirChanged = false; ! next = Geometry.insertVertex(next, false); ! Edge e = new Edge(last, next); ! edges.add(e); ! if (stepI == 1) { ! //stepped right ! if (((Boolean)drawSeg.get(vertSegs[i + di][j + dj])).booleanValue()) { ! //step down ! stepJ = 1; ! stepI = 0; ! dirChanged = true; ! } else if (((Boolean)drawSeg.get(horSegs[i + di][j + dj])).booleanValue()) { ! //step right ! stepJ = 0; ! stepI = 1; ! } ! connectMap.put(e, horSegs[i + di - 1][j + dj]); ! } else if (stepJ == 1) { ! //stepped down ! if (((Boolean)drawSeg.get(horSegs[i + di - 1][j + dj])).booleanValue()) { ! //step left ! stepJ = 0; ! stepI = -1; ! dirChanged = true; ! } else if (((Boolean)drawSeg.get(vertSegs[i + di][j + dj])).booleanValue()) { ! //step down ! stepJ = 1; ! stepI = 0; ! } ! connectMap.put(e, vertSegs[i + di][j + dj - 1]); ! } else if (stepI == -1) { ! //stepped left ! if (((Boolean)drawSeg.get(vertSegs[i + di][j + dj - 1])).booleanValue()) { ! //step up ! stepJ = -1; ! stepI = 0; ! dirChanged = true; ! } else if (((Boolean)drawSeg.get(horSegs[i + di - 1][j + dj])).booleanValue()) { ! //step left ! stepJ = 0; ! stepI = -1; ! } ! connectMap.put(e, horSegs[i + di][j + dj]); ! } else if (stepJ == -1) { ! //stepped up - the only option here is to step up even further. ! stepJ = -1; ! stepI = 0; ! connectMap.put(e, vertSegs[i + di][j + dj]); ! } else { ! log.info("NO STEP WAS MADE:" + " si:" + stepI + ! " sj:" + stepJ + ! " i:" + (i + di) + ! " j:" + (j + dj)); ! } ! if (dirChanged) { ! next.move((hDir.copy(-stepJ)).add(vDir.copy(stepI)).getX(), ! (hDir.copy(-stepJ)).add(vDir.copy(stepI)).getY(), ! (hDir.copy(-stepJ)).add(vDir.copy(stepI)).getZ()); ! } ! last = next; ! di += stepI; ! dj += stepJ; ! next = vertSegs[i + di][j + dj].intersection(horSegs[i + di][j + dj]); ! next = next.add(hDir.copy(-stepJ)).add(vDir.copy(stepI)); ! } ! Edge e = new Edge(last, start); ! connectMap.put(e, vertSegs[i + di][j + dj]); ! edges.add(e); ! List surface = Geometry.insertEdges(edges); ! if (surface.isEmpty()) { ! log.info("NO SURFACE FROM EDGES :'-("); ! } else { ! Set sides = new HashSet(); ! Geometry.holeAnalysis(extrudeIntoSpace((Surface)surface.iterator().next(), ! depth, ! sides)); ! Iterator it = sides.iterator(); ! while (it.hasNext()) { ! Surface side = (Surface)it.next(); ! Iterator sIt = side.getEdges().iterator(); ! while (sIt.hasNext()) { ! Line seg = (Line)connectMap.get(sIt.next()); ! if (seg != null) { ! seg.connect(side); ! } ! } ! } ! } } } ! } ! Project.getInstance().setActiveSpace(oldActive); } } ! /** * Removes the windows of the facade. |
From: Nordholt <nor...@us...> - 2006-09-29 13:40:19
|
Update of /cvsroot/bprocessor/gl/src/net/sourceforge/bprocessor/gl/tool In directory sc8-pr-cvs3.sourceforge.net:/tmp/cvs-serv11452/src/net/sourceforge/bprocessor/gl/tool Modified Files: Pencil.java Log Message: fixed to work with new insert methods Index: Pencil.java =================================================================== RCS file: /cvsroot/bprocessor/gl/src/net/sourceforge/bprocessor/gl/tool/Pencil.java,v retrieving revision 1.12 retrieving revision 1.13 diff -C2 -d -r1.12 -r1.13 *** Pencil.java 7 Sep 2006 11:38:41 -0000 1.12 --- Pencil.java 29 Sep 2006 13:40:11 -0000 1.13 *************** *** 98,102 **** (current.type() == Intersection.EDGE && eColl.contains(current.object()))); ! if (Geometry.insertEdges(edges) || exsGeometry) { cleanUp(); return; --- 98,102 ---- (current.type() == Intersection.EDGE && eColl.contains(current.object()))); ! if (!Geometry.insertEdges(edges).isEmpty() || exsGeometry) { cleanUp(); return; |
From: Nordholt <nor...@us...> - 2006-09-29 13:39:46
|
Update of /cvsroot/bprocessor/model/src/net/sourceforge/bprocessor/model In directory sc8-pr-cvs3.sourceforge.net:/tmp/cvs-serv11057/src/net/sourceforge/bprocessor/model Modified Files: Vertex.java Log Message: added method to do a scaled copy Index: Vertex.java =================================================================== RCS file: /cvsroot/bprocessor/model/src/net/sourceforge/bprocessor/model/Vertex.java,v retrieving revision 1.45 retrieving revision 1.46 diff -C2 -d -r1.45 -r1.46 *** Vertex.java 5 Sep 2006 11:01:36 -0000 1.45 --- Vertex.java 29 Sep 2006 13:39:34 -0000 1.46 *************** *** 202,205 **** --- 202,216 ---- return vertex; } + + /** + * Return a scaled copy of this Vertex + * @param scale the amout to scale the copy + * @return a scaled copy + */ + public Vertex copy(double scale) { + Vertex v = this.copy(); + v.scale(scale); + return v; + } /** |
From: Nordholt <nor...@us...> - 2006-09-29 13:39:11
|
Update of /cvsroot/bprocessor/model/src/net/sourceforge/bprocessor/model In directory sc8-pr-cvs3.sourceforge.net:/tmp/cvs-serv10765/src/net/sourceforge/bprocessor/model Modified Files: Geometry.java Log Message: changed insert methods to return the surfaces created Index: Geometry.java =================================================================== RCS file: /cvsroot/bprocessor/model/src/net/sourceforge/bprocessor/model/Geometry.java,v retrieving revision 1.27 retrieving revision 1.28 diff -C2 -d -r1.27 -r1.28 *** Geometry.java 18 Sep 2006 14:10:07 -0000 1.27 --- Geometry.java 29 Sep 2006 13:39:03 -0000 1.28 *************** *** 176,183 **** * surfaces etc. * @param edges The list of edges ! * @return Whether a new surface was added */ ! public static boolean insert(List edges) { ! Edge first = (Edge) edges.get(0); Vertex from = first.getFrom(); --- 176,183 ---- * surfaces etc. * @param edges The list of edges ! * @return a list of the surfaces created */ ! public static List insert(List edges) { ! List result = new LinkedList(); Edge first = (Edge) edges.get(0); Vertex from = first.getFrom(); *************** *** 185,189 **** Vertex to = last.getTo(); Surface exterior = null; ! boolean closed = false; { Set fromSurfaces = from.getSurfaces(); --- 185,191 ---- Vertex to = last.getTo(); Surface exterior = null; ! //Finding out if the edges are all contained in one surface with ! //endpoints of the chain of edges as vertices of the surface. ! //If such a surface exists it is set to extorior { Set fromSurfaces = from.getSurfaces(); *************** *** 201,229 **** } else { Iterator iter = shared.iterator(); ! while (iter.hasNext() && (exterior == null)) { Surface currentSurface = (Surface) iter.next(); ! if (edges.size() > 1) { ! Vertex currentVertex = first.otherVertex(from); ! int currentIndex = 1; ! Edge currentEdge = (Edge) edges.get(currentIndex); ! boolean outside = false; ! while ((currentVertex != to) && !outside) { ! outside = !currentSurface.surrounds(currentVertex); ! currentVertex = currentEdge.otherVertex(currentVertex); ! currentIndex++; ! if (currentIndex < edges.size()) { ! currentEdge = (Edge) edges.get(currentIndex); ! } else { ! currentEdge = null; ! } ! } ! if (!outside) { ! exterior = currentSurface; } } } } } ! Set siblings = to.getEdges(); siblings.remove(first); --- 203,229 ---- } else { Iterator iter = shared.iterator(); ! while (edges.size() > 1 && iter.hasNext() && (exterior == null)) { Surface currentSurface = (Surface) iter.next(); ! Vertex currentVertex = first.otherVertex(from); ! int currentIndex = 1; ! Edge currentEdge = (Edge) edges.get(currentIndex); ! boolean outside = false; ! while ((currentVertex != to) && !outside) { ! outside = !currentSurface.surrounds(currentVertex); ! currentVertex = currentEdge.otherVertex(currentVertex); ! currentIndex++; ! if (currentIndex < edges.size()) { ! currentEdge = (Edge) edges.get(currentIndex); ! } else { ! currentEdge = null; } } + if (!outside) { + exterior = currentSurface; + } } } } ! //Find the surfaces Set siblings = to.getEdges(); siblings.remove(first); *************** *** 240,248 **** siblings = node.insert(siblings); node.sort(); ! closed = findSurfaces(node, lastEdgeNode, edges, exterior); } } } ! return closed; } --- 240,248 ---- siblings = node.insert(siblings); node.sort(); ! result.addAll(findSurfaces(node, lastEdgeNode, edges, exterior)); } } } ! return result; } *************** *** 254,260 **** * @param edges The edges * @param exterior The exterior ! * @return Whether a surface was found */ ! private static boolean findSurfaces(VertexNode vertex, EdgeNode last, List edges, Surface exterior) { int count = 0; --- 254,260 ---- * @param edges The edges * @param exterior The exterior ! * @return a list of the surfaces found */ ! private static List findSurfaces(VertexNode vertex, EdgeNode last, List edges, Surface exterior) { int count = 0; *************** *** 262,269 **** Space mesh = ((Edge) edges.iterator().next()).getOwner(); { - Surface clockwise = clockwiseSurface(vertex, last, edges); ! if (clockwise != null) { ! if (clockwise.angle(vertex.system()) < 0) { mesh.insert(clockwise); --- 262,267 ---- Space mesh = ((Edge) edges.iterator().next()).getOwner(); { Surface clockwise = clockwiseSurface(vertex, last, edges); ! if (clockwise != null) { if (clockwise.angle(vertex.system()) < 0) { mesh.insert(clockwise); *************** *** 302,306 **** } } ! return !surfaces.isEmpty(); } --- 300,304 ---- } } ! return surfaces; } *************** *** 364,368 **** } ! /** * The VertexNode class is used for internal surface calculations --- 362,366 ---- } ! /** * The VertexNode class is used for internal surface calculations *************** *** 837,844 **** * Insert a number edges into the model * @param edges List of edges ! * @return Boolean indicating whether the edges are closed */ ! public static boolean insertEdges(List edges) { ! boolean closed = false; if (!edges.isEmpty()) { Vertex v = Edge.commonVertex((Edge) edges.get(0), (Edge) edges.get(edges.size() - 1)); --- 835,843 ---- * Insert a number edges into the model * @param edges List of edges ! * @return List of the surfaces created (empty list if none) */ ! public static List insertEdges(List edges) { ! //boolean closed = false; ! List result = new LinkedList(); if (!edges.isEmpty()) { Vertex v = Edge.commonVertex((Edge) edges.get(0), (Edge) edges.get(edges.size() - 1)); *************** *** 855,861 **** if (actual.size() > 2) { Surface surface = new Surface(actual); Project.getInstance().getActiveSpace().insert(surface); holeAnalysis(surface); - closed = true; } } else { --- 854,860 ---- if (actual.size() > 2) { Surface surface = new Surface(actual); + result.add(surface); Project.getInstance().getActiveSpace().insert(surface); holeAnalysis(surface); } } else { *************** *** 869,878 **** } } ! closed = insert(actual); } } Project.getInstance().changed(Project.getInstance()); Project.getInstance().checkpoint(); ! return closed; } --- 868,877 ---- } } ! result.addAll(insert(actual)); } } Project.getInstance().changed(Project.getInstance()); Project.getInstance().checkpoint(); ! return result; } |
From: Michael L. <he...@us...> - 2006-09-29 12:09:54
|
Update of /cvsroot/bprocessor/gl/src/net/sourceforge/bprocessor/gl/view In directory sc8-pr-cvs3.sourceforge.net:/tmp/cvs-serv8033/src/net/sourceforge/bprocessor/gl/view Modified Files: View.java Log Message: Improved hit-detection of transformed entities. Index: View.java =================================================================== RCS file: /cvsroot/bprocessor/gl/src/net/sourceforge/bprocessor/gl/view/View.java,v retrieving revision 1.154 retrieving revision 1.155 diff -C2 -d -r1.154 -r1.155 *** View.java 28 Sep 2006 06:09:14 -0000 1.154 --- View.java 29 Sep 2006 12:09:50 -0000 1.155 *************** *** 886,890 **** Object o = iter.next(); if (o instanceof Surface) { ! drawObject(o); } } --- 886,890 ---- Object o = iter.next(); if (o instanceof Surface) { ! drawGeometric((Geometric) o); } } *************** *** 910,914 **** Object o = highlightIter.next(); if (!(o instanceof Surface)) { ! drawObject(o); } } --- 910,914 ---- Object o = highlightIter.next(); if (!(o instanceof Surface)) { ! drawGeometric((Geometric) o); } } *************** *** 919,931 **** Iterator it = tempVertices.iterator(); while (it.hasNext()) { ! drawObject(it.next()); } } // draw target ! if (target != null) { gl.glColor3fv(targetColor); gl.glLineWidth(1.5f); ! drawObject(target); } --- 919,931 ---- Iterator it = tempVertices.iterator(); while (it.hasNext()) { ! drawGeometric((Geometric) it.next()); } } // draw target ! if (target != null && target instanceof Geometric) { gl.glColor3fv(targetColor); gl.glLineWidth(1.5f); ! drawGeometric((Geometric) target); } *************** *** 940,944 **** Iterator it = onTopEntities.iterator(); while (it.hasNext()) { ! drawObject(it.next()); } } --- 940,944 ---- Iterator it = onTopEntities.iterator(); while (it.hasNext()) { ! drawGeometric((Geometric) it.next()); } } *************** *** 998,1005 **** */ private void transformTo(Space space) { ! if (space.getOwner() != null) { transformTo(space.getOwner()); } - transform(space.getTransformations()); } --- 998,1005 ---- */ private void transformTo(Space space) { ! if (space != null) { transformTo(space.getOwner()); + transform(space.getTransformations()); } } *************** *** 1098,1101 **** --- 1098,1112 ---- } + /** + * Transform the the geometrics coordinate system before + * drawing. + * @param geometric Geometric + */ + private void drawGeometric(Geometric geometric) { + gl.glPushMatrix(); + transformTo(geometric.getOwner()); + drawObject(geometric); + gl.glPopMatrix(); + } /** *************** *** 1912,1939 **** --- 1923,1977 ---- if (selectMode == VERTICES || selectMode == ALL) { Iterator iter = vertices.iterator(); + gl.glPushMatrix(); + Space owner = null; while (iter.hasNext()) { Vertex v = (Vertex)iter.next(); pushName(gl, v); + if (v.getOwner() != owner) { + gl.glPopMatrix(); + gl.glPushMatrix(); + owner = v.getOwner(); + transformTo(owner); + } drawVertexHit(v); popName(gl); } + gl.glPopMatrix(); } if (selectMode == EDGES || selectMode == ALL) { Iterator iter = edges.iterator(); + gl.glPushMatrix(); + Space owner = null; while (iter.hasNext()) { Edge e = (Edge)iter.next(); pushName(gl, e); + if (e.getOwner() != owner) { + gl.glPopMatrix(); + gl.glPushMatrix(); + owner = e.getOwner(); + transformTo(owner); + } drawEdge(e); popName(gl); } + gl.glPopMatrix(); } if (selectMode == SURFACES || selectMode == ALL) { Iterator it = surfaces.iterator(); + gl.glPushMatrix(); + Space owner = null; while (it.hasNext()) { Surface s = (Surface)it.next(); pushName(gl, s); + if (s.getOwner() != owner) { + gl.glPopMatrix(); + gl.glPushMatrix(); + owner = s.getOwner(); + transformTo(owner); + } drawSurface(s); popName(gl); } + gl.glPopMatrix(); } { *************** *** 1966,1972 **** --- 2004,2019 ---- all.addAll(tempConstructors); Iterator iter = all.iterator(); + Space owner = null; + gl.glPushMatrix(); while (iter.hasNext()) { Constructor current = (Constructor) iter.next(); + if (!excluded.contains(current)) { + if (current.getOwner() != owner) { + gl.glPopMatrix(); + gl.glPushMatrix(); + owner = current.getOwner(); + transformTo(owner); + } if (camera.getType() == Camera.PERSPECTIVE) { dist = (current.getOrigin().minus(v)).length() * scale; *************** *** 2029,2032 **** --- 2076,2080 ---- } } + gl.glPopMatrix(); } } |
From: Michael L. <he...@us...> - 2006-09-29 07:13:24
|
Update of /cvsroot/bprocessor/bscript/src/net/sourceforge/bprocessor/model/evaluator In directory sc8-pr-cvs3.sourceforge.net:/tmp/cvs-serv21194/src/net/sourceforge/bprocessor/model/evaluator Modified Files: Primitive.java Call.java Log Message: List access implemented in bscript Index: Primitive.java =================================================================== RCS file: /cvsroot/bprocessor/bscript/src/net/sourceforge/bprocessor/model/evaluator/Primitive.java,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** Primitive.java 17 Sep 2006 17:29:21 -0000 1.4 --- Primitive.java 29 Sep 2006 07:13:16 -0000 1.5 *************** *** 8,11 **** --- 8,12 ---- package net.sourceforge.bprocessor.model.evaluator; + import java.util.List; import java.util.Stack; *************** *** 30,33 **** --- 31,36 ---- /** gt */ public static final int GT = 8; + /** get */ + public static final int GET = 9; /** opcode */ *************** *** 97,100 **** --- 100,109 ---- break; } + case GET: { + Double op1 = (Double) stack.pop(); + List op2 = (List) stack.pop(); + stack.push(op2.get(op1.intValue())); + break; + } } return 1; Index: Call.java =================================================================== RCS file: /cvsroot/bprocessor/bscript/src/net/sourceforge/bprocessor/model/evaluator/Call.java,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** Call.java 19 Sep 2006 19:22:42 -0000 1.6 --- Call.java 29 Sep 2006 07:13:16 -0000 1.7 *************** *** 59,62 **** --- 59,63 ---- locals.put(name, value); } + locals.put("args", arguments); } Environment activation = new Environment(env.origin(), locals, arguments); |
From: Michael L. <he...@us...> - 2006-09-29 07:13:24
|
Update of /cvsroot/bprocessor/bscript/src/etc In directory sc8-pr-cvs3.sourceforge.net:/tmp/cvs-serv21194/src/etc Modified Files: bscript.g Log Message: List access implemented in bscript Index: bscript.g =================================================================== RCS file: /cvsroot/bprocessor/bscript/src/etc/bscript.g,v retrieving revision 1.8 retrieving revision 1.9 diff -C2 -d -r1.8 -r1.9 *** bscript.g 17 Sep 2006 17:29:21 -0000 1.8 --- bscript.g 29 Sep 2006 07:13:16 -0000 1.9 *************** *** 27,30 **** --- 27,32 ---- Lt : '<' ; Gt : '>' ; + LB : '[' ; + RB : ']' ; Equal: '=' ; LtEq: "<=" ; *************** *** 113,122 **** } "while" expression[env] ! { env.append(branchend); } "do" ( statement[env] End ) * "end" { int after = env.length(); Branch branch = new Branch(before - after); env.append(branch); ! branchend.setOffset(after - before + 1); } ; --- 115,124 ---- } "while" expression[env] ! { int beforebranch = env.length(); env.append(branchend); } "do" ( statement[env] End ) * "end" { int after = env.length(); Branch branch = new Branch(before - after); env.append(branch); ! branchend.setOffset(after - beforebranch + 1); } ; *************** *** 186,189 **** --- 188,192 ---- : literal[env] | variable[env] + | variable[env] LB ( expression[env] ) RB { env.append(new Primitive(Primitive.GET)); } | StartTerm expression[env] EndTerm | unary[env] |
From: Michael L. <he...@us...> - 2006-09-29 07:13:20
|
Update of /cvsroot/bprocessor/gui/src/net/sourceforge/bprocessor/gui In directory sc8-pr-cvs3.sourceforge.net:/tmp/cvs-serv21183/src/net/sourceforge/bprocessor/gui Modified Files: PopupMenu.java Log Message: List access implemented in bscript Index: PopupMenu.java =================================================================== RCS file: /cvsroot/bprocessor/gui/src/net/sourceforge/bprocessor/gui/PopupMenu.java,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** PopupMenu.java 28 Sep 2006 06:09:08 -0000 1.3 --- PopupMenu.java 29 Sep 2006 07:13:12 -0000 1.4 *************** *** 141,144 **** --- 141,151 ---- }; pm.add(axisrotate); + AbstractAction axisrotatelocal = new SpaceMenuAction(s, "Local Axis Rotate") { + public void actionPerformed(ActionEvent arg0) { + space.pushTransform(new AxisRotate()); + space.changed(); + } + }; + pm.add(axisrotatelocal); // Adding all modellors JMenu mm = new JMenu("Modellors"); |
From: Michael L. <he...@us...> - 2006-09-29 07:13:18
|
Update of /cvsroot/bprocessor/model/src/net/sourceforge/bprocessor/model In directory sc8-pr-cvs3.sourceforge.net:/tmp/cvs-serv20812/src/net/sourceforge/bprocessor/model Modified Files: Space.java Log Message: List access implemented in bscript Index: Space.java =================================================================== RCS file: /cvsroot/bprocessor/model/src/net/sourceforge/bprocessor/model/Space.java,v retrieving revision 1.67 retrieving revision 1.68 diff -C2 -d -r1.67 -r1.68 *** Space.java 27 Sep 2006 08:36:25 -0000 1.67 --- Space.java 29 Sep 2006 07:13:00 -0000 1.68 *************** *** 275,279 **** /** ! * Set transformation * @param transform Transform */ --- 275,279 ---- /** ! * Add transformation * @param transform Transform */ *************** *** 283,286 **** --- 283,296 ---- /** + * push transformation + * @param transform Transform + */ + public void pushTransform(Transform transform) { + this.transform.push(transform); + } + + + + /** * Set proto * @param space Space |
From: Michael L. <he...@us...> - 2006-09-28 06:09:25
|
Update of /cvsroot/bprocessor/gl/src/net/sourceforge/bprocessor/gl/view In directory sc8-pr-cvs3.sourceforge.net:/tmp/cvs-serv18824/src/net/sourceforge/bprocessor/gl/view Modified Files: View.java Log Message: A failed experiment with rotations Index: View.java =================================================================== RCS file: /cvsroot/bprocessor/gl/src/net/sourceforge/bprocessor/gl/view/View.java,v retrieving revision 1.153 retrieving revision 1.154 diff -C2 -d -r1.153 -r1.154 *** View.java 27 Sep 2006 08:36:38 -0000 1.153 --- View.java 28 Sep 2006 06:09:14 -0000 1.154 *************** *** 20,23 **** --- 20,24 ---- import net.sourceforge.bprocessor.model.Geometry; import net.sourceforge.bprocessor.model.Line; + import net.sourceforge.bprocessor.model.Matrix; import net.sourceforge.bprocessor.model.Plane; import net.sourceforge.bprocessor.model.Camera; *************** *** 1021,1027 **** if (current instanceof Rotate) { Rotate rotate = (Rotate) current; ! gl.glRotated(rotate.rx(), 1, 0, 0); ! gl.glRotated(rotate.ry(), 0, 1, 0); ! gl.glRotated(rotate.rz(), 0, 0, 1); } if (current instanceof AxisRotate) { --- 1022,1039 ---- if (current instanceof Rotate) { Rotate rotate = (Rotate) current; ! double xaxis[] = new double[]{1, 0, 0, 0}; ! double yaxis[] = new double[]{0, 1, 0, 0}; ! double zaxis[] = new double[]{0, 0, 1, 0}; ! ! Matrix zmatrix = Matrix.rotation(Math.PI * rotate.rz() / 180, ! zaxis[0], zaxis[1], zaxis[2]); ! xaxis = zmatrix.multiply(xaxis); ! yaxis = zmatrix.multiply(yaxis); ! Matrix ymatrix = Matrix.rotation(Math.PI * rotate.ry() / 180, ! yaxis[0], yaxis[1], yaxis[2]); ! xaxis = ymatrix.multiply(xaxis); ! gl.glRotated(rotate.rx(), xaxis[0], xaxis[1], xaxis[2]); ! gl.glRotated(rotate.ry(), yaxis[0], yaxis[1], yaxis[2]); ! gl.glRotated(rotate.rz(), zaxis[0], zaxis[1], zaxis[2]); } if (current instanceof AxisRotate) { |
From: Michael L. <he...@us...> - 2006-09-28 06:09:18
|
Update of /cvsroot/bprocessor/gui/src/net/sourceforge/bprocessor/gui In directory sc8-pr-cvs3.sourceforge.net:/tmp/cvs-serv18809/src/net/sourceforge/bprocessor/gui Modified Files: PopupMenu.java Log Message: A failed experiment with rotations Index: PopupMenu.java =================================================================== RCS file: /cvsroot/bprocessor/gui/src/net/sourceforge/bprocessor/gui/PopupMenu.java,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** PopupMenu.java 27 Sep 2006 08:36:30 -0000 1.2 --- PopupMenu.java 28 Sep 2006 06:09:08 -0000 1.3 *************** *** 134,138 **** }; pm.add(scale); ! AbstractAction fullrotate = new SpaceMenuAction(s, "Full Rotate") { public void actionPerformed(ActionEvent arg0) { space.addTransform(new AxisRotate()); --- 134,138 ---- }; pm.add(scale); ! AbstractAction axisrotate = new SpaceMenuAction(s, "Axis Rotate") { public void actionPerformed(ActionEvent arg0) { space.addTransform(new AxisRotate()); *************** *** 140,144 **** } }; ! pm.add(fullrotate); // Adding all modellors JMenu mm = new JMenu("Modellors"); --- 140,144 ---- } }; ! pm.add(axisrotate); // Adding all modellors JMenu mm = new JMenu("Modellors"); |
From: Michael L. <he...@us...> - 2006-09-27 08:36:47
|
Update of /cvsroot/bprocessor/gl/src/net/sourceforge/bprocessor/gl/tool In directory sc8-pr-cvs3.sourceforge.net:/tmp/cvs-serv987/src/net/sourceforge/bprocessor/gl/tool Modified Files: SpaceTool.java Log Message: Translations and Rotations in scripting Index: SpaceTool.java =================================================================== RCS file: /cvsroot/bprocessor/gl/src/net/sourceforge/bprocessor/gl/tool/SpaceTool.java,v retrieving revision 1.41 retrieving revision 1.42 diff -C2 -d -r1.41 -r1.42 *** SpaceTool.java 26 Sep 2006 09:52:29 -0000 1.41 --- SpaceTool.java 27 Sep 2006 08:36:38 -0000 1.42 *************** *** 32,35 **** --- 32,36 ---- import net.sourceforge.bprocessor.gl.GLView; + import net.sourceforge.bprocessor.model.AxisRotate; import net.sourceforge.bprocessor.gui.PopupMenu; import net.sourceforge.bprocessor.model.ClippingPlane; *************** *** 41,44 **** --- 42,47 ---- import net.sourceforge.bprocessor.model.Space; import net.sourceforge.bprocessor.model.Surface; + import net.sourceforge.bprocessor.model.TransformStack; + import net.sourceforge.bprocessor.model.Translate; import net.sourceforge.bprocessor.model.Vertex; import net.sourceforge.bprocessor.model.Geometry; *************** *** 58,61 **** --- 61,68 ---- /** The logger */ private static Logger log = Logger.getLogger(SpaceTool.class); + + /** TransformStack */ + private TransformStack transform; + /** * Construct the SpaceTool *************** *** 590,594 **** public Object evaluate(String value) { ! HashMap globals = Project.getInstance().getGlobals().environment(); globals.put("echo", new Builtin() { --- 597,601 ---- public Object evaluate(String value) { ! transform = new TransformStack(); HashMap globals = Project.getInstance().getGlobals().environment(); globals.put("echo", new Builtin() { *************** *** 615,618 **** --- 622,626 ---- Double z = (Double) env.get(2); Vertex result = new Vertex(x.doubleValue(), y.doubleValue(), z.doubleValue()); + result = transform.transform(result); stack.push(result); } *************** *** 639,644 **** } }); ! ! String script = Project.getInstance().getScript(); --- 647,700 ---- } }); ! globals.put("contour", new Builtin() { ! public void evaluate(Environment env, Stack stack) { ! Vertex previous = (Vertex) env.get(env.length() - 1); ! for (int i = 0; i < env.length(); i++) { ! Vertex current = (Vertex) env.get(i); ! stack.push(new Edge(previous, current)); ! previous = current; ! } ! } ! }); ! globals.put("translate", new Builtin() { ! public void evaluate(Environment env, Stack stack) { ! Double x = (Double) env.get(0); ! Double y = (Double) env.get(1); ! Double z = (Double) env.get(2); ! transform.push( ! new Translate(x.doubleValue(), y.doubleValue(), z.doubleValue()) ! ); ! } ! }); ! globals.put("rotate", new Builtin() { ! public void evaluate(Environment env, Stack stack) { ! Double a = (Double) env.get(0); ! Double x = (Double) env.get(1); ! Double y = (Double) env.get(2); ! Double z = (Double) env.get(3); ! transform.push( ! new AxisRotate(a.doubleValue(), x.doubleValue(), y.doubleValue(), z.doubleValue()) ! ); ! } ! }); ! globals.put("extrude", new Builtin() { ! public void evaluate(Environment env, Stack stack) { ! Surface surface = (Surface) env.get(0); ! Double distance = (Double) env.get(1); ! HashSet sides = new HashSet(); ! Project.getInstance().getActiveSpace().add(surface); ! Surface top = surface.extrude(distance.doubleValue(), sides); ! Project.getInstance().getActiveSpace().remove(surface); ! stack.push(surface); ! Iterator iter = sides.iterator(); ! while (iter.hasNext()) { ! Surface current = (Surface) iter.next(); ! Project.getInstance().getActiveSpace().remove(current); ! stack.push(current); ! } ! Project.getInstance().getActiveSpace().remove(top); ! stack.push(top); ! } ! }); String script = Project.getInstance().getScript(); |
From: Michael L. <he...@us...> - 2006-09-27 08:36:41
|
Update of /cvsroot/bprocessor/gl/src/net/sourceforge/bprocessor/gl/view In directory sc8-pr-cvs3.sourceforge.net:/tmp/cvs-serv987/src/net/sourceforge/bprocessor/gl/view Modified Files: View.java Log Message: Translations and Rotations in scripting Index: View.java =================================================================== RCS file: /cvsroot/bprocessor/gl/src/net/sourceforge/bprocessor/gl/view/View.java,v retrieving revision 1.152 retrieving revision 1.153 diff -C2 -d -r1.152 -r1.153 *** View.java 20 Sep 2006 11:01:42 -0000 1.152 --- View.java 27 Sep 2006 08:36:38 -0000 1.153 *************** *** 16,20 **** import net.sourceforge.bprocessor.model.CoordinateSystem; import net.sourceforge.bprocessor.model.Defaults; ! import net.sourceforge.bprocessor.model.FullRotate; import net.sourceforge.bprocessor.model.Geometric; import net.sourceforge.bprocessor.model.Geometry; --- 16,20 ---- import net.sourceforge.bprocessor.model.CoordinateSystem; import net.sourceforge.bprocessor.model.Defaults; ! import net.sourceforge.bprocessor.model.AxisRotate; import net.sourceforge.bprocessor.model.Geometric; import net.sourceforge.bprocessor.model.Geometry; *************** *** 29,32 **** --- 29,33 ---- import net.sourceforge.bprocessor.model.Selection; import net.sourceforge.bprocessor.model.Space; + import net.sourceforge.bprocessor.model.TransformStack; import net.sourceforge.bprocessor.model.Translate; import net.sourceforge.bprocessor.model.Vertex; *************** *** 36,40 **** import java.util.ArrayList; - import java.util.Collections; import java.util.HashSet; import java.util.Iterator; --- 37,40 ---- *************** *** 992,995 **** --- 992,1034 ---- } + /** + * + * @param space Space + */ + private void transformTo(Space space) { + if (space.getOwner() != null) { + transformTo(space.getOwner()); + } + transform(space.getTransformations()); + } + + /** + * Apply transformations + * @param transformations List of transformations + */ + private void transform(TransformStack transformations) { + Iterator iter = transformations.stack().iterator(); + while (iter.hasNext()) { + Transform current = (Transform) iter.next(); + if (current instanceof Translate) { + Translate translate = (Translate) current; + gl.glTranslated(translate.tx(), translate.ty(), translate.tz()); + } + if (current instanceof Scale) { + Scale scale = (Scale) current; + gl.glScaled(scale.sx(), scale.sy(), scale.sz()); + } + if (current instanceof Rotate) { + Rotate rotate = (Rotate) current; + gl.glRotated(rotate.rx(), 1, 0, 0); + gl.glRotated(rotate.ry(), 0, 1, 0); + gl.glRotated(rotate.rz(), 0, 0, 1); + } + if (current instanceof AxisRotate) { + AxisRotate rotate = (AxisRotate) current; + gl.glRotated(rotate.angle(), rotate.rx(), rotate.ry(), rotate.rz()); + } + } + } /** *************** *** 1000,1029 **** private void drawSpace(Space space, GLDrawable gld) { gl.glPushMatrix(); ! { ! List transforms = new LinkedList(space.getTransformations()); ! Collections.reverse(transforms); ! Iterator iter = transforms.iterator(); ! while (iter.hasNext()) { ! Transform current = (Transform) iter.next(); ! if (current instanceof Translate) { ! Translate translate = (Translate) current; ! gl.glTranslated(translate.tx(), translate.ty(), translate.tz()); ! } ! if (current instanceof Scale) { ! Scale scale = (Scale) current; ! gl.glScaled(scale.sx(), scale.sy(), scale.sz()); ! } ! if (current instanceof Rotate) { ! Rotate rotate = (Rotate) current; ! gl.glRotated(rotate.rx(), 1, 0, 0); ! gl.glRotated(rotate.ry(), 0, 1, 0); ! gl.glRotated(rotate.rz(), 0, 0, 1); ! } ! if (current instanceof FullRotate) { ! FullRotate rotate = (FullRotate) current; ! gl.glRotated(rotate.angle(), rotate.rx(), rotate.ry(), rotate.rz()); ! } ! } ! } Collection surfaces = space.getSurfaces(); switch (drawMode) { --- 1039,1043 ---- private void drawSpace(Space space, GLDrawable gld) { gl.glPushMatrix(); ! transform(space.getTransformations()); Collection surfaces = space.getSurfaces(); switch (drawMode) { *************** *** 1158,1161 **** --- 1172,1177 ---- while (true) { if (active != null) { + gl.glPushMatrix(); + transformTo(active); Collection cons = active.getConstructors(); Iterator iter = cons.iterator(); *************** *** 1170,1173 **** --- 1186,1190 ---- } } + gl.glPopMatrix(); } else { break; |
From: Michael L. <he...@us...> - 2006-09-27 08:36:39
|
Update of /cvsroot/bprocessor/gui/src/net/sourceforge/bprocessor/gui In directory sc8-pr-cvs3.sourceforge.net:/tmp/cvs-serv978/src/net/sourceforge/bprocessor/gui Modified Files: PopupMenu.java Log Message: Translations and Rotations in scripting Index: PopupMenu.java =================================================================== RCS file: /cvsroot/bprocessor/gui/src/net/sourceforge/bprocessor/gui/PopupMenu.java,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** PopupMenu.java 26 Sep 2006 09:50:55 -0000 1.1 --- PopupMenu.java 27 Sep 2006 08:36:30 -0000 1.2 *************** *** 24,28 **** import net.sourceforge.bprocessor.model.Attribute; import net.sourceforge.bprocessor.model.Entity; ! import net.sourceforge.bprocessor.model.FullRotate; import net.sourceforge.bprocessor.model.Geometry; import net.sourceforge.bprocessor.model.Project; --- 24,28 ---- import net.sourceforge.bprocessor.model.Attribute; import net.sourceforge.bprocessor.model.Entity; ! import net.sourceforge.bprocessor.model.AxisRotate; import net.sourceforge.bprocessor.model.Geometry; import net.sourceforge.bprocessor.model.Project; *************** *** 136,140 **** AbstractAction fullrotate = new SpaceMenuAction(s, "Full Rotate") { public void actionPerformed(ActionEvent arg0) { ! space.addTransform(new FullRotate()); space.changed(); } --- 136,140 ---- AbstractAction fullrotate = new SpaceMenuAction(s, "Full Rotate") { public void actionPerformed(ActionEvent arg0) { ! space.addTransform(new AxisRotate()); space.changed(); } |
Update of /cvsroot/bprocessor/model/src/net/sourceforge/bprocessor/model In directory sc8-pr-cvs3.sourceforge.net:/tmp/cvs-serv966/src/net/sourceforge/bprocessor/model Modified Files: Translate.java Space.java Scale.java Added Files: TransformStack.java AxisRotate.java Removed Files: FullRotate.java Log Message: Translations and Rotations in scripting --- FullRotate.java DELETED --- Index: Translate.java =================================================================== RCS file: /cvsroot/bprocessor/model/src/net/sourceforge/bprocessor/model/Translate.java,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** Translate.java 19 Sep 2006 10:00:09 -0000 1.1 --- Translate.java 27 Sep 2006 08:36:25 -0000 1.2 *************** *** 35,38 **** --- 35,52 ---- tz = 0; } + + /** + * Constructor + * @param x x + * @param y y + * @param z z + */ + public Translate(double x, double y, double z) { + super(); + tx = x; + ty = y; + tz = z; + } + /** *************** *** 114,118 **** */ public Vertex transform(Vertex vertex) { ! return vertex; } --- 128,135 ---- */ public Vertex transform(Vertex vertex) { ! double x = vertex.getX() + tx; ! double y = vertex.getY() + ty; ! double z = vertex.getZ() + tz; ! return new Vertex(x, y, z); } --- NEW FILE: TransformStack.java --- //--------------------------------------------------------------------------------- // $Id: TransformStack.java,v 1.1 2006/09/27 08:36:25 henryml Exp $ // // Copyright (c) 2005 The BProcessor Team (http://bprocessor.sourceforge.net) // Released under the Lesser GNU Public License v2.1 //--------------------------------------------------------------------------------- package net.sourceforge.bprocessor.model; import java.util.List; import java.util.Stack; /** * Transformation stack */ public class TransformStack extends Transform { /** stack */ private Stack stack; /** * Contructor * */ public TransformStack() { super(); stack = new Stack(); } /** * * @return stack */ public Stack stack() { return stack; } /** * Push a transform * @param transform Transfrom */ public void push(Transform transform) { stack.push(transform); } /** * Pop a transform * */ public void pop() { stack.pop(); } /** * Insert a transform * @param transform Transform */ public void insert(Transform transform) { stack.add(0, transform); } /** * @param vertex Vertex * @return vertex */ public Vertex transform(Vertex vertex) { for (int i = stack.size(); i > 0; i--) { Transform current = (Transform) stack.get(i - 1); vertex = current.transform(vertex); } return vertex; } /** * @param attributes List of attributes */ public void setAttributes(List attributes) { } /** * @return List of Attributes */ public List getAttributes() { return null; } /** * @return Name */ public String getGeneralName() { return "Transformation Stack"; } } Index: Space.java =================================================================== RCS file: /cvsroot/bprocessor/model/src/net/sourceforge/bprocessor/model/Space.java,v retrieving revision 1.66 retrieving revision 1.67 diff -C2 -d -r1.66 -r1.67 *** Space.java 26 Sep 2006 09:52:24 -0000 1.66 --- Space.java 27 Sep 2006 08:36:25 -0000 1.67 *************** *** 126,130 **** /** The transformation */ ! private List transformations; --- 126,130 ---- /** The transformation */ ! private TransformStack transform; *************** *** 187,191 **** description = new Description(""); envelope = new HashSet(); ! transformations = new LinkedList(); if (container) { vertices = new HashMap(); --- 187,191 ---- description = new Description(""); envelope = new HashSet(); ! transform = new TransformStack(); if (container) { vertices = new HashMap(); *************** *** 270,275 **** * @return transformations */ ! public List getTransformations() { ! return transformations; } --- 270,275 ---- * @return transformations */ ! public TransformStack getTransformations() { ! return transform; } *************** *** 279,283 **** */ public void addTransform(Transform transform) { ! transformations.add(transform); } --- 279,283 ---- */ public void addTransform(Transform transform) { ! this.transform.insert(transform); } *************** *** 1257,1261 **** } } ! Iterator iter = getTransformations().iterator(); while (iter.hasNext()) { Transform current = (Transform) iter.next(); --- 1257,1261 ---- } } ! Iterator iter = getTransformations().stack().iterator(); while (iter.hasNext()) { Transform current = (Transform) iter.next(); --- NEW FILE: AxisRotate.java --- //--------------------------------------------------------------------------------- // $Id: AxisRotate.java,v 1.1 2006/09/27 08:36:25 henryml Exp $ // // Copyright (c) 2005 The BProcessor Team (http://bprocessor.sourceforge.net) // Released under the Lesser GNU Public License v2.1 //--------------------------------------------------------------------------------- package net.sourceforge.bprocessor.model; import java.util.ArrayList; import java.util.Iterator; import java.util.List; /** * Rotate */ public class AxisRotate extends Transform { /** rotate x */ private double rx; /** rotate y */ private double ry; /** rotate z */ private double rz; /** angle */ private double angle; /** * Constructor */ public AxisRotate() { super(); rx = 0; ry = 0; rz = 1; angle = 0; } /** * * @param a a * @param x x * @param y y * @param z z */ public AxisRotate(double a, double x, double y, double z) { super(); rx = x; ry = y; rz = z; angle = a; } /** * @param value new value */ public void rx(double value) { rx = value; } /** * * @return rx */ public double rx() { return rx; } /** * @param value new value */ public void ry(double value) { ry = value; } /** * * @return ry */ public double ry() { return ry; } /** * @param value new value */ public void rz(double value) { rz = value; } /** * * @return rz */ public double rz() { return rz; } /** * * @param value new value */ public void angle(double value) { angle = value; } /** * * @return angle */ public double angle() { return angle; } /** * Set attributes * @param attributes List */ public void setAttributes(List attributes) { Iterator iter = attributes.iterator(); while (iter.hasNext()) { Attribute a = (Attribute)iter.next(); if (a.getName().equals("Rotate X")) { rx(((Double)a.getValue()).doubleValue()); } else if (a.getName().equals("Rotate Y")) { ry(((Double)a.getValue()).doubleValue()); } else if (a.getName().equals("Rotate Z")) { rz(((Double)a.getValue()).doubleValue()); } else if (a.getName().equals("Angle")) { angle(((Double)a.getValue()).doubleValue()); } } Project.getInstance().changed(Project.getInstance()); } /** * Get attributes * @return List */ public List getAttributes() { ArrayList res = new ArrayList(); res.add(new Attribute("Rotate X", new Double(rx()))); res.add(new Attribute("Rotate Y", new Double(ry()))); res.add(new Attribute("Rotate Z", new Double(rz()))); res.add(new Attribute("Angle", new Double(angle()))); return res; } /** * @param vertex Vertex * @return Vertex */ public Vertex transform(Vertex vertex) { Matrix matrix = Matrix.rotation(angle, rx, ry, rz); double values[] = new double[4]; values[0] = vertex.getX(); values[1] = vertex.getY(); values[2] = vertex.getZ(); values[3] = 1; values = matrix.multiply(values); return new Vertex(values[0], values[1], values[2]); } /** * Get display name * @return name */ public String getGeneralName() { return "Rotate"; } } Index: Scale.java =================================================================== RCS file: /cvsroot/bprocessor/model/src/net/sourceforge/bprocessor/model/Scale.java,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** Scale.java 19 Sep 2006 10:00:09 -0000 1.1 --- Scale.java 27 Sep 2006 08:36:25 -0000 1.2 *************** *** 114,118 **** */ public Vertex transform(Vertex vertex) { ! return vertex; } --- 114,121 ---- */ public Vertex transform(Vertex vertex) { ! double x = vertex.getX() * sx; ! double y = vertex.getY() * sy; ! double z = vertex.getZ() * sz; ! return new Vertex(x, y, z); } |
From: rimestad <rim...@us...> - 2006-09-26 10:01:16
|
Update of /cvsroot/bprocessor/facade/src/net/sourceforge/bprocessor/facade/modellor In directory sc8-pr-cvs3.sourceforge.net:/tmp/cvs-serv22769/src/net/sourceforge/bprocessor/facade/modellor Modified Files: FacadeModellor.java WindowModellor.java Log Message: as Index: WindowModellor.java =================================================================== RCS file: /cvsroot/bprocessor/facade/src/net/sourceforge/bprocessor/facade/modellor/WindowModellor.java,v retrieving revision 1.8 retrieving revision 1.9 diff -C2 -d -r1.8 -r1.9 *** WindowModellor.java 25 Sep 2006 13:44:40 -0000 1.8 --- WindowModellor.java 26 Sep 2006 10:01:11 -0000 1.9 *************** *** 143,148 **** /** Draw the window */ public void drawWindow() { ! Space frame = new Space("Frame", Space.CONSTRUCTION, true); ! Space glass = new Space("Glass", Space.CONSTRUCTION, true); glass.setTransparent(true); Surface inner = surface.copy(space); --- 143,148 ---- /** Draw the window */ public void drawWindow() { ! Space frame = new Space("Frame", Space.CONSTRUCTION, Space.ELEMENT_LEVEL, true); ! Space glass = new Space("Glass", Space.CONSTRUCTION, Space.ELEMENT_LEVEL, true); glass.setTransparent(true); Surface inner = surface.copy(space); *************** *** 183,187 **** */ public Modellor newInstance(Space s) { ! return new WindowModellor(s, (Surface)(s.getEnvelope().iterator().next())); } --- 183,192 ---- */ public Modellor newInstance(Space s) { ! if (s.getLevel() == Space.SPACE_LEVEL) { ! return new WindowModellor(s, (Surface)(s.getEnvelope().iterator().next())); ! } else { ! ! return null; ! } } Index: FacadeModellor.java =================================================================== RCS file: /cvsroot/bprocessor/facade/src/net/sourceforge/bprocessor/facade/modellor/FacadeModellor.java,v retrieving revision 1.15 retrieving revision 1.16 diff -C2 -d -r1.15 -r1.16 *** FacadeModellor.java 25 Sep 2006 14:07:36 -0000 1.15 --- FacadeModellor.java 26 Sep 2006 10:01:11 -0000 1.16 *************** *** 323,327 **** depth > 0) { removeFacade(); ! frame = new Space("Frame", Space.CONSTRUCTION, true); space.add(frame); Surface eFront = front.copy(space); --- 323,327 ---- depth > 0) { removeFacade(); ! frame = new Space("Frame", Space.CONSTRUCTION, Space.ELEMENT_LEVEL, true); space.add(frame); Surface eFront = front.copy(space); *************** *** 612,616 **** Vertex sn = s.normal(); Vertex fn = front.normal(); ! Space wf = new Space("Window", Space.CONSTRUCTION, true); space.add(wf); windowElements.add(wf); --- 612,616 ---- Vertex sn = s.normal(); Vertex fn = front.normal(); ! Space wf = new Space("Window", Space.CONSTRUCTION, Space.ELEMENT_LEVEL, true); space.add(wf); windowElements.add(wf); |
From: rimestad <rim...@us...> - 2006-09-26 09:52:32
|
Update of /cvsroot/bprocessor/gl/src/net/sourceforge/bprocessor/gl/tool In directory sc8-pr-cvs3.sourceforge.net:/tmp/cvs-serv19110/src/net/sourceforge/bprocessor/gl/tool Modified Files: SpaceTool.java AbstractPencil.java ControlledMoveTool.java CreateSpaceActionListener.java Log Message: added levels to space and added union as a boolean, now the entire program uses that change Index: SpaceTool.java =================================================================== RCS file: /cvsroot/bprocessor/gl/src/net/sourceforge/bprocessor/gl/tool/SpaceTool.java,v retrieving revision 1.40 retrieving revision 1.41 diff -C2 -d -r1.40 -r1.41 *** SpaceTool.java 19 Sep 2006 19:22:34 -0000 1.40 --- SpaceTool.java 26 Sep 2006 09:52:29 -0000 1.41 *************** *** 32,38 **** --- 32,40 ---- import net.sourceforge.bprocessor.gl.GLView; + import net.sourceforge.bprocessor.gui.PopupMenu; import net.sourceforge.bprocessor.model.ClippingPlane; import net.sourceforge.bprocessor.model.Constructor; import net.sourceforge.bprocessor.model.Edge; + import net.sourceforge.bprocessor.model.Entity; import net.sourceforge.bprocessor.model.Project; import net.sourceforge.bprocessor.model.Selection; *************** *** 156,197 **** */ protected JPopupMenu makeSelectionMenu() { ! if (target instanceof String) { ! String type = (String) target; ! JPopupMenu menu = new JPopupMenu(); ! JMenuItem layerItem = new JMenuItem("Layer"); ! System.out.println(target); ! Surface surface = null; ! Space space = null; ! ! Iterator iter = Selection.primary().iterator(); ! while (iter.hasNext()) { ! Object current = iter.next(); ! if (current instanceof Surface) { ! surface = (Surface) current; ! } ! } ! if (surface != null) { ! if (type.equals("front")) { ! space = surface.getFrontDomain(); } ! if (type.equals("back")) { ! space = surface.getBackDomain(); } } - layerItem.addActionListener(new LayerAction(space, surface)); - menu.add(layerItem); - return menu; } else { ! ! JPopupMenu menu = new JPopupMenu(); ! JMenuItem offsetItem = new JMenuItem("Offset Constraint"); ! offsetItem.addActionListener(new MenuAction() { ! public void actionPerformed(ActionEvent event) { ! addOffsetConstraint(Selection.primary()); } ! } ! ); ! menu.add(offsetItem); ! return menu; } } --- 158,220 ---- */ protected JPopupMenu makeSelectionMenu() { ! if (Selection.primary().isEmpty()) { ! if (target instanceof String) { ! String type = (String) target; ! JPopupMenu menu = new JPopupMenu(); ! JMenuItem layerItem = new JMenuItem("Layer"); ! Surface surface = null; ! Space space = null; ! ! Iterator iter = Selection.primary().iterator(); ! while (iter.hasNext()) { ! Object current = iter.next(); ! if (current instanceof Surface) { ! surface = (Surface) current; ! } } ! if (surface != null) { ! if (type.equals("front")) { ! space = surface.getFrontDomain(); ! } ! if (type.equals("back")) { ! space = surface.getBackDomain(); ! } } + layerItem.addActionListener(new LayerAction(space, surface)); + menu.add(layerItem); + return menu; + } else if (target instanceof Space) { + return PopupMenu.getSpaceMenu((Space)target); + } else if (target instanceof Entity) { + JPopupMenu menu = PopupMenu.getEntityMenu((Entity) target); + + JMenuItem offsetItem = new JMenuItem("Offset Constraint"); + offsetItem.addActionListener(new MenuAction() { + public void actionPerformed(ActionEvent event) { + addOffsetConstraint(Selection.primary()); + } + } + ); + menu.add(offsetItem); + return menu; + } else { + return null; } } else { ! Iterator sel = Selection.primary().iterator(); ! Collection entities = new LinkedList(); ! while (sel.hasNext()) { ! Object next = sel.next(); ! if (Selection.primary().size() == 1) { ! if (next instanceof Space) { ! return PopupMenu.getSpaceMenu((Space)next); ! } else { ! return PopupMenu.getEntityMenu((Entity)next); ! } ! } else { ! entities.add(next); } ! } ! return PopupMenu.getEntiesMenu(entities); } } *************** *** 438,451 **** Collection domains = null; String category = null; ! Space owner = surface.getOwner(); ! Space world = Project.getInstance().world(); ! if (owner == world) { domains = Project.getInstance().getSpaces(); category = "Space"; ! } else if (owner.getOwner() == world) { domains = owner.getElements(); category = "Element"; ! } else { domains = owner.getElements(); category = "Part"; --- 461,476 ---- Collection domains = null; String category = null; ! Space owner = space.getOwner(); ! if (space.getLevel() == Space.PROJECT_LEVEL) { domains = Project.getInstance().getSpaces(); + category = "Project"; + } else if (space.getLevel() == Space.SPACE_LEVEL) { + domains = owner.getElements(); category = "Space"; ! } else if (space.getLevel() == Space.ELEMENT_LEVEL) { domains = owner.getElements(); category = "Element"; ! } else if (space.getLevel() == Space.PART_LEVEL) { domains = owner.getElements(); category = "Part"; *************** *** 465,479 **** createConstItem.addActionListener(constListener); ! JMenuItem editSpaceItem = new JMenuItem("Edit Space"); ! editSpaceItem.addActionListener(new SpaceAction(space) { ! public void actionPerformed(ActionEvent arg0) { ! if (space != null) { ! Selection.primary().clear(); ! glv.getView().makeTarget(null); ! Project.getInstance().setActiveSpace(space); } ! } ! }); ! JMenuItem copySpaceItem = new JMenuItem("Duplicate Space"); copySpaceItem.addActionListener(new SpaceAction(space) { public void actionPerformed(ActionEvent arg0) { --- 490,507 ---- createConstItem.addActionListener(constListener); ! JMenuItem editSpaceItem = null; ! if (space.isContainer()) { ! editSpaceItem = new JMenuItem("Edit " + category); ! editSpaceItem.addActionListener(new SpaceAction(space) { ! public void actionPerformed(ActionEvent arg0) { ! if (space != null) { ! Selection.primary().clear(); ! glv.getView().makeTarget(null); ! Project.getInstance().setActiveSpace(space); ! } } ! }); ! } ! JMenuItem copySpaceItem = new JMenuItem("Duplicate " + category); copySpaceItem.addActionListener(new SpaceAction(space) { public void actionPerformed(ActionEvent arg0) { *************** *** 487,491 **** }); ! JMenuItem flipSpaceItem = new JMenuItem("Rotate Space 90 degrees CCW"); flipSpaceItem.addActionListener(new SpaceAction(space) { public void actionPerformed(ActionEvent arg0) { --- 515,519 ---- }); ! JMenuItem flipSpaceItem = new JMenuItem("Rotate " + category + " 90 degrees CCW"); flipSpaceItem.addActionListener(new SpaceAction(space) { public void actionPerformed(ActionEvent arg0) { *************** *** 507,527 **** JMenu constMenu = new JMenu("Construction " + category + "s"); ! Iterator domIt = domains.iterator(); ! while (domIt.hasNext()) { ! Space domain = (Space)domIt.next(); ! if (domain instanceof Space) { ! JMenuItem domainItem = new JMenuItem(domain.getName()); ! ActionListener ml = new DomainPopupListener(domain, ! surface, ! side.equals("front")); ! domainItem.addActionListener(ml); ! if (domain.isFunctionalSpace()) { ! funcMenu.add(domainItem); ! } else { ! constMenu.add(domainItem); } } } - funcMenu.addSeparator(); funcMenu.add(createFuncItem); --- 535,556 ---- JMenu constMenu = new JMenu("Construction " + category + "s"); ! if (domains != null) { ! Iterator domIt = domains.iterator(); ! while (domIt.hasNext()) { ! Space domain = (Space)domIt.next(); ! if (domain instanceof Space) { ! JMenuItem domainItem = new JMenuItem(domain.getName()); ! ActionListener ml = new DomainPopupListener(domain, ! surface, ! side.equals("front")); ! domainItem.addActionListener(ml); ! if (domain.isFunctionalSpace()) { ! funcMenu.add(domainItem); ! } else { ! constMenu.add(domainItem); ! } } } } funcMenu.addSeparator(); funcMenu.add(createFuncItem); *************** *** 533,537 **** //menu.add(voidItem); menu.add(copySpaceItem); ! menu.add(editSpaceItem); menu.add(flipSpaceItem); menu.addPopupMenuListener(spl); --- 562,568 ---- //menu.add(voidItem); menu.add(copySpaceItem); ! if (editSpaceItem != null) { ! menu.add(editSpaceItem); ! } menu.add(flipSpaceItem); menu.addPopupMenuListener(spl); *************** *** 618,625 **** parser.script(globals); } catch (Exception error) { ! Project.info(error); } try { ! Project.info("evaluate '" + value + "'"); Environment global = new Environment(globals, null); Environment env = new Environment(global, new HashMap(), new LinkedList()); --- 649,656 ---- parser.script(globals); } catch (Exception error) { ! log.info(error); } try { ! log.info("evaluate '" + value + "'"); Environment global = new Environment(globals, null); Environment env = new Environment(global, new HashMap(), new LinkedList()); *************** *** 651,655 **** } catch (Exception error) { ! Project.info(error); } return null; --- 682,686 ---- } catch (Exception error) { ! log.info(error); } return null; *************** *** 660,664 **** */ public void key(KeyEvent event) { ! { String value; if (typing) { --- 691,695 ---- */ public void key(KeyEvent event) { ! if (!event.isAltDown() && !event.isControlDown()) { String value; if (typing) { *************** *** 673,677 **** typing = true; } else { ! Project.info(new Character(ch)); if (event.getKeyCode() == KeyEvent.VK_ENTER) { evaluate(value); --- 704,708 ---- typing = true; } else { ! log.info(new Character(ch)); if (event.getKeyCode() == KeyEvent.VK_ENTER) { evaluate(value); Index: CreateSpaceActionListener.java =================================================================== RCS file: /cvsroot/bprocessor/gl/src/net/sourceforge/bprocessor/gl/tool/CreateSpaceActionListener.java,v retrieving revision 1.9 retrieving revision 1.10 diff -C2 -d -r1.9 -r1.10 *** CreateSpaceActionListener.java 15 May 2006 09:17:55 -0000 1.9 --- CreateSpaceActionListener.java 26 Sep 2006 09:52:30 -0000 1.10 *************** *** 61,69 **** String result; category = null; ! if (surface.getOwner() == Project.getInstance().world()) { category = "Space"; ! } else { category = "Element"; } if (functional) { --- 61,73 ---- String result; category = null; ! if (Project.getInstance().getActiveSpace().getLevel() == Space.SPACE_LEVEL) { category = "Space"; ! } ! if (Project.getInstance().getActiveSpace().getLevel() == Space.ELEMENT_LEVEL) { category = "Element"; } + if (Project.getInstance().getActiveSpace().getLevel() == Space.PART_LEVEL) { + category = "Part"; + } if (functional) { *************** *** 86,104 **** if (result != null && !result.trim().equals("")) { ! Space space; ! if (functional) { ! space = Space.createFunctionalSpace(result.trim()); ! } else { ! space = Space.createConstructionSpace(result.trim()); ! } ! ! owner.add(space); ! ! if (front) { ! surface.setFrontDomain(space); ! } else { ! surface.setBackDomain(space); } - Project.getInstance().checkpoint(); } } --- 90,110 ---- if (result != null && !result.trim().equals("")) { ! try { ! Space space; ! if (functional) { ! space = owner.createFunctionalSpace(result.trim()); ! } else { ! space = owner.createConstructionSpace(result.trim()); ! } ! owner.add(space); ! if (front) { ! surface.setFrontDomain(space); ! } else { ! surface.setBackDomain(space); ! } ! Project.getInstance().checkpoint(); ! } catch (Exception ex) { ! ex.printStackTrace(); } } } Index: AbstractPencil.java =================================================================== RCS file: /cvsroot/bprocessor/gl/src/net/sourceforge/bprocessor/gl/tool/AbstractPencil.java,v retrieving revision 1.67 retrieving revision 1.68 diff -C2 -d -r1.67 -r1.68 *** AbstractPencil.java 18 Sep 2006 14:09:58 -0000 1.67 --- AbstractPencil.java 26 Sep 2006 09:52:29 -0000 1.68 *************** *** 671,675 **** glv.setLength(d / 1000); } catch (NumberFormatException exp) { ! Project.info(exp); } } --- 671,675 ---- glv.setLength(d / 1000); } catch (NumberFormatException exp) { ! log.warn(exp); } } *************** *** 731,735 **** apply(d / 1000); } catch (NumberFormatException exp) { ! Project.info(exp); } } --- 731,735 ---- apply(d / 1000); } catch (NumberFormatException exp) { ! log.warn(exp); } } *************** *** 739,743 **** glv.setLength(d / 1000); } catch (NumberFormatException exp) { ! Project.info(exp); } } --- 739,743 ---- glv.setLength(d / 1000); } catch (NumberFormatException exp) { ! log.warn(exp); } } *************** *** 806,816 **** return affected; } - - /** - * info - * @param info Info - */ - public static void info(Object info) { - log.info(info); - } } --- 806,808 ---- Index: ControlledMoveTool.java =================================================================== RCS file: /cvsroot/bprocessor/gl/src/net/sourceforge/bprocessor/gl/tool/ControlledMoveTool.java,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** ControlledMoveTool.java 5 Sep 2006 11:01:43 -0000 1.4 --- ControlledMoveTool.java 26 Sep 2006 09:52:30 -0000 1.5 *************** *** 16,19 **** --- 16,21 ---- import java.util.Map; + import org.apache.log4j.Logger; + import net.sourceforge.bprocessor.gl.GLView; import net.sourceforge.bprocessor.model.Edge; *************** *** 32,35 **** --- 34,39 ---- /** Direction */ private Vertex direction; + /** the logger */ + private static Logger log = Logger.getLogger(ControlledMoveTool.class); /** *************** *** 243,253 **** double slideScale; if (delta == null) { ! Project.info("delta null"); } if (slideDir == null) { ! Project.info("slideDir null"); } if (deltaUnit == null) { ! Project.info("deltaUnit null"); } if (delta.getX() != 0) { --- 247,257 ---- double slideScale; if (delta == null) { ! log.info("delta null"); } if (slideDir == null) { ! log.info("slideDir null"); } if (deltaUnit == null) { ! log.info("deltaUnit null"); } if (delta.getX() != 0) { |
From: rimestad <rim...@us...> - 2006-09-26 09:52:32
|
Update of /cvsroot/bprocessor/gl/src/net/sourceforge/bprocessor/gl In directory sc8-pr-cvs3.sourceforge.net:/tmp/cvs-serv19110/src/net/sourceforge/bprocessor/gl Modified Files: GLView.java Log Message: added levels to space and added union as a boolean, now the entire program uses that change Index: GLView.java =================================================================== RCS file: /cvsroot/bprocessor/gl/src/net/sourceforge/bprocessor/gl/GLView.java,v retrieving revision 1.41 retrieving revision 1.42 diff -C2 -d -r1.41 -r1.42 *** GLView.java 11 Sep 2006 12:47:32 -0000 1.41 --- GLView.java 26 Sep 2006 09:52:30 -0000 1.42 *************** *** 246,250 **** */ public void popup(JPopupMenu pp, int x, int y) { ! pp.show((Component) glc, x, y); } --- 246,252 ---- */ public void popup(JPopupMenu pp, int x, int y) { ! if (pp != null) { ! pp.show((Component) glc, x, y); ! } } |
From: rimestad <rim...@us...> - 2006-09-26 09:52:27
|
Update of /cvsroot/bprocessor/model/src/net/sourceforge/bprocessor/model/modellor In directory sc8-pr-cvs3.sourceforge.net:/tmp/cvs-serv19081/src/net/sourceforge/bprocessor/model/modellor Modified Files: LayerModellor.java Log Message: added levels to space and added union as a boolean, now the entire program uses that change Index: LayerModellor.java =================================================================== RCS file: /cvsroot/bprocessor/model/src/net/sourceforge/bprocessor/model/modellor/LayerModellor.java,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** LayerModellor.java 29 Aug 2006 10:06:18 -0000 1.4 --- LayerModellor.java 26 Sep 2006 09:52:25 -0000 1.5 *************** *** 68,79 **** for (int i = 0; i < 3; i++) { ! Space layer = Space.createConstructionSpace("Layer " + (i + 1)); ! space.add(layer); ! this.set(layer, new Layer()); ! bottom.setFrontDomain(layer); ! Set sides = new HashSet(); ! bottom = bottom.extrude(distance, sides); ! bottom.flip(); ! bottom.setBackDomain(layer); } bottom.setFrontDomain(space.getEmpty()); --- 68,83 ---- for (int i = 0; i < 3; i++) { ! try { ! Space layer = space.createConstructionSpace("Layer " + (i + 1)); ! space.add(layer); ! this.set(layer, new Layer()); ! bottom.setFrontDomain(layer); ! Set sides = new HashSet(); ! bottom = bottom.extrude(distance, sides); ! bottom.flip(); ! bottom.setBackDomain(layer); ! } catch (Exception ex) { ! ex.printStackTrace(); ! } } bottom.setFrontDomain(space.getEmpty()); |
From: rimestad <rim...@us...> - 2006-09-26 09:52:27
|
Update of /cvsroot/bprocessor/model/src/etc In directory sc8-pr-cvs3.sourceforge.net:/tmp/cvs-serv19081/src/etc Modified Files: bprocessor.xsd Log Message: added levels to space and added union as a boolean, now the entire program uses that change Index: bprocessor.xsd =================================================================== RCS file: /cvsroot/bprocessor/model/src/etc/bprocessor.xsd,v retrieving revision 1.16 retrieving revision 1.17 diff -C2 -d -r1.16 -r1.17 *** bprocessor.xsd 17 Sep 2006 21:58:16 -0000 1.16 --- bprocessor.xsd 26 Sep 2006 09:52:25 -0000 1.17 *************** *** 33,36 **** --- 33,37 ---- <xsd:element name="name" type="xsd:string" maxOccurs="1" minOccurs="0"/> <xsd:element name="type" type="xsd:int" maxOccurs="1" minOccurs="0"/> + <xsd:element name="level" type="xsd:int" maxOccurs="1" minOccurs="0"/> <xsd:element name="description" type="xsd:string" maxOccurs="1" minOccurs="0"/> <xsd:element name="Classification" type="xsd:string" maxOccurs="1" minOccurs="0"/> |