org.faceless.graph.output
Class PDFOutput

java.lang.Object
  extended by org.faceless.graph.output.Output
      extended by org.faceless.graph.output.PDFOutput

public class PDFOutput
extends Output

This class renders the graph to a PDF document defined using version 1.2 or earlier of the Big Faceless PDF library. The latest version of this library is version 2, so class should only be used by those that already own an older version of the PDF library. See PDF2Output for a class that works with latest version.


Constructor Summary
PDFOutput(PDFPage p, float left, float top, float right, float bottom)
           Create a new PDFOutput class to render the graph to the specified page.
 
Method Summary
 boolean canPattern()
          Return true if this subclass out Output can handle pattern fills.
 boolean canRotate()
          Returns true if this subclass can handle rotated text (it can, so it does)
 BoundingBox getCanvas()
          Return the canvas as a BoundingBox.
 Graph getGraph()
          Return the graph being rendered.
 BoundingBox getTextBox(String text, Style s)
          Return the bounding box for given string in the specified style.
 void line(double x1, double y1, double x2, double y2)
          Draw a line from x1,y1 to x2,y2 on the canvas, in the current colour
 void poly(String name, double[] x, double[] y, int num)
          Draw and fill a polygon on the canvas, in the current colour.
 void render(Graph gr)
          Render the Graph to this Output object.
 void setColor(Paint s)
          Set the current pen, font and fill colour
 void setFontMap(String name, int style, PDFFont font)
          Define a custom font for use with this output class.
 void setLineDash(double on, double off, double phase)
          Set the line dash pattern
 void setLineThickness(double thickness)
          Set the line thickness (1 being default, 2 twice as thick, etc.) on platforms that support it.
 void text(String text, double x, double y, Style s)
          Draw a line of text at the specified position in the specified style.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

PDFOutput

public PDFOutput(PDFPage p,
                 float left,
                 float top,
                 float right,
                 float bottom)

Create a new PDFOutput class to render the graph to the specified page. This class assumes that the page has the default canvas settings - i.e. it's measured in points from the bottom left of the page.

Parameters:
p - a PDFpage object measured in points from the bottom-left
left - the left margin of the graph, in points from the left of the page
bottom - the bottom margin of the graph, in points from the bottom of the page
width - the width of the graph in points
height - the height of the graph in points
Method Detail

canRotate

public final boolean canRotate()
Returns true if this subclass can handle rotated text (it can, so it does)

Specified by:
canRotate in class Output

canPattern

public final boolean canPattern()
Description copied from class: Output
Return true if this subclass out Output can handle pattern fills.

Specified by:
canPattern in class Output

render

public void render(Graph gr)
Description copied from class: Output
Render the Graph to this Output object.

Specified by:
render in class Output

getGraph

public Graph getGraph()
Description copied from class: Output
Return the graph being rendered. For internal use.

Specified by:
getGraph in class Output

getCanvas

public BoundingBox getCanvas()
Description copied from class: Output
Return the canvas as a BoundingBox. The final graph will be sized to fit this box.

Specified by:
getCanvas in class Output

setLineThickness

public void setLineThickness(double thickness)
Description copied from class: Output
Set the line thickness (1 being default, 2 twice as thick, etc.) on platforms that support it.

Specified by:
setLineThickness in class Output

setLineDash

public void setLineDash(double on,
                        double off,
                        double phase)
Description copied from class: Output
Set the line dash pattern

Specified by:
setLineDash in class Output

setColor

public void setColor(Paint s)
Description copied from class: Output
Set the current pen, font and fill colour

Specified by:
setColor in class Output

line

public void line(double x1,
                 double y1,
                 double x2,
                 double y2)
Description copied from class: Output
Draw a line from x1,y1 to x2,y2 on the canvas, in the current colour

Specified by:
line in class Output

poly

public void poly(String name,
                 double[] x,
                 double[] y,
                 int num)
Description copied from class: Output
Draw and fill a polygon on the canvas, in the current colour. The corners of the polygon are specified by the arrays of X and Y values. The polygon has no borders, and is filled with the current colour. Subclasses should handle the cases where several of the points are the same.

Specified by:
poly in class Output
Parameters:
name - The name of the dataset that is being drawn. Not used in the current release, but will eventually be user for interaction with rendered graphs
x - the array of X co-ordinates
y - the array of Y co-ordinates
num - the number of co-ordinates in the array

setFontMap

public void setFontMap(String name,
                       int style,
                       PDFFont font)
Define a custom font for use with this output class. Here's an example:
 setFontMap("myfont", java.awt.Font.PLAIN, new TrueTypeFont("myfont.ttf"));
 

Since:
1.0.3

getTextBox

public BoundingBox getTextBox(String text,
                              Style s)
Description copied from class: Output
Return the bounding box for given string in the specified style.

Specified by:
getTextBox in class Output
Parameters:
text - The string to return the size for.
s - The style to apply to the text before returning it's size. The aspects of the style that may affect this include font, rotation and alignment

text

public void text(String text,
                 double x,
                 double y,
                 Style s)
Description copied from class: Output
Draw a line of text at the specified position in the specified style.

Specified by:
text in class Output
Parameters:
text - The line of text to draw.
x - The x position to place the text at, measured from the left of the canvas.
y - The y position to place the text at, measured from the bottom of the canvas.


Copyright © 2001-2012 Big Faceless Organization