From: <ha...@us...> - 2007-05-17 07:21:18
|
Revision: 7729 http://svn.sourceforge.net/jmol/?rev=7729&view=rev Author: hansonr Date: 2007-05-17 00:21:15 -0700 (Thu, 17 May 2007) Log Message: ----------- 11.1.41 feature fix for load append losing shape: save/restore shape Modified Paths: -------------- trunk/Jmol/src/org/jmol/modelframe/Frame.java trunk/Jmol/src/org/jmol/modelframe/Mmset.java trunk/Jmol/src/org/jmol/modelframe/Model.java trunk/Jmol/src/org/jmol/shapebio/AminoPolymer.java trunk/Jmol/src/org/jmol/shapebio/Mps.java trunk/Jmol/src/org/jmol/viewer/Eval.java trunk/Jmol/src/org/jmol/viewer/StateManager.java trunk/Jmol/src/org/jmol/viewer/Token.java trunk/Jmol/src/org/jmol/viewer/Viewer.java Modified: trunk/Jmol/src/org/jmol/modelframe/Frame.java =================================================================== --- trunk/Jmol/src/org/jmol/modelframe/Frame.java 2007-05-17 07:15:57 UTC (rev 7728) +++ trunk/Jmol/src/org/jmol/modelframe/Frame.java 2007-05-17 07:21:15 UTC (rev 7729) @@ -2757,7 +2757,6 @@ + " \"" + d + " ? " + atom.getIdentity() + "\""); dMin = Math.min(d, dMin); } - //System.out.println("frame calcsurf " + i + " " + dMin); int d = surfaceDistance100s[i] = (int) (dMin * 100); surfaceDistanceMax = Math.max(surfaceDistanceMax, d); } @@ -3282,7 +3281,6 @@ void setTrajectory(int iTraj) { if (trajectories == null || iTraj < 0 || iTraj >= trajectories.size()) return; - //System.out.println("setting trajectory " + iTraj); Point3f[] trajectory = (Point3f[]) trajectories.get(iTraj); for (int i = atomCount; --i >= 0;) atoms[i].set(trajectory[i]); Modified: trunk/Jmol/src/org/jmol/modelframe/Mmset.java =================================================================== --- trunk/Jmol/src/org/jmol/modelframe/Mmset.java 2007-05-17 07:15:57 UTC (rev 7728) +++ trunk/Jmol/src/org/jmol/modelframe/Mmset.java 2007-05-17 07:21:15 UTC (rev 7729) @@ -397,7 +397,6 @@ Structure structure = structures[i]; for (int j = modelCount; --j >= 0;) if (structure.modelIndex == j || structure.modelIndex == -1) { - System.out.println("adding " + structureCount + " structures from file -- model "+ structure.modelIndex); models[j].addSecondaryStructure(structure.type, structure.startChainID, structure.startSeqcode, structure.endChainID, structure.endSeqcode); Modified: trunk/Jmol/src/org/jmol/modelframe/Model.java =================================================================== --- trunk/Jmol/src/org/jmol/modelframe/Model.java 2007-05-17 07:15:57 UTC (rev 7728) +++ trunk/Jmol/src/org/jmol/modelframe/Model.java 2007-05-17 07:21:15 UTC (rev 7729) @@ -124,24 +124,19 @@ void addSecondaryStructure(byte type, char startChainID, int startSeqcode, char endChainID, int endSeqcode) { - System.out.println ("model.addsecondarystructure model= " + modelIndex + " bioPolymerCount = " + bioPolymerCount); for (int i = bioPolymerCount; --i >= 0; ) { Polymer polymer = bioPolymers[i]; - //System.out.println(i+" ; " + polymer); polymer.addSecondaryStructure(type, startChainID, startSeqcode, endChainID, endSeqcode); } } void calculateStructures() { - //Logger.debug("Model.calculateStructures"); for (int i = bioPolymerCount; --i >= 0; ) bioPolymers[i].calculateStructures(); - //System.out.println("model:calculateStructures for model " +modelIndex); } void setConformation(BitSet bsConformation) { - //Logger.debug("Model.calculateStructures"); for (int i = bioPolymerCount; --i >= 0; ) bioPolymers[i].setConformation(bsConformation, nAltLocs); } Modified: trunk/Jmol/src/org/jmol/shapebio/AminoPolymer.java =================================================================== --- trunk/Jmol/src/org/jmol/shapebio/AminoPolymer.java 2007-05-17 07:15:57 UTC (rev 7728) +++ trunk/Jmol/src/org/jmol/shapebio/AminoPolymer.java 2007-05-17 07:21:15 UTC (rev 7729) @@ -274,7 +274,7 @@ public void calculateStructures() { //deprecated: calcHydrogenBonds(); - System.out.println("calculateStructures for model " + this.model.getModelIndex()); + //System.out.println("calculateStructures for model " + this.model.getModelIndex()); char[] structureTags = new char[monomerCount]; for (int i = 0; i < monomerCount - 1; ++i) { @@ -360,8 +360,6 @@ start = end; } } - - System.out.println("done calculateStructures for model " + this.model.getModelIndex()); } Modified: trunk/Jmol/src/org/jmol/shapebio/Mps.java =================================================================== --- trunk/Jmol/src/org/jmol/shapebio/Mps.java 2007-05-17 07:15:57 UTC (rev 7728) +++ trunk/Jmol/src/org/jmol/shapebio/Mps.java 2007-05-17 07:21:15 UTC (rev 7729) @@ -52,6 +52,8 @@ public final void initFrame() { mmset = frame.getMmset(); atoms = frame.atoms; + mpsmodels = null; + initialize(); } public void setSize(int size, BitSet bsSelected) { Modified: trunk/Jmol/src/org/jmol/viewer/Eval.java =================================================================== --- trunk/Jmol/src/org/jmol/viewer/Eval.java 2007-05-17 07:15:57 UTC (rev 7728) +++ trunk/Jmol/src/org/jmol/viewer/Eval.java 2007-05-17 07:21:15 UTC (rev 7729) @@ -6928,6 +6928,10 @@ if (!isSyntaxCheck) viewer.saveState(saveName); return; + case Token.shape: + if (!isSyntaxCheck) + viewer.saveShape(saveName); + return; case Token.identifier: if (parameterAsString(1).equalsIgnoreCase("selection")) { if (!isSyntaxCheck) @@ -6936,7 +6940,7 @@ } } } - evalError(GT._("save what?") + " bonds? orientation? selection? state?"); + evalError(GT._("save what?") + " bonds? orientation? selection? shape? state?"); } void restore() throws ScriptException { @@ -6965,6 +6969,14 @@ invalidArgument(); runScript(state); return; + case Token.shape: + if (isSyntaxCheck) + return; + String shape = viewer.getSavedShape(saveName); + if (shape == null) + invalidArgument(); + runScript(shape); + return; case Token.identifier: if (parameterAsString(1).equalsIgnoreCase("selection")) { if (!isSyntaxCheck) @@ -6973,7 +6985,7 @@ } } } - evalError(GT._("restore what?") + " bonds? orientation? selection?"); + evalError(GT._("restore what?") + " bonds? orientation? selection? shape? state?"); } void write() throws ScriptException { @@ -7248,6 +7260,16 @@ if (!isSyntaxCheck) msg = viewer.getSavedState(name); break; + case Token.shape: + if ((len = statementLength) == 2) { + if (!isSyntaxCheck) + msg = viewer.getShape(); + break; + } + String shape = parameterAsString(2); + if (!isSyntaxCheck) + msg = viewer.getSavedShape(shape); + break; case Token.data: String type = ((len = statementLength) == 3 ? parameterAsString(2) : null); if (!isSyntaxCheck) { Modified: trunk/Jmol/src/org/jmol/viewer/StateManager.java =================================================================== --- trunk/Jmol/src/org/jmol/viewer/StateManager.java 2007-05-17 07:15:57 UTC (rev 7728) +++ trunk/Jmol/src/org/jmol/viewer/StateManager.java 2007-05-17 07:21:15 UTC (rev 7729) @@ -33,7 +33,6 @@ import org.jmol.g3d.Graphics3D; import org.jmol.modelframe.Bond; import org.jmol.modelframe.Frame; -import org.jmol.util.CommandHistory; import org.jmol.util.Escape; import org.jmol.util.TextFormat; @@ -87,6 +86,7 @@ String lastConnections = ""; String lastSelected = ""; String lastState = ""; + String lastShape = ""; StateManager(Viewer viewer) { this.viewer = viewer; @@ -190,7 +190,7 @@ String script = (String) saved.get(name); return (script == null ? "" : script); } - +/* boolean restoreState(String saveName) { //not used -- more efficient just to run the script String name = (saveName.length() > 0 ? "State_" + saveName @@ -201,7 +201,19 @@ viewer.script(script + CommandHistory.NOHISTORYATALL_FLAG); return true; } +*/ + void saveShape(String saveName) { + saveName = lastShape = "Shape_" + saveName; + saved.put(saveName, viewer.getShape()); + } + String getSavedShape(String saveName) { + String name = (saveName.length() > 0 ? "Shape_" + saveName + : lastShape); + String script = (String) saved.get(name); + return (script == null ? "" : script); + } + void saveOrientation(String saveName) { Orientation o = new Orientation(); o.saveName = lastOrientation = "Orientation_" + saveName; @@ -962,7 +974,7 @@ if (set.length() < 5) // nothing selected continue; if (!set.equals(setPrev)) - appendCmd(s, selectCmd + " " + (set.equals(strAll) ? "*" : set)); + appendCmd(s, selectCmd + " " + (set.equals(strAll) && false? "*" : set)); setPrev = set; if (key.indexOf("-") != 0) // - for key means none required appendCmd(s, key); Modified: trunk/Jmol/src/org/jmol/viewer/Token.java =================================================================== --- trunk/Jmol/src/org/jmol/viewer/Token.java 2007-05-17 07:15:57 UTC (rev 7728) +++ trunk/Jmol/src/org/jmol/viewer/Token.java 2007-05-17 07:21:15 UTC (rev 7729) @@ -718,6 +718,7 @@ final static int frontlit = misc | 86; final static int backlit = misc | 87; final static int fullylit = misc | 88; + final static int shape = misc | 89; // predefined Tokens: @@ -936,6 +937,7 @@ "transform", new Token(transform), "orientation", new Token(orientation), "state", new Token(state), + "shape", new Token(shape), "url", new Token(url), // atom expressions Modified: trunk/Jmol/src/org/jmol/viewer/Viewer.java =================================================================== --- trunk/Jmol/src/org/jmol/viewer/Viewer.java 2007-05-17 07:15:57 UTC (rev 7728) +++ trunk/Jmol/src/org/jmol/viewer/Viewer.java 2007-05-17 07:21:15 UTC (rev 7729) @@ -411,11 +411,15 @@ return stateManager.getSavedState(saveName); } - boolean restoreState(String saveName) { + void saveShape(String saveName) { //from Eval - return stateManager.restoreState(saveName); + stateManager.saveShape(saveName); } + String getSavedShape(String saveName) { + return stateManager.getSavedShape(saveName); + } + void saveSelection(String saveName) { //from Eval stateManager.saveSelection(saveName, selectionManager.bsSelection); @@ -2194,6 +2198,11 @@ return s.toString(); } + public String getShape() { + return modelManager.getState(); + } + + static Hashtable dataValues = new Hashtable(); static void setData(String type, Object[] data, int atomCount, int matchField, int field) { This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |