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;
}
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;
}
Aggregations