Package org.openscience.cdk.interfaces

Examples of org.openscience.cdk.interfaces.IChemModel


            t.printStackTrace(System.err);
        }
    }

    public static void showEmptyInstance(boolean debug) {
        IChemModel chemModel = emptyModel();
        showInstance(chemModel, GT.get("Untitled") + " "
                + (instancecounter++), debug);
    }
View Full Code Here


        showInstance(chemModel, GT.get("Untitled") + " "
                + (instancecounter++), debug);
    }
   
    public static IChemModel emptyModel() {
        IChemModel chemModel = DefaultChemObjectBuilder.getInstance().newInstance(IChemModel.class);
        chemModel.setMoleculeSet(chemModel.getBuilder().newInstance(IAtomContainerSet.class));
        chemModel.getMoleculeSet().addAtomContainer(
                chemModel.getBuilder().newInstance(IAtomContainer.class));
        return chemModel;
    }
View Full Code Here

                    JChemPaintEditorApplet.GUI_APPLET) ||
                    JChemPaintPanel.getAllAtomContainersInOne(jcpPanel.getChemModel()).getAtomCount()==0) {
                int clear = jcpPanel.showWarning();
                if (clear == JOptionPane.YES_OPTION) {
                    try {
                        IChemModel chemModel = null;
                            chemModel = JChemPaint.readFromFile(f, null, jcpPanel);
                        if (jcpPanel.get2DHub().getUndoRedoFactory() != null
                                && jcpPanel.get2DHub().getUndoRedoHandler() != null) {
                            IUndoRedoable undoredo = jcpPanel.get2DHub()
                                    .getUndoRedoFactory().getLoadNewModelEdit(
                                            jcpPanel.getChemModel(),
            null,
                                            jcpPanel.getChemModel()
                                                    .getMoleculeSet(),
                                            jcpPanel.getChemModel()
                                                    .getReactionSet(),
                                            chemModel.getMoleculeSet(),
                                            chemModel.getReactionSet(),
                                            "Load "
                                                    + f.getName());
                            jcpPanel.get2DHub().getUndoRedoHandler().postEdit(
                                    undoredo);
                        }
                        jcpPanel.getChemModel().setMoleculeSet(
                                chemModel.getMoleculeSet());
                        jcpPanel.getChemModel().setReactionSet(chemModel.getReactionSet());
                        jcpPanel.getRenderPanel().getRenderer()
                                .getRenderer2DModel().setSelection(
                                        new LogicalSelection(
                                                LogicalSelection.Type.NONE));
View Full Code Here

    }

    public static void showInstance(File inFile, String type,
            AbstractJChemPaintPanel jcpPanel, boolean debug) {
        try {
            IChemModel chemModel = JChemPaint.readFromFile(inFile, type, jcpPanel);

            String name = inFile.getName();
            JChemPaintPanel p = JChemPaint.showInstance(chemModel, name, debug);
            p.setCurrentWorkDirectory(inFile.getParentFile());
            p.setLastOpenedFile(inFile);
View Full Code Here

   
    public static IChemModel readFromFileReader(URL fileURL, String url,
            String type, AbstractJChemPaintPanel panel) throws CDKException {

        IChemModel chemModel = null;
        WaitDialog.showDialog();


        // InChI workaround - guessing for InChI results into an INChIReader
        // (this does not work, we'd need an INChIPlainTextReader..)
View Full Code Here

        if (cor instanceof CMLReader)
            cor.setReader(new FileInputStream(file)); // hack
        else
            cor.setReader(new FileReader(file)); // hack

        IChemModel chemModel = JChemPaint.getChemModelFromReader(cor,panel);
        boolean avoidOverlap=true;
        if (cor instanceof RGroupQueryReader)
          avoidOverlap=false;

        JChemPaint.cleanUpChemModel(chemModel, avoidOverlap, panel);
View Full Code Here

     */
    public static void generateModel(AbstractJChemPaintPanel chemPaintPanel, IAtomContainer molecule, boolean generateCoordinates, boolean shiftPasted)
    throws CDKException {
        if (molecule == null) return;

        IChemModel chemModel = chemPaintPanel.getChemModel();
        IAtomContainerSet moleculeSet = chemModel.getMoleculeSet();
        if (moleculeSet == null) {
            moleculeSet = new AtomContainerSet();
        }
       
        // On copy & paste on top of an existing drawn structure, prevent the
View Full Code Here

        this.setBackground(renderer.getRenderer2DModel().getBackColor());
        this.setPreferredSize(new Dimension(width, height));
    }

    public String toSVG() {
        IChemModel chemModel = this.hub.getIChemModel();
        if (chemModel != null && chemModel.getMoleculeSet() != null) {
            SVGGenerator svgGenerator = new SVGGenerator();
            this.renderer.paintChemModel(chemModel, svgGenerator);
            return svgGenerator.getResult();
        } else {
            return "<svg></svg>";
View Full Code Here

            return "<svg></svg>";
        }
    }

    public Image takeSnapshot() {
        IChemModel chemModel = hub.getIChemModel();
        if (isValidChemModel(chemModel)) {
            Rectangle2D modelBounds = Renderer.calculateBounds(chemModel);
            Rectangle bounds = renderer.calculateScreenBounds(modelBounds);
            bounds.height *=1.1;
            bounds.width *=1.1;
 
View Full Code Here

            return null;
        }
    }

    public void takeSnapshot(Graphics2D g) {
        IChemModel chemModel = hub.getIChemModel();
        Rectangle2D modelBounds = Renderer.calculateBounds(chemModel);
        Rectangle bounds = renderer.calculateScreenBounds(modelBounds);
        this.takeSnapshot(g, hub.getIChemModel(), bounds, modelBounds);
    }
View Full Code Here

TOP

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

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.