bprocessor-commit Mailing List for B-processor (Page 137)
Status: Pre-Alpha
Brought to you by:
henryml
You can subscribe to this list here.
2005 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
(12) |
Jul
(117) |
Aug
(151) |
Sep
(157) |
Oct
(81) |
Nov
(117) |
Dec
(119) |
---|---|---|---|---|---|---|---|---|---|---|---|---|
2006 |
Jan
(183) |
Feb
(130) |
Mar
(117) |
Apr
(61) |
May
(82) |
Jun
(45) |
Jul
(149) |
Aug
(173) |
Sep
(199) |
Oct
(165) |
Nov
(107) |
Dec
(137) |
2007 |
Jan
(124) |
Feb
(58) |
Mar
(123) |
Apr
(80) |
May
(130) |
Jun
(64) |
Jul
(31) |
Aug
(42) |
Sep
(114) |
Oct
(167) |
Nov
(239) |
Dec
(200) |
2008 |
Jan
(43) |
Feb
(43) |
Mar
(4) |
Apr
(9) |
May
(5) |
Jun
(1) |
Jul
(3) |
Aug
(3) |
Sep
(13) |
Oct
(9) |
Nov
(12) |
Dec
|
2009 |
Jan
|
Feb
(20) |
Mar
(7) |
Apr
(12) |
May
(34) |
Jun
(72) |
Jul
|
Aug
(3) |
Sep
(31) |
Oct
(2) |
Nov
(8) |
Dec
(4) |
2010 |
Jan
(5) |
Feb
(32) |
Mar
(8) |
Apr
(7) |
May
(36) |
Jun
|
Jul
(11) |
Aug
(15) |
Sep
(7) |
Oct
(2) |
Nov
(13) |
Dec
(80) |
2011 |
Jan
|
Feb
|
Mar
(8) |
Apr
(12) |
May
(32) |
Jun
(9) |
Jul
(5) |
Aug
|
Sep
(2) |
Oct
|
Nov
|
Dec
(8) |
2012 |
Jan
|
Feb
|
Mar
(3) |
Apr
(5) |
May
(2) |
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
2013 |
Jan
|
Feb
|
Mar
|
Apr
|
May
(22) |
Jun
(5) |
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
From: Michael L. <he...@us...> - 2006-02-01 09:00:35
|
Update of /cvsroot/bprocessor/model/src/net/sourceforge/bprocessor/model In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv3261/src/net/sourceforge/bprocessor/model Modified Files: Space.java Project.java Log Message: Renamed "surfaces" to "envelope" in Space, since a space can also have interior surfaces Index: Space.java =================================================================== RCS file: /cvsroot/bprocessor/model/src/net/sourceforge/bprocessor/model/Space.java,v retrieving revision 1.15 retrieving revision 1.16 diff -C2 -d -r1.15 -r1.16 *** Space.java 30 Jan 2006 10:04:50 -0000 1.15 --- Space.java 1 Feb 2006 09:00:23 -0000 1.16 *************** *** 26,31 **** /** The attributes */ private Set attributes; ! /** The surfaces */ ! private Set surfaces; --- 26,31 ---- /** The attributes */ private Set attributes; ! /** The envelope (a set of surfaces) */ ! private Set envelope; *************** *** 133,139 **** * class="net.sourceforge.bprocessor.model.Surface" */ ! public Set getSurfaces() { ! if (surfaces != null) { ! return surfaces; } else { return new HashSet(); --- 133,139 ---- * class="net.sourceforge.bprocessor.model.Surface" */ ! public Set getEnvelope() { ! if (envelope != null) { ! return envelope; } else { return new HashSet(); *************** *** 145,177 **** * @param surfaces The surfaces */ ! public void setSurfaces(Set surfaces) { ! this.surfaces = surfaces; } /** ! * Add a surface to the list of surfaces * @param surface The surface */ public void addSurface(Surface surface) { ! if (surfaces == null) { ! surfaces = new HashSet(); } ! surfaces.add(surface); changed(); } /** ! * Remove a surface from this domain * @param surface The surface to remove - * @return True if the Domain contained the surface otherwise false */ ! public boolean removeSurface(Surface surface) { ! Set s = getSurfaces(); ! if (s != null && s.contains(surface)) { ! s.remove(surface); changed(); ! return true; } - return false; } --- 145,175 ---- * @param surfaces The surfaces */ ! public void setEnvelope(Set surfaces) { ! this.envelope = surfaces; } /** ! * Add a surface to the envelope * @param surface The surface */ public void addSurface(Surface surface) { ! if (envelope == null) { ! envelope = new HashSet(); } ! envelope.add(surface); changed(); } /** ! * Remove a surface from the envelope of this domain * @param surface The surface to remove */ ! public void removeSurface(Surface surface) { ! if (envelope != null) { ! envelope.remove(surface); changed(); ! } else { ! throw new Error("removing " + surface + " from " + this + " with no envelope"); } } Index: Project.java =================================================================== RCS file: /cvsroot/bprocessor/model/src/net/sourceforge/bprocessor/model/Project.java,v retrieving revision 1.32 retrieving revision 1.33 diff -C2 -d -r1.32 -r1.33 *** Project.java 30 Jan 2006 15:08:39 -0000 1.32 --- Project.java 1 Feb 2006 09:00:23 -0000 1.33 *************** *** 262,266 **** */ public void remove(Space space) { ! Set surfaces = space.getSurfaces(); if (surfaces != null) { Iterator surfIt = surfaces.iterator(); --- 262,266 ---- */ public void remove(Space space) { ! Set surfaces = space.getEnvelope(); if (surfaces != null) { Iterator surfIt = surfaces.iterator(); |
From: Michael L. <he...@us...> - 2006-02-01 09:00:32
|
Update of /cvsroot/bprocessor/model/src/net/sourceforge/bprocessor/model/xml In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv3261/src/net/sourceforge/bprocessor/model/xml Modified Files: PersistenceManager.java Log Message: Renamed "surfaces" to "envelope" in Space, since a space can also have interior surfaces Index: PersistenceManager.java =================================================================== RCS file: /cvsroot/bprocessor/model/src/net/sourceforge/bprocessor/model/xml/PersistenceManager.java,v retrieving revision 1.22 retrieving revision 1.23 diff -C2 -d -r1.22 -r1.23 *** PersistenceManager.java 24 Jan 2006 14:10:42 -0000 1.22 --- PersistenceManager.java 1 Feb 2006 09:00:22 -0000 1.23 *************** *** 265,269 **** sr.add(s); } ! csm.setSurfaces(sr); } } --- 265,269 ---- sr.add(s); } ! csm.setEnvelope(sr); } } *************** *** 303,307 **** sr.add(s); } ! fsm.setSurfaces(sr); } } --- 303,307 ---- sr.add(s); } ! fsm.setEnvelope(sr); } } *************** *** 622,626 **** Constructionspace csx = findConstructionSpace(bp, cs); ! Set data = cs.getSurfaces(); Iterator it = data.iterator(); while (it.hasNext()) { --- 622,626 ---- Constructionspace csx = findConstructionSpace(bp, cs); ! Set data = cs.getEnvelope(); Iterator it = data.iterator(); while (it.hasNext()) { *************** *** 666,670 **** Functionalspace fsx = findFunctionalSpace(bp, fs); ! Set data = fs.getSurfaces(); Iterator it = data.iterator(); while (it.hasNext()) { --- 666,670 ---- Functionalspace fsx = findFunctionalSpace(bp, fs); ! Set data = fs.getEnvelope(); Iterator it = data.iterator(); while (it.hasNext()) { |
From: Michael L. <he...@us...> - 2006-02-01 09:00:27
|
Update of /cvsroot/bprocessor/gui/src/net/sourceforge/bprocessor/gui/treeview In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv3207/src/net/sourceforge/bprocessor/gui/treeview Modified Files: GenericTreeView.java Log Message: Renamed "surfaces" to "envelope" in Space, since a space can also have interior surfaces Index: GenericTreeView.java =================================================================== RCS file: /cvsroot/bprocessor/gui/src/net/sourceforge/bprocessor/gui/treeview/GenericTreeView.java,v retrieving revision 1.11 retrieving revision 1.12 diff -C2 -d -r1.11 -r1.12 *** GenericTreeView.java 30 Jan 2006 15:08:35 -0000 1.11 --- GenericTreeView.java 1 Feb 2006 09:00:17 -0000 1.12 *************** *** 177,181 **** public SpaceNode(Space space) { super(space); ! Set surfaces = space.getSurfaces(); add(new SurfaceContainer("Surface", surfaces)); add(new ContainerNode("Element")); --- 177,181 ---- public SpaceNode(Space space) { super(space); ! Set surfaces = space.getEnvelope(); add(new SurfaceContainer("Surface", surfaces)); add(new ContainerNode("Element")); |
From: Michael L. <he...@us...> - 2006-02-01 09:00:22
|
Update of /cvsroot/bprocessor/gl/src/net/sourceforge/bprocessor/gl/tool In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv3151/src/net/sourceforge/bprocessor/gl/tool Modified Files: SelectTool.java CatmullClark.java Log Message: Renamed "surfaces" to "envelope" in Space, since a space can also have interior surfaces Index: SelectTool.java =================================================================== RCS file: /cvsroot/bprocessor/gl/src/net/sourceforge/bprocessor/gl/tool/SelectTool.java,v retrieving revision 1.52 retrieving revision 1.53 diff -C2 -d -r1.52 -r1.53 *** SelectTool.java 25 Jan 2006 10:02:09 -0000 1.52 --- SelectTool.java 1 Feb 2006 09:00:11 -0000 1.53 *************** *** 80,87 **** Surface surface = (Surface) target; if (surface.getBackDomain() != null) { ! selection.addAll(surface.getBackDomain().getSurfaces()); } if (surface.getFrontDomain() != null) { ! selection.addAll(surface.getFrontDomain().getSurfaces()); } } else { --- 80,87 ---- Surface surface = (Surface) target; if (surface.getBackDomain() != null) { ! selection.addAll(surface.getBackDomain().getEnvelope()); } if (surface.getFrontDomain() != null) { ! selection.addAll(surface.getFrontDomain().getEnvelope()); } } else { Index: CatmullClark.java =================================================================== RCS file: /cvsroot/bprocessor/gl/src/net/sourceforge/bprocessor/gl/tool/CatmullClark.java,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** CatmullClark.java 30 Jan 2006 10:04:45 -0000 1.6 --- CatmullClark.java 1 Feb 2006 09:00:11 -0000 1.7 *************** *** 300,304 **** */ public List generate() { ! List faces = copy(space.getSurfaces()); return catmullclark(catmullclark(catmullclark(faces))); } --- 300,304 ---- */ public List generate() { ! List faces = copy(space.getEnvelope()); return catmullclark(catmullclark(catmullclark(faces))); } |
From: Michael L. <he...@us...> - 2006-01-31 14:45:17
|
Update of /cvsroot/bprocessor/gl/src/net/sourceforge/bprocessor/gl/view In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv19502/src/net/sourceforge/bprocessor/gl/view Modified Files: View.java Log Message: Uses white in hiddenline wireframe Index: View.java =================================================================== RCS file: /cvsroot/bprocessor/gl/src/net/sourceforge/bprocessor/gl/view/View.java,v retrieving revision 1.53 retrieving revision 1.54 diff -C2 -d -r1.53 -r1.54 *** View.java 30 Jan 2006 12:35:48 -0000 1.53 --- View.java 31 Jan 2006 14:44:53 -0000 1.54 *************** *** 125,135 **** private static final int ALL = 4; ! /** The NORMAL side is the side where the normal points to */ ! private static final int NORMAL = 0; ! /** The front side is the functional-space side. */ private static final int FRONT = 1; ! /** The back side the construction-space side. */ private static final int BACK = 2; --- 125,135 ---- private static final int ALL = 4; ! /** BOTH side is used when surface is drawn without lightning and culling */ ! private static final int BOTH = 0; ! /** The front side is side the normal is pointing to */ private static final int FRONT = 1; ! /** The back side is the other side than the one the normal is pointing to */ private static final int BACK = 2; *************** *** 891,895 **** gl.glPolygonOffset(1.0f, 1.0f); gl.glColor3fv(SURFACE_COLOR); ! drawSurfaces(gld, NORMAL); gl.glDisable(GL.GL_POLYGON_OFFSET_FILL); break; --- 891,895 ---- gl.glPolygonOffset(1.0f, 1.0f); gl.glColor3fv(SURFACE_COLOR); ! drawSurfaces(gld, BOTH); gl.glDisable(GL.GL_POLYGON_OFFSET_FILL); break; *************** *** 1361,1364 **** --- 1361,1367 ---- return false; } + if (front == back) { + return false; + } return true; } *************** *** 1401,1429 **** if (!selection.contains(s)) { boolean visible = isVisible(s); ! if (!visible) { ! gl.glEnable(GL.GL_POLYGON_STIPPLE); ! gl.glPolygonStipple(seethrough); ! gl.glColor3fv(GRID_COLOR); } else { ! if (side == FRONT) { ! if (s.getFrontMaterial() == null) { ! Space back = s.getFrontDomain(); ! gl.glColor3fv(getSpaceColor(back)); ! } else { ! gl.glColor3fv(s.getFrontMaterial().getColor()); } ! } ! if (side == BACK) { ! if (s.getBackMaterial() == null) { ! Space front = s.getBackDomain(); ! gl.glColor3fv(getSpaceColor(front)); ! } else { ! gl.glColor3fv(s.getBackMaterial().getColor()); } } ! } ! drawSurface(s); ! if (!visible) { ! gl.glDisable(GL.GL_POLYGON_STIPPLE); } } --- 1404,1438 ---- if (!selection.contains(s)) { boolean visible = isVisible(s); ! if (side == BOTH) { ! if (visible) { ! drawSurface(s); ! } } else { ! if (!visible) { ! gl.glEnable(GL.GL_POLYGON_STIPPLE); ! gl.glPolygonStipple(seethrough); ! gl.glColor3fv(GRID_COLOR); ! } else { ! if (side == FRONT) { ! if (s.getFrontMaterial() == null) { ! Space back = s.getFrontDomain(); ! gl.glColor3fv(getSpaceColor(back)); ! } else { ! gl.glColor3fv(s.getFrontMaterial().getColor()); ! } } ! if (side == BACK) { ! if (s.getBackMaterial() == null) { ! Space front = s.getBackDomain(); ! gl.glColor3fv(getSpaceColor(front)); ! } else { ! gl.glColor3fv(s.getBackMaterial().getColor()); ! } } } ! drawSurface(s); ! if (!visible) { ! gl.glDisable(GL.GL_POLYGON_STIPPLE); ! } } } |
From: Michael L. <he...@us...> - 2006-01-30 15:20:42
|
Update of /cvsroot/bprocessor/model/src/net/sourceforge/bprocessor/model/constraints In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv3153/src/net/sourceforge/bprocessor/model/constraints Added Files: OffsetConstraint.java package.html Log Message: Moved OffsetConstraint to model.constraints --- NEW FILE: package.html --- <body> Defines the package that contains the constraints in the model </body> --- NEW FILE: OffsetConstraint.java --- //--------------------------------------------------------------------------------- // $Id: OffsetConstraint.java,v 1.1 2006/01/30 15:20:31 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.constraints; import java.util.HashSet; import java.util.Iterator; import java.util.Set; import net.sourceforge.bprocessor.model.Constraint; import net.sourceforge.bprocessor.model.CoordinateSystem; import net.sourceforge.bprocessor.model.Edge; import net.sourceforge.bprocessor.model.Surface; import net.sourceforge.bprocessor.model.Vertex; /** * @author henryml * * TODO To change the template for this generated type comment go to * Window - Preferences - Java - Code Style - Code Templates */ public class OffsetConstraint extends Constraint { /** The offset */ private double offset; /** * Constructor for OffsetConstraint * @param master The master * @param slave The slave */ public OffsetConstraint(Surface master, Surface slave) { super(master, slave); updateOffset(); } /** * Collect vertices from object * FIXME: Make reuable by moving somewhere accessible * @param o The object * @param vertices The vertices */ protected void collect(Object o, Set vertices) { if (o instanceof Vertex) { vertices.add(o); } else if (o instanceof Edge) { Edge edge = (Edge) o; vertices.add(edge.getFrom()); vertices.add(edge.getTo()); } else if (o instanceof Surface) { Surface surface = (Surface) o; vertices.addAll(surface.getVertices()); if (surface.getHoles() != null) { Iterator iter = surface.getHoles().iterator(); while (iter.hasNext()) { Surface current = (Surface) iter.next(); collect(current, vertices); } } } } /** * Update offset */ protected void updateOffset() { Surface master = (Surface) getMaster(); Surface slave = (Surface) getSlave(); CoordinateSystem system = master.coordinateSystem(); Vertex origin = system.origin(); Vertex n = system.getN(); n.scale(1 / n.length()); Vertex v = slave.getFirstVertex(); Vertex u = v.minus(origin); double distance = n.dot(u); this.offset = distance; } /** * Maintain offset */ protected void maintainOffset() { Surface master = (Surface) getMaster(); Surface slave = (Surface) getSlave(); CoordinateSystem system = master.coordinateSystem(); Vertex origin = system.origin(); Vertex n = system.getN(); n.scale(1 / n.length()); Set vertices = new HashSet(); // List vertices = slave.getVertices(); // vertices.remove(0); collect(slave, vertices); Iterator iter = vertices.iterator(); while (iter.hasNext()) { Vertex current = (Vertex) iter.next(); Vertex p = system.translate(current); p.setZ(offset); p = system.unTranslate(p); current.setX(p.getX()); current.setY(p.getY()); current.setZ(p.getZ()); } } /** * Update * @param entity The changed entity */ public void update(Object entity) { if (entity == getSlave()) { updateOffset(); } else { maintainOffset(); } } } |
From: Michael L. <he...@us...> - 2006-01-30 15:20:37
|
Update of /cvsroot/bprocessor/model/src/net/sourceforge/bprocessor/model/constraints In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv3134/src/net/sourceforge/bprocessor/model/constraints Log Message: Directory /cvsroot/bprocessor/model/src/net/sourceforge/bprocessor/model/constraints added to the repository |
From: Michael L. <he...@us...> - 2006-01-30 15:20:30
|
Update of /cvsroot/bprocessor/gl/src/net/sourceforge/bprocessor/gl/tool In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv3097/src/net/sourceforge/bprocessor/gl/tool Modified Files: SpaceTool.java Log Message: Moved OffsetConstraint to model.constraints Index: SpaceTool.java =================================================================== RCS file: /cvsroot/bprocessor/gl/src/net/sourceforge/bprocessor/gl/tool/SpaceTool.java,v retrieving revision 1.10 retrieving revision 1.11 diff -C2 -d -r1.10 -r1.11 *** SpaceTool.java 30 Jan 2006 14:48:44 -0000 1.10 --- SpaceTool.java 30 Jan 2006 15:20:18 -0000 1.11 *************** *** 18,22 **** import java.util.LinkedList; import java.util.List; - import java.util.Set; import javax.swing.JMenu; --- 18,21 ---- *************** *** 27,32 **** import net.sourceforge.bprocessor.gl.GLView; - import net.sourceforge.bprocessor.model.Constraint; - import net.sourceforge.bprocessor.model.CoordinateSystem; import net.sourceforge.bprocessor.model.Edge; import net.sourceforge.bprocessor.model.Modellor; --- 26,29 ---- *************** *** 35,38 **** --- 32,36 ---- import net.sourceforge.bprocessor.model.Surface; import net.sourceforge.bprocessor.model.Vertex; + import net.sourceforge.bprocessor.model.constraints.OffsetConstraint; /** *************** *** 113,191 **** } - - /** - * The OffsetConstraint maintains a distance between surfaces - * TODO move to model - */ - public class OffsetConstraint extends Constraint { - /** The offset */ - private double offset; - - /** - * Constructor for OffsetConstraint - * @param master The master - * @param slave The slave - */ - public OffsetConstraint(Surface master, Surface slave) { - super(master, slave); - updateOffset(); - } - - /** - * Update offset - */ - protected void updateOffset() { - Surface master = (Surface) getMaster(); - Surface slave = (Surface) getSlave(); - CoordinateSystem system = master.coordinateSystem(); - Vertex origin = system.origin(); - Vertex n = system.getN(); - n.scale(1 / n.length()); - Vertex v = slave.getFirstVertex(); - Vertex u = v.minus(origin); - double distance = n.dot(u); - this.offset = distance; - } - - /** - * Maintain offset - */ - protected void maintainOffset() { - Surface master = (Surface) getMaster(); - Surface slave = (Surface) getSlave(); - CoordinateSystem system = master.coordinateSystem(); - Vertex origin = system.origin(); - Vertex n = system.getN(); - n.scale(1 / n.length()); - Set vertices = new HashSet(); - - // List vertices = slave.getVertices(); - // vertices.remove(0); - collect(slave, vertices); - Iterator iter = vertices.iterator(); - while (iter.hasNext()) { - Vertex current = (Vertex) iter.next(); - Vertex p = system.translate(current); - p.setZ(offset); - p = system.unTranslate(p); - current.setX(p.getX()); - current.setY(p.getY()); - current.setZ(p.getZ()); - } - } - - /** - * Update - * @param entity The changed entity - */ - public void update(Object entity) { - if (entity == getSlave()) { - updateOffset(); - } else { - maintainOffset(); - } - } - } - /** * Add offset constraint to objects --- 111,114 ---- |
From: Michael L. <he...@us...> - 2006-01-30 15:08:52
|
Update of /cvsroot/bprocessor/model/src/net/sourceforge/bprocessor/model In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv31360/src/net/sourceforge/bprocessor/model Modified Files: Constraint.java Project.java Log Message: Constraints now is shown in D-View Index: Constraint.java =================================================================== RCS file: /cvsroot/bprocessor/model/src/net/sourceforge/bprocessor/model/Constraint.java,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** Constraint.java 10 Jan 2006 10:45:21 -0000 1.1 --- Constraint.java 30 Jan 2006 15:08:39 -0000 1.2 *************** *** 21,25 **** * state. */ ! public abstract class Constraint implements Observer { /** The master */ private Entity master; --- 21,25 ---- * state. */ ! public abstract class Constraint extends Entity implements Observer { /** The master */ private Entity master; *************** *** 96,98 **** --- 96,119 ---- return entities; } + + /** + * Return name + * @return The name + */ + public String getName() { + if (id == null) { + return "C"; + } else { + return "C" + id; + } + } + + /** + * Return the center for the entity + * @return The center as a vertex + */ + public Vertex center() { + return null; + } + } Index: Project.java =================================================================== RCS file: /cvsroot/bprocessor/model/src/net/sourceforge/bprocessor/model/Project.java,v retrieving revision 1.31 retrieving revision 1.32 diff -C2 -d -r1.31 -r1.32 *** Project.java 30 Jan 2006 14:48:48 -0000 1.31 --- Project.java 30 Jan 2006 15:08:39 -0000 1.32 *************** *** 153,156 **** --- 153,158 ---- public void add(Constraint constraint) { constraints.add(constraint); + constraint.setId(new Long(constraints.size())); + changed(this); } *************** *** 161,164 **** --- 163,168 ---- public void remove(Constraint constraint) { constraints.remove(constraint); + constraint.setId(null); + changed(this); } |
From: Michael L. <he...@us...> - 2006-01-30 15:08:52
|
Update of /cvsroot/bprocessor/gui/src/net/sourceforge/bprocessor/gui/treeview In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv31337/src/net/sourceforge/bprocessor/gui/treeview Modified Files: GenericTreeView.java SpaceTreeView.java Log Message: Constraints now is shown in D-View Index: GenericTreeView.java =================================================================== RCS file: /cvsroot/bprocessor/gui/src/net/sourceforge/bprocessor/gui/treeview/GenericTreeView.java,v retrieving revision 1.10 retrieving revision 1.11 diff -C2 -d -r1.10 -r1.11 *** GenericTreeView.java 23 Jan 2006 10:16:26 -0000 1.10 --- GenericTreeView.java 30 Jan 2006 15:08:35 -0000 1.11 *************** *** 20,23 **** --- 20,24 ---- import net.sourceforge.bprocessor.model.Camera; + import net.sourceforge.bprocessor.model.Constraint; import net.sourceforge.bprocessor.model.Edge; import net.sourceforge.bprocessor.model.Entity; *************** *** 295,298 **** --- 296,330 ---- /** + * ConstraintNode + */ + public class ConstraintNode extends EntityNode { + /** + * Constructor for ConstraintNode + * @param constraint The constraint + */ + public ConstraintNode(Constraint constraint) { + super(constraint); + } + } + + /** + * ConstraintContainer + */ + public class ConstraintContainer extends ContainerNode { + /** + * Constructor for ConstraintContainer + * @param name The name + * @param constraints The constraints + */ + public ConstraintContainer(String name, Collection constraints) { + super(name); + Iterator iter = constraints.iterator(); + while (iter.hasNext()) { + Constraint current = (Constraint) iter.next(); + add(new ConstraintNode(current)); + } + } + } + /** * Selection Listener */ Index: SpaceTreeView.java =================================================================== RCS file: /cvsroot/bprocessor/gui/src/net/sourceforge/bprocessor/gui/treeview/SpaceTreeView.java,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** SpaceTreeView.java 23 Jan 2006 10:16:26 -0000 1.4 --- SpaceTreeView.java 30 Jan 2006 15:08:35 -0000 1.5 *************** *** 31,37 **** Collection construction = Project.getInstance().getConstructionSpaces(); Collection functional = Project.getInstance().getFunctionalSpaces(); ! Collection surfaces = Project.getInstance().getSurfaces(); root.add(new SpaceContainer("Functional", functional)); root.add(new SpaceContainer("Construction", construction)); model.nodeStructureChanged(root); } --- 31,38 ---- Collection construction = Project.getInstance().getConstructionSpaces(); Collection functional = Project.getInstance().getFunctionalSpaces(); ! Collection constraints = Project.getInstance().getConstraints(); root.add(new SpaceContainer("Functional", functional)); root.add(new SpaceContainer("Construction", construction)); + root.add(new ConstraintContainer("Constraints", constraints)); model.nodeStructureChanged(root); } |
From: Michael L. <he...@us...> - 2006-01-30 14:48:58
|
Update of /cvsroot/bprocessor/model/src/net/sourceforge/bprocessor/model In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv24172/src/net/sourceforge/bprocessor/model Modified Files: Project.java Removed Files: Constraints.java Log Message: Removed "Constraints" object and moved functionality to Project --- Constraints.java DELETED --- Index: Project.java =================================================================== RCS file: /cvsroot/bprocessor/model/src/net/sourceforge/bprocessor/model/Project.java,v retrieving revision 1.30 retrieving revision 1.31 diff -C2 -d -r1.30 -r1.31 *** Project.java 30 Jan 2006 10:08:14 -0000 1.30 --- Project.java 30 Jan 2006 14:48:48 -0000 1.31 *************** *** 47,50 **** --- 47,53 ---- /** The domain id */ private long cameraId; + + /** The constraints */ + private Collection constraints; /** Has changes been made */ *************** *** 80,83 **** --- 83,87 ---- observers = new LinkedList(); mesh = new Mesh(); + constraints = new LinkedList(); } *************** *** 142,145 **** --- 146,193 ---- currentCamera = cam0; } + + /** + * Add a constraint + * @param constraint The constraint to add + */ + public void add(Constraint constraint) { + constraints.add(constraint); + } + + /** + * Remove a constraint + * @param constraint The constraint to remove + */ + public void remove(Constraint constraint) { + constraints.remove(constraint); + } + + /** + * Return constraints + * @return The constraints + */ + public Collection getConstraints() { + return constraints; + } + + /** + * Update all constraints related to entity + * @param entity The changed entity + */ + public void updateConstraints(Entity entity) { + // TODO implement general constraint updating mechanism + // that ensures that constraints are updated in correct + // order + + Iterator iter = constraints.iterator(); + while (iter.hasNext()) { + Constraint current = (Constraint) iter.next(); + if (current.depends(entity)) { + current.update(entity); + } + } + entity.changed(); + } + /** |
From: Michael L. <he...@us...> - 2006-01-30 14:48:54
|
Update of /cvsroot/bprocessor/gl/src/net/sourceforge/bprocessor/gl/tool In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv24151/src/net/sourceforge/bprocessor/gl/tool Modified Files: MoveTool.java SpaceTool.java RotationTool.java Log Message: Removed "Constraints" object and moved functionality to Project Index: SpaceTool.java =================================================================== RCS file: /cvsroot/bprocessor/gl/src/net/sourceforge/bprocessor/gl/tool/SpaceTool.java,v retrieving revision 1.9 retrieving revision 1.10 diff -C2 -d -r1.9 -r1.10 *** SpaceTool.java 30 Jan 2006 10:04:45 -0000 1.9 --- SpaceTool.java 30 Jan 2006 14:48:44 -0000 1.10 *************** *** 28,32 **** import net.sourceforge.bprocessor.gl.GLView; import net.sourceforge.bprocessor.model.Constraint; - import net.sourceforge.bprocessor.model.Constraints; import net.sourceforge.bprocessor.model.CoordinateSystem; import net.sourceforge.bprocessor.model.Edge; --- 28,31 ---- *************** *** 208,212 **** if (master != null && slave != null) { OffsetConstraint constraint = new OffsetConstraint(master, slave); ! Constraints.getInstance().add(constraint); } } --- 207,211 ---- if (master != null && slave != null) { OffsetConstraint constraint = new OffsetConstraint(master, slave); ! Project.getInstance().add(constraint); } } Index: MoveTool.java =================================================================== RCS file: /cvsroot/bprocessor/gl/src/net/sourceforge/bprocessor/gl/tool/MoveTool.java,v retrieving revision 1.29 retrieving revision 1.30 diff -C2 -d -r1.29 -r1.30 *** MoveTool.java 30 Jan 2006 11:31:43 -0000 1.29 --- MoveTool.java 30 Jan 2006 14:48:44 -0000 1.30 *************** *** 10,14 **** import net.sourceforge.bprocessor.gl.model.ClippingPlane; - import net.sourceforge.bprocessor.model.Constraints; import net.sourceforge.bprocessor.model.Edge; import net.sourceforge.bprocessor.model.Entity; --- 10,13 ---- *************** *** 100,104 **** } else { if (o instanceof Entity) { ! Constraints.getInstance().update((Entity) o); } } --- 99,103 ---- } else { if (o instanceof Entity) { ! Project.getInstance().updateConstraints((Entity) o); } } Index: RotationTool.java =================================================================== RCS file: /cvsroot/bprocessor/gl/src/net/sourceforge/bprocessor/gl/tool/RotationTool.java,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** RotationTool.java 30 Jan 2006 14:11:55 -0000 1.6 --- RotationTool.java 30 Jan 2006 14:48:44 -0000 1.7 *************** *** 10,14 **** import net.sourceforge.bprocessor.gl.model.ClippingPlane; ! import net.sourceforge.bprocessor.model.Constraints; import net.sourceforge.bprocessor.model.Edge; import net.sourceforge.bprocessor.model.Entity; --- 10,14 ---- import net.sourceforge.bprocessor.gl.model.ClippingPlane; ! import net.sourceforge.bprocessor.model.Project; import net.sourceforge.bprocessor.model.Edge; import net.sourceforge.bprocessor.model.Entity; *************** *** 89,93 **** Object o = iter.next(); if (o instanceof Entity) { ! Constraints.getInstance().update((Entity) o); } } --- 89,93 ---- Object o = iter.next(); if (o instanceof Entity) { ! Project.getInstance().updateConstraints((Entity) o); } } |
From: rimestad <rim...@us...> - 2006-01-30 14:45:44
|
Update of /cvsroot/bprocessor/model/src/net/sourceforge/bprocessor/model In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv23173/src/net/sourceforge/bprocessor/model Modified Files: Attributes.java Camera.java Log Message: Let camera implement Parametric Index: Attributes.java =================================================================== RCS file: /cvsroot/bprocessor/model/src/net/sourceforge/bprocessor/model/Attributes.java,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** Attributes.java 30 Jan 2006 13:04:55 -0000 1.2 --- Attributes.java 30 Jan 2006 14:45:36 -0000 1.3 *************** *** 39,42 **** --- 39,51 ---- /** + * Constructor + * @param name The name + * @param value The value + */ + public Attributes(String name, Object value) { + this(name, value, 0); + } + + /** * @return Returns the name. */ Index: Camera.java =================================================================== RCS file: /cvsroot/bprocessor/model/src/net/sourceforge/bprocessor/model/Camera.java,v retrieving revision 1.8 retrieving revision 1.9 diff -C2 -d -r1.8 -r1.9 *** Camera.java 25 Jan 2006 14:46:01 -0000 1.8 --- Camera.java 30 Jan 2006 14:45:36 -0000 1.9 *************** *** 7,10 **** --- 7,14 ---- package net.sourceforge.bprocessor.model; + import java.util.ArrayList; + import java.util.Iterator; + import java.util.List; + import org.apache.log4j.Logger; *************** *** 13,17 **** * as well as a up vector */ ! public class Camera { /** The 3D view view */ public static final int VIEW_3D = 1; --- 17,21 ---- * as well as a up vector */ ! public class Camera implements Parametric { /** The 3D view view */ public static final int VIEW_3D = 1; *************** *** 390,392 **** --- 394,455 ---- return getName(); } + + /** + * Set the attributes of the object to the values in the list + * @param attributes The attributes to set + */ + public void setAttributes(List attributes) { + Iterator iter = attributes.iterator(); + while (iter.hasNext()) { + Attributes a = (Attributes)iter.next(); + if (a.getName().equals("Name")) { + setName((String)a.getValue()); + } else if (a.getName().equals("Type")) { + setType(((String)a.getValue()).equals("Orthographic") ? ORTHOGRAPHIC : PERSPECTIVE); + } else if (a.getName().equals("Camera")) { + Double x = (Double)iter.next(); + Double y = (Double)iter.next(); + Double z = (Double)iter.next(); + setCamera(new double[]{x.doubleValue(), y.doubleValue(), z.doubleValue()}); + } else if (a.getName().equals("Center")) { + Double x = (Double)iter.next(); + Double y = (Double)iter.next(); + Double z = (Double)iter.next(); + setCenter(new double[]{x.doubleValue(), y.doubleValue(), z.doubleValue()}); + } else if (a.getName().equals("Roll")) { + Double x = (Double)iter.next(); + Double y = (Double)iter.next(); + Double z = (Double)iter.next(); + setRoll(new double[]{x.doubleValue(), y.doubleValue(), z.doubleValue()}); + } else if (a.getName().equals("Focalwidth")) { + setFocalwidth(((Double)a.getValue()).doubleValue()); + } else { + log.error("Wrong attribute for the object " + a); + } + } + } + + /** + * Return a list of the attributes in the object + * @return the list of attributes for the object + */ + public List getAttributes() { + ArrayList res = new ArrayList(); + res.add(new Attributes("Name", getName())); + res.add(new Attributes("Type", type == ORTHOGRAPHIC ? "Orthographic" : "Perspective")); + res.add(new Attributes("Camera", null)); + res.add(new Attributes("X", new Double(getCamera()[0]))); + res.add(new Attributes("Y", new Double(getCamera()[1]))); + res.add(new Attributes("Z", new Double(getCamera()[2]))); + res.add(new Attributes("Center", null)); + res.add(new Attributes("X", new Double(getCenter()[0]))); + res.add(new Attributes("Y", new Double(getCenter()[1]))); + res.add(new Attributes("Z", new Double(getCenter()[2]))); + res.add(new Attributes("Roll", null)); + res.add(new Attributes("X", new Double(getRoll()[0]))); + res.add(new Attributes("Y", new Double(getRoll()[1]))); + res.add(new Attributes("Z", new Double(getRoll()[2]))); + res.add(new Attributes("Focalwidth", new Double(getFocalwidth()))); + return res; + } } |
From: rimestad <rim...@us...> - 2006-01-30 14:12:13
|
Update of /cvsroot/bprocessor/gl/src/net/sourceforge/bprocessor/gl/tool In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv10697/src/net/sourceforge/bprocessor/gl/tool Modified Files: ToolFactory.java RotationTool.java Log Message: Now the rotation tool does work but still in a simple matter and with no snap or info of angle rotated. Index: ToolFactory.java =================================================================== RCS file: /cvsroot/bprocessor/gl/src/net/sourceforge/bprocessor/gl/tool/ToolFactory.java,v retrieving revision 1.26 retrieving revision 1.27 diff -C2 -d -r1.26 -r1.27 *** ToolFactory.java 30 Jan 2006 11:34:10 -0000 1.26 --- ToolFactory.java 30 Jan 2006 14:11:55 -0000 1.27 *************** *** 107,110 **** --- 107,111 ---- but.setToolTipText("Move"); but = tb.registerAction(new RotationAction(glv)); + bg.add(but); but.setToolTipText("Rotate"); but = tb.registerAction(new ExtrudeAction(glv)); *************** *** 118,124 **** but.setToolTipText("Tape Measure"); tb.addSeparator(); - but = tb.registerAction(new RotationAction(glv)); - bg.add(but); - but.setToolTipText("Rotation"); but = tb.registerAction(new CameraAction(glv)); bg.add(but); --- 119,122 ---- Index: RotationTool.java =================================================================== RCS file: /cvsroot/bprocessor/gl/src/net/sourceforge/bprocessor/gl/tool/RotationTool.java,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** RotationTool.java 27 Jan 2006 12:22:45 -0000 1.5 --- RotationTool.java 30 Jan 2006 14:11:55 -0000 1.6 *************** *** 13,18 **** import net.sourceforge.bprocessor.model.Edge; import net.sourceforge.bprocessor.model.Entity; import net.sourceforge.bprocessor.model.Plane; - import net.sourceforge.bprocessor.model.Selection; import net.sourceforge.bprocessor.model.Vertex; import net.sourceforge.bprocessor.model.Surface; --- 13,18 ---- import net.sourceforge.bprocessor.model.Edge; import net.sourceforge.bprocessor.model.Entity; + import net.sourceforge.bprocessor.model.Geometry; import net.sourceforge.bprocessor.model.Plane; import net.sourceforge.bprocessor.model.Vertex; import net.sourceforge.bprocessor.model.Surface; *************** *** 29,32 **** --- 29,33 ---- import org.apache.log4j.Logger; + /** * The rotation tool *************** *** 67,70 **** --- 68,73 ---- /** The set containing the guide line */ private HashSet guide = new HashSet(); + /** The vertexes to rotate */ + private HashSet vertices = new HashSet(); /** *************** *** 101,115 **** if (xCircle.contains(target)) { axis = X_AXIS; - Selection.primary().addAll(xCircle); clearConstructors(zCircle); clearConstructors(yCircle); } else if (yCircle.contains(target)) { axis = Y_AXIS; - Selection.primary().addAll(yCircle); clearConstructors(xCircle); clearConstructors(zCircle); } else if (zCircle.contains(target)) { axis = Z_AXIS; - Selection.primary().addAll(zCircle); clearConstructors(xCircle); clearConstructors(yCircle); --- 104,115 ---- *************** *** 132,141 **** } } else { ! clearConstructors(xCircle); ! xCircle.clear(); ! clearConstructors(yCircle); ! yCircle.clear(); ! clearConstructors(zCircle); ! zCircle.clear(); } } --- 132,136 ---- } } else { ! cleanUp(); } } *************** *** 148,156 **** super.released(e); if (axis != 0) { ! // We were rotation so show all constructor line again displayConstructors(xCircle); displayConstructors(yCircle); displayConstructors(zCircle); - Selection.primary().clear(); // remove guideline clearConstructors(guide); --- 143,152 ---- super.released(e); if (axis != 0) { ! rotate(from, initial, this.center); ! ! // We were rotating so show all constructor line again displayConstructors(xCircle); displayConstructors(yCircle); displayConstructors(zCircle); // remove guideline clearConstructors(guide); *************** *** 160,173 **** if (target != null && target instanceof Entity) { if (target instanceof Edge && ((Edge)target).getConstructor()) { ! // If it is a constructor it should not be rotatable return; } ! clearConstructors(xCircle); ! clearConstructors(yCircle); ! clearConstructors(zCircle); ! xCircle.clear(); ! yCircle.clear(); ! zCircle.clear(); ! HashSet vertices = new HashSet(); collect(selection, vertices); --- 156,163 ---- if (target != null && target instanceof Entity) { if (target instanceof Edge && ((Edge)target).getConstructor()) { ! // If it is a constructor it should not be rotateable return; } ! cleanUp(); collect(selection, vertices); *************** *** 179,182 **** --- 169,173 ---- drawCircles(((Entity)target).center(), dist); } else { + // There were nothing selected if (axis == 0) { dist = 0; *************** *** 199,203 **** initial.setY(ny.getY()); initial.setZ(ny.getZ()); - // TODO rotate the object from prev to initial prev = initial; --- 190,193 ---- *************** *** 216,220 **** public void keyPressed(KeyEvent e) { if (e.getKeyCode() == KeyEvent.VK_ESCAPE) { ! //TODO rotate object from initial back to from } } --- 206,239 ---- public void keyPressed(KeyEvent e) { if (e.getKeyCode() == KeyEvent.VK_ESCAPE) { ! rotate(initial, from, this.center); ! } ! } ! ! /** ! * Rotate the selected vertexes the angle from v1 to v2 ! * @param v1 The from vertex ! * @param v2 The to vertex ! * @param center the vertex to rotate about ! */ ! private void rotate(Vertex v1, Vertex v2, Vertex center) { ! Vertex first = from.minus(center); ! Vertex second = initial.minus(center); ! double direction = first.cross(second).getX() + ! first.cross(second).getY() + ! first.cross(second).getZ(); ! double angle = Math.acos(first.dot(second) / (first.length() * second.length()));; ! int x = axis == X_AXIS ? 1 : 0; ! int y = axis == Y_AXIS ? 1 : 0; ! int z = axis == Z_AXIS ? 1 : 0; ! if (!new Double(angle).isNaN()) { ! Iterator iter = vertices.iterator(); ! while (iter.hasNext()) { ! Vertex v = (Vertex)iter.next(); ! if (direction > 0) { ! Geometry.rotate(angle, x, y, z, v, center); ! } else { ! Geometry.rotate(-angle, x, y, z, v, center); ! } ! } } } *************** *** 222,226 **** /** * Remove tool specific things at tool change - * */ public void cleanUp() { --- 241,244 ---- *************** *** 231,234 **** --- 249,253 ---- yCircle.clear(); zCircle.clear(); + vertices.clear(); } |
From: rimestad <rim...@us...> - 2006-01-30 14:12:10
|
Update of /cvsroot/bprocessor/model/src/net/sourceforge/bprocessor/model In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv10677/src/net/sourceforge/bprocessor/model Modified Files: Geometry.java Log Message: Now the rotation tool does work but still in a simple matter and with no snap or info of angle rotated. Index: Geometry.java =================================================================== RCS file: /cvsroot/bprocessor/model/src/net/sourceforge/bprocessor/model/Geometry.java,v retrieving revision 1.10 retrieving revision 1.11 diff -C2 -d -r1.10 -r1.11 *** Geometry.java 24 Jan 2006 14:10:42 -0000 1.10 --- Geometry.java 30 Jan 2006 14:11:51 -0000 1.11 *************** *** 93,96 **** --- 93,121 ---- } + /** + * Rotate + * @param angle The angle + * @param x The x + * @param y The y + * @param z The z + * @param vector The vector to rotate + * @param center The center of rotation + */ + public static void rotate(double angle, double x, double y, double z, + Vertex vector, Vertex center) { + + double[] v = new double[4]; + + v[0] = vector.getX() - center.getX(); + v[1] = vector.getY() - center.getY(); + v[2] = vector.getZ() - center.getZ(); + v[3] = 1; + Matrix rotation = Matrix.rotation(angle, x, y, z); + v = rotation.multiply(v); + vector.setX(v[0] + center.getX()); + vector.setY(v[1] + center.getY()); + vector.setZ(v[2] + center.getZ()); + } + /** |
From: rimestad <rim...@us...> - 2006-01-30 13:05:14
|
Update of /cvsroot/bprocessor/model/src/net/sourceforge/bprocessor/model In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv17809/src/net/sourceforge/bprocessor/model Modified Files: Attributes.java Log Message: fixed javadoc Index: Attributes.java =================================================================== RCS file: /cvsroot/bprocessor/model/src/net/sourceforge/bprocessor/model/Attributes.java,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** Attributes.java 30 Jan 2006 11:41:12 -0000 1.1 --- Attributes.java 30 Jan 2006 13:04:55 -0000 1.2 *************** *** 29,34 **** * Constructor * @param name The name - * @param type The type * @param value The value */ public Attributes(String name, Object value, int precision) { --- 29,34 ---- * Constructor * @param name The name * @param value The value + * @param precision The precision */ public Attributes(String name, Object value, int precision) { |
From: Nordholt <nor...@us...> - 2006-01-30 12:35:59
|
Update of /cvsroot/bprocessor/gl/src/net/sourceforge/bprocessor/gl/view In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv6908 Modified Files: View.java Log Message: changed toolbar buttons to togglebuttons Index: View.java =================================================================== RCS file: /cvsroot/bprocessor/gl/src/net/sourceforge/bprocessor/gl/view/View.java,v retrieving revision 1.52 retrieving revision 1.53 diff -C2 -d -r1.52 -r1.53 *** View.java 30 Jan 2006 10:04:45 -0000 1.52 --- View.java 30 Jan 2006 12:35:48 -0000 1.53 *************** *** 37,41 **** import javax.swing.Action; import javax.swing.ImageIcon; ! import javax.swing.JButton; import net.java.games.jogl.GL; --- 37,42 ---- import javax.swing.Action; import javax.swing.ImageIcon; ! import javax.swing.JToggleButton; ! import javax.swing.ButtonGroup; import net.java.games.jogl.GL; *************** *** 367,375 **** Toolbar tb = Toolbar.getInstance(); ! JButton but = tb.registerAction(new ViewWireframe(glv)); but.setToolTipText("Wireframe"); but = tb.registerAction(new ViewSolid(glv)); but.setToolTipText("Solid"); but = tb.registerAction(new ViewLighting(glv)); but.setToolTipText("Shading"); } --- 368,380 ---- Toolbar tb = Toolbar.getInstance(); ! ButtonGroup bg = new ButtonGroup(); ! JToggleButton but = tb.registerAction(new ViewWireframe(glv)); ! bg.add(but); but.setToolTipText("Wireframe"); but = tb.registerAction(new ViewSolid(glv)); + bg.add(but); but.setToolTipText("Solid"); but = tb.registerAction(new ViewLighting(glv)); + bg.add(but); but.setToolTipText("Shading"); } |
From: rimestad <rim...@us...> - 2006-01-30 11:41:22
|
Update of /cvsroot/bprocessor/model/src/net/sourceforge/bprocessor/model In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv17468/src/net/sourceforge/bprocessor/model Added Files: Attributes.java Parametric.java Log Message: A class for modeling attributes in objects in the model and a interface for the objects that want to be showable in the attributeview in the standard way --- NEW FILE: Attributes.java --- //--------------------------------------------------------------------------------- // $Id: Attributes.java,v 1.1 2006/01/30 11:41:12 rimestad 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 org.apache.log4j.Logger; /** * A class for holding the info for objects in the model so that it can be * shown in the attributeview in the gui */ public class Attributes { /** The logger */ private static Logger log = Logger.getLogger(Attributes.class); /** The value object */ private Object value; /** The name */ private String name; /** The precision of the object */ private int precision; /** * Constructor * @param name The name * @param type The type * @param value The value */ public Attributes(String name, Object value, int precision) { setName(name); setValue(value); setPrecision(precision); } /** * @return Returns the name. */ public String getName() { return name; } /** * @param name The name to set. */ public void setName(String name) { this.name = name; } /** * @return Returns the precision. */ public int getPrecision() { return precision; } /** * @param precision The precision to set. */ public void setPrecision(int precision) { this.precision = precision; } /** * @return Returns the value. */ public Object getValue() { return value; } /** * @param value The value to set. */ public void setValue(Object value) { this.value = value; } } --- NEW FILE: Parametric.java --- //--------------------------------------------------------------------------------- // $Id: Parametric.java,v 1.1 2006/01/30 11:41:12 rimestad 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; /** * Interface for objects shown by standards in the gui attributeview */ public interface Parametric { /** * Set the attributes of the object to the values in the list * @param attributes The attributes to set */ public void setAttributes(List attributes); /** * Return a list of the attributes in the object * @return the list of attributes for the object */ public List getAttributes(); } |
From: Nordholt <nor...@us...> - 2006-01-30 11:36:51
|
Update of /cvsroot/bprocessor/gui/src/net/sourceforge/bprocessor/gui In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv15844 Modified Files: Toolbar.java Log Message: changed toolbar buttons to togglebuttons Index: Toolbar.java =================================================================== RCS file: /cvsroot/bprocessor/gui/src/net/sourceforge/bprocessor/gui/Toolbar.java,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** Toolbar.java 20 Dec 2005 15:43:31 -0000 1.3 --- Toolbar.java 30 Jan 2006 11:36:43 -0000 1.4 *************** *** 8,12 **** import javax.swing.Action; ! import javax.swing.JButton; import javax.swing.JPanel; import javax.swing.JToolBar; --- 8,12 ---- import javax.swing.Action; ! import javax.swing.JToggleButton; import javax.swing.JPanel; import javax.swing.JToolBar; *************** *** 51,56 **** * @return The JButton */ ! public JButton registerAction(Action action) { ! return toolBar.add(action); } --- 51,58 ---- * @return The JButton */ ! public JToggleButton registerAction(Action action) { ! JToggleButton tb = new JToggleButton(action); ! toolBar.add(tb); ! return tb; } |
From: Nordholt <nor...@us...> - 2006-01-30 11:34:34
|
Update of /cvsroot/bprocessor/gl/src/net/sourceforge/bprocessor/gl/tool In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv14617 Modified Files: ToolFactory.java Log Message: made the toolbar buttons into togglebuttons Index: ToolFactory.java =================================================================== RCS file: /cvsroot/bprocessor/gl/src/net/sourceforge/bprocessor/gl/tool/ToolFactory.java,v retrieving revision 1.25 retrieving revision 1.26 diff -C2 -d -r1.25 -r1.26 *** ToolFactory.java 27 Jan 2006 11:43:37 -0000 1.25 --- ToolFactory.java 30 Jan 2006 11:34:10 -0000 1.26 *************** *** 19,23 **** import javax.swing.Action; import javax.swing.ImageIcon; ! import javax.swing.JButton; import org.apache.log4j.Logger; --- 19,24 ---- import javax.swing.Action; import javax.swing.ImageIcon; ! import javax.swing.JToggleButton; ! import javax.swing.ButtonGroup; import org.apache.log4j.Logger; *************** *** 93,118 **** Toolkit.getDefaultToolkit().createCustomCursor(walkImage, new Point(7, 8), "Walk"); Toolbar tb = Toolbar.getInstance(); tb.addSeparator(); ! JButton but = tb.registerAction(new SelectAction(glv)); but.setToolTipText("Select"); but = tb.registerAction(new PencilAction(glv)); but.setToolTipText("Pencil"); but = tb.registerAction(new MoveAction(glv)); but.setToolTipText("Move"); but = tb.registerAction(new RotationAction(glv)); but.setToolTipText("Rotate"); but = tb.registerAction(new ExtrudeAction(glv)); but.setToolTipText("Extrude"); but = tb.registerAction(new ClipAction(glv)); but.setToolTipText("Clipping"); but = tb.registerAction(new TapeMeasureAction(glv)); but.setToolTipText("Tape Measure"); tb.addSeparator(); but = tb.registerAction(new CameraAction(glv)); but.setToolTipText("Camera rotation"); but = tb.registerAction(new CameraFlyAction(glv)); but.setToolTipText("Fly mode"); but = tb.registerAction(new CameraWalkAction(glv)); but.setToolTipText("Walk mode"); --- 94,132 ---- Toolkit.getDefaultToolkit().createCustomCursor(walkImage, new Point(7, 8), "Walk"); + ButtonGroup bg = new ButtonGroup(); Toolbar tb = Toolbar.getInstance(); tb.addSeparator(); ! JToggleButton but = tb.registerAction(new SelectAction(glv)); ! bg.add(but); but.setToolTipText("Select"); but = tb.registerAction(new PencilAction(glv)); + bg.add(but); but.setToolTipText("Pencil"); but = tb.registerAction(new MoveAction(glv)); + bg.add(but); but.setToolTipText("Move"); but = tb.registerAction(new RotationAction(glv)); but.setToolTipText("Rotate"); but = tb.registerAction(new ExtrudeAction(glv)); + bg.add(but); but.setToolTipText("Extrude"); but = tb.registerAction(new ClipAction(glv)); + bg.add(but); but.setToolTipText("Clipping"); but = tb.registerAction(new TapeMeasureAction(glv)); + bg.add(but); but.setToolTipText("Tape Measure"); tb.addSeparator(); + but = tb.registerAction(new RotationAction(glv)); + bg.add(but); + but.setToolTipText("Rotation"); but = tb.registerAction(new CameraAction(glv)); + bg.add(but); but.setToolTipText("Camera rotation"); but = tb.registerAction(new CameraFlyAction(glv)); + bg.add(but); but.setToolTipText("Fly mode"); but = tb.registerAction(new CameraWalkAction(glv)); + bg.add(but); but.setToolTipText("Walk mode"); *************** *** 188,191 **** --- 202,206 ---- } else if (i == Tool.TAPE_MEASURE_TOOL) { currentTool = tapeMeasure; + return tapeMeasure; } else { log.error("[get] No such tool " + i); *************** *** 419,423 **** Image image = Toolkit.getDefaultToolkit().getImage(url); cursor = Toolkit.getDefaultToolkit().createCustomCursor(image, new Point(0, 0), "Pencil"); - } --- 434,437 ---- |
From: Nordholt <nor...@us...> - 2006-01-30 11:33:10
|
Update of /cvsroot/bprocessor/gl/src/net/sourceforge/bprocessor/gl/tool In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv13746 Modified Files: AbstractTool.java Log Message: changed way to get corner constructors Index: AbstractTool.java =================================================================== RCS file: /cvsroot/bprocessor/gl/src/net/sourceforge/bprocessor/gl/tool/AbstractTool.java,v retrieving revision 1.56 retrieving revision 1.57 diff -C2 -d -r1.56 -r1.57 *** AbstractTool.java 27 Jan 2006 11:42:47 -0000 1.56 --- AbstractTool.java 30 Jan 2006 11:32:52 -0000 1.57 *************** *** 429,446 **** protected Set makeXYZConerConstructors(Vertex v) { if (v != null) { Edge x = new Edge(xAxis.getFrom().add(v), xAxis.getTo().add(v)); ! x.getFrom().move(50, 0, 0); ! x.getTo().move(50, 0, 0); x.setConstructor(true); Edge y = new Edge(yAxis.getFrom().add(v), yAxis.getTo().add(v)); ! y.getFrom().move(0, 50, 0); ! y.getTo().move(0, 50, 0); y.setConstructor(true); Edge z = new Edge(zAxis.getFrom().add(v), zAxis.getTo().add(v)); ! z.getFrom().move(0, 0, 50); ! z.getTo().move(0, 0, 50); z.setConstructor(true); Set constructors = new HashSet(); --- 429,470 ---- protected Set makeXYZConerConstructors(Vertex v) { if (v != null) { + Vertex xDir = new Vertex(1, 0, 0); + Vertex yDir = new Vertex(0, 1, 0); + Vertex zDir = new Vertex(0, 0, 1); + double[] center = glv.getView().getCamera().getCenter(); + double[] camera = glv.getView().getCamera().getCamera(); + Vertex cameraDir = new Vertex(center[0] - camera[0], + center[1] - camera[1], + center[2] - camera[2]); + Edge x = new Edge(xAxis.getFrom().add(v), xAxis.getTo().add(v)); ! if (cameraDir.dot(xDir) > 0) { ! x.getFrom().move(-50, 0, 0); ! x.getTo().move(-50, 0, 0); ! } else { ! x.getFrom().move(50, 0, 0); ! x.getTo().move(50, 0, 0); ! } x.setConstructor(true); Edge y = new Edge(yAxis.getFrom().add(v), yAxis.getTo().add(v)); ! if (cameraDir.dot(yDir) > 0) { ! y.getFrom().move(0, -50, 0); ! y.getTo().move(0, -50, 0); ! } else { ! y.getFrom().move(0, 50, 0); ! y.getTo().move(0, 50, 0); ! } y.setConstructor(true); Edge z = new Edge(zAxis.getFrom().add(v), zAxis.getTo().add(v)); ! if (cameraDir.dot(zDir) > 0) { ! z.getFrom().move(0, 0, -50); ! z.getTo().move(0, 0, -50); ! } else { ! z.getFrom().move(0, 0, 50); ! z.getTo().move(0, 0, 50); ! } z.setConstructor(true); Set constructors = new HashSet(); |
From: Nordholt <nor...@us...> - 2006-01-30 11:31:53
|
Update of /cvsroot/bprocessor/gl/src/net/sourceforge/bprocessor/gl/tool In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv12993 Modified Files: MoveTool.java Log Message: changed way free move mode to work at more angels Index: MoveTool.java =================================================================== RCS file: /cvsroot/bprocessor/gl/src/net/sourceforge/bprocessor/gl/tool/MoveTool.java,v retrieving revision 1.28 retrieving revision 1.29 diff -C2 -d -r1.28 -r1.29 *** MoveTool.java 25 Jan 2006 14:45:25 -0000 1.28 --- MoveTool.java 30 Jan 2006 11:31:43 -0000 1.29 *************** *** 202,219 **** int y = e.getY(); Vertex parentPos = glv.getView().toPlaneCoords(new double[] {x, y}, dragPlane); ! Vertex delta = parentPos.minus(from); ! //Restricting movement to fit movement mode. ! delta = restrict(delta); ! if (log.isDebugEnabled()) { ! log.debug("from " + from.getX() + ", " + from.getY() + ", " + from.getZ()); ! log.debug("delta " + delta.getX() + ", " + delta.getY() + ", " + delta.getZ()); ! } ! delta = snapToInitial(delta); ! move(vertices, delta); ! from.move(delta.getX(), delta.getY(), delta.getZ()); ! glv.setLength(from.minus(initial).length()); ! update(); } } --- 202,223 ---- int y = e.getY(); Vertex parentPos = glv.getView().toPlaneCoords(new double[] {x, y}, dragPlane); ! if (parentPos != null) { ! Vertex delta = parentPos.minus(from); ! //Restricting movement to fit movement mode. ! delta = restrict(delta); ! if (log.isDebugEnabled()) { ! log.debug("from " + from.getX() + ", " + from.getY() + ", " + from.getZ()); ! log.debug("delta " + delta.getX() + ", " + delta.getY() + ", " + delta.getZ()); ! } ! delta = snapToInitial(delta); ! move(vertices, delta); ! from.move(delta.getX(), delta.getY(), delta.getZ()); ! glv.setLength(from.minus(initial).length()); ! update(); ! } else { ! log.warn("could not hit the dragplane"); ! } } } *************** *** 265,269 **** private void findRestrictions(MouseEvent e) { if (moveMode == AXIS_RESTRICTED) { ! if (restrictionVector == null) { boolean found = findRestrictionVector(e); if (found) { --- 269,273 ---- private void findRestrictions(MouseEvent e) { if (moveMode == AXIS_RESTRICTED) { ! if (restrictionVector == null && moveConstructors != null) { boolean found = findRestrictionVector(e); if (found) { *************** *** 272,316 **** } } else if (moveMode == FREE_SNAP) { ! if (dragPlane == null) { ! Vertex upper = new Vertex(0, 0, 50); ! upper = upper.add(initial); ! Vertex upperX = new Vertex(50, 0, 50); ! upperX = upperX.add(initial); ! Vertex upperY = new Vertex(0, 50, 50); ! upperY = upperY.add(initial); ! Vertex lowerX = new Vertex(50, 0, 0); ! lowerX = lowerX.add(initial); ! Vertex lowerY = new Vertex(0, 50, 0); ! lowerY = lowerY.add(initial); ! Vertex lowerXY = new Vertex(50, 50, 0); ! lowerXY = lowerXY.add(initial); ! ! List xzEdges = new LinkedList(); ! xzEdges.add(new Edge(initial, upper)); ! xzEdges.add(new Edge(upper, upperX)); ! xzEdges.add(new Edge(upperX, lowerX)); ! xzEdges.add(new Edge(lowerX, initial)); ! List yzEdges = new LinkedList(); ! yzEdges.add(new Edge(initial, upper)); ! yzEdges.add(new Edge(upper, upperY)); ! yzEdges.add(new Edge(upperY, lowerY)); ! yzEdges.add(new Edge(lowerY, initial)); ! List xyEdges = new LinkedList(); ! xyEdges.add(new Edge(initial, lowerX)); ! xyEdges.add(new Edge(lowerX, lowerXY)); ! xyEdges.add(new Edge(lowerXY, lowerY)); ! xyEdges.add(new Edge(lowerY, initial)); ! ! Surface xzSurface = new Surface(xzEdges); ! Surface yzSurface = new Surface(yzEdges); ! Surface xySurface = new Surface(xyEdges); ! glv.getView().addTempSurface(xzSurface); ! glv.getView().addTempSurface(yzSurface); ! glv.getView().addTempSurface(xySurface); List objects = glv.getView().getObjectAtPoint(e.getX(), e.getY()); - Iterator it = objects.iterator(); while (it.hasNext()) { --- 276,294 ---- } } else if (moveMode == FREE_SNAP) { ! if (dragPlane == null && moveConstructors != null) { ! Iterator iter = moveConstructors.iterator(); ! Edge firstConst = (Edge)iter.next(); ! Edge secondConst = (Edge)iter.next(); ! Edge thirdConst = (Edge)iter.next(); ! Surface hitSurface1 = spannedSurface(firstConst, secondConst); ! Surface hitSurface2 = spannedSurface(firstConst, thirdConst); ! Surface hitSurface3 = spannedSurface(secondConst, thirdConst); + glv.getView().addTempSurface(hitSurface1); + glv.getView().addTempSurface(hitSurface2); + glv.getView().addTempSurface(hitSurface3); List objects = glv.getView().getObjectAtPoint(e.getX(), e.getY()); Iterator it = objects.iterator(); while (it.hasNext()) { *************** *** 318,324 **** if (ob instanceof Surface) { Surface surface = (Surface)ob; ! if (surface.equals(xzSurface) || ! surface.equals(yzSurface) || ! surface.equals(xySurface)) { dragPlane = surface.plane(); restrictionVector = new Vertex(0, 0, 0); --- 296,302 ---- if (ob instanceof Surface) { Surface surface = (Surface)ob; ! if (surface.equals(hitSurface1) || ! surface.equals(hitSurface2) || ! surface.equals(hitSurface3)) { dragPlane = surface.plane(); restrictionVector = new Vertex(0, 0, 0); *************** *** 326,337 **** } } ! glv.getView().removeTempSurface(xzSurface); ! glv.getView().removeTempSurface(xySurface); ! glv.getView().removeTempSurface(yzSurface); clearConstructors(moveConstructors); } } } ! /** * Finds the current restriction vector. --- 304,363 ---- } } ! glv.getView().removeTempSurface(hitSurface1); ! glv.getView().removeTempSurface(hitSurface2); ! glv.getView().removeTempSurface(hitSurface3); clearConstructors(moveConstructors); } } } ! ! /** ! * Creates the surface spanned by two edges connected ! * at one point. ! * @param edge1 the first edge. ! * @param edge2 the second edge. ! * @return the surface. ! */ ! private Surface spannedSurface(Edge edge1, Edge edge2) { ! List edges = new LinkedList(); ! ! Vertex to1 = edge1.getTo().copy(); ! Vertex to2 = edge2.getTo().copy(); ! Vertex notConnected1; ! Vertex notConnected2; ! Vertex connected; ! if (Math.abs(to1.getX() - to2.getX()) < 0.0001 && ! Math.abs(to1.getY() - to2.getY()) < 0.0001 && ! Math.abs(to1.getZ() - to2.getZ()) < 0.0001) { ! connected = to1; ! notConnected1 = edge1.getFrom().copy(); ! notConnected2 = edge2.getFrom().copy(); ! } else { ! Vertex from2 = edge2.getFrom().copy(); ! if (Math.abs(to1.getX() - from2.getX()) < 0.0001 && ! Math.abs(to1.getY() - from2.getY()) < 0.0001 && ! Math.abs(to1.getZ() - from2.getZ()) < 0.0001) { ! connected = to1; ! notConnected1 = edge1.getFrom().copy(); ! notConnected2 = to2; ! } else { ! notConnected1 = to1; ! connected = edge1.getFrom().copy(); ! if (Math.abs(connected.getX() - from2.getX()) < 0.0001 && ! Math.abs(connected.getY() - from2.getY()) < 0.0001 && ! Math.abs(connected.getZ() - from2.getZ()) < 0.0001) { ! notConnected2 = to2; ! } else { ! notConnected2 = from2; ! } ! } ! } ! ! edges.add(new Edge(notConnected1, notConnected2)); ! edges.add(new Edge(notConnected2, connected)); ! edges.add(new Edge(connected, notConnected1)); ! return new Surface(edges); ! } ! /** * Finds the current restriction vector. *************** *** 474,477 **** --- 500,504 ---- } move(vertices, delta); + update(); glv.repaint(); } |
From: Nikolaj B. <nbr...@us...> - 2006-01-30 10:08:22
|
Update of /cvsroot/bprocessor/model/src/net/sourceforge/bprocessor/model In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv19275/src/net/sourceforge/bprocessor/model Modified Files: Project.java Log Message: File options now remeber last used path, and a few minor updates Index: Project.java =================================================================== RCS file: /cvsroot/bprocessor/model/src/net/sourceforge/bprocessor/model/Project.java,v retrieving revision 1.29 retrieving revision 1.30 diff -C2 -d -r1.29 -r1.30 *** Project.java 27 Jan 2006 13:17:52 -0000 1.29 --- Project.java 30 Jan 2006 10:08:14 -0000 1.30 *************** *** 51,54 **** --- 51,60 ---- private boolean dirty; + /** The path to the current project */ + private String savePath; + + /** The last used path for for loading and saving */ + private String defaultPath; + /** The current project camera */ private Camera currentCamera; *************** *** 441,443 **** --- 447,481 ---- return currentCamera; } + + /** + * Gets the current save path + * @return The current save path + */ + public String getSavePath() { + return savePath; + } + + /** + * Sets the current save path + * @param savePath the path to the current project + */ + public void setSavePath(String savePath) { + this.savePath = savePath; + } + + /** + * Gets the last used path + * @return The default path + */ + public String getDefaultPath() { + return defaultPath; + } + + /** + * Sets the last used path + * @param defaultPath the path that was last used + */ + public void setDefaultPath(String defaultPath) { + this.defaultPath = defaultPath; + } } |
From: Nikolaj B. <nbr...@us...> - 2006-01-30 10:07:58
|
Update of /cvsroot/bprocessor/gui/src/net/sourceforge/bprocessor/gui/actions In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv19053/src/net/sourceforge/bprocessor/gui/actions Modified Files: FileSaveActionListener.java FileNewActionListener.java FileLoadActionListener.java FileCloseActionListener.java Added Files: FileSaveAsActionListener.java Log Message: File options now remeber last used path, and a few minor updates Index: FileSaveActionListener.java =================================================================== RCS file: /cvsroot/bprocessor/gui/src/net/sourceforge/bprocessor/gui/actions/FileSaveActionListener.java,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** FileSaveActionListener.java 25 Jan 2006 11:01:14 -0000 1.2 --- FileSaveActionListener.java 30 Jan 2006 10:07:42 -0000 1.3 *************** *** 36,52 **** */ public void actionPerformed(ActionEvent e) { ! JFileChooser chooser = new JFileChooser(); ! int state = chooser.showSaveDialog(null); ! File file = chooser.getSelectedFile(); ! ! if (file != null && ! state == JFileChooser.APPROVE_OPTION) { try { ! PersistenceManager.save(file); Project.getInstance().makeClean(); } catch (Exception ex) { ! log.error("Could not export to file: " + file, ex); } } } } --- 36,66 ---- */ public void actionPerformed(ActionEvent e) { ! ! if (Project.getInstance().getSavePath() == null) { ! JFileChooser chooser = new JFileChooser(Project.getInstance().getDefaultPath()); ! int state = chooser.showSaveDialog(null); ! File file = chooser.getSelectedFile(); ! ! if (file != null && ! state == JFileChooser.APPROVE_OPTION) { ! try { ! PersistenceManager.save(file); ! Project.getInstance().setSavePath(file.getAbsolutePath()); ! Project.getInstance().setDefaultPath(file.getAbsolutePath()); ! Project.getInstance().makeClean(); ! } catch (Exception ex) { ! log.error("Could not export to file: " + file, ex); ! } ! } ! } else { try { ! PersistenceManager.save(new File(Project.getInstance().getSavePath())); Project.getInstance().makeClean(); } catch (Exception ex) { ! log.error("Could not export to file: " + ! new File(Project.getInstance().getSavePath()), ex); } } } } + Index: FileLoadActionListener.java =================================================================== RCS file: /cvsroot/bprocessor/gui/src/net/sourceforge/bprocessor/gui/actions/FileLoadActionListener.java,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** FileLoadActionListener.java 25 Jan 2006 11:01:14 -0000 1.2 --- FileLoadActionListener.java 30 Jan 2006 10:07:42 -0000 1.3 *************** *** 46,64 **** JOptionPane.YES_NO_CANCEL_OPTION); if (n == 0) { ! JFileChooser chooser = new JFileChooser(); int state = chooser.showSaveDialog(null); File file = chooser.getSelectedFile(); if (file != null && state == JFileChooser.APPROVE_OPTION) { try { PersistenceManager.save(file); ! JFileChooser loadChooser = new JFileChooser(); int lstate = loadChooser.showOpenDialog(null); File lfile = loadChooser.getSelectedFile(); - if (lfile != null && lstate == JFileChooser.APPROVE_OPTION) { try { Selection.primary().clear(); Project.getInstance().clear(); --- 46,67 ---- JOptionPane.YES_NO_CANCEL_OPTION); if (n == 0) { ! JFileChooser chooser = new JFileChooser(Project.getInstance().getDefaultPath()); int state = chooser.showSaveDialog(null); File file = chooser.getSelectedFile(); + if (file != null && state == JFileChooser.APPROVE_OPTION) { try { + Project.getInstance().setDefaultPath(file.getAbsolutePath()); PersistenceManager.save(file); ! JFileChooser loadChooser = new JFileChooser(Project.getInstance().getDefaultPath()); int lstate = loadChooser.showOpenDialog(null); File lfile = loadChooser.getSelectedFile(); if (lfile != null && lstate == JFileChooser.APPROVE_OPTION) { try { + Project.getInstance().setSavePath(lfile.getAbsolutePath()); + Project.getInstance().setDefaultPath(lfile.getAbsolutePath()); Selection.primary().clear(); Project.getInstance().clear(); *************** *** 76,86 **** if (n == 1) { ! JFileChooser loadChooser = new JFileChooser(); int lstate = loadChooser.showOpenDialog(null); File lfile = loadChooser.getSelectedFile(); - if (lfile != null && lstate == JFileChooser.APPROVE_OPTION) { try { Selection.primary().clear(); Project.getInstance().clear(); --- 79,90 ---- if (n == 1) { ! JFileChooser loadChooser = new JFileChooser(Project.getInstance().getDefaultPath()); int lstate = loadChooser.showOpenDialog(null); File lfile = loadChooser.getSelectedFile(); if (lfile != null && lstate == JFileChooser.APPROVE_OPTION) { try { + Project.getInstance().setSavePath(lfile.getAbsolutePath()); + Project.getInstance().setDefaultPath(lfile.getAbsolutePath()); Selection.primary().clear(); Project.getInstance().clear(); *************** *** 92,105 **** } } } else { ! JFileChooser loadChooser = new JFileChooser(); int lstate = loadChooser.showOpenDialog(null); File lfile = loadChooser.getSelectedFile(); - if (lfile != null && lstate == JFileChooser.APPROVE_OPTION) { try { Selection.primary().clear(); Project.getInstance().clear(); --- 96,111 ---- } } + } else { ! JFileChooser loadChooser = new JFileChooser(Project.getInstance().getDefaultPath()); int lstate = loadChooser.showOpenDialog(null); File lfile = loadChooser.getSelectedFile(); if (lfile != null && lstate == JFileChooser.APPROVE_OPTION) { try { + Project.getInstance().setSavePath(lfile.getAbsolutePath()); + Project.getInstance().setDefaultPath(lfile.getAbsolutePath()); Selection.primary().clear(); Project.getInstance().clear(); --- NEW FILE: FileSaveAsActionListener.java --- //--------------------------------------------------------------------------------- // $Id: FileSaveAsActionListener.java,v 1.1 2006/01/30 10:07:42 nbramsen Exp $ // // Copyright (c) 2005 The BProcessor Team (http://bprocessor.sourceforge.net) // Released under the Lesser GNU Public License v2.1 //--------------------------------------------------------------------------------- package net.sourceforge.bprocessor.gui.actions; import net.sourceforge.bprocessor.model.Project; import net.sourceforge.bprocessor.model.xml.PersistenceManager; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import java.io.File; import javax.swing.JFileChooser; import org.apache.log4j.Logger; /** * The file->save as action listener */ public class FileSaveAsActionListener implements ActionListener { /** The logger */ private static Logger log = Logger.getLogger(FileSaveAsActionListener.class); /** * FileSavAseActionListener */ public FileSaveAsActionListener() { } /** * Action performed * @param e The action event */ public void actionPerformed(ActionEvent e) { JFileChooser chooser = new JFileChooser(Project.getInstance().getDefaultPath()); int state = chooser.showSaveDialog(null); File file = chooser.getSelectedFile(); if (file != null && state == JFileChooser.APPROVE_OPTION) { try { Project.getInstance().setDefaultPath(file.getAbsolutePath()); Project.getInstance().setSavePath(file.getAbsolutePath()); PersistenceManager.save(file); Project.getInstance().makeClean(); } catch (Exception ex) { log.error("Could not export to file: " + file, ex); } } } } Index: FileNewActionListener.java =================================================================== RCS file: /cvsroot/bprocessor/gui/src/net/sourceforge/bprocessor/gui/actions/FileNewActionListener.java,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** FileNewActionListener.java 25 Jan 2006 11:01:14 -0000 1.3 --- FileNewActionListener.java 30 Jan 2006 10:07:42 -0000 1.4 *************** *** 42,45 **** --- 42,46 ---- */ public void actionPerformed(ActionEvent event) { + Project.getInstance().setSavePath(null); if (Project.getInstance().isDirty()) { int n = JOptionPane.showConfirmDialog( *************** *** 49,53 **** JOptionPane.YES_NO_CANCEL_OPTION); if (n == 0) { ! JFileChooser chooser = new JFileChooser(); int state = chooser.showSaveDialog(null); File file = chooser.getSelectedFile(); --- 50,54 ---- JOptionPane.YES_NO_CANCEL_OPTION); if (n == 0) { ! JFileChooser chooser = new JFileChooser(Project.getInstance().getDefaultPath()); int state = chooser.showSaveDialog(null); File file = chooser.getSelectedFile(); *************** *** 56,59 **** --- 57,61 ---- try { PersistenceManager.save(file); + Project.getInstance().setDefaultPath(file.getAbsolutePath()); Selection.primary().clear(); Project.getInstance().clear(); Index: FileCloseActionListener.java =================================================================== RCS file: /cvsroot/bprocessor/gui/src/net/sourceforge/bprocessor/gui/actions/FileCloseActionListener.java,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** FileCloseActionListener.java 25 Jan 2006 11:01:14 -0000 1.1 --- FileCloseActionListener.java 30 Jan 2006 10:07:42 -0000 1.2 *************** *** 42,46 **** */ public void actionPerformed(ActionEvent event) { ! if (Project.getInstance().isDirty()) { int n = JOptionPane.showConfirmDialog( --- 42,46 ---- */ public void actionPerformed(ActionEvent event) { ! Project.getInstance().setSavePath(null); if (Project.getInstance().isDirty()) { int n = JOptionPane.showConfirmDialog( *************** *** 50,54 **** JOptionPane.YES_NO_CANCEL_OPTION); if (n == 0) { ! JFileChooser chooser = new JFileChooser(); int state = chooser.showSaveDialog(null); File file = chooser.getSelectedFile(); --- 50,54 ---- JOptionPane.YES_NO_CANCEL_OPTION); if (n == 0) { ! JFileChooser chooser = new JFileChooser(Project.getInstance().getDefaultPath()); int state = chooser.showSaveDialog(null); File file = chooser.getSelectedFile(); *************** *** 56,59 **** --- 56,60 ---- state == JFileChooser.APPROVE_OPTION) { try { + Project.getInstance().setDefaultPath(file.getAbsolutePath()); PersistenceManager.save(file); Selection.primary().clear(); |
From: Nikolaj B. <nbr...@us...> - 2006-01-30 10:07:52
|
Update of /cvsroot/bprocessor/gui/src/net/sourceforge/bprocessor/gui In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv19053/src/net/sourceforge/bprocessor/gui Modified Files: GUI.java Log Message: File options now remeber last used path, and a few minor updates Index: GUI.java =================================================================== RCS file: /cvsroot/bprocessor/gui/src/net/sourceforge/bprocessor/gui/GUI.java,v retrieving revision 1.26 retrieving revision 1.27 diff -C2 -d -r1.26 -r1.27 *** GUI.java 27 Jan 2006 10:54:32 -0000 1.26 --- GUI.java 30 Jan 2006 10:07:43 -0000 1.27 *************** *** 21,24 **** --- 21,25 ---- import net.sourceforge.bprocessor.gui.actions.FilePropertiesActionListener; import net.sourceforge.bprocessor.gui.actions.FileSaveActionListener; + import net.sourceforge.bprocessor.gui.actions.FileSaveAsActionListener; import net.sourceforge.bprocessor.gui.actions.ToolsDetachActionListener; import net.sourceforge.bprocessor.gui.actions.ToolsJoinActionListener; *************** *** 125,128 **** --- 126,135 ---- file.add(fileSave); + JMenuItem fileSaveAs = new JMenuItem("Save As"); + fileSaveAs.addActionListener(new FileSaveAsActionListener()); + fileSaveAs.setMnemonic(KeyEvent.VK_A); + fileSaveAs.setEnabled(true); + file.add(fileSaveAs); + JMenuItem fileClose = new JMenuItem("Close"); fileClose.addActionListener(new FileCloseActionListener()); |