use of com.actelion.research.chem.StereoMolecule in project openchemlib by Actelion.
the class BondBaseAction method onChangeBond.
public void onChangeBond(int bond) {
StereoMolecule mol = model.getMolecule();
if (mol != null) {
mol.changeBond(bond, Molecule.cBondTypeIncreaseOrder);
mol.ensureHelperArrays(Molecule.cHelperNeighbours);
}
}
use of com.actelion.research.chem.StereoMolecule in project openchemlib by Actelion.
the class BondHighlightAction method showBondQFDialog.
private boolean showBondQFDialog(int bond) {
StereoMolecule mol = model.getMolecule();
if (mol != null) {
GeomFactory factory = model.getGeomFactory();
IBondQueryFeaturesDialog dlg = factory.createBondFeaturesDialog(/*new BondQueryFeaturesDialog(*/
mol, bond);
return dlg.doModalAt(lastHightlightPoint.getX(), lastHightlightPoint.getY()) == DialogResult.IDOK;
}
return false;
}
use of com.actelion.research.chem.StereoMolecule in project openchemlib by Actelion.
the class BondHighlightAction method paint.
public boolean paint(IDrawContext _ctx) {
StereoMolecule mol = model.getMolecule();
boolean ok = false;
if (mol != null) {
int theAtom = model.getSelectedAtom();
int theBond = model.getSelectedBond();
if (theBond != -1) {
drawBondHighlight(_ctx, mol, theBond);
ok = true;
} else if (theAtom != -1) {
return super.paint(_ctx);
}
}
return ok;
}
use of com.actelion.research.chem.StereoMolecule in project openchemlib by Actelion.
the class BondHighlightAction method handleCharacter.
private boolean handleCharacter(String code) {
StereoMolecule mol = model.getMolecule();
int theBond = model.getSelectedBond();
if (mol != null && theBond != -1) {
if (code != null && code.length() > 0) {
char c = code.charAt(0);
switch(c) {
case 'q':
return mol.isFragment() ? showBondQFDialog(theBond) : false;
case '4':
case '5':
case '6':
case '7':
return mol.addRingToBond(theBond, c - '0', false);
case 'b':
return mol.addRingToBond(theBond, 6, true);
case '1':
return mol.changeBond(theBond, Molecule.cBondTypeSingle);
case '2':
return mol.changeBond(theBond, Molecule.cBondTypeDouble);
case '3':
return mol.changeBond(theBond, Molecule.cBondTypeTriple);
case 'u':
return mol.changeBond(theBond, Molecule.cBondTypeUp);
case 'd':
return mol.changeBond(theBond, Molecule.cBondTypeDown);
case 'c':
return mol.changeBond(theBond, Molecule.cBondTypeCross);
case 'm':
return mol.changeBond(theBond, Molecule.cBondTypeMetalLigand);
}
}
}
return false;
}
use of com.actelion.research.chem.StereoMolecule in project openchemlib by Actelion.
the class ChangeChargeAction method onMouseUp.
@Override
public boolean onMouseUp(IMouseEvent evt) {
model.pushUndo();
int theAtom = model.getSelectedAtom();
if (theAtom != -1) {
StereoMolecule mol = model.getMolecule();
int charge = mol.getAtomCharge(theAtom);
if (plus)
charge++;
else
charge--;
mol.setAtomCharge(theAtom, charge);
return true;
}
return false;
}
Aggregations