X-Git-Url: http://source.jalview.org/gitweb/?a=blobdiff_plain;f=src%2Fjalview%2Fviewmodel%2Fseqfeatures%2FFeatureRendererSettings.java;h=f594453a964eb1c320c9681e6f90457516f95c98;hb=ed512fe4ab6c8a61bbf2e3b9d2b09ea9746af78d;hp=49dcad7c304c0cd9cf6afcae1c075ff5a8bd1f33;hpb=4d7f98a6dd54d9863ba449ec79dcd95d25ed863d;p=jalview.git
diff --git a/src/jalview/viewmodel/seqfeatures/FeatureRendererSettings.java b/src/jalview/viewmodel/seqfeatures/FeatureRendererSettings.java
index 49dcad7..f594453 100644
--- a/src/jalview/viewmodel/seqfeatures/FeatureRendererSettings.java
+++ b/src/jalview/viewmodel/seqfeatures/FeatureRendererSettings.java
@@ -1,9 +1,31 @@
+/*
+ * Jalview - A Sequence Alignment Editor and Viewer ($$Version-Rel$$)
+ * Copyright (C) $$Year-Rel$$ The Jalview Authors
+ *
+ * This file is part of Jalview.
+ *
+ * Jalview is free software: you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation, either version 3
+ * of the License, or (at your option) any later version.
+ *
+ * Jalview is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty
+ * of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ * PURPOSE. See the GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with Jalview. If not, see .
+ * The Jalview Authors are detailed in the 'AUTHORS' file.
+ */
package jalview.viewmodel.seqfeatures;
-import jalview.schemes.GraduatedColor;
+import jalview.api.FeatureColourI;
+import jalview.datamodel.features.FeatureMatcherSetI;
+import jalview.schemes.FeatureColour;
import java.util.Arrays;
-import java.util.Hashtable;
+import java.util.HashMap;
import java.util.Iterator;
import java.util.Map;
import java.util.concurrent.ConcurrentHashMap;
@@ -12,24 +34,38 @@ public class FeatureRendererSettings implements Cloneable
{
String[] renderOrder;
- Map featureGroups;
+ /*
+ * map of {groupName, isDisplayed}
+ */
+ Map featureGroups;
- Map featureColours;
+ /*
+ * map of {featureType, colourScheme}
+ */
+ Map featureColours;
+
+ /*
+ * map of {featureType, filters}
+ */
+ Map featureFilters;
float transparency;
- Map featureOrder;
+ Map featureOrder;
public FeatureRendererSettings(String[] renderOrder,
- Hashtable featureGroups, Hashtable featureColours,
- float transparency, Hashtable featureOrder)
+ Map featureGroups,
+ Map featureColours, float transparency,
+ Map featureOrder)
{
super();
this.renderOrder = Arrays.copyOf(renderOrder, renderOrder.length);
- this.featureGroups = new ConcurrentHashMap(featureGroups);
- this.featureColours = new ConcurrentHashMap(featureColours);
+ this.featureGroups = new ConcurrentHashMap(
+ featureGroups);
+ this.featureColours = new ConcurrentHashMap(
+ featureColours);
this.transparency = transparency;
- this.featureOrder = new ConcurrentHashMap(featureOrder);
+ this.featureOrder = new ConcurrentHashMap(featureOrder);
}
/**
@@ -41,9 +77,11 @@ public class FeatureRendererSettings implements Cloneable
jalview.viewmodel.seqfeatures.FeatureRendererModel fr)
{
renderOrder = null;
- featureGroups = new ConcurrentHashMap();
- featureColours = new ConcurrentHashMap();
- featureOrder = new ConcurrentHashMap();
+ featureGroups = new ConcurrentHashMap();
+ featureColours = new ConcurrentHashMap();
+ featureFilters = new HashMap<>();
+ featureOrder = new ConcurrentHashMap();
+
if (fr.renderOrder != null)
{
this.renderOrder = new String[fr.renderOrder.length];
@@ -52,26 +90,36 @@ public class FeatureRendererSettings implements Cloneable
}
if (fr.featureGroups != null)
{
- this.featureGroups = new ConcurrentHashMap(fr.featureGroups);
+ this.featureGroups = new ConcurrentHashMap(
+ fr.featureGroups);
}
if (fr.featureColours != null)
{
- this.featureColours = new ConcurrentHashMap(fr.featureColours);
+ this.featureColours = new ConcurrentHashMap(
+ fr.featureColours);
}
- Iterator en = fr.featureColours.keySet().iterator();
+ Iterator en = fr.featureColours.keySet().iterator();
while (en.hasNext())
{
- Object next = en.next();
- Object val = featureColours.get(next);
- if (val instanceof GraduatedColor)
+ String next = en.next();
+ FeatureColourI val = featureColours.get(next);
+ // if (val instanceof GraduatedColor)
+ if (val.isGraduatedColour() || val.isColourByLabel()) // why this test?
{
- featureColours.put(next, new GraduatedColor((GraduatedColor) val));
+ featureColours.put(next, new FeatureColour((FeatureColour) val));
}
}
+
+ if (fr.featureFilters != null)
+ {
+ this.featureFilters.putAll(fr.featureFilters);
+ }
+
this.transparency = fr.transparency;
if (fr.featureOrder != null)
{
- this.featureOrder = new ConcurrentHashMap(fr.featureOrder);
+ this.featureOrder = new ConcurrentHashMap(
+ fr.featureOrder);
}
}
-}
\ No newline at end of file
+}