X-Git-Url: http://source.jalview.org/gitweb/?a=blobdiff_plain;f=src%2Fjalview%2Fviewmodel%2FAlignmentViewport.java;h=cbc218987ff4b54217b00f423d4438a548a59943;hb=ed96e73a6db654d52a6a1b1d27c2ee707876a4c7;hp=0ea31d7bcf4f4015bed0e4e22b8036ef19c0c6ec;hpb=40d9c9f294735841777e3a387458f1085987571b;p=jalview.git diff --git a/src/jalview/viewmodel/AlignmentViewport.java b/src/jalview/viewmodel/AlignmentViewport.java index 0ea31d7..cbc2189 100644 --- a/src/jalview/viewmodel/AlignmentViewport.java +++ b/src/jalview/viewmodel/AlignmentViewport.java @@ -663,7 +663,7 @@ public abstract class AlignmentViewport * changing choice of colour scheme (JAL-2386) */ sg.setColourScheme( - cs == null ? null : cs.getInstance(sg, hiddenRepSequences)); + cs == null ? null : cs.getInstance(this, sg)); if (cs != null) { sg.getGroupColourScheme().alignmentChanged(sg, @@ -959,6 +959,7 @@ public abstract class AlignmentViewport ranges = null; currentTree = null; selectionGroup = null; + colSel = null; setAlignment(null); } @@ -1693,11 +1694,29 @@ public abstract class AlignmentViewport public jalview.datamodel.AlignmentView getAlignmentView( boolean selectedOnly, boolean markGroups) { - return new AlignmentView(alignment, alignment.getHiddenColumns(), - selectionGroup, + return getAlignmentViewWithComplement(selectedOnly,markGroups,true); + } + + @Override + public jalview.datamodel.AlignmentView getAlignmentViewWithComplement( + boolean selectedOnly, boolean markGroups,boolean withComplment) + { + AlignmentView complementView = null; + if (withComplment) + { + if (codingComplement != null) + { + complementView = codingComplement.getAlignmentViewWithComplement( + selectedOnly, markGroups, false); + } + } + AlignmentView thisView = new AlignmentView(alignment, + alignment.getHiddenColumns(), selectionGroup, alignment.getHiddenColumns() != null && alignment.getHiddenColumns().hasHiddenColumns(), selectedOnly, markGroups); + thisView.setComplement(complementView); + return thisView; } @Override @@ -2716,6 +2735,30 @@ public abstract class AlignmentViewport viewStyle.setProteinFontAsCdna(b); } + @Override + public void setShowComplementFeatures(boolean b) + { + viewStyle.setShowComplementFeatures(b); + } + + @Override + public boolean isShowComplementFeatures() + { + return viewStyle.isShowComplementFeatures(); + } + + @Override + public void setShowComplementFeaturesOnTop(boolean b) + { + viewStyle.setShowComplementFeaturesOnTop(b); + } + + @Override + public boolean isShowComplementFeaturesOnTop() + { + return viewStyle.isShowComplementFeaturesOnTop(); + } + /** * @return true if view should scroll to show the highlighted region of a * sequence @@ -2956,4 +2999,86 @@ public abstract class AlignmentViewport { return currentTree; } + + /** + * flag set to indicate if structure views might be out of sync with sequences + * in the alignment + */ + + private boolean needToUpdateStructureViews = false; + + @Override + public boolean isUpdateStructures() + { + return needToUpdateStructureViews; + } + + @Override + public void setUpdateStructures(boolean update) + { + needToUpdateStructureViews = update; + } + + @Override + public boolean needToUpdateStructureViews() + { + boolean update = needToUpdateStructureViews; + needToUpdateStructureViews = false; + return update; + } + + @Override + public void addSequenceGroup(SequenceGroup sequenceGroup) + { + alignment.addGroup(sequenceGroup); + + Color col = sequenceGroup.idColour; + if (col != null) + { + col = col.brighter(); + + for (SequenceI sq : sequenceGroup.getSequences()) + { + setSequenceColour(sq, col); + } + } + + if (codingComplement != null) + { + SequenceGroup mappedGroup = MappingUtils + .mapSequenceGroup(sequenceGroup, this, codingComplement); + if (mappedGroup.getSequences().size() > 0) + { + codingComplement.getAlignment().addGroup(mappedGroup); + + if (col != null) + { + for (SequenceI seq : mappedGroup.getSequences()) + { + codingComplement.setSequenceColour(seq, col); + } + } + } + // propagate the structure view update flag according to our own setting + codingComplement.setUpdateStructures(needToUpdateStructureViews); + } + } + + @Override + public Iterator getViewAsVisibleContigs(boolean selectedRegionOnly) + { + int start = 0; + int end = 0; + if (selectedRegionOnly && selectionGroup != null) + { + start = selectionGroup.getStartRes(); + end = selectionGroup.getEndRes() + 1; + } + else + { + end = alignment.getWidth(); + } + return (alignment.getHiddenColumns().getVisContigsIterator(start, end, + false)); + } }