/*
- * Jalview - A Sequence Alignment Editor and Viewer (Version 2.5)
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.6)
* Copyright (C) 2010 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
*
* This file is part of Jalview.
* @author $author$
* @version $Revision$
*/
-public class FeatureRenderer
+public class FeatureRenderer implements jalview.api.FeatureRenderer
{
AlignViewport av;
featureGroups = fr.featureGroups;
featureColours = fr.featureColours;
transparency = fr.transparency;
+ if (av!=null && fr.av!=null && fr.av!=av)
+ {
+ if (fr.av.featuresDisplayed!=null)
+ {
+ if (av.featuresDisplayed==null)
+ {
+ av.featuresDisplayed = new Hashtable();
+ } else {
+ av.featuresDisplayed.clear();
+ }
+ Enumeration en=fr.av.featuresDisplayed.keys();
+ while (en.hasMoreElements())
+ {
+ av.featuresDisplayed.put(en.nextElement(), Boolean.TRUE);
+ }
+ }
+ }
}
static String lastFeatureAdded;
else if (sequenceFeatures[sfindex].type.equals("disulfide bond"))
{
- renderFeature(g, seq, seq
- .findIndex(sequenceFeatures[sfindex].begin) - 1, seq
- .findIndex(sequenceFeatures[sfindex].begin) - 1,
+ renderFeature(g, seq,
+ seq.findIndex(sequenceFeatures[sfindex].begin) - 1,
+ seq.findIndex(sequenceFeatures[sfindex].begin) - 1,
getColour(sequenceFeatures[sfindex])
// new Color(((Integer) av.featuresDisplayed
// .get(sequenceFeatures[sfindex].type)).intValue())
, start, end, y1);
- renderFeature(g, seq, seq
- .findIndex(sequenceFeatures[sfindex].end) - 1, seq
- .findIndex(sequenceFeatures[sfindex].end) - 1,
+ renderFeature(g, seq,
+ seq.findIndex(sequenceFeatures[sfindex].end) - 1,
+ seq.findIndex(sequenceFeatures[sfindex].end) - 1,
getColour(sequenceFeatures[sfindex])
// new Color(((Integer) av.featuresDisplayed
// .get(sequenceFeatures[sfindex].type)).intValue())
{
if (showFeature(sequenceFeatures[sfindex]))
{
- renderFeature(g, seq, seq
- .findIndex(sequenceFeatures[sfindex].begin) - 1, seq
- .findIndex(sequenceFeatures[sfindex].end) - 1,
+ renderFeature(g, seq,
+ seq.findIndex(sequenceFeatures[sfindex].begin) - 1,
+ seq.findIndex(sequenceFeatures[sfindex].end) - 1,
getColour(sequenceFeatures[sfindex]), start, end, y1);
}
}
Hashtable minmax = null;
+ /**
+ * Called when alignment in associated view has new/modified features to
+ * discover and display.
+ *
+ */
+ public void featuresAdded()
+ {
+ lastSeq = null;
+ findAllFeatures();
+ }
+
+ /**
+ * find all features on the alignment
+ */
void findAllFeatures()
{
jalview.schemes.UserColourScheme ucs = new jalview.schemes.UserColourScheme();
{
if (getColour(features[index].getType()) == null)
{
- featureColours.put(features[index].getType(), ucs
- .createColourFromName(features[index].getType()));
+ featureColours.put(features[index].getType(),
+ ucs.createColourFromName(features[index].getType()));
}
av.featuresDisplayed.put(features[index].getType(), new Integer(