Search in sources :

Example 61 with StereoMolecule

use of com.actelion.research.chem.StereoMolecule in project openchemlib by Actelion.

the class NewChainAction method paint.

@Override
public boolean paint(IDrawContext ctx) {
    StereoMolecule mol = model.getMolecule();
    if (mol != null) {
        if (!dragging) {
            super.paint(ctx);
        } else {
            int theAtom = model.getSelectedAtom();
            drawChain(ctx, theAtom != -1 ? new Point2D.Double(mol.getAtomX(theAtom), mol.getAtomY(theAtom)) : origin);
        }
    }
    return false;
}
Also used : StereoMolecule(com.actelion.research.chem.StereoMolecule)

Example 62 with StereoMolecule

use of com.actelion.research.chem.StereoMolecule in project openchemlib by Actelion.

the class NewChainAction method onMouseDown.

public boolean onMouseDown(IMouseEvent evt) {
    java.awt.geom.Point2D pt = new Point2D.Double(evt.getX(), evt.getY());
    StereoMolecule mol = model.getMolecule();
    boolean update = false;
    origin = pt;
    sourceAtom = findAtom(mol, pt);
    if (sourceAtom != -1) {
        // if (mol != null)
        {
            if (mol.getAllConnAtoms(sourceAtom) == Model.MAX_CONNATOMS) {
                return false;
            }
            origin = new Point2D.Double(mol.getAtomX(sourceAtom), mol.getAtomY(sourceAtom));
            update = true;
            numChainAtoms = 0;
            mChainAtomX = null;
            mChainAtomY = null;
            mChainAtom = null;
        }
    } else {
        origin = new Point2D.Double(evt.getX(), evt.getY());
        update = true;
        numChainAtoms = 0;
        mChainAtomX = null;
        mChainAtomY = null;
        mChainAtom = null;
    }
    return update;
}
Also used : Point2D(java.awt.geom.Point2D) Point2D(java.awt.geom.Point2D) StereoMolecule(com.actelion.research.chem.StereoMolecule)

Aggregations

StereoMolecule (com.actelion.research.chem.StereoMolecule)62 Point2D (java.awt.geom.Point2D)11 Canonizer (com.actelion.research.chem.Canonizer)8 IDCodeParser (com.actelion.research.chem.IDCodeParser)8 GeomFactory (com.actelion.research.share.gui.editor.geom.GeomFactory)7 SSSearcher (com.actelion.research.chem.SSSearcher)4 Rectangle2D (java.awt.geom.Rectangle2D)3 IDrawingObject (com.actelion.research.share.gui.editor.chem.IDrawingObject)2 IOException (java.io.IOException)2 Depictor2D (com.actelion.research.chem.Depictor2D)1 DrawingObjectList (com.actelion.research.chem.DrawingObjectList)1 CoordinateInventor (com.actelion.research.chem.coords.CoordinateInventor)1 IAtomPropertiesDialog (com.actelion.research.share.gui.editor.dialogs.IAtomPropertiesDialog)1 IAtomQueryFeaturesDialog (com.actelion.research.share.gui.editor.dialogs.IAtomQueryFeaturesDialog)1 IBondQueryFeaturesDialog (com.actelion.research.share.gui.editor.dialogs.IBondQueryFeaturesDialog)1 LittleEndianDataOutputStream (com.actelion.research.util.LittleEndianDataOutputStream)1 IntVec (com.actelion.research.util.datamodel.IntVec)1 UnsupportedFlavorException (java.awt.datatransfer.UnsupportedFlavorException)1 BufferedImage (java.awt.image.BufferedImage)1 ArrayList (java.util.ArrayList)1