![]() |
ENSDF++ 1.1
An easy, fast and simple way to run querys towards the ENSDF database, written in C++.
|
This represents an EPS document. More...
Public Member Functions | |
EpsDocument (String title) | |
Constructs an empty EpsDevice. | |
EpsDocument (String title, OutputStream outputStream, int minX, int minY, int maxX, int maxY) throws IOException | |
Constructs an empty EpsDevice that writes directly to a file. | |
synchronized String | getTitle () |
Returns the title of the EPS document. | |
synchronized void | updateBounds (double x, double y) |
Updates the bounds of the current EPS document. | |
synchronized void | append (EpsGraphics2D g, String line) |
Appends a line to the EpsDocument. | |
synchronized void | write (Writer writer) throws IOException |
Outputs the contents of the EPS document to the specified Writer, complete with headers and bounding box. | |
synchronized void | flush () throws IOException |
synchronized void | close () throws IOException |
boolean | isClipSet () |
void | setClipSet (boolean isClipSet) |
Private Member Functions | |
void | writeFooter (Writer writer) throws IOException |
Private Attributes | |
float | minX |
float | minY |
float | maxX |
float | maxY |
boolean | _isClipSet = false |
String | _title |
StringWriter | _stringWriter |
BufferedWriter | _bufferedWriter = null |
EpsGraphics2D | _lastG = null |
This represents an EPS document.
Several EpsGraphics2D objects may point to the same EpsDocument.
Copyright Paul Mutton, http://www.jibble.org/
Definition at line 35 of file EpsDocument.java.
EpsDocument::EpsDocument | ( | String | title, |
OutputStream | outputStream, | ||
int | minX, | ||
int | minY, | ||
int | maxX, | ||
int | maxY | ||
) | throws IOException [inline] |
Constructs an empty EpsDevice that writes directly to a file.
Bounds must be set before use.
Definition at line 55 of file EpsDocument.java.
References write().
{ _title = title; this.minX = minX; this.minY = minY; this.maxX = maxX; this.maxY = maxY; _bufferedWriter = new BufferedWriter(new OutputStreamWriter(outputStream)); write(_bufferedWriter); }
synchronized void EpsDocument::append | ( | EpsGraphics2D | g, |
String | line | ||
) | [inline] |
Appends a line to the EpsDocument.
A new line character is added to the end of the line when it is added.
Definition at line 97 of file EpsDocument.java.
References EpsGraphics2D::getBackground(), EpsGraphics2D::getClip(), EpsGraphics2D::getColor(), EpsGraphics2D::getComposite(), EpsGraphics2D::getFont(), EpsGraphics2D::getPaint(), EpsGraphics2D::getStroke(), EpsGraphics2D::setBackground(), EpsGraphics2D::setClip(), EpsGraphics2D::setColor(), EpsGraphics2D::setComposite(), EpsGraphics2D::setFont(), EpsGraphics2D::setPaint(), and EpsGraphics2D::setStroke().
Referenced by EpsGraphics2D::append().
{ if (_lastG == null) { _lastG = g; } else if (g != _lastG) { EpsGraphics2D lastG = _lastG; _lastG = g; // We are being drawn on with a different EpsGraphics2D context. // We may need to update the clip, etc from this new context. if (g.getClip() != lastG.getClip()) { g.setClip(g.getClip()); } if (!g.getColor().equals(lastG.getColor())) { g.setColor(g.getColor()); } if (!g.getBackground().equals(lastG.getBackground())) { g.setBackground(g.getBackground()); } // We don't need this, as this only affects the stroke and font, // which are dealt with separately later on. //if (!g.getTransform().equals(lastG.getTransform())) { // g.setTransform(g.getTransform()); //} if (!g.getPaint().equals(lastG.getPaint())) { g.setPaint(g.getPaint()); } if (!g.getComposite().equals(lastG.getComposite())) { g.setComposite(g.getComposite()); } if (!g.getComposite().equals(lastG.getComposite())) { g.setComposite(g.getComposite()); } if (!g.getFont().equals(lastG.getFont())) { g.setFont(g.getFont()); } if (!g.getStroke().equals(lastG.getStroke())) { g.setStroke(g.getStroke()); } } _lastG = g; try { _bufferedWriter.write(line + "\n"); } catch (IOException e) { throw new EpsException("Could not write to the output file: " + e); } }