X-Git-Url: http://source.jalview.org/gitweb/?a=blobdiff_plain;f=src%2Fjalview%2Fworkers%2FAnnotationWorker.java;h=4d81307a2a6598d97cd39b1a03312832428858b6;hb=4c4998c1524e4d567720c42ca41adbfe74d60d90;hp=efe707ac1cacb9f8b0b83a81c8680653aca61935;hpb=f8e603128476ca6e093ea2fc65435d1294978c53;p=jalview.git diff --git a/src/jalview/workers/AnnotationWorker.java b/src/jalview/workers/AnnotationWorker.java index efe707a..4d81307 100644 --- a/src/jalview/workers/AnnotationWorker.java +++ b/src/jalview/workers/AnnotationWorker.java @@ -79,7 +79,7 @@ class AnnotationWorker extends AlignCalcWorker return; } - removeAnnotations(); + // removeAnnotation(); AlignmentI alignment = alignViewport.getAlignment(); if (alignment != null) { @@ -89,10 +89,19 @@ class AnnotationWorker extends AlignCalcWorker alignment, new FeatureRenderer(alignViewport)); for (AlignmentAnnotation ann : anns) { - ann.showAllColLabels = true; - ann.graph = AlignmentAnnotation.BAR_GRAPH; - ourAnnots.add(ann); - alignment.addAnnotation(ann); + AlignmentAnnotation theAnn = alignment.findOrCreateAnnotation( + ann.label, ann.description, false, null, null); + theAnn.showAllColLabels = true; + theAnn.graph = AlignmentAnnotation.BAR_GRAPH; + theAnn.scaleColLabel = true; + theAnn.annotations = ann.annotations; + setGraphMinMax(theAnn, theAnn.annotations); + theAnn.validateRangeAndDisplay(); + if (!ourAnnots.contains(theAnn)) + { + ourAnnots.add(theAnn); + } + // alignment.addAnnotation(ann); } } catch (IndexOutOfBoundsException x) { @@ -114,19 +123,6 @@ class AnnotationWorker extends AlignCalcWorker ap.adjustAnnotationHeight(); ap.paintAlignment(true); } - - } - - /** - * Remove all our annotations before re-calculating them - */ - void removeAnnotations() - { - for (AlignmentAnnotation ann : ourAnnots) - { - alignViewport.getAlignment().deleteAnnotation(ann); - } - ourAnnots.clear(); } @Override