} catch (Exception e)
{
throw new IllegalArgumentException(
- "Couldn't parse the minimum value for graduated colour ("
- + descriptor + ")");
+ "Couldn't parse the minimum value for graduated colour ('"
+ + minval + "')");
}
try
{
/**
* Returns the colour for the given instance of the feature. This may be a
- * simple colour, a colour generated from the feature description (if
- * isColourByLabel()), or a colour derived from the feature score (if
- * isGraduatedColour()).
+ * simple colour, a colour generated from the feature description or other
+ * attribute (if isColourByLabel()), or a colour derived from the feature
+ * score or other attribute (if isGraduatedColour()).
+ * <p>
+ * Answers null if feature score (or attribute) value lies outside a
+ * configured threshold.
*
* @param feature
* @return
attributeName = name;
}
+ @Override
+ public boolean isOutwithThreshold(SequenceFeature feature)
+ {
+ if (!isGraduatedColour())
+ {
+ return false;
+ }
+ float scr = feature.getScore();
+ if (attributeName != null)
+ {
+ try
+ {
+ String attVal = feature.getValueAsString(attributeName);
+ scr = Float.valueOf(attVal);
+ } catch (Throwable e)
+ {
+ scr = Float.NaN;
+ }
+ }
+ if (Float.isNaN(scr))
+ {
+ return false;
+ }
+
+ return ((isAboveThreshold() && scr <= threshold)
+ || (isBelowThreshold() && scr >= threshold));
+ }
+
}