1 Clazz.declarePackage ("jalview.schemes");
2 Clazz.load (null, "jalview.schemes.GraduatedColor", ["jalview.schemes.UserColourScheme", "java.awt.Color", "java.lang.Float"], function () {
3 c$ = Clazz.decorateAsClass (function () {
4 this.thresholdState = -1;
15 this.autoScale = true;
17 this.colourByLabel = false;
18 Clazz.instantialize (this, arguments);
19 }, jalview.schemes, "GraduatedColor");
20 Clazz.makeConstructor (c$,
21 function (low, high, min, max) {
23 this.tolow = min >= max;
24 this.lr = low.getRed () / 255;
25 this.lg = low.getGreen () / 255;
26 this.lb = low.getBlue () / 255;
27 this.dr = (high.getRed () / 255) - this.lr;
28 this.dg = (high.getGreen () / 255) - this.lg;
29 this.db = (high.getBlue () / 255) - this.lb;
32 this.range = min - max;
35 this.range = max - min;
36 }}, "java.awt.Color,java.awt.Color,~N,~N");
37 Clazz.makeConstructor (c$,
45 this.base = oldcs.base;
46 this.range = oldcs.range;
47 this.tolow = oldcs.tolow;
48 this.thresholdState = oldcs.thresholdState;
49 this.thrsh = oldcs.thrsh;
50 this.autoScale = oldcs.autoScale;
51 this.colourByLabel = oldcs.colourByLabel;
52 }, "jalview.schemes.GraduatedColor");
53 Clazz.makeConstructor (c$,
54 function (oldcs, min, max) {
55 this.construct (oldcs);
56 this.updateBounds (min, max);
57 }, "jalview.schemes.GraduatedColor,~N,~N");
58 Clazz.defineMethod (c$, "getMinColor",
60 return new java.awt.Color (this.lr, this.lg, this.lb);
62 Clazz.defineMethod (c$, "getMaxColor",
64 return new java.awt.Color (this.lr + this.dr, this.lg + this.dg, this.lb + this.db);
66 Clazz.defineMethod (c$, "getTolow",
70 Clazz.defineMethod (c$, "setTolow",
74 Clazz.defineMethod (c$, "isColored",
76 var val = feature.getScore ();
77 if (Float.isNaN (val)) {
79 }if (this.thresholdState == -1) {
81 }if (Float.isNaN (this.thrsh)) {
83 }var rtn = this.thresholdState == 1;
84 if (val <= this.thrsh) {
88 }}, "jalview.datamodel.SequenceFeature");
89 Clazz.defineMethod (c$, "isColourByLabel",
91 return this.colourByLabel;
93 Clazz.defineMethod (c$, "setColourByLabel",
94 function (colourByLabel) {
95 this.colourByLabel = colourByLabel;
97 Clazz.defineMethod (c$, "findColor",
99 if (this.colourByLabel) {
100 if (this.ucs == null) {
101 this.ucs = new jalview.schemes.UserColourScheme ();
102 }return this.ucs.createColourFromName (feature.getDescription ());
103 }if (this.range == 0.0) {
104 return this.getMaxColor ();
105 }var scr = feature.getScore ();
106 if (Float.isNaN (scr)) {
107 return this.getMinColor ();
108 }var scl = (scr - this.base) / this.range;
115 }return new java.awt.Color (this.lr + scl * this.dr, this.lg + scl * this.dg, this.lb + scl * this.db);
116 }, "jalview.datamodel.SequenceFeature");
117 Clazz.defineMethod (c$, "setThresh",
121 Clazz.defineMethod (c$, "getThresh",
125 Clazz.defineMethod (c$, "setThreshType",
126 function (aboveThreshold) {
127 this.thresholdState = aboveThreshold;
129 Clazz.defineMethod (c$, "getThreshType",
131 return this.thresholdState;
133 Clazz.defineMethod (c$, "getMax",
135 return (this.tolow) ? this.base : (this.base + this.range);
137 Clazz.defineMethod (c$, "getMin",
139 return (this.tolow) ? (this.base + this.range) : this.base;
141 Clazz.defineMethod (c$, "isAutoScale",
143 return this.autoScale;
145 Clazz.defineMethod (c$, "setAutoScaled",
146 function (autoscale) {
147 this.autoScale = autoscale;
149 Clazz.defineMethod (c$, "updateBounds",
150 function (min, max) {
153 this.range = min - max;
157 this.range = max - min;