From 34e81d4c2a02e30ccbea5295e550137b57810f25 Mon Sep 17 00:00:00 2001 From: jprocter Date: Fri, 12 Nov 2010 15:55:33 +0000 Subject: [PATCH] patch for JAL-682 - copy over current display settings to the associated viewport if they are present in a distinct alignment viewport associated with the source of the feature settings being transferred. --- src/jalview/appletgui/FeatureRenderer.java | 17 ++++++++++++ src/jalview/gui/FeatureRenderer.java | 39 +++++++++++++++++++++++----- 2 files changed, 50 insertions(+), 6 deletions(-) diff --git a/src/jalview/appletgui/FeatureRenderer.java b/src/jalview/appletgui/FeatureRenderer.java index 6e9da1a..de03c03 100755 --- a/src/jalview/appletgui/FeatureRenderer.java +++ b/src/jalview/appletgui/FeatureRenderer.java @@ -84,6 +84,23 @@ public class FeatureRenderer implements jalview.api.FeatureRenderer 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; diff --git a/src/jalview/gui/FeatureRenderer.java b/src/jalview/gui/FeatureRenderer.java index 4e72719..021c27e 100755 --- a/src/jalview/gui/FeatureRenderer.java +++ b/src/jalview/gui/FeatureRenderer.java @@ -165,11 +165,37 @@ public class FeatureRenderer implements jalview.api.FeatureRenderer public void transferSettings(FeatureRenderer fr) { - this.renderOrder = fr.renderOrder; - this.featureGroups = fr.featureGroups; - this.featureColours = fr.featureColours; - this.transparency = fr.transparency; - this.featureOrder = fr.featureOrder; + FeatureRendererSettings frs = new FeatureRendererSettings(fr); + this.renderOrder = frs.renderOrder; + this.featureGroups = frs.featureGroups; + this.featureColours = frs.featureColours; + this.transparency = frs.transparency; + this.featureOrder = frs.featureOrder; + if (av != null && av!=fr.av) + { + // copy over the displayed feature settings + if (fr.av != null) + { + if (fr.av.featuresDisplayed != null) + { + // update display settings + if (av.featuresDisplayed == null) + { + av.featuresDisplayed = new Hashtable(fr.av.featuresDisplayed); + } + else + { + av.featuresDisplayed.clear(); + Enumeration en = fr.av.featuresDisplayed.keys(); + while (en.hasMoreElements()) + { + av.featuresDisplayed.put(en.nextElement(), Boolean.TRUE); + } + + } + } + } + } } BufferedImage offscreenImage; @@ -229,7 +255,8 @@ public class FeatureRenderer implements jalview.api.FeatureRenderer } currentColour = null; - // TODO: non-threadsafe - each rendering thread needs its own instance of the feature renderer - or this should be synchronized. + // TODO: non-threadsafe - each rendering thread needs its own instance of + // the feature renderer - or this should be synchronized. offscreenRender = true; if (offscreenImage != null) -- 1.7.10.2