From 0f649b7bf0e7ba6b62198d7bdcfece9413f9408d Mon Sep 17 00:00:00 2001 From: amwaterhouse Date: Wed, 25 May 2005 16:36:40 +0000 Subject: [PATCH] saves usercolours --- src/jalview/gui/Jalview2XML.java | 87 +++++++++++++++++++++++++++++++++----- 1 file changed, 77 insertions(+), 10 deletions(-) diff --git a/src/jalview/gui/Jalview2XML.java b/src/jalview/gui/Jalview2XML.java index 6b6bd86..3eebf5c 100755 --- a/src/jalview/gui/Jalview2XML.java +++ b/src/jalview/gui/Jalview2XML.java @@ -80,6 +80,7 @@ public class Jalview2XML { Vector seqids = new Vector(); + Vector userColours = new Vector(); AlignViewport av = af.viewport; @@ -185,11 +186,15 @@ public class Jalview2XML if (sg.cs instanceof ResidueColourScheme) groups[i].setPidThreshold( ( (ResidueColourScheme) sg.cs).getThreshold()); - else if (sg.cs instanceof ScoreColourScheme) - groups[i].setPidThreshold( ( (ScoreColourScheme) sg.cs).getThreshold()); + else if (sg.cs instanceof ScoreColourScheme) + groups[i].setPidThreshold( ( (ScoreColourScheme) sg.cs).getThreshold()); - groups[i].setColour( ColourSchemeProperty.getColourName(sg.cs) ); + if (sg.cs instanceof jalview.schemes.UserColourScheme) + groups[i].setColour(SetUserColourScheme(sg.cs, userColours, jms)); + else + groups[i].setColour(ColourSchemeProperty.getColourName(sg.cs)); + groups[i].setOutlineColour(sg.getOutlineColour().getRGB()); groups[i].setDisplayBoxes(sg.getDisplayBoxes()); groups[i].setDisplayText(sg.getDisplayText()); @@ -203,7 +208,6 @@ public class Jalview2XML } } - jms.setJGroup(groups); } @@ -217,6 +221,12 @@ public class Jalview2XML view.setHeight(af.getHeight()); view.setStartRes(av.startRes); view.setStartSeq(av.startSeq); + + + if( av.getGlobalColourScheme() instanceof jalview.schemes.UserColourScheme) + view.setBgColour( SetUserColourScheme(av.getGlobalColourScheme(), + userColours, jms) ); + else view.setBgColour( ColourSchemeProperty.getColourName ( av.getGlobalColourScheme())); @@ -269,6 +279,52 @@ public class Jalview2XML } } + static String SetUserColourScheme(jalview.schemes.ColourSchemeI cs, + Vector userColours, + JalviewModelSequence jms) + { + String id=null; + jalview.schemes.UserColourScheme ucs = (jalview.schemes.UserColourScheme)cs; + if (!userColours.contains(ucs)) + { + userColours.add(ucs); + java.awt.Color [] colours = ucs.getColours(); + jalview.binding.UserColours uc = new jalview.binding.UserColours(); + jalview.binding.UserColourScheme jbucs = new jalview.binding.UserColourScheme(); + for(int i=0; i0) { -- 1.7.10.2