Clover icon

Coverage Report

  1. Project Clover database Thu Nov 7 2024 17:01:39 GMT
  2. Package jalview.viewmodel.seqfeatures

File FeatureRendererSettings.java

 

Coverage histogram

../../../img/srcFileCovDistChart0.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.00%
 

Contributing tests

No tests hitting this source file were found.

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  0 toggle public FeatureRendererSettings(String[] renderOrder,
57    Map<String, Boolean> featureGroups,
58    Map<String, FeatureColourI> featureColours, float transparency,
59    Map<String, Float> featureOrder)
60    {
61  0 super();
62  0 this.renderOrder = Arrays.copyOf(renderOrder, renderOrder.length);
63  0 this.featureGroups = new ConcurrentHashMap<String, Boolean>(
64    featureGroups);
65  0 this.featureColours = new ConcurrentHashMap<String, FeatureColourI>(
66    featureColours);
67  0 this.transparency = transparency;
68  0 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  0 toggle public FeatureRendererSettings(
77    jalview.viewmodel.seqfeatures.FeatureRendererModel fr)
78    {
79  0 renderOrder = null;
80  0 featureGroups = new ConcurrentHashMap<String, Boolean>();
81  0 featureColours = new ConcurrentHashMap<String, FeatureColourI>();
82  0 featureFilters = new HashMap<>();
83  0 featureOrder = new ConcurrentHashMap<String, Float>();
84   
85  0 if (fr.renderOrder != null)
86    {
87  0 this.renderOrder = new String[fr.renderOrder.length];
88  0 System.arraycopy(fr.renderOrder, 0, renderOrder, 0,
89    fr.renderOrder.length);
90    }
91  0 if (fr.featureGroups != null)
92    {
93  0 this.featureGroups = new ConcurrentHashMap<String, Boolean>(
94    fr.featureGroups);
95    }
96  0 if (fr.featureColours != null)
97    {
98  0 this.featureColours = new ConcurrentHashMap<String, FeatureColourI>(
99    fr.featureColours);
100    }
101  0 Iterator<String> en = fr.featureColours.keySet().iterator();
102  0 while (en.hasNext())
103    {
104  0 String next = en.next();
105  0 FeatureColourI val = featureColours.get(next);
106    // if (val instanceof GraduatedColor)
107  0 if (val.isGraduatedColour() || val.isColourByLabel()) // why this test?
108    {
109  0 featureColours.put(next, new FeatureColour((FeatureColour) val));
110    }
111    }
112   
113  0 if (fr.featureFilters != null)
114    {
115  0 this.featureFilters.putAll(fr.featureFilters);
116    }
117   
118  0 this.transparency = fr.transparency;
119  0 if (fr.featureOrder != null)
120    {
121  0 this.featureOrder = new ConcurrentHashMap<String, Float>(
122    fr.featureOrder);
123    }
124    }
125    }