*/
void updateTitleAndMenus();
+ boolean isAlignAddedStructures();
+
+ void setAlignAddedStructures(boolean alignAdded);
+
}
{
progressBar = ap.alignFrame;
- openNewJmol(ap, new PDBEntry[] { pdbentry }, new SequenceI[][] { seq });
+ openNewJmol(ap, alignAddedStructures, new PDBEntry[] { pdbentry },
+ new SequenceI[][]
+ { seq });
}
- private void openNewJmol(AlignmentPanel ap, PDBEntry[] pdbentrys,
+ private void openNewJmol(AlignmentPanel ap, boolean alignAdded,
+ PDBEntry[] pdbentrys,
SequenceI[][] seqs)
{
progressBar = ap.alignFrame;
addAlignmentPanel(ap);
useAlignmentPanelForColourbyseq(ap);
- alignAddedStructures = true;
- useAlignmentPanelForSuperposition(ap);
+ alignAddedStructures = alignAdded;
+ useAlignmentPanelForSuperposition(ap);
jmb.setColourBySequence(true);
setSize(400, 400); // probably should be a configurable/dynamic default here
}
/**
- * create a new Jmol containing several structures superimposed using the
- * given alignPanel.
+ * create a new Jmol containing several structures optionally superimposed
+ * using the given alignPanel.
*
* @param ap
+ * @param alignAdded
+ * - true to superimpose
* @param pe
* @param seqs
*/
- public AppJmol(AlignmentPanel ap, PDBEntry[] pe, SequenceI[][] seqs)
+ public AppJmol(AlignmentPanel ap, boolean alignAdded, PDBEntry[] pe,
+ SequenceI[][] seqs)
{
- openNewJmol(ap, pe, seqs);
+ openNewJmol(ap, alignAdded, pe, seqs);
}
jmb.updateColours(ap);
}
// do superposition if asked to
- if (Cache.getDefault("AUTOSUPERIMPOSE", true) && alignAddedStructures)
+ if (alignAddedStructures)
{
alignAddedStructures();
}
}
}
});
- alignAddedStructures = false;
+
}
/**
if (pdbentrys.length > 1)
{
- alignAddedStructures = true;
useAlignmentPanelForSuperposition(ap);
}
jmb.setColourBySequence(true);
}
/**
- * create a new viewer containing several structures superimposed using the
- * given alignPanel.
+ * create a new viewer containing several structures, optionally superimposed
+ * using the given alignPanel.
*
* @param pe
* @param seqs
* @param ap
*/
- public ChimeraViewFrame(PDBEntry[] pe, SequenceI[][] seqs,
+ public ChimeraViewFrame(PDBEntry[] pe, boolean alignAdded,
+ SequenceI[][] seqs,
AlignmentPanel ap)
{
this();
+ setAlignAddedStructures(alignAdded);
openNewChimera(ap, pe, seqs);
}
jmb.updateColours(ap);
}
// do superposition if asked to
- if (Cache.getDefault("AUTOSUPERIMPOSE", true) && alignAddedStructures)
+ if (alignAddedStructures)
{
new Thread(new Runnable()
{
alignStructs_withAllAlignPanels();
}
}).start();
- alignAddedStructures = false;
}
addingStructures = false;
}
StructureSelectionManager ssm;
+ /**
+ * decide if new structures are aligned to existing ones
+ */
+ private boolean superposeAdded = true;
+
public enum ViewerType
{
JMOL, CHIMERA
new SequenceI[seqsForPdbs.size()][]);
if (sview != null)
{
+ sview.setAlignAddedStructures(superposeAdded);
new Thread(new Runnable()
{
@Override
if (viewerType.equals(ViewerType.JMOL))
{
- sview = new AppJmol(ap, pdbsForFile, theSeqs);
+ sview = new AppJmol(ap, superposeAdded, pdbsForFile, theSeqs);
}
else if (viewerType.equals(ViewerType.CHIMERA))
{
- sview = new ChimeraViewFrame(pdbsForFile, theSeqs, ap);
+ sview = new ChimeraViewFrame(pdbsForFile, superposeAdded, theSeqs,
+ ap);
}
else
{
{
if (sview != null)
{
+ sview.setAlignAddedStructures(superposeAdded);
if (!sview.addAlreadyLoadedFile(seqsForPdb, null, ap, pdb.getId()))
{
sview.addToExistingViewer(pdb, seqsForPdb, null, ap, pdb.getId());
return sview != null && sview.isVisible();
}
+ public void setSuperpose(boolean alignAddedStructures)
+ {
+ superposeAdded = alignAddedStructures;
+ }
+
}
}
/**
+ * @return true if added structures should be aligned to existing one(s)
+ */
+ @Override
+ public boolean isAlignAddedStructures()
+ {
+ return alignAddedStructures;
+ }
+
+ /**
+ *
+ * @param true
+ * if added structures should be aligned to existing one(s)
+ */
+ @Override
+ public void setAlignAddedStructures(boolean alignAdded)
+ {
+ alignAddedStructures = alignAdded;
+ }
+
+ /**
*
* @param ap2
* @return true if this Jmol instance is linked with the given alignPanel
*/
protected void addStructure(final PDBEntry pdbentry,
final SequenceI[] seqs, final String[] chains,
- final boolean align, final IProgressIndicator alignFrame)
+ final IProgressIndicator alignFrame)
{
if (pdbentry.getFile() == null)
{
}
}
// and call ourselves again.
- addStructure(pdbentry, seqs, chains, align, alignFrame);
+ addStructure(pdbentry, seqs, chains, alignFrame);
}
}).start();
return;
{ seqs }, new String[][] { chains });
addingStructures = true;
_started = false;
- alignAddedStructures = align;
worker = new Thread(this);
worker.start();
return;
}
- /**
- * Presents a dialog with the option to add an align a structure to an
- * existing structure view
- *
- * @param pdbId
- * @param view
- * @return YES, NO or CANCEL JvOptionPane code
- */
- protected int chooseAlignStructureToViewer(String pdbId,
- StructureViewerBase view)
- {
- int option = JvOptionPane.showInternalConfirmDialog(Desktop.desktop,
- MessageManager.formatMessage("label.add_pdbentry_to_view",
- new Object[]
- { pdbId, view.getTitle() }),
- MessageManager
- .getString("label.align_to_existing_structure_view"),
- JvOptionPane.YES_NO_CANCEL_OPTION);
- return option;
- }
-
protected boolean hasPdbId(String pdbId)
{
return getBinding().hasPdbId(pdbId);
AlignmentPanel ap = (AlignmentPanel) apanel; // Implementation error if this
// cast fails
useAlignmentPanelForSuperposition(ap);
- addStructure(pdbentry, seq, chains, true, ap.alignFrame);
+ addStructure(pdbentry, seq, chains, ap.alignFrame);
return true;
}