Package org.openscience.cdk.interfaces

Examples of org.openscience.cdk.interfaces.IBond


      removed.addAtom(atom);
      Iterator<IBond> it = ChemModelManipulator.getRelevantAtomContainer(
          chemModel, atom).getConnectedBondsList(atom).iterator();
      IAtomContainer ac = selected.getBuilder().newInstance(IAtomContainer.class);
      while (it.hasNext()) {
        IBond bond = it.next();
        if (!removed.contains(bond)) {
          removed.addBond(bond);
          ac.addBond(bond);
        }
      }
      ChemModelManipulator.removeAtomAndConnectedElectronContainers(
                                       chemModel, atom);
      for (IBond bond : ac.bonds()) {
        if (bond.getAtom(0) == atom)
          updateAtom(bond.getAtom(1));
        else
          updateAtom(bond.getAtom(0));
      }
    }
    removeEmptyContainers(chemModel);
    if (undoredofactory != null && undoredohandler != null) {
      IUndoRedoable undoredo = undoredofactory
View Full Code Here


        int hcount = atom.getImplicitHydrogenCount();
        for (int k = 0; k < hcount; k++) {
          IAtom newAtom = this.addAtomWithoutUndo("H", atom, false);
          IAtomContainer atomContainer = ChemModelManipulator
              .getRelevantAtomContainer(getIChemModel(), newAtom);
          IBond newBond = atomContainer.getBond(atom, newAtom);
          undoRedoContainer.addAtom(newAtom);
          undoRedoContainer.addBond(newBond);
        }
      }
    }
View Full Code Here

        droppedContainers.add(null);
      }

      // Handle the case of a bond between mergedAtom and mergedPartnerAtom.
      // This bond should be removed.
      IBond rb = container1.getBond(mergedAtom, mergedPartnerAtom);
      if (rb != null) {
        container1.removeBond(rb);
        removedBonds.add(rb);
      }
       
      // In the next loop we remove bonds that are redundant, that is
      // to say bonds that exist on both sides of the parts to be merged
      // and would cause duplicate bonding in the end result.
      for (IAtom atom : container1.atoms()) {

        if (!atom.equals(mergedAtom)) {
          if (container1.getBond(mergedAtom, atom) != null) {
            if (model.getMerge().containsKey(atom)) {
              for (IAtom atom2 : container2.atoms()) {
                if (!atom2.equals(mergedPartnerAtom)) {
                  if (container1.getBond(mergedPartnerAtom,
                      atom2) != null) {
                    if (model.getMerge().get(atom).equals(
                        atom2)) {
                      IBond redundantBond = container1
                          .getBond(atom, mergedAtom);
                      container1
                          .removeBond(redundantBond);
                      removedBonds.add(redundantBond);
                    }
View Full Code Here

        if(bondsInRange==null)
            return;
           
        while(bondsInRange.hasNext()){
            IBond bond = bondsInRange.next();

            IBond.Stereo stereo=null;
            IBond.Order order=null;

            if(type.equals("bond")){
View Full Code Here

    this.chemModelRelay=chemModelRelay;
  }

  public void redo() {
    for (int i = 0; i < undoRedoContainer.getBondCount(); i++) {
      IBond bond = undoRedoContainer.getBond(i);
      container.removeBond(bond);
    }
    for (int i = 0; i < undoRedoContainer.getAtomCount(); i++) {
      IAtom atom = undoRedoContainer.getAtom(i);
      container.removeAtom(atom);
View Full Code Here

    }
  }

  public void undo() {
    for (int i = 0; i < undoRedoContainer.getBondCount(); i++) {
      IBond bond = undoRedoContainer.getBond(i);
      container.addBond(bond);
    }
    for (int i = 0; i < undoRedoContainer.getAtomCount(); i++) {
      IAtom atom = undoRedoContainer.getAtom(i);
      container.addAtom(atom);
View Full Code Here

      for (Iterator<IAtom> atItr = existingAtomDistr.keySet().iterator(); atItr.hasNext();) {
        IAtom atom = atItr.next();
        existingAtomDistr.get(atom).addAtom(atom);
      }
      for (Iterator<IBond> bndItr = existingBondDistr.keySet().iterator(); bndItr.hasNext();) {
        IBond bond = bndItr.next();
        existingBondDistr.get(bond).addBond(bond);
      }
        hub.getChemModel().getMoleculeSet().removeAtomContainer(userSelection);
     
      if (type.equals("setRoot")) {
View Full Code Here

      for (Iterator<IAtom> atItr = existingAtomDistr.keySet().iterator(); atItr.hasNext();) {
        IAtom atom = atItr.next();
        existingAtomDistr.get(atom).removeAtom(atom);
      }
      for (Iterator<IBond> bndItr = existingBondDistr.keySet().iterator(); bndItr.hasNext();) {
        IBond bond = bndItr.next();
        existingBondDistr.get(bond).removeBond(bond);
      }
      hub.getChemModel().getMoleculeSet().addAtomContainer(userSelection);
 
      if (type.equals("setRoot")) {
View Full Code Here

                    container = ac;
                }else{
                    container.add(ac);
                    List<IBond> connbonds=container.getConnectedBondsList(ac.getAtom(0));
                    for(int i=0;i<connbonds.size();i++){
                        IBond bond=connbonds.get(i);
                        if(bond.getAtom(0)==ac.getAtom(0)){
                            bond.setAtom(closestAtom, 0);
                        }else{
                            bond.setAtom(closestAtom, 1);
                        }
                    }
                    container.removeAtomAndConnectedElectronContainers(ac.getAtom(0));
                    ac.removeAtom(ac.getAtom(0));
                }
View Full Code Here

    }
    return closestAtom;
  }
 
  private IBond getClosestSelBond(Point2d worldCoord) {
    IBond closestBond = null;
    IChemObjectSelection sel = chemModelRelay.getRenderer().getRenderer2DModel().getSelection();
    double closestDistanceSQ = Double.MAX_VALUE;

    for (IBond bond : sel.elements(IBond.class)) {
      if (bond.get2DCenter() != null) {
View Full Code Here

TOP

Related Classes of org.openscience.cdk.interfaces.IBond

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.