X-Git-Url: http://source.jalview.org/gitweb/?a=blobdiff_plain;f=src%2Fext%2Fedu%2Fucsf%2Frbvi%2Fstrucviz2%2FChimeraManager.java;h=3ed27a3ddac19ea4cd3d65240ad0e094931aabc2;hb=f2f654875a6eb5f4e90b2c5c545bfed3a70f2b5f;hp=b74e65ae1019af52d8ce2a84620a47f84dfbba7f;hpb=e18dbe61c8206a892604fc4726472ce9d067c1e4;p=jalview.git diff --git a/src/ext/edu/ucsf/rbvi/strucviz2/ChimeraManager.java b/src/ext/edu/ucsf/rbvi/strucviz2/ChimeraManager.java index b74e65a..3ed27a3 100644 --- a/src/ext/edu/ucsf/rbvi/strucviz2/ChimeraManager.java +++ b/src/ext/edu/ucsf/rbvi/strucviz2/ChimeraManager.java @@ -1,7 +1,5 @@ package ext.edu.ucsf.rbvi.strucviz2; -import jalview.ws.HttpClientUtils; - import java.awt.Color; import java.io.BufferedReader; import java.io.File; @@ -22,6 +20,8 @@ import org.slf4j.LoggerFactory; 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. */ @@ -177,7 +177,7 @@ public class ChimeraManager ModelType type) { logger.info("chimera open " + modelPath); - stopListening(); + // stopListening(); List response = null; // TODO: [Optional] Handle modbase models if (type == ModelType.MODBASE_MODEL) @@ -281,7 +281,7 @@ public class ChimeraManager } sendChimeraCommand("focus", false); - startListening(); + // startListening(); // see ChimeraListener return models; } @@ -339,12 +339,35 @@ public class ChimeraManager 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); } /** @@ -355,8 +378,8 @@ public class ChimeraManager */ 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() @@ -407,6 +430,12 @@ public class ChimeraManager return selectedModelsMap; } + /** + * Sends a 'list selection level residue' command to Chimera and returns the + * list of selected atomspecs + * + * @return + */ public List getSelectedResidueSpecs() { List selectedResidues = new ArrayList(); @@ -561,7 +590,7 @@ public class ChimeraManager 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; } @@ -775,6 +804,7 @@ public class ChimeraManager */ protected List 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 commands = new ArrayList(1); @@ -850,5 +880,4 @@ public class ChimeraManager { return busy; } - }