Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## org.faceless.graph.output
Class Output

    java.lang.Object
      org.faceless.graph.output.Output

Direct Known Subclasses:
  ImageOutput, PDF2Output, PDFOutput

    public abstract class Output

extends Object

The Output class is the abstract base class for all Output canvases in the graph Library. It defines some very primitive drawing methods (point, line, polygon and text) which need to be overridden by more concrete subclasses in order to render the graphs.

The main method in the `Output` class of interest to end-users is the `render(org.faceless.graph.Graph)` method, which takes a Graph as an argument and renders that graph to this output stream.

Method Summary
`abstract boolean` | `canPattern()` Return true if this subclass out Output can handle pattern fills.
`abstract boolean` | `canRotate()` Return true if this subclass out Output can handle rotated text.
`abstract BoundingBox` | `getCanvas()` Return the canvas as a `BoundingBox`.
`abstract Graph` | `getGraph()` Return the graph being rendered.
`abstract BoundingBox` | `getTextBox(String text, Style style)` Return the bounding box for given string in the specified style.
`abstract 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
`abstract void` | `poly(String name, double[] x, double[] y, int num)` Draw and fill a polygon on the canvas, in the current colour.
`abstract void` | `render(Graph g)` Render the Graph to this Output object.
`abstract void` | `setColor(Paint s)` Set the current pen, font and fill colour
`abstract void` | `setLineDash(double on, double off, double phase)` Set the line dash pattern
`abstract void` | `setLineThickness(double thickness)` Set the line thickness (1 being default, 2 twice as thick, etc.) on platforms that support it.
`abstract 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`

Method Detail

### getTextBox

    public abstract BoundingBox getTextBox(String text,
                                           Style style)

  Return the bounding box for given string in the specified style.

  Parameters:
    `text` - The string to return the size for.
    `style` - 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

### getCanvas

    public abstract BoundingBox getCanvas()

  Return the canvas as a `BoundingBox`. The final graph will be sized to fit this box.

### canRotate

    public abstract boolean canRotate()

  Return true if this subclass out Output can handle rotated text.

### canPattern

    public abstract boolean canPattern()

  Return true if this subclass out Output can handle pattern fills.

  Since:
    1.0.13

### setColor

    public abstract void setColor(Paint s)

  Set the current pen, font and fill colour

### setLineThickness

    public abstract void setLineThickness(double thickness)

  Set the line thickness (1 being default, 2 twice as thick, etc.) on platforms that support it.

### setLineDash

    public abstract void setLineDash(double on,
                                     double off,
                                     double phase)

  Set the line dash pattern

### text

    public abstract void text(String text,
                              double x,
                              double y,
                              Style s)

  Draw a line of text at the specified position in the specified style.

  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.
    `style` - The style to apply to the text. Aspects of the style that will be used include Color, Font, Alignment and Rotation

### line

    public abstract 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

### poly

    public abstract void poly(String name,
                              double[] x,
                              double[] y,
                              int num)

  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.

  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

### render

    public abstract void render(Graph g)
                         throws IOException

  Render the Graph to this Output object.

  Throws:
    `IOException`

### getGraph

    public abstract Graph getGraph()

  Return the graph being rendered. For internal use.

  Since:
    1.0.3

Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

Copyright © 2001-2012 Big Faceless Organization