bprocessor-commit Mailing List for B-processor (Page 68)
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...> - 2007-04-17 13:04:45
|
Update of /cvsroot/bprocessor/model/src/net/sourceforge/bprocessor/model/modellor In directory sc8-pr-cvs3.sourceforge.net:/tmp/cvs-serv634/src/net/sourceforge/bprocessor/model/modellor Modified Files: TileModellor.java Cylinder.java Modellor.java Log Message: made cylinder and tile modellor able to be saved by persistence by adding material as a type in externalizeModellor Index: TileModellor.java =================================================================== RCS file: /cvsroot/bprocessor/model/src/net/sourceforge/bprocessor/model/modellor/TileModellor.java,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** TileModellor.java 16 Apr 2007 15:54:42 -0000 1.6 --- TileModellor.java 17 Apr 2007 13:04:44 -0000 1.7 *************** *** 54,57 **** --- 54,63 ---- /** + * Needed for persistence + */ + public TileModellor() { + } + + /** * Fill the give space with tiles * @param s The space *************** *** 65,68 **** --- 71,75 ---- startPoint = surface.coordinateSystem(); startPoint.add(new Relation(surface, "0")); + space.add(tileColor); } } *************** *** 85,88 **** --- 92,96 ---- return; } + log.info("Modellor update on " + entity); space.clear(); space.add(startPoint); *************** *** 195,199 **** --- 203,209 ---- a = attributes.get("Material"); if (a != null) { + space.remove(tileColor); tileColor = (Material)a.getValue(); + space.add(tileColor); } a = attributes.get("Surface"); *************** *** 203,208 **** a = attributes.get("Setting height"); if (a != null) { ! surface = (Surface)a.getValue(); } } --- 213,219 ---- a = attributes.get("Setting height"); if (a != null) { ! height = ((Double)a.getValue()).intValue(); } + update(this); } *************** *** 288,290 **** --- 299,306 ---- return "TileModellor"; } + + /** {@inheritDoc} */ + public String getGeneralName() { + return "Tilemodellor"; + } } Index: Cylinder.java =================================================================== RCS file: /cvsroot/bprocessor/model/src/net/sourceforge/bprocessor/model/modellor/Cylinder.java,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** Cylinder.java 16 Apr 2007 15:54:42 -0000 1.2 --- Cylinder.java 17 Apr 2007 13:04:44 -0000 1.3 *************** *** 14,18 **** import net.sourceforge.bprocessor.model.Attribute; import net.sourceforge.bprocessor.model.Edge; - import net.sourceforge.bprocessor.model.Project; import net.sourceforge.bprocessor.model.Space; import net.sourceforge.bprocessor.model.Surface; --- 14,17 ---- *************** *** 36,39 **** --- 35,54 ---- private int axisDivisions = 12; + private Space space = null; + + /** + * Empty constructor for persistence + */ + public Cylinder() { + } + + /** + * Create at cylinder modellor + * @param s the space to put the cylinder in + */ + public Cylinder(Space s) { + this.space = s; + } + /*** * Generate a Cylinder *************** *** 41,44 **** --- 56,64 ---- */ public void update(Object entity) { + if (space == null) { + return; + } + space.clear(); + /** Origin */ Vertex o = new Vertex(0, 0, 0); *************** *** 58,62 **** Surface top; Surface bottom; - Space space = Project.getInstance().world(); for (int i = 0; i < axisDivisions; i++) { --- 78,81 ---- *************** *** 116,124 **** /** ! * FIXME: empty implementation to make compile ! * (pfff make sure stuff compiles before you check in please) */ public void delete() { ! return; } --- 135,142 ---- /** ! * {@inheritDoc} */ public void delete() { ! space = null; } *************** *** 137,140 **** --- 155,159 ---- axisDivisions = ((Double)a.getValue()).intValue(); } + update(this); } *************** *** 148,153 **** /** {@inheritDoc} */ public Modellor newInstance(Space s) { ! // TODO Auto-generated method stub ! return null; } --- 167,171 ---- /** {@inheritDoc} */ public Modellor newInstance(Space s) { ! return new Cylinder(s); } *************** *** 157,167 **** height = ((Double)m.get("Height")).doubleValue(); radius = ((Double)m.get("Radius")).doubleValue(); } /** {@inheritDoc} */ public void getSubContent(Map<String, Object> m) { ! m.put("Axis", new Integer(axisDivisions)); m.put("Height", new Double(height)); m.put("Radius", new Double(radius)); } --- 175,187 ---- height = ((Double)m.get("Height")).doubleValue(); radius = ((Double)m.get("Radius")).doubleValue(); + space = ((Space)m.get("Space")); } /** {@inheritDoc} */ public void getSubContent(Map<String, Object> m) { ! m.put("Axis", Integer.valueOf(axisDivisions)); m.put("Height", new Double(height)); m.put("Radius", new Double(radius)); + m.put("Space", space); } *************** *** 171,173 **** --- 191,203 ---- return Space.PART_LEVEL; } + + /** {@inheritDoc} */ + public String getName() { + return "Cylinder"; + } + + /** {@inheritDoc} */ + public String getGeneralName() { + return "Cylinder modellor"; + } } Index: Modellor.java =================================================================== RCS file: /cvsroot/bprocessor/model/src/net/sourceforge/bprocessor/model/modellor/Modellor.java,v retrieving revision 1.10 retrieving revision 1.11 diff -C2 -d -r1.10 -r1.11 *** Modellor.java 16 Apr 2007 15:54:42 -0000 1.10 --- Modellor.java 17 Apr 2007 13:04:44 -0000 1.11 *************** *** 24,27 **** --- 24,30 ---- * The modellor interface, can generate surfaces from parameters * established at the creation of the Modellor. + * + * Remember a empty constructor for the persistencelayer to use + * remember to override both getName and getGeneralName to get the right printet name */ public abstract class Modellor extends Entity implements Observer, Parametric { *************** *** 41,45 **** /** * Constructor for modellor - * */ public Modellor() { --- 44,47 ---- |
|
From: rimestad <rim...@us...> - 2007-04-16 15:55:45
|
Update of /cvsroot/bprocessor/model/src/net/sourceforge/bprocessor/model/constraints In directory sc8-pr-cvs3.sourceforge.net:/tmp/cvs-serv15623/src/net/sourceforge/bprocessor/model/constraints Modified Files: OffsetConstraint.java Log Message: generic get set methods Index: OffsetConstraint.java =================================================================== RCS file: /cvsroot/bprocessor/model/src/net/sourceforge/bprocessor/model/constraints/OffsetConstraint.java,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** OffsetConstraint.java 30 Oct 2006 10:58:36 -0000 1.6 --- OffsetConstraint.java 16 Apr 2007 15:55:43 -0000 1.7 *************** *** 182,186 **** * @param attributes The attributes */ ! public void setAttributes(List attributes) { Iterator iter = attributes.iterator(); while (iter.hasNext()) { --- 182,186 ---- * @param attributes The attributes */ ! public void setAttributes(List<Attribute> attributes) { Iterator iter = attributes.iterator(); while (iter.hasNext()) { *************** *** 199,204 **** * @return The attributes */ ! public List getAttributes() { ! LinkedList attributes = new LinkedList(); Surface master = (Surface) getMaster(); Surface slave = (Surface) getSlave(); --- 199,204 ---- * @return The attributes */ ! public List<Attribute> getAttributes() { ! LinkedList<Attribute> attributes = new LinkedList<Attribute>(); Surface master = (Surface) getMaster(); Surface slave = (Surface) getSlave(); |
Update of /cvsroot/bprocessor/model/src/net/sourceforge/bprocessor/model In directory sc8-pr-cvs3.sourceforge.net:/tmp/cvs-serv15574/src/net/sourceforge/bprocessor/model Modified Files: Line.java Rotate.java AxisRotate.java Project.java Relation.java CoordinateSystem.java Classification.java Edge.java Vertex.java Material.java ClippingPlane.java Surface.java TransformStack.java Translate.java Camera.java Space.java Scale.java IDTransform.java Point.java Attribute.java Log Message: made get and set attributes generic Index: Edge.java =================================================================== RCS file: /cvsroot/bprocessor/model/src/net/sourceforge/bprocessor/model/Edge.java,v retrieving revision 1.84 retrieving revision 1.85 diff -C2 -d -r1.84 -r1.85 *** Edge.java 15 Apr 2007 10:43:40 -0000 1.84 --- Edge.java 16 Apr 2007 15:55:22 -0000 1.85 *************** *** 596,603 **** * @param attributes The attributes to set */ ! public void setAttributes(List attributes) { ! Iterator iter = attributes.iterator(); ! while (iter.hasNext()) { ! Attribute a = (Attribute)iter.next(); if (a.getName().equals("Name")) { continue; --- 596,601 ---- * @param attributes The attributes to set */ ! public void setAttributes(List<Attribute> attributes) { ! for (Attribute a : attributes) { if (a.getName().equals("Name")) { continue; *************** *** 612,617 **** * @return the list of attributes for the object */ ! public List getAttributes() { ! ArrayList res = new ArrayList(); res.add(new Attribute("Name", getName(), false)); res.add(new Attribute("Owner", getOwner(), false)); --- 610,615 ---- * @return the list of attributes for the object */ ! public List<Attribute> getAttributes() { ! ArrayList<Attribute> res = new ArrayList<Attribute>(); res.add(new Attribute("Name", getName(), false)); res.add(new Attribute("Owner", getOwner(), false)); Index: Rotate.java =================================================================== RCS file: /cvsroot/bprocessor/model/src/net/sourceforge/bprocessor/model/Rotate.java,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** Rotate.java 28 Nov 2006 10:06:34 -0000 1.3 --- Rotate.java 16 Apr 2007 15:55:22 -0000 1.4 *************** *** 9,13 **** import java.util.ArrayList; - import java.util.Iterator; import java.util.List; --- 9,12 ---- *************** *** 95,102 **** * @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()); --- 94,99 ---- * @param attributes List */ ! public void setAttributes(List<Attribute> attributes) { ! for (Attribute a : attributes) { if (a.getName().equals("Rotate X")) { rx(((Double)a.getValue()).doubleValue()); *************** *** 115,120 **** * @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()))); --- 112,117 ---- * @return List */ ! public List<Attribute> getAttributes() { ! ArrayList<Attribute> res = new ArrayList<Attribute>(); res.add(new Attribute("Rotate X", new Double(rx()))); res.add(new Attribute("Rotate Y", new Double(ry()))); Index: CoordinateSystem.java =================================================================== RCS file: /cvsroot/bprocessor/model/src/net/sourceforge/bprocessor/model/CoordinateSystem.java,v retrieving revision 1.49 retrieving revision 1.50 diff -C2 -d -r1.49 -r1.50 *** CoordinateSystem.java 11 Apr 2007 12:19:41 -0000 1.49 --- CoordinateSystem.java 16 Apr 2007 15:55:22 -0000 1.50 *************** *** 502,506 **** /** {@inheritDoc} */ ! public void setAttributes(List attributes) { Vertex orig = new Vertex(0, 0, 0); orig.setX(((Double)(((Attribute)attributes.get(1)).getValue())).doubleValue()); --- 502,506 ---- /** {@inheritDoc} */ ! public void setAttributes(List<Attribute> attributes) { Vertex orig = new Vertex(0, 0, 0); orig.setX(((Double)(((Attribute)attributes.get(1)).getValue())).doubleValue()); *************** *** 540,545 **** /** {@inheritDoc} */ ! public List getAttributes() { ! ArrayList res = new ArrayList(); res.add(new Attribute("Origin", "", false)); res.add(new Attribute("x", new Double(getOrigin().getX()))); --- 540,545 ---- /** {@inheritDoc} */ ! public List<Attribute> getAttributes() { ! ArrayList<Attribute> res = new ArrayList<Attribute>(); res.add(new Attribute("Origin", "", false)); res.add(new Attribute("x", new Double(getOrigin().getX()))); Index: Classification.java =================================================================== RCS file: /cvsroot/bprocessor/model/src/net/sourceforge/bprocessor/model/Classification.java,v retrieving revision 1.11 retrieving revision 1.12 diff -C2 -d -r1.11 -r1.12 *** Classification.java 11 Apr 2007 12:13:20 -0000 1.11 --- Classification.java 16 Apr 2007 15:55:22 -0000 1.12 *************** *** 247,252 **** * @return the list of attributes for the object */ ! public List getAttributes() { ! ArrayList res = new ArrayList(); res.add(new Attribute("Name", getName(), false)); res.add(new Attribute("Code", getFullId(null), false)); --- 247,252 ---- * @return the list of attributes for the object */ ! public List<Attribute> getAttributes() { ! ArrayList<Attribute> res = new ArrayList<Attribute>(); res.add(new Attribute("Name", getName(), false)); res.add(new Attribute("Code", getFullId(null), false)); *************** *** 269,273 **** * @param attributes The attributes to set */ ! public void setAttributes(List attributes) { Iterator iter = attributes.iterator(); while (iter.hasNext()) { --- 269,273 ---- * @param attributes The attributes to set */ ! public void setAttributes(List<Attribute> attributes) { Iterator iter = attributes.iterator(); while (iter.hasNext()) { Index: Translate.java =================================================================== RCS file: /cvsroot/bprocessor/model/src/net/sourceforge/bprocessor/model/Translate.java,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** Translate.java 28 Nov 2006 10:06:34 -0000 1.3 --- Translate.java 16 Apr 2007 15:55:22 -0000 1.4 *************** *** 9,13 **** import java.util.ArrayList; - import java.util.Iterator; import java.util.List; --- 9,12 ---- *************** *** 96,103 **** * @param attributes List */ ! public void setAttributes(List attributes) { ! Iterator iter = attributes.iterator(); ! while (iter.hasNext()) { ! Attribute a = (Attribute)iter.next(); if (a.getName().equals("Translate X")) { tx(((Double)a.getValue()).doubleValue()); --- 95,100 ---- * @param attributes List */ ! public void setAttributes(List<Attribute> attributes) { ! for (Attribute a : attributes) { if (a.getName().equals("Translate X")) { tx(((Double)a.getValue()).doubleValue()); Index: Camera.java =================================================================== RCS file: /cvsroot/bprocessor/model/src/net/sourceforge/bprocessor/model/Camera.java,v retrieving revision 1.39 retrieving revision 1.40 diff -C2 -d -r1.39 -r1.40 *** Camera.java 6 Mar 2007 14:11:35 -0000 1.39 --- Camera.java 16 Apr 2007 15:55:22 -0000 1.40 *************** *** 545,549 **** * @param attributes The attributes to set */ ! public void setAttributes(List attributes) { Iterator iter = attributes.iterator(); while (iter.hasNext()) { --- 545,549 ---- * @param attributes The attributes to set */ ! public void setAttributes(List<Attribute> attributes) { Iterator iter = attributes.iterator(); while (iter.hasNext()) { *************** *** 585,589 **** * @return the list of attributes for the object */ ! public List getAttributes() { ArrayList<Attribute> res = new ArrayList<Attribute>(); res.add(new Attribute("Name", getName())); --- 585,589 ---- * @return the list of attributes for the object */ ! public List<Attribute> getAttributes() { ArrayList<Attribute> res = new ArrayList<Attribute>(); res.add(new Attribute("Name", getName())); Index: Surface.java =================================================================== RCS file: /cvsroot/bprocessor/model/src/net/sourceforge/bprocessor/model/Surface.java,v retrieving revision 1.156 retrieving revision 1.157 diff -C2 -d -r1.156 -r1.157 *** Surface.java 15 Apr 2007 10:45:21 -0000 1.156 --- Surface.java 16 Apr 2007 15:55:22 -0000 1.157 *************** *** 1694,1701 **** * @param attributes The attributes to set */ ! public void setAttributes(List attributes) { ! Iterator iter = attributes.iterator(); ! while (iter.hasNext()) { ! Attribute a = (Attribute)iter.next(); if (a.getName().equals("Name")) { continue; --- 1694,1699 ---- * @param attributes The attributes to set */ ! public void setAttributes(List<Attribute> attributes) { ! for (Attribute a : attributes) { if (a.getName().equals("Name")) { continue; *************** *** 1737,1742 **** * @return the list of attributes for the object */ ! public List getAttributes() { ! ArrayList res = new ArrayList(); res.add(new Attribute("Name", getName(), false)); if (getOwner() == Project.getInstance().world()) { --- 1735,1740 ---- * @return the list of attributes for the object */ ! public List<Attribute> getAttributes() { ! ArrayList<Attribute> res = new ArrayList<Attribute>(); res.add(new Attribute("Name", getName(), false)); if (getOwner() == Project.getInstance().world()) { Index: Material.java =================================================================== RCS file: /cvsroot/bprocessor/model/src/net/sourceforge/bprocessor/model/Material.java,v retrieving revision 1.8 retrieving revision 1.9 diff -C2 -d -r1.8 -r1.9 *** Material.java 15 May 2006 09:20:46 -0000 1.8 --- Material.java 16 Apr 2007 15:55:22 -0000 1.9 *************** *** 7,10 **** --- 7,12 ---- package net.sourceforge.bprocessor.model; + import java.io.Serializable; + /** * The Material of a Surface *************** *** 15,19 **** * usage="read-write" */ ! public class Material { /** The name of the material */ --- 17,21 ---- * usage="read-write" */ ! public class Material implements Serializable { /** The name of the material */ *************** *** 30,33 **** --- 32,36 ---- */ public Material() { + setColor(0, 0, 0); } *************** *** 39,43 **** public Material(String name, float[] color3fv) { setName(name); ! setColor(color3fv); } --- 42,50 ---- public Material(String name, float[] color3fv) { setName(name); ! if (color3fv != null) { ! setColor(color3fv); ! } else { ! setColor(0, 0, 0); ! } } *************** *** 84,88 **** */ public void setColor(float[] color3fv) { ! this.color = color3fv; } --- 91,112 ---- */ public void setColor(float[] color3fv) { ! if (color3fv.length >= 3) { ! setColor(color3fv[0], color3fv[1], color3fv[2]); ! } ! } ! ! /** ! * Set the color array to the given floats ! * @param r the red component ! * @param g the green component ! * @param b the blue component ! */ ! public void setColor(float r, float g, float b) { ! if (this.color == null) { ! this.color = new float[3]; ! } ! this.color[0] = r; ! this.color[1] = g; ! this.color[2] = b; } *************** *** 93,97 **** */ public float[] getColor() { ! return color; } } --- 117,121 ---- */ public float[] getColor() { ! return (float[]) color.clone(); } } Index: ClippingPlane.java =================================================================== RCS file: /cvsroot/bprocessor/model/src/net/sourceforge/bprocessor/model/ClippingPlane.java,v retrieving revision 1.18 retrieving revision 1.19 diff -C2 -d -r1.18 -r1.19 *** ClippingPlane.java 19 Feb 2007 15:50:14 -0000 1.18 --- ClippingPlane.java 16 Apr 2007 15:55:22 -0000 1.19 *************** *** 331,336 **** /** {@inheritDoc} */ ! public List getAttributes() { ! ArrayList res = new ArrayList(); if (isActive()) { res.add(new Attribute("isActive", Boolean.TRUE)); --- 331,336 ---- /** {@inheritDoc} */ ! public List<Attribute> getAttributes() { ! ArrayList<Attribute> res = new ArrayList<Attribute>(); if (isActive()) { res.add(new Attribute("isActive", Boolean.TRUE)); *************** *** 360,364 **** /** {@inheritDoc} */ ! public void setAttributes(List attributes) { Iterator iter = attributes.iterator(); while (iter.hasNext()) { --- 360,364 ---- /** {@inheritDoc} */ ! public void setAttributes(List<Attribute> attributes) { Iterator iter = attributes.iterator(); while (iter.hasNext()) { Index: Point.java =================================================================== RCS file: /cvsroot/bprocessor/model/src/net/sourceforge/bprocessor/model/Point.java,v retrieving revision 1.15 retrieving revision 1.16 diff -C2 -d -r1.15 -r1.16 *** Point.java 13 Mar 2007 15:21:24 -0000 1.15 --- Point.java 16 Apr 2007 15:55:22 -0000 1.16 *************** *** 45,49 **** /** {@inheritDoc} */ ! public void setAttributes(List attributes) { Vertex orig = getOrigin(); orig.setX(((Double)(((Attribute)attributes.get(0)).getValue())).doubleValue()); --- 45,49 ---- /** {@inheritDoc} */ ! public void setAttributes(List<Attribute> attributes) { Vertex orig = getOrigin(); orig.setX(((Double)(((Attribute)attributes.get(0)).getValue())).doubleValue()); *************** *** 53,58 **** /** {@inheritDoc} */ ! public List getAttributes() { ! ArrayList res = new ArrayList(); res.add(new Attribute("X", new Double(getOrigin().getX()))); res.add(new Attribute("Y", new Double(getOrigin().getY()))); --- 53,58 ---- /** {@inheritDoc} */ ! public List<Attribute> getAttributes() { ! ArrayList<Attribute> res = new ArrayList<Attribute>(); res.add(new Attribute("X", new Double(getOrigin().getX()))); res.add(new Attribute("Y", new Double(getOrigin().getY()))); Index: Project.java =================================================================== RCS file: /cvsroot/bprocessor/model/src/net/sourceforge/bprocessor/model/Project.java,v retrieving revision 1.118 retrieving revision 1.119 diff -C2 -d -r1.118 -r1.119 *** Project.java 14 Apr 2007 15:00:47 -0000 1.118 --- Project.java 16 Apr 2007 15:55:22 -0000 1.119 *************** *** 770,774 **** * @param attributes The attributes to set */ ! public void setAttributes(List attributes) { Iterator iter = attributes.iterator(); while (iter.hasNext()) { --- 770,774 ---- * @param attributes The attributes to set */ ! public void setAttributes(List<Attribute> attributes) { Iterator iter = attributes.iterator(); while (iter.hasNext()) { *************** *** 787,792 **** * @return the list of attributes for the object */ ! public List getAttributes() { ! ArrayList res = new ArrayList(); res.add(new Attribute("Name", getName())); //res.add(new Attribute("Energyloss", new Double(EnergyCalc.energyLoss()), false)); --- 787,792 ---- * @return the list of attributes for the object */ ! public List<Attribute> getAttributes() { ! ArrayList<Attribute> res = new ArrayList<Attribute>(); res.add(new Attribute("Name", getName())); //res.add(new Attribute("Energyloss", new Double(EnergyCalc.energyLoss()), false)); Index: Attribute.java =================================================================== RCS file: /cvsroot/bprocessor/model/src/net/sourceforge/bprocessor/model/Attribute.java,v retrieving revision 1.18 retrieving revision 1.19 diff -C2 -d -r1.18 -r1.19 *** Attribute.java 12 Mar 2007 08:32:47 -0000 1.18 --- Attribute.java 16 Apr 2007 15:55:22 -0000 1.19 *************** *** 182,186 **** * @param attributes List of attribute */ ! public void setAttributes(List attributes) { Iterator iter = attributes.iterator(); while (iter.hasNext()) { --- 182,186 ---- * @param attributes List of attribute */ ! public void setAttributes(List<Attribute> attributes) { Iterator iter = attributes.iterator(); while (iter.hasNext()) { *************** *** 205,210 **** * @return List of attributes */ ! public List getAttributes() { ! List attributes = new LinkedList(); attributes.add(new Attribute("Name", name)); attributes.add(new Attribute("Value", value)); --- 205,210 ---- * @return List of attributes */ ! public List<Attribute> getAttributes() { ! List<Attribute> attributes = new LinkedList<Attribute>(); attributes.add(new Attribute("Name", name)); attributes.add(new Attribute("Value", value)); Index: TransformStack.java =================================================================== RCS file: /cvsroot/bprocessor/model/src/net/sourceforge/bprocessor/model/TransformStack.java,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** TransformStack.java 11 Oct 2006 14:05:16 -0000 1.3 --- TransformStack.java 16 Apr 2007 15:55:22 -0000 1.4 *************** *** 83,87 **** * @param attributes List of attributes */ ! public void setAttributes(List attributes) { } --- 83,87 ---- * @param attributes List of attributes */ ! public void setAttributes(List<Attribute> attributes) { } *************** *** 89,93 **** * @return List of Attributes */ ! public List getAttributes() { return null; } --- 89,93 ---- * @return List of Attributes */ ! public List<Attribute> getAttributes() { return null; } Index: Space.java =================================================================== RCS file: /cvsroot/bprocessor/model/src/net/sourceforge/bprocessor/model/Space.java,v retrieving revision 1.134 retrieving revision 1.135 diff -C2 -d -r1.134 -r1.135 *** Space.java 15 Apr 2007 11:12:04 -0000 1.134 --- Space.java 16 Apr 2007 15:55:22 -0000 1.135 *************** *** 1495,1499 **** * @param attributes The attributes to set */ ! public void setAttributes(List attributes) { Iterator iter = attributes.iterator(); while (iter.hasNext()) { --- 1495,1499 ---- * @param attributes The attributes to set */ ! public void setAttributes(List<Attribute> attributes) { Iterator iter = attributes.iterator(); while (iter.hasNext()) { Index: Line.java =================================================================== RCS file: /cvsroot/bprocessor/model/src/net/sourceforge/bprocessor/model/Line.java,v retrieving revision 1.31 retrieving revision 1.32 diff -C2 -d -r1.31 -r1.32 *** Line.java 13 Mar 2007 15:21:24 -0000 1.31 --- Line.java 16 Apr 2007 15:55:22 -0000 1.32 *************** *** 120,124 **** /** {@inheritDoc} */ ! public void setAttributes(List attributes) { Vertex orig = new Vertex(0, 0, 0); --- 120,124 ---- /** {@inheritDoc} */ ! public void setAttributes(List<Attribute> attributes) { Vertex orig = new Vertex(0, 0, 0); *************** *** 140,145 **** /** {@inheritDoc} */ ! public List getAttributes() { ! ArrayList res = new ArrayList(); res.add(new Attribute("name", "Origin", false)); res.add(new Attribute("X", new Double(getOrigin().getX()))); --- 140,145 ---- /** {@inheritDoc} */ ! public List<Attribute> getAttributes() { ! ArrayList<Attribute> res = new ArrayList<Attribute>(); res.add(new Attribute("name", "Origin", false)); res.add(new Attribute("X", new Double(getOrigin().getX()))); Index: AxisRotate.java =================================================================== RCS file: /cvsroot/bprocessor/model/src/net/sourceforge/bprocessor/model/AxisRotate.java,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** AxisRotate.java 28 Nov 2006 10:06:34 -0000 1.3 --- AxisRotate.java 16 Apr 2007 15:55:22 -0000 1.4 *************** *** 9,13 **** import java.util.ArrayList; - import java.util.Iterator; import java.util.List; --- 9,12 ---- *************** *** 117,124 **** * @param attributes List */ ! public void setAttributes(List attributes) { ! Iterator iter = attributes.iterator(); ! while (iter.hasNext()) { ! Attribute a = (Attribute)iter.next(); if (a.getName().equals("Axis X")) { rx(((Double)a.getValue()).doubleValue()); --- 116,121 ---- * @param attributes List */ ! public void setAttributes(List<Attribute> attributes) { ! for (Attribute a : attributes) { if (a.getName().equals("Axis X")) { rx(((Double)a.getValue()).doubleValue()); *************** *** 139,144 **** * @return List */ ! public List getAttributes() { ! ArrayList res = new ArrayList(); res.add(new Attribute("Axis X", new Double(rx()))); res.add(new Attribute("Axis Y", new Double(ry()))); --- 136,141 ---- * @return List */ ! public List<Attribute> getAttributes() { ! ArrayList<Attribute> res = new ArrayList<Attribute>(); res.add(new Attribute("Axis X", new Double(rx()))); res.add(new Attribute("Axis Y", new Double(ry()))); Index: Vertex.java =================================================================== RCS file: /cvsroot/bprocessor/model/src/net/sourceforge/bprocessor/model/Vertex.java,v retrieving revision 1.58 retrieving revision 1.59 diff -C2 -d -r1.58 -r1.59 *** Vertex.java 14 Apr 2007 15:00:47 -0000 1.58 --- Vertex.java 16 Apr 2007 15:55:22 -0000 1.59 *************** *** 435,442 **** * @param attributes The attributes to set */ ! public void setAttributes(List attributes) { ! Iterator iter = attributes.iterator(); ! while (iter.hasNext()) { ! Attribute a = (Attribute)iter.next(); if (a.getName().equals("Name")) { continue; --- 435,440 ---- * @param attributes The attributes to set */ ! public void setAttributes(List<Attribute> attributes) { ! for (Attribute a : attributes) { if (a.getName().equals("Name")) { continue; *************** *** 455,460 **** * @return the list of attributes for the object */ ! public List getAttributes() { ! ArrayList res = new ArrayList(); res.add(new Attribute("Name", getName(), false)); res.add(new Attribute("Owner", getOwner(), false)); --- 453,458 ---- * @return the list of attributes for the object */ ! public List<Attribute> getAttributes() { ! ArrayList<Attribute> res = new ArrayList<Attribute>(); res.add(new Attribute("Name", getName(), false)); res.add(new Attribute("Owner", getOwner(), false)); Index: IDTransform.java =================================================================== RCS file: /cvsroot/bprocessor/model/src/net/sourceforge/bprocessor/model/IDTransform.java,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** IDTransform.java 11 Oct 2006 14:05:16 -0000 1.1 --- IDTransform.java 16 Apr 2007 15:55:22 -0000 1.2 *************** *** 33,37 **** * @param attributes List */ ! public void setAttributes(List attributes) { } --- 33,37 ---- * @param attributes List */ ! public void setAttributes(List<Attribute> attributes) { } *************** *** 39,43 **** * @return List */ ! public List getAttributes() { return null; } --- 39,43 ---- * @return List */ ! public List<Attribute> getAttributes() { return null; } Index: Scale.java =================================================================== RCS file: /cvsroot/bprocessor/model/src/net/sourceforge/bprocessor/model/Scale.java,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** Scale.java 28 Nov 2006 10:06:34 -0000 1.4 --- Scale.java 16 Apr 2007 15:55:22 -0000 1.5 *************** *** 9,13 **** import java.util.ArrayList; - import java.util.Iterator; import java.util.List; --- 9,12 ---- *************** *** 95,102 **** * @param attributes List */ ! public void setAttributes(List attributes) { ! Iterator iter = attributes.iterator(); ! while (iter.hasNext()) { ! Attribute a = (Attribute)iter.next(); if (a.getName().equals("Scale X")) { sx(((Double)a.getValue()).doubleValue()); --- 94,99 ---- * @param attributes List */ ! public void setAttributes(List<Attribute> attributes) { ! for (Attribute a : attributes) { if (a.getName().equals("Scale X")) { sx(((Double)a.getValue()).doubleValue()); *************** *** 115,120 **** * @return List */ ! public List getAttributes() { ! ArrayList res = new ArrayList(); res.add(new Attribute("Scale X", new Double(sx()))); res.add(new Attribute("Scale Y", new Double(sy()))); --- 112,117 ---- * @return List */ ! public List<Attribute> getAttributes() { ! ArrayList<Attribute> res = new ArrayList<Attribute>(); res.add(new Attribute("Scale X", new Double(sx()))); res.add(new Attribute("Scale Y", new Double(sy()))); Index: Relation.java =================================================================== RCS file: /cvsroot/bprocessor/model/src/net/sourceforge/bprocessor/model/Relation.java,v retrieving revision 1.7 retrieving revision 1.8 diff -C2 -d -r1.7 -r1.8 *** Relation.java 13 Mar 2007 09:56:50 -0000 1.7 --- Relation.java 16 Apr 2007 15:55:22 -0000 1.8 *************** *** 12,16 **** import java.util.Collection; import java.util.HashMap; - import java.util.Iterator; import java.util.LinkedList; import java.util.List; --- 12,15 ---- *************** *** 48,53 **** /** {@inheritDoc} */ ! public List getAttributes() { ! LinkedList attributes = new LinkedList(); attributes.add(new Attribute("Object", geometric)); attributes.add(new Attribute("Offset", offset)); --- 47,52 ---- /** {@inheritDoc} */ ! public List<Attribute> getAttributes() { ! LinkedList<Attribute> attributes = new LinkedList<Attribute>(); attributes.add(new Attribute("Object", geometric)); attributes.add(new Attribute("Offset", offset)); *************** *** 123,130 **** /** {@inheritDoc} */ ! public void setAttributes(List attributes) { ! Iterator iter = attributes.iterator(); ! while (iter.hasNext()) { ! Attribute current = (Attribute) iter.next(); if (current.getName().equals("Offset")) { this.offset = (String) current.getValue(); --- 122,127 ---- /** {@inheritDoc} */ ! public void setAttributes(List<Attribute> attributes) { ! for (Attribute current : attributes) { if (current.getName().equals("Offset")) { this.offset = (String) current.getValue(); |
Update of /cvsroot/bprocessor/model/src/net/sourceforge/bprocessor/model/modellor In directory sc8-pr-cvs3.sourceforge.net:/tmp/cvs-serv15187/src/net/sourceforge/bprocessor/model/modellor Modified Files: TileModellor.java WindowModellor.java Modellor.java Cylinder.java ModelBathModellor.java LayerModellor.java Log Message: made abstract methods for getting and setting attributes and content to make extending modellors fool proof alongside with more generics Index: ModelBathModellor.java =================================================================== RCS file: /cvsroot/bprocessor/model/src/net/sourceforge/bprocessor/model/modellor/ModelBathModellor.java,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** ModelBathModellor.java 10 Apr 2007 20:59:01 -0000 1.1 --- ModelBathModellor.java 16 Apr 2007 15:54:42 -0000 1.2 *************** *** 8,12 **** import java.util.Collection; - import java.util.HashMap; import java.util.HashSet; import java.util.LinkedList; --- 8,11 ---- *************** *** 197,213 **** /** {@inheritDoc} */ ! public void setAttributes(List attributes) { update(space); } /** {@inheritDoc} */ ! public List getAttributes() { ! List res = new LinkedList(); ! res.add(new Attribute("Name", getName(), false)); ! res.add(new Attribute("Length", length, true)); ! res.add(new Attribute("Width", width, true)); ! res.add(new Attribute("Height", height, true)); ! res.add(new Attribute("Shaft-offset", shaftOffset, true)); ! return res; } --- 196,225 ---- /** {@inheritDoc} */ ! public void setAttributes(Map<String, Attribute> attributes) { ! Attribute a = attributes.get("Length"); ! if (a != null) { ! length = (Double)a.getValue(); ! } ! a = attributes.get("Width"); ! if (a != null) { ! width = (Double)a.getValue(); ! } ! a = attributes.get("Height"); ! if (a != null) { ! height = (Double)a.getValue(); ! } ! a = attributes.get("Shaft-offset"); ! if (a != null) { ! shaftOffset = (Double)a.getValue(); ! } update(space); } /** {@inheritDoc} */ ! public void getAttributes(List<Attribute> l) { ! l.add(new Attribute("Length", length, true)); ! l.add(new Attribute("Width", width, true)); ! l.add(new Attribute("Height", height, true)); ! l.add(new Attribute("Shaft-offset", shaftOffset, true)); } *************** *** 223,235 **** /** {@inheritDoc} */ ! public void setContent(Map m) { space = (Space)m.get("Space"); } /** {@inheritDoc} */ ! public Map getContent() { ! Map what = new HashMap(); ! what.put("Space", space); ! return what; } --- 235,245 ---- /** {@inheritDoc} */ ! public void setSubContent(Map<String, Object> m) { space = (Space)m.get("Space"); } /** {@inheritDoc} */ ! public void getSubContent(Map<String, Object> m) { ! m.put("Space", space); } Index: WindowModellor.java =================================================================== RCS file: /cvsroot/bprocessor/model/src/net/sourceforge/bprocessor/model/modellor/WindowModellor.java,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** WindowModellor.java 10 Apr 2007 20:59:01 -0000 1.1 --- WindowModellor.java 16 Apr 2007 15:54:42 -0000 1.2 *************** *** 9,15 **** import java.util.ArrayList; import java.util.Collection; - import java.util.HashMap; import java.util.HashSet; - import java.util.LinkedList; import java.util.List; import java.util.Iterator; --- 9,13 ---- *************** *** 191,205 **** /** {@inheritDoc} */ ! public void setAttributes(List attributes) { ! framewidth = ((Double)((Attribute)attributes.get(1)).getValue()).doubleValue(); ! framedepth = ((Double)((Attribute)attributes.get(2)).getValue()).doubleValue(); ! offset = ((Double)((Attribute)attributes.get(3)).getValue()).doubleValue(); ! Iterator sit = Project.getInstance().getActiveSpace().getSurfaces().iterator(); ! Object value = ((Attribute)attributes.get(4)).getValue(); ! while (sit.hasNext()) { ! Project.getInstance().checkpoint(); ! Surface s = (Surface)sit.next(); ! if (s.getName().equals(value)) { ! surface = s; } } --- 189,215 ---- /** {@inheritDoc} */ ! public void setAttributes(Map<String, Attribute> attributes) { ! Attribute a = attributes.get("Framewidth"); ! if (a != null) { ! framewidth = (Double)a.getValue(); ! } ! a = attributes.get("Framedepth"); ! if (a != null) { ! framedepth = (Double)a.getValue(); ! } ! a = attributes.get("Offset"); ! if (a != null) { ! offset = (Double)a.getValue(); ! } ! a = attributes.get("Surface"); ! if (a != null) { ! Iterator sit = Project.getInstance().getActiveSpace().getSurfaces().iterator(); ! Object value = a.getValue(); ! while (sit.hasNext()) { ! Project.getInstance().checkpoint(); ! Surface s = (Surface)sit.next(); ! if (s.getName().equals(value)) { ! surface = s; ! } } } *************** *** 208,219 **** /** {@inheritDoc} */ ! public List getAttributes() { ! List res = new LinkedList(); ! res.add(new Attribute("Name", getName(), false)); ! res.add(new Attribute("Framewidth", new Double(framewidth))); ! res.add(new Attribute("Framedepth", new Double(framedepth))); ! res.add(new Attribute("Offset", new Double(offset))); ! res.add(new Attribute("Surface", surface)); ! return res; } --- 218,227 ---- /** {@inheritDoc} */ ! public void getAttributes(List<Attribute> l) { ! l.add(new Attribute("Name", getName(), false)); ! l.add(new Attribute("Framewidth", new Double(framewidth))); ! l.add(new Attribute("Framedepth", new Double(framedepth))); ! l.add(new Attribute("Offset", new Double(offset))); ! l.add(new Attribute("Surface", surface)); } *************** *** 229,233 **** /** {@inheritDoc} */ ! public void setContent(Map m) { framewidth = ((Double)m.get("Framewidth")).doubleValue(); framedepth = ((Double)m.get("Framedepth")).doubleValue(); --- 237,241 ---- /** {@inheritDoc} */ ! public void setSubContent(Map<String, Object> m) { framewidth = ((Double)m.get("Framewidth")).doubleValue(); framedepth = ((Double)m.get("Framedepth")).doubleValue(); *************** *** 239,251 **** /** {@inheritDoc} */ ! public Map getContent() { ! Map what = new HashMap(); ! what.put("Framewidth", new Double(framewidth)); ! what.put("Framedepth", new Double(framedepth)); ! what.put("Offset", new Double(offset)); ! what.put("Sign", new Integer(sign)); ! what.put("Space", space); ! what.put("Surface", surface); ! return what; } --- 247,257 ---- /** {@inheritDoc} */ ! public void getSubContent(Map<String, Object> m) { ! m.put("Framewidth", new Double(framewidth)); ! m.put("Framedepth", new Double(framedepth)); ! m.put("Offset", new Double(offset)); ! m.put("Sign", new Integer(sign)); ! m.put("Space", space); ! m.put("Surface", surface); } Index: TileModellor.java =================================================================== RCS file: /cvsroot/bprocessor/model/src/net/sourceforge/bprocessor/model/modellor/TileModellor.java,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** TileModellor.java 16 Apr 2007 11:13:29 -0000 1.5 --- TileModellor.java 16 Apr 2007 15:54:42 -0000 1.6 *************** *** 11,14 **** --- 11,15 ---- import java.util.LinkedList; import java.util.List; + import java.util.Map; import org.apache.log4j.Logger; *************** *** 37,41 **** /** The width of the joint between tiles in mm*/ ! private static int jointSize = 3; private int height = 0; --- 38,42 ---- /** The width of the joint between tiles in mm*/ ! private int jointSize = 3; private int height = 0; *************** *** 50,54 **** /** tile thickness in mm */ ! private static int tileThickness = 8; /** --- 51,55 ---- /** tile thickness in mm */ ! private int tileThickness = 8; /** *************** *** 107,116 **** List<Surface> tiles = new LinkedList<Surface>(); CoordinateSystem insertPoint = cs.copy(); ! insertPoint.setOrigin(cs.unTranslate(new Vertex(minX + jointSize / 2000, ! minY + jointSize / 2000, 0))); Vertex orig = insertPoint.center(); if (height > 0) { ! maxY = height / 1000; } Vertex localHori = new Vertex(tileSize.getWidth() / 1000.0 + jointSize / 2000.0, 0, 0); --- 108,117 ---- List<Surface> tiles = new LinkedList<Surface>(); CoordinateSystem insertPoint = cs.copy(); ! insertPoint.setOrigin(cs.unTranslate(new Vertex(minX + jointSize / 2000.0, ! minY + jointSize / 2000.0, 0))); Vertex orig = insertPoint.center(); if (height > 0) { ! maxY = height / 1000.0; } Vertex localHori = new Vertex(tileSize.getWidth() / 1000.0 + jointSize / 2000.0, 0, 0); *************** *** 168,192 **** /** {@inheritDoc} */ @Override ! public List<Attribute> getAttributes() { ! List<Attribute> atrib = super.getAttributes(); ! ! atrib.add(new Attribute("Tilewidth", new Double(tileSize.width))); ! atrib.add(new Attribute("Tileheight", new Double(tileSize.height))); ! atrib.add(new Attribute("Joint width", new Double(jointSize))); ! atrib.add(new Attribute("Material", tileColor)); ! atrib.add(new Attribute("Surface", surface)); ! atrib.add(new Attribute("Setting height", new Double(height))); ! return atrib; } /** {@inheritDoc} */ @Override ! public void setAttributes(List<Attribute> attributes) { ! super.setAttributes(attributes); ! for (Attribute a : attributes) { ! if (a.getName().equals("Setting height")) { ! height = ((Double)a.getValue()).intValue(); ! update(null); ! } } } --- 169,266 ---- /** {@inheritDoc} */ @Override ! public void getAttributes(List<Attribute> l) { ! l.add(new Attribute("Tilewidth", new Double(tileSize.width))); ! l.add(new Attribute("Tileheight", new Double(tileSize.height))); ! l.add(new Attribute("Joint width", new Double(jointSize))); ! l.add(new Attribute("Material", tileColor)); ! l.add(new Attribute("Surface", surface)); ! l.add(new Attribute("Setting height", new Double(height))); } /** {@inheritDoc} */ @Override ! public void setAttributes(Map<String, Attribute> attributes) { ! Attribute a = attributes.get("Tilewidth"); ! if (a != null) { ! tileSize.width = ((Double)a.getValue()).intValue(); ! } ! a = attributes.get("Tileheight"); ! if (a != null) { ! tileSize.height = ((Double)a.getValue()).intValue(); ! } ! a = attributes.get("Joint width"); ! if (a != null) { ! jointSize = ((Double)a.getValue()).intValue(); ! } ! a = attributes.get("Material"); ! if (a != null) { ! tileColor = (Material)a.getValue(); ! } ! a = attributes.get("Surface"); ! if (a != null) { ! surface = (Surface)a.getValue(); ! } ! a = attributes.get("Setting height"); ! if (a != null) { ! surface = (Surface)a.getValue(); ! } ! } ! ! /** ! * {@inheritDoc} ! */ ! @Override ! public void getSubContent(Map<String, Object> m) { ! m.put("Space", space); ! m.put("Surface", surface); ! m.put("startPoint", startPoint); ! m.put("tileColor", tileColor); ! m.put("jointSize", jointSize); ! m.put("tileWidth", tileSize.width); ! m.put("tileHeight", tileSize.height); ! m.put("tileThickness", tileThickness); ! m.put("height", height); ! } ! ! /** ! * {@inheritDoc} ! */ ! @Override ! public void setSubContent(Map<String, Object> m) { ! Object o = m.get("Space"); ! if (o != null) { ! space = (Space)o; ! } ! o = m.get("Surface"); ! if (o != null) { ! surface = (Surface)o; ! } ! o = m.get("startPoint"); ! if (o != null) { ! startPoint = (CoordinateSystem)o; ! } ! o = m.get("tileColor"); ! if (o != null) { ! tileColor = (Material)o; ! } ! o = m.get("jointSize"); ! if (o != null) { ! jointSize = (Integer)o; ! } ! o = m.get("tileWidth"); ! if (o != null) { ! tileSize.width = (Integer)o; ! } ! o = m.get("tileHeight"); ! if (o != null) { ! tileSize.height = (Integer)o; ! } ! o = m.get("tileThickness"); ! if (o != null) { ! tileThickness = (Integer)o; ! } ! o = m.get("height"); ! if (o != null) { ! height = (Integer)o; } } Index: Modellor.java =================================================================== RCS file: /cvsroot/bprocessor/model/src/net/sourceforge/bprocessor/model/modellor/Modellor.java,v retrieving revision 1.9 retrieving revision 1.10 diff -C2 -d -r1.9 -r1.10 *** Modellor.java 16 Apr 2007 09:08:46 -0000 1.9 --- Modellor.java 16 Apr 2007 15:54:42 -0000 1.10 *************** *** 10,14 **** import java.util.Collection; import java.util.HashMap; - import java.util.Iterator; import java.util.LinkedList; import java.util.List; --- 10,13 ---- *************** *** 79,82 **** --- 78,94 ---- return modellors.remove(m); } + + /** + * Static method for generating a map of attributes to lookup in + * @param attributes the list of attributes + * @return a map from name to attribute + */ + public static Map<String, Attribute> generateAttributeMap(List<Attribute> attributes) { + Map<String, Attribute> attr = new HashMap<String, Attribute>(); + for (Attribute a : attributes) { + attr.put(a.getName(), a); + } + return attr; + } /** *************** *** 91,94 **** --- 103,125 ---- */ public abstract int getUseableLevel(); + + /** + * method to fill in all the attributes, in the wished order + * @param l the list to fill in the attributes + */ + public abstract void getAttributes(List<Attribute> l); + + /** + * Set attributes in the modellor + * @param m a map of attribute name to attributes for quick lookup + */ + public abstract void setAttributes(Map<String, Attribute> m); + + /** + * Create a new instance of the modellor, based on a space + * @param s The space the modellor should reside in + * @return The created modellor object for the given space + */ + public abstract Modellor newInstance(Space s); /** *************** *** 114,131 **** return "Modellor"; } ! ! /** ! * Create a new instance of the modellor, based on a space ! * @param s The space the modellor should reside in ! * @return The created modellor object for the given space ! */ ! public abstract Modellor newInstance(Space s); ! /** * Set the entire content of the modellor to the given map key to value pairs * @param m the map containing the values; */ ! public void setContent(Map m) { active = ((Boolean)m.get("active")).booleanValue(); } --- 145,156 ---- return "Modellor"; } ! /** * Set the entire content of the modellor to the given map key to value pairs * @param m the map containing the values; */ ! public void setContent(Map<String, Object> m) { active = ((Boolean)m.get("active")).booleanValue(); + setSubContent(m); } *************** *** 134,142 **** * @return A map of key to value pairs of the content */ ! public Map getContent() { ! Map content = new HashMap(); content.put("active", Boolean.valueOf(active)); return content; } /** --- 159,180 ---- * @return A map of key to value pairs of the content */ ! public Map<String, Object> getContent() { ! Map<String, Object> content = new HashMap<String, Object>(); content.put("active", Boolean.valueOf(active)); + this.getSubContent(content); return content; } + + /** + * Abstract method for getting the implementing modellors content + * @param c the map to put the content in + */ + public abstract void getSubContent(Map<String, Object> c); + + /** + * Abstact method for setting the content in extending classes + * @param c The map containing the object setting + */ + public abstract void setSubContent(Map<String, Object> c); /** *************** *** 158,181 **** /** * Get the attributes of this modellor * @return the attributes */ public List<Attribute> getAttributes() { List<Attribute> l = new LinkedList<Attribute>(); l.add(new Attribute("Active", Boolean.valueOf(active), true)); return l; } ! /** * Set the attributes of the modellor * @param attributes the new attributes */ public void setAttributes(List<Attribute> attributes) { ! Iterator it = attributes.iterator(); ! while (it.hasNext()) { ! Attribute a = (Attribute)it.next(); ! if (a.getName().equals("Active")) { ! setActive((Boolean)a.getValue()); ! } } } } --- 196,221 ---- /** * Get the attributes of this modellor + * DO NOT OVERRIDE * @return the attributes */ public List<Attribute> getAttributes() { List<Attribute> l = new LinkedList<Attribute>(); + this.getAttributes(l); l.add(new Attribute("Active", Boolean.valueOf(active), true)); return l; } ! /** * Set the attributes of the modellor + * DO NOT OVERRIDE * @param attributes the new attributes */ public void setAttributes(List<Attribute> attributes) { ! Map<String, Attribute> map = generateAttributeMap(attributes); ! Attribute a = map.get("Active"); ! if (a != null) { ! setActive((Boolean)a.getValue()); } + setAttributes(map); } } Index: LayerModellor.java =================================================================== RCS file: /cvsroot/bprocessor/model/src/net/sourceforge/bprocessor/model/modellor/LayerModellor.java,v retrieving revision 1.11 retrieving revision 1.12 diff -C2 -d -r1.11 -r1.12 *** LayerModellor.java 10 Apr 2007 20:59:01 -0000 1.11 --- LayerModellor.java 16 Apr 2007 15:54:42 -0000 1.12 *************** *** 9,13 **** import java.util.Collection; - import java.util.HashMap; import java.util.HashSet; import java.util.Iterator; --- 9,12 ---- *************** *** 131,170 **** /** ! * Set attributes ! * @param attributes The attributes */ ! public void setAttributes(List attributes) { ! Iterator iter = attributes.iterator(); ! while (iter.hasNext()) { ! Attribute current = (Attribute) iter.next(); ! if (current.getName().equals("Thickness")) { ! Double thickness = (Double) current.getValue(); ! distance = thickness.doubleValue(); ! space.changed(); ! } else if (current.getName().equals("Surface")) { ! Iterator it = space.getEnvelope().iterator(); ! Surface chosen = null; ! while (it.hasNext()) { ! Surface cur = (Surface)it.next(); ! if (cur.getName().equalsIgnoreCase((String)current.getValue())) { ! chosen = cur; ! } ! } ! if (chosen != null) { ! surface = chosen; } } } } /** ! * Get attributes ! * @return The attributes */ ! public List getAttributes() { ! LinkedList attributes = new LinkedList(); ! attributes.add(new Attribute("Surface", surface.getName())); ! attributes.add(new Attribute("Thickness", new Double(distance))); ! return attributes; } --- 130,164 ---- /** ! * {@inheritDoc} */ ! public void setAttributes(Map<String, Attribute> attributes) { ! Attribute a = attributes.get("Thickness"); ! if (a != null) { ! Double thickness = (Double) a.getValue(); ! distance = thickness.doubleValue(); ! space.changed(); ! } ! a = attributes.get("Surface"); ! if (a != null) { ! Iterator it = space.getEnvelope().iterator(); ! Surface chosen = null; ! while (it.hasNext()) { ! Surface cur = (Surface)it.next(); ! if (cur.getName().equalsIgnoreCase((String)a.getValue())) { ! chosen = cur; } } + if (chosen != null) { + surface = chosen; + } } } /** ! * {@inheritDoc} */ ! public void getAttributes(List<Attribute> l) { ! l.add(new Attribute("Surface", surface.getName())); ! l.add(new Attribute("Thickness", new Double(distance))); } *************** *** 196,200 **** * @param attributes Attributes */ ! public void setAttributes(List attributes) { } --- 190,194 ---- * @param attributes Attributes */ ! public void setAttributes(List<Attribute> attributes) { } *************** *** 203,208 **** * @return List of attributes */ ! public List getAttributes() { ! LinkedList attributes = new LinkedList(); attributes.add(new Attribute("Depth", new Double(0.3))); attributes.add(new Attribute("Top offset", new Double(0.0))); --- 197,202 ---- * @return List of attributes */ ! public List<Attribute> getAttributes() { ! LinkedList<Attribute> attributes = new LinkedList<Attribute>(); attributes.add(new Attribute("Depth", new Double(0.3))); attributes.add(new Attribute("Top offset", new Double(0.0))); *************** *** 224,228 **** /** {@inheritDoc} */ ! public void setContent(Map m) { space = (Space)m.get("Space"); surface = (Surface)m.get("Surface"); --- 218,222 ---- /** {@inheritDoc} */ ! public void setSubContent(Map<String, Object> m) { space = (Space)m.get("Space"); surface = (Surface)m.get("Surface"); *************** *** 231,240 **** /** {@inheritDoc} */ ! public Map getContent() { ! Map m = new HashMap(); m.put("Space", space); m.put("Surface", surface); m.put("Distance", new Double(distance)); - return null; } --- 225,232 ---- /** {@inheritDoc} */ ! public void getSubContent(Map<String, Object> m) { m.put("Space", space); m.put("Surface", surface); m.put("Distance", new Double(distance)); } Index: Cylinder.java =================================================================== RCS file: /cvsroot/bprocessor/model/src/net/sourceforge/bprocessor/model/modellor/Cylinder.java,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** Cylinder.java 10 Apr 2007 20:59:01 -0000 1.1 --- Cylinder.java 16 Apr 2007 15:54:42 -0000 1.2 *************** *** 8,16 **** import java.util.Arrays; - import java.util.HashMap; import java.util.LinkedList; import java.util.List; import java.util.Map; import net.sourceforge.bprocessor.model.Edge; import net.sourceforge.bprocessor.model.Project; --- 8,16 ---- import java.util.Arrays; import java.util.LinkedList; import java.util.List; import java.util.Map; + import net.sourceforge.bprocessor.model.Attribute; import net.sourceforge.bprocessor.model.Edge; import net.sourceforge.bprocessor.model.Project; *************** *** 124,135 **** /** {@inheritDoc} */ ! public void setAttributes(List attributes) { ! // TODO Auto-generated method stub } /** {@inheritDoc} */ ! public List getAttributes() { ! // TODO Auto-generated method stub ! return null; } --- 124,147 ---- /** {@inheritDoc} */ ! public void setAttributes(Map<String, Attribute> attributes) { ! Attribute a = attributes.get("Radius"); ! if (a != null) { ! radius = (Double)a.getValue(); ! } ! a = attributes.get("Height"); ! if (a != null) { ! height = (Double)a.getValue(); ! } ! a = attributes.get("Axis devisions"); ! if (a != null) { ! axisDivisions = ((Double)a.getValue()).intValue(); ! } } /** {@inheritDoc} */ ! public void getAttributes(List<Attribute> l) { ! l.add(new Attribute("Radius", new Double(radius))); ! l.add(new Attribute("Height", new Double(height))); ! l.add(new Attribute("Axis devisions", new Double(axisDivisions))); } *************** *** 141,145 **** /** {@inheritDoc} */ ! public void setContent(Map m) { axisDivisions = ((Integer)m.get("Axis")).intValue(); height = ((Double)m.get("Height")).doubleValue(); --- 153,157 ---- /** {@inheritDoc} */ ! public void setSubContent(Map<String, Object> m) { axisDivisions = ((Integer)m.get("Axis")).intValue(); height = ((Double)m.get("Height")).doubleValue(); *************** *** 148,157 **** /** {@inheritDoc} */ ! public Map getContent() { ! Map m = new HashMap(); m.put("Axis", new Integer(axisDivisions)); m.put("Height", new Double(height)); m.put("Radius", new Double(radius)); - return m; } --- 160,167 ---- /** {@inheritDoc} */ ! public void getSubContent(Map<String, Object> m) { m.put("Axis", new Integer(axisDivisions)); m.put("Height", new Double(height)); m.put("Radius", new Double(radius)); } |
|
From: rimestad <rim...@us...> - 2007-04-16 15:54:45
|
Update of /cvsroot/bprocessor/facade/src/net/sourceforge/bprocessor/facade/modellor In directory sc8-pr-cvs3.sourceforge.net:/tmp/cvs-serv15177/src/net/sourceforge/bprocessor/facade/modellor Modified Files: NetFacadeModellor.java FacadeModellor.java Log Message: made abstract methods for getting and setting attributes and content to make extending modellors fool proof alongside with more generics Index: NetFacadeModellor.java =================================================================== RCS file: /cvsroot/bprocessor/facade/src/net/sourceforge/bprocessor/facade/modellor/NetFacadeModellor.java,v retrieving revision 1.28 retrieving revision 1.29 diff -C2 -d -r1.28 -r1.29 *** NetFacadeModellor.java 15 Apr 2007 11:05:54 -0000 1.28 --- NetFacadeModellor.java 16 Apr 2007 15:54:36 -0000 1.29 *************** *** 16,19 **** --- 16,20 ---- import java.util.Set; + import net.sourceforge.bprocessor.gui.GUI; import net.sourceforge.bprocessor.model.Attribute; import net.sourceforge.bprocessor.model.Classification; *************** *** 87,111 **** /** ! * Get content of the modellor for persistence ! * @return a map for persistence */ ! public Map getContent() { ! Map content = new HashMap(); ! content.put("space", space); ! content.put("net", net); ! content.put("depth", new Double(depth)); ! content.put("frameWidth", new Double(frameWidth)); ! content.put("front", front); ! content.put("single", Boolean.valueOf(single)); ! content.put("frame", frame); ! content.putAll(super.getContent()); ! return content; } /** ! * Set the content of the modellor from a map, for persistence ! * @param m persistence map */ ! public void setContent(Map m) { space = (Space)m.get("space"); net = (Net)m.get("net"); --- 88,107 ---- /** ! * {@inheritDoc} */ ! public void getSubContent(Map<String, Object> m) { ! m.put("space", space); ! m.put("net", net); ! m.put("depth", new Double(depth)); ! m.put("frameWidth", new Double(frameWidth)); ! m.put("front", front); ! m.put("single", Boolean.valueOf(single)); ! m.put("frame", frame); } /** ! * {@inheritDoc} */ ! public void setSubContent(Map<String, Object> m) { space = (Space)m.get("space"); net = (Net)m.get("net"); *************** *** 115,119 **** single = ((Boolean)m.get("single")).booleanValue(); frame = (Space)m.get("frame"); - super.setContent(m); Project.getInstance().addObserver(this); } --- 111,114 ---- *************** *** 199,251 **** space.setModellor(null); } ! space = null; ! net = null; ! frame = null; ! front = null; } /** ! * Get the attributes of this modellor ! * @return the attributes */ ! public List getAttributes() { ! List attributes = new LinkedList(); ! attributes.add(new Attribute("Net", net, true)); ! attributes.add(new Attribute("Front", front, true)); ! attributes.add(new Attribute("Framewidth", new Double(frameWidth), true)); ! attributes.add(new Attribute("Depth", new Double(depth), true)); ! attributes.add(new Attribute("Single", Boolean.valueOf(single), true)); ! attributes.addAll(super.getAttributes()); ! return attributes; } /** ! * Set the attributes of the modellor ! * @param attributes the new attributes */ ! public void setAttributes(List<Attribute> attributes) { ! Iterator it = attributes.iterator(); ! while (it.hasNext()) { ! Attribute att = (Attribute)it.next(); ! if (att.getName().equals("Net")) { ! setNet((Space)att.getValue()); ! } else if (att.getName().equals("Framewidth")) { ! setFrameWidth(((Double)att.getValue()).doubleValue()); ! } else if (att.getName().equals("Depth")) { ! setDepth(((Double)att.getValue()).doubleValue()); ! } else if (att.getName().equals("Single")) { ! setSingle(((Boolean)att.getValue()).booleanValue()); ! } else if (att.getName().equals("Front")) { ! Iterator sit = Project.getInstance().getActiveSpace().getSurfaces().iterator(); ! while (sit.hasNext()) { ! Surface s = (Surface)sit.next(); ! if (s.getName().equals(att.getValue()) && front != s) { ! this.setFront(s); ! this.setNet(createNet(front)); ! } } } } - super.setAttributes(attributes); } --- 194,254 ---- space.setModellor(null); } ! //space = null; ! //net = null; ! //frame = null; ! //front = null; } /** ! * {@inheritDoc} */ ! public void getAttributes(List<Attribute> l) { ! l.add(new Attribute("Net", net, true)); ! l.add(new Attribute("Front", front, true)); ! l.add(new Attribute("Framewidth", new Double(frameWidth), true)); ! l.add(new Attribute("Depth", new Double(depth), true)); ! l.add(new Attribute("Single", Boolean.valueOf(single), true)); } /** ! * {@inheritDoc} */ ! public void setAttributes(Map<String, Attribute> attributes) { ! Attribute a = attributes.get("Net"); ! if (a != null) { ! setNet((Space)a.getValue()); ! } ! a = attributes.get("Framewidth"); ! if (a != null) { ! setFrameWidth(((Double)a.getValue()).doubleValue()); ! } ! a = attributes.get("Framewidth"); ! if (a != null) { ! setFrameWidth(((Double)a.getValue()).doubleValue()); ! } ! a = attributes.get("Depth"); ! if (a != null) { ! setDepth(((Double)a.getValue()).doubleValue()); ! } ! a = attributes.get("Single"); ! if (a != null) { ! setSingle(((Boolean)a.getValue()).booleanValue()); ! } ! a = attributes.get("Front"); ! if (a != null) { ! Iterator sit = space.getOwner().getSurfaces().iterator(); ! boolean legalSurface = false; ! while (sit.hasNext()) { ! Surface s = (Surface)sit.next(); ! if (s.getName().equals(a.getValue()) && front != s) { ! legalSurface = true; ! this.setFront(s); ! this.setNet(createNet(front)); } } + if (!legalSurface) { + GUI.getInstance().alert(a.getValue() + " weren't a useable surface"); + } } } Index: FacadeModellor.java =================================================================== RCS file: /cvsroot/bprocessor/facade/src/net/sourceforge/bprocessor/facade/modellor/FacadeModellor.java,v retrieving revision 1.32 retrieving revision 1.33 diff -C2 -d -r1.32 -r1.33 *** FacadeModellor.java 15 Apr 2007 10:40:18 -0000 1.32 --- FacadeModellor.java 16 Apr 2007 15:54:36 -0000 1.33 *************** *** 16,19 **** --- 16,20 ---- import java.util.Iterator; + import net.sourceforge.bprocessor.gui.GUI; import net.sourceforge.bprocessor.model.modellor.Modellor; import net.sourceforge.bprocessor.model.Space; *************** *** 225,300 **** } /** ! * Set the attributes of the object to the values in the list ! * @param attributes The attributes to set */ ! public void setAttributes(List attributes) { ! Iterator it = attributes.iterator(); boolean changeFacade = false; boolean changeCons = false; ! while (it.hasNext()) { ! Attribute a = (Attribute)it.next(); ! if (a.getName().equals("Name")) { ! name = (String)a.getValue(); ! } else if (a.getName().equals("Front")) { ! Iterator sit = Project.getInstance().getActiveSpace().getSurfaces().iterator(); ! while (sit.hasNext()) { ! Surface s = (Surface)sit.next(); ! if (s.getName().equals(a.getValue())) { ! if (front != s) { ! front = s; ! changeFacade = true; ! changeCons = true; ! } } - } - } else if (a.getName().equals("V-posts")) { - int n = ((Double)a.getValue()).intValue(); - if (n != vertPosts) { - changeFacade = true; - changeCons = true; - vertPosts = n; } ! } else if (a.getName().equals("H-posts")) { ! int n = ((Double)a.getValue()).intValue(); ! if (n != horPosts) { ! changeFacade = true; ! changeCons = true; ! horPosts = n; ! } ! } else if (a.getName().equals("V-postwidth")) { ! double d = ((Double)a.getValue()).doubleValue(); ! setVertPostWidth(d); changeFacade = true; ! } else if (a.getName().equals("H-postwidth")) { ! double d = ((Double)a.getValue()).doubleValue(); ! setHorPostWidth(d); changeFacade = true; ! } else if (a.getName().equals("Frame thickness")) { ! double n = ((Double)a.getValue()).doubleValue(); ! if (n != frameWidth) { ! frameWidth = n; ! changeCons = true; ! changeFacade = true; ! } ! } else if (a.getName().equals("Depth")) { ! double n = ((Double)a.getValue()).doubleValue(); ! if (n != depth) { ! depth = n; ! changeFacade = true; ! } ! } else if (a.getName().equals("Single posted")) { ! boolean b = ((Boolean)a.getValue()).booleanValue(); ! if (b && type != SINGLE_BAR) { ! type = SINGLE_BAR; ! changeFacade = true; ! changeCons = true; ! } ! if (!b && type == SINGLE_BAR) { ! type = DOUBLE_BAR; ! changeFacade = true; ! changeCons = true; ! } } } if (changeCons || (horCons.isEmpty() && vertCons.isEmpty())) { createPostConstructors(); --- 226,319 ---- } /** ! * {@inheritDoc} */ ! public void setAttributes(Map<String, Attribute> attributes) { boolean changeFacade = false; boolean changeCons = false; ! Attribute a = attributes.get("Name"); ! if (a != null) { ! name = (String)a.getValue(); ! } ! a = attributes.get("Front"); ! if (a != null) { ! Iterator sit = space.getOwner().getSurfaces().iterator(); ! boolean legalSurface = false; ! while (sit.hasNext()) { ! Surface s = (Surface)sit.next(); ! if (s.getName().equals(a.getValue())) { ! if (front != s) { ! legalSurface = true; ! front = s; ! changeFacade = true; ! changeCons = true; } } ! } ! if (!legalSurface) { ! GUI.getInstance().alert(a.getValue() + " weren't a useable surface"); ! } ! } ! a = attributes.get("V-posts"); ! if (a != null) { ! int n = ((Double)a.getValue()).intValue(); ! if (n != vertPosts) { changeFacade = true; ! changeCons = true; ! vertPosts = n; ! } ! } ! a = attributes.get("H-posts"); ! if (a != null) { ! int n = ((Double)a.getValue()).intValue(); ! if (n != horPosts) { changeFacade = true; ! changeCons = true; ! horPosts = n; ! } ! } ! a = attributes.get("V-postwidth"); ! if (a != null) { ! double d = ((Double)a.getValue()).doubleValue(); ! setVertPostWidth(d); ! changeFacade = true; ! } ! a = attributes.get("H-postwidth"); ! if (a != null) { ! double d = ((Double)a.getValue()).doubleValue(); ! setHorPostWidth(d); ! changeFacade = true; ! } ! a = attributes.get("Frame thickness"); ! if (a != null) { ! double n = ((Double)a.getValue()).doubleValue(); ! if (n != frameWidth) { ! frameWidth = n; ! changeCons = true; ! changeFacade = true; ! } ! } ! a = attributes.get("Depth"); ! if (a != null) { ! double n = ((Double)a.getValue()).doubleValue(); ! if (n != depth) { ! depth = n; ! changeFacade = true; ! } ! } ! a = attributes.get("Single posted"); ! if (a != null) { ! boolean b = ((Boolean)a.getValue()).booleanValue(); ! if (b && type != SINGLE_BAR) { ! type = SINGLE_BAR; ! changeFacade = true; ! changeCons = true; ! } ! if (!b && type == SINGLE_BAR) { ! type = DOUBLE_BAR; ! changeFacade = true; ! changeCons = true; } } + if (changeCons || (horCons.isEmpty() && vertCons.isEmpty())) { createPostConstructors(); *************** *** 307,329 **** } /** ! * Retrn a list of the attributes in the object ! * @return the list of attributes for the object */ ! public List getAttributes() { ! LinkedList attributes = new LinkedList(); ! attributes.add(new Attribute("Name", name)); ! attributes.add(new Attribute("Front", front, true)); ! attributes.add(new Attribute("V-posts", new Double(vertPosts))); ! attributes.add(new Attribute("H-posts", new Double(horPosts))); boolean bars = (type == SINGLE_BAR); if (bars) { ! attributes.add(new Attribute("V-postwidth", new Double(vertPostWidth), bars)); ! attributes.add(new Attribute("H-postwidth", new Double(horPostWidth), bars)); ! attributes.add(new Attribute("Frame thickness", new Double(frameWidth), bars)); } ! attributes.add(new Attribute("Depth", new Double(depth))); ! attributes.add(new Attribute("Single posted", Boolean.valueOf(bars))); ! return attributes; } /** * Get the name --- 326,346 ---- } /** ! * {@inheritDoc} */ ! public void getAttributes(List<Attribute> l) { ! l.add(new Attribute("Name", name)); ! l.add(new Attribute("Front", front, true)); ! l.add(new Attribute("V-posts", new Double(vertPosts))); ! l.add(new Attribute("H-posts", new Double(horPosts))); boolean bars = (type == SINGLE_BAR); if (bars) { ! l.add(new Attribute("V-postwidth", new Double(vertPostWidth), bars)); ! l.add(new Attribute("H-postwidth", new Double(horPostWidth), bars)); ! l.add(new Attribute("Frame thickness", new Double(frameWidth), bars)); } ! l.add(new Attribute("Depth", new Double(depth))); ! l.add(new Attribute("Single posted", Boolean.valueOf(bars))); } + /** * Get the name *************** *** 776,780 **** /** {@inheritDoc} */ ! public void setContent(Map m) { bottomBound = (Line)m.get("bottomBound"); rightBound = (Line)m.get("rightBound"); --- 793,797 ---- /** {@inheritDoc} */ ! public void setSubContent(Map<String, Object> m) { bottomBound = (Line)m.get("bottomBound"); rightBound = (Line)m.get("rightBound"); *************** *** 794,799 **** /** {@inheritDoc} */ ! public Map getContent() { ! Map m = new HashMap(); m.put("bottomBound", bottomBound); m.put("rightBound", rightBound); --- 811,815 ---- /** {@inheritDoc} */ ! public void getSubContent(Map<String, Object> m) { m.put("bottomBound", bottomBound); m.put("rightBound", rightBound); *************** *** 810,814 **** m.put("name", name); m.put("Space", space); - return m; } --- 826,829 ---- |
|
From: Nordholt <nor...@us...> - 2007-04-16 11:13:38
|
Update of /cvsroot/bprocessor/model/src/net/sourceforge/bprocessor/model/modellor In directory sc8-pr-cvs3.sourceforge.net:/tmp/cvs-serv1958/src/net/sourceforge/bprocessor/model/modellor Modified Files: TileModellor.java Log Message: again some lazy guy forgot to check his style ;) Index: TileModellor.java =================================================================== RCS file: /cvsroot/bprocessor/model/src/net/sourceforge/bprocessor/model/modellor/TileModellor.java,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** TileModellor.java 16 Apr 2007 09:08:46 -0000 1.4 --- TileModellor.java 16 Apr 2007 11:13:29 -0000 1.5 *************** *** 114,120 **** maxY = height / 1000; } ! Vertex horizontalAdd = insertPoint.unTranslate(new Vertex(tileSize.getWidth() / 1000.0 + jointSize / 2000.0, 0, 0)).minus(orig); do { ! Vertex verticalAdd = insertPoint.unTranslate(new Vertex(0, tileSize.getHeight() / 1000.0 + jointSize / 2000.0, 0)).minus(orig); int iterations = 0; do { --- 114,122 ---- maxY = height / 1000; } ! Vertex localHori = new Vertex(tileSize.getWidth() / 1000.0 + jointSize / 2000.0, 0, 0); ! Vertex horizontalAdd = insertPoint.unTranslate(localHori).minus(orig); do { ! Vertex localVert = new Vertex(0, tileSize.getHeight() / 1000.0 + jointSize / 2000.0, 0); ! Vertex verticalAdd = insertPoint.unTranslate(localVert).minus(orig); int iterations = 0; do { |
|
From: rimestad <rim...@us...> - 2007-04-16 09:08:54
|
Update of /cvsroot/bprocessor//model/src/net/sourceforge/bprocessor/model/modellor In directory sc8-pr-cvs3.sourceforge.net:/tmp/cvs-serv17774/src/net/sourceforge/bprocessor/model/modellor Modified Files: TileModellor.java Modellor.java Log Message: now the surface is covered with tiles Index: TileModellor.java =================================================================== RCS file: /cvsroot/bprocessor//model/src/net/sourceforge/bprocessor/model/modellor/TileModellor.java,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** TileModellor.java 14 Apr 2007 15:05:38 -0000 1.3 --- TileModellor.java 16 Apr 2007 09:08:46 -0000 1.4 *************** *** 9,16 **** --- 9,18 ---- import java.awt.Dimension; import java.util.ArrayList; + import java.util.LinkedList; import java.util.List; import org.apache.log4j.Logger; + import net.sourceforge.bprocessor.model.Attribute; import net.sourceforge.bprocessor.model.CoordinateSystem; import net.sourceforge.bprocessor.model.Edge; *************** *** 34,40 **** private Dimension tileSize = new Dimension(100, 100); ! /** The width of the joint between tiles */ private static int jointSize = 3; private Material tileColor = new Material("White", new float[]{1.0f, 1.0f, 1.0f}); --- 36,44 ---- private Dimension tileSize = new Dimension(100, 100); ! /** The width of the joint between tiles in mm*/ private static int jointSize = 3; + private int height = 0; + private Material tileColor = new Material("White", new float[]{1.0f, 1.0f, 1.0f}); *************** *** 83,86 **** --- 87,144 ---- space.add(startPoint); CoordinateSystem cs = startPoint; + //find outer borders + double maxX = Double.MIN_VALUE, maxY = Double.MIN_VALUE, + minX = Double.MAX_VALUE, minY = Double.MAX_VALUE; + for (Vertex v : surface.collect()) { + Vertex translated = cs.translate(v); + if (translated.getX() > maxX) { + maxX = translated.getX(); + } + if (translated.getX() < minX) { + minX = translated.getX(); + } + if (translated.getY() > maxY) { + maxY = translated.getY(); + } + if (translated.getY() < minY) { + minY = translated.getY(); + } + } + List<Surface> tiles = new LinkedList<Surface>(); + CoordinateSystem insertPoint = cs.copy(); + insertPoint.setOrigin(cs.unTranslate(new Vertex(minX + jointSize / 2000, + minY + jointSize / 2000, + 0))); + Vertex orig = insertPoint.center(); + if (height > 0) { + maxY = height / 1000; + } + Vertex horizontalAdd = insertPoint.unTranslate(new Vertex(tileSize.getWidth() / 1000.0 + jointSize / 2000.0, 0, 0)).minus(orig); + do { + Vertex verticalAdd = insertPoint.unTranslate(new Vertex(0, tileSize.getHeight() / 1000.0 + jointSize / 2000.0, 0)).minus(orig); + int iterations = 0; + do { + tiles.add(drawTile(insertPoint, tileColor)); + orig = orig.add(verticalAdd); + insertPoint.setOrigin(orig); + iterations++; + } while (cs.translate(orig.copy()).getY() < maxY); + orig = orig.add(horizontalAdd); + Vertex tmp = verticalAdd.copy(); + tmp.scale(iterations); + orig = orig.minus(tmp); + insertPoint.setOrigin(orig); + } while (cs.translate(orig.copy()).getX() < maxX); + + for (Surface s : tiles) { + List<Surface> extrusion = new ArrayList<Surface>(); + Surface back = s.extrusion(-tileThickness / 1000.0, extrusion); + extrusion.add(back); + extrusion.add(s); + space.addAll(extrusion); + } + } + + private Surface drawTile(CoordinateSystem cs, Material color) { Space tile = new Space("Tile", Space.CONSTRUCTION, Space.PART_LEVEL, true); space.add(tile); *************** *** 101,114 **** edges.add(e4); Surface front = new Surface(edges); ! front.setFrontMaterial(tileColor); front.setBackDomain(tile); ! List<Surface> extrusion = new ArrayList<Surface>(); ! Surface back = front.extrusion(-tileThickness / 1000.0, extrusion); ! extrusion.add(back); ! extrusion.add(front); ! space.addAll(extrusion); ! } /** * {@inheritDoc} --- 159,193 ---- edges.add(e4); Surface front = new Surface(edges); ! front.setFrontMaterial(color); front.setBackDomain(tile); ! return front; } + /** {@inheritDoc} */ + @Override + public List<Attribute> getAttributes() { + List<Attribute> atrib = super.getAttributes(); + + atrib.add(new Attribute("Tilewidth", new Double(tileSize.width))); + atrib.add(new Attribute("Tileheight", new Double(tileSize.height))); + atrib.add(new Attribute("Joint width", new Double(jointSize))); + atrib.add(new Attribute("Material", tileColor)); + atrib.add(new Attribute("Surface", surface)); + atrib.add(new Attribute("Setting height", new Double(height))); + return atrib; + } + + /** {@inheritDoc} */ + @Override + public void setAttributes(List<Attribute> attributes) { + super.setAttributes(attributes); + for (Attribute a : attributes) { + if (a.getName().equals("Setting height")) { + height = ((Double)a.getValue()).intValue(); + update(null); + } + } + } + /** * {@inheritDoc} Index: Modellor.java =================================================================== RCS file: /cvsroot/bprocessor//model/src/net/sourceforge/bprocessor/model/modellor/Modellor.java,v retrieving revision 1.8 retrieving revision 1.9 diff -C2 -d -r1.8 -r1.9 *** Modellor.java 15 Apr 2007 11:12:57 -0000 1.8 --- Modellor.java 16 Apr 2007 09:08:46 -0000 1.9 *************** *** 160,164 **** * @return the attributes */ ! public List getAttributes() { List<Attribute> l = new LinkedList<Attribute>(); l.add(new Attribute("Active", Boolean.valueOf(active), true)); --- 160,164 ---- * @return the attributes */ ! public List<Attribute> getAttributes() { List<Attribute> l = new LinkedList<Attribute>(); l.add(new Attribute("Active", Boolean.valueOf(active), true)); |
|
From: Nordholt <nor...@us...> - 2007-04-15 11:13:46
|
Update of /cvsroot/bprocessor/model/src/net/sourceforge/bprocessor/model/modellor In directory sc8-pr-cvs3.sourceforge.net:/tmp/cvs-serv29355/src/net/sourceforge/bprocessor/model/modellor Modified Files: Modellor.java Log Message: put correct generics on the setattributes method. Index: Modellor.java =================================================================== RCS file: /cvsroot/bprocessor/model/src/net/sourceforge/bprocessor/model/modellor/Modellor.java,v retrieving revision 1.7 retrieving revision 1.8 diff -C2 -d -r1.7 -r1.8 *** Modellor.java 10 Apr 2007 20:59:01 -0000 1.7 --- Modellor.java 15 Apr 2007 11:12:57 -0000 1.8 *************** *** 170,174 **** * @param attributes the new attributes */ ! public void setAttributes(List attributes) { Iterator it = attributes.iterator(); while (it.hasNext()) { --- 170,174 ---- * @param attributes the new attributes */ ! public void setAttributes(List<Attribute> attributes) { Iterator it = attributes.iterator(); while (it.hasNext()) { |
|
From: Nordholt <nor...@us...> - 2007-04-15 11:12:06
|
Update of /cvsroot/bprocessor/model/src/net/sourceforge/bprocessor/model In directory sc8-pr-cvs3.sourceforge.net:/tmp/cvs-serv29002/src/net/sourceforge/bprocessor/model Modified Files: Space.java Log Message: simplyfied and try to fix the delete method, still has errors though. Index: Space.java =================================================================== RCS file: /cvsroot/bprocessor/model/src/net/sourceforge/bprocessor/model/Space.java,v retrieving revision 1.133 retrieving revision 1.134 diff -C2 -d -r1.133 -r1.134 *** Space.java 14 Apr 2007 14:59:34 -0000 1.133 --- Space.java 15 Apr 2007 11:12:04 -0000 1.134 *************** *** 749,857 **** public void delete(Edge edge) { if (edge.getId() != null) { ! Set<Surface> surfaces = edge.getSurfaces(); ! Vertex to = edge.getTo(); ! Vertex from = edge.getFrom(); ! remove(edge); ! ! { ! // Find adjacent surfaces that must be combined to one surface. ! // ! // First the adjacent surfaces are partioned into groups of ! // coplanar surfaces. ! // If there is only one group consisting of two coplanar surfaces ! // these two surfaces are combined. ! ! List<List<Surface>> partions = new LinkedList<List<Surface>>(); ! List<Surface> work = new LinkedList<Surface>(surfaces); ! while (!work.isEmpty()) { ! Iterator iter = work.iterator(); ! Surface first = (Surface) iter.next(); ! iter.remove(); ! Plane plane = first.plane(); ! List<Surface> partion = new LinkedList<Surface>(); ! partion.add(first); ! while (iter.hasNext()) { ! Surface current = (Surface) iter.next(); ! if (plane.contains(current)) { ! partion.add(current); ! iter.remove(); } ! } ! partions.add(partion); ! } ! int count = 0; ! List partion = null; ! { ! Iterator<List<Surface>> iter = partions.iterator(); ! while (iter.hasNext()) { ! List current = iter.next(); ! if (current.size() == 2) { ! count++; ! partion = current; } } } ! if (count == 1) { ! Surface s1 = (Surface) partion.get(0); ! Surface s2 = (Surface) partion.get(1); ! List<Edge> edges1 = new LinkedList<Edge>(); ! List<Edge> edges2 = new LinkedList<Edge>(); ! { ! boolean gab = false; ! List<Edge> prefix = new LinkedList<Edge>(); ! Iterator iter = s1.getEdges().iterator(); ! while (iter.hasNext()) { ! Edge current = (Edge) iter.next(); ! if (!s2.contains(current)) { ! if (!gab) { ! prefix.add(current); ! } else { ! edges1.add(current); ! } ! } else { ! gab = true; ! } ! } ! edges1.addAll(prefix); ! } ! { ! boolean gab = false; ! List<Edge> prefix = new LinkedList<Edge>(); ! Iterator iter = s2.getEdges().iterator(); ! while (iter.hasNext()) { ! Edge current = (Edge) iter.next(); ! if (!s1.contains(current)) { ! if (!gab) { ! prefix.add(current); ! } else { ! edges2.add(current); ! } ! } else { ! gab = true; ! } ! } ! edges2.addAll(prefix); ! } ! if (Edge.first(edges1) == Edge.first(edges2)) { ! Collections.reverse(edges2); ! } ! edges1.addAll(edges2); ! Surface surface = new Surface(edges1); ! add(surface); ! if (s1.getExterior() != null) { ! s1.getExterior().addHole(surface); } - Surface.mergeSpaceAssign(s1, s2, surface); } } - - - Iterator it = surfaces.iterator(); - while (it.hasNext()) { - Surface surface = (Surface)it.next(); - remove(surface); - } if (to.getOwner() != null) { if (to.getEdges().size() == 0) { --- 749,820 ---- public void delete(Edge edge) { if (edge.getId() != null) { ! Set<Surface> surfaces = edge.getSurfaces(); Vertex to = edge.getTo(); ! Vertex from = edge.getFrom(); remove(edge); ! { ! if (surfaces.size() == 2) { ! Iterator<Surface> it = surfaces.iterator(); ! Surface s1 = it.next(); ! Surface s2 = it.next(); ! if (s1.plane().contains(s2)) { ! List<Edge> edges1 = edgeFirst(s1, edge); ! List<Edge> edges2 = edgeFirst(s2, edge); ! edges1.remove(edge); ! edges2.remove(edge); ! if (Edge.first(edges1) == Edge.first(edges2)) { ! Collections.reverse(edges2); } ! edges1.addAll(edges2); ! Surface surface = new Surface(edges1); ! add(surface); ! if (s1.getExterior() != null) { ! s1.getExterior().addHole(surface); ! } else if (s2.getExterior() != null) { ! s2.getExterior().addHole(surface); } + Set<Surface> holes = new HashSet<Surface>(); + holes.addAll(s1.getHoles()); + holes.addAll(s2.getHoles()); + for (Surface hole : holes) { + surface.addHole(hole); + } + Surface.mergeSpaceAssign(s1, s2, surface); } } ! } ! for (Surface surface : surfaces) { ! List<Edge> edges = surface.getEdges(); ! int firstIndex = edges.indexOf(edge); ! int lastIndex = edges.lastIndexOf(edge); ! if (firstIndex == lastIndex) { ! remove(surface); ! } else { ! int size = edges.size(); ! int gapSize = lastIndex - firstIndex; ! if ((gapSize == 1) || gapSize == size - 1) { ! edges.remove(lastIndex); ! edges.remove(firstIndex); ! surface.setEdges(edges); ! } else { ! List<Edge> head = new LinkedList<Edge>(edges.subList(0, firstIndex)); ! List<Edge> middel = new LinkedList<Edge>(edges.subList(firstIndex + 1, lastIndex)); ! List<Edge> tail = new LinkedList<Edge>(edges.subList(lastIndex, size)); ! tail.remove(edge); ! head.addAll(tail); ! Surface s1 = new Surface(head); ! Surface s2 = new Surface(middel); ! if (s1.surrounds(s2, true)) { ! surface.setEdges(head); ! add(s2); ! surface.addHole(s2); ! } else { ! surface.setEdges(middel); ! add(s1); ! surface.addHole(s1); ! } } } } if (to.getOwner() != null) { if (to.getEdges().size() == 0) { *************** *** 868,871 **** --- 831,855 ---- /** + * Takes a surface and arranges its edgelist so that + * the a specified edge in the list is the first edge in the list + * @param surface the surface + * @param first the edge the should be first in the edgelist + * @return a list of the surfaces edges arranged correctly, returns + * unaltered edgelist if the edge is not in the surface. + */ + private static List<Edge> edgeFirst(Surface s, Edge first) { + List<Edge> edges = new LinkedList<Edge>(s.getEdges()); + int index = edges.indexOf(first); + int size = edges.size(); + if (index > 0) { + List<Edge> prefix = edges.subList(0, index); + List<Edge> suffix = edges.subList(index, size); + edges = suffix; + edges.addAll(prefix); + } + return edges; + } + + /** * Return the edges * @return The edges *************** *** 927,933 **** public void remove(Surface surface) { if (surface.getHoles() != null) { ! Iterator iter = surface.getHoles().iterator(); ! while (iter.hasNext()) { ! Surface curHole = (Surface)iter.next(); if (surface.getExterior() != null) { surface.getExterior().addHole(curHole); --- 911,915 ---- public void remove(Surface surface) { if (surface.getHoles() != null) { ! for (Surface curHole : surface.getHoles()) { if (surface.getExterior() != null) { surface.getExterior().addHole(curHole); |
|
From: Nordholt <nor...@us...> - 2007-04-15 11:10:41
|
Update of /cvsroot/bprocessor/model/src/net/sourceforge/bprocessor/model In directory sc8-pr-cvs3.sourceforge.net:/tmp/cvs-serv28510/src/net/sourceforge/bprocessor/model Modified Files: Geometry.java Log Message: added the simplify geometry method. It can still cause errors, these has to do with how we delete edges. Index: Geometry.java =================================================================== RCS file: /cvsroot/bprocessor/model/src/net/sourceforge/bprocessor/model/Geometry.java,v retrieving revision 1.51 retrieving revision 1.52 diff -C2 -d -r1.51 -r1.52 *** Geometry.java 30 Mar 2007 11:11:43 -0000 1.51 --- Geometry.java 15 Apr 2007 11:10:40 -0000 1.52 *************** *** 606,609 **** --- 606,637 ---- /** + * Simplifies geometry + * @param entities a set of entities + */ + public static void simplifyGeometry(Collection<? extends Entity> entities) { + Set<Surface> surfaces = new HashSet<Surface>(); + Set<Edge> edges = new HashSet<Edge>(); + Set<Vertex> vertices = new HashSet<Vertex>(); + for (Entity ent : entities) { + if (ent instanceof Surface) { + surfaces.add((Surface)ent); + } else if (ent instanceof Edge) { + edges.add((Edge)ent); + } else if (ent instanceof Vertex) { + vertices.add((Vertex)ent); + } + } + for (Surface s : surfaces) { + edges.addAll(s.getEdges()); + } + vertices.addAll(Geometry.collect(edges)); + allPossibleCollapses(vertices); + allEdgeCollapses(edges); + surfaces.removeAll(deleteRedundantSurfaces(surfaces)); + mergeAllPossibleSurfaces(surfaces); + extendAllPossibleEdges(edges); + } + + /** * Deletes all surfaces that have the same space assignment on each side * @param surfaces a set of surfaces to delete from *************** *** 639,643 **** } } ! } } for (Edge e : mergeEdges) { --- 667,671 ---- } } ! } } for (Edge e : mergeEdges) { *************** *** 676,679 **** --- 704,755 ---- /** + * Finds sets of edges that have the same endpoints (in both ends) + * and replaces each set with a single edge. + * @param edges the edges to search + */ + public static void allEdgeCollapses(Set<Edge> edges) { + Set<Edge> collapsed = firstEdgeCollaps(edges); + while (!collapsed.isEmpty()) { + edges.removeAll(collapsed); + collapsEdges(collapsed); + collapsed = firstEdgeCollaps(edges); + } + } + + private static Set<Edge> firstEdgeCollaps(Set<Edge> edges) { + Set<Edge> collaps = new HashSet<Edge>(); + Set<Edge> unChecked = new HashSet<Edge>(edges); + for (Edge e : edges) { + unChecked.remove(e); + for (Edge ue : unChecked) { + if (e.equalsEps(ue)) { + collaps.add(ue); + } + } + if (!collaps.isEmpty()) { + collaps.add(e); + break; + } + } + return collaps; + } + + private static void collapsEdges(Set<Edge> edges) { + if (!edges.isEmpty()) { + Edge collapsEdge = edges.iterator().next(); + edges.remove(collapsEdge); + for (Edge e : edges) { + Set<Surface> surfaces = e.getSurfaces(); + for (Surface s : surfaces) { + List<Edge> edge = new LinkedList<Edge>(); + edge.add(e); + s.replace(edge, collapsEdge); + } + e.delete(); + } + } + } + + /** * Collapses a set of vertices, so that all vertices that * lies in the same coordinates are replaced with one new vertex *************** *** 729,733 **** e.setFrom(collaps); } - e.changed(); } } --- 805,808 ---- *************** *** 748,752 **** List<Edge> extendable = firstExtendList(edges); while (!extendable.isEmpty()) { - log.info("extended"); extendEdges(extendable); for (Edge e : extendable) { --- 823,826 ---- *************** *** 792,796 **** */ private static List<Edge> firstExtendList(Set<Edge> edges) { - log.info("extend set size: " + edges.size()); List<Edge> extendable = new LinkedList<Edge>(); for (Edge e : edges) { --- 866,869 ---- *************** *** 798,802 **** List<Edge> fromList = extendList(e, e.getFrom()); if (!toList.isEmpty() || !fromList.isEmpty()) { - log.info("break"); extendable.addAll(toList); extendable.add(e); --- 871,874 ---- *************** *** 805,809 **** } } - log.info("extendable size: " + extendable.size()); return extendable; } --- 877,880 ---- |
|
From: Nordholt <nor...@us...> - 2007-04-15 11:08:38
|
Update of /cvsroot/bprocessor/gui/src/net/sourceforge/bprocessor/gui In directory sc8-pr-cvs3.sourceforge.net:/tmp/cvs-serv27681/src/net/sourceforge/bprocessor/gui Modified Files: PopupMenu.java Log Message: added simplify geometry and merge surfaces to the popup menu Index: PopupMenu.java =================================================================== RCS file: /cvsroot/bprocessor/gui/src/net/sourceforge/bprocessor/gui/PopupMenu.java,v retrieving revision 1.30 retrieving revision 1.31 diff -C2 -d -r1.30 -r1.31 *** PopupMenu.java 14 Apr 2007 15:00:42 -0000 1.30 --- PopupMenu.java 15 Apr 2007 11:08:37 -0000 1.31 *************** *** 14,17 **** --- 14,18 ---- import java.util.LinkedList; import java.util.Map; + import java.util.Set; import javax.swing.AbstractAction; *************** *** 100,103 **** --- 101,121 ---- jm.add(relate); } + + JMenuItem mergeItem = new JMenuItem("Merge Surfaces"); + mergeItem.addActionListener(new CollectionMenuAction(c, "Merge Surfaces") { + public void actionPerformed(ActionEvent event) { + Set<Surface> surfaces = new HashSet<Surface>(); + Iterator it = col.iterator(); + while (it.hasNext()) { + Object o = it.next(); + if (o instanceof Surface) { + surfaces.add((Surface)o); + } + } + Geometry.mergeAllPossibleSurfaces(surfaces); + } + } + ); + jm.add(mergeItem); return jm; } *************** *** 361,364 **** --- 379,389 ---- menu.add(allConnected); + AbstractAction simplify = new EntitiesMenuAction(entities, "Simplify Geometry") { + public void actionPerformed(ActionEvent arg0) { + Geometry.simplifyGeometry(entities); + } + }; + menu.add(simplify); + AbstractAction makeUnion = new EntitiesMenuAction(entities, "Make Union") { public void actionPerformed(ActionEvent e) { |
|
From: Nordholt <nor...@us...> - 2007-04-15 11:07:47
|
Update of /cvsroot/bprocessor/gui/src/net/sourceforge/bprocessor/gui In directory sc8-pr-cvs3.sourceforge.net:/tmp/cvs-serv27277/src/net/sourceforge/bprocessor/gui Modified Files: GUI.java Log Message: Made the treeview wider Index: GUI.java =================================================================== RCS file: /cvsroot/bprocessor/gui/src/net/sourceforge/bprocessor/gui/GUI.java,v retrieving revision 1.65 retrieving revision 1.66 diff -C2 -d -r1.65 -r1.66 *** GUI.java 14 Apr 2007 14:58:09 -0000 1.65 --- GUI.java 15 Apr 2007 11:07:42 -0000 1.66 *************** *** 567,572 **** tree.addTab("Views", new CameraView()); tree.addTab("DBK", new JScrollPane (new DBKTreeView())); ! tree.setMinimumSize(new Dimension(120, 240)); ! tree.setPreferredSize(new Dimension(120, 240)); registerPanel(tree, SPLIT_LEFT); } --- 567,572 ---- tree.addTab("Views", new CameraView()); tree.addTab("DBK", new JScrollPane (new DBKTreeView())); ! tree.setMinimumSize(new Dimension(180, 240)); ! tree.setPreferredSize(new Dimension(240, 240)); registerPanel(tree, SPLIT_LEFT); } |
|
From: Nordholt <nor...@us...> - 2007-04-15 11:05:56
|
Update of /cvsroot/bprocessor/facade/src/net/sourceforge/bprocessor/facade/modellor In directory sc8-pr-cvs3.sourceforge.net:/tmp/cvs-serv26502/src/net/sourceforge/bprocessor/facade/modellor Modified Files: NetFacadeModellor.java Log Message: doing some generics Index: NetFacadeModellor.java =================================================================== RCS file: /cvsroot/bprocessor/facade/src/net/sourceforge/bprocessor/facade/modellor/NetFacadeModellor.java,v retrieving revision 1.27 retrieving revision 1.28 diff -C2 -d -r1.27 -r1.28 *** NetFacadeModellor.java 15 Apr 2007 10:40:17 -0000 1.27 --- NetFacadeModellor.java 15 Apr 2007 11:05:54 -0000 1.28 *************** *** 224,228 **** * @param attributes the new attributes */ ! public void setAttributes(List attributes) { Iterator it = attributes.iterator(); while (it.hasNext()) { --- 224,228 ---- * @param attributes the new attributes */ ! public void setAttributes(List<Attribute> attributes) { Iterator it = attributes.iterator(); while (it.hasNext()) { |
|
From: Nordholt <nor...@us...> - 2007-04-15 11:05:04
|
Update of /cvsroot/bprocessor/facade/src/net/sourceforge/bprocessor/facade In directory sc8-pr-cvs3.sourceforge.net:/tmp/cvs-serv26110/src/net/sourceforge/bprocessor/facade Modified Files: FacadeMain.java Log Message: correcting some lazy guys checkstyle errors ;-) Index: FacadeMain.java =================================================================== RCS file: /cvsroot/bprocessor/facade/src/net/sourceforge/bprocessor/facade/FacadeMain.java,v retrieving revision 1.8 retrieving revision 1.9 diff -C2 -d -r1.8 -r1.9 *** FacadeMain.java 14 Apr 2007 15:02:13 -0000 1.8 --- FacadeMain.java 15 Apr 2007 11:05:02 -0000 1.9 *************** *** 9,13 **** import net.sourceforge.bprocessor.facade.modellor.FacadeModellor; import net.sourceforge.bprocessor.facade.modellor.NetFacadeModellor; - import net.sourceforge.bprocessor.model.modellor.ModelBathModellor; import net.sourceforge.bprocessor.model.modellor.Modellor; --- 9,12 ---- |
|
From: Nordholt <nor...@us...> - 2007-04-15 11:05:02
|
Update of /cvsroot/bprocessor/gl/src/net/sourceforge/bprocessor/gl/tool In directory sc8-pr-cvs3.sourceforge.net:/tmp/cvs-serv26089/src/net/sourceforge/bprocessor/gl/tool Modified Files: SelectStrategy.java Log Message: correcting some lazy guys checkstyle errors ;-) Index: SelectStrategy.java =================================================================== RCS file: /cvsroot/bprocessor/gl/src/net/sourceforge/bprocessor/gl/tool/SelectStrategy.java,v retrieving revision 1.9 retrieving revision 1.10 diff -C2 -d -r1.9 -r1.10 *** SelectStrategy.java 14 Apr 2007 15:00:52 -0000 1.9 --- SelectStrategy.java 15 Apr 2007 11:04:57 -0000 1.10 *************** *** 156,160 **** } } else { ! log.warn("Target weren't a Geometric"); } } --- 156,160 ---- } } else { ! log.warn("Target weren't a Geometric"); } } |
|
From: Nordholt <nor...@us...> - 2007-04-15 10:45:22
|
Update of /cvsroot/bprocessor/model/src/net/sourceforge/bprocessor/model In directory sc8-pr-cvs3.sourceforge.net:/tmp/cvs-serv18389/src/net/sourceforge/bprocessor/model Modified Files: Surface.java Log Message: removed some inaccurate comments Index: Surface.java =================================================================== RCS file: /cvsroot/bprocessor/model/src/net/sourceforge/bprocessor/model/Surface.java,v retrieving revision 1.155 retrieving revision 1.156 diff -C2 -d -r1.155 -r1.156 *** Surface.java 11 Apr 2007 12:17:32 -0000 1.155 --- Surface.java 15 Apr 2007 10:45:21 -0000 1.156 *************** *** 253,257 **** while (iter.hasNext()) { vertices.add(current); ! Edge edge = (Edge) iter.next(); current = edge.otherVertex(current); if (current == null) { --- 253,257 ---- while (iter.hasNext()) { vertices.add(current); ! Edge edge = (Edge) iter.next(); current = edge.otherVertex(current); if (current == null) { *************** *** 1677,1684 **** boolean match = false; for (Edge e2 : otherEdgeList) { ! if ((e1.from.equalEps(e2.from) || ! e1.from.equalEps(e2.to)) && ! (e1.to.equalEps(e2.from) || ! e1.to.equalEps(e2.to))) { match = true; break; --- 1677,1681 ---- boolean match = false; for (Edge e2 : otherEdgeList) { ! if (e1.equalsEps(e2)) { match = true; break; *************** *** 2004,2008 **** Vertex n2 = sur2.normal(); if (n1.dot(n2) > 0) { - //the surfaces have the same turning so front is front if (sur1.getFrontDomain() == sur2.getFrontDomain()) { front = sur1.getFrontDomain(); --- 2001,2004 ---- |
|
From: Nordholt <nor...@us...> - 2007-04-15 10:43:48
|
Update of /cvsroot/bprocessor/model/src/net/sourceforge/bprocessor/model In directory sc8-pr-cvs3.sourceforge.net:/tmp/cvs-serv17606/src/net/sourceforge/bprocessor/model Modified Files: Edge.java Log Message: added an equalEps method Index: Edge.java =================================================================== RCS file: /cvsroot/bprocessor/model/src/net/sourceforge/bprocessor/model/Edge.java,v retrieving revision 1.83 retrieving revision 1.84 diff -C2 -d -r1.83 -r1.84 *** Edge.java 14 Apr 2007 15:00:47 -0000 1.83 --- Edge.java 15 Apr 2007 10:43:40 -0000 1.84 *************** *** 1106,1108 **** --- 1106,1120 ---- return true; } + + /** + * Checks if the end points of this edge are + * sufficiently close to those of an other edge + * to say that the two edges have the same endpoints + * @param e an other edge + * @return boolean value of the above + */ + public boolean equalsEps(Edge e) { + return ((from.equalEps(e.from) || from.equalEps(e.to)) && + (to.equalEps(e.from) || to.equalEps(e.to))); + } } |
|
From: Nordholt <nor...@us...> - 2007-04-15 10:43:09
|
Update of /cvsroot/bprocessor/gl/src/net/sourceforge/bprocessor/gl/view In directory sc8-pr-cvs3.sourceforge.net:/tmp/cvs-serv17474/src/net/sourceforge/bprocessor/gl/view Modified Files: View.java Log Message: added some generics, and made sure not to get a null pointer exception when something goes wrong in getting an vertexlist from a surface. Index: View.java =================================================================== RCS file: /cvsroot/bprocessor/gl/src/net/sourceforge/bprocessor/gl/view/View.java,v retrieving revision 1.200 retrieving revision 1.201 diff -C2 -d -r1.200 -r1.201 *** View.java 23 Mar 2007 13:20:04 -0000 1.200 --- View.java 15 Apr 2007 10:43:08 -0000 1.201 *************** *** 1659,1663 **** */ private void drawContour(Surface surface, GLUtessellator tess) { ! List vertices = null; try { vertices = surface.getVertices(); --- 1659,1663 ---- */ private void drawContour(Surface surface, GLUtessellator tess) { ! List<Vertex> vertices = null; try { vertices = surface.getVertices(); *************** *** 1666,1675 **** return; } ! if (vertices.size() > 0) { Vertex first = (Vertex) vertices.get(0); - Iterator iter = vertices.iterator(); glu.gluTessBeginContour(tess); ! while (iter.hasNext()) { ! Vertex current = (Vertex) iter.next(); double[] coords = new double[] {current.getX(), current.getY(), current.getZ()}; glu.gluTessVertex(tess, coords, 0, new TesselatorPoint(coords[0], coords[1], coords[2])); --- 1666,1673 ---- return; } ! if (vertices != null && vertices.size() > 0) { Vertex first = (Vertex) vertices.get(0); glu.gluTessBeginContour(tess); ! for (Vertex current : vertices) { double[] coords = new double[] {current.getX(), current.getY(), current.getZ()}; glu.gluTessVertex(tess, coords, 0, new TesselatorPoint(coords[0], coords[1], coords[2])); *************** *** 1678,1681 **** --- 1676,1682 ---- glu.gluTessVertex(tess, coords, 0, new TesselatorPoint(coords[0], coords[1], coords[2])); glu.gluTessEndContour(tess); + } else { + log.error("Did not draw suface " + surface + + " because its verticelist were null or empty"); } } |
|
From: Nordholt <nor...@us...> - 2007-04-15 10:40:26
|
Update of /cvsroot/bprocessor/facade/src/net/sourceforge/bprocessor/facade/modellor In directory sc8-pr-cvs3.sourceforge.net:/tmp/cvs-serv16302/src/net/sourceforge/bprocessor/facade/modellor Modified Files: NetFacadeModellor.java FacadeModellor.java Log Message: changing use of new integer objects to use of the static valueOf method Index: NetFacadeModellor.java =================================================================== RCS file: /cvsroot/bprocessor/facade/src/net/sourceforge/bprocessor/facade/modellor/NetFacadeModellor.java,v retrieving revision 1.26 retrieving revision 1.27 diff -C2 -d -r1.26 -r1.27 *** NetFacadeModellor.java 10 Apr 2007 20:59:05 -0000 1.26 --- NetFacadeModellor.java 15 Apr 2007 10:40:17 -0000 1.27 *************** *** 49,56 **** /** The depth of window and door frames */ ! private static final double FRAME_DEPTH = 0.05; ! ! /** The depth of window and door frames */ ! private static final double GLASS_FRAME = 0.02; /** serial id */ --- 49,53 ---- /** The depth of window and door frames */ ! private static final double FRAME_DEPTH = 0.05; /** serial id */ *************** *** 286,294 **** */ public void setNet(Space net) { ! if (this.net != null) { ! space.remove(this.net); } - this.net = (Net)net; - space.add(net); } --- 283,293 ---- */ public void setNet(Space net) { ! if (net instanceof Net) { ! if (this.net != null) { ! space.remove(this.net); ! } ! this.net = (Net)net; ! space.add(net); } } *************** *** 410,422 **** frame.removeSurface(cut2); frame1.addAll(frame2); ! space.addAll(frame1); ! frame1.removeAll(Geometry.deleteRedundantSurfaces(frame1)); ! Geometry.allPossibleCollapses(Geometry.collect(frame1)); ! Geometry.mergeAllPossibleSurfaces(frame1); ! Set<Edge> edges = new HashSet<Edge>(); ! for (Surface s : frame1) { ! edges.addAll(s.getEdges()); ! } ! Geometry.extendAllPossibleEdges(edges); } } --- 409,414 ---- frame.removeSurface(cut2); frame1.addAll(frame2); ! space.addAll(frame1); ! Geometry.simplifyGeometry(frame1); } } Index: FacadeModellor.java =================================================================== RCS file: /cvsroot/bprocessor/facade/src/net/sourceforge/bprocessor/facade/modellor/FacadeModellor.java,v retrieving revision 1.31 retrieving revision 1.32 diff -C2 -d -r1.31 -r1.32 *** FacadeModellor.java 10 Apr 2007 20:59:05 -0000 1.31 --- FacadeModellor.java 15 Apr 2007 10:40:18 -0000 1.32 *************** *** 803,811 **** m.put("front", front); m.put("frameThickness", new Double(frameWidth)); ! m.put("horPosts", new Integer(horPosts)); m.put("horPostWidth", new Double(horPostWidth)); ! m.put("vertPosts", new Integer(vertPosts)); m.put("vertPostWidth", new Double(vertPostWidth)); ! m.put("type", new Integer(type)); m.put("name", name); m.put("Space", space); --- 803,811 ---- m.put("front", front); m.put("frameThickness", new Double(frameWidth)); ! m.put("horPosts", Integer.valueOf(horPosts)); m.put("horPostWidth", new Double(horPostWidth)); ! m.put("vertPosts", Integer.valueOf(vertPosts)); m.put("vertPostWidth", new Double(vertPostWidth)); ! m.put("type", Integer.valueOf(type)); m.put("name", name); m.put("Space", space); |
Update of /cvsroot/bprocessor//gui/src/net/sourceforge/bprocessor/gui/actions In directory sc8-pr-cvs3.sourceforge.net:/tmp/cvs-serv1516/src/net/sourceforge/bprocessor/gui/actions Modified Files: CreateConstructionSpaceActionListener.java CreateNetActionListener.java CreateFunctionalSpaceActionListener.java Log Message: creat menu actions now call change to get a update in the model (tree e.t.c) when creating such Index: CreateNetActionListener.java =================================================================== RCS file: /cvsroot/bprocessor//gui/src/net/sourceforge/bprocessor/gui/actions/CreateNetActionListener.java,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** CreateNetActionListener.java 28 Nov 2006 16:15:49 -0000 1.3 --- CreateNetActionListener.java 14 Apr 2007 14:56:48 -0000 1.4 *************** *** 34,37 **** --- 34,38 ---- active.changed(); Project.getInstance().checkpoint(); + Project.getInstance().changed(active); } Index: CreateFunctionalSpaceActionListener.java =================================================================== RCS file: /cvsroot/bprocessor//gui/src/net/sourceforge/bprocessor/gui/actions/CreateFunctionalSpaceActionListener.java,v retrieving revision 1.12 retrieving revision 1.13 diff -C2 -d -r1.12 -r1.13 *** CreateFunctionalSpaceActionListener.java 31 Jan 2007 15:22:19 -0000 1.12 --- CreateFunctionalSpaceActionListener.java 14 Apr 2007 14:56:48 -0000 1.13 *************** *** 35,39 **** public void actionPerformed(ActionEvent e) { try { ! Space owner = Project.getInstance().world(); Space space; space = owner.createFunctionalSpace("Functional"); --- 35,39 ---- public void actionPerformed(ActionEvent e) { try { ! Space owner = Project.getInstance().getActiveSpace(); Space space; space = owner.createFunctionalSpace("Functional"); *************** *** 41,44 **** --- 41,45 ---- AttributeView.instance().display(space); Project.getInstance().checkpoint(); + Project.getInstance().changed(owner); } catch (Exception error) { error.printStackTrace(); Index: CreateConstructionSpaceActionListener.java =================================================================== RCS file: /cvsroot/bprocessor//gui/src/net/sourceforge/bprocessor/gui/actions/CreateConstructionSpaceActionListener.java,v retrieving revision 1.13 retrieving revision 1.14 diff -C2 -d -r1.13 -r1.14 *** CreateConstructionSpaceActionListener.java 31 Jan 2007 15:22:19 -0000 1.13 --- CreateConstructionSpaceActionListener.java 14 Apr 2007 14:56:48 -0000 1.14 *************** *** 36,40 **** public void actionPerformed(ActionEvent e) { try { ! Space owner = Project.getInstance().world(); Space space; space = owner.createConstructionSpace("Construction"); --- 36,40 ---- public void actionPerformed(ActionEvent e) { try { ! Space owner = Project.getInstance().getActiveSpace(); Space space; space = owner.createConstructionSpace("Construction"); *************** *** 42,45 **** --- 42,46 ---- AttributeView.instance().display(space); Project.getInstance().checkpoint(); + Project.getInstance().changed(owner); } catch (Exception error) { error.printStackTrace(); |
|
From: rimestad <rim...@us...> - 2007-04-14 15:44:08
|
Update of /cvsroot/bprocessor//gui/src/net/sourceforge/bprocessor/gui In directory sc8-pr-cvs3.sourceforge.net:/tmp/cvs-serv2241/src/net/sourceforge/bprocessor/gui Modified Files: GUI.java Log Message: made create menu dynamic so that only relevant modellors are shown Index: GUI.java =================================================================== RCS file: /cvsroot/bprocessor//gui/src/net/sourceforge/bprocessor/gui/GUI.java,v retrieving revision 1.64 retrieving revision 1.65 diff -C2 -d -r1.64 -r1.65 *** GUI.java 11 Apr 2007 12:20:08 -0000 1.64 --- GUI.java 14 Apr 2007 14:58:09 -0000 1.65 *************** *** 74,77 **** --- 74,80 ---- */ public class GUI extends JFrame { + /** */ + private static final long serialVersionUID = 1L; + /** The logger */ private static Logger log = Logger.getLogger(GUI.class); *************** *** 102,106 **** /** closed spaces */ ! private Set closedSpaces = new HashSet(); /** The browsing tree */ --- 105,109 ---- /** closed spaces */ ! private Set<Space> closedSpaces = new HashSet<Space>(); /** The browsing tree */ *************** *** 240,290 **** private JMenu createCreateMenu() { JMenu create = new JMenu("Create"); ! create.setMnemonic(KeyEvent.VK_C); ! JMenuItem createConstructor = new JMenuItem("Constructor"); ! createConstructor.setMnemonic(KeyEvent.VK_N); ! createConstructor.addActionListener(new CreateConstructorActionListener()); ! createConstructor.setEnabled(false); ! create.add(createConstructor); ! JMenuItem createFunctionalSpace = new JMenuItem("Functional Space"); ! createFunctionalSpace.setMnemonic(KeyEvent.VK_F); ! createFunctionalSpace.addActionListener(new CreateFunctionalSpaceActionListener()); ! create.add(createFunctionalSpace); ! JMenuItem createConstructionSpace = new JMenuItem("Construction Space"); ! createConstructionSpace.setMnemonic(KeyEvent.VK_O); ! createConstructionSpace.addActionListener(new CreateConstructionSpaceActionListener()); ! create.add(createConstructionSpace); ! ! JMenuItem createNet = new JMenuItem("B-net"); ! createNet.setMnemonic(KeyEvent.VK_N); ! createNet.addActionListener(new CreateNetActionListener()); ! create.add(createNet); ! JMenu modellorSubmenu = new JMenu("Modellors"); ! modellorSubmenu.setMnemonic(KeyEvent.VK_M); ! modellorSubmenu.addMenuListener(new MenuListener() { ! public void menuCanceled(MenuEvent e) { ! } ! public void menuDeselected(MenuEvent e) { ! } ! public void menuSelected(MenuEvent e) { ! JMenu jm = (JMenu)e.getSource(); ! jm.removeAll(); ! Space s = Project.getInstance().getActiveSpace(); ! int level = s.getLevel(); ! for (Modellor m : Modellor.getRegisteredModellors()) { ! JMenuItem mod = new JMenuItem(m.getName()); ! if (level == m.getUseableLevel()) { ! mod.addActionListener(new ModellorMenuAction(s, m)); ! jm.add(mod); } ! } } }); ! create.add(modellorSubmenu); return create; } --- 243,311 ---- private JMenu createCreateMenu() { JMenu create = new JMenu("Create"); ! create.addMenuListener(new MenuListener() { ! public void menuCanceled(MenuEvent arg0) { ! } ! public void menuDeselected(MenuEvent arg0) { ! } ! public void menuSelected(MenuEvent arg0) { ! if (!(arg0.getSource() instanceof JMenu)) { ! log.error("MenuListener reacted on wrong object " + arg0.getSource()); ! return; ! } ! JMenu create = (JMenu)arg0.getSource(); ! create.removeAll(); ! JMenuItem createConstructor = new JMenuItem("Constructor"); ! createConstructor.setMnemonic(KeyEvent.VK_N); ! createConstructor.addActionListener(new CreateConstructorActionListener()); ! createConstructor.setEnabled(false); ! create.add(createConstructor); ! int lvl = Project.getInstance().getActiveSpace().getLevel(); ! if (lvl < Space.PART_LEVEL) { ! String append = Space.levelToSting(lvl + 1); ! JMenuItem createFunctionalSpace = new JMenuItem("Functional " + append); ! createFunctionalSpace.setMnemonic(KeyEvent.VK_F); ! createFunctionalSpace.addActionListener(new CreateFunctionalSpaceActionListener()); ! create.add(createFunctionalSpace); ! JMenuItem createConstructionSpace = new JMenuItem("Construction " + append); ! createConstructionSpace.setMnemonic(KeyEvent.VK_O); ! createConstructionSpace.addActionListener(new CreateConstructionSpaceActionListener()); ! create.add(createConstructionSpace); ! } ! JMenuItem createNet = new JMenuItem("B-net"); ! createNet.setMnemonic(KeyEvent.VK_N); ! createNet.addActionListener(new CreateNetActionListener()); ! create.add(createNet); ! JMenu modellorSubmenu = new JMenu("Modellors"); ! modellorSubmenu.setMnemonic(KeyEvent.VK_M); ! modellorSubmenu.addMenuListener(new MenuListener() { ! public void menuCanceled(MenuEvent e) { ! } ! public void menuDeselected(MenuEvent e) { } ! ! public void menuSelected(MenuEvent e) { ! JMenu jm = (JMenu)e.getSource(); ! jm.removeAll(); ! Space s = Project.getInstance().getActiveSpace(); ! int level = s.getLevel(); ! for (Modellor m : Modellor.getRegisteredModellors()) { ! JMenuItem mod = new JMenuItem(m.getName()); ! if (level == m.getUseableLevel()) { ! mod.addActionListener(new ModellorMenuAction(s, m)); ! jm.add(mod); ! } ! } ! } ! }); ! create.add(modellorSubmenu); } }); ! create.setMnemonic(KeyEvent.VK_C); return create; } *************** *** 335,339 **** public void actionPerformed(ActionEvent arg0) { Selection s = Selection.primary(); ! Collection copy = Project.getInstance().getCopyBuffer(); copy.clear(); //FIXME check if it is legal to copy the selected geometry --- 356,360 ---- public void actionPerformed(ActionEvent arg0) { Selection s = Selection.primary(); ! Collection<Geometric> copy = Project.getInstance().getCopyBuffer(); copy.clear(); //FIXME check if it is legal to copy the selected geometry *************** *** 354,362 **** editPaste.addActionListener(new AbstractAction() { public void actionPerformed(ActionEvent arg0) { ! LinkedList copied = new LinkedList(); ! Collection c = Project.getInstance().getCopyBuffer(); ! Iterator iter = c.iterator(); while (iter.hasNext()) { ! Geometric g = (Geometric)iter.next(); if (g instanceof Space) { copied.add(((Space)g).copy()); --- 375,383 ---- editPaste.addActionListener(new AbstractAction() { public void actionPerformed(ActionEvent arg0) { ! LinkedList<Geometric> copied = new LinkedList<Geometric>(); ! Collection<Geometric> c = Project.getInstance().getCopyBuffer(); ! Iterator<Geometric> iter = c.iterator(); while (iter.hasNext()) { ! Geometric g = iter.next(); if (g instanceof Space) { copied.add(((Space)g).copy()); *************** *** 386,390 **** } } ! Selection.primary().retainAll(copied); } }); --- 407,411 ---- } } ! Selection.primary().set(copied); } }); *************** *** 622,625 **** --- 643,647 ---- * The run */ + @Override public void run() { while (true) { |
Update of /cvsroot/bprocessor//model/src/net/sourceforge/bprocessor/model In directory sc8-pr-cvs3.sourceforge.net:/tmp/cvs-serv3197/src/net/sourceforge/bprocessor/model Modified Files: Edge.java Vertex.java Parametric.java ParameterBlock.java Project.java Selection.java Log Message: altered selection to a generic collection og geometrics which lead to quite alot of changes Index: Edge.java =================================================================== RCS file: /cvsroot/bprocessor//model/src/net/sourceforge/bprocessor/model/Edge.java,v retrieving revision 1.82 retrieving revision 1.83 diff -C2 -d -r1.82 -r1.83 *** Edge.java 11 Apr 2007 08:44:58 -0000 1.82 --- Edge.java 14 Apr 2007 15:00:47 -0000 1.83 *************** *** 76,81 **** * @return Collection of vertices in random order */ ! public static Collection vertices(Collection edges) { ! Set vertices = new HashSet(); Iterator iter = edges.iterator(); while (iter.hasNext()) { --- 76,81 ---- * @return Collection of vertices in random order */ ! public static Collection<Vertex> vertices(Collection edges) { ! Set<Vertex> vertices = new HashSet<Vertex>(); Iterator iter = edges.iterator(); while (iter.hasNext()) { Index: Parametric.java =================================================================== RCS file: /cvsroot/bprocessor//model/src/net/sourceforge/bprocessor/model/Parametric.java,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** Parametric.java 29 Jan 2007 18:08:45 -0000 1.3 --- Parametric.java 14 Apr 2007 15:00:47 -0000 1.4 *************** *** 18,22 **** * @param attributes The attributes to set */ ! public void setAttributes(List attributes); /** --- 18,22 ---- * @param attributes The attributes to set */ ! public void setAttributes(List<Attribute> attributes); /** *************** *** 24,28 **** * @return the list of attributes for the object */ ! public List getAttributes(); /** --- 24,28 ---- * @return the list of attributes for the object */ ! public List<Attribute> getAttributes(); /** Index: ParameterBlock.java =================================================================== RCS file: /cvsroot/bprocessor//model/src/net/sourceforge/bprocessor/model/ParameterBlock.java,v retrieving revision 1.7 retrieving revision 1.8 diff -C2 -d -r1.7 -r1.8 *** ParameterBlock.java 11 Apr 2007 12:19:41 -0000 1.7 --- ParameterBlock.java 14 Apr 2007 15:00:47 -0000 1.8 *************** *** 23,27 **** /** Parameters */ ! private List parameters; /** --- 23,27 ---- /** Parameters */ ! private List<Attribute> parameters; /** *************** *** 30,34 **** public ParameterBlock() { super(); ! parameters = new LinkedList(); } --- 30,34 ---- public ParameterBlock() { super(); ! parameters = new LinkedList<Attribute>(); } *************** *** 37,41 **** * @param attributes List of Attribute */ ! public void setAttributes(List attributes) { parameters = attributes; } --- 37,41 ---- * @param attributes List of Attribute */ ! public void setAttributes(List<Attribute> attributes) { parameters = attributes; } *************** *** 45,49 **** * @return List if Attribute */ ! public List getAttributes() { return parameters; } --- 45,49 ---- * @return List if Attribute */ ! public List<Attribute> getAttributes() { return parameters; } *************** *** 88,93 **** * @return HashMap */ ! public HashMap environment() { ! HashMap env = new HashMap(); Iterator iter = parameters.iterator(); while (iter.hasNext()) { --- 88,93 ---- * @return HashMap */ ! public HashMap<String, Object> environment() { ! HashMap<String, Object> env = new HashMap<String, Object>(); Iterator iter = parameters.iterator(); while (iter.hasNext()) { Index: Project.java =================================================================== RCS file: /cvsroot/bprocessor//model/src/net/sourceforge/bprocessor/model/Project.java,v retrieving revision 1.117 retrieving revision 1.118 diff -C2 -d -r1.117 -r1.118 *** Project.java 21 Mar 2007 11:58:06 -0000 1.117 --- Project.java 14 Apr 2007 15:00:47 -0000 1.118 *************** *** 22,27 **** --- 22,31 ---- import java.util.StringTokenizer; + import net.sourceforge.bprocessor.model.modellor.Cylinder; import net.sourceforge.bprocessor.model.modellor.LayerModellor; + import net.sourceforge.bprocessor.model.modellor.ModelBathModellor; import net.sourceforge.bprocessor.model.modellor.Modellor; + import net.sourceforge.bprocessor.model.modellor.TileModellor; + import net.sourceforge.bprocessor.model.modellor.WindowModellor; import net.sourceforge.bprocessor.model.xml.Bmodel; *************** *** 108,112 **** /** The copy buffer */ ! private Collection copyBuffer; /** Flag set when updating */ --- 112,116 ---- /** The copy buffer */ ! private Collection<Geometric> copyBuffer; /** Flag set when updating */ *************** *** 155,158 **** --- 159,167 ---- globals.put("roof", 0.07); Modellor.registerModellor(new LayerModellor()); + Modellor.registerModellor(new TileModellor(null)); + Modellor.registerModellor(new Cylinder()); + Modellor.registerModellor(new WindowModellor()); + Modellor.registerModellor(new ModelBathModellor()); + try { loadClassification(true); *************** *** 1152,1156 **** * @return The copyBuffer */ ! public Collection getCopyBuffer() { return copyBuffer; } --- 1161,1165 ---- * @return The copyBuffer */ ! public Collection<Geometric> getCopyBuffer() { return copyBuffer; } Index: Vertex.java =================================================================== RCS file: /cvsroot/bprocessor//model/src/net/sourceforge/bprocessor/model/Vertex.java,v retrieving revision 1.57 retrieving revision 1.58 diff -C2 -d -r1.57 -r1.58 *** Vertex.java 23 Mar 2007 15:27:18 -0000 1.57 --- Vertex.java 14 Apr 2007 15:00:47 -0000 1.58 *************** *** 514,519 **** * @return Edges */ ! public static Set edges(Collection vertices) { ! Set edges = new HashSet(); Iterator iter = vertices.iterator(); while (iter.hasNext()) { --- 514,519 ---- * @return Edges */ ! public static Set<Edge> edges(Collection vertices) { ! Set<Edge> edges = new HashSet<Edge>(); Iterator iter = vertices.iterator(); while (iter.hasNext()) { Index: Selection.java =================================================================== RCS file: /cvsroot/bprocessor//model/src/net/sourceforge/bprocessor/model/Selection.java,v retrieving revision 1.17 retrieving revision 1.18 diff -C2 -d -r1.17 -r1.18 *** Selection.java 24 Jan 2007 15:17:50 -0000 1.17 --- Selection.java 14 Apr 2007 15:00:47 -0000 1.18 *************** *** 21,36 **** * in the userinterface. */ ! public class Selection implements Collection { /** The logger */ private static Logger log = Logger.getLogger(Selection.class); /** The collection of objects mark is used to test for membership */ ! private Set mark; /** The order of the objects */ ! private List selection; /** The observers */ ! private List observers; /** The primary selection */ --- 21,36 ---- * in the userinterface. */ ! public class Selection implements Collection<Geometric> { /** The logger */ private static Logger log = Logger.getLogger(Selection.class); /** The collection of objects mark is used to test for membership */ ! private Set<Geometric> mark; /** The order of the objects */ ! private List<Geometric> selection; /** The observers */ ! private List<Observer> observers; /** The primary selection */ *************** *** 50,56 **** public Selection() { super(); ! mark = new HashSet(); ! selection = new LinkedList(); ! observers = new LinkedList(); } --- 50,56 ---- public Selection() { super(); ! mark = new HashSet<Geometric>(); ! selection = new LinkedList<Geometric>(); ! observers = new LinkedList<Observer>(); } *************** *** 69,73 **** * @return True if changed */ ! public boolean add(Object object) { if (object == null) { throw new Error("Null object added to selection"); --- 69,73 ---- * @return True if changed */ ! public boolean add(Geometric object) { if (object == null) { throw new Error("Null object added to selection"); *************** *** 102,106 **** /** * Clear the selection ! * ONLY TO BE USED IF NOTHING IS ADDED TO THE SELECTION */ public void clear() { --- 102,106 ---- /** * Clear the selection ! * ONLY TO BE USED IF NOTHING IS ADDED TO THE SELECTION OTHERWISE USE OVERRIDE */ public void clear() { *************** *** 124,128 **** * @param object The object */ ! public void set(Object object) { clean(); add(object); --- 124,128 ---- * @param object The object */ ! public void set(Geometric object) { clean(); add(object); *************** *** 130,137 **** /** * Return an iterator * @return An iterator */ ! public Iterator iterator() { return selection.iterator(); } --- 130,146 ---- /** + * Empty the selection and add the given list instead + * @param geos the geometrics to add + */ + public void set(Collection<Geometric> geos) { + clean(); + addAll(geos); + } + + /** * Return an iterator * @return An iterator */ ! public Iterator<Geometric> iterator() { return selection.iterator(); } *************** *** 190,197 **** /** * Add all elements to array * @param array Elements to add * @return The array */ ! public Object[] toArray(Object[] array) { return selection.toArray(array); } --- 199,207 ---- /** * Add all elements to array + * @param <T> The type of the wanted array * @param array Elements to add * @return The array */ ! public <T> T[] toArray(T[] array) { return selection.toArray(array); } *************** *** 202,206 **** * @return True if all elements are contained in this selection */ ! public boolean containsAll(Collection objects) { return mark.containsAll(objects); } --- 212,216 ---- * @return True if all elements are contained in this selection */ ! public boolean containsAll(Collection<?> objects) { return mark.containsAll(objects); } *************** *** 211,224 **** * @return True if changed */ ! public boolean addAll(Collection objects) { boolean touched = false; ! Iterator iter = objects.iterator(); ! while (iter.hasNext()) { ! Object current = iter.next(); ! if (!(current instanceof Geometric)) { ! throw new Error("Illegal object added to selection " + current.getClass().getName()); ! } ! if (mark.add(current)) { ! selection.add(current); touched = true; } --- 221,229 ---- * @return True if changed */ ! public boolean addAll(Collection<? extends Geometric> objects) { boolean touched = false; ! for (Geometric current : objects) { ! if (mark.add((Geometric)current)) { ! selection.add((Geometric)current); touched = true; } *************** *** 237,241 **** * @return True if changed */ ! public boolean removeAll(Collection objects) { boolean touched = false; Iterator iter = objects.iterator(); --- 242,246 ---- * @return True if changed */ ! public boolean removeAll(Collection<?> objects) { boolean touched = false; Iterator iter = objects.iterator(); *************** *** 256,278 **** /** ! * Retain all elements in collection ! * @param objects Collection ! * @return True if changed ! */ ! public boolean retainAll(Collection objects) { ! clean(); ! addAll(objects); ! return true; ! } ! ! /** ! * Retain the given elements in collection ! * @param object the object ! * @return True if changed */ ! public boolean retain(Object object) { ! clean(); ! add(object); ! return true; } --- 261,268 ---- /** ! * {@inheritDoc} */ ! public boolean retainAll(Collection<?> objects) { ! return selection.retainAll(objects); } *************** *** 298,303 **** * @return Collection of Vertex */ ! public Set collect() { ! Set vertices = new HashSet(); Iterator iter = iterator(); while (iter.hasNext()) { --- 288,293 ---- * @return Collection of Vertex */ ! public Set<Vertex> collect() { ! Set<Vertex> vertices = new HashSet<Vertex>(); Iterator iter = iterator(); while (iter.hasNext()) { *************** *** 311,314 **** --- 301,305 ---- * @return String */ + @Override public String toString() { return selection.toString(); |
|
From: rimestad <rim...@us...> - 2007-04-14 15:11:41
|
Update of /cvsroot/bprocessor//gui/src/net/sourceforge/bprocessor/gui/treeview In directory sc8-pr-cvs3.sourceforge.net:/tmp/cvs-serv3173/src/net/sourceforge/bprocessor/gui/treeview Modified Files: GenericTreeView.java Log Message: altered selection to a generic collection og geometrics which lead to quite alot of changes Index: GenericTreeView.java =================================================================== RCS file: /cvsroot/bprocessor//gui/src/net/sourceforge/bprocessor/gui/treeview/GenericTreeView.java,v retrieving revision 1.94 retrieving revision 1.95 diff -C2 -d -r1.94 -r1.95 *** GenericTreeView.java 10 Apr 2007 13:24:45 -0000 1.94 --- GenericTreeView.java 14 Apr 2007 15:00:42 -0000 1.95 *************** *** 330,334 **** public void select(Object target) { if (target instanceof Geometric) { ! Selection.primary().add(target); } else { AttributeView.instance().display(target); --- 330,334 ---- public void select(Object target) { if (target instanceof Geometric) { ! Selection.primary().add((Geometric)target); } else { AttributeView.instance().display(target); *************** *** 1361,1365 **** GenericTreeView gtv = (GenericTreeView)event.getSource(); TreePath[] paths = gtv.getSelectionPaths(); ! LinkedList select = new LinkedList(); for (int i = 0; i < paths.length; i++) { Object o = paths[i].getLastPathComponent(); --- 1361,1365 ---- GenericTreeView gtv = (GenericTreeView)event.getSource(); TreePath[] paths = gtv.getSelectionPaths(); ! LinkedList<Geometric> select = new LinkedList<Geometric>(); for (int i = 0; i < paths.length; i++) { Object o = paths[i].getLastPathComponent(); *************** *** 1368,1382 **** Object target = node.getUserObject(); if (target instanceof Geometric) { ! select.add(target); } else if (paths.length == 1 && target instanceof Parametric) { AttributeView.instance().display(target); } } } ! Selection.primary().retainAll(select); } else { TreePath[] path = event.getPaths(); ! LinkedList deselect = new LinkedList(); for (int i = 0; i < path.length; i++) { Object object = path[i].getLastPathComponent(); --- 1368,1386 ---- Object target = node.getUserObject(); if (target instanceof Geometric) { ! select.add((Geometric)target); } else if (paths.length == 1 && target instanceof Parametric) { AttributeView.instance().display(target); + } else { + log.error("Reached empty branch in "); } + } else { + log.error("It were not a defaultMutatableNode"); } } ! Selection.primary().set(select); } else { TreePath[] path = event.getPaths(); ! LinkedList<Geometric> deselect = new LinkedList<Geometric>(); for (int i = 0; i < path.length; i++) { Object object = path[i].getLastPathComponent(); *************** *** 1385,1389 **** Object target = node.getUserObject(); if (target instanceof Geometric) { ! deselect.add(target); } } --- 1389,1393 ---- Object target = node.getUserObject(); if (target instanceof Geometric) { ! deselect.add((Geometric)target); } } |
|
From: rimestad <rim...@us...> - 2007-04-14 15:11:41
|
Update of /cvsroot/bprocessor//facade/src/net/sourceforge/bprocessor/facade In directory sc8-pr-cvs3.sourceforge.net:/tmp/cvs-serv4006/src/net/sourceforge/bprocessor/facade Modified Files: FacadeMain.java Log Message: removed modelbathmodellor registration to the project now that the class is in the modellor package Index: FacadeMain.java =================================================================== RCS file: /cvsroot/bprocessor//facade/src/net/sourceforge/bprocessor/facade/FacadeMain.java,v retrieving revision 1.7 retrieving revision 1.8 diff -C2 -d -r1.7 -r1.8 *** FacadeMain.java 10 Apr 2007 20:59:06 -0000 1.7 --- FacadeMain.java 14 Apr 2007 15:02:13 -0000 1.8 *************** *** 27,31 **** Modellor.registerModellor(new FacadeModellor()); Modellor.registerModellor(new NetFacadeModellor()); - Modellor.registerModellor(new ModelBathModellor()); } --- 27,30 ---- |
|
From: rimestad <rim...@us...> - 2007-04-14 15:11:35
|
Update of /cvsroot/bprocessor//model/src/net/sourceforge/bprocessor/model/modellor In directory sc8-pr-cvs3.sourceforge.net:/tmp/cvs-serv5210/src/net/sourceforge/bprocessor/model/modellor Modified Files: TileModellor.java Log Message: fixed compile errors Index: TileModellor.java =================================================================== RCS file: /cvsroot/bprocessor//model/src/net/sourceforge/bprocessor/model/modellor/TileModellor.java,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** TileModellor.java 14 Apr 2007 15:03:06 -0000 1.2 --- TileModellor.java 14 Apr 2007 15:05:38 -0000 1.3 *************** *** 16,20 **** import net.sourceforge.bprocessor.model.Edge; import net.sourceforge.bprocessor.model.Material; - import net.sourceforge.bprocessor.model.Project; import net.sourceforge.bprocessor.model.Relation; import net.sourceforge.bprocessor.model.Space; --- 16,19 ---- *************** *** 87,93 **** space.add(tile); Vertex v1 = cs.unTranslate(new Vertex(0.0, 0.0, 0.0)); ! Vertex v2 = cs.unTranslate(new Vertex(tileSize.getWidth()/1000.0, 0, 0)); ! Vertex v3 = cs.unTranslate(new Vertex(tileSize.getWidth()/1000.0, tileSize.getHeight()/1000.0, 0)); ! Vertex v4 = cs.unTranslate(new Vertex(0.0, tileSize.getHeight()/1000.0, 0)); Edge e1 = new Edge(v1, v2); Edge e2 = new Edge(v2, v3); --- 86,94 ---- space.add(tile); Vertex v1 = cs.unTranslate(new Vertex(0.0, 0.0, 0.0)); ! Vertex v2 = cs.unTranslate(new Vertex(tileSize.getWidth() / 1000.0, 0, 0)); ! Vertex v3 = cs.unTranslate(new Vertex(tileSize.getWidth() / 1000.0, ! tileSize.getHeight() / 1000.0, ! 0)); ! Vertex v4 = cs.unTranslate(new Vertex(0.0, tileSize.getHeight() / 1000.0, 0)); Edge e1 = new Edge(v1, v2); Edge e2 = new Edge(v2, v3); |