From: <mar...@us...> - 2010-06-03 13:58:34
|
Revision: 15550 http://cdk.svn.sourceforge.net/cdk/?rev=15550&view=rev Author: mark_rynbeek Date: 2010-06-03 13:58:27 +0000 (Thu, 03 Jun 2010) Log Message: ----------- Speeds up rotation Modified Paths: -------------- jchempaint/trunk/src/main/org/openscience/jchempaint/controller/Rotate3DModule.java jchempaint/trunk/src/main/org/openscience/jchempaint/controller/RotateModule.java Modified: jchempaint/trunk/src/main/org/openscience/jchempaint/controller/Rotate3DModule.java =================================================================== --- jchempaint/trunk/src/main/org/openscience/jchempaint/controller/Rotate3DModule.java 2010-06-02 08:25:15 UTC (rev 15549) +++ jchempaint/trunk/src/main/org/openscience/jchempaint/controller/Rotate3DModule.java 2010-06-03 13:58:27 UTC (rev 15550) @@ -84,6 +84,7 @@ double cosinePsi = java.lang.Math.cos(rotationAnglePsi); double sinePsi = java.lang.Math.sin(rotationAnglePsi); + IAtomContainer atc = selection.getConnectedAtomContainer(); for (int i = 0; i < startCoordsRelativeToRotationCenter.length; i++) { double newX = startCoordsRelativeToRotationCenter[i].x*cosinePhi + startCoordsRelativeToRotationCenter[i].y*sinePhi*sinePsi; @@ -92,8 +93,7 @@ Point2d newCoords = new Point2d(newX + rotationCenter.x, newY + rotationCenter.y); - selection.getConnectedAtomContainer().getAtom(i).setPoint2d( - newCoords); + atc.getAtom(i).setPoint2d(newCoords); } if ((cosinePhi < 0) && (!horizontalFlip)) { @@ -116,26 +116,6 @@ chemModelRelay.updateView(); } - /* public void invertStereoInSelection() { - IAtomContainer toflip; - RendererModel renderModel = renderer.getRenderer2DModel(); - if (renderModel.getSelection().getConnectedAtomContainer()!=null && - renderModel.getSelection().getConnectedAtomContainer().getAtomCount()!=0 ) { - toflip = renderModel.getSelection().getConnectedAtomContainer(); - } else - return; - - for(IBond bond : toflip.bonds()){ - if(bond.getStereo()==IBond.Stereo.UP) - bond.setStereo(IBond.Stereo.DOWN); - else if(bond.getStereo()==IBond.Stereo.DOWN) - bond.setStereo(IBond.Stereo.UP); - else if(bond.getStereo()==IBond.Stereo.UP_INVERTED) - bond.setStereo(IBond.Stereo.DOWN_INVERTED); - else if(bond.getStereo()==IBond.Stereo.DOWN_INVERTED) - bond.setStereo(IBond.Stereo.UP_INVERTED); - } - }*/ public String getDrawModeString() { return "Rotate in space"; Modified: jchempaint/trunk/src/main/org/openscience/jchempaint/controller/RotateModule.java =================================================================== --- jchempaint/trunk/src/main/org/openscience/jchempaint/controller/RotateModule.java 2010-06-02 08:25:15 UTC (rev 15549) +++ jchempaint/trunk/src/main/org/openscience/jchempaint/controller/RotateModule.java 2010-06-03 13:58:27 UTC (rev 15550) @@ -165,7 +165,6 @@ * On mouse drag, actual rotation around the center is done */ public void mouseDrag(Point2d worldCoordFrom, Point2d worldCoordTo) { - if (selectionMade) { rotationPerformed=true; /* @@ -213,6 +212,7 @@ */ double cosine = java.lang.Math.cos(rotationAngle); double sine = java.lang.Math.sin(rotationAngle); + IAtomContainer atc = selection.getConnectedAtomContainer(); for (int i = 0; i < startCoordsRelativeToRotationCenter.length; i++) { double newX = (startCoordsRelativeToRotationCenter[i].x * cosine) - (startCoordsRelativeToRotationCenter[i].y * sine); @@ -222,8 +222,7 @@ Point2d newCoords = new Point2d(newX + rotationCenter.x, newY + rotationCenter.y); - selection.getConnectedAtomContainer().getAtom(i).setPoint2d( - newCoords); + atc.getAtom(i).setPoint2d(newCoords); } } chemModelRelay.updateView(); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |