コード例 #1
0
 /**
  * Performs the layout with no constraint, so the content size is determined by the bounds of the
  * shape and/or line drawn to represent the series.
  *
  * @param g2 the graphics device.
  * @return The content size.
  */
 protected ArrangeResult arrangeNN(Graphics2D g2, ArrangeParams params) {
   Rectangle2D contentSize = new Rectangle2D.Double();
   if (this.line != null) {
     contentSize.setRect(this.line.getBounds2D());
   }
   if (this.shape != null) {
     contentSize = contentSize.createUnion(this.shape.getBounds2D());
   }
   ArrangeResult result = params.getRecyclableResult();
   if (result != null) {
     result.setSize(contentSize.getWidth(), contentSize.getHeight());
   } else {
     result = new ArrangeResult(contentSize.getWidth(), contentSize.getHeight(), null);
   }
   return result;
 }
コード例 #2
0
  protected ArrangeResult arrangeFF(
      Graphics2D g2, double fixedWidth, double fixedHeight, ArrangeParams params) {

    Rectangle2D contentSize = new Rectangle2D.Double();
    if (this.line != null) {
      contentSize.setRect(this.line.getBounds2D());
    }
    if (this.shape != null) {
      contentSize = contentSize.createUnion(this.shape.getBounds2D());
    }
    // TODO: compare the contentSize to the required fixed size
    // and possibly log the problems
    ArrangeResult result = params.getRecyclableResult();
    if (result != null) {
      result.setSize(fixedWidth, fixedHeight);
    } else {
      result = new ArrangeResult(fixedWidth, fixedHeight, null);
    }
    return result;
  }