Update of /cvsroot/bprocessor/model/src/net/sourceforge/bprocessor/model
In directory sc8-pr-cvs3.sourceforge.net:/tmp/cvs-serv3360/src/net/sourceforge/bprocessor/model
Modified Files:
Project.java
Log Message:
Put the Landmålergården import in its own class CVSreader (that is removed it from Project) Fixed it in many ways, so that it now reads surfaces and spaces but there are still some major flaws
Index: Project.java
===================================================================
RCS file: /cvsroot/bprocessor/model/src/net/sourceforge/bprocessor/model/Project.java,v
retrieving revision 1.112
retrieving revision 1.113
diff -C2 -d -r1.112 -r1.113
*** Project.java 29 Jan 2007 14:56:50 -0000 1.112
--- Project.java 30 Jan 2007 19:50:39 -0000 1.113
***************
*** 11,15 ****
import java.io.File;
import java.io.FileInputStream;
- import java.io.IOException;
import java.io.InputStreamReader;
import java.util.ArrayList;
--- 11,14 ----
***************
*** 1129,1187 ****
return copyBuffer;
}
-
- /**
- * Load a file
- * @param lfile The file to load
- * @throws IOException
- * @exception IOException Thrown if an exception occurs
- */
- public void importCSV(File lfile) throws IOException {
- System.out.println("import file");
- BufferedReader bf;
- bf = new BufferedReader(
- new InputStreamReader(new FileInputStream(lfile)));
- String current = "";
- Vertex firstVer = null;
- Vertex fromVer = null;
- Vertex toVer;
- double x = 0;
- double y = 0;
- double z = 0;
- int curId = 0;
- int lastId = 0;
- int i = 0;
- List<Edge> newEdges = new LinkedList<Edge>();
- current = bf.readLine();
- while (current != null) {
- StringTokenizer st = new StringTokenizer(current, ";");
- st.nextToken();
- st.nextToken();
- y = Double.parseDouble(st.nextToken());
- x = Double.parseDouble(st.nextToken());
- z = Double.parseDouble(st.nextToken());
- st.nextToken();
- curId = Integer.parseInt(st.nextToken());
-
- if (curId <= lastId) {
- newEdges.add(new Edge(fromVer, firstVer));
- lastId = 0;
- }
-
- if (curId == 1) {
- firstVer = new Vertex(x, y, z);
- fromVer = new Vertex(x, y, z);
- lastId = curId;
- }
-
- if (curId >= lastId && curId > 1) {
- toVer = new Vertex(x, y, z);
- newEdges.add(new Edge(fromVer, toVer));
- fromVer = toVer;
- lastId = curId;
- }
- current = bf.readLine();
- }
- Project.getInstance().world().insert(newEdges);
- }
-
}
--- 1128,1130 ----
|