private boolean loadingFromArchive = false;
/**
- * second flag to indicate if the jmol viewer should ignore sequence colouring
- * events from the structure manager because the GUI is still setting up
+ * second flag to indicate if the Chimera viewer should ignore sequence
+ * colouring events from the structure manager because the GUI is still
+ * setting up
*/
private boolean loadingFinished = true;
/**
- * state flag used to check if the Jmol viewer's paint method can be called
+ * state flag used to check if the Chimera viewer's paint method can be called
*/
private boolean finishedInit = false;
} catch (Error e)
{
}
- // Explicitly map to the filename used by Jmol ;
+ // Explicitly map to the filename used by Chimera ;
// pdbentry[pe].getFile(), protocol);
if (ssm != null)
}
viewer = new ChimeraManager(
csm = new ext.edu.ucsf.rbvi.strucviz2.StructureManager(true));
- /*
- * viewer = JmolViewer.allocateViewer(renderPanel, new SmarterJmolAdapter(),
- * "jalviewJmol", ap.av.applet .getDocumentBase(),
- * ap.av.applet.getCodeBase(), "", this);
- *
- * jmolpopup = JmolPopup.newJmolPopup(viewer, true, "Jmol", true);
- */
}
public JalviewChimeraBinding(StructureSelectionManager ssm,
{
viewer.exitChimera();
}
- // viewer.evalStringQuiet("zap");
- // viewer.setJmolStatusListener(null);
lastCommand = null;
viewer = null;
releaseUIResources();
}
/**
- * called by JalviewJmolbinding after closeViewer is called - release any
+ * called by JalviewChimerabinding after closeViewer is called - release any
* resources and references so they can be garbage collected.
*/
protected abstract void releaseUIResources();
public void colourByChain()
{
colourBySequence = false;
- // TODO: colour by chain should colour each chain distinctly across all
- // visible models
- // TODO: http://issues.jalview.org/browse/JAL-628
+ // this is not a valid Chimera command; is there one? Menu option hidden
evalStateCommand("select *;color chain",false);
}
public void colourByCharge()
{
colourBySequence = false;
- evalStateCommand("colour *;color white;select ASP,GLU;color red;"
- + "select LYS,ARG;color blue;select CYS;color yellow", false);
+ evalStateCommand(
+ "color white;color red ::ASP;color red ::GLU;color blue ::LYS;color blue ::ARG;color yellow ::CYS",
+ false);
}
/**
assert (_alignment.length == _refStructure.length && _alignment.length != _hiddenCols.length);
StringBuilder allComs = new StringBuilder(128); // Chimera superposition cmd
String[] files = getPdbFile();
- // check to see if we are still waiting for Jmol files
+ // check to see if we are still waiting for Chimera files
long starttime = System.currentTimeMillis();
boolean waiting = true;
do
String res;
int index;
Color col;
+ // Chimera expects RBG values in the range 0-1
+ final double normalise = 255D;
viewerCommandHistory(false);
// TODO: Switch between nucleotide or aa selection expressions
Enumeration en = ResidueProperties.aa3Hash.keys();
- StringBuffer command = new StringBuffer("select *;color white;");
+ StringBuilder command = new StringBuilder(128);
+ command.append("color white;");
while (en.hasMoreElements())
{
res = en.nextElement().toString();
}
col = cs.findColour(ResidueProperties.aa[index].charAt(0));
- // TODO: need colour string function and res selection here
- command.append("select " + res + ";color[" + col.getRed() + ","
- + col.getGreen() + "," + col.getBlue() + "];");
+ command.append("color " + col.getRed() / normalise + ","
+ + col.getGreen() / normalise + "," + col.getBlue()
+ / normalise + " ::" + res + ";");
}
evalStateCommand(command.toString(),false);
viewerCommandHistory(true);
}
- public void showHelp()
- {
- // chimera help
- showUrl("http://jmol.sourceforge.net/docs/JmolUserGuide/", "jmolHelp");
- }
-
/**
- * open the URL somehow
- *
- * @param target
- */
- public abstract void showUrl(String url, String target);
-
- /**
- * called when the binding thinks the UI needs to be refreshed after a Jmol
+ * called when the binding thinks the UI needs to be refreshed after a Chimera
* state change. this could be because structures were loaded, or because an
- * error has occured.
+ * error has occurred.
*/
public abstract void refreshGUI();
/**
*
- * @return true if Jmol is still restoring state or loading is still going on
- * (see setFinsihedLoadingFromArchive)
+ * @return true if Chimeral is still restoring state or loading is still going
+ * on (see setFinsihedLoadingFromArchive)
*/
public boolean isLoadingFromArchive()
{
loadingFinished = finishedLoading;
}
- public void setBackgroundColour(java.awt.Color col)
+ /**
+ * Send the Chimera 'background solid <color>" command.
+ *
+ * @see https
+ * ://www.cgl.ucsf.edu/chimera/current/docs/UsersGuide/midas/background
+ * .html
+ * @param col
+ */
+ public void setBackgroundColour(Color col)
{
viewerCommandHistory(false);
- // todo set background colour
- viewer.sendChimeraCommand(
- "background [" + col.getRed() + "," + col.getGreen() + ","
- + col.getBlue() + "];", false);
+ double normalise = 255D;
+ final String command = "background solid " + col.getRed() / normalise + ","
+ + col.getGreen() / normalise + "," + col.getBlue()
+ / normalise + ";";
+ viewer.sendChimeraCommand(command, false);
viewerCommandHistory(true);
}