Package javax.vecmath

Examples of javax.vecmath.Point2d


        // this is essential, otherwise a rectangle
        // of (+INF, -INF, +INF, -INF) is returned!
        if (ac==null || ac.getAtomCount() == 0) {
            return new Rectangle2D.Double();
        } else if (ac.getAtomCount() == 1) {
            Point2d p = ac.getAtom(0).getPoint2d();
            return new Rectangle2D.Double(p.x, p.y, 0, 0);
        }

      double xmin = Double.POSITIVE_INFINITY;
      double xmax = Double.NEGATIVE_INFINITY;
      double ymin = Double.POSITIVE_INFINITY;
      double ymax = Double.NEGATIVE_INFINITY;

      for (IAtom atom : ac.atoms()) {
        Point2d p = atom.getPoint2d();
        xmin = Math.min(xmin, p.x);
        xmax = Math.max(xmax, p.x);
        ymin = Math.min(ymin, p.y);
        ymax = Math.max(ymax, p.y);
      }
View Full Code Here


        compare(0);
    }

    private void deleteAtom() {
        applet.button("eraser").click();
        Point2d moveto=getAtomPoint(panel, 0);
        applet.panel("renderpanel").robot.click(applet.panel("renderpanel").component(), new Point((int)moveto.x, (int)moveto.y), MouseButton.LEFT_BUTTON,1);       
    }
View Full Code Here

    }
    }
   
    private void attachRing() {
        applet.button("hexagon").click();
        Point2d moveto=getBondPoint(panel, 0);
        applet.panel("renderpanel").robot.click(applet.panel("renderpanel").component(), new Point((int)moveto.x, (int)moveto.y), MouseButton.LEFT_BUTTON,1);       
    }
View Full Code Here

        applet.panel("renderpanel").robot.click(applet.panel("renderpanel").component(), new Point((int)moveto.x, (int)moveto.y), MouseButton.LEFT_BUTTON,1);       
    }

    public void drawRing(int x, int y){
        applet.button("hexagon").click();
        Point2d moveto=new Point2d(x, y);
        applet.panel("renderpanel").robot.click(applet.panel("renderpanel").component(), new Point((int)moveto.x, (int)moveto.y), MouseButton.LEFT_BUTTON,1);
    }
View Full Code Here

    @Override
    public IRenderingElement generate(IAtomContainer ac, RendererModel model) {
        JChemPaintRendererModel jcpModel = (JChemPaintRendererModel) model;
        IAtom atom = model.getHighlightedAtom();
        if (atom != null && shouldHighlight(atom, jcpModel)) {
            Point2d p = atom.getPoint2d();
           
            // the element size has to be scaled to model space
            // so that it can be scaled back to screen space...
            double radius = jcpModel.getHighlightDistance() / jcpModel.getScale();
            radius /= 2.0;
View Full Code Here

        applet.button("C").click();
        applet.button("bondTool").click();
        applet.panel("renderpanel").robot.click(applet.panel("renderpanel").component(),new Point(100,100));
        applet.button("select").click();
    IAtomContainer ethane = panel.getChemModel().getMoleculeSet().getAtomContainer(0);
    Point2d p1 = ethane.getAtom(0).getPoint2d();
    Renderer r = panel.getRenderPanel().getRenderer();
    p1 = r.toScreenCoordinates(p1.x, p1.y);
      panel.get2DHub().mouseClickedDown((int)(p1.x), (int)(p1.y));
        applet.panel("renderpanel").robot.waitForIdle();
      panel.get2DHub().mouseClickedUp((int)p1.x, (int)p1.y);
        panel.get2DHub().updateView();
        applet.panel("renderpanel").robot.waitForIdle();
        IChemObjectSelection sel = r.getRenderer2DModel().getSelection();
        Assert.assertEquals(true, sel.contains(ethane.getAtom(0)));

    double d = r.getRenderer2DModel().getSelectionRadius() / r.getRenderer2DModel().getScale();
      panel.get2DHub().mouseClickedDown((int)(p1.x+d/2), (int)(p1.y+d/2));
        applet.panel("renderpanel").robot.waitForIdle();
      panel.get2DHub().mouseDrag((int)(p1.x+d/2), (int)(p1.y+d/2),(int)p1.x+100, (int)p1.y+100);
      panel.get2DHub().mouseClickedUp((int)p1.x+100, (int)p1.y+100);
        panel.get2DHub().updateView();
        applet.panel("renderpanel").robot.waitForIdle();
        sel = panel.getRenderPanel().getRenderer().getRenderer2DModel().getSelection();
        Point2d p2 = ethane.getAtom(0).getPoint2d();
        p2 = r.toScreenCoordinates(p2.x, p2.y);
        Assert.assertEquals((int)(p1.x+100), (int)p2.x);
    }
View Full Code Here

        panel.get2DHub().mouseClickedDown(100, 100);
        panel.get2DHub().mouseDrag(100, 100, 300, 100);
        panel.get2DHub().mouseClickedUp(300, 100);
        panel.get2DHub().updateView();
        applet.panel("renderpanel").robot.waitForIdle();
    Point2d p = getAtomPoint(panel,0,1);
        try {
        panel.get2DHub().mouseClickedDown((int)p.x, (int)p.y);
        panel.get2DHub().mouseClickedUp((int)p.x, (int)p.y);
        } catch(Exception e) {
          Assert.fail();
View Full Code Here

        double bondLengthModel = jcpPanel.get2DHub().calculateAverageBondLength(jcpPanel.get2DHub().getIChemModel().getMoleculeSet());
        double bondLengthInsert = GeometryTools.getBondLengthAverage(topaste);
        double scale=bondLengthModel/bondLengthInsert;
        for (IAtom atom : topaste.atoms()) {
            if (atom.getPoint2d()!=null) {
                atom.setPoint2d(new Point2d(atom.getPoint2d().x*scale,atom.getPoint2d().y*scale));
            }
        }
    }
View Full Code Here

            }
        }

        //somehow, in case of single atoms, there are no coordinates
        if(toPaste.getAtomCount()==1 && toPaste.getAtom(0).getPoint2d()==null)
            toPaste.getAtom(0).setPoint2d(new Point2d(0,0));

        try {
            JChemPaint.generateModel(jcpPanel, toPaste, false,true);
        } catch (CDKException e) {
      e.printStackTrace();
View Full Code Here

        Assert.assertEquals(7,panel.getChemModel().getMoleculeSet().getAtomContainer(0).getAtomCount());
        applet.menuItem("paste").click();
        Assert.assertEquals(2,panel.getChemModel().getMoleculeSet().getAtomContainerCount());
        Assert.assertEquals(7,panel.getChemModel().getMoleculeSet().getAtomContainer(0).getAtomCount());
        Assert.assertEquals(1,panel.getChemModel().getMoleculeSet().getAtomContainer(1).getAtomCount());
        Point2d moveto=panel.getRenderPanel().getRenderer().toScreenCoordinates(panel.getChemModel().getMoleculeSet().getAtomContainer(0).getAtom(4).getPoint2d().x,panel.getChemModel().getMoleculeSet().getAtomContainer(0).getAtom(4).getPoint2d().y);
        JPopupMenuFixture popup = applet.panel("renderpanel").showPopupMenuAt(new Point((int)moveto.x,(int)moveto.y));
        //try {Thread.sleep(5000);} catch (InterruptedException e) {e.printStackTrace();}
        popup.menuItem("cut").click();
        Assert.assertEquals(3,panel.getChemModel().getMoleculeSet().getAtomContainerCount());
        //try {Thread.sleep(5000);} catch (InterruptedException e) {e.printStackTrace();}
View Full Code Here

TOP

Related Classes of javax.vecmath.Point2d

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.