Revision: 5229
Author: hansonr
Date: 2006-06-16 16:27:41 -0700 (Fri, 16 Jun 2006)
ViewCVS: http://svn.sourceforge.net/jmol/?rev=5229&view=rev
Log Message:
-----------
bob200603 dipole part 2, and associated modifications to mesh-based objects
Modified Paths:
--------------
branches/bob200603/Jmol/src/org/jmol/viewer/Draw.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/ModelManager.java
branches/bob200603/Jmol/src/org/jmol/viewer/Pmesh.java
Modified: branches/bob200603/Jmol/src/org/jmol/viewer/Draw.java
===================================================================
--- branches/bob200603/Jmol/src/org/jmol/viewer/Draw.java 2006-06-16
23:26:27 UTC (rev 5228)
+++ branches/bob200603/Jmol/src/org/jmol/viewer/Draw.java 2006-06-16
23:27:41 UTC (rev 5229)
@@ -69,7 +69,7 @@
isPlane = isVertices = isPerpendicular = false;
isVisible = isValid = true;
length = Float.MAX_VALUE;
- super.setProperty("meshID", null, null);
+ super.setProperty("thisID", null, null);
return;
}
@@ -134,8 +134,8 @@
}
if ("identifier" == propertyName) {
- String meshID = (String) value;
- int meshIndex = getMeshIndex(meshID);
+ String thisID = (String) value;
+ int meshIndex = getIndexFromName(thisID);
if (meshIndex >= 0) {
reversePoints[nidentifiers] = isReversed;
useVertices[nidentifiers] = isVertices;
Modified: branches/bob200603/Jmol/src/org/jmol/viewer/Isosurface.java
===================================================================
--- branches/bob200603/Jmol/src/org/jmol/viewer/Isosurface.java 2006-06-16
23:26:27 UTC (rev 5228)
+++ branches/bob200603/Jmol/src/org/jmol/viewer/Isosurface.java 2006-06-16
23:27:41 UTC (rev 5229)
@@ -108,7 +108,7 @@
final static int defaultColorNegative = Graphics3D.getArgbFromString("red");
final static int defaultColorPositive = Graphics3D.getArgbFromString("blue");
final static float defaultSolventRadius = 1.2f;
-
+ boolean writePrecisionColor;
boolean colorBySign;
int colorNeg;
int colorPos;
@@ -187,6 +187,7 @@
force2SidedTriangles = true;
rangeDefined = false;
mappedDataMin = Float.MAX_VALUE;
+ writePrecisionColor = false;
thisContour = -1;
iDoContourPlane = true;
dataIsJvxl2dContour = false;
@@ -201,7 +202,7 @@
center.set(Float.MAX_VALUE, Float.MAX_VALUE, Float.MAX_VALUE);
anisotropy[0] = anisotropy[1] = anisotropy[2] = 1f;
cutoff = Float.MAX_VALUE;
- super.setProperty("meshID", null, null);
+ super.setProperty("thisID", null, null);
return;
}
@@ -213,6 +214,11 @@
return;
}
+ if ("remappable" == propertyName) {
+ writePrecisionColor = true;
+ return;
+ }
+
if ("center" == propertyName) {
center.set((Point3f) value);
return;
@@ -377,12 +383,17 @@
checkFlags();
if (thePlane == null) {
readData(true);
+ if (isJvxlColorMapped) {
+ jvxlReadColorData(currentMesh, "roygb");
+ } else {
+ colorIsosurface();
+ }
} else {
createIsosurface();
initializeMesh(true);
readVolumetricData(true);
+ colorIsosurface();
}
- colorIsosurface();
discardTempData(true);
currentMesh.nBytes = nBytes;
System.out.println("\n" + jvxlGetFile(currentMesh, jvxlFileMessage));
@@ -511,7 +522,6 @@
void readData(boolean isMapData) {
isJvxl = false;
endOfData = false;
-
int nSurfaces = readVolumetricHeader();
if (nSurfaces < fileIndex) {
System.out
@@ -519,7 +529,16 @@
+ nSurfaces);
fileIndex = nSurfaces;
}
- readVolumetricData(isMapData);
+ if (isJvxl && isMapData)
+ try {
+ int nPoints = nPointsX * nPointsY * nPointsZ;
+ gotoData(fileIndex - 1, nPoints);
+ skipJvxlData(nPoints, false);
+ } catch (Exception e) {
+ e.printStackTrace();
+ }
+ else
+ readVolumetricData(isMapData);
}
void discardTempData(boolean discardAll) {
@@ -949,20 +968,22 @@
System.out.println("JVXL skipping: nStructureData=" + nStructureData
+ " nEdgeData=" + nEdgeData + " isJvxlColorMapped="
+ isJvxlColorMapped);
- if (nStructureData > 0)
- skipData(nPoints, true);
- if (nEdgeData > 0)
- skipData(nEdgeData, false);
- if (isJvxlColorMapped)
- skipData(nColorData, false);
+ skipJvxlData(nPoints, true);
} else {
skipData(nPoints, true);
}
-
if (isJvxl)
jvxlReadDefinitionLine(true);
}
+ void skipJvxlData(int nPoints, boolean doSkipColorData) throws Exception {
+ if (nStructureData > 0)
+ skipData(nPoints, true);
+ if (nEdgeData > 0)
+ skipData(nEdgeData, false);
+ if (isJvxlColorMapped && doSkipColorData)
+ skipData(nColorData, false);
+ }
void skipData(int nPoints, boolean isInt) throws Exception {
int iV = 0;
while (iV < nPoints) {
@@ -1113,6 +1134,8 @@
String list = "";
String list1 = "";
int incr = (mesh.hasGridPoints && mesh.jvxlPlane == null ? 3 : 1);
+ if (writePrecisionColor)
+ isJvxlColorPrecision = true;
for (int i = 0; i < vertexCount; i += incr) {
float value = setVertexColorValue(mesh, i);
if (mesh.firstViewableVertex == 0 || i < mesh.firstViewableVertex) {
@@ -1136,6 +1159,7 @@
list += ch;
}
}
+ mesh.isJvxlPrecisionColor = writePrecisionColor;
mesh.jvxlColorData = (colorByPhase ? "" : list + list1 + "\n");
if (logMessages)
System.out.println("color data: " + mesh.jvxlColorData);
@@ -1155,7 +1179,7 @@
datum = value = getPhase(mesh.vertices[vertexIndex]);
else if (dataIsJvxl2dContour)
datum = value = getInterpolatedPixelValue(mesh.vertices[vertexIndex]);
- else
+ else
datum = value = lookupInterpolatedVoxelValue(mesh.vertices[vertexIndex]);
if (colorBySign) {
@@ -1350,9 +1374,9 @@
System.out.println("JVXL reading color data base/range: " + mappedDataMin
+ "/" + mappedDataMax + " for " + vertexCount + " vertices."
+ iDoContourPlane + " " + contourVertexCount + " using encoding keys "
- + colorFractionBase + " " + colorFractionRange
+ + colorFractionBase + " " + colorFractionRange);
+ System.out.println("mapping red-->blue for " + valueMappedToRed + " to " +
valueMappedToBlue + iDoContourPlane + isJvxlColorPrecision);
- );
float min = (mappedDataMin == Float.MAX_VALUE ? defaultMappedDataMin
: mappedDataMin);
float range = (mappedDataMin == Float.MAX_VALUE ? defaultMappedDataMax
@@ -1396,7 +1420,7 @@
} else {
colixes[i] = viewer.getColixFromPalette(value, valueMappedToRed,
valueMappedToBlue, scaleName);
- if (logMessages)
+ if (true || logMessages)
System.out.println("readColor " + i + ": " + fraction + " " + value
+ " " + valueMappedToRed + " " + valueMappedToBlue + " "
+ colixes[i]);
Modified: branches/bob200603/Jmol/src/org/jmol/viewer/Mesh.java
===================================================================
--- branches/bob200603/Jmol/src/org/jmol/viewer/Mesh.java 2006-06-16
23:26:27 UTC (rev 5228)
+++ branches/bob200603/Jmol/src/org/jmol/viewer/Mesh.java 2006-06-16
23:27:41 UTC (rev 5229)
@@ -33,13 +33,14 @@
class Mesh {
Viewer viewer;
- String meshID;
+ String thisID;
boolean isValid = true;
String jvxlFileHeader;
String jvxlDefinitionLine;
String jvxlSurfaceData;
String jvxlEdgeData;
String jvxlColorData;
+ boolean isJvxlPrecisionColor;
Point4f jvxlPlane;
float mappedDataMin;
float mappedDataMax;
@@ -80,9 +81,9 @@
boolean drawTriangles = false;
boolean fillTriangles = true;
- Mesh(Viewer viewer, String meshID, Graphics3D g3d, short colix) {
+ Mesh(Viewer viewer, String thisID, Graphics3D g3d, short colix) {
this.viewer = viewer;
- this.meshID = meshID;
+ this.thisID = thisID;
this.g3d = g3d;
this.colix = colix;
}
Modified: branches/bob200603/Jmol/src/org/jmol/viewer/MeshCollection.java
===================================================================
--- branches/bob200603/Jmol/src/org/jmol/viewer/MeshCollection.java
2006-06-16 23:26:27 UTC (rev 5228)
+++ branches/bob200603/Jmol/src/org/jmol/viewer/MeshCollection.java
2006-06-16 23:27:41 UTC (rev 5229)
@@ -49,24 +49,24 @@
for (int i = 0; i < meshCount; ++i) {
Mesh mesh = meshes[i];
System.out.println("i=" + i +
- " mesh.meshID=" + mesh.meshID +
+ " mesh.thisID=" + mesh.thisID +
" mesh.visible=" + mesh.visible +
" mesh.translucent=" + mesh.translucent +
" mesh.colix=" + mesh.meshColix);
}
*/
- if ("meshID" == propertyName) {
- String meshID = (String)value;
- if (meshID == null) {
+ if ("thisID" == propertyName) {
+ String thisID = (String)value;
+ if (thisID == null) {
currentMesh = null;
return;
}
- int meshIndex = getMeshIndex(meshID);
+ int meshIndex = getIndexFromName(thisID);
if (meshIndex >= 0) {
currentMesh = meshes[meshIndex];
return;
}
- allocMesh(meshID);
+ allocMesh(thisID);
return;
}
if ("on" == propertyName) {
@@ -175,17 +175,17 @@
meshCount = 0;
}
}
- int getMeshIndex(String meshID) {
+ int getIndexFromName(String thisID) {
for (int i = meshCount; --i >= 0; ) {
- if (meshes[i] != null && meshID.equals(meshes[i].meshID))
+ if (meshes[i] != null && thisID.equals(meshes[i].thisID))
return i;
}
return -1;
}
- void allocMesh(String meshID) {
+ void allocMesh(String thisID) {
meshes = (Mesh[])Util.ensureLength(meshes, meshCount + 1);
- currentMesh = meshes[meshCount++] = new Mesh(viewer, meshID, g3d, colix);
+ currentMesh = meshes[meshCount++] = new Mesh(viewer, thisID, g3d, colix);
}
String line;
@@ -332,7 +332,7 @@
for (int i = 0; i < meshCount; i++) {
Hashtable info = new Hashtable();
Mesh mesh = meshes[i];
- info.put("ID", mesh.meshID);
+ info.put("ID", mesh.thisID);
info.put("drawType",mesh.drawType);
info.put("drawVertexCount",new Integer(mesh.drawVertexCount));
if (mesh.drawType == "Line")
Modified: branches/bob200603/Jmol/src/org/jmol/viewer/ModelManager.java
===================================================================
--- branches/bob200603/Jmol/src/org/jmol/viewer/ModelManager.java
2006-06-16 23:26:27 UTC (rev 5228)
+++ branches/bob200603/Jmol/src/org/jmol/viewer/ModelManager.java
2006-06-16 23:27:41 UTC (rev 5229)
@@ -54,9 +54,8 @@
// int currentFrameNumber;
Frame frame;
// Frame[] frames;
-
- void setClientFile(String fullPathName, String fileName,
- Object clientFile) {
+
+ void setClientFile(String fullPathName, String fileName, Object clientFile) {
if (clientFile == null) {
fullPathName = fileName = modelSetName = null;
frame = null;
@@ -224,7 +223,7 @@
Draw draw = (Draw) frame.shapes[JmolConstants.SHAPE_DRAW];
if (draw == null)
return null;
- int meshIndex = draw.getMeshIndex(axisID);
+ int meshIndex = draw.getIndexFromName(axisID);
if (meshIndex < 0) {
return null;
}
@@ -235,7 +234,7 @@
Draw draw = (Draw) frame.shapes[JmolConstants.SHAPE_DRAW];
if (draw == null)
return null;
- int meshIndex = draw.getMeshIndex(axisID);
+ int meshIndex = draw.getIndexFromName(axisID);
if (meshIndex < 0) {
return null;
}
@@ -428,17 +427,6 @@
return frame.findAtomsInRectangle(rectRubber);
}
- // FIXME mth 2004 02 23 -- this does *not* belong here
- float solventProbeRadius = 1.2f;
- void setSolventProbeRadius(float radius) {
- this.solventProbeRadius = radius;
- }
-
- boolean solventOn = false;
- void setSolventOn(boolean solventOn) {
- this.solventOn = solventOn;
- }
-
/****************************************************************
* shape support
****************************************************************/
@@ -499,12 +487,18 @@
}
int getShapeIdFromObjectName(String objectName) {
- for (int i = JmolConstants.SHAPE_MIN_MESH_COLLECTION;
+ int i;
+ for (i = JmolConstants.SHAPE_MIN_MESH_COLLECTION;
i < JmolConstants.SHAPE_MAX; ++i) {
MeshCollection shape = (MeshCollection) frame.shapes[i];
- if (shape != null && shape.getMeshIndex(objectName) >= 0)
+ if (shape != null && shape.getIndexFromName(objectName) >= 0)
return i;
}
+ i = JmolConstants.SHAPE_DIPOLES;
+ Dipoles dipoles = (Dipoles) frame.shapes[i];
+ if (dipoles != null && dipoles.getIndexFromName(objectName) >= 0)
+ return i;
+
return -1;
}
@@ -1287,20 +1281,13 @@
int ballVisibilityFlag =
viewer.getShapeVisibilityFlag(JmolConstants.SHAPE_BALLS);
int haloVisibilityFlag =
viewer.getShapeVisibilityFlag(JmolConstants.SHAPE_HALO);
- //the four mesh-related objects must be set individually
+ //named objects must be set individually
+ //in the future, we might include here a BITSET of models rather than just
a modelIndex
+
BitSet bs = viewer.getVisibleFramesBitSet();
- Draw draw = (Draw) frame.shapes[JmolConstants.SHAPE_DRAW];
- if (draw != null)
- draw.setVisibilityFlags(bs);
- Polyhedra poly = (Polyhedra) frame.shapes[JmolConstants.SHAPE_POLYHEDRA];
- if (poly != null)
- poly.setVisibilityFlags(bs);
- Isosurface surf = (Isosurface)
frame.shapes[JmolConstants.SHAPE_ISOSURFACE];
- if (surf != null)
- surf.setVisibilityFlags(bs);
- Pmesh pmesh = (Pmesh) frame.shapes[JmolConstants.SHAPE_PMESH];
- if (pmesh != null)
- pmesh.setVisibilityFlags(bs);
+ for (int i = JmolConstants.SHAPE_MIN_NAMED_OBJECT; i <
JmolConstants.SHAPE_MAX; i++)
+ if (frame.shapes[i] != null)
+ frame.shapes[i].setVisibilityFlags(bs);
for (int i = frame.atomCount; --i >= 0; ) {
Atom atom = atoms[i];
@@ -1355,7 +1342,7 @@
Hashtable shapeinfo = new Hashtable();
shapeinfo.put("index",new Integer(i));
shapeinfo.put("myVisibilityFlag",new Integer(shape.myVisibilityFlag));
- if(shapeType == "Draw")
+ if(shapeType == "Draw" || shapeType == "Dipoles")
shapeinfo.put("obj",shape.getShapeDetail());
info.put(shapeType,shapeinfo);
}
Modified: branches/bob200603/Jmol/src/org/jmol/viewer/Pmesh.java
===================================================================
--- branches/bob200603/Jmol/src/org/jmol/viewer/Pmesh.java 2006-06-16
23:26:27 UTC (rev 5228)
+++ branches/bob200603/Jmol/src/org/jmol/viewer/Pmesh.java 2006-06-16
23:27:41 UTC (rev 5229)
@@ -40,7 +40,7 @@
if ("init" == propertyName) {
isFixed = false;
isOnePerLine = false;
- super.setProperty("meshID", null, null);
+ super.setProperty("thisID", null, null);
return;
}
This was sent by the SourceForge.net collaborative development platform, the
world's largest Open Source development site.
_______________________________________________
Jmol-commits mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/jmol-commits