From: <ha...@us...> - 2010-04-30 16:45:19
|
Revision: 12989 http://jmol.svn.sourceforge.net/jmol/?rev=12989&view=rev Author: hansonr Date: 2010-04-30 16:45:12 +0000 (Fri, 30 Apr 2010) Log Message: ----------- version=12.0.RC10_dev # bug fix: isosurface LATTICE option not generating copies for export # code: all exporters may write files directly (was just POVRAY) Modified Paths: -------------- trunk/Jmol/src/org/jmol/api/JmolRendererInterface.java trunk/Jmol/src/org/jmol/export/Export3D.java trunk/Jmol/src/org/jmol/export/_IdtfExporter.java trunk/Jmol/src/org/jmol/export/_PovrayExporter.java trunk/Jmol/src/org/jmol/export/_TachyonExporter.java trunk/Jmol/src/org/jmol/export/___Exporter.java trunk/Jmol/src/org/jmol/g3d/Graphics3D.java trunk/Jmol/src/org/jmol/script/ScriptEvaluator.java trunk/Jmol/src/org/jmol/shape/MeshRenderer.java trunk/Jmol/src/org/jmol/viewer/Jmol.properties trunk/Jmol/src/org/jmol/viewer/Viewer.java Modified: trunk/Jmol/src/org/jmol/api/JmolRendererInterface.java =================================================================== --- trunk/Jmol/src/org/jmol/api/JmolRendererInterface.java 2010-04-30 14:11:36 UTC (rev 12988) +++ trunk/Jmol/src/org/jmol/api/JmolRendererInterface.java 2010-04-30 16:45:12 UTC (rev 12989) @@ -20,6 +20,8 @@ public abstract int getExportType(); + public abstract String getExportName(); + public abstract boolean initializeExporter(String type, Viewer viewer, Graphics3D g3d, Object output); @@ -295,7 +297,7 @@ short normixC, Point3i screenD, short colixD, short normixD); - public abstract void drawSurface(MeshSurface meshSurface, Point3f[] vertices); + public abstract void drawSurface(MeshSurface meshSurface, Point3f[] vertices, Point3f offset); public abstract boolean isInDisplayRange(int x, int y); Modified: trunk/Jmol/src/org/jmol/export/Export3D.java =================================================================== --- trunk/Jmol/src/org/jmol/export/Export3D.java 2010-04-30 14:11:36 UTC (rev 12988) +++ trunk/Jmol/src/org/jmol/export/Export3D.java 2010-04-30 16:45:12 UTC (rev 12989) @@ -56,6 +56,8 @@ private int width; private int height; private int slab; + + String exportName; public Export3D() { hermite3d = new Hermite3D(this); @@ -66,8 +68,13 @@ return exporter.exportType; } + public String getExportName() { + return exportName; + } + public boolean initializeExporter(String type, Viewer viewer, Graphics3D g3d, Object output) { + exportName = type; try { String name = "org.jmol.export._" + (false && type.equals("Povray") ? "NewPovray" : type) + "Exporter"; @@ -656,14 +663,14 @@ colixD, normixD); } - public void drawSurface(MeshSurface meshSurface, Point3f[] vertices) { + public void drawSurface(MeshSurface meshSurface, Point3f[] vertices, Point3f offset) { exporter.drawSurface(meshSurface.vertexCount, meshSurface.polygonCount, meshSurface.haveQuads ? 4 : 3, vertices == null ? meshSurface.vertices : vertices, meshSurface.vertexNormals, meshSurface.isColorSolid ? null : meshSurface.vertexColixes, meshSurface.polygonIndexes, meshSurface.isColorSolid ? meshSurface.polygonColixes : null, - meshSurface.bsFaces, meshSurface.colix, null); + meshSurface.bsFaces, meshSurface.colix, offset); } public short[] getBgColixes(short[] bgcolixes) { Modified: trunk/Jmol/src/org/jmol/export/_IdtfExporter.java =================================================================== --- trunk/Jmol/src/org/jmol/export/_IdtfExporter.java 2010-04-30 14:11:36 UTC (rev 12988) +++ trunk/Jmol/src/org/jmol/export/_IdtfExporter.java 2010-04-30 16:45:12 UTC (rev 12989) @@ -158,6 +158,7 @@ } */ + private AxisAngle4f viewpoint = new AxisAngle4f(); private boolean haveSphere; private boolean haveCylinder; Modified: trunk/Jmol/src/org/jmol/export/_PovrayExporter.java =================================================================== --- trunk/Jmol/src/org/jmol/export/_PovrayExporter.java 2010-04-30 14:11:36 UTC (rev 12988) +++ trunk/Jmol/src/org/jmol/export/_PovrayExporter.java 2010-04-30 16:45:12 UTC (rev 12989) @@ -47,7 +47,6 @@ String finalizeOutput() { super.finalizeOutput(); - System.out.println("POVRAY FINALIZED"); return getAuxiliaryFileData(); } Modified: trunk/Jmol/src/org/jmol/export/_TachyonExporter.java =================================================================== --- trunk/Jmol/src/org/jmol/export/_TachyonExporter.java 2010-04-30 14:11:36 UTC (rev 12988) +++ trunk/Jmol/src/org/jmol/export/_TachyonExporter.java 2010-04-30 16:45:12 UTC (rev 12989) @@ -203,7 +203,7 @@ viewer.unTransformPoint(screenTip, tempP2); radius = viewer.unscaleToScreen(screenBase.z, radius); Matrix3f matRotateScale = getRotationMatrix(tempP1, tempP2, radius); - jmolRenderer.drawSurface(getConeMesh(tempP1, matRotateScale, colix), null); + jmolRenderer.drawSurface(getConeMesh(tempP1, matRotateScale, colix), null, null); } protected void outputCylinder(Point3f screenA, Point3f screenB, Modified: trunk/Jmol/src/org/jmol/export/___Exporter.java =================================================================== --- trunk/Jmol/src/org/jmol/export/___Exporter.java 2010-04-30 14:11:36 UTC (rev 12988) +++ trunk/Jmol/src/org/jmol/export/___Exporter.java 2010-04-30 16:45:12 UTC (rev 12989) @@ -292,8 +292,9 @@ os = null; } catch (IOException e) { e.printStackTrace(); + return "ERROR EXPORTING FILE"; } - return null; + return "OK " + nBytes + " " + jmolRenderer.getExportName() + " " + fileName ; } protected static String getExportDate() { Modified: trunk/Jmol/src/org/jmol/g3d/Graphics3D.java =================================================================== --- trunk/Jmol/src/org/jmol/g3d/Graphics3D.java 2010-04-30 14:11:36 UTC (rev 12988) +++ trunk/Jmol/src/org/jmol/g3d/Graphics3D.java 2010-04-30 16:45:12 UTC (rev 12989) @@ -1457,7 +1457,7 @@ screenD, colixD, normixD); } - public void drawSurface(MeshSurface meshSurface, Point3f[] vertices) { + public void drawSurface(MeshSurface meshSurface, Point3f[] vertices, Point3f offset) { // Export3D only } @@ -2901,6 +2901,10 @@ return EXPORT_NOT; } + public String getExportName() { + return null; + } + public boolean canDoTriangles() { return true; } Modified: trunk/Jmol/src/org/jmol/script/ScriptEvaluator.java =================================================================== --- trunk/Jmol/src/org/jmol/script/ScriptEvaluator.java 2010-04-30 14:11:36 UTC (rev 12988) +++ trunk/Jmol/src/org/jmol/script/ScriptEvaluator.java 2010-04-30 16:45:12 UTC (rev 12989) @@ -12145,25 +12145,30 @@ if (isExport) { // POV-Ray uses a BufferedWriter instead of a StringBuffer. boolean isPovRay = type.equals("Povray"); - data = viewer.generateOutput(data, isPovRay ? fileName : null, width, - height); + // todo -- there's no reason this data has to be done this way. + // we could send all of them out to file directly + data = viewer.generateOutput(data, fileName, width, height); if (data == null || data.length() == 0) return ""; + if (!isCommand) + return data; if (isPovRay) { - if (!isCommand) - return data; fileName = data.substring(data.indexOf("File created: ") + 14); fileName = fileName.substring(0, fileName.indexOf("\n")); fileName = fileName.substring(0, fileName.lastIndexOf(" (")); msg = viewer.createImage(fileName + ".ini", "ini", data, Integer.MIN_VALUE, 0, 0, null, fullPath); - if (msg != null) { - if (!msg.startsWith("OK")) - evalError(msg, null); - scriptStatusOrBuffer("Created " + fullPath[0] + ":\n\n" + data); - } - return ""; + data = "Created " + fullPath[0] + ":\n\n" + data; + } else { + msg = data; } + if (msg != null) { + if (!msg.startsWith("OK")) + evalError(msg, null); + scriptStatusOrBuffer(data); + } + return ""; + } else if (data == "MENU") { data = viewer.getMenu(""); } else if (data == "PGRP") { Modified: trunk/Jmol/src/org/jmol/shape/MeshRenderer.java =================================================================== --- trunk/Jmol/src/org/jmol/shape/MeshRenderer.java 2010-04-30 14:11:36 UTC (rev 12988) +++ trunk/Jmol/src/org/jmol/shape/MeshRenderer.java 2010-04-30 16:45:12 UTC (rev 12989) @@ -49,6 +49,7 @@ protected float width; protected boolean isTranslucent; protected Point4f thePlane; + protected Point3f latticeOffset = new Point3f(); protected final Point3f pt1f = new Point3f(); protected final Point3f pt2f = new Point3f(); @@ -71,7 +72,7 @@ return false; if (!g3d.setColix(colix) && !mesh.showContourLines) return mesh.title != null; - + latticeOffset.set(0, 0, 0); for (int i = vertexCount; --i >= 0;) viewer.transformPoint(vertices[i], screens[i]); render2(exportType != Graphics3D.EXPORT_NOT); @@ -79,7 +80,6 @@ SymmetryInterface unitcell = viewer.getModelUnitCell(mesh.modelIndex); if (unitcell != null) { Point3f vTemp = new Point3f(); - Point3f offset = new Point3f(); Point3i minXYZ = new Point3i(); Point3i maxXYZ = new Point3i((int) mesh.lattice.x, (int) mesh.lattice.y, (int) mesh.lattice.z); @@ -89,11 +89,11 @@ for (int tz = minXYZ.z; tz < maxXYZ.z; tz++) { if (tx == 0 && ty == 0 && tz == 0) continue; - offset.set(tx, ty, tz); - unitcell.toCartesian(offset); + latticeOffset.set(tx, ty, tz); + unitcell.toCartesian(latticeOffset); for (int i = vertexCount; --i >= 0;) { vTemp.set(vertices[i]); - vTemp.add(offset); + vTemp.add(latticeOffset); viewer.transformPoint(vTemp, screens[i]); } render2(exportType != Graphics3D.EXPORT_NOT); @@ -319,7 +319,7 @@ protected void exportSurface() { mesh.vertexNormals = mesh.getNormals(vertices); mesh.bsFaces = bsFaces; - g3d.drawSurface(mesh, mesh.offsetVertices); + g3d.drawSurface(mesh, mesh.offsetVertices, latticeOffset); mesh.vertexNormals = null; mesh.bsFaces = null; } Modified: trunk/Jmol/src/org/jmol/viewer/Jmol.properties =================================================================== --- trunk/Jmol/src/org/jmol/viewer/Jmol.properties 2010-04-30 14:11:36 UTC (rev 12988) +++ trunk/Jmol/src/org/jmol/viewer/Jmol.properties 2010-04-30 16:45:12 UTC (rev 12989) @@ -1,8 +1,11 @@ # Developers: to add a description of changes you have made, # add it on a line starting with # below the "version=..." line -version=12.0.RC9_dev +version=12.0.RC10_dev +# bug fix: isosurface LATTICE option not generating copies for export +# code: all exporters may write files directly (was just POVRAY) + # -------------------------------------------------------------- #version=12.0.RC9 Modified: trunk/Jmol/src/org/jmol/viewer/Viewer.java =================================================================== --- trunk/Jmol/src/org/jmol/viewer/Viewer.java 2010-04-30 14:11:36 UTC (rev 12988) +++ trunk/Jmol/src/org/jmol/viewer/Viewer.java 2010-04-30 16:45:12 UTC (rev 12989) @@ -3561,9 +3561,11 @@ int height) { if (isDataOnly) return ""; - fileName = getFileNameFromDialog(fileName, Integer.MIN_VALUE); - if (fileName == null) - return null; + if (fileName != null) { + fileName = getFileNameFromDialog(fileName, Integer.MIN_VALUE); + if (fileName == null) + return null; + } mustRender = true; int saveWidth = dimScreen.width; int saveHeight = dimScreen.height; @@ -7527,6 +7529,8 @@ } private String getFileNameFromDialog(String fileName, int quality) { + if (fileName == null) + return null; boolean useDialog = (fileName.indexOf("?") == 0); if (useDialog) fileName = fileName.substring(1); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |