+ minval = gcol.nextToken();\r
+ }\r
+ maxval = gcol.nextToken();\r
+ // set defaults\r
+ int threshtype = AnnotationColourGradient.NO_THRESHOLD;\r
+ float min = Float.MIN_VALUE, max = Float.MAX_VALUE, threshval = Float.NaN;\r
+ try\r
+ {\r
+ if (minval.length() > 0)\r
+ {\r
+ min = new Float(minval).floatValue();\r
+ }\r
+ } catch (Exception e)\r
+ {\r
+ System.err\r
+ .println("Couldn't parse the minimum value for graduated colour for type ("\r
+ + colscheme\r
+ + ") - did you misspell 'auto' for the optional automatic colour switch ?");\r
+ e.printStackTrace();\r
+ }\r
+ try\r
+ {\r
+ if (maxval.length() > 0)\r
+ {\r
+ max = new Float(maxval).floatValue();\r
+ }\r
+ } catch (Exception e)\r
+ {\r
+ System.err\r
+ .println("Couldn't parse the maximum value for graduated colour for type ("\r
+ + colscheme + ")");\r
+ e.printStackTrace();\r
+ }\r
+ try\r
+ {\r
+ colour = new jalview.schemes.GraduatedColor(\r
+ new UserColourScheme(mincol).findColour('A'),\r
+ new UserColourScheme(maxcol).findColour('A'), min,\r
+ max);\r
+ } catch (Exception e)\r
+ {\r
+ System.err\r
+ .println("Couldn't parse the graduated colour scheme ("\r
+ + colscheme + ")");\r
+ e.printStackTrace();\r
+ }\r
+ if (colour != null)\r
+ {\r
+ ((jalview.schemes.GraduatedColor) colour)\r
+ .setAutoScaled(abso == null);\r
+ // add in any additional parameters\r
+ String ttype = null, tval = null;\r
+ if (gcol.hasMoreTokens())\r
+ {\r
+ // threshold type and possibly a threshold value\r
+ ttype = gcol.nextToken();\r
+ if (ttype.toLowerCase().startsWith("below"))\r
+ {\r
+ ((jalview.schemes.GraduatedColor) colour)\r
+ .setThreshType(AnnotationColourGradient.BELOW_THRESHOLD);\r
+ }\r
+ else if (ttype.toLowerCase().startsWith("above"))\r
+ {\r
+ ((jalview.schemes.GraduatedColor) colour)\r
+ .setThreshType(AnnotationColourGradient.ABOVE_THRESHOLD);\r
+ }\r
+ else\r
+ {\r
+ ((jalview.schemes.GraduatedColor) colour)\r
+ .setThreshType(AnnotationColourGradient.NO_THRESHOLD);\r
+ if (!ttype.toLowerCase().startsWith("no"))\r
+ {\r
+ System.err\r
+ .println("Ignoring unrecognised threshold type : "\r
+ + ttype);\r
+ }\r
+ }\r
+ }\r
+ if (((GraduatedColor) colour).getThreshType() != AnnotationColourGradient.NO_THRESHOLD)\r
+ {\r
+ tval = gcol.nextToken();\r
+ try\r
+ {\r
+ ((jalview.schemes.GraduatedColor) colour)\r
+ .setThresh(new Float(tval).floatValue());\r
+ } catch (Exception e)\r
+ {\r
+ System.err\r
+ .println("Couldn't parse threshold value as a float: ("\r
+ + tval + ")");\r
+ e.printStackTrace();\r
+ }\r
+ }\r
+ // parse the thresh-is-min token ?\r
+ if (gcol.hasMoreTokens())\r
+ {\r
+ System.err\r
+ .println("Ignoring additional tokens in parameters in graduated colour specification\n");\r
+ while (gcol.hasMoreTokens())\r
+ {\r
+ System.err.println("|" + gcol);\r
+ }\r
+ System.err.println("\n");\r
+ }\r