Examples of Size2D


Examples of com.positive.charts.util.Size2D

   *            the constraint (<code>null</code> not permitted).
   *
   * @return The block size (in Java2D units, never <code>null</code>).
   */
  public Size2D arrange(final GC g2, final RectangleConstraint constraint) {
    final Size2D result = new Size2D();
    this.fetchLegendItems();
    if (this.items.isEmpty()) {
      return result;
    }
    BlockContainer container = this.wrapper;
    if (container == null) {
      container = this.items;
    }
    final RectangleConstraint c = this.toContentConstraint(constraint);
    final Size2D size = container.arrange(g2, c);
    result.height = this.calculateTotalHeight(size.height);
    result.width = this.calculateTotalWidth(size.width);
    return result;
  }
View Full Code Here

Examples of com.positive.charts.util.Size2D

    double y = 0.0;
    double maxHeight = 0.0;
    final List itemsInRow = new ArrayList();
    for (int i = 0; i < blocks.size(); i++) {
      final Block block = (Block) blocks.get(i);
      final Size2D size = block.arrange(g2, RectangleConstraint.NONE);
      if (x + size.width <= width) {
        itemsInRow.add(block);
        block.setBounds(RectUtils.doubleRect(x, y, size.width,
            size.height));
        x = x + size.width + this.horizontalGap;
        maxHeight = Math.max(maxHeight, size.height);
      } else {
        if (itemsInRow.isEmpty()) {
          // place in this row (truncated) anyway
          block.setBounds(RectUtils.doubleRect(x, y, Math.min(
              size.width, width - x), size.height));
          x = 0.0;
          y = y + size.height + this.verticalGap;
        } else {
          // start new row
          itemsInRow.clear();
          x = 0.0;
          y = y + maxHeight + this.verticalGap;
          maxHeight = size.height;
          block.setBounds(RectUtils.doubleRect(x, y, Math.min(
              size.width, width), size.height));
          x = size.width + this.horizontalGap;
          itemsInRow.add(block);
        }
      }
    }
    return new Size2D(constraint.getWidth(), y + maxHeight);
  }
View Full Code Here

Examples of com.positive.charts.util.Size2D

   * @return The size following the arrangement.
   */
  protected Size2D arrangeFR(final BlockContainer container, final GC g2,
      final RectangleConstraint constraint) {

    final Size2D s = this.arrangeFN(container, g2, constraint);
    if (constraint.getHeightRange().contains(s.height)) {
      return s;
    } else {
      final RectangleConstraint c = constraint.toFixedHeight(constraint
          .getHeightRange().constrain(s.getHeight()));
      return this.arrangeFF(container, g2, c);
    }
  }
View Full Code Here

Examples of com.positive.charts.util.Size2D

            // TODO: shift block down to bottom
          }
        }
      }
    }
    return new Size2D(width, maxHeight);
  }
View Full Code Here

Examples of com.positive.charts.util.Size2D

   * @return The size following the arrangement.
   */
  protected Size2D arrangeRF(final BlockContainer container, final GC g2,
      final RectangleConstraint constraint) {

    final Size2D s = this.arrangeNF(container, g2, constraint);
    if (constraint.getWidthRange().contains(s.width)) {
      return s;
    } else {
      final RectangleConstraint c = constraint.toFixedWidth(constraint
          .getWidthRange().constrain(s.getWidth()));
      return this.arrangeFF(container, g2, c);
    }
  }
View Full Code Here

Examples of com.positive.charts.util.Size2D

   */
  protected Size2D arrangeRN(final BlockContainer container, final GC g2,
      final RectangleConstraint constraint) {
    // first arrange without constraints, then see if the width fits
    // within the required range...if not, call arrangeFN() at max width
    final Size2D s1 = this.arrangeNN(container, g2);
    if (constraint.getWidthRange().contains(s1.width)) {
      return s1;
    } else {
      final RectangleConstraint c = constraint.toFixedWidth(constraint
          .getWidthRange().getUpperBound());
View Full Code Here

Examples of com.positive.charts.util.Size2D

  protected Size2D arrangeRR(final BlockContainer container, final GC g2,
      final RectangleConstraint constraint) {

    // first arrange without constraints, and see if this fits within
    // the required ranges...
    final Size2D s1 = this.arrangeNN(container, g2);
    if (constraint.getWidthRange().contains(s1.width)) {
      return s1; // TODO: we didn't check the height yet
    } else {
      final RectangleConstraint c = constraint.toFixedWidth(constraint
          .getWidthRange().getUpperBound());
View Full Code Here

Examples of graphics.common.Size2D

    final int listSize = 400;
    GraphicsObject[] objList = new GraphicsObject[ listSize ];
    List< GraphicsObject > objList2 = new LinkedList< GraphicsObject >();
    for( int i = 0; i < listSize; i++ ) {
      Point2D tempPoint = new Point2D( rand.nextInt( window.getWidth() - 30 ) + 30, rand.nextInt( window.getHeight() - 30 ) + 30 );
      Size2D tempSize = new Size2D( rand.nextInt( 30 ) + 21, rand.nextInt( 30 ) + 21 );
      GraphicsObject obj = new JavaSprite( "fenceright",
          tempPoint, tempSize );
      objList[ i ] = obj;
      objList2.add( obj );
    }
    GraphicsObject obj = new JavaSprite( "fenceright",
        new Point2D( 15, 31 ), new Size2D( 80, 80 ) );
   
    GraphicsObject elp1 = new Oval( new Point2D( 50, 50 ), new Size2D( 30, 16 ) );
    ((Oval)elp1).setColor( new Color( 255, 0, 0 ) );
    GraphicsObject elp2 = new Oval( new Point2D( 300, 300 ), new Size2D( 30, 16 ),
                      new Color( 255, 0, 0 ) );
    GraphicsObject cur = new BezierCurve( new Point2D( 65, 58 ), new Point2D( 315, 108 ),
                  new Point2D( 315, 208 ), new Point2D( 315, 308 ),
                  new Color( 255, 255, 0 ), 100 );
   
    Network network = new Network();
    Network.Node n1 = network.new Node( new Oval( new Point2D( 100, 100 ), new Size2D( 30, 15 ) ) );
    Network.Node n2 = network.new Node( new Oval( new Point2D( 200, 450 ), new Size2D( 30, 15 ) ) );
    Network.Node n3 = network.new Node( new Oval( new Point2D( 30, 200 ), new Size2D( 30, 15 ) ) );
    Network.Node n4 = network.new Node( new Oval( new Point2D( 500, 40 ), new Size2D( 30, 15 ) ) );
    network.addNode( n1 );
    network.addNode( n2 );
    network.addNode( n3 );
    network.addNode( n4 );
    network.addEdge( n1, n2 );
    network.addEdge( n1, n4 );
    //network.addEdge( n2, n3 );
    //network.addEdge( n4, n3 );
   
    Timer timer = new Timer();
    int frames = 0, prevFrames = 0;
    int timePassed = 0;
    timer.start();
    while( true ) {
      kb.poll();
      if( kb.keyDown( KeyEvent.VK_Q ) ) {
        break;
      }
      if( kb.keyDown( KeyEvent.VK_A ) ) {
        Point2D tempPoint = new Point2D( rand.nextInt( window.getWidth() ), rand.nextInt( window.getHeight() ) );
        Size2D tempSize = new Size2D( rand.nextInt( 30 ) + 21, rand.nextInt( 30 ) + 21 );
        GraphicsObject obj2 = new JavaSprite( "fenceright",
            tempPoint, tempSize );
        objList2.add( obj2 );
      }
      window.clear();
View Full Code Here

Examples of graphics.common.Size2D

    }

    private class Get2D implements SizeGet {
        @Override
        public Size get( double width, double height, double depth ) {
                return new Size2D( width, height );
        }
View Full Code Here

Examples of graphics.common.Size2D

    makeWindow( windowName, windowSize );
  }
 
  public JavaWindow( String windowName, int width, int height)
  {
    makeWindow( windowName, new Size2D( width, height ) );
  }
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.