Examples of IAtomContainerSet


Examples of org.openscience.cdk.interfaces.IAtomContainerSet

      newAtom = chemModel.getBuilder().newInstance(IAtom.class,atomType, worldCoord);
    }
    if (isotopeNumber != 0)
      newAtom.setMassNumber(isotopeNumber);
    // FIXME : there should be an initial hierarchy?
    IAtomContainerSet molSet = chemModel.getMoleculeSet();
    if (molSet == null) {
      molSet = chemModel.getBuilder().newInstance(IAtomContainerSet.class);
      IAtomContainer ac = chemModel.getBuilder().newInstance(IAtomContainer.class);
      ac.addAtom(newAtom);
      molSet.addAtomContainer(ac);
      chemModel.setMoleculeSet(molSet);
    }
    IAtomContainer newAtomContainer = chemModel.getBuilder().newInstance(IAtomContainer.class);
    if (chemModel.getMoleculeSet().getAtomContainer(0).getAtomCount() == 0)
      newAtomContainer = (IAtomContainer) chemModel.getMoleculeSet()
          .getAtomContainer(0);
    else
      molSet.addAtomContainer(newAtomContainer);
    newAtomContainer.addAtom(newAtom);
    updateAtom(newAtom);
    JChemPaintRendererModel model = this.getRenderer().getRenderer2DModel();
    double nudgeDistance = model.getHighlightDistance() / model.getScale();
    if (getClosestAtom(newAtom) != null)
View Full Code Here

Examples of org.openscience.cdk.interfaces.IAtomContainerSet

    IAtomContainer atomCon = ChemModelManipulator.getRelevantAtomContainer(
        chemModel, atom);
    if (atomCon == null) {
      atomCon = chemModel.getBuilder().newInstance(IAtomContainer.class);
      IAtomContainerSet moleculeSet = chemModel.getMoleculeSet();
      if (moleculeSet == null) {
        moleculeSet = chemModel.getBuilder().newInstance(IAtomContainerSet.class);
        chemModel.setMoleculeSet(moleculeSet);
      }
      moleculeSet.addAtomContainer(atomCon);
    }

    // The AtomPlacer generates coordinates for the new atom
    AtomPlacer atomPlacer = new AtomPlacer();
    atomPlacer.setMolecule(chemModel.getBuilder().newInstance(IAtomContainer.class,atomCon));
View Full Code Here

Examples of org.openscience.cdk.interfaces.IAtomContainerSet

          chemModel, chemModel.getMoleculeSet(),
          chemModel.getReactionSet(), "Clear Panel");
      getUndoRedoHandler().postEdit(undoredo);
    }
    if (chemModel.getMoleculeSet() != null) {
      IAtomContainerSet molSet = chemModel.getBuilder().newInstance(IAtomContainerSet.class);
      IAtomContainer ac = chemModel.getBuilder().newInstance(IAtomContainer.class);
      molSet.addAtomContainer(ac);
      chemModel.setMoleculeSet(molSet);

    }
    if (chemModel.getReactionSet() != null)
      chemModel.setReactionSet(chemModel.getBuilder().newInstance(IReactionSet.class));
View Full Code Here

Examples of org.openscience.cdk.interfaces.IAtomContainerSet

      if (ConnectivityChecker.isConnected(container)) {
        generateNewCoordinates(container);
      } else {
        // deal with disconnected atom containers
        IAtomContainerSet molecules = ConnectivityChecker
            .partitionIntoMolecules(container);
        for (IAtomContainer subContainer : molecules.atomContainers()) {
          generateNewCoordinates(subContainer);
        }
      }

      for (IAtom atom : container.atoms()) {
View Full Code Here

Examples of org.openscience.cdk.interfaces.IAtomContainerSet

    IRing ring = chemModel.getBuilder().newInstance(IRing.class,ringSize, "C");
    double bondLength = calculateAverageBondLength(chemModel
        .getMoleculeSet());
    ringPlacer
        .placeRing(ring, worldcoord, bondLength, RingPlacer.jcpAngles);
    IAtomContainerSet set = chemModel.getMoleculeSet();

    // the molecule set should not be null, but just in case...
    if (set == null) {
      set = chemModel.getBuilder().newInstance(IAtomContainerSet.class);
      chemModel.setMoleculeSet(set);
View Full Code Here

Examples of org.openscience.cdk.interfaces.IAtomContainerSet

    double bondLength = calculateAverageBondLength(chemModel
        .getMoleculeSet());
    ringPlacer
        .placeRing(ring, worldcoord, bondLength, RingPlacer.jcpAngles);
    IAtomContainerSet set = chemModel.getMoleculeSet();

    // the molecule set should not be null, but just in case...
    if (set == null) {
      set = chemModel.getBuilder().newInstance(IAtomContainerSet.class);
      chemModel.setMoleculeSet(set);
View Full Code Here

Examples of org.openscience.cdk.interfaces.IAtomContainerSet

    selectionChanged();
  }

  // OK
  public void addFragment(IAtomContainer toPaste, IAtomContainer moleculeToAddTo, IAtomContainer toRemove) {
    IAtomContainerSet newMoleculeSet = chemModel.getMoleculeSet();
    if (newMoleculeSet == null) {
      newMoleculeSet = chemModel.getBuilder().newInstance(IAtomContainerSet.class);
    }
    IAtomContainerSet oldMoleculeSet = chemModel.getBuilder().newInstance(IAtomContainerSet.class);
    if (moleculeToAddTo == null) {
      newMoleculeSet.addAtomContainer(toPaste);
      moleculeToAddTo = toPaste;
    } else {
      IAtomContainer mol = chemModel.getBuilder().newInstance(IAtomContainer.class);
      for (IAtom atom: moleculeToAddTo.atoms())
        mol.addAtom(atom);
      for (IBond bond: moleculeToAddTo.bonds())
        mol.addBond(bond);
      oldMoleculeSet.addAtomContainer(mol);
      moleculeToAddTo.add(toPaste);
    }
    if (toRemove != null) {
      oldMoleculeSet.addAtomContainer(toRemove);
      moleculeToAddTo.add(toRemove);
      updateAtoms(toRemove, toRemove.atoms());
      newMoleculeSet.removeAtomContainer(toRemove);
    }
    for (IAtomContainer ac: newMoleculeSet.atomContainers())
View Full Code Here

Examples of org.openscience.cdk.interfaces.IAtomContainerSet

     * @throws CDKException InChI could not be generated
     */
    public static IChemModel readInChI(URL url) throws CDKException {
        IChemModel chemModel = new ChemModel();
        try {
            IAtomContainerSet moleculeSet = new AtomContainerSet();
            chemModel.setMoleculeSet(moleculeSet);

            BufferedReader in = new BufferedReader(new InputStreamReader(url.openStream()));
            String line;
            while ((line = in.readLine()) != null) {
                if (line.toLowerCase().startsWith("inchi=")) {
                    moleculeSet.addAtomContainer(parseInChI(line));
                }
            }
            in.close();
        } catch (Exception e) {

View Full Code Here

Examples of org.openscience.cdk.interfaces.IAtomContainerSet

     * @return the rectangular area that the diagram will occupy on screen
     */
    public Rectangle paintChemModel(
            IChemModel chemModel, IDrawVisitor drawVisitor) {

        IAtomContainerSet moleculeSet = chemModel.getMoleculeSet();
        IReactionSet reactionSet = chemModel.getReactionSet();

        if (moleculeSet == null && reactionSet != null) {
            return paintReactionSet(reactionSet, drawVisitor);
        }

        if (moleculeSet != null && reactionSet == null) {
            return paintMoleculeSet(moleculeSet, drawVisitor);
        }

        if (moleculeSet != null && moleculeSet.getAtomContainerCount() > 0 && reactionSet != null) {
            Rectangle2D reactionSetBounds = Renderer.calculateBounds(reactionSet);
            Rectangle2D moleculeSetBounds = Renderer.calculateBounds(moleculeSet);
           
            Rectangle2D totalBounds = new Rectangle2D.Double();
           
View Full Code Here

Examples of org.openscience.cdk.interfaces.IAtomContainerSet

     *     if true, set the modelCenter to the center of the ChemModel's bounds.
     */
    public void paintChemModel(IChemModel chemModel,
            IDrawVisitor drawVisitor, Rectangle2D bounds, boolean resetCenter) {
        // check for an empty model
        IAtomContainerSet moleculeSet = chemModel.getMoleculeSet();
        IReactionSet reactionSet = chemModel.getReactionSet();

        // nasty, but it seems that reactions can be read in as ChemModels
        // with BOTH a ReactionSet AND a MoleculeSet...
        if (moleculeSet == null || reactionSet != null) {
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.