1 Clazz.declarePackage ("jalview.schemes");
\r
2 Clazz.load (["jalview.schemes.ResidueColourScheme", "java.util.Hashtable"], "jalview.schemes.RNAHelicesColour", ["jalview.schemes.ResidueProperties", "jalview.util.ColorUtils", "java.awt.Color"], function () {
\r
3 c$ = Clazz.decorateAsClass (function () {
\r
4 this.helixcolorhash = null;
\r
5 this.positionsToHelix = null;
\r
7 this.annotation = null;
\r
8 this.lastrefresh = -1;
\r
9 Clazz.instantialize (this, arguments);
\r
10 }, jalview.schemes, "RNAHelicesColour", jalview.schemes.ResidueColourScheme);
\r
11 Clazz.prepareFields (c$, function () {
\r
12 this.helixcolorhash = new java.util.Hashtable ();
\r
13 this.positionsToHelix = new java.util.Hashtable ();
\r
15 Clazz.makeConstructor (c$,
\r
16 function (annotation) {
\r
17 Clazz.superConstructor (this, jalview.schemes.RNAHelicesColour, [jalview.schemes.ResidueProperties.nucleotideIndex]);
\r
18 this.annotation = annotation;
\r
20 }, "jalview.datamodel.AlignmentAnnotation");
\r
21 Clazz.makeConstructor (c$,
\r
22 function (alignment) {
\r
23 Clazz.superConstructor (this, jalview.schemes.RNAHelicesColour, [jalview.schemes.ResidueProperties.nucleotideIndex]);
\r
24 this.alignmentChanged (alignment, null);
\r
25 }, "jalview.datamodel.AnnotatedCollectionI");
\r
26 Clazz.overrideMethod (c$, "alignmentChanged",
\r
27 function (alignment, hiddenReps) {
\r
28 var annotations = alignment.getAlignmentAnnotation ();
\r
29 for (var i = 0; i < annotations.length; i++) {
\r
30 if (annotations[i].getRNAStruc () != null) {
\r
31 this.annotation = annotations[i];
\r
35 }, "jalview.datamodel.AnnotatedCollectionI,java.util.Map");
\r
36 Clazz.defineMethod (c$, "refresh",
\r
38 if (this.annotation != null && ((this.annotation._rnasecstr == null || this.lastrefresh != this.annotation._rnasecstr.hashCode ()) && this.annotation.isValidStruc ())) {
\r
39 this.annotation.getRNAStruc ();
\r
40 this.lastrefresh = this.annotation._rnasecstr.hashCode ();
\r
42 this.positionsToHelix = new java.util.Hashtable ();
\r
43 for (var x = 0; x < this.annotation._rnasecstr.length; x++) {
\r
44 this.positionsToHelix.put (new Integer (this.annotation._rnasecstr[x].getBegin ()), this.annotation._rnasecstr[x].getFeatureGroup ());
\r
45 this.positionsToHelix.put (new Integer (this.annotation._rnasecstr[x].getEnd ()), this.annotation._rnasecstr[x].getFeatureGroup ());
\r
46 if (Integer.parseInt (this.annotation._rnasecstr[x].getFeatureGroup ()) > this.numHelix) {
\r
47 this.numHelix = Integer.parseInt (this.annotation._rnasecstr[x].getFeatureGroup ());
\r
49 for (var j = 0; j <= this.numHelix; j++) {
\r
50 if (!this.helixcolorhash.containsKey (Integer.toString (j))) {
\r
51 this.helixcolorhash.put (Integer.toString (j), jalview.util.ColorUtils.generateRandomColor (java.awt.Color.white));
\r
54 Clazz.defineMethod (c$, "findColour",
\r
56 return jalview.schemes.ResidueProperties.purinepyrimidine[jalview.schemes.ResidueProperties.purinepyrimidineIndex[c.charCodeAt (0)]];
\r
58 Clazz.defineMethod (c$, "findColour",
\r
59 function (c, j, seq) {
\r
61 var currentColour = java.awt.Color.white;
\r
62 var currentHelix = null;
\r
63 currentHelix = this.positionsToHelix.get (new Integer (j));
\r
64 if (currentHelix != null) {
\r
65 currentColour = this.helixcolorhash.get (currentHelix);
\r
66 }return currentColour;
\r
67 }, "~S,~N,jalview.datamodel.SequenceI");
\r