Revision: 5221
Author:   hansonr
Date:     2006-06-13 19:25:31 -0700 (Tue, 13 Jun 2006)
ViewCVS:  http://svn.sourceforge.net/jmol/?rev=5221&view=rev

Log Message:
-----------
bob200603 10.x.12 applet and application

adds   measure DELETE ALL min max (atom expr.) (atom expr.) ....

similar to measure ALL, but deletes only those within the specified range.

connects better with the measurement table and changes the measurement table
to read out atom.getIdentity() rather than just the name/number. This is for
use particularly with multiple models.

This required a change to the JmolViewer interface, adding 

  public String viewer.getInfo(int atomIndex)

Modified Paths:
--------------
    branches/bob200603/Jmol/src/org/jmol/api/JmolViewer.java
    branches/bob200603/Jmol/src/org/jmol/viewer/Eval.java
    branches/bob200603/Jmol/src/org/jmol/viewer/JmolConstants.java
    branches/bob200603/Jmol/src/org/jmol/viewer/Measures.java
    branches/bob200603/Jmol/src/org/jmol/viewer/Viewer.java
    branches/bob200603/Jmol/src/org/openscience/jmol/app/MeasurementTable.java
Modified: branches/bob200603/Jmol/src/org/jmol/api/JmolViewer.java
===================================================================
--- branches/bob200603/Jmol/src/org/jmol/api/JmolViewer.java    2006-06-14 
02:11:31 UTC (rev 5220)
+++ branches/bob200603/Jmol/src/org/jmol/api/JmolViewer.java    2006-06-14 
02:25:31 UTC (rev 5221)
@@ -179,6 +179,7 @@
 
   abstract public int getAtomNumber(int atomIndex);
   abstract public String getAtomName(int atomIndex);
+  abstract public String getAtomInfo(int atomIndex);
 
   abstract public float getRotationRadius();
 

Modified: branches/bob200603/Jmol/src/org/jmol/viewer/Eval.java
===================================================================
--- branches/bob200603/Jmol/src/org/jmol/viewer/Eval.java       2006-06-14 
02:11:31 UTC (rev 5220)
+++ branches/bob200603/Jmol/src/org/jmol/viewer/Eval.java       2006-06-14 
02:25:31 UTC (rev 5221)
@@ -1796,6 +1796,7 @@
     rangeMinMax[0] = Float.MAX_VALUE;
     rangeMinMax[1] = Float.MAX_VALUE;
     boolean isAll = false;
+    boolean isDelete = false;
     Vector monitorExpressions = new Vector();
 
     BitSet bs = new BitSet();
@@ -1805,6 +1806,8 @@
       Token token = statement[i + 1];
       //System.out.println(i+" "+token.toString());
       switch (token.tok) {
+      case Token.delete:
+        isDelete = true;
       case Token.all:
         atomIndex = -1;
         isAll = true;
@@ -1847,7 +1850,7 @@
         rangeMinMax[0] = (rangeMinMax[1] == Float.MAX_VALUE ? Float.MAX_VALUE
             : -200F);
       }
-      viewer.defineMeasurement(monitorExpressions, rangeMinMax);
+      viewer.defineMeasurement(monitorExpressions, rangeMinMax, isDelete);
     } else {
       viewer.toggleMeasurement(monitorArgs);
     }

Modified: branches/bob200603/Jmol/src/org/jmol/viewer/JmolConstants.java
===================================================================
--- branches/bob200603/Jmol/src/org/jmol/viewer/JmolConstants.java      
2006-06-14 02:11:31 UTC (rev 5220)
+++ branches/bob200603/Jmol/src/org/jmol/viewer/JmolConstants.java      
2006-06-14 02:25:31 UTC (rev 5221)
@@ -39,7 +39,7 @@
   // for now, just update this by hand
   // perhaps use ant filter later ... but mth doesn't like it :-(
   public final static String copyright = "(C) 2006 Jmol Development";
-  public final static String version = "10.x.11c(branch bob200603)";
+  public final static String version = "10.x.12(branch bob200603)";
   public final static String cvsDate = "$Date$";
   public final static String date = cvsDate.substring(7, 23);
 

Modified: branches/bob200603/Jmol/src/org/jmol/viewer/Measures.java
===================================================================
--- branches/bob200603/Jmol/src/org/jmol/viewer/Measures.java   2006-06-14 
02:11:31 UTC (rev 5220)
+++ branches/bob200603/Jmol/src/org/jmol/viewer/Measures.java   2006-06-14 
02:25:31 UTC (rev 5221)
@@ -64,6 +64,10 @@
   }
 
   void define(int[] atomCountPlusIndices) {
+    define(atomCountPlusIndices, false);
+  }
+  
+  void define(int[] atomCountPlusIndices, boolean isDelete) {
     if (viewer.getMeasureAllModelsFlag()) {
       Vector measureList = new Vector();
       int nPoints = atomCountPlusIndices[0];
@@ -71,23 +75,29 @@
         Atom atom = frame.atoms[atomCountPlusIndices[i]];
         measureList.add(viewer.getAtomBits("atomno", atom.getAtomNumber()));
       }
-      define(measureList);
+      define(measureList, isDelete);
       return;
     }    
-    defineOnly(atomCountPlusIndices);
+    defineOnly(atomCountPlusIndices, isDelete);
   }
   
-  void defineOnly(int[] atomCountPlusIndices) {
-    if (isDefined(atomCountPlusIndices))
-      return;
-    
+  void defineOnly(int[] atomCountPlusIndices, boolean isDelete) {
     float value = frame.getMeasurement(atomCountPlusIndices);
-    //System.out.println("measures define value,maxmin "+value+" 
"+rangeMinMax[0]+" "+rangeMinMax[1]);
+    //System.out.println("measures define value,maxmin "+value+" 
"+rangeMinMax[0]+" "+rangeMinMax[1] + " " + isDelete);
     
     if (rangeMinMax[0] != Float.MAX_VALUE) {
       if (value < rangeMinMax[0] || value > rangeMinMax[1])
         return;
     }
+
+    if (isDefined(atomCountPlusIndices)) {
+      if(isDelete)
+        delete(atomCountPlusIndices);
+      return;
+    }
+    if (isDelete)
+      return;
+    
     //System.out.println("define " + rangeMinMax[0] + "-" + rangeMinMax[1] + 
";" + value);
     Measurement measureNew = new Measurement(frame, atomCountPlusIndices, 
value, colix);
     if (measurementCount == measurements.length) {
@@ -117,6 +127,7 @@
 
   boolean delete(int i) {
     if (i < measurementCount) {
+      viewer.setStatusNewDefaultModeMeasurement("measureDeleted" , i, "");
       System.arraycopy(measurements, i+1,
                        measurements, i,
                        measurementCount - i - 1);
@@ -134,15 +145,14 @@
   }
   
   void toggle(int[] atomCountPlusIndices) {
+    rangeMinMax[0] = Float.MAX_VALUE;
     if (isDefined(atomCountPlusIndices))
-      delete(atomCountPlusIndices);
-    else {
-      rangeMinMax[0] = Float.MAX_VALUE;
-      define(atomCountPlusIndices);
-    }
+      define(atomCountPlusIndices, true);
+    else
+      define(atomCountPlusIndices, false);
   }
 
-  void define(Vector monitorExpressions) {
+  void define(Vector monitorExpressions, boolean isDelete) {
   /*
    * sets up measures based on an array of atom selection expressions -RMH 3/06
    * 
@@ -163,15 +173,17 @@
     int[] atomCountPlusIndices = new int[5];
     atomCountPlusIndices[0] = nPoints;
     //System.out.println("measure define "+ nPoints + " " + isOneToOne);
-    nextMeasure(0, nPoints, monitorExpressions, atomCountPlusIndices, 
isOneToOne ? -1 : 0);
+    nextMeasure(0, nPoints, monitorExpressions, atomCountPlusIndices, 
isOneToOne ? -1 : 0, isDelete);
   }
 
   void nextMeasure(int thispt, int nPoints, Vector monitorExpressions,
-                   int[] atomCountPlusIndices, int thisModel) {
+                   int[] atomCountPlusIndices, int thisModel, boolean 
isDelete) {
     BitSet bs = (BitSet) monitorExpressions.get(thispt);
-    //System.out.println("nextMeasure"+thispt+" acpi:"+atomCountPlusIndices);
+    //System.out.println("nextMeasure" + thispt + " acpi:" + 
atomCountPlusIndices
+        //+ " " + isDelete);
     //System.out.println("bs "+ bs);
-    for (int i = bs.size(); --i >= 0;) {
+    int iMax = bs.size();
+    for (int i = 0; i < iMax; i++) {
       if (bs.get(i)) {
         if (thispt > 0 && i == atomCountPlusIndices[thispt])
           continue;
@@ -186,11 +198,15 @@
         }
         atomCountPlusIndices[thispt + 1] = i;
         if (thispt == nPoints - 1) {
-          if (!isDefined(atomCountPlusIndices))
-            defineOnly(atomCountPlusIndices);
+          if (isDefined(atomCountPlusIndices)) {
+            if (isDelete)
+              defineOnly(atomCountPlusIndices, true);
+          } else if (!isDelete) {
+            defineOnly(atomCountPlusIndices, false);
+          }
         } else {
           nextMeasure(thispt + 1, nPoints, monitorExpressions,
-              atomCountPlusIndices, thisModel);
+              atomCountPlusIndices, thisModel, isDelete);
         }
       }
     }
@@ -209,6 +225,7 @@
   void setProperty(String propertyName, Object value,
                           BitSet bsSelected){
     
+    //System.out.println("Measures " + propertyName  + " " + value);
     if ("color".equals(propertyName)) {
         //System.out.println("Measures.color set to:" + value);
       colix = (value == null ? 0 : Graphics3D.getColix(value));
@@ -226,8 +243,10 @@
       { delete(value); }
     else if ("toggle".equals(propertyName))
     { toggle((int[])value); }
+    else if ("deleteVector".equals(propertyName))
+    { define((Vector)value, true); }
     else if ("defineVector".equals(propertyName))
-    { define((Vector)value); }
+    { define((Vector)value, false); }
     else if ("setRange".equals(propertyName))
     { setRange((float[])value); }
     else if ("pending".equals(propertyName))
@@ -243,8 +262,7 @@
   }
 
   Object getProperty(String property, int index) {
-    //    System.out.println("Measures.getProperty(" +property + "," + index 
+")");
-    //String propertyString = (String)property;
+    //System.out.println("Measures.getProperty(" +property + "," + index +")");
     if ("count".equals(property))
       { return new Integer(measurementCount); }
     if ("countPlusIndices".equals(property)) {

Modified: branches/bob200603/Jmol/src/org/jmol/viewer/Viewer.java
===================================================================
--- branches/bob200603/Jmol/src/org/jmol/viewer/Viewer.java     2006-06-14 
02:11:31 UTC (rev 5220)
+++ branches/bob200603/Jmol/src/org/jmol/viewer/Viewer.java     2006-06-14 
02:25:31 UTC (rev 5221)
@@ -1735,12 +1735,13 @@
     setStatusNewDefaultModeMeasurement("scripted", 1,"?");
   }
 
-  void defineMeasurement(Vector monitorExpressions, float[] rangeMinMax) {
+  void defineMeasurement(Vector monitorExpressions, float[] rangeMinMax,
+                         boolean isDelete) {
     setShapeProperty(JmolConstants.SHAPE_MEASURES, "setRange", rangeMinMax);
-    setShapeProperty(JmolConstants.SHAPE_MEASURES, "defineVector",
-        monitorExpressions);
-    setStatusNewDefaultModeMeasurement("scripted", 1,"?");
-        }
+    setShapeProperty(JmolConstants.SHAPE_MEASURES, isDelete ? "deleteVector"
+        : "defineVector", monitorExpressions);
+    setStatusNewDefaultModeMeasurement("scripted", 1, "?");
+  }
 
   public void deleteMeasurement(int i) {
     setShapeProperty(JmolConstants.SHAPE_MEASURES, "delete", new Integer(i));
@@ -2316,7 +2317,7 @@
     return pickingManager.setPickingStyle(style);
   }
 
-  String getAtomInfo(int atomIndex) {
+  public String getAtomInfo(int atomIndex) {
     return modelManager.getAtomInfo(atomIndex);
   }
 

Modified: 
branches/bob200603/Jmol/src/org/openscience/jmol/app/MeasurementTable.java
===================================================================
--- branches/bob200603/Jmol/src/org/openscience/jmol/app/MeasurementTable.java  
2006-06-14 02:11:31 UTC (rev 5220)
+++ branches/bob200603/Jmol/src/org/openscience/jmol/app/MeasurementTable.java  
2006-06-14 02:25:31 UTC (rev 5221)
@@ -217,8 +217,7 @@
       if (col >= countPlusIndices.length)
         return null;
       int atomIndex = countPlusIndices[col];
-      return ("" + viewer.getAtomNumber(atomIndex) +
-              " " + viewer.getAtomName(atomIndex));
+      return (viewer.getAtomInfo(atomIndex));
     }
 
     public boolean isCellEditable(int row, int col) { return false; }


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

Reply via email to