edu.mit.csail.sdg.alloy4
Class OurPDFWriter

java.lang.Object
  extended by edu.mit.csail.sdg.alloy4.OurPDFWriter

public final class OurPDFWriter
extends java.lang.Object

Graphical convenience methods for producing PDF files.

This implementation explicitly generates a very simple 8.5 inch by 11 inch one-page PDF consisting of graphical operations. Hopefully this class will no longer be needed in the future once Java comes with better PDF support.


Constructor Summary
OurPDFWriter(java.lang.String filename, int dpi, double scale)
          Begin a blank PDF file with the given dots-per-inch and the given scale (the given file, if existed, will be overwritten)
 
Method Summary
 void close()
          Close and save this PDF object.
 OurPDFWriter drawCircle(int radius, boolean fillOrNot)
          Draws a circle of the given radius, centered at (0, 0).
 OurPDFWriter drawLine(int x1, int y1, int x2, int y2)
          Draws a line from (x1, y1) to (x2, y2).
 OurPDFWriter drawShape(java.awt.Shape shape, boolean fillOrNot)
          Draws a shape.
 OurPDFWriter setBoldLine()
          Changes the line style to be bold.
 OurPDFWriter setColor(java.awt.Color color)
          Changes the color for subsequent graphical drawing.
 OurPDFWriter setDashedLine()
          Changes the line style to be dashed.
 OurPDFWriter setDottedLine()
          Changes the line style to be dotted.
 OurPDFWriter setNormalLine()
          Changes the line style to be normal.
 OurPDFWriter shiftCoordinateSpace(int x, int y)
          Shifts the coordinate space by the given amount.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

OurPDFWriter

public OurPDFWriter(java.lang.String filename,
                    int dpi,
                    double scale)
Begin a blank PDF file with the given dots-per-inch and the given scale (the given file, if existed, will be overwritten)

Throws:
java.lang.IllegalArgumentException - if dpi is less than 50 or is greater than 3000
Method Detail

setColor

public OurPDFWriter setColor(java.awt.Color color)
Changes the color for subsequent graphical drawing.


setNormalLine

public OurPDFWriter setNormalLine()
Changes the line style to be normal.


setBoldLine

public OurPDFWriter setBoldLine()
Changes the line style to be bold.


setDottedLine

public OurPDFWriter setDottedLine()
Changes the line style to be dotted.


setDashedLine

public OurPDFWriter setDashedLine()
Changes the line style to be dashed.


shiftCoordinateSpace

public OurPDFWriter shiftCoordinateSpace(int x,
                                         int y)
Shifts the coordinate space by the given amount.


drawLine

public OurPDFWriter drawLine(int x1,
                             int y1,
                             int x2,
                             int y2)
Draws a line from (x1, y1) to (x2, y2).


drawCircle

public OurPDFWriter drawCircle(int radius,
                               boolean fillOrNot)
Draws a circle of the given radius, centered at (0, 0).


drawShape

public OurPDFWriter drawShape(java.awt.Shape shape,
                              boolean fillOrNot)
Draws a shape.


close

public void close()
           throws java.io.IOException
Close and save this PDF object.

Throws:
java.io.IOException