JAL-1933 update threshold on focus lost in text field
[jalview.git] / src / jalview / ext / rbvi / chimera / ChimeraCommands.java
index 9ef89fd..07c0015 100644 (file)
@@ -38,8 +38,6 @@ import java.util.LinkedHashMap;
 import java.util.List;
 import java.util.Map;
 
-import MCview.PDBChain;
-
 /**
  * Routines for generating Chimera commands for Jalview/Chimera binding
  * 
@@ -49,7 +47,7 @@ import MCview.PDBChain;
 public class ChimeraCommands
 {
 
-  private static final String NAMESPACE_PREFIX = "jv_";
+  public static final String NAMESPACE_PREFIX = "jv_";
 
   /**
    * Constructs Chimera commands to colour residues as per the Jalview alignment
@@ -400,7 +398,14 @@ public class ChimeraCommands
     for (SequenceFeature sf : sfs)
     {
       String type = sf.getType();
-      if (!visibleFeatures.contains(type) || suppressFeature(type))
+
+      /*
+       * Only copy visible features, don't copy any which originated
+       * from Chimera, and suppress uninteresting ones (e.g. RESNUM)
+       */
+      boolean isFromViewer = JalviewChimeraBinding.CHIMERA_FEATURE_GROUP
+              .equals(sf.getFeatureGroup());
+      if (isFromViewer || !visibleFeatures.contains(type))
       {
         continue;
       }
@@ -415,7 +420,7 @@ public class ChimeraCommands
           value = type;
         }
         float score = sf.getScore();
-        if (score != 0f && score != Float.NaN)
+        if (score != 0f && !Float.isNaN(score))
         {
           value = Float.toString(score);
         }
@@ -435,18 +440,6 @@ public class ChimeraCommands
   }
 
   /**
-   * Answers true if the feature type is one we don't wish to propagate to
-   * Chimera - for now, RESNUM
-   * 
-   * @param type
-   * @return
-   */
-  static boolean suppressFeature(String type)
-  {
-    return PDBChain.RESNUM_FEATURE.equals(type);
-  }
-
-  /**
    * Traverse the map of features/values/models/chains/positions to construct a
    * list of 'setattr' commands (one per distinct feature type and value).
    * <p>