package ext.edu.ucsf.rbvi.strucviz2;
-import jalview.ws.HttpClientUtils;
-
import java.awt.Color;
import java.io.BufferedReader;
import java.io.File;
import ext.edu.ucsf.rbvi.strucviz2.StructureManager.ModelType;
import ext.edu.ucsf.rbvi.strucviz2.port.ListenerThreads;
+import jalview.ws.HttpClientUtils;
+
/**
* This object maintains the Chimera communication information.
*/
ModelType type)
{
logger.info("chimera open " + modelPath);
- stopListening();
+ // stopListening();
List<String> response = null;
// TODO: [Optional] Handle modbase models
if (type == ModelType.MODBASE_MODEL)
}
sendChimeraCommand("focus", false);
- startListening();
+ // startListening(); // see ChimeraListener
return models;
}
public void startListening()
{
- sendChimeraCommand("listen start models; listen start select", false);
+ sendChimeraCommand("listen start models; listen start selection", false);
}
public void stopListening()
{
- sendChimeraCommand("listen stop models; listen stop select", false);
+ sendChimeraCommand("listen stop models; listen stop selection", false);
+ }
+
+ /**
+ * Tell Chimera we are listening on the given URI
+ *
+ * @param uri
+ */
+ public void startListening(String uri)
+ {
+ sendChimeraCommand("listen start models url " + uri, false);
+ sendChimeraCommand("listen start select prefix SelectionChanged url "
+ + uri, false);
+ }
+
+ /**
+ * Tell Chimera we have stopped listening on the given URI
+ *
+ * @param uri
+ */
+ public void stopListening(String uri)
+ {
+ sendChimeraCommand("listen stop models url " + uri, false);
+ sendChimeraCommand("listen stop selection url " + uri, false);
}
/**
*/
public void select(String command)
{
- sendChimeraCommand("listen stop select; " + command
- + "; listen start select", false);
+ sendChimeraCommand("listen stop selection; " + command
+ + "; listen start selection", false);
}
public void focus()
return selectedModelsMap;
}
+ /**
+ * Sends a 'list selection level residue' command to Chimera and returns the
+ * list of selected atomspecs
+ *
+ * @return
+ */
public List<String> getSelectedResidueSpecs()
{
List<String> selectedResidues = new ArrayList<String>();
structureManager.setChimeraPathProperty(workingPath);
// TODO: [Optional] Check Chimera version and show a warning if below 1.8
// Ask Chimera to give us updates
- startListening();
+ // startListening(); // later - see ChimeraListener
return true;
}
*/
protected List<String> sendRestCommand(String command)
{
+ // System.out.println("Rest: " + command);
// TODO start a separate thread to do this so we don't block?
String restUrl = "http://127.0.0.1:" + this.chimeraRestPort + "/run";
List<NameValuePair> commands = new ArrayList<NameValuePair>(1);
{
return busy;
}
-
}