From: <ha...@us...> - 2009-02-23 13:50:31
|
Revision: 10672 http://jmol.svn.sourceforge.net/jmol/?rev=10672&view=rev Author: hansonr Date: 2009-02-23 13:50:28 +0000 (Mon, 23 Feb 2009) Log Message: ----------- version=11.7.27_dev # new feature: isosurface points can be retrieved using $id[n] where n=0,1,2,3... similar to $draw[n] Modified Paths: -------------- trunk/Jmol/src/org/jmol/shape/MeshCollection.java trunk/Jmol/src/org/jmol/shapespecial/Draw.java trunk/Jmol/src/org/jmol/shapesurface/IsosurfaceRenderer.java trunk/Jmol/src/org/jmol/viewer/Eval.java trunk/Jmol/src/org/jmol/viewer/Jmol.properties Modified: trunk/Jmol/src/org/jmol/shape/MeshCollection.java =================================================================== --- trunk/Jmol/src/org/jmol/shape/MeshCollection.java 2009-02-23 12:22:32 UTC (rev 10671) +++ trunk/Jmol/src/org/jmol/shape/MeshCollection.java 2009-02-23 13:50:28 UTC (rev 10672) @@ -384,9 +384,26 @@ return id; } } + if (property == "vertices") + return getVertices(currentMesh); + if (property.startsWith("getCenter:")) { + int meshIndex = getIndexFromName(property.substring(10)); + Mesh m; + return (meshIndex < 0 || (m = meshes[meshIndex]).vertices == null + || m.vertexCount <= index ? null + : index >= 0 ? m.vertices[index] : null); + + } return null; } + private Object getVertices(Mesh mesh) { + if (mesh == null) + return null; + return mesh.vertices; + } + + private void deleteMesh() { int i = 0; if (explicitID && currentMesh != null) { Modified: trunk/Jmol/src/org/jmol/shapespecial/Draw.java =================================================================== --- trunk/Jmol/src/org/jmol/shapespecial/Draw.java 2009-02-23 12:22:32 UTC (rev 10671) +++ trunk/Jmol/src/org/jmol/shapespecial/Draw.java 2009-02-23 13:50:28 UTC (rev 10672) @@ -357,20 +357,17 @@ public Object getProperty(String property, int index) { if (property == "command") return getDrawCommand(thisMesh); - if (property == "vertices") - return getPath(thisMesh); if (property == "type") return new Integer(thisMesh == null ? JmolConstants.DRAW_NONE : thisMesh.drawType); - if (property.indexOf("getSpinCenter:") == 0) - return getSpinCenter(property.substring(14), index); + if (property.indexOf("getCenter:") == 0) + return getSpinCenter(property.substring(10), index, Integer.MIN_VALUE); if (property.indexOf("getSpinAxis:") == 0) return getSpinAxis(property.substring(12), index); return super.getProperty(property, index); } - private Point3f getSpinCenter(String axisID, int modelIndex) { + private Point3f getSpinCenter(String axisID, int vertexIndex, int modelIndex) { String id; - int vertexIndex = -1; int pt = axisID.indexOf("["); int pt2; if (pt > 0) { @@ -384,7 +381,6 @@ } } else { id = axisID; - vertexIndex = -1; } int meshIndex = getIndexFromName(id); DrawMesh m; @@ -402,12 +398,6 @@ m.ptCenters == null || modelIndex < 0 ? m.axis : m.axes[modelIndex]); } - private Object getPath(Mesh mesh) { - if (mesh == null) - return null; - return mesh.vertices; - } - private boolean setDrawing() { if (thisMesh == null) allocMesh(null); Modified: trunk/Jmol/src/org/jmol/shapesurface/IsosurfaceRenderer.java =================================================================== --- trunk/Jmol/src/org/jmol/shapesurface/IsosurfaceRenderer.java 2009-02-23 12:22:32 UTC (rev 10671) +++ trunk/Jmol/src/org/jmol/shapesurface/IsosurfaceRenderer.java 2009-02-23 13:50:28 UTC (rev 10672) @@ -101,15 +101,21 @@ protected void renderPoints() { int incr = imesh.vertexIncrement; int diam = 4; - //g3d.setFont(g3d.getFontFid("Monospaced", 10)); - for (int i = (!imesh.hasGridPoints || imesh.firstRealVertex < 0 ? 0 : imesh.firstRealVertex); i < vertexCount; i += incr) { + boolean showNumbers = viewer.getTestFlag2(); + if (showNumbers) + g3d.setFont(g3d.getFontFid("Monospaced", 10)); + for (int i = (!imesh.hasGridPoints || imesh.firstRealVertex < 0 ? 0 + : imesh.firstRealVertex); i < vertexCount; i += incr) { if (vertexValues != null && Float.isNaN(vertexValues[i]) || frontOnly && transformedVectors[normixes[i]].z < 0) continue; if (imesh.vertexColixes != null) g3d.setColix(imesh.vertexColixes[i]); g3d.fillSphereCentered(diam, screens[i]); - //g3d.drawStringNoSlab(i + " " + imesh.vertexValues[i], null, screens[i].x, screens[i].y, screens[i].z); + if (showNumbers) + g3d.drawStringNoSlab(i + + (imesh.isColorSolid ? "" : " " + imesh.vertexValues[i]), null, + screens[i].x, screens[i].y, screens[i].z); } if (incr != 3) return; @@ -126,7 +132,6 @@ Graphics3D.BLUE, true, 0.5f) : Graphics3D.BLUE); for (int i = 2; i < vertexCount; i += 3) { g3d.fillSphereCentered(4, screens[i]); - //g3d.drawStringNoSlab(i + " " + imesh.vertexValues[i], null, screens[i].x, screens[i].y, screens[i].z); } } Modified: trunk/Jmol/src/org/jmol/viewer/Eval.java =================================================================== --- trunk/Jmol/src/org/jmol/viewer/Eval.java 2009-02-23 12:22:32 UTC (rev 10671) +++ trunk/Jmol/src/org/jmol/viewer/Eval.java 2009-02-23 13:50:28 UTC (rev 10672) @@ -789,7 +789,7 @@ } else if (v instanceof Point4f) { fixed[j] = new Token(Token.point4f, v); } else { - Point3f center = getDrawObjectCenter(var); + Point3f center = getObjectCenter(var, Integer.MIN_VALUE); if (center == null) error(ERROR_invalidArgument); fixed[j] = new Token(Token.point3f, center); @@ -2335,16 +2335,17 @@ if (checkToken(i)) { switch (getToken(i).tok) { case Token.dollarsign: + int index = Integer.MIN_VALUE; String id = objectNameParameter(++i); // allow for $pt2.3 -- specific vertex if (tokAt(i + 1) == Token.leftsquare) { - id += "[" + intParameter(i + 2) + "]"; + index = intParameter(i + 2); if (getToken(i + 3).tok != Token.rightsquare) error(ERROR_invalidArgument); } if (isSyntaxCheck) return new Point3f(); - if ((center = getDrawObjectCenter(id)) == null) + if ((center = getObjectCenter(id, index)) == null) error(ERROR_drawObjectNotDefined, id); break; case Token.bitset: @@ -5128,9 +5129,13 @@ isSpin, bsAtoms); } - private Point3f getDrawObjectCenter(String axisID) { - return (Point3f) viewer.getShapeProperty(JmolConstants.SHAPE_DRAW, - "getSpinCenter:" + axisID); + private Point3f getObjectCenter(String axisID, int index) { + Point3f pt = (Point3f) viewer.getShapeProperty(JmolConstants.SHAPE_DRAW, + "getCenter:" + axisID, index); + if (pt == null) + pt = (Point3f) viewer.getShapeProperty(JmolConstants.SHAPE_ISOSURFACE, + "getCenter:" + axisID, index); + return pt; } private Vector3f getDrawObjectAxis(String axisID) { Modified: trunk/Jmol/src/org/jmol/viewer/Jmol.properties =================================================================== --- trunk/Jmol/src/org/jmol/viewer/Jmol.properties 2009-02-23 12:22:32 UTC (rev 10671) +++ trunk/Jmol/src/org/jmol/viewer/Jmol.properties 2009-02-23 13:50:28 UTC (rev 10672) @@ -3,6 +3,8 @@ version=11.7.27_dev +# new feature: isosurface points can be retrieved using $id[n] where n=0,1,2,3... similar to $draw[n] +# debugging: setTestflag2() turns on vertex labeling in isosurfaces # new feature: isosurface OBJ file reader using # isosurface OBJ "myfilename" n # where n is an optional pointer to a specific group (starting with 1) This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |