Examples of Ellipse2D


Examples of java.awt.geom.Ellipse2D

    /* (non-Javadoc)
     * @see org.jpox.store.mapping.JavaTypeMapping#setObject(org.jpox.ObjectManager, java.lang.Object, int[], java.lang.Object)
     */
    public void setObject(ObjectManager om, Object preparedStatement, int[] exprIndex, Object value)
    {
      Ellipse2D ellipse = (Ellipse2D)value;
        if (ellipse == null)
        {
        for (int i = 0; i < exprIndex.length; i++)
        {
          getDataStoreMapping(i).setObject(preparedStatement, exprIndex[i], null);         
      }
        }
        else
        {
            getDataStoreMapping(0).setDouble(preparedStatement,exprIndex[0],ellipse.getX());
            getDataStoreMapping(1).setDouble(preparedStatement,exprIndex[1],ellipse.getY());
            getDataStoreMapping(2).setDouble(preparedStatement,exprIndex[2],ellipse.getWidth());
            getDataStoreMapping(3).setDouble(preparedStatement,exprIndex[3],ellipse.getHeight());
        }
    }
View Full Code Here

Examples of java.awt.geom.Ellipse2D

   * Returns <code>true</code> if the disc of this compass contains
   * the point at (<code>x</code>, <code>y</code>)
   * with a given <code>margin</code>.
   */
  public boolean containsPoint(float x, float y, float margin) {
    Ellipse2D shape = new Ellipse2D.Float(getX() - getDiameter() / 2, getY() - getDiameter() / 2, getDiameter(), getDiameter());
    if (margin == 0) {
      return shape.contains(x, y);
    } else {
      return shape.intersects(x - margin, y - margin, 2 * margin, 2 * margin);
    }
  }
View Full Code Here

Examples of java.awt.geom.Ellipse2D

   * Returns the ellipse shape matching this camera.
   */
  private Shape getShape() {
    if (this.shapeCache == null) {
      // Create the ellipse that matches piece bounds
      Ellipse2D cameraEllipse = new Ellipse2D.Float(
          getX() - getWidth() / 2, getY() - getDepth() / 2,
          getWidth(), getDepth());
      // Apply rotation to the rectangle
      AffineTransform rotation = new AffineTransform();
      rotation.setToRotation(getYaw(), getX(), getY());
      PathIterator it = cameraEllipse.getPathIterator(rotation);
      GeneralPath pieceShape = new GeneralPath();
      pieceShape.append(it, false);
      // Cache shape
      this.shapeCache = pieceShape;
    }
View Full Code Here

Examples of java.awt.geom.Ellipse2D

         
          // Paint recorded camera path
          g2D.setComposite(AlphaComposite.getInstance(AlphaComposite.SRC_OVER, 1));
          g2D.setColor(getSelectionColor());
          float cameraCircleRadius = 7 / getScale();
          Ellipse2D ellipse = new Ellipse2D.Float(-cameraCircleRadius, -cameraCircleRadius,
              2 * cameraCircleRadius, 2 * cameraCircleRadius);
          List<Camera> cameraPath = controller.getCameraPath();
          for (int i = 0; i < cameraPath.size(); i++) {
            Camera camera = cameraPath.get(i);
            AffineTransform previousTransform = g2D.getTransform();
View Full Code Here

Examples of java.awt.geom.Ellipse2D

    /* (non-Javadoc)
     * @see org.datanucleus.store.mapping.JavaTypeMapping#setObject(org.datanucleus.ObjectManager, java.lang.Object, int[], java.lang.Object)
     */
    public void setObject(ExecutionContext ec, Object preparedStatement, int[] exprIndex, Object value)
    {
      Ellipse2D ellipse = (Ellipse2D)value;
        if (ellipse == null)
        {
        for (int i = 0; i < exprIndex.length; i++)
        {
          getDatastoreMapping(i).setObject(preparedStatement, exprIndex[i], null);         
      }
        }
        else
        {
            getDatastoreMapping(0).setDouble(preparedStatement,exprIndex[0],ellipse.getX());
            getDatastoreMapping(1).setDouble(preparedStatement,exprIndex[1],ellipse.getY());
            getDatastoreMapping(2).setDouble(preparedStatement,exprIndex[2],ellipse.getWidth());
            getDatastoreMapping(3).setDouble(preparedStatement,exprIndex[3],ellipse.getHeight());
        }
    }
View Full Code Here

Examples of java.awt.geom.Ellipse2D

        /**
         * Returns a Shape representing a thumb.
         */
        private Shape createThumbShape(int width, int height) {
            // Use circular shape.
            Ellipse2D shape = new Ellipse2D.Double(0, 0, width, height);
            return shape;
        }
View Full Code Here

Examples of java.awt.geom.Ellipse2D

  private void paintControlPoint(Graphics2D g2, Point2D control) {
    double origin_x = xPositionToPixel(control.getX());
    double origin_y = yPositionToPixel(control.getY());
    double pos = control == control1 ? 0.0 : 1.0;

    Ellipse2D outer = getDraggableArea(control);
    Ellipse2D inner = new Ellipse2D.Double(origin_x + 2.0 - CONTROL_POINT_SIZE / 2.0,
        origin_y + 2.0 - CONTROL_POINT_SIZE / 2.0,
        8.0, 8.0);

    Area circle = new Area(outer);
    circle.subtract(new Area(inner));
View Full Code Here

Examples of java.awt.geom.Ellipse2D

  }

  private class ControlPointsHandler extends MouseMotionAdapter {
    @Override
    public void mouseMoved(MouseEvent e) {
      Ellipse2D area1 = getDraggableArea(control1);
      Ellipse2D area2 = getDraggableArea(control2);

      if (area1.contains(e.getPoint()) || area2.contains(e.getPoint())) {
        setCursor(Cursor.getPredefinedCursor(Cursor.HAND_CURSOR));
      } else {
        setCursor(Cursor.getDefaultCursor());
      }
    }
View Full Code Here

Examples of java.awt.geom.Ellipse2D

  }

  private class SelectionHandler extends MouseAdapter {
    @Override
    public void mousePressed(MouseEvent e) {
      Ellipse2D area1 = getDraggableArea(control1);
      Ellipse2D area2 = getDraggableArea(control2);

      if (area1.contains(e.getPoint())) {
        selected = control1;
        dragStart = e.getPoint();

        Rectangle bounds = area1.getBounds();
        repaint(bounds.x, bounds.y, bounds.width, bounds.height);
      } else if (area2.contains(e.getPoint())) {
        selected = control2;
        dragStart = e.getPoint();

        Rectangle bounds = area2.getBounds();
        repaint(bounds.x, bounds.y, bounds.width, bounds.height);
      } else {
        resetSelection();
      }
    }
View Full Code Here

Examples of java.awt.geom.Ellipse2D

                stream.writeDouble(rectangle.getY());
                stream.writeDouble(rectangle.getWidth());
                stream.writeDouble(rectangle.getHeight());
            }
            else if (shape instanceof Ellipse2D) {
                final Ellipse2D ellipse = (Ellipse2D) shape;
                stream.writeObject(Ellipse2D.class);
                stream.writeDouble(ellipse.getX());
                stream.writeDouble(ellipse.getY());
                stream.writeDouble(ellipse.getWidth());
                stream.writeDouble(ellipse.getHeight());
            }
            else if (shape instanceof Arc2D) {
                final Arc2D arc = (Arc2D) shape;
                stream.writeObject(Arc2D.class);
                stream.writeDouble(arc.getX());
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.