[Bprocessor-commit] model/src/net/sourceforge/bprocessor/model Space.java, 1.251, 1.252 Project.jav
Status: Pre-Alpha
Brought to you by:
henryml
From: Michael L. <he...@us...> - 2010-05-18 13:38:16
|
Update of /cvsroot/bprocessor/model/src/net/sourceforge/bprocessor/model In directory sfp-cvsdas-2.v30.ch3.sourceforge.com:/tmp/cvs-serv22842/src/net/sourceforge/bprocessor/model Modified Files: Space.java Project.java ClassificationFileReader.java Persistence.java Log Message: Index: Persistence.java =================================================================== RCS file: /cvsroot/bprocessor/model/src/net/sourceforge/bprocessor/model/Persistence.java,v retrieving revision 1.88 retrieving revision 1.89 diff -C2 -d -r1.88 -r1.89 *** Persistence.java 9 Mar 2010 13:02:00 -0000 1.88 --- Persistence.java 18 May 2010 13:38:07 -0000 1.89 *************** *** 1749,1759 **** /** * Load the DBK XML file into the project ! * @param file The file to load * @return A array of size two with the Constructional classification as the first and * Functional classification as the second * @throws Exception Either an file read exception or some exception from the JAXB framework */ ! public static Object[] loadDBK(File file) throws Exception { ! FileInputStream input = new FileInputStream(file); DBK xml = (DBK)loadFile(input); XMLSpecificTypeType rootType = xml.getXMLSpecificType(); --- 1749,1758 ---- /** * Load the DBK XML file into the project ! * @param input The file to load * @return A array of size two with the Constructional classification as the first and * Functional classification as the second * @throws Exception Either an file read exception or some exception from the JAXB framework */ ! public static Object[] loadDBK(InputStream input) throws Exception { DBK xml = (DBK)loadFile(input); XMLSpecificTypeType rootType = xml.getXMLSpecificType(); Index: Space.java =================================================================== RCS file: /cvsroot/bprocessor/model/src/net/sourceforge/bprocessor/model/Space.java,v retrieving revision 1.251 retrieving revision 1.252 diff -C2 -d -r1.251 -r1.252 *** Space.java 7 May 2010 13:35:58 -0000 1.251 --- Space.java 18 May 2010 13:38:07 -0000 1.252 *************** *** 9,12 **** --- 9,13 ---- import java.io.PrintStream; + import java.text.DecimalFormat; import java.util.ArrayList; import java.util.Collection; *************** *** 61,64 **** --- 62,66 ---- */ public static void export(List<Space> containers, PrintStream out) { + DecimalFormat format = new DecimalFormat("0.####"); List<Surface> surfaces = new LinkedList(); for (Space container : containers) { *************** *** 72,77 **** for (Vertex current : vertices) { vmap.put(current, count++); ! out.println("v " + current.getX() + ! " " + current.getZ() + " " + (-current.getY())); } for (Space container : containers) { --- 74,81 ---- for (Vertex current : vertices) { vmap.put(current, count++); ! ! ! out.println("v " + format.format(current.getX()) + ! " " + format.format(current.getZ()) + " " + format.format((-current.getY()))); } for (Space container : containers) { Index: ClassificationFileReader.java =================================================================== RCS file: /cvsroot/bprocessor/model/src/net/sourceforge/bprocessor/model/ClassificationFileReader.java,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** ClassificationFileReader.java 25 Jun 2009 22:17:30 -0000 1.6 --- ClassificationFileReader.java 18 May 2010 13:38:07 -0000 1.7 *************** *** 45,49 **** new File(args[0] + "Classification.xml")); log.info("Wrote XML"); ! Object[] loaded = Persistence.loadDBK(new File(args[0] + "Classification.xml")); construction = (Classification)loaded[0]; functional = (Classification)loaded[1]; --- 45,50 ---- new File(args[0] + "Classification.xml")); log.info("Wrote XML"); ! Object[] loaded ! = Persistence.loadDBK(new FileInputStream(new File(args[0] + "Classification.xml"))); construction = (Classification)loaded[0]; functional = (Classification)loaded[1]; Index: Project.java =================================================================== RCS file: /cvsroot/bprocessor/model/src/net/sourceforge/bprocessor/model/Project.java,v retrieving revision 1.190 retrieving revision 1.191 diff -C2 -d -r1.190 -r1.191 *** Project.java 7 May 2010 13:35:58 -0000 1.190 --- Project.java 18 May 2010 13:38:07 -0000 1.191 *************** *** 11,14 **** --- 11,15 ---- import java.io.ByteArrayOutputStream; import java.io.File; + import java.io.FileInputStream; import java.io.FileOutputStream; import java.io.IOException; *************** *** 84,87 **** --- 85,90 ---- public static final boolean SENSE = false; + private static final boolean DBK_FILE = false; + /** */ public static final boolean BRUN = false; *************** *** 445,449 **** instance = new Project(); try { ! Object[] loaded = Persistence.loadDBK(new File("Classification.xml")); constructionClas = (Classification)loaded[0]; functionalClas = (Classification)loaded[1]; --- 448,467 ---- instance = new Project(); try { ! InputStream input = null; ! ! File file = new File("Classification.xml"); ! if (file.exists() && DBK_FILE) { ! input = new FileInputStream(file); ! } else { ! ! ClassLoader cl = Thread.currentThread().getContextClassLoader(); ! URL url = cl.getResource("Classification.xml"); ! input = url.openStream(); ! if (input != null) { ! System.out.println("found classification file"); ! } ! } ! ! Object[] loaded = Persistence.loadDBK(input); constructionClas = (Classification)loaded[0]; functionalClas = (Classification)loaded[1]; *************** *** 1928,1940 **** printer.println("<Scene>"); ! for (Material current : getMaterials()) { ! current.exportXml(printer); } for (Camera current : getCameras()) { current.exportXml(printer); } - for (String current : names) { Space construct = map.get(current); --- 1946,1973 ---- printer.println("<Scene>"); ! { ! String header = "<SceneDescription" ! + " name=\"" + "Koldinghus_scene" + "\"" ! + " scale=\"0.35\"" ! + "/>"; ! printer.println(header); } + { + String header = "<MTLfile " + + " filename=\"" + "materials.mtl" + "\"" + + "/>"; + printer.println(header); + } + + // + // for (Material current : getMaterials()) { + // current.exportXml(printer); + // } + for (Camera current : getCameras()) { current.exportXml(printer); } for (String current : names) { Space construct = map.get(current); *************** *** 1944,1948 **** material = Defaults.getConstructionMaterial(); } ! String header = "<Object" + " name=\"" + current + "\"" + " material=\"" + material.getName() + "\"" --- 1977,1981 ---- material = Defaults.getConstructionMaterial(); } ! String header = "<ObjectFile" + " name=\"" + current + "\"" + " material=\"" + material.getName() + "\"" |