From: Robert H. <ha...@st...> - 2010-12-08 17:10:30
|
public String getModelNumberDotted(int modelIndex) On Wed, Dec 8, 2010 at 10:19 AM, Dr. Christoph Gille < chr...@ch...> wrote: > When refering to a specific molecul in Jmol I need the model number. > I mean the number which I use in selections like "... and 3.1 " where 3 is > the model number. > > > currently I identify the model index by using viewer.getModelFileName(int) > and adding one. > > This works as long as no model has been deleted. > > What is the correct way of obtaining the model number? > > > Thanks > > Christoph > > > > This is my current code: > > > private int getModelNumber() { > final Viewer viewer=getJmolViewer(); > final String path=this.filePath; > if (viewer!=null && path!=null) { > for(int i=viewer.getModelCount(); --i>=0;) { > if (path.equals(viewer.getModelFileName(i))) return i; > } > } > return -1; > } > > > > > > ------------------------------------------------------------------------------ > This SF Dev2Dev email is sponsored by: > > WikiLeaks The End of the Free Internet > http://p.sf.net/sfu/therealnews-com > _______________________________________________ > Jmol-developers mailing list > Jmo...@li... > https://lists.sourceforge.net/lists/listinfo/jmol-developers > -- Robert M. Hanson Professor of Chemistry St. Olaf College 1520 St. Olaf Ave. Northfield, MN 55057 http://www.stolaf.edu/people/hansonr phone: 507-786-3107 If nature does not answer first what we want, it is better to take what answer we get. -- Josiah Willard Gibbs, Lecture XXX, Monday, February 5, 1900 |