Package org.openscience.cdk.interfaces

Examples of org.openscience.cdk.interfaces.IChemObject


        int l = type.length();
        if (type.substring(l-4,l).equals("Tool"))
            type = type.substring(0,l-4);
       
        //then handle selection or highlight if there is one
        IChemObject object = getSource(event);
        Iterator<IBond> bondsInRange = null;

        if (object == null){
            //this means the main menu or toolbar was used
            if(jcpPanel.getRenderPanel().getRenderer().getRenderer2DModel().getSelection()!=null
View Full Code Here


public class EditAtomContainerPropsAction extends JCPAction {

  private static final long serialVersionUID = 8489495722307245626L;

  public void actionPerformed(ActionEvent event) {
    IChemObject object = getSource(event);
    logger.debug("Showing object properties for: ", object);
    ChemObjectEditor editor = new AtomContainerEditor();
    IAtomContainer relevantContainer = null;
    if(object instanceof IAtom)
      relevantContainer = ChemModelManipulator.getRelevantAtomContainer(jcpPanel.getChemModel(),(IAtom)object);
View Full Code Here

    private IControllerModule newActiveModule;

    public void actionPerformed(ActionEvent event)
    {
        logger.debug("About to change atom type of relevant atom!");
        IChemObject object = getSource(event);
        logger.debug("Source of call: ", object);
        Iterator<IAtom> atomsInRange = null;
        if (object == null){
            //this means the main menu was used
            if(jcpPanel.getRenderPanel().getRenderer().getRenderer2DModel().getSelection()!=null &&
View Full Code Here

        if(jcpPanel.get2DHub().getActiveDrawModule() instanceof AddBondDragModule)
            newActiveModule=new AddAtomModule(jcpPanel.get2DHub(), ((AddBondDragModule)jcpPanel.get2DHub().getActiveDrawModule()).getStereoForNewBond());
        else if(jcpPanel.get2DHub().getActiveDrawModule() instanceof AddAtomModule)
            newActiveModule=new AddAtomModule(jcpPanel.get2DHub(), ((AddAtomModule)jcpPanel.get2DHub().getActiveDrawModule()).getStereoForNewBond());
        logger.debug("About to change atom type of relevant atom!");
        IChemObject object = getSource(event);
        logger.debug("Source of call: ", object);
        Iterator<IAtom> atomsInRange = null;
    if (object == null){
      //this means the main menu was used
      if(jcpPanel.getRenderPanel().getRenderer().getRenderer2DModel().getSelection().isFilled())
View Full Code Here

                        .getConnectedAtomContainer());
            } catch (NullPointerException e) {
               
                bounds=null;
            }
        IChemObject highlightedAtom = chemModelRelay.getRenderer().getRenderer2DModel().getHighlightedAtom();
        IChemObject highlightedBond = chemModelRelay.getRenderer().getRenderer2DModel().getHighlightedBond();
        if((bounds !=null && bounds.contains(new Point2D.Double(p.x, p.y)))
                || highlightedAtom!=null || highlightedBond!=null){
            chemModelRelay.setCursor(Cursor.HAND_CURSOR);
        }else{
            chemModelRelay.setCursor(Cursor.DEFAULT_CURSOR);
View Full Code Here

        if(p.equals(startPoint)){
           
            IAtom closestAtom = chemModelRelay.getClosestAtom(p);
            IBond closestBond = chemModelRelay.getClosestBond(p);
            IChemObject singleSelection = getHighlighted( p,
                    closestAtom,
                    closestBond );

            IChemObjectSelection curSel = chemModelRelay.getRenderer().getRenderer2DModel().getSelection();
            IChemObjectSelection sel = null;
View Full Code Here

    public void mouseClickedDown(Point2d worldCoord) {
        IAtom closestAtom = chemModelRelay.getClosestAtom(worldCoord);
        IBond closestBond = chemModelRelay.getClosestBond(worldCoord);

        IChemObject singleSelection = getHighlighted( worldCoord,
                                                      closestAtom,closestBond );

        if (singleSelection == null) {
            //we add the ring
        IRing newRing = this.addRingToEmptyCanvas(worldCoord);
View Full Code Here

            return;
        }
        this.chemModelRelay.clearPhantoms();
        IAtom closestAtom = chemModelRelay.getClosestAtom(worldCoord);
        IBond closestBond = chemModelRelay.getClosestBond(worldCoord);
        IChemObject singleSelection = getHighlighted( worldCoord,
                closestAtom,closestBond );

        if (singleSelection == null) {
            //we build a phantom ring
            IRing ring = this.chemModelRelay.getIChemModel().getBuilder().newInstance(IRing.class,ringSize, "C");
View Full Code Here

       
        start = new Point2d(worldCoord);
        IAtom closestAtom = chemModelRelay.getClosestAtom(worldCoord);
        IBond closestBond = chemModelRelay.getClosestBond( worldCoord );

        IChemObject singleSelection = getHighlighted( worldCoord,
                                                      closestAtom,
                                                      closestBond );

        if(singleSelection == null || singleSelection instanceof IAtom ) {
            isBond = false;
View Full Code Here

  public void setChemModelRelay(IChemModelRelay relay) {
      this.chemModelRelay = relay;
  }

    protected IChemObject getHighlighted( Point2d worldCoord, IChemObject... objects ) {
        IChemObject closest = null;
        double minDistance = Double.POSITIVE_INFINITY;
        for(IChemObject obj:objects) {
            double distance = Double.POSITIVE_INFINITY;
            if(obj instanceof IAtom)
                distance = distanceToAtom( (IAtom) obj, worldCoord );
View Full Code Here

TOP

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

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.