[Bprocessor-commit] /model/src/net/sourceforge/bprocessor/model/modellor TileModellor.java, 1.1, 1
Status: Pre-Alpha
Brought to you by:
henryml
|
From: rimestad <rim...@us...> - 2007-04-14 15:03:07
|
Update of /cvsroot/bprocessor//model/src/net/sourceforge/bprocessor/model/modellor In directory sc8-pr-cvs3.sourceforge.net:/tmp/cvs-serv4298/src/net/sourceforge/bprocessor/model/modellor Modified Files: TileModellor.java Log Message: now the tilemodellor acctually draws a single tile :-) Index: TileModellor.java =================================================================== RCS file: /cvsroot/bprocessor//model/src/net/sourceforge/bprocessor/model/modellor/TileModellor.java,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** TileModellor.java 10 Apr 2007 20:59:01 -0000 1.1 --- TileModellor.java 14 Apr 2007 15:03:06 -0000 1.2 *************** *** 11,17 **** --- 11,21 ---- import java.util.List; + import org.apache.log4j.Logger; + import net.sourceforge.bprocessor.model.CoordinateSystem; 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; import net.sourceforge.bprocessor.model.Surface; *************** *** 23,26 **** --- 27,32 ---- */ public class TileModellor extends Modellor { + /** The logger */ + private static Logger log = Logger.getLogger(TileModellor.class); private static final long serialVersionUID = 1L; *************** *** 32,36 **** private static int jointSize = 3; ! private Material tileColor = new Material("White", new float[]{.0f, .0f, .0f}); private Surface surface; --- 38,42 ---- private static int jointSize = 3; ! private Material tileColor = new Material("White", new float[]{1.0f, 1.0f, 1.0f}); private Surface surface; *************** *** 48,54 **** */ public TileModellor(Space s) { ! space = s; ! surface = s.getSurfaces().iterator().next(); ! startPoint = surface.coordinateSystem(); } --- 54,65 ---- */ public TileModellor(Space s) { ! if (s == null) { ! return; ! } else { ! space = s; ! surface = s.getEnvelope().iterator().next(); ! startPoint = surface.coordinateSystem(); ! startPoint.add(new Relation(surface, "0")); ! } } *************** *** 66,76 **** @Override public void update(Object entity) { Space tile = new Space("Tile", Space.CONSTRUCTION, Space.PART_LEVEL, true); - tile.setUnion(true); space.add(tile); ! Vertex v1 = new Vertex(0, 0, 0); ! Vertex v2 = new Vertex(tileSize.width, 0, 0); ! Vertex v3 = new Vertex(tileSize.width, tileSize.height, 0); ! Vertex v4 = new Vertex(0, tileSize.height, 0); Edge e1 = new Edge(v1, v2); Edge e2 = new Edge(v2, v3); --- 77,93 ---- @Override public void update(Object entity) { + if (space == null || surface == null) { + log.warn("Could not update modellor due to null space og surface"); + return; + } + space.clear(); + space.add(startPoint); + CoordinateSystem cs = startPoint; Space tile = new Space("Tile", Space.CONSTRUCTION, Space.PART_LEVEL, true); 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); *************** *** 84,91 **** Surface front = new Surface(edges); front.setFrontMaterial(tileColor); ! front.setFrontDomain(tile); ! space.insert(front); List<Surface> extrusion = new ArrayList<Surface>(); ! front.extrusion(tileThickness / 1000, extrusion); space.addAll(extrusion); --- 101,109 ---- 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); *************** *** 104,109 **** @Override public int getUseableLevel() { ! return Space.PART_LEVEL; } - } --- 122,134 ---- @Override public int getUseableLevel() { ! return Space.SPACE_LEVEL; ! } ! ! /** ! * {@inheritDoc} ! */ ! @Override ! public String getName() { ! return "TileModellor"; } } |