JAL-2094 first pass with jalview.api.ColorI interface
[jalview.git] / src / jalview / io / StructureFile.java
index 7262443..3a7419c 100644 (file)
@@ -1,6 +1,7 @@
 package jalview.io;
 
 import jalview.analysis.AlignSeq;
+import jalview.api.FeatureSettingsModelI;
 import jalview.datamodel.Alignment;
 import jalview.datamodel.AlignmentAnnotation;
 import jalview.datamodel.AlignmentI;
@@ -62,6 +63,18 @@ public abstract class StructureFile extends AlignFile
     this.predictSecondaryStructure = predictSecondaryStructure;
     this.externalSecondaryStructure = externalSecStr;
   }
+
+  public void xferSettings()
+  {
+    this.visibleChainAnnotation = StructureViewSettings
+            .isVisibleChainAnnotation();
+    this.predictSecondaryStructure = StructureViewSettings
+            .isPredictSecondaryStructure();
+    this.externalSecondaryStructure = StructureViewSettings
+            .isExternalSecondaryStructure();
+
+  }
+
   public StructureFile(boolean parseImmediately, String inFile, String type)
           throws IOException
   {
@@ -258,12 +271,17 @@ public abstract class StructureFile extends AlignFile
         final Constructor constructor = cl
 .getConstructor(new Class[] {
             boolean.class, boolean.class, boolean.class, FileParse.class });
-        final Object[] args = new Object[] { true, true, true,
+        final Object[] args = new Object[] { visibleChainAnnotation,
+            predictSecondaryStructure, externalSecondaryStructure,
             new FileParse(getDataName(),
                 type) };
 
         StructureViewSettings.setShowSeqFeatures(false);
-        StructureViewSettings.setPredictSecondaryStructure(true);
+        StructureViewSettings.setVisibleChainAnnotation(false);
+        StructureViewSettings
+                .setPredictSecondaryStructure(predictSecondaryStructure);
+        StructureViewSettings
+                .setExternalSecondaryStructure(externalSecondaryStructure);
         Object jmf = constructor.newInstance(args);
         AlignmentI al = new Alignment((SequenceI[]) cl.getMethod(
                 "getSeqsAsArray", new Class[] {}).invoke(jmf));
@@ -397,4 +415,19 @@ public abstract class StructureFile extends AlignFile
   {
     this.dbRefType = dbRefType;
   }
+
+  /**
+   * Returns a descriptor for suitable feature display settings with
+   * <ul>
+   * <li>ResNums or insertions features visible</li>
+   * <li>insertions features coloured red</li>
+   * <li>ResNum features coloured by label</li>
+   * <li>Insertions displayed above (on top of) ResNums</li>
+   * </ul>
+   */
+  @Override
+  public FeatureSettingsModelI getFeatureColourScheme()
+  {
+    return new PDBFeatureSettings();
+  }
 }