Author: scooter
Date: 2011-10-25 16:44:49 -0700 (Tue, 25 Oct 2011)
New Revision: 27304

Modified:
   
csplugins/trunk/ucsf/scooter/structureViz/src/structureViz/actions/Chimera.java
   
csplugins/trunk/ucsf/scooter/structureViz/src/structureViz/actions/OpenTask.java
   
csplugins/trunk/ucsf/scooter/structureViz/src/structureViz/model/Structure.java
Log:
Fixed some problems with the open structure detection


Modified: 
csplugins/trunk/ucsf/scooter/structureViz/src/structureViz/actions/Chimera.java
===================================================================
--- 
csplugins/trunk/ucsf/scooter/structureViz/src/structureViz/actions/Chimera.java 
    2011-10-25 21:50:50 UTC (rev 27303)
+++ 
csplugins/trunk/ucsf/scooter/structureViz/src/structureViz/actions/Chimera.java 
    2011-10-25 23:44:49 UTC (rev 27304)
@@ -153,20 +153,6 @@
        }
 
        /**
-        * Return true if this structure is currently open
-        *
-        * @param structure the Structure we're inquiring about
-        * @return true if open
-        */
-       public boolean isOpen(Structure structure) {
-               // Get the model number
-               int modelNumber = structure.modelNumber();
-               if (modelHash.containsKey(modelNumber))
-                       return true;
-               return false;
-       }
-
-       /**
         * Return our network view
         *
         * @return the network view we were created with
@@ -231,6 +217,19 @@
        }
 
        /**
+        * Return true if this structure is currently open
+        *
+        * @param structure the Structure we're inquiring about
+        * @return true if open
+        */
+       public boolean containsModel(Structure structure) {
+               // Get the model number
+               int modelNumber = structure.modelNumber();
+               int subModelNumber = structure.subModelNumber();
+               return containsModel(modelNumber, subModelNumber);
+       }
+
+       /**
         * Test to see if we currently have a particular model open.
         *
         * @param modelNumber the model number expressed as an int

Modified: 
csplugins/trunk/ucsf/scooter/structureViz/src/structureViz/actions/OpenTask.java
===================================================================
--- 
csplugins/trunk/ucsf/scooter/structureViz/src/structureViz/actions/OpenTask.java
    2011-10-25 21:50:50 UTC (rev 27303)
+++ 
csplugins/trunk/ucsf/scooter/structureViz/src/structureViz/actions/OpenTask.java
    2011-10-25 23:44:49 UTC (rev 27304)
@@ -65,12 +65,12 @@
                        // System.out.println("Looking at structure 
"+structure.name());
                        // See if this structure is already open somewhere
                        Structure s = CyChimera.findStructureForModel(null, 
structureName, false);
-                       if (s != null) {
+                       if (s != null && s.modelNumber() >= 0) {
                                // System.out.println("Found existing 
structure: "+s.toString()+", model = "+s.modelNumber());
                                s.addStructure(structure);
                                structure = s;
                        }
-                       if (!chimera.isOpen(structure))
+                       if (!chimera.containsModel(structure))
                                chimera.open(structure);
                }
        }

Modified: 
csplugins/trunk/ucsf/scooter/structureViz/src/structureViz/model/Structure.java
===================================================================
--- 
csplugins/trunk/ucsf/scooter/structureViz/src/structureViz/model/Structure.java 
    2011-10-25 21:50:50 UTC (rev 27303)
+++ 
csplugins/trunk/ucsf/scooter/structureViz/src/structureViz/model/Structure.java 
    2011-10-25 23:44:49 UTC (rev 27304)
@@ -115,7 +115,7 @@
        protected Structure (String name, Map<GraphObject, GraphObject> goMap, 
                             StructureType type) {
                this.structureName = name;
-               this.modelNumber = nextModel;
+               this.modelNumber = -1;
                this.subModelNumber = 0;
                this.residueMap = new HashMap<GraphObject, List<String>>();
                this.type = type;

-- 
You received this message because you are subscribed to the Google Groups 
"cytoscape-cvs" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/cytoscape-cvs?hl=en.

Reply via email to