Update of /cvsroot/bprocessor//model/src/net/sourceforge/bprocessor/model/modellor
In directory sc8-pr-cvs3.sourceforge.net:/tmp/cvs-serv16270/src/net/sourceforge/bprocessor/model/modellor
Modified Files:
TileModellor.java
Log Message:
some minor changes to the tile modellor
Index: TileModellor.java
===================================================================
RCS file: /cvsroot/bprocessor//model/src/net/sourceforge/bprocessor/model/modellor/TileModellor.java,v
retrieving revision 1.11
retrieving revision 1.12
diff -C2 -d -r1.11 -r1.12
*** TileModellor.java 24 Apr 2007 12:51:17 -0000 1.11
--- TileModellor.java 4 May 2007 11:52:58 -0000 1.12
***************
*** 12,18 ****
--- 12,20 ----
import java.util.Collections;
import java.util.Comparator;
+ import java.util.HashSet;
import java.util.LinkedList;
import java.util.List;
import java.util.Map;
+ import java.util.Set;
import org.apache.log4j.Logger;
***************
*** 23,26 ****
--- 25,29 ----
import net.sourceforge.bprocessor.model.Material;
import net.sourceforge.bprocessor.model.Net;
+ import net.sourceforge.bprocessor.model.Project;
import net.sourceforge.bprocessor.model.Space;
import net.sourceforge.bprocessor.model.Surface;
***************
*** 82,85 ****
--- 85,89 ----
space.add(tileColor);
updateNet(startPoint);
+ Project.getInstance().addObserver(this);
}
}
***************
*** 106,112 ****
updateNet(startPoint);
space.add(net);
//generate the tiles from the net
! /*Surface outer = surface.copyall(space);
Collection<Surface> surs = net.getSurfaces();
int lvl = space.getLevel() + 1;
--- 110,120 ----
updateNet(startPoint);
space.add(net);
+ int sign = 1;
+ if (surface.getBackDomain() == space) {
+ sign = -1;
+ }
//generate the tiles from the net
! Surface outer = surface.copyall(space);
Collection<Surface> surs = net.getSurfaces();
int lvl = space.getLevel() + 1;
***************
*** 118,134 ****
space.addAll(newS);
Space sp = new Space("Tile", Space.CONSTRUCTION, lvl, true);
! newS.setBackDomain(sp);
! newS.setFrontMaterial(tileColor);
space.add(sp);
}
Space joint = new Space("Tile", Space.CONSTRUCTION, lvl, true);
! outer.setBackDomain(joint);
! outer.setFrontMaterial(jointMatetrial);
Collection<Surface> tmp = new LinkedList<Surface>();
Set<Surface> tmp2 = new HashSet<Surface>();
! tmp.add(outer.extrusionall(-((double)tileThickness / 1000), tmp, tmp2));
space.addAll(tmp);
! space.addAll(tmp2);*/
}
--- 126,152 ----
space.addAll(newS);
Space sp = new Space("Tile", Space.CONSTRUCTION, lvl, true);
! if (sign == -1) {
! newS.setBackDomain(sp);
! newS.setFrontMaterial(tileColor);
! } else {
! newS.setFrontDomain(sp);
! newS.setBackMaterial(tileColor);
! }
space.add(sp);
}
Space joint = new Space("Tile", Space.CONSTRUCTION, lvl, true);
! if (sign == -1) {
! outer.setBackDomain(joint);
! outer.setFrontMaterial(jointMatetrial);
! } else {
! outer.setFrontDomain(joint);
! outer.setBackMaterial(jointMatetrial);
! }
Collection<Surface> tmp = new LinkedList<Surface>();
Set<Surface> tmp2 = new HashSet<Surface>();
! tmp.add(outer.extrusionall(sign * ((double)tileThickness / 1000), tmp, tmp2));
space.addAll(tmp);
! space.addAll(tmp2);
}
***************
*** 333,345 ****
}
a = attributes.get("Surface");
! if (a != null) {
! Surface tmp = (Surface)a.getValue();
! if (space.getEnvelope().contains(tmp)) {
! if (!tmp.equals(surface)) {
! surface = tmp;
! startPoint = surface.coordinateSystem();
! updateNet = true;
}
}
}
a = attributes.get("Setting height");
--- 351,369 ----
}
a = attributes.get("Surface");
! if (a != null && a.getValue() != null) {
! Surface chosen = null;
! for (Surface cur : space.getEnvelope()) {
! if (cur.getName().equalsIgnoreCase((String)a.getValue())) {
! chosen = cur;
}
}
+ if (chosen != null) {
+ surface = chosen;
+ space.getOwner().remove(startPoint);
+ startPoint = surface.coordinateSystem();
+ space.getOwner().add(startPoint);
+ startPoint.relate(surface);
+ updateNet = true;
+ }
}
a = attributes.get("Setting height");
***************
*** 414,417 ****
--- 438,442 ----
height = (Integer)o;
}
+ Project.getInstance().addObserver(this);
}
|