Thread: [Bprocessor-commit] model/src/net/sourceforge/bprocessor/model/modellor TileModellor.java, 1.6, 1.
Status: Pre-Alpha
Brought to you by:
henryml
|
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 ---- |