Revision: 21517
          http://sourceforge.net/p/jmol/code/21517
Author:   hansonr
Date:     2017-04-13 16:27:44 +0000 (Thu, 13 Apr 2017)
Log Message:
-----------
Jmol.___JmolVersion="14.14.1"

new feature: set jmolInJSpecView  
  -- allows Jmol window to NOT be embedded in JSpecView when JSpecView is 
opened in Jmol
  -- default TRUE
  
bug fix: mesh capper producing gaps
bug fix: CIP chirality fixed for rule ordering; validated for IUPAC Rules 1, 2, 
and 3 (though still some questions about Rule 3)
bug fix: print getProperty("cifinfo") without file name fails
 
 

Modified Paths:
--------------
    trunk/Jmol/jars/JSpecView.jar
    trunk/Jmol/src/org/jmol/render/MeshRenderer.java
    trunk/Jmol/src/org/jmol/rendersurface/PmeshRenderer.java
    trunk/Jmol/src/org/jmol/script/T.java
    trunk/Jmol/src/org/jmol/util/MeshCapper.java
    trunk/Jmol/src/org/jmol/util/MeshSlicer.java
    trunk/Jmol/src/org/jmol/viewer/GlobalSettings.java
    trunk/Jmol/src/org/jmol/viewer/Jmol.properties
    trunk/Jmol/src/org/jmol/viewer/Viewer.java
    trunk/Jmol/src/org/openscience/jmol/app/jmolpanel/StatusListener.java

Modified: trunk/Jmol/jars/JSpecView.jar
===================================================================
(Binary files differ)

Modified: trunk/Jmol/src/org/jmol/render/MeshRenderer.java
===================================================================
--- trunk/Jmol/src/org/jmol/render/MeshRenderer.java    2017-04-13 04:13:56 UTC 
(rev 21516)
+++ trunk/Jmol/src/org/jmol/render/MeshRenderer.java    2017-04-13 16:27:44 UTC 
(rev 21517)
@@ -181,6 +181,7 @@
   private boolean setVariables() {
     if (mesh.visibilityFlags == 0)
       return false;
+    forceShowTriangles = vwr.getBoolean(T.testflag3);
     showTriangles = forceShowTriangles || mesh.showTriangles;
     if (mesh.bsSlabGhost != null)
       g3d.setC(mesh.slabColix); // forces a second pass

Modified: trunk/Jmol/src/org/jmol/rendersurface/PmeshRenderer.java
===================================================================
--- trunk/Jmol/src/org/jmol/rendersurface/PmeshRenderer.java    2017-04-13 
04:13:56 UTC (rev 21516)
+++ trunk/Jmol/src/org/jmol/rendersurface/PmeshRenderer.java    2017-04-13 
16:27:44 UTC (rev 21517)
@@ -30,7 +30,6 @@
   
   @Override
   protected boolean render() {
-    forceShowTriangles = vwr.getBoolean(T.testflag3);
     return renderIso();
   }
 

Modified: trunk/Jmol/src/org/jmol/script/T.java
===================================================================
--- trunk/Jmol/src/org/jmol/script/T.java       2017-04-13 04:13:56 UTC (rev 
21516)
+++ trunk/Jmol/src/org/jmol/script/T.java       2017-04-13 16:27:44 UTC (rev 
21517)
@@ -1011,10 +1011,11 @@
   public final static int hidenotselected                = booleanparam | 86;
   public final static int highresolution                 = booleanparam | 88;
 // see predefinedset  public final static int hydrogen                       = 
booleanparam | 90;
-  public final static int imagestate                     = booleanparam | 91;
-  public static final int iskiosk                        = booleanparam | 92; 
// 11.9.29
-  public final static int isosurfacekey                  = booleanparam | 93;
-  public final static int isosurfacepropertysmoothing    = booleanparam | 94;
+  public final static int imagestate                     = booleanparam | 89;
+  public static final int iskiosk                        = booleanparam | 90; 
// 11.9.29
+  public final static int isosurfacekey                  = booleanparam | 91;
+  public final static int isosurfacepropertysmoothing    = booleanparam | 92;
+  public final static int jmolinjspecview                = booleanparam | 93; 
// 14.13.1
   public final static int justifymeasurements            = booleanparam | 95;
   public final static int languagetranslation            = booleanparam | 96;
   public final static int legacyautobonding              = booleanparam | 97;
@@ -2585,6 +2586,7 @@
        "isosurfaceKey",
        "isosurfacePropertySmoothing",
        "isosurfacePropertySmoothingPower",
+       "jmolInJSpecView",
        "justifyMeasurements",
        "languageTranslation",
        "leadAtom",
@@ -3632,6 +3634,7 @@
         isosurfacekey,                      //        "isosurfaceKey"
         isosurfacepropertysmoothing,        //        
"isosurfacePropertySmoothing"
         isosurfacepropertysmoothingpower,   //        
"isosurfacePropertySmoothingPower"
+        jmolinjspecview,
         justifymeasurements,                //        "justifyMeasurements"
         languagetranslation,                //        "languageTranslation"
         leadatom,                           //        "leadAtom"

Modified: trunk/Jmol/src/org/jmol/util/MeshCapper.java
===================================================================
--- trunk/Jmol/src/org/jmol/util/MeshCapper.java        2017-04-13 04:13:56 UTC 
(rev 21516)
+++ trunk/Jmol/src/org/jmol/util/MeshCapper.java        2017-04-13 16:27:44 UTC 
(rev 21517)
@@ -87,7 +87,7 @@
 
   private int nPoints;
 
-  private M4 m4;
+  M4 m4, m4inv;
 
   /////////////// initialization //////////////////
 
@@ -317,7 +317,7 @@
     Quat q = Quat.getQuaternionFrameV(vab, vac, null, false);
     M3 m3 = q.getMatrix();
     m4 = M4.newMV(m3, vertices.get(0));
-    M4 m4inv = M4.newM4(m4).invert();
+    m4inv = M4.newM4(m4).invert();
     vertices.toArray(vs);
     vertices = null;
         
@@ -331,7 +331,7 @@
     if (Logger.debugging)
       Logger.info("MeshCapper using " + vs.length + " vertices");
     
-    CapVertex v0 = vs[0].sort(vs);
+    CapVertex v0 = sort(vs);
     if (v0 == null) {
       Logger.error("two identical points -- aborting");
       return;
@@ -359,6 +359,104 @@
   }
 
   /**
+   * Generate qnext links based on scanning Y large to Y small and if Y1==Y2,
+   * then X small to large
+   * 
+   * @param vs
+   * @return null if there are two identical points (edge crossings)
+   */
+  public CapVertex sort(CapVertex[] vs) {
+    Lst<CapVertex> v0s = new Lst<CapVertex>();
+    Lst<CapVertex> v1s = new Lst<CapVertex>();
+    int n = vs.length;
+//    for (int i = n; --i >= 0;)
+//      System.out.println(vs[i]);
+//    System.out.println("#----");
+      for (int i = n; --i >= 0;) {  
+      if (vs[i].next == null) {
+        v0s.addLast(vs[i]);
+      } else if (vs[i].prev == null) {
+        v1s.addLast(vs[i]);
+      }
+    }
+    for (int i = v0s.size(); --i >= 0;) {
+      CapVertex v0 = v0s.get(i);
+      CapVertex v1 = findNearestVertex(v1s, v0);
+      if (v1 == null) {
+        System.out.println("MESHCAPPER OHOH");
+      } else {
+        v0.link(v1);
+      }
+      
+    }
+    MeshCapperSorter sorter = new MeshCapperSorter();
+//    for (int i = 0; i < n; i++) {
+//      CapVertex v = vs[i];
+//      if (vs[i].next == null || vs[i].prev == null)
+//        System.out.println("null meshcapper");
+//    }
+//
+
+    Arrays.sort(vs, sorter);
+    int pt = n;
+
+//    int pt = 0;
+//    for (int i = 0; i < n; i++) {
+//      if (!vs[i].disabled)
+//        vs[pt++] = vs[i];
+//    }
+    if (pt > 0) {
+      for (int i = pt; --i >= 0;) {
+        CapVertex v = vs[i];
+        vs[i].qnext = vs[(i + 1) % pt];
+      }
+      vs[pt - 1].qnext = vs[0];
+    }
+    return vs[0];
+  }
+
+  private CapVertex findNearestVertex(Lst<CapVertex> v1s, CapVertex v0) {
+    float min = Float.MAX_VALUE;
+    CapVertex vmin = null;
+    int imin = -1;
+    for (int i = v1s.size(); --i >= 0;) {
+      CapVertex v1 = v1s.get(i);
+      float d = v1.distanceSquared(v0);
+      if (d < min) {
+        min = d;
+        vmin = v1;
+        imin = i;
+      }
+    }
+    if (imin >= 0)
+      v1s.removeItemAt(imin);
+    return vmin;
+  }
+
+  public class MeshCapperSorter implements
+  Comparator<CapVertex> {
+    
+    
+    @Override
+    public int compare(CapVertex v1, CapVertex v2) {
+      // first HIGHEST Y to LOWEST Y, then LOWEST X to HIGHEST X
+      return (v1.y < v2.y ? 1 : v1.y > v2.y || v1.x < v2.x ? -1
+          : v1.x > v2.x ? 1 
+              : 0);//disable(v1, v2));
+    }
+
+  
+  }
+  
+  int disable(CapVertex v1, CapVertex v2) {
+    if (!v1.disabled && !v2.disabled) {
+      //v2.link(null);
+      v2.disabled = true;
+    }
+    return 0;
+  }
+
+  /**
    * Handle the point; mark as processed.
    * 
    * @param v
@@ -824,6 +922,8 @@
     CapVertex[] region;
 
     boolean disabled;
+    
+    T3 cartesian;
 
     CapVertex(T3 p, int i) {
       ipt = i;
@@ -840,93 +940,6 @@
     }
 
     /**
-     * Generate qnext links based on scanning Y large to Y small and if Y1==Y2,
-     * then X small to large
-     * 
-     * @param vs
-     * @return null if there are two identical points (edge crossings)
-     */
-    public CapVertex sort(CapVertex[] vs) {
-      CapVertex v0 = null;
-      CapVertex v1 = null;
-      int n = vs.length;
-      for (int i = n; --i >= 0;)
-        System.out.println(i + "/" + n + " "  + vs[i]);
-      System.out.println("----");
-        for (int i = n; --i >= 0;) {  
-        if (vs[i].next == null) {
-          System.out.println("fixing next " +  vs[i]);
-          if (v0 == null) {
-            v1 = vs[i];
-            System.out.println("next,v0 null; v1 is now " + v1);
-          } else {
-            vs[i].link(v0);
-            System.out.println("next null, v0 not null;linked\n" + vs[i] + 
"\n" + v0);
-            v0 = null;
-          }
-        } else if (vs[i].prev == null) {
-          System.out.println("fixing prev " +  vs[i]);
-          if (v1 == null) {
-            v0 = vs[i];
-            System.out.println("prev,v1 null; v0 is now " + v0);
-          } else {
-            v1.link(vs[i]);
-            System.out.println("prev null, v1 not null;linked\n" + v1 + "\n" + 
vs[i]);
-            v1 = null;
-          }
-        }
-      }
-
-      MeshCapperSorter sorter = new MeshCapperSorter();
-//      for (int i = 0; i < n; i++) {
-//        CapVertex v = vs[i];
-//        if (vs[i].next == null || vs[i].prev == null)
-//          System.out.println("null meshcapper");
-//      }
-//
-
-      Arrays.sort(vs, sorter);
-      int pt = n;
-
-//      int pt = 0;
-//      for (int i = 0; i < n; i++) {
-//        if (!vs[i].disabled)
-//          vs[pt++] = vs[i];
-//      }
-      if (pt > 0) {
-        for (int i = pt; --i >= 0;) {
-          CapVertex v = vs[i];
-          vs[i].qnext = vs[(i + 1) % pt];
-        }
-        vs[pt - 1].qnext = vs[0];
-      }
-      return vs[0];
-    }
-
-    public class MeshCapperSorter implements
-    Comparator<CapVertex> {
-      
-      
-      @Override
-      public int compare(CapVertex v1, CapVertex v2) {
-        // first HIGHEST Y to LOWEST Y, then LOWEST X to HIGHEST X
-        return (v1.y < v2.y ? 1 : v1.y > v2.y || v1.x < v2.x ? -1
-            : v1.x > v2.x ? 1 
-                : 0);//disable(v1, v2));
-      }
-
-    
-    }
-    
-    int disable(CapVertex v1, CapVertex v2) {
-      if (!v1.disabled && !v2.disabled) {
-        //v2.link(null);
-        v2.disabled = true;
-      }
-      return 0;
-    }
-
-    /**
      * Get interpolated x for the scan line intersection with an edge. This
      * method is used both in finding the last point for a split and for
      * checking winding on same-side addition.
@@ -991,14 +1004,18 @@
 
     @Override
     public String toString() {
+      if (cartesian  == null)
+        cartesian = new P3();
+      if (m4 != null)
+        m4.rotTrans2(this, cartesian);
       return "draw p"
           + id
           + " {"
-          + x
+          + cartesian.x
           + " "
-          + y
+          + cartesian.y
           + " "
-          + z
+          + cartesian.z
           + "} # "
           + (prev == null ? "null" : prev.id)
           + (next == null ? " null" : " " + next.id)

Modified: trunk/Jmol/src/org/jmol/util/MeshSlicer.java
===================================================================
--- trunk/Jmol/src/org/jmol/util/MeshSlicer.java        2017-04-13 04:13:56 UTC 
(rev 21516)
+++ trunk/Jmol/src/org/jmol/util/MeshSlicer.java        2017-04-13 16:27:44 UTC 
(rev 21517)
@@ -138,9 +138,7 @@
       P3[] box = (P3[]) slabbingObject;
       sb.append("within ").append(Escape.eAP(box));
       P4[] faces = getBoxFacesFromCriticalPoints(box);
-      System.out.println("MeshSlicer test 4");
       for (int i = 0; i < faces.length; i++) {
-        if (i == 1 || i == 2 || i == 4)
         getIntersection(0, faces[i], null, null, null, null, null, andCap,
             false, T.plane, isGhost);
       }
@@ -281,9 +279,11 @@
         if (m.vertexSource == null)
           return;
         fData = new float[m.vc];
-        for (int i = 0; i < m.vc; i++)
-          if ((fData[i] = m.vertexSource[i]) == -1)
+        for (int i = 0; i < m.vc; i++) {
+          fData[i] = m.vertexSource[i];
+          if (fData[i] == -1)
             System.out.println("meshsurface hmm");
+        }
       } else {
         fData = m.vvs;
       }

Modified: trunk/Jmol/src/org/jmol/viewer/GlobalSettings.java
===================================================================
--- trunk/Jmol/src/org/jmol/viewer/GlobalSettings.java  2017-04-13 04:13:56 UTC 
(rev 21516)
+++ trunk/Jmol/src/org/jmol/viewer/GlobalSettings.java  2017-04-13 16:27:44 UTC 
(rev 21517)
@@ -283,6 +283,7 @@
     setB("isosurfaceKey", isosurfaceKey);
     setB("isosurfacePropertySmoothing", isosurfacePropertySmoothing);
     setI("isosurfacePropertySmoothingPower", isosurfacePropertySmoothingPower);
+    setB("jmolInJSpecView", jmolInJSpecView);
     setB("justifyMeasurements", justifyMeasurements);
     setB("legacyAutoBonding", legacyAutoBonding);
     setB("legacyHAddition", legacyHAddition);
@@ -467,6 +468,7 @@
   boolean legacyAutoBonding = false;
   public boolean legacyHAddition = false;
   public boolean legacyJavaFloat = false; // float/double issue with 
crystallographic symmetry before Jmol 14.2.5
+  boolean jmolInJSpecView = true;
 
   boolean modulateOccupancy = true;
 
@@ -972,7 +974,7 @@
       + 
";bondingversion;contextdepthmax;debug;debugscript;defaultlatttice;defaults;defaultdropscript;diffusepercent;"
       + ";exportdrivers;exportscale"
       + ";_filecaching;_filecache;fontcaching;fontscaling;forcefield;language"
-      + ";legacyautobonding;legacyhaddition;legacyjavafloat"
+      + ";jmolinjspecview;legacyautobonding;legacyhaddition;legacyjavafloat"
       + ";loglevel;logfile;loggestures;logcommands;measurestylechime"
       + 
";loadformat;loadligandformat;smilesurlformat;pubchemformat;nihresolverformat;edsurlformat;edsurlcutoff;multiprocessor;navigationmode;"
       + 
";pathforallfiles;perspectivedepth;phongexponent;perspectivemodel;platformspeed"
@@ -1061,6 +1063,7 @@
     //      appendCmd(str, "set autoLoadOrientation true");
     app(str, "set bondingVersion " + bondingVersion);
     app(str, "set legacyAutoBonding " + legacyAutoBonding);
+    app(str, "set legacyAutoBonding " + legacyAutoBonding);
     app(str, "set legacyHAddition " + legacyHAddition);
     app(str, "set legacyJavaFloat " + legacyJavaFloat);
     app(str, "set minBondDistance " + minBondDistance);

Modified: trunk/Jmol/src/org/jmol/viewer/Jmol.properties
===================================================================
--- trunk/Jmol/src/org/jmol/viewer/Jmol.properties      2017-04-13 04:13:56 UTC 
(rev 21516)
+++ trunk/Jmol/src/org/jmol/viewer/Jmol.properties      2017-04-13 16:27:44 UTC 
(rev 21517)
@@ -49,19 +49,17 @@
 # 10. Run jmol/tools build-release.xml
 #
 
-Jmol.___JmolVersion="14.13.2"
+Jmol.___JmolVersion="14.14.1"
 
-bug fix: mesh capper produces gaps; problems with disabled.link(null)
-bug fix: CIP chirality fixed for rule ordering; validated for IUPAC Rules 1, 
2, and 3
+new feature: set jmolInJSpecView  
+  -- allows Jmol window to NOT be embedded in JSpecView when JSpecView is 
opened in Jmol
+  -- default TRUE
+  
+bug fix: mesh capper producing gaps
+bug fix: CIP chirality fixed for rule ordering; validated for IUPAC Rules 1, 
2, and 3 (though still some questions about Rule 3)
 bug fix: print getProperty("cifinfo") without file name fails
  
-TODO: still incomplete fix 
- see:
  
-   load nacl.cif {1 1 1} spacegroup 225 
-   select @24
-       spacefill ionic;lcaocartoon scale 1.0 CAP unitcell "cpk";spacefill off
- 
 JmolVersion="14.13.1" // 2017.04.09
 
 new feature: MOL V2000 reader loads > <dataname> blocks into _M.molData

Modified: trunk/Jmol/src/org/jmol/viewer/Viewer.java
===================================================================
--- trunk/Jmol/src/org/jmol/viewer/Viewer.java  2017-04-13 04:13:56 UTC (rev 
21516)
+++ trunk/Jmol/src/org/jmol/viewer/Viewer.java  2017-04-13 16:27:44 UTC (rev 
21517)
@@ -5199,6 +5199,8 @@
       return g.rasmolHydrogenSetting;
     case T.isosurfacekey:
       return g.isosurfaceKey;
+    case T.jmolinjspecview:
+      return g.jmolInJSpecView;
     case T.justifymeasurements:
       return g.justifyMeasurements;
     case T.legacyautobonding:
@@ -6454,6 +6456,9 @@
       // /11.0///
       setRefreshing(value);
       break;
+    case T.jmolinjspecview:
+      g.jmolInJSpecView = value;
+      break;
     case T.justifymeasurements:
       g.justifyMeasurements = value;
       break;

Modified: trunk/Jmol/src/org/openscience/jmol/app/jmolpanel/StatusListener.java
===================================================================
--- trunk/Jmol/src/org/openscience/jmol/app/jmolpanel/StatusListener.java       
2017-04-13 04:13:56 UTC (rev 21516)
+++ trunk/Jmol/src/org/openscience/jmol/app/jmolpanel/StatusListener.java       
2017-04-13 16:27:44 UTC (rev 21517)
@@ -42,6 +42,7 @@
 import org.jmol.api.JmolSyncInterface;
 import org.jmol.c.CBK;
 import org.jmol.dialog.Dialog;
+import org.jmol.script.T;
 import org.jmol.util.Logger;
 import org.jmol.viewer.Viewer;
 import org.openscience.jmol.app.JmolPlugin;
@@ -511,7 +512,7 @@
         return;
     }
     if (jSpecViewFrame == null) {
-      jSpecViewFrame = new MainFrame((Component) vwr.display, this);
+      jSpecViewFrame = new MainFrame(vwr.getBoolean(T.jmolinjspecview) ? 
(Component) vwr.display : null, this);
       jSpecViewFrame.setSize(Math.max(1000, jmol.frame.getWidth() + 50), 600);
       jSpecViewFrame.setLocation(jmol.frame.getLocation().x + 10, jmol.frame
           .getLocation().y + 100);

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


------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
_______________________________________________
Jmol-commits mailing list
Jmol-commits@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/jmol-commits

Reply via email to