Revision: 5186
Author: hansonr
Date: 2006-05-28 07:14:39 -0700 (Sun, 28 May 2006)
ViewCVS: http://svn.sourceforge.net/jmol/?rev=5186&view=rev
Log Message:
-----------
bob200603 isosurface:
-fixes delete not clearing cutoff and ranges
-adds "background" and "nobackground" as isosurface script option
Modified Paths:
--------------
branches/bob200603/Jmol/src/org/jmol/viewer/Eval.java
branches/bob200603/Jmol/src/org/jmol/viewer/Isosurface.java
branches/bob200603/Jmol/src/org/jmol/viewer/Mesh.java
branches/bob200603/Jmol/src/org/jmol/viewer/MeshCollection.java
branches/bob200603/Jmol/src/org/jmol/viewer/MeshRenderer.java
Modified: branches/bob200603/Jmol/src/org/jmol/viewer/Eval.java
===================================================================
--- branches/bob200603/Jmol/src/org/jmol/viewer/Eval.java 2006-05-28
03:37:57 UTC (rev 5185)
+++ branches/bob200603/Jmol/src/org/jmol/viewer/Eval.java 2006-05-28
14:14:39 UTC (rev 5186)
@@ -3956,11 +3956,20 @@
i = pcLastExpressionInstruction;
iHavePlane = true;
break;
+ case Token.background:
+ propertyName = "background";
+ propertyValue = Boolean.TRUE;
+ break;
case Token.identifier:
if (((String) token.value).equalsIgnoreCase("fileIndex")) {
fileIndexPt = i + 1;
break;
}
+ if (((String) token.value).equalsIgnoreCase("noBackground")) {
+ propertyName = "background";
+ propertyValue = Boolean.FALSE;
+ break;
+ }
if (((String) token.value).equalsIgnoreCase("gridPoints")) {
propertyName = "gridPoints";
break;
Modified: branches/bob200603/Jmol/src/org/jmol/viewer/Isosurface.java
===================================================================
--- branches/bob200603/Jmol/src/org/jmol/viewer/Isosurface.java 2006-05-28
03:37:57 UTC (rev 5185)
+++ branches/bob200603/Jmol/src/org/jmol/viewer/Isosurface.java 2006-05-28
14:14:39 UTC (rev 5186)
@@ -95,6 +95,7 @@
final static float defaultEdgeFractionRange = 90f;
final static int defaultColorFractionBase = 35;
final static float defaultColorFractionRange =
JmolConstants.argbsRoygbScale.length;
+ final static float defaultCutoff = 0.02f;
final Point3f volumetricOrigin = new Point3f();
final Vector3f[] volumetricVectors = new Vector3f[3];
@@ -115,7 +116,7 @@
int fileIndex = 0; //one-based
- float cutoff = 0.02f;
+ float cutoff = Float.MAX_VALUE;
boolean rangeDefined = false;
float minRange, maxRange;
@@ -137,6 +138,8 @@
thePlane = null;
addGridPoints = false;
associateNormals = true;
+ rangeDefined = false;
+ cutoff = Float.MAX_VALUE;
super.setProperty("meshID", null, null);
return;
}
@@ -175,6 +178,8 @@
currentMesh.showPoints = true;
currentMesh.hasGridPoints = true;
}
+ if (cutoff == Float.MAX_VALUE)
+ cutoff = defaultCutoff;
readData(false);
calcVoxelVertexVectors();
generateSurfaceData();
@@ -217,9 +222,18 @@
}
applyColorScale(minRange, maxRange, "roygb");
discardTempData();
- System.out.println("\n" + getJvxlFile(currentMesh, "mapped"));
+ System.out.println("\n"
+ + getJvxlFile(currentMesh, "mapped: min = " + minRange + "; max = "
+ + maxRange));
return;
}
+
+ // the following options piggyback on MeshCollection actions
+ // and thus do not return
+
+ if ("delete" == propertyName) {
+ }
+
super.setProperty(propertyName, value, bs);
}
@@ -507,6 +521,7 @@
nStructureData = parseInt(); //nStructure
nEdgeData = parseInt(); //nEdgeData
nColorData = parseInt();
+ thePlane = null;
if (nStructureData < 0) {
nEdgeData = -1;
try {
@@ -581,7 +596,9 @@
+ " points each");
for (int i = 0; i < n; i++)
if (isJvxl) {
- readJvxlDefinitionLine(false);
+ readJvxlDefinitionLine(true);
+ System.out.println("JVXL skipping: nStructureData=" + nStructureData
+ + " nEdgeData=" + nEdgeData + " iHaveColorData=" + iHaveColorData);
if (nStructureData > 0)
skipData(nPoints, true);
if (nEdgeData > 0)
@@ -598,8 +615,8 @@
while (iV < nPoints) {
line = br.readLine();
//if (iV < 1000 || nPoints - iV < 1000)
- //System.out.println(iV + " skip " + nPoints + " " + line);
- iV += (isInt ? countData(line) : line.length());
+ //System.out.println(iV + " skip " + iV + " " + nPoints + " " + line);
+ iV += (isInt ? countData(line) : uncompressString(line).length());
}
}
@@ -1259,7 +1276,7 @@
.length())) + ":1";
data += "\n" + (thePlane == null ? mesh.surfaceData : "") + compressedData;
if (msg != null)
- data += "#-------end of jvxl file " + msg + " data-------\n";
+ data += "#-------end of jvxl file data-------\n";
return data;
}
Modified: branches/bob200603/Jmol/src/org/jmol/viewer/Mesh.java
===================================================================
--- branches/bob200603/Jmol/src/org/jmol/viewer/Mesh.java 2006-05-28
03:37:57 UTC (rev 5185)
+++ branches/bob200603/Jmol/src/org/jmol/viewer/Mesh.java 2006-05-28
14:14:39 UTC (rev 5186)
@@ -43,6 +43,7 @@
float jvxlCompressionRatio;
int nBytes;
boolean hasGridPoints;
+ boolean hideBackground;
boolean visible = true;
short colix;
Modified: branches/bob200603/Jmol/src/org/jmol/viewer/MeshCollection.java
===================================================================
--- branches/bob200603/Jmol/src/org/jmol/viewer/MeshCollection.java
2006-05-28 03:37:57 UTC (rev 5185)
+++ branches/bob200603/Jmol/src/org/jmol/viewer/MeshCollection.java
2006-05-28 14:14:39 UTC (rev 5186)
@@ -88,6 +88,18 @@
}
return;
}
+
+ if ("background" == propertyName) {
+ boolean doHide = ! ((Boolean) value).booleanValue();
+ if (currentMesh != null)
+ currentMesh.hideBackground = doHide;
+ else {
+ for (int i = meshCount; --i >= 0; )
+ meshes[i].hideBackground = doHide;
+ }
+ return;
+ }
+
if ("color" == propertyName) {
if (value != null) {
colix = Graphics3D.getColix(value);
Modified: branches/bob200603/Jmol/src/org/jmol/viewer/MeshRenderer.java
===================================================================
--- branches/bob200603/Jmol/src/org/jmol/viewer/MeshRenderer.java
2006-05-28 03:37:57 UTC (rev 5185)
+++ branches/bob200603/Jmol/src/org/jmol/viewer/MeshRenderer.java
2006-05-28 14:14:39 UTC (rev 5186)
@@ -31,6 +31,9 @@
boolean iShowTriangles;
boolean iShowNormals;
+ boolean iHideBackground;
+ short backgroundColix;
+
void render1(Mesh mesh) {
if (!mesh.visible)
return;
@@ -44,7 +47,10 @@
viewer.transformPoint(vertices[i], screens[i]);
iShowTriangles = viewer.getTestFlag3();
iShowNormals = viewer.getTestFlag4();
-
+ iHideBackground = (mesh.jvxlPlane != null && mesh.hideBackground);
+ if (iHideBackground) {
+ backgroundColix = Graphics3D.getColix(viewer.getBackgroundArgb());
+ }
if (mesh.showPoints)
renderPoints(mesh, screens, vertexCount);
if (iShowNormals)
@@ -96,8 +102,13 @@
short[] normixes = mesh.normixes;
short colix = mesh.colix;
short[] vertexColixes = mesh.vertexColixes;
- for (int i = mesh.polygonCount; --i >= 0; ) {
- if (! mesh.isPolygonDisplayable(i))
+ short hideColix = 0;
+ try {
+ hideColix = vertexColixes[mesh.polygonIndexes[0][0]];
+ } catch (Exception e) {
+ }
+ for (int i = mesh.polygonCount; --i >= 0;) {
+ if (!mesh.isPolygonDisplayable(i))
continue;
int[] vertexIndexes = polygonIndexes[i];
if (vertexIndexes != null) {
@@ -112,35 +123,43 @@
} else {
colixA = colixB = colixC = colix;
}
-
+ if (iHideBackground) {
+ if (colixA == hideColix && colixB == hideColix && colixC ==
hideColix)
+ continue;
+ if (colixA == hideColix)
+ colixA = backgroundColix;
+ if (colixB == hideColix)
+ colixB = backgroundColix;
+ if (colixC == hideColix)
+ colixC = backgroundColix;
+ }
if (iB == iC) {
- g3d.fillCylinder(colixA, Graphics3D.ENDCAPS_SPHERICAL,
- (iA == iB ? 6 : 3), screens[iA], screens[iB]);
+ g3d.fillCylinder(colixA, Graphics3D.ENDCAPS_SPHERICAL, (iA == iB ? 6
+ : 3), screens[iA], screens[iB]);
} else if (vertexIndexes.length == 3) {
- if (fill)
+ if (fill)
if (iShowTriangles)
g3d.fillTriangleTest(screens[iA], colixA, normixes[iA],
- screens[iB], colixB, normixes[iB],
- screens[iC], colixC, normixes[iC]);
+ screens[iB], colixB, normixes[iB], screens[iC], colixC,
+ normixes[iC]);
else
- g3d.fillTriangle(screens[iA], colixA, normixes[iA],
- screens[iB], colixB, normixes[iB],
- screens[iC], colixC, normixes[iC]);
- else // FIX ME ... need a drawTriangle routine with multiple colors
+ g3d.fillTriangle(screens[iA], colixA, normixes[iA], screens[iB],
+ colixB, normixes[iB], screens[iC], colixC, normixes[iC]);
+ else
+ // FIX ME ... need a drawTriangle routine with multiple colors
g3d.drawTriangle(colixA, screens[iA], screens[iB], screens[iC]);
-
+
} else if (vertexIndexes.length == 4) {
int iD = vertexIndexes[3];
short colixD = vertexColixes != null ? vertexColixes[iD] : colix;
if (fill)
g3d.fillQuadrilateral(screens[iA], colixA, normixes[iA],
- screens[iB], colixB, normixes[iB],
- screens[iC], colixC, normixes[iC],
- screens[iD], colixD, normixes[iD]);
+ screens[iB], colixB, normixes[iB], screens[iC], colixC,
+ normixes[iC], screens[iD], colixD, normixes[iD]);
else
- g3d.drawQuadrilateral(colixA, screens[iA],
- screens[iB], screens[iC], screens[iD]);
-
+ g3d.drawQuadrilateral(colixA, screens[iA], screens[iB],
+ screens[iC], screens[iD]);
+
} else {
System.out.println("PmeshRenderer: polygon with > 4 sides");
}
This was sent by the SourceForge.net collaborative development platform, the
world's largest Open Source development site.
-------------------------------------------------------
All the advantages of Linux Managed Hosting--Without the Cost and Risk!
Fully trained technicians. The highest number of Red Hat certifications in
the hosting industry. Fanatical Support. Click to learn more
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=107521&bid=248729&dat=121642
_______________________________________________
Jmol-commits mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/jmol-commits