/** * Gets the content size for the specified page. * * @param page the page number. * @return the content size. */ public Rectangle2D getContentSize(final int page) { Rectangle2D content = scene.getContentSize(); return new Rectangle2D.Double( content.getX(), (page - 1) * perPage * scene.getScalingFactor(), content.getWidth(), perPage * scene.getScalingFactor()); }
/** * Render a page of the scene. * * @param page the page. * @param graphics the graphics. */ public void renderContents(final int page, final GraphicsContext graphics) { scene.setParameter("page", "" + page); Rectangle2D contents = scene.getContentSize(); renderContents( graphics, new Rectangle2D.Double( contents.getX(), (start + (page - 1) * perPage) * scene.getScalingFactor(), contents.getWidth(), perPage * scene.getScalingFactor())); scene.setParameter("page", null); }
/** * Create a new PageableScene. * * @param scene the scene. * @param paper the paper. * @param perPage the number of scene units per page. */ public PageableScene(final Scene scene, final Paper paper, final double perPage) { this( scene, paper, scene.getContentSize().getY() / scene.getScalingFactor(), perPage, true, true); }
public double getScalingFactor() { return scene.getScalingFactor(); }
/** * Gets the number of pages with the specified start Y value in scene coordinates. * * @return the number of pages. */ public int getPageCount() { Rectangle2D content = scene.getContentSize(); double height = content.getMaxY() / scene.getScalingFactor() - start; return (int) Math.ceil(height / perPage); }