Merge branch 'alpha/JAL-3362_Jalview_212_alpha' into alpha/merge_212_JalviewJS_2112
[jalview.git] / src / jalview / viewmodel / AlignmentViewport.java
index a9334ff..8f1fc83 100644 (file)
@@ -24,6 +24,7 @@ import jalview.analysis.AnnotationSorter.SequenceAnnotationOrder;
 import jalview.analysis.Conservation;
 import jalview.analysis.TreeModel;
 import jalview.api.AlignCalcManagerI;
+import jalview.api.AlignExportSettingsI;
 import jalview.api.AlignViewportI;
 import jalview.api.AlignmentViewPanel;
 import jalview.api.FeaturesDisplayedI;
@@ -31,6 +32,7 @@ import jalview.api.ViewStyleI;
 import jalview.commands.CommandI;
 import jalview.datamodel.AlignedCodonFrame;
 import jalview.datamodel.AlignmentAnnotation;
+import jalview.datamodel.AlignmentExportData;
 import jalview.datamodel.AlignmentI;
 import jalview.datamodel.AlignmentView;
 import jalview.datamodel.Annotation;
@@ -731,13 +733,13 @@ public abstract class AlignmentViewport
   /**
    * results of cDNA complement consensus visible portion of view
    */
-  protected Hashtable[] hcomplementConsensus = null;
+  protected Hashtable<String, Object>[] hcomplementConsensus = null;
 
   /**
    * results of secondary structure base pair consensus for visible portion of
    * view
    */
-  protected Hashtable[] hStrucConsensus = null;
+  protected Hashtable<String, Object>[] hStrucConsensus = null;
 
   protected Conservation hconservation = null;
   
@@ -766,7 +768,8 @@ public abstract class AlignmentViewport
   }
 
   @Override
-  public void setComplementConsensusHash(Hashtable[] hconsensus)
+  public void setComplementConsensusHash(
+          Hashtable<String, Object>[] hconsensus)
   {
     this.hcomplementConsensus = hconsensus;
   }
@@ -790,19 +793,20 @@ public abstract class AlignmentViewport
   }
 
   @Override
-  public Hashtable[] getComplementConsensusHash()
+  public Hashtable<String, Object>[] getComplementConsensusHash()
   {
     return hcomplementConsensus;
   }
 
   @Override
-  public Hashtable[] getRnaStructureConsensusHash()
+  public Hashtable<String, Object>[] getRnaStructureConsensusHash()
   {
     return hStrucConsensus;
   }
 
   @Override
-  public void setRnaStructureConsensusHash(Hashtable[] hStrucConsensus)
+  public void setRnaStructureConsensusHash(
+          Hashtable<String, Object>[] hStrucConsensus)
   {
     this.hStrucConsensus = hStrucConsensus;
 
@@ -1919,7 +1923,7 @@ public abstract class AlignmentViewport
       }
     } while (end < max);
 
-    int[][] startEnd = new int[regions.size()][2];
+    // int[][] startEnd = new int[regions.size()][2];
 
     return regions;
   }
@@ -2277,7 +2281,7 @@ public abstract class AlignmentViewport
      * TODO reorder the annotation rows according to group/sequence ordering on
      * alignment
      */
-    boolean sortg = true;
+    // boolean sortg = true;
 
     // remove old automatic annotation
     // add any new annotation
@@ -2390,7 +2394,7 @@ public abstract class AlignmentViewport
   public void clearSequenceColours()
   {
     sequenceColours.clear();
-  };
+  }
 
   @Override
   public AlignViewportI getCodingComplement()
@@ -3122,6 +3126,36 @@ public abstract class AlignmentViewport
   }
 
   @Override
+  public AlignmentExportData getAlignExportData(AlignExportSettingsI options)
+  {
+    AlignmentI alignmentToExport = null;
+    String[] omitHidden = null;
+    alignmentToExport = null;
+
+    if (hasHiddenColumns() && !options.isExportHiddenColumns())
+    {
+      omitHidden = getViewAsString(false,
+              options.isExportHiddenSequences());
+    }
+
+    int[] alignmentStartEnd = new int[2];
+    if (hasHiddenRows() && options.isExportHiddenSequences())
+    {
+      alignmentToExport = getAlignment().getHiddenSequences()
+              .getFullAlignment();
+    }
+    else
+    {
+      alignmentToExport = getAlignment();
+    }
+    alignmentStartEnd = getAlignment().getHiddenColumns()
+            .getVisibleStartAndEndIndex(alignmentToExport.getWidth());
+    AlignmentExportData ed = new AlignmentExportData(alignmentToExport,
+            omitHidden, alignmentStartEnd);
+    return ed;
+  }
+  
+  @Override
   public boolean isNormaliseSequenceLogo()
   {
     return normaliseSequenceLogo;
@@ -3142,7 +3176,6 @@ public abstract class AlignmentViewport
   {
     hmmNormaliseSequenceLogo = state;
   }
-
   /**
    * flag set to indicate if structure views might be out of sync with sequences
    * in the alignment