Clover icon

Coverage Report

  1. Project Clover database Mon Nov 11 2024 17:27:16 GMT
  2. Package jalview.viewmodel.seqfeatures

File FeatureRendererSettings.java

 

Coverage histogram

../../../img/srcFileCovDistChart10.png
0% of files have more coverage

Code metrics

14
29
2
1
125
77
10
0.34
14.5
2
5

Classes

Class Line # Actions
FeatureRendererSettings 33 29 10
0.9333333493.3%
 

Contributing tests

This file is covered by 20 tests. .

Source view

1    /*
2    * Jalview - A Sequence Alignment Editor and Viewer ($$Version-Rel$$)
3    * Copyright (C) $$Year-Rel$$ The Jalview Authors
4    *
5    * This file is part of Jalview.
6    *
7    * Jalview is free software: you can redistribute it and/or
8    * modify it under the terms of the GNU General Public License
9    * as published by the Free Software Foundation, either version 3
10    * of the License, or (at your option) any later version.
11    *
12    * Jalview is distributed in the hope that it will be useful, but
13    * WITHOUT ANY WARRANTY; without even the implied warranty
14    * of MERCHANTABILITY or FITNESS FOR A PARTICULAR
15    * PURPOSE. See the GNU General Public License for more details.
16    *
17    * You should have received a copy of the GNU General Public License
18    * along with Jalview. If not, see <http://www.gnu.org/licenses/>.
19    * The Jalview Authors are detailed in the 'AUTHORS' file.
20    */
21    package jalview.viewmodel.seqfeatures;
22   
23    import jalview.api.FeatureColourI;
24    import jalview.datamodel.features.FeatureMatcherSetI;
25    import jalview.schemes.FeatureColour;
26   
27    import java.util.Arrays;
28    import java.util.HashMap;
29    import java.util.Iterator;
30    import java.util.Map;
31    import java.util.concurrent.ConcurrentHashMap;
32   
 
33    public class FeatureRendererSettings implements Cloneable
34    {
35    String[] renderOrder;
36   
37    /*
38    * map of {groupName, isDisplayed}
39    */
40    Map<String, Boolean> featureGroups;
41   
42    /*
43    * map of {featureType, colourScheme}
44    */
45    Map<String, FeatureColourI> featureColours;
46   
47    /*
48    * map of {featureType, filters}
49    */
50    Map<String, FeatureMatcherSetI> featureFilters;
51   
52    float transparency;
53   
54    Map<String, Float> featureOrder;
55   
 
56  36 toggle public FeatureRendererSettings(String[] renderOrder,
57    Map<String, Boolean> featureGroups,
58    Map<String, FeatureColourI> featureColours, float transparency,
59    Map<String, Float> featureOrder)
60    {
61  36 super();
62  36 this.renderOrder = Arrays.copyOf(renderOrder, renderOrder.length);
63  36 this.featureGroups = new ConcurrentHashMap<String, Boolean>(
64    featureGroups);
65  36 this.featureColours = new ConcurrentHashMap<String, FeatureColourI>(
66    featureColours);
67  36 this.transparency = transparency;
68  36 this.featureOrder = new ConcurrentHashMap<String, Float>(featureOrder);
69    }
70   
71    /**
72    * create an independent instance of the feature renderer settings
73    *
74    * @param fr
75    */
 
76  72 toggle public FeatureRendererSettings(
77    jalview.viewmodel.seqfeatures.FeatureRendererModel fr)
78    {
79  72 renderOrder = null;
80  72 featureGroups = new ConcurrentHashMap<String, Boolean>();
81  72 featureColours = new ConcurrentHashMap<String, FeatureColourI>();
82  72 featureFilters = new HashMap<>();
83  72 featureOrder = new ConcurrentHashMap<String, Float>();
84   
85  72 if (fr.renderOrder != null)
86    {
87  62 this.renderOrder = new String[fr.renderOrder.length];
88  62 System.arraycopy(fr.renderOrder, 0, renderOrder, 0,
89    fr.renderOrder.length);
90    }
91  72 if (fr.featureGroups != null)
92    {
93  72 this.featureGroups = new ConcurrentHashMap<String, Boolean>(
94    fr.featureGroups);
95    }
96  72 if (fr.featureColours != null)
97    {
98  72 this.featureColours = new ConcurrentHashMap<String, FeatureColourI>(
99    fr.featureColours);
100    }
101  72 Iterator<String> en = fr.featureColours.keySet().iterator();
102  1549 while (en.hasNext())
103    {
104  1477 String next = en.next();
105  1477 FeatureColourI val = featureColours.get(next);
106    // if (val instanceof GraduatedColor)
107  1477 if (val.isGraduatedColour() || val.isColourByLabel()) // why this test?
108    {
109  4 featureColours.put(next, new FeatureColour((FeatureColour) val));
110    }
111    }
112   
113  72 if (fr.featureFilters != null)
114    {
115  72 this.featureFilters.putAll(fr.featureFilters);
116    }
117   
118  72 this.transparency = fr.transparency;
119  72 if (fr.featureOrder != null)
120    {
121  62 this.featureOrder = new ConcurrentHashMap<String, Float>(
122    fr.featureOrder);
123    }
124    }
125    }