Package org.openscience.cdk.renderer.elements

Examples of org.openscience.cdk.renderer.elements.ElementGroup


            } else if (moleculeSetBounds != null) {
                totalBounds = moleculeSetBounds;
            }
           
            this.setupTransformNatural(totalBounds);
            ElementGroup diagram = new ElementGroup();
            for (IReaction reaction : reactionSet.reactions()) {
                diagram.add(this.generateDiagram(reaction));
            }
            diagram.add(this.generateDiagram(moleculeSet));
            diagram.add(this.generateDiagram(reactionSet));
            this.paint(drawVisitor, diagram);

            // the size of the painted diagram is returned
            return this.convertToDiagramBounds(totalBounds);
        }
View Full Code Here


            }
        }

        // setup and draw
        this.setupTransformNatural(totalBounds);
        ElementGroup diagram = new ElementGroup();
        for (IReaction reaction : reactionSet.reactions()) {
            diagram.add(this.generateDiagram(reaction));
        }
        diagram.add(this.generateDiagram(reactionSet));
        this.paint(drawVisitor, diagram);

        // the size of the painted diagram is returned
        return this.convertToDiagramBounds(totalBounds);
    }
View Full Code Here

            }
        }

        // setup and draw
        this.setupTransformNatural(totalBounds);
        ElementGroup diagram = new ElementGroup();
        for (IAtomContainer molecule : moleculeSet.atomContainers()) {
            diagram.add(this.generateDiagram(molecule));
        }
        this.paint(drawVisitor, diagram);

        return this.convertToDiagramBounds(totalBounds);
    }
View Full Code Here

        }

        this.setupTransformToFit(bounds, totalBounds,
                Renderer.calculateAverageBondLength(reactionSet), resetCenter);

        ElementGroup diagram = new ElementGroup();
        for (IReaction reaction : reactionSet.reactions()) {
            diagram.add(this.generateDiagram(reaction));
        }
        diagram.add(this.generateDiagram(reactionSet));

        // paint them all
        this.paint(drawVisitor, diagram);
    }
View Full Code Here

        }

        this.setupTransformToFit(bounds, totalBounds,
                Renderer.calculateAverageBondLength(molecules), resetCenter);

        ElementGroup diagram = new ElementGroup();
        for (IAtomContainer molecule : molecules.atomContainers()) {
            diagram.add(this.generateDiagram(molecule));
        }

        this.paint(drawVisitor, diagram);
    }
View Full Code Here

                    this.modelCenter));
        }
    }

    private IRenderingElement generateDiagram(IReactionSet reactionSet) {
        ElementGroup diagram = new ElementGroup();

        for (IReactionSetGenerator generator : this.reactionSetGenerators) {
            diagram.add(generator.generate(reactionSet, rendererModel));
        }
        return diagram;
    }
View Full Code Here

*
*/
public class ReactionPlusGenerator implements IReactionGenerator {

  public IRenderingElement generate(IReaction reaction, JChemPaintRendererModel model) {
    ElementGroup diagram = new ElementGroup();
        Color color = model.getForeColor();
   
    IAtomContainerSet reactants = reaction.getReactants();
    if(reactants.getAtomContainerCount()>0){
            Rectangle2D totalBoundsReactants = Renderer.calculateBounds(reactants);
            Rectangle2D bounds1 =
                Renderer.calculateBounds(reactants.getAtomContainer(0));
            double axis = totalBoundsReactants.getCenterY();
            for (int i = 1; i < reaction.getReactantCount(); i++) {
              Rectangle2D bounds2 =
                  Renderer.calculateBounds(reactants.getAtomContainer(i));
              diagram.add(makePlus(bounds1, bounds2, axis, color));
              bounds1 = bounds2;
            }
    }
       
        IAtomContainerSet products = reaction.getProducts();
        if(products.getAtomContainerCount()>0){
            Rectangle2D totalBoundsProducts = Renderer.calculateBounds(products);
            double axis = totalBoundsProducts.getCenterY();
            Rectangle2D bounds1 = Renderer.calculateBounds(products.getAtomContainer(0));
            for (int i = 1; i < reaction.getProductCount(); i++) {
              Rectangle2D bounds2 =
                  Renderer.calculateBounds(products.getAtomContainer(i));
             
              diagram.add(makePlus(bounds1, bounds2, axis, color));
              bounds1 = bounds2;
            }
        }
        return diagram;
  }
View Full Code Here

    public IRenderingElement generate(IAtomContainer ac, RendererModel model) {
        return generate(model.getSelection(), ((JChemPaintRendererModel) model).getSelectedPartColor());
    }

    protected IRenderingElement generate(IChemObjectSelection selection, Color selectionColor) {
        ElementGroup selectionElements = new ElementGroup();

        if (selection == null)
            return selectionElements;

        if (selection instanceof IncrementalSelection) {
            IncrementalSelection sel = (IncrementalSelection) selection;
            if (!sel.isFinished())
                selectionElements.add(sel.generate(selectionColor));
        }
        return selectionElements;
    }
View Full Code Here

                    this.modelCenter));
        }
  }

  protected IRenderingElement generateDiagram(IAtomContainer ac) {
      ElementGroup diagram = new ElementGroup();
        for (IGenerator generator : this.generators) {
          IRenderingElement element = generator.generate(ac, this.rendererModel);
          if(!(element instanceof TextGroupElement) || ((TextGroupElement)element).children.size()>0)
            diagram.add(element);
        }
        //Rgroup stuff (not contained in the ac)
       
        return diagram;
  }
View Full Code Here

        this.hub = hub;
    }

    public IRenderingElement generate(IAtomContainer ac, RendererModel model) {
        if(hub.getPhantomText()==null)
            return new ElementGroup();
        else
            return new TextElement(hub.getPhantomTextPosition().x, hub.getPhantomTextPosition().y, hub.getPhantomText(), Color.GRAY);
    }
View Full Code Here

TOP

Related Classes of org.openscience.cdk.renderer.elements.ElementGroup

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.