Exemplo n.º 1
0
 /**
  * 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());
 }
Exemplo n.º 2
0
 /**
  * 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);
 }
Exemplo n.º 3
0
 /**
  * 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);
 }
Exemplo n.º 4
0
 public double getScalingFactor() {
   return scene.getScalingFactor();
 }
Exemplo n.º 5
0
 /**
  * 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);
 }