Skip to content

Commit

Permalink
Use local variables.
Browse files Browse the repository at this point in the history
  • Loading branch information
johnmay committed Nov 7, 2015
1 parent 0627c8e commit 68a1824
Showing 1 changed file with 16 additions and 17 deletions.
33 changes: 16 additions & 17 deletions tool/sdg/src/main/java/org/openscience/cdk/layout/RingPlacer.java
Original file line number Diff line number Diff line change
Expand Up @@ -619,36 +619,35 @@ Vector2d getRingCenterOfFirstRing(IRing ring, Vector2d bondVector, double bondLe
* @param ring The Ring for which all connected rings in RingSet are to be layed out.
*/
void placeConnectedRings(IRingSet rs, IRing ring, int handleType, double bondLength) {
IRingSet connectedRings = rs.getConnectedRings(ring);
IRing connectedRing;
IAtomContainer sharedAtoms;
int sac;
Point2d oldRingCenter, sharedAtomsCenter, tempPoint;
Vector2d tempVector, oldRingCenterVector, newRingCenterVector;
final IRingSet connectedRings = rs.getConnectedRings(ring);

// logger.debug(rs.reportRingList(molecule));
for (IAtomContainer container : connectedRings.atomContainers()) {
connectedRing = (IRing) container;
final IRing connectedRing = (IRing) container;
if (!connectedRing.getFlag(CDKConstants.ISPLACED)) {
// logger.debug(ring.toString(molecule));
// logger.debug(connectedRing.toString(molecule));
sharedAtoms = AtomContainerManipulator.getIntersection(ring, connectedRing);
sac = sharedAtoms.getAtomCount();
final IAtomContainer sharedAtoms = AtomContainerManipulator.getIntersection(ring, connectedRing);
final int numSharedAtoms = sharedAtoms.getAtomCount();
logger.debug("placeConnectedRings-> connectedRing: " + (ring.toString()));
if ((sac == 2 && handleType == FUSED) || (sac == 1 && handleType == SPIRO)
|| (sac > 2 && handleType == BRIDGED)) {
sharedAtomsCenter = GeometryUtil.get2DCenter(sharedAtoms);
oldRingCenter = GeometryUtil.get2DCenter(ring);
tempVector = (new Vector2d(sharedAtomsCenter));
newRingCenterVector = new Vector2d(tempVector);
if ((numSharedAtoms == 2 && handleType == FUSED) ||
(numSharedAtoms == 1 && handleType == SPIRO) ||
(numSharedAtoms > 2 && handleType == BRIDGED)) {

System.err.println("place");

final Point2d sharedAtomsCenter = GeometryUtil.get2DCenter(sharedAtoms);
final Point2d oldRingCenter = GeometryUtil.get2DCenter(ring);
final Vector2d tempVector = (new Vector2d(sharedAtomsCenter));
final Vector2d newRingCenterVector = new Vector2d(tempVector);
newRingCenterVector.sub(new Vector2d(oldRingCenter));
oldRingCenterVector = new Vector2d(newRingCenterVector);
final Vector2d oldRingCenterVector = new Vector2d(newRingCenterVector);
logger.debug("placeConnectedRing -> tempVector: " + tempVector + ", tempVector.length: "
+ tempVector.length());
logger.debug("placeConnectedRing -> bondCenter: " + sharedAtomsCenter);
logger.debug("placeConnectedRing -> oldRingCenterVector.length(): " + oldRingCenterVector.length());
logger.debug("placeConnectedRing -> newRingCenterVector.length(): " + newRingCenterVector.length());
tempPoint = new Point2d(sharedAtomsCenter);
final Point2d tempPoint = new Point2d(sharedAtomsCenter);
tempPoint.add(newRingCenterVector);
placeRing(connectedRing, sharedAtoms, sharedAtomsCenter, newRingCenterVector, bondLength);
connectedRing.setFlag(CDKConstants.ISPLACED, true);
Expand Down

0 comments on commit 68a1824

Please sign in to comment.