Place new feature on top of existing features
authoramwaterhouse <Andrew Waterhouse>
Fri, 27 Apr 2007 14:42:27 +0000 (14:42 +0000)
committeramwaterhouse <Andrew Waterhouse>
Fri, 27 Apr 2007 14:42:27 +0000 (14:42 +0000)
src/jalview/appletgui/FeatureRenderer.java

index b36fbfd..1061efd 100755 (executable)
@@ -88,14 +88,6 @@ public class FeatureRenderer
   static String lastFeatureGroupAdded;\r
   static String lastDescriptionAdded;\r
 \r
-  public boolean createNewFeatures(SequenceI[] sequences,\r
-                                   SequenceFeature[] features,\r
-      AlignmentPanel ap)\r
-  {\r
-    return amendFeatures(sequences, features, true, ap);\r
-  }\r
-\r
-\r
   int featureIndex = 0;\r
   boolean deleteFeature = false;\r
   Panel colourPanel;\r
@@ -370,8 +362,6 @@ public class FeatureRenderer
           featureGroups = new Hashtable();\r
         }\r
 \r
-\r
-\r
         col = colourPanel.getBackground();\r
         setColour(lastFeatureAdded, col);\r
 \r
@@ -383,6 +373,11 @@ public class FeatureRenderer
         }\r
         findAllFeatures();\r
 \r
+        String [] tro = new String[renderOrder.length];\r
+        tro[0] = renderOrder[renderOrder.length-1];\r
+        System.arraycopy(renderOrder,0,tro,1,renderOrder.length-1);\r
+        renderOrder = tro;\r
+\r
         return true;\r
       }\r
       else\r
@@ -677,21 +672,19 @@ public class FeatureRenderer
 \r
   public Color getColour(String featureType)\r
   {\r
-    return (Color) featureColours.get(featureType);\r
-  }\r
-\r
-  public void addNewFeature(String name, Color col)\r
-  {\r
-\r
-    setColour(name, col);\r
-    if (av.featuresDisplayed == null)\r
+    if (!featureColours.containsKey(featureType))\r
     {\r
-      av.featuresDisplayed = new Hashtable();\r
+      jalview.schemes.UserColourScheme ucs = new\r
+          jalview.schemes.UserColourScheme();\r
+      Color col = ucs.createColourFromName(featureType);\r
+      featureColours.put(featureType, col);\r
+      return col;\r
     }\r
-\r
-    av.featuresDisplayed.put(name, "NOGROUP");\r
+    else\r
+      return (Color) featureColours.get(featureType);\r
   }\r
 \r
+\r
   public void setColour(String featureType, Color col)\r
   {\r
     featureColours.put(featureType, col);\r
@@ -707,6 +700,23 @@ public class FeatureRenderer
       av.featuresDisplayed.clear();\r
     }\r
 \r
+   /* if (visibleNew)\r
+    {\r
+      if (av.featuresDisplayed != null)\r
+      {\r
+        av.featuresDisplayed.clear();\r
+      }\r
+      else\r
+      {\r
+        av.featuresDisplayed = new Hashtable();\r
+      }\r
+    }\r
+    if (data == null)\r
+    {\r
+      return;\r
+    }*/\r
+\r
+\r
     renderOrder = new String[data.length];\r
 \r
     if (data.length > 0)\r