+
+ @SuppressWarnings("unused")
+ private List<SequenceFeature> overlaps = (/** @j2sNative true || */
+ false ? null : new ArrayList<>());
+
+ /**
+ * Returns the sequence feature colour rendered at the given column position,
+ * or null if none found. The feature of highest render order (i.e. on top) is
+ * found, subject to both feature type and feature group being visible, and
+ * its colour returned. This method is suitable when no feature transparency
+ * applied (only the topmost visible feature colour is rendered).
+ * <p>
+ * Note this method does not check for a gap in the column so would return the
+ * colour for features enclosing a gapped column. Check for gap before calling
+ * if different behaviour is wanted.
+ *
+ * BH 2019.07.30
+ *
+ * Adds a result ArrayList to parameters in order to avoid an unnecessary
+ * construction of that for every pixel checked.
+ *
+ *
+ * @param seq
+ * @param column
+ * (1..)
+ * @return
+ */
+ private Color findFeatureColour(SequenceI seq, int column)
+ {
+ /*
+ * check for new feature added while processing
+ */
+ updateFeatures();
+
+ /*
+ * inspect features in reverse renderOrder (the last in the array is
+ * displayed on top) until we find one that is rendered at the position
+ */
+ for (int renderIndex = renderOrder.length; --renderIndex >= 0;)
+ {
+ String type = renderOrder[renderIndex];
+ if (!seq.hasFeatures(type) || !showFeatureOfType(type))
+ {
+ continue;
+ }
+
+ if (overlaps != null)
+ {
+ overlaps.clear();
+ }
+ List<SequenceFeature> list = seq.findFeatures(column, type, overlaps);
+ if (list.size() > 0)
+ {
+ for (int i = 0, n = list.size(); i < n; i++)
+ {
+ SequenceFeature sf = list.get(i);
+ if (featureGroupNotShown(sf))
+ {
+ continue;
+ }
+ Color col = getColour(sf);
+ if (col != null)
+ {
+ return col;
+ }
+ }
+ }
+ }
+
+ /*
+ * no displayed feature found at position
+ */
+ return null;
+ }