From: <ha...@us...> - 2006-04-04 23:58:17
|
Revision: 4912 Author: hansonr Date: 2006-04-04 16:58:10 -0700 (Tue, 04 Apr 2006) ViewCVS: http://svn.sourceforge.net/jmol/?rev=4912&view=rev Log Message: ----------- connect fix: include check for order == NULL_BOND_ORDER clean up: (1) replace numerics with appropriate defined constants (2) return NULL_BOND_ORDER not 0 from bondOrderFromString() Modified Paths: -------------- trunk/Jmol/src/org/jmol/viewer/Sticks.java Modified: trunk/Jmol/src/org/jmol/viewer/Sticks.java =================================================================== --- trunk/Jmol/src/org/jmol/viewer/Sticks.java 2006-04-04 20:35:42 UTC (rev 4911) +++ trunk/Jmol/src/org/jmol/viewer/Sticks.java 2006-04-04 23:58:10 UTC (rev 4912) @@ -53,6 +53,7 @@ void setProperty(String propertyName, Object value, BitSet bsSelected) { + //System.out.println(propertyName+" "+value+" "+bsSelected); if ("color" == propertyName) { short colix = Graphics3D.getColix(value); setColixBond(colix, @@ -163,11 +164,11 @@ void makeConnections(float minDistance, float maxDistance, short order, int connectOperation, BitSet bsA, BitSet bsB) { - /* + System.out.println("makeConnections(" + minDistance + "," + maxDistance + "," + order + "," + connectOperation + - "," + bsA + "," + bsB + ")";) - */ + "," + bsA + "," + bsB + ")"); + int atomCount = frame.atomCount; Atom[] atoms = frame.atoms; if (connectOperation == DELETE_BONDS) { @@ -178,8 +179,8 @@ autoBond(order, bsA, bsB); return; } - if (order <= 0) - order = 1; // default + if (order == NULL_BOND_ORDER) + order = JmolConstants.BOND_COVALENT_SINGLE; // default float minDistanceSquared = minDistance * minDistance; float maxDistanceSquared = maxDistance * maxDistance; for (int iA = atomCount; --iA >= 0; ) { @@ -219,7 +220,8 @@ BitSet bsDelete = new BitSet(); float minDistanceSquared = minDistance * minDistance; float maxDistanceSquared = maxDistance * maxDistance; - if ((order & JmolConstants.BOND_HYDROGEN_MASK) != 0) + if (order != NULL_BOND_ORDER + && (order & JmolConstants.BOND_HYDROGEN_MASK) != 0) order = JmolConstants.BOND_HYDROGEN_MASK; for (int i = bondCount; --i >= 0; ) { Bond bond = bonds[i]; @@ -231,7 +233,7 @@ float distanceSquared = atom1.point3f.distanceSquared(atom2.point3f); if (distanceSquared >= minDistanceSquared && distanceSquared <= maxDistanceSquared) - if (order <= 0 || // order defaulted to -1 + if (order == NULL_BOND_ORDER || order == (bond.order & ~JmolConstants.BOND_SULFUR_MASK) || (order & bond.order & JmolConstants.BOND_HYDROGEN_MASK) != 0) bsDelete.set(i); @@ -246,7 +248,7 @@ if (JmolConstants.bondOrderNames[i].equalsIgnoreCase(bondOrderString)) return JmolConstants.bondOrderValues[i]; } - return 0; + return NULL_BOND_ORDER; } int connectOperationFromString(String connectOperationString) { This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |