Package org.pentaho.reporting.engine.classic.core.util.geom

Examples of org.pentaho.reporting.engine.classic.core.util.geom.StrictBounds


  @Test
  public void testImageAligningToCells()
  {
    TableRectangle rect = new TableRectangle();
    rect.setRect(1, 1, 2, 2);
    StrictBounds b = new StrictBounds(StrictGeomUtility.toInternalValue(100), StrictGeomUtility.toInternalValue(100),
        StrictGeomUtility.toInternalValue(400), StrictGeomUtility.toInternalValue(400));
    ClientAnchor clientAnchor = imageHandler.computeClientAnchor(sheetLayout, rect, b);
    Assert.assertEquals(1, clientAnchor.getCol1());
    Assert.assertEquals(1, clientAnchor.getCol2());
    Assert.assertEquals(1, clientAnchor.getRow1());
View Full Code Here


  @Test
  public void testImageAligningLeftAndTop()
  {
    TableRectangle rect = new TableRectangle();
    rect.setRect(1, 1, 2, 2);
    StrictBounds b = new StrictBounds(StrictGeomUtility.toInternalValue(100), StrictGeomUtility.toInternalValue(100),
        StrictGeomUtility.toInternalValue(300), StrictGeomUtility.toInternalValue(300));

    ClientAnchor clientAnchor = imageHandler.computeClientAnchor(sheetLayout, rect, b);
    Assert.assertEquals(1, clientAnchor.getCol1());
    Assert.assertEquals(1, clientAnchor.getCol2());
View Full Code Here

  @Test
  public void testImageAligningMiddle()
  {
    TableRectangle rect = new TableRectangle();
    rect.setRect(1, 1, 2, 2);
    StrictBounds b = new StrictBounds(StrictGeomUtility.toInternalValue(200), StrictGeomUtility.toInternalValue(200),
        StrictGeomUtility.toInternalValue(200), StrictGeomUtility.toInternalValue(200));

    ClientAnchor clientAnchor = imageHandler.computeClientAnchor(sheetLayout, rect, b);
    Assert.assertEquals(1, clientAnchor.getCol1());
    Assert.assertEquals(1, clientAnchor.getCol2());
View Full Code Here

  @Test
  public void testImageAligningToCellsXLSX()
  {
    TableRectangle rect = new TableRectangle();
    rect.setRect(1, 1, 2, 2);
    StrictBounds b = new StrictBounds(StrictGeomUtility.toInternalValue(100), StrictGeomUtility.toInternalValue(100),
        StrictGeomUtility.toInternalValue(400), StrictGeomUtility.toInternalValue(400));
    ClientAnchor clientAnchor = xlsxImageHandler.computeClientAnchor(sheetLayout, rect, b);
    Assert.assertEquals(1, clientAnchor.getCol1());
    Assert.assertEquals(1, clientAnchor.getCol2());
    Assert.assertEquals(1, clientAnchor.getRow1());
View Full Code Here

  @Test
  public void testImageAligningLeftAndTopXLSX()
  {
    TableRectangle rect = new TableRectangle();
    rect.setRect(1, 1, 2, 2);
    StrictBounds b = new StrictBounds(StrictGeomUtility.toInternalValue(100), StrictGeomUtility.toInternalValue(100),
        StrictGeomUtility.toInternalValue(300), StrictGeomUtility.toInternalValue(300));

    ClientAnchor clientAnchor = xlsxImageHandler.computeClientAnchor(sheetLayout, rect, b);
    Assert.assertEquals(1, clientAnchor.getCol1());
    Assert.assertEquals(1, clientAnchor.getCol2());
View Full Code Here

  @Test
  public void testImageAligningMiddleXLSX()
  {
    TableRectangle rect = new TableRectangle();
    rect.setRect(1, 1, 2, 2);
    StrictBounds b = new StrictBounds(StrictGeomUtility.toInternalValue(200), StrictGeomUtility.toInternalValue(200),
        StrictGeomUtility.toInternalValue(200), StrictGeomUtility.toInternalValue(200));

    ClientAnchor clientAnchor = xlsxImageHandler.computeClientAnchor(sheetLayout, rect, b);
    Assert.assertEquals(1, clientAnchor.getCol1());
    Assert.assertEquals(1, clientAnchor.getCol2());
View Full Code Here

      throw new NullPointerException();
    }

    codePointBuffer = new CodePointBuffer(400);
    text = new StringBuffer(400);
    paragraphBounds = new StrictBounds();
    revalidateTextEllipseProcessStep = new RevalidateTextEllipseProcessStep(metaData);
    this.clipOnWordBoundary = "true".equals
        (metaData.getConfiguration().getConfigProperty(
            "org.pentaho.reporting.engine.classic.core.LastLineBreaksOnWordBoundary"));
  }
View Full Code Here

  public CollectSelectedNodesStep()
  {
    resultList = new ArrayList<RenderNode>();
    strictSelection = true;
    nodebounds = new StrictBounds();
  }
View Full Code Here

      final long internalImageHeight = StrictGeomUtility.toInternalValue(scaleFactor * imageHeight);

      final long cellWidth = cellBounds.getWidth();
      final long cellHeight = cellBounds.getHeight();

      final StrictBounds cb;
      final int pictureId;
      try
      {
        if (shouldScale)
        {
          final double scaleX;
          final double scaleY;

          final boolean keepAspectRatio = layoutContext.getBooleanStyleProperty(ElementStyleKeys.KEEP_ASPECT_RATIO);
          if (keepAspectRatio)
          {
            final double imgScaleFactor = Math.min(cellWidth / (double) internalImageWidth,
                cellHeight / (double) internalImageHeight);
            scaleX = imgScaleFactor;
            scaleY = imgScaleFactor;
          }
          else
          {
            scaleX = cellWidth / (double) internalImageWidth;
            scaleY = cellHeight / (double) internalImageHeight;
          }

          final long clipWidth = (long) (scaleX * internalImageWidth);
          final long clipHeight = (long) (scaleY * internalImageHeight);

          final long alignmentX = RenderUtility.computeHorizontalAlignment(horizontalAlignment, cellWidth, clipWidth);
          final long alignmentY = RenderUtility.computeVerticalAlignment(verticalAlignment, cellHeight, clipHeight);

          cb = new StrictBounds(cellBounds.getX() + alignmentX,
              cellBounds.getY() + alignmentY,
              Math.min(clipWidth, cellWidth),
              Math.min(clipHeight, cellHeight));

          // Recompute the cells that this image will cover (now that it has been resized)
          rectangle = currentLayout.getTableBounds(cb, rectangle);

          pictureId = loadImage(image);
          if (printerBase.isUseXlsxFormat())
          {
            if (pictureId < 0)
            {
              return;
            }
          }
          else if (pictureId <= 0)
          {
            return;
          }
        }
        else
        {
          // unscaled ..
          if (internalImageWidth <= cellWidth &&
              internalImageHeight <= cellHeight)
          {
            // No clipping needed.
            final long alignmentX = RenderUtility.computeHorizontalAlignment
                (horizontalAlignment, cellBounds.getWidth(), internalImageWidth);
            final long alignmentY = RenderUtility.computeVerticalAlignment
                (verticalAlignment, cellBounds.getHeight(), internalImageHeight);

            cb = new StrictBounds(cellBounds.getX() + alignmentX,
                cellBounds.getY() + alignmentY,
                internalImageWidth,
                internalImageHeight);

            // Recompute the cells that this image will cover (now that it has been resized)
            rectangle = currentLayout.getTableBounds(cb, rectangle);

            pictureId = loadImage(image);
            if (printerBase.isUseXlsxFormat())
            {
              if (pictureId < 0)
              {
                return;
              }
            }
            else if (pictureId <= 0)
            {
              return;
            }
          }
          else
          {
            // at least somewhere there is clipping needed.
            final long clipWidth = Math.min(cellWidth, internalImageWidth);
            final long clipHeight = Math.min(cellHeight, internalImageHeight);
            final long alignmentX = RenderUtility.computeHorizontalAlignment
                (horizontalAlignment, cellBounds.getWidth(), clipWidth);
            final long alignmentY = RenderUtility.computeVerticalAlignment
                (verticalAlignment, cellBounds.getHeight(), clipHeight);
            cb = new StrictBounds(cellBounds.getX() + alignmentX,
                cellBounds.getY() + alignmentY,
                clipWidth,
                clipHeight);

            // Recompute the cells that this image will cover (now that it has been resized)
View Full Code Here

    {
      final Object o = content.getContent().getRawObject();
      if (o instanceof DrawableWrapper)
      {
        final DrawableWrapper drawableWrapper = (DrawableWrapper) o;
        final StrictBounds bounds = new StrictBounds(content.getX(), content.getY(), content.getWidth(), content.getHeight());
        DefaultImageReference imageContainer =
            RenderUtility.createImageFromDrawable(drawableWrapper, bounds, content.getStyleSheet(), metaData);
        return Image.getInstance(imageContainer.getImage(), Color.WHITE);
      }
      if (o instanceof java.awt.Image)
View Full Code Here

TOP

Related Classes of org.pentaho.reporting.engine.classic.core.util.geom.StrictBounds

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.