use of com.actelion.research.share.gui.editor.chem.IDrawingObject in project openchemlib by Actelion.
the class Model method cleanReaction.
/*
public void resizeReaction(Dimension os, Dimension ns)
{
Reaction rxn = getReaction(false);
double offsetx = ns.getWidth() - os.getWidth();
double offsety = ns.getHeight() - os.getHeight();
double scale;
if (Math.abs(offsetx) > Math.abs(offsety)) {
scale = ns.getHeight() / os.getHeight();
} else {
scale = ns.getWidth() / os.getWidth();
}
ChemistryHelper.transformReaction(rxn, offsetx, offsety, scale);
setValue(rxn);
}
*/
public void cleanReaction(boolean cleanAll) {
Reaction reaction = getReaction();
// System.out.printf("cleanreaction %s\n",reaction.getReactants());
Dimension dim = getDisplaySize();
double w = dim.getWidth();
double h = dim.getHeight();
double width = w / 5;
if (w > 0 && h > 0) {
// new Arrow(mx , my, dx,20);
IDrawingObject arrow = getDrawingObjects().get(0);
arrow.setRect((float) (0.5f * w), (float) (0.5f * h), (float) (0.5f * .16 * w), 20);
arrowPos = new Point2D.Double((0.5f * w), (0.5f * h));
mMode = MODE_MULTIPLE_FRAGMENTS;
if (cleanAll)
cleanupCoordinates(true, true);
ChemistryHelper.scaleInto(reaction, 0, 0, dim.getWidth(), dim.getHeight(), width);
setValue(reaction);
}
}
Aggregations