*/
package jalview.datamodel;
-import jalview.viewmodel.annotationfilter.AnnotationFilterParameter;
-import jalview.viewmodel.annotationfilter.AnnotationFilterParameter.SearchableAnnotationField;
-
import java.util.ArrayList;
import java.util.BitSet;
import java.util.Collections;
import java.util.List;
import java.util.regex.PatternSyntaxException;
+import jalview.viewmodel.annotationfilter.AnnotationFilterParameter;
+import jalview.viewmodel.annotationfilter.AnnotationFilterParameter.SearchableAnnotationField;
+
/**
* Data class holding the selected columns and hidden column ranges for a view.
* Ranges are base 1.
}
/**
+ *
+ */
+ public boolean intersects(int from, int to)
+ {
+ // TODO: do this in a more efficient bitwise way
+ for (int f = from; f <= to; f++)
+ {
+ if (selection.isSelected(f))
+ {
+ return true;
+ }
+ }
+ return false;
+ }
+
+ /**
* Answers true if no columns are selected, else false
*/
public boolean isEmpty()
{
column = hiddenColumns.visibleToAbsoluteColumn(column);
}
- // // TODO: highlight columns selected
- // boolean colsel = false;
- // if (columnSelection != null)
- // {
- // colsel = columnSelection.contains(column);
- // }
+ // TODO: highlight columns selected
+ boolean colsel = false;
+ if (columnSelection != null)
+ {
+ colsel = columnSelection.contains(column);
+ }
if (column > aaMax)
{
// TODO show maximum colour for range - sort of done
// also need a 'getMaxPosForRange(start,end)' to accurately render
- Color col = getColorForRange(min, max, contacts, cstart, cend);
-
+ Color col;
+ boolean rowsel = false;
+ if (!colsel && columnSelection != null)
+ {
+ if (_aa.sequenceRef == null)
+ {
+ rowsel = columnSelection.intersects(cstart, cend);
+ }
+ else
+ {
+ // TODO check we have correctly mapped cstart to local sequence
+ // numbering
+ int s = _aa.sequenceRef.findIndex(cstart);
+ int e = _aa.sequenceRef.findIndex(cend);
+ if (s > 0 && s < _aa.sequenceRef.getLength())
+ {
+ rowsel = columnSelection.intersects(s, e);
+ }
+ }
+ }
// TODO: show selected region
- // if (colsel || columnSelection!=null &&
- // columnSelection.intersects(cstart,cend))
- // {
- // g.setColor(col.brighter());
- // }
- // else
+ if (colsel || rowsel)
{
+
+ col = getSelectedColorForRange(min, max, contacts, cstart, cend);
+ g.setColor(col);
+ }
+ else
+ {
+ col = getColorForRange(min, max, contacts, cstart, cend);
g.setColor(col);
}
if (pixels_step > 1)
}
// Shading parameters
- Color minColor = Color.white, maxColor = Color.magenta;
+ Color minColor = Color.white, maxColor = Color.green.darker().darker(),
+ selMaxColor = Color.magenta.darker();
Color shadeFor(float min, float max, float value)
{
return shadeFor(min, max, (float) cr.getMean());
}
+ public Color getSelectedColorForRange(float min, float max,
+ ContactListI cl, int i, int j)
+ {
+ ContactRange cr = cl.getRangeFor(i, j);
+ // average for moment - probably more interested in maxIntProj though
+ return jalview.util.ColorUtils.getGraduatedColour((float) cr.getMean(),
+ 0, minColor, max, selMaxColor);
+ }
+
}