From: <ha...@us...> - 2008-11-11 22:57:41
|
Revision: 10295 http://jmol.svn.sourceforge.net/jmol/?rev=10295&view=rev Author: hansonr Date: 2008-11-11 22:57:36 +0000 (Tue, 11 Nov 2008) Log Message: ----------- version=11.7.12_dev vertex/triangle reader (efvet) # new feature: very preliminary efvet file reader (http://ef-site.hgc.jp/eF-site) # isosurface "myfile.efvet" Modified Paths: -------------- trunk/Jmol/src/org/jmol/jvxl/readers/EfvetReader.java trunk/Jmol/src/org/jmol/jvxl/readers/SurfaceFileReader.java trunk/Jmol/src/org/jmol/jvxl/readers/SurfaceGenerator.java trunk/Jmol/src/org/jmol/jvxl/readers/SurfaceReader.java trunk/Jmol/src/org/jmol/shapesurface/Isosurface.java trunk/Jmol/src/org/jmol/viewer/Eval.java Modified: trunk/Jmol/src/org/jmol/jvxl/readers/EfvetReader.java =================================================================== --- trunk/Jmol/src/org/jmol/jvxl/readers/EfvetReader.java 2008-11-11 20:54:30 UTC (rev 10294) +++ trunk/Jmol/src/org/jmol/jvxl/readers/EfvetReader.java 2008-11-11 22:57:36 UTC (rev 10295) @@ -104,11 +104,19 @@ float value = 0; skipTo("<vertices", "count"); jvxlData.vertexCount = nVertices = parseInt(); + skipTo("property=", null); + line = line.replace('"',' '); + String[] tokens = getTokens(); + int dataIndex = params.fileIndex; + if (dataIndex > 0 && dataIndex < tokens.length) + Logger.info("property " + tokens[dataIndex]); + else + Logger.info(line); for (int i = 0; i < nVertices; i++) { skipTo("<vertex", "image"); pt.set(parseFloat(), parseFloat(), parseFloat()); lineTo("property"); - for(int j = 0; j <= dataIndex; j++) + for(int j = 0; j < dataIndex; j++) value = parseFloat(); meshDataServer.addVertexCopy(pt, value, i); } Modified: trunk/Jmol/src/org/jmol/jvxl/readers/SurfaceFileReader.java =================================================================== --- trunk/Jmol/src/org/jmol/jvxl/readers/SurfaceFileReader.java 2008-11-11 20:54:30 UTC (rev 10294) +++ trunk/Jmol/src/org/jmol/jvxl/readers/SurfaceFileReader.java 2008-11-11 22:57:36 UTC (rev 10295) @@ -30,7 +30,6 @@ abstract class SurfaceFileReader extends SurfaceReader { protected BufferedReader br; - protected int dataIndex; SurfaceFileReader(SurfaceGenerator sg, BufferedReader br) { super(sg); @@ -61,10 +60,6 @@ // required by SurfaceReader } - protected void gotoData(int n, int nPoints) throws Exception { - dataIndex = n; - } - abstract void getSurfaceData() throws Exception; ///////////file reading ////////// Modified: trunk/Jmol/src/org/jmol/jvxl/readers/SurfaceGenerator.java =================================================================== --- trunk/Jmol/src/org/jmol/jvxl/readers/SurfaceGenerator.java 2008-11-11 20:54:30 UTC (rev 10294) +++ trunk/Jmol/src/org/jmol/jvxl/readers/SurfaceGenerator.java 2008-11-11 22:57:36 UTC (rev 10295) @@ -771,6 +771,12 @@ generateSurface(); } } + + public void finalizeIsosurface() { + if (surfaceReader != null && surfaceReader.hasColorData && params.rangeDefined) + colorIsosurface(); + } + private boolean setReader(boolean isMap) { if (surfaceReader != null) return !surfaceReader.vertexDataOnly; @@ -825,10 +831,7 @@ if (haveMeshDataServer) meshDataServer.notifySurfaceGenerationCompleted(); - if (surfaceReader.hasColorData) { - colorIsosurface(); - params.state = Parameters.STATE_DATA_COLORED; - } else if (jvxlData.jvxlDataIs2dContour) { + if (jvxlData.jvxlDataIs2dContour) { surfaceReader.colorIsosurface(); params.state = Parameters.STATE_DATA_COLORED; } @@ -839,7 +842,10 @@ surfaceReader.jvxlUpdateInfo(); setMarchingSquares(surfaceReader.marchingSquares); surfaceReader.discardTempData(false); - surfaceReader = null; // resets voxel reader for mapping + if (surfaceReader.hasColorData) + params.state = Parameters.STATE_DATA_COLORED; + else + surfaceReader = null; // resets voxel reader for mapping params.mappedDataMin = Float.MAX_VALUE; } Modified: trunk/Jmol/src/org/jmol/jvxl/readers/SurfaceReader.java =================================================================== --- trunk/Jmol/src/org/jmol/jvxl/readers/SurfaceReader.java 2008-11-11 20:54:30 UTC (rev 10294) +++ trunk/Jmol/src/org/jmol/jvxl/readers/SurfaceReader.java 2008-11-11 22:57:36 UTC (rev 10295) @@ -181,6 +181,9 @@ protected boolean isXLowToHigh = false; //can be overridden in some readers by --progressive private float assocCutoff = 0.3f; + boolean vertexDataOnly; + boolean hasColorData; + SurfaceReader(SurfaceGenerator sg) { this.sg = sg; this.colorEncoder = sg.getColorEncoder(); @@ -419,8 +422,6 @@ protected final Point3f ptTemp = new Point3f(); final float[] fReturn = new float[1]; - boolean vertexDataOnly; - boolean hasColorData; public int getSurfacePointIndex(float cutoff, boolean isCutoffAbsolute, int x, int y, int z, Point3i offset, int vA, Modified: trunk/Jmol/src/org/jmol/shapesurface/Isosurface.java =================================================================== --- trunk/Jmol/src/org/jmol/shapesurface/Isosurface.java 2008-11-11 20:54:30 UTC (rev 10294) +++ trunk/Jmol/src/org/jmol/shapesurface/Isosurface.java 2008-11-11 22:57:36 UTC (rev 10295) @@ -137,8 +137,7 @@ public void initShape() { super.initShape(); myType = "isosurface"; - jvxlData = new JvxlData(); - sg = new SurfaceGenerator(viewer, this, colorEncoder, null, jvxlData); + sg = new SurfaceGenerator(viewer, this, colorEncoder, null, jvxlData = new JvxlData()); } protected void clearSg() { @@ -286,6 +285,7 @@ } if ("finalize" == propertyName) { + sg.finalizeIsosurface(); setScriptInfo(); setJvxlInfo(); clearSg(); @@ -374,7 +374,7 @@ currentMesh = thisMesh; super.setProperty(propertyName, value, bs); thisMesh = (IsosurfaceMesh) currentMesh; - jvxlData = (thisMesh == null ? null : thisMesh.jvxlData); + sg.setJvxlData(jvxlData = (thisMesh == null ? null : thisMesh.jvxlData)); } public Object getProperty(String property, int index) { @@ -772,7 +772,7 @@ } private void setJvxlInfo() { - if (sg.getJvxlData() != jvxlData) + if (sg.getJvxlData() != jvxlData || sg.getJvxlData() != thisMesh.jvxlData) jvxlData = thisMesh.jvxlData = sg.getJvxlData(); jvxlData.jvxlDefinitionLine = JvxlReader.jvxlGetDefinitionLine(jvxlData, false); Modified: trunk/Jmol/src/org/jmol/viewer/Eval.java =================================================================== --- trunk/Jmol/src/org/jmol/viewer/Eval.java 2008-11-11 20:54:30 UTC (rev 10294) +++ trunk/Jmol/src/org/jmol/viewer/Eval.java 2008-11-11 22:57:36 UTC (rev 10295) @@ -11392,10 +11392,10 @@ } if (surfaceObjectSeen && isIsosurface && !isSyntaxCheck) { + setShapeProperty(iShape, "finalize", null); + Integer n = (Integer) viewer.getShapeProperty(iShape, "count"); float[] dataRange = (float[]) viewer - .getShapeProperty(iShape, "dataRange"); - Integer n = (Integer) viewer.getShapeProperty(iShape, "count"); - setShapeProperty(iShape, "finalize", null); + .getShapeProperty(iShape, "dataRange"); String s = (String) viewer.getShapeProperty(iShape, "ID"); if (s != null) { s += " created; number of isosurfaces = " + n; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |