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