Revision: 18314
          http://sourceforge.net/p/jmol/code/18314
Author:   hansonr
Date:     2013-06-08 12:30:13 +0000 (Sat, 08 Jun 2013)
Log Message:
-----------
___version=13.0.17_dev_2013.06.07

bug fix: jvxl reader ignores jvxlVertexColorData 

Modified Paths:
--------------
    branches/v13_0/Jmol/src/org/jmol/jvxl/readers/SurfaceGenerator.java
    branches/v13_0/Jmol/src/org/jmol/shapesurface/Isosurface.java
    branches/v13_0/Jmol/src/org/jmol/shapesurface/IsosurfaceMesh.java
    branches/v13_0/Jmol/src/org/jmol/viewer/Jmol.properties

Modified: branches/v13_0/Jmol/src/org/jmol/jvxl/readers/SurfaceGenerator.java
===================================================================
--- branches/v13_0/Jmol/src/org/jmol/jvxl/readers/SurfaceGenerator.java 
2013-06-07 23:32:18 UTC (rev 18313)
+++ branches/v13_0/Jmol/src/org/jmol/jvxl/readers/SurfaceGenerator.java 
2013-06-08 12:30:13 UTC (rev 18314)
@@ -1126,6 +1126,10 @@
       params.state = Parameters.STATE_DATA_COLORED;
       surfaceReader.applyColorScale();
     }
+    if (jvxlData.vertexColorMap != null) {
+      jvxlData.vertexColorMap = null;
+      surfaceReader.hasColorData = false;
+    }
     surfaceReader.jvxlUpdateInfo();
     setMarchingSquares(surfaceReader.marchingSquares);
     surfaceReader.discardTempData(false);

Modified: branches/v13_0/Jmol/src/org/jmol/shapesurface/Isosurface.java
===================================================================
--- branches/v13_0/Jmol/src/org/jmol/shapesurface/Isosurface.java       
2013-06-07 23:32:18 UTC (rev 18313)
+++ branches/v13_0/Jmol/src/org/jmol/shapesurface/Isosurface.java       
2013-06-08 12:30:13 UTC (rev 18314)
@@ -233,15 +233,32 @@
 
     if ("atomcolor" == propertyName) {
       if (thisMesh != null) {
-        if (thisMesh.vertexSource == null) {
+        boolean haveColors = (thisMesh.vertexSource != null);
+        if (haveColors)
+          for (int i = thisMesh.vertexCount; --i >= 0;)
+            if (thisMesh.vertexSource[i] < 0) {
+              haveColors = false;
+              break;
+            }
+        if (!haveColors) {
+          int[] source = thisMesh.vertexSource;
+          short[] vertexColixes = thisMesh.vertexColixes;
           short colix = (!thisMesh.isColorSolid ? 0 : thisMesh.colix);
           setProperty("init", null, null);
           setProperty("map", Boolean.FALSE, null);
           setProperty("property", new float[viewer.getAtomCount()], null);
-          if (colix != 0) {
-            thisMesh.colorCommand = "color isosurface "
-                + Graphics3D.getHexCode(colix);
-            setProperty("color", new Integer(Graphics3D.getArgb(colix)), null);
+          if (source == null) {
+            if (colix != 0) {
+              thisMesh.colorCommand = "color isosurface "
+                  + Graphics3D.getHexCode(colix);
+              setProperty("color", Integer.valueOf(Graphics3D.getArgb(colix)), 
null);
+            }                      
+          } else {
+            for (int i = thisMesh.vertexCount; --i >= 0;)
+              if (source[i] < 0)
+                source[i] = thisMesh.vertexSource[i];
+            thisMesh.vertexSource = source;
+            thisMesh.vertexColixes = vertexColixes;
           }
         }
         thisMesh.colorAtoms(Graphics3D.getColix(value), bs);

Modified: branches/v13_0/Jmol/src/org/jmol/shapesurface/IsosurfaceMesh.java
===================================================================
--- branches/v13_0/Jmol/src/org/jmol/shapesurface/IsosurfaceMesh.java   
2013-06-07 23:32:18 UTC (rev 18313)
+++ branches/v13_0/Jmol/src/org/jmol/shapesurface/IsosurfaceMesh.java   
2013-06-08 12:30:13 UTC (rev 18314)
@@ -527,7 +527,10 @@
     // TODO: color translucency?
     if (isAtoms)
       for (int i = 0; i < vertexCount; i++) {
-        if (bs.get(vertexSource[i])) {
+        int pt = vertexSource[i]; 
+        if (pt < 0)
+          continue;
+        if (bs.get(pt)) {
           vertexColixes[i] = colix;
           bsVertices.set(i);
         }
@@ -632,7 +635,8 @@
    * scheme information, and vertex color mappings (as from COLOR ISOSURFACE
    * {hydrophobic} WHITE), returning these settings when the JVXL file is
    * opened.
-   * @param colorRgb 
+   * 
+   * @param colorRgb
    */
   void setColorsFromJvxlData(int colorRgb) {
     diameter = jvxlData.diameter;
@@ -649,19 +653,20 @@
     if (jvxlData.meshColor != null)
       meshColix = Graphics3D.getColix(jvxlData.meshColor);
     setJvxlDataRendering();
-      
-    isColorSolid = !jvxlData.isBicolorMap;
+
+    isColorSolid = !jvxlData.isBicolorMap && jvxlData.vertexColorMap == null;
     if (colorEncoder != null) {
       // bicolor map will be taken care of with params.isBicolorMap
-      if (jvxlData.colorScheme != null) {
-        String colorScheme = jvxlData.colorScheme;
-        boolean isTranslucent = colorScheme.startsWith("translucent ");
-        if (isTranslucent)
-          colorScheme = colorScheme.substring(12);
-        colorEncoder.setColorScheme(colorScheme, isTranslucent);
-        remapColors(null, Float.NaN);
-      }
-      if (jvxlData.vertexColorMap != null)
+      if (jvxlData.vertexColorMap == null) {
+        if (jvxlData.colorScheme != null) {
+          String colorScheme = jvxlData.colorScheme;
+          boolean isTranslucent = colorScheme.startsWith("translucent ");
+          if (isTranslucent)
+            colorScheme = colorScheme.substring(12);
+          colorEncoder.setColorScheme(colorScheme, isTranslucent);
+          remapColors(null, Float.NaN);
+        }
+      } else {
         for (Map.Entry<String, BitSet> entry : jvxlData.vertexColorMap
             .entrySet()) {
           BitSet bsMap = entry.getValue();
@@ -670,7 +675,8 @@
           for (int i = bsMap.nextSetBit(0); i >= 0; i = bsMap.nextSetBit(i + 
1))
             vertexColixes[i] = colix;
         }
-    }    
+      }
+    }
   }
 
   void setJvxlDataRendering() {

Modified: branches/v13_0/Jmol/src/org/jmol/viewer/Jmol.properties
===================================================================
--- branches/v13_0/Jmol/src/org/jmol/viewer/Jmol.properties     2013-06-07 
23:32:18 UTC (rev 18313)
+++ branches/v13_0/Jmol/src/org/jmol/viewer/Jmol.properties     2013-06-08 
12:30:13 UTC (rev 18314)
@@ -11,6 +11,7 @@
 
 ___version=13.0.17_dev_2013.06.07
 
+bug fix: jvxl reader ignores jvxlVertexColorData 
 bug fix: ellipsoid rendering problems
 
 =============================================================================

This was sent by the SourceForge.net collaborative development platform, the 
world's largest Open Source development site.


------------------------------------------------------------------------------
How ServiceNow helps IT people transform IT departments:
1. A cloud service to automate IT design, transition and operations
2. Dashboards that offer high-level views of enterprise services
3. A single system of record for all IT processes
http://p.sf.net/sfu/servicenow-d2d-j
_______________________________________________
Jmol-commits mailing list
Jmol-commits@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/jmol-commits

Reply via email to