Java 8 Point2D - top ranked examples from Open Source projects

These code examples were ranked by Codota’s semantic indexing as the best open source examples for Java 8 Point2D class.

This code example shows how to use the following methods:getX, getY
     */ 
    public void itemDragged(VisualItem item, MouseEvent e) {
        if (!SwingUtilities.isLeftMouseButton(e)) return;
        dragged = true;
        Display d = (Display)e.getComponent();
        d.getAbsoluteCoordinate(e.getPoint(), temp);
        double dx = temp.getX()-down.getX();
        double dy = temp.getY()-down.getY();
        double x = item.getX();
        double y = item.getY();
 
        item.setStartX(x);  item.setStartY(y);
        item.setX(x+dx);    item.setY(y+dy);
        item.setEndX(x+dx); item.setEndY(y+dy);
         
        if ( repaint )
            item.getVisualization().repaint();
         
        down.setLocation(temp);
        if ( action != null )
9
CodeRank
Experience pair programming with AI  Get Codota for Java
This code example shows how to use the following methods:getX, getY
        this.y = y;
        this.type = type;
    } 
 
    public Point(Point2D pt) {
        this(pt.getX(), pt.getY(), LINE_TO);
    } 
 
    public double getX() { 
        return x;
    } 
 
    public double getY() { 
        return y;
    } 
 
    public int getType() { 
        return type;
    } 
 
8
CodeRank
Experience pair programming with AI  Get Codota for Java
This code example shows how to use the following methods:getX, getY
        GridCoverage2DRIA cria = GridCoverage2DRIA.create(dst, src, NODATA);
 
        //--- internal points should double coords (no interp on coords) 
        Point2D psrc = new Point2D.Double(13d,16d); // this is on dst gc
        Point2D pdst = cria.mapSourcePoint(psrc, 0);
        assertNotNull("Can't convert " + psrc, pdst);
        assertEquals(26d, pdst.getX());
        assertEquals(32d, pdst.getY());
 
        //--- external points should not be remapped 
        psrc = new Point2D.Double(600d,600d); // this is on dst gc
        pdst = cria.mapSourcePoint(psrc, 0);
        assertNull(pdst);
 
//        src.view(ViewType.RENDERED).show(); 
//        dst.view(ViewType.RENDERED).show(); 
//        new Viewer(getName(), cria); 
//        Thread.sleep(15000); 
    } 
 
8
CodeRank
Experience pair programming with AI  Get Codota for Java
This code example shows how to use the following methods:getX, getY
     * @param bounds the layout bounds 
     * @return the corrected anchor point 
     */ 
    protected Point2D correct(Point2D anchor, Rectangle2D bounds) {
        if ( anchor == null ) return anchor;
        double x = anchor.getX(), y = anchor.getY();
        double x1 = bounds.getMinX(), y1 = bounds.getMinY();
        double x2 = bounds.getMaxX(), y2 = bounds.getMaxY();
        x = (x < x1 ? x1 : (x > x2 ? x2 : x));
        y = (y < y1 ? y1 : (y > y2 ? y2 : y));
         
        m_tmp.setLocation(x,y);
        return m_tmp;
    } 
     
    /** 
     * Distorts an item's x-coordinate. 
     * @param x the undistorted x coordinate 
     * @param anchor the anchor or focus point of the display 
     * @param bounds the layout bounds 
8
CodeRank
Experience pair programming with AI  Get Codota for Java
This code example shows how to use the following methods:getX, getY
     */ 
    public Point2D getPoint2D(Point2D srcPt, Point2D dstPt) {
        if (dstPt == null) {
            dstPt = new Point2D.Float();
        } 
        dstPt.setLocation(srcPt.getX(), srcPt.getY());
 
        return dstPt;
    } 
 
    /* (non-Javadoc) 
     * @see java.awt.image.BufferedImageOp#getRenderingHints() 
     */ 
    public RenderingHints getRenderingHints() {
        return hints;
    } 
 
    protected boolean containsMyFilterParams(String key, Map<String, String> parameterMap) {
        for (String paramKey : parameterMap.keySet()) {
            if (paramKey.startsWith(key)) {
8
CodeRank
Experience pair programming with AI  Get Codota for Java
This code example shows how to use the following methods:getX, getY
        } 
        savePrefs(); 
    } 
 
    public void setClonePoint(Point2D p) {
        super.setClonePoint(p);
 
        // Revise the default clone point offsets. 
        Point2D p1 = (Point2D) points.get(0);
        Point2D p2 = (Point2D) points.get(1);
        EllipticCloneX = p.getX() - (p1.getX() + p2.getX()) / 2;
        EllipticCloneY = p.getY() - (p1.getY() + p2.getY()) / 2;
 
        savePrefs(); 
    } 
 
    public void setInnerShape(Point2D p) {
        super.setInnerShape(p);
        isManualWidthSet = true;
    } 
8
CodeRank
Experience pair programming with AI  Get Codota for Java
This code example shows how to use the following methods:getX, getY, setLocation
        m_linear = linearGroup;
    } 
 
    private void setAnchor() { 
        Display d = getVisualization().getDisplay(0);
        m_anchor.setLocation(d.getWidth()/2,d.getHeight()/2);
        d.getAbsoluteCoordinate(m_anchor, m_anchor);
        ax = m_anchor.getX();
        ay = m_anchor.getY();
    } 
 
    /** 
     * @see prefuse.action.Action#run(double) 
     */ 
    public void run(double frac) {
        setAnchor(); 
        super.run(frac);
    } 
     
    /** 
7
CodeRank
Experience pair programming with AI  Get Codota for Java
This code example shows how to use the following methods:getX, getY
    } 
     
    public Point2D getPoint2D( Point2D srcPt, Point2D dstPt ) {
        if ( dstPt == null )
            dstPt = new Point2D.Double();
        dstPt.setLocation( srcPt.getX(), srcPt.getY() );
        return dstPt;
    } 
 
    public RenderingHints getRenderingHints() {
        return null; 
    } 
 
	/** 
	 * A convenience method for getting ARGB pixels from an image. This tries to avoid the performance 
	 * penalty of BufferedImage.getRGB unmanaging the image. 
     * @param image   a BufferedImage object 
     * @param x       the left edge of the pixel block 
     * @param y       the right edge of the pixel block 
     * @param width   the width of the pixel arry 
8
CodeRank
Experience pair programming with AI  Get Codota for Java
This code example shows how to use the following methods:getX, getY
    } 
    objMap.put("expectedRuntime", expectedRunTimeSec);
 
    HashMap<String, Object> layoutInfo = new HashMap<String, Object>();
    if (position != null) {
      layoutInfo.put("x", position.getX());
      layoutInfo.put("y", position.getY());
    } 
    layoutInfo.put("level", level);
    objMap.put("layout", layoutInfo); 
 
    return objMap; 
  } 
} 
8
CodeRank
Experience pair programming with AI  Get Codota for Java
This code example shows how to use the following methods:getX, getY
	 * Set the centre of the effect as a proportion of the image size. 
	 * @param centre the center 
     * @see #getCentre 
	 */ 
	public void setCentre( Point2D centre ) {
		this.centreX = (float)centre.getX();
		this.centreY = (float)centre.getY();
	} 
 
	/** 
	 * Get the centre of the effect as a proportion of the image size. 
	 * @return the center 
     * @see #setCentre 
	 */ 
	public Point2D getCentre() {
		return new Point2D.Float( centreX, centreY );
	} 
	 
	/** 
	 * Set the radius of the effect. 
8
CodeRank
Experience pair programming with AI  Get Codota for Java
See Code Examples for Java 8 Point2D Methods: