public void loadSession(final String file) throws IOException { removeAllContents(); SaveSession.loadScene(this, file); }
/** * Close this universe. Remove all Contents and release all resources. */ @Override public void cleanup() { timeline.pause(); removeAllContents(); contents.clear(); universes.remove(this); adder.shutdownNow(); executer.flush(); final WindowListener[] ls = plDialog.getWindowListeners(); for (final WindowListener l : ls) plDialog.removeWindowListener(l); plDialog.dispose(); super.cleanup(); }
public static void loadScene(final Image3DUniverse univ, final String path) throws IOException { final BufferedReader in = new BufferedReader(new FileReader(path)); final SaveSession sase = new SaveSession(); univ.removeAllContents(); final HashMap<String, String> view = sase.readView(in, univ); final boolean b = univ.getAutoAdjustView(); Content c = null; while ((c = sase.readContent(in)) != null) { // TODO c.setPointListDialog(univ.getPointListDialog()); univ.addContent(c); } in.close(); sase.apply(view, univ); }
public void displayCase(Image3DUniverse univ, int caseNo) { System.out.println("Case no " + caseNo); int threshold = 120; BranchGroup scene = univ.getScene(); for(int i = scene.numChildren()-1; i >= 1 ; i--) { if (scene.getChild(i) instanceof BranchGroup) if (scene.getChild(i).getCapability(BranchGroup.ALLOW_DETACH)) scene.removeChild(i); } System.out.println("Nr. of contents:" + univ.getContents().size()); univ.removeAllContents(); createCase(caseNo); Volume volume = new Volume(image); List l = MCCube.getTriangles(volume, threshold); univ.addTriangleMesh(l, RED, "case" + caseNo); for(int z = 0; z < data.length; z++) { for(int y = 0; y < 2; y++) { for(int x = 0; x < 2; x++) { if(((int)data[z][y*2+x]&0xff)>=threshold) { addVertex(univ, RED, x, y, z); } else { addVertex(univ, GREY, x, y, z); } } } } }