Update of /cvsroot/bprocessor/model/src/net/sourceforge/bprocessor/model
In directory ddv4jf1.ch3.sourceforge.com:/tmp/cvs-serv5521/src/net/sourceforge/bprocessor/model
Modified Files:
Project.java
Log Message:
Refactoring initialization
Index: Project.java
===================================================================
RCS file: /cvsroot/bprocessor/model/src/net/sourceforge/bprocessor/model/Project.java,v
retrieving revision 1.167
retrieving revision 1.168
diff -C2 -d -r1.167 -r1.168
*** Project.java 12 May 2009 11:51:19 -0000 1.167
--- Project.java 15 May 2009 08:01:43 -0000 1.168
***************
*** 105,113 ****
private static boolean doExport;
- /** The cameras */
- private HashMap cameras = new HashMap();
! /** The domain id */
! private long cameraId;
/** The constraints */
--- 105,111 ----
private static boolean doExport;
! private HashMap cameras = new HashMap();
! private long nextCameraID;
/** The constraints */
***************
*** 325,330 ****
public Project() {
super();
! setName("new project");
! setExportPath("b-processor-export.obj");
script = new Description("");
undoStack = new Stack();
--- 323,335 ----
public Project() {
super();
! initialize();
! }
!
! /**
! *
! */
! public void initialize() {
! name = "New Project";
! exportPath = "b-processor-export.obj";
script = new Description("");
undoStack = new Stack();
***************
*** 332,336 ****
copyBuffer = new LinkedList();
catalog = new LinkedList<Component>();
! resetCam();
observers = new LinkedList();
staticObservers = new LinkedList();
--- 337,344 ----
copyBuffer = new LinkedList();
catalog = new LinkedList<Component>();
! currentCamera = new Camera("(Current)",
! new double[]{6, 3, 2},
! new double[]{7, -21, 24},
! new double[]{0, 0, 1}, Camera.PERSPECTIVE);
observers = new LinkedList();
staticObservers = new LinkedList();
***************
*** 338,350 ****
world = Space.createFunctionalSpace("World");
world.setId(new Long(0));
! materials = new HashMap<Long, Material>();
nextMaterialId = 0;
add(Defaults.getFunctionalMaterial());
add(Defaults.getConstructionMaterial());
add(Defaults.getVoidMaterial());
activeCoordinateSystem = new CoordinateSystem(new Vertex(1, 0, 0), new Vertex(0, 1, 0),
new Vertex(0, 0, 1), new Vertex(0, 0, 0));
activeCoordinateSystem.setActive(true);
world.add(activeCoordinateSystem);
constraints = new LinkedList();
globals = new ParameterBlock();
--- 346,367 ----
world = Space.createFunctionalSpace("World");
world.setId(new Long(0));
! materials = new HashMap();
nextMaterialId = 0;
+ cameras = new HashMap();
+ nextCameraID = 0;
+
add(Defaults.getFunctionalMaterial());
add(Defaults.getConstructionMaterial());
add(Defaults.getVoidMaterial());
+
activeCoordinateSystem = new CoordinateSystem(new Vertex(1, 0, 0), new Vertex(0, 1, 0),
new Vertex(0, 0, 1), new Vertex(0, 0, 0));
activeCoordinateSystem.setActive(true);
world.add(activeCoordinateSystem);
+
+ // Grid grid = new Grid();
+ // world.add(grid);
+
+
constraints = new LinkedList();
globals = new ParameterBlock();
***************
*** 369,372 ****
--- 386,396 ----
/**
+ * Clear all objects
+ */
+ public void clear() {
+ initialize();
+ }
+
+ /**
*
* @param tesselator Tesselator
***************
*** 386,399 ****
/**
*
- */
- public void resetCam() {
- currentCamera = new Camera("(Current)",
- new double[]{6, 3, 2},
- new double[]{7, -21, 24},
- new double[]{0, 0, 1}, Camera.PERSPECTIVE);
- }
-
- /**
- *
* @return sensor
*/
--- 410,413 ----
***************
*** 514,534 ****
}
! /**
! * Clear all objects
! */
! public void clear() {
! world.clear();
! getCatalogObjects().clear();
! this.setActiveSpace(world);
! CoordinateSystem cs = new CoordinateSystem(new Vertex(1, 0, 0),
! new Vertex(0, 1, 0), new Vertex(0, 0, 1), new Vertex(0, 0, 0));
! world.add(cs);
! this.setActiveCoordinateSystem(cs);
! this.cameras.clear();
! this.cameraId = 0;
! cs.setActive(true);
! observers.clear();
! }
!
/**
* remove all elements in the collection from the project
--- 528,532 ----
}
!
/**
* remove all elements in the collection from the project
***************
*** 716,720 ****
*/
public void add(Camera c) {
! c.setId(new Long(cameraId++));
cameras.put(c.getId(), c);
}
--- 714,718 ----
*/
public void add(Camera c) {
! c.setId(new Long(nextCameraID++));
cameras.put(c.getId(), c);
}
|