JAL-4158 first attempt at stashing colours for contact matrix groups and allowing...
[jalview.git] / src / jalview / ws / datamodel / alphafold / PAEContactMatrix.java
index 5fe27cc..41e677a 100644 (file)
@@ -1,7 +1,9 @@
 package jalview.ws.datamodel.alphafold;
 
+import java.awt.Color;
 import java.util.ArrayList;
 import java.util.BitSet;
+import java.util.HashMap;
 import java.util.Iterator;
 import java.util.List;
 import java.util.Map;
@@ -309,7 +311,14 @@ public class PAEContactMatrix implements ContactMatrixI
       groups.add(gpset);
     }
   }
-  
+  @Override
+  public void updateGroups(List<BitSet> colGroups)
+  {
+    if (colGroups!=null)
+    {
+      groups=colGroups;
+    }    
+  }
   @Override
   public BitSet getGroupsFor(int column)
   {
@@ -322,6 +331,25 @@ public class PAEContactMatrix implements ContactMatrixI
     return ContactMatrixI.super.getGroupsFor(column);
   }
 
+  HashMap<BitSet,Color> colorMap = new HashMap<>();
+  @Override 
+  public Color getColourForGroup(BitSet bs)
+  {
+    if (bs==null) {
+      return Color.white;
+    }
+    Color groupCol=colorMap.get(bs);
+    if (groupCol==null)
+    {
+      return Color.white;
+    }
+    return groupCol;
+  }
+  @Override 
+  public void setColorForGroup(BitSet bs,Color color)
+  {
+    colorMap.put(bs,color);
+  }
   public void restoreGroups(List<BitSet> newgroups, String treeMethod,
           String tree, double thresh2)
   {