Package java.awt.geom

Examples of java.awt.geom.Dimension2D


    {
        double w = v0.getWidth() +
            ((v1.getWidth() - v0.getWidth()) * fraction);
        double h = v0.getHeight() +
            ((v1.getHeight() - v0.getHeight()) * fraction);
        Dimension2D value = (Dimension2D)v0.clone();
        value.setSize(w, h);
        return value;
    }
View Full Code Here


        ImageTagRegistry reg = ImageTagRegistry.getRegistry();
        reg.flushCache();
    }

    public void setGraphicsNode(GraphicsNode gn, boolean createDispatcher) {
        Dimension2D dim = bridgeContext.getDocumentSize();
        Dimension   mySz = new Dimension((int)dim.getWidth(),
                                         (int)dim.getHeight());
        JSVGComponent.this.setMySize(mySz);
        SVGSVGElement elt = svgDocument.getRootElement();
        prevComponentSize = getSize();
        AffineTransform at = calculateViewingTransform
            (fragmentIdentifier, elt);
View Full Code Here

                    (null, SVGConstants.SVG_PRESERVE_ASPECT_RATIO_ATTRIBUTE);
                Tx = ViewBox.getPreserveAspectRatioTransform
                    (elt, viewBox, aspectRatio, dim.width, dim.height);
            }else {
                // no viewBox has been specified, create a scale transform
                Dimension2D docSize = svgCanvas.getSVGDocumentSize();
                double sx = dim.width / docSize.getWidth();
                double sy = dim.height / docSize.getHeight();
                double s = Math.min(sx, sy);
                Tx = AffineTransform.getScaleInstance(s, s);
            }

            GraphicsNode gn = svgCanvas.getGraphicsNode();
View Full Code Here

    mockCompartment.expects(once()).method("setSize").with(eq(1.0), eq(2.0));
    mockedElement.setSize(1.0, 2.0);
    mockCompartment.expects(once()).method("setMinimumSize")
      .with(eq(3.0), eq(4.0));
    mockedElement.setMinimumSize(3.0, 4.0);
    Dimension2D minsize = new DoubleDimension(11.0, 12.0);
    Dimension2D size = new DoubleDimension(15.0, 18.0);
    mockCompartment.expects(once()).method("getSize").will(returnValue(size));
    assertEquals(size, mockedElement.getSize());
    mockCompartment.expects(once()).method("getMinimumSize")
      .will(returnValue(minsize));
    assertEquals(minsize, mockedElement.getMinimumSize());
View Full Code Here

  // *************************************************************************
  // ******** Resizing operations
  // ***************************************
 
  private void doRecalculateSizeExpectations(double mainwidth) {
    Dimension2D mainsize = new DoubleDimension(mainwidth, 30);
    Dimension2D opsize = new DoubleDimension(35, 10);
    Dimension2D mainminsize = new DoubleDimension(50, 30);
    Dimension2D opminsize = new DoubleDimension(35, 10);
    mockMainCompartment.expects(once()).method("recalculateSize")
      .with(eq(mockDrawingContext.proxy()));
    mockAttrCompartment.expects(once()).method("recalculateSize")
      .with(eq(mockDrawingContext.proxy()));
    mockOpCompartment.expects(once()).method("recalculateSize")
View Full Code Here

   * Returns the total canvas size for export functions. The total size
   * includes the margins
   * @return the total canvas size
   */
  public Dimension getTotalCanvasSize() {
    Dimension2D diagramSize = diagram.getSize();
    Dimension result = new Dimension();
    result.width = (int) (diagramSize.getWidth() + MARGIN_LEFT + MARGIN_RIGHT);
    result.height = (int) (diagramSize.getHeight() + MARGIN_TOP +
      MARGIN_BOTTOM);
    return result;
  }
View Full Code Here

  /**
   * Simulates a dragging operation for resizing.
   */
  public void testDragResizeSe() {
    Dimension2D minimumSize = new DoubleDimension(10, 10);
    // start dragging somewhere in the SE handle (322+, 425+)
    selection.startDragging(324.0, 427.0);
    assertTrue(selection.isDragging());
    // make it a little bigger
    setFullResizeExpectations(minimumSize);
View Full Code Here

  /**
   * Simulates a dragging operation for resizing with truncation.
   */
  public void testDragResizeSeWithTruncation() {
    // At SE resize, the position is < 22 and 25
    Dimension2D minimumSize = new DoubleDimension(20, 20);
    // start dragging somewhere in the SE handle (322+, 425+)
    selection.startDragging(324.0, 427.0);
    assertTrue(selection.isDragging());
    // make it a little smaller
    setResizeExpectations(minimumSize);
View Full Code Here

  /**
   * Simulates a dragging operation for resizing on the NW corner.
   */
  public void testDragResizeNw() {
    Point2D origin = new Point2D.Double(0, 0);
    Dimension2D minimumSize = new DoubleDimension(20, 20);
    // start dragging somewhere in the NW handle (2-, 5-)
    selection.startDragging(1, 3);
    assertTrue(selection.isDragging());
    // make it a little bigger
    setFullResizeExpectations(minimumSize);
View Full Code Here

  /**
   * Simulates a dragging operation for resizing with truncation, NW corner.
   */
  public void testDragResizeNwWithTruncation() {
    // At NW resize, the position is > (322 - 20) and (425 - 20)
    Dimension2D minimumSize = new DoubleDimension(20, 20);
    // start dragging somewhere in the NW handle (2-, 5-)
    selection.startDragging(1.0, 3.0);
    assertTrue(selection.isDragging());
    // make it a little smaller, dragging it to the lower right
    setResizeExpectations(minimumSize);
View Full Code Here

TOP

Related Classes of java.awt.geom.Dimension2D

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.