Point2d ref = new Point2d(fp.x, fp.y+blen); snapBondToPosition(focus, bonds.get(0), getRotated(ref, fp, Math.toRadians(0))); snapBondToPosition(focus, bonds.get(1), getRotated(ref, fp, Math.toRadians(60))); snapBondToPosition(focus, bonds.get(2), getRotated(ref, fp, Math.toRadians(-60))); snapBondToPosition(focus, bonds.get(3), getRotated(ref, fp, Math.toRadians(-120))); snapBondToPosition(focus, bonds.get(4), getRotated(ref, fp, Math.toRadians(120))); snapBondToPosition(focus, bonds.get(5), getRotated(ref, fp, Math.toRadians(180))); setBondDisplay(bonds.get(1), focus, DOWN); setBondDisplay(bonds.get(2), focus, DOWN);
snapBondToPosition(focus, bonds.get(0), getRotated(ref, fp, Math.toRadians(0))); snapBondToPosition(focus, bonds.get(3), getRotated(ref, fp, Math.toRadians(-60))); snapBondToPosition(focus, bonds.get(2), getRotated(ref, fp, Math.toRadians(90))); snapBondToPosition(focus, bonds.get(1), getRotated(ref, fp, Math.toRadians(-120))); snapBondToPosition(focus, bonds.get(4), getRotated(ref, fp, Math.toRadians(180))); setBondDisplay(bonds.get(1), focus, UP); setBondDisplay(bonds.get(3), focus, DOWN); } else { snapBondToPosition(focus, bonds.get(0), getRotated(ref, fp, Math.toRadians(0))); snapBondToPosition(focus, bonds.get(1), getRotated(ref, fp, Math.toRadians(60))); snapBondToPosition(focus, bonds.get(2), getRotated(ref, fp, Math.toRadians(-90))); snapBondToPosition(focus, bonds.get(3), getRotated(ref, fp, Math.toRadians(120))); snapBondToPosition(focus, bonds.get(4), getRotated(ref, fp, Math.toRadians(180))); setBondDisplay(bonds.get(1), focus, DOWN); setBondDisplay(bonds.get(3), focus, UP);
snapBondToPosition(focus, bonds.get(0), getRotated(ref, fp, Math.toRadians(0))); snapBondToPosition(focus, bonds.get(3), getRotated(ref, fp, Math.toRadians(-60))); snapBondToPosition(focus, bonds.get(2), getRotated(ref, fp, Math.toRadians(90))); snapBondToPosition(focus, bonds.get(1), getRotated(ref, fp, Math.toRadians(-120))); snapBondToPosition(focus, bonds.get(4), getRotated(ref, fp, Math.toRadians(180))); setBondDisplay(bonds.get(1), focus, UP); setBondDisplay(bonds.get(3), focus, DOWN); } else { snapBondToPosition(focus, bonds.get(0), getRotated(ref, fp, Math.toRadians(0))); snapBondToPosition(focus, bonds.get(1), getRotated(ref, fp, Math.toRadians(60))); snapBondToPosition(focus, bonds.get(2), getRotated(ref, fp, Math.toRadians(-90))); snapBondToPosition(focus, bonds.get(3), getRotated(ref, fp, Math.toRadians(120))); snapBondToPosition(focus, bonds.get(4), getRotated(ref, fp, Math.toRadians(180))); setBondDisplay(bonds.get(1), focus, DOWN); setBondDisplay(bonds.get(3), focus, UP);
Point2d ref = new Point2d(fp.x, fp.y+blen); snapBondToPosition(focus, bonds.get(0), getRotated(ref, fp, Math.toRadians(0))); snapBondToPosition(focus, bonds.get(1), getRotated(ref, fp, Math.toRadians(60))); snapBondToPosition(focus, bonds.get(2), getRotated(ref, fp, Math.toRadians(-60))); snapBondToPosition(focus, bonds.get(3), getRotated(ref, fp, Math.toRadians(-120))); snapBondToPosition(focus, bonds.get(4), getRotated(ref, fp, Math.toRadians(120))); snapBondToPosition(focus, bonds.get(5), getRotated(ref, fp, Math.toRadians(180))); setBondDisplay(bonds.get(1), focus, DOWN); setBondDisplay(bonds.get(2), focus, DOWN);
private void modifyAndLabel(SquarePlanar se) { List<IAtom> atoms = se.normalize().getCarriers(); List<IBond> bonds = new ArrayList<>(4); double blen = 0; for (IAtom atom : atoms) { IBond bond = container.getBond(se.getFocus(), atom); // can't handled these using this method! if (bond.isInRing()) return; bonds.add(bond); blen += GeometryUtil.getLength2D(bond); } blen /= bonds.size(); IAtom focus = se.getFocus(); Point2d fp = focus.getPoint2d(); for (IAtom atom : container.atoms()) atom.setFlag(CDKConstants.VISITED, false); for (IBond bond : container.bonds()) bond.setFlag(CDKConstants.VISITED, false); Point2d ref = new Point2d(fp.x, fp.y+blen); snapBondToPosition(focus, bonds.get(0), getRotated(ref, fp, Math.toRadians(-60))); snapBondToPosition(focus, bonds.get(1), getRotated(ref, fp, Math.toRadians(60))); snapBondToPosition(focus, bonds.get(2), getRotated(ref, fp, Math.toRadians(120))); snapBondToPosition(focus, bonds.get(3), getRotated(ref, fp, Math.toRadians(-120))); setBondDisplay(bonds.get(0), focus, DOWN); setBondDisplay(bonds.get(1), focus, DOWN); setBondDisplay(bonds.get(2), focus, UP); setBondDisplay(bonds.get(3), focus, UP); }
private void modifyAndLabel(SquarePlanar se) { List<IAtom> atoms = se.normalize().getCarriers(); List<IBond> bonds = new ArrayList<>(4); double blen = 0; for (IAtom atom : atoms) { IBond bond = container.getBond(se.getFocus(), atom); // can't handled these using this method! if (bond.isInRing()) return; bonds.add(bond); blen += GeometryUtil.getLength2D(bond); } blen /= bonds.size(); IAtom focus = se.getFocus(); Point2d fp = focus.getPoint2d(); for (IAtom atom : container.atoms()) atom.setFlag(CDKConstants.VISITED, false); for (IBond bond : container.bonds()) bond.setFlag(CDKConstants.VISITED, false); Point2d ref = new Point2d(fp.x, fp.y+blen); snapBondToPosition(focus, bonds.get(0), getRotated(ref, fp, Math.toRadians(-60))); snapBondToPosition(focus, bonds.get(1), getRotated(ref, fp, Math.toRadians(60))); snapBondToPosition(focus, bonds.get(2), getRotated(ref, fp, Math.toRadians(120))); snapBondToPosition(focus, bonds.get(3), getRotated(ref, fp, Math.toRadians(-120))); setBondDisplay(bonds.get(0), focus, DOWN); setBondDisplay(bonds.get(1), focus, DOWN); setBondDisplay(bonds.get(2), focus, UP); setBondDisplay(bonds.get(3), focus, UP); }