ConForM.CoopnTools.CoKer.Visual
Class GraphicalExporter

java.lang.Object
  |
  +--ConForM.CoopnTools.CoKer.Visual.GraphicalExporter
Direct Known Subclasses:
GraphicalMIFExporter, GraphicalPSExporter

public abstract class GraphicalExporter
extends java.lang.Object

Graphical Exportation class. This class defines abstract graphical exporters, intended to be used with graphical visualisations. All interactions with an exporter object are made in the logical coordinate space, where 1 inch corresponds to 81,92 logical units.


Field Summary
protected  java.awt.Rectangle bounds
           
protected  java.awt.Color color
           
protected  float[] dash
           
protected  boolean dashed
           
protected  CoopnEnv env
           
static int EPS
          Encaspulated postscript.
protected  java.awt.Insets insets
           
static int MIF
          MIF tag.
protected  float phase
           
static int POSTSCRIPT
          Postscript.
static int RTF
          RTF tag.
protected  java.io.PrintWriter stream
           
protected  java.lang.String title
           
protected  int translationX
           
protected  int translationY
           
protected  float zoom
           
 
Constructor Summary
protected GraphicalExporter(java.io.PrintWriter stream, java.lang.String title, java.awt.Rectangle bounds, java.awt.Insets insets, int zoom, CoopnEnv env)
           
 
Method Summary
 void dispose()
          Terminates an exportation, and dispose the exporter object.
abstract  void drawArc(double x, double y, double width, double height, int startAngle, int arcAngle)
          Draw an elliptical arc, given by its bounding rectangle.
 void drawArc(java.awt.Point point, java.awt.Dimension dim, int startAngle, int arcAngle)
          Draw an elliptical arc, given by its bounding rectangle.
 void drawArc(java.awt.Rectangle rectangle, int startAngle, int arcAngle)
          Draw an elliptical arc, given by its bounding rectangle.
abstract  void drawArrow(java.awt.geom.GeneralPath path, boolean fill, int tipAngle, int baseAngle, int length, java.awt.geom.GeneralPath arrowPath)
          Draw a path with a plain arrow at its end.
abstract  void drawArrow(java.awt.geom.GeneralPath path, boolean fill, int tipAngle, int baseAngle, int length, java.awt.geom.GeneralPath sarrowPath, java.awt.geom.GeneralPath earrowPath)
          Draw a path with a plain arrow at both ends.
abstract  void drawArrow(java.awt.geom.GeneralPath path, int tipAngle, int baseAngle, int length, java.awt.geom.GeneralPath arrowPath)
          Draw a path with a stick arrow at its end.
abstract  void drawArrow(java.awt.geom.GeneralPath path, int tipAngle, int baseAngle, int length, java.awt.geom.GeneralPath sarrowPath, java.awt.geom.GeneralPath earrowPath)
          Draw a path with a stick arrow at both ends.
abstract  void drawLine(double x1, double y1, double x2, double y2)
          Draw a line.
 void drawLine(java.awt.geom.Point2D p1, java.awt.geom.Point2D p2)
          Draw a line.
abstract  void drawPath(java.awt.geom.GeneralPath path)
          Draw a path.
abstract  void drawPolygon(java.awt.geom.Point2D[] points)
          Draw a polygon.
 void drawPolygon(java.awt.Polygon polygon)
          Draw a polygon.
abstract  void drawRectangle(double x, double y, double width, double height)
          Draw a rectangle.
abstract  void drawRectangle(double x, double y, double width, double height, int angle)
          Draw a rotated rectangle.
 void drawRectangle(java.awt.Point point, java.awt.Dimension dim)
          Draw a rectangle.
 void drawRectangle(java.awt.Point point, java.awt.Dimension dim, int angle)
          Draw a rotated rectangle.
 void drawRectangle(java.awt.Rectangle rectangle)
          Draw a rectangle.
 void drawRectangle(java.awt.Rectangle rectangle, int angle)
          Draw a rotated rectangle.
abstract  void drawText(double x, double y, java.lang.String text, java.awt.Font font)
          Draw a text.
 void drawText(java.awt.geom.Point2D point, java.lang.String text, java.awt.Font font)
          Draw a text.
abstract  void endElement()
          End an element.
abstract  void fillArc(double x, double y, double width, double height, int startAngle, int arcAngle)
          Fill an elliptical arc, given by its bounding rectangle.
abstract  void fillArc(double x, double y, double width, double height, int startAngle, int arcAngle, float grayValue)
          Fill an elliptical arc, given by its bounding rectangle.
 void fillArc(java.awt.Point point, java.awt.Dimension dim, int startAngle, int arcAngle)
          Fill an elliptical arc, given by its bounding rectangle.
 void fillArc(java.awt.Point point, java.awt.Dimension dim, int startAngle, int arcAngle, float grayValue)
          Fill an elliptical arc, given by its bounding rectangle.
 void fillArc(java.awt.Rectangle rectangle, int startAngle, int arcAngle)
          Fill an elliptical arc, given by its bounding rectangle.
 void fillArc(java.awt.Rectangle rectangle, int startAngle, int arcAngle, float grayValue)
          Fill an elliptical arc, given by its bounding rectangle.
abstract  void fillPolygon(java.awt.geom.Point2D[] points)
          Fill a polygon.
abstract  void fillPolygon(java.awt.geom.Point2D[] points, float grayValue)
          Fill a polygon.
 void fillPolygon(java.awt.Polygon polygon)
          Fill a polygon.
 void fillPolygon(java.awt.Polygon polygon, float grayValue)
          Fill a polygon.
abstract  void fillRectangle(double x, double y, double width, double height)
          Fill a rectangle.
abstract  void fillRectangle(double x, double y, double width, double height, float grayValue)
          Fill a rectangle.
abstract  void fillRectangle(double x, double y, double width, double height, float grayValue, int angle)
          Fill a rotated rectangle.
abstract  void fillRectangle(double x, double y, double width, double height, int angle)
          Fill a rotated rectangle.
 void fillRectangle(java.awt.Point point, java.awt.Dimension dim)
          Fill a rectangle.
 void fillRectangle(java.awt.Point point, java.awt.Dimension dim, float grayValue)
          Fill a rectangle.
 void fillRectangle(java.awt.Point point, java.awt.Dimension dim, float grayValue, int angle)
          Fill a rotated rectangle.
 void fillRectangle(java.awt.Point point, java.awt.Dimension dim, int angle)
          Fill a rotated rectangle.
 void fillRectangle(java.awt.Rectangle rectangle)
          Fill a rectangle.
 void fillRectangle(java.awt.Rectangle rectangle, float grayValue)
          Fill a rectangle.
 void fillRectangle(java.awt.Rectangle rectangle, float grayValue, int angle)
          Fill a rotated rectangle.
 void fillRectangle(java.awt.Rectangle rectangle, int angle)
          Fill a rotated rectangle.
static GraphicalExporter getExporter(java.io.PrintWriter stream, int format, java.lang.String title, java.awt.Rectangle bounds, java.awt.Insets insets, int zoom, CoopnEnv env)
          Get an exporter for a particular format.
protected abstract  void header()
           
 void setColor(java.awt.Color color)
          Set the current color.
 void setDashed(float[] dash, float phase)
          Set the current dash style.
 void setPlain()
          Set the current dash style to plain.
abstract  void startElement(GraphicalVisualElement element)
          Start an element.
static java.lang.String[] supportedFormats(CoopnEnv env)
          Get the supported formats.
protected abstract  void trailer()
           
 void translate(int x, int y)
          Translate the current user space.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

EPS

public static final int EPS
Encaspulated postscript.

MIF

public static final int MIF
MIF tag.

POSTSCRIPT

public static final int POSTSCRIPT
Postscript.

RTF

public static final int RTF
RTF tag.

stream

protected java.io.PrintWriter stream

title

protected java.lang.String title

bounds

protected java.awt.Rectangle bounds

insets

protected java.awt.Insets insets

zoom

protected float zoom

env

protected CoopnEnv env

translationX

protected int translationX

translationY

protected int translationY

color

protected java.awt.Color color

dashed

protected boolean dashed

dash

protected float[] dash

phase

protected float phase
Constructor Detail

GraphicalExporter

protected GraphicalExporter(java.io.PrintWriter stream,
                            java.lang.String title,
                            java.awt.Rectangle bounds,
                            java.awt.Insets insets,
                            int zoom,
                            CoopnEnv env)
Method Detail

dispose

public void dispose()
Terminates an exportation, and dispose the exporter object. This routine does not dispose the stream, nor the bounds.

header

protected abstract void header()

trailer

protected abstract void trailer()

startElement

public abstract void startElement(GraphicalVisualElement element)
Start an element.
Parameters:
element - the element to start

endElement

public abstract void endElement()
End an element.

translate

public void translate(int x,
                      int y)
Translate the current user space.
Parameters:
x - x-displacement
y - y-displacement

setColor

public void setColor(java.awt.Color color)
Set the current color.
Parameters:
color - the new color

setPlain

public void setPlain()
Set the current dash style to plain.

setDashed

public void setDashed(float[] dash,
                      float phase)
Set the current dash style.
Parameters:
dash - The array representing the dash pattern
phase - the offset to start the dash pattern

drawText

public abstract void drawText(double x,
                              double y,
                              java.lang.String text,
                              java.awt.Font font)
Draw a text.
Parameters:
x - x-coordinate of starting point
y - y-coordinate of starting point
text - text
font - font

drawText

public void drawText(java.awt.geom.Point2D point,
                     java.lang.String text,
                     java.awt.Font font)
Draw a text.
Parameters:
point - starting point
text - text
font - font

drawLine

public abstract void drawLine(double x1,
                              double y1,
                              double x2,
                              double y2)
Draw a line.
Parameters:
x1 - x-coordinate of starting point
y1 - y-coordinate of starting point
x2 - x-coordinate of ending point
y2 - y-coordinate of ending point

drawLine

public void drawLine(java.awt.geom.Point2D p1,
                     java.awt.geom.Point2D p2)
Draw a line.
Parameters:
p1 - the starting point
p2 - the ending point

drawRectangle

public abstract void drawRectangle(double x,
                                   double y,
                                   double width,
                                   double height,
                                   int angle)
Draw a rotated rectangle.
Parameters:
x - x-coordinate of starting point
y - y-coordinate of starting point
width - width
height - height
angle - the rotation angle

fillRectangle

public abstract void fillRectangle(double x,
                                   double y,
                                   double width,
                                   double height,
                                   int angle)
Fill a rotated rectangle.
Parameters:
x - x-coordinate of starting point
y - y-coordinate of starting point
width - width
height - height
angle - the rotation angle

fillRectangle

public abstract void fillRectangle(double x,
                                   double y,
                                   double width,
                                   double height,
                                   float grayValue,
                                   int angle)
Fill a rotated rectangle. The shape is filled with a grey texture, the tint of which is given by a real number.
Parameters:
x - x-coordinate of starting point
y - y-coordinate of starting point
width - width
height - height
grayValue - the gray value. 0 means black while 1 means white
angle - the rotation angle

drawRectangle

public void drawRectangle(java.awt.Point point,
                          java.awt.Dimension dim,
                          int angle)
Draw a rotated rectangle.
Parameters:
point - starting point
dim - dimension
angle - the rotation angle

fillRectangle

public void fillRectangle(java.awt.Point point,
                          java.awt.Dimension dim,
                          int angle)
Fill a rotated rectangle.
Parameters:
point - starting point
dim - dimension
angle - the rotation angle

fillRectangle

public void fillRectangle(java.awt.Point point,
                          java.awt.Dimension dim,
                          float grayValue,
                          int angle)
Fill a rotated rectangle. The shape is filled with a grey texture, the tint of which is given by a real number.
Parameters:
point - starting point
dim - dimension
grayValue - the gray value. 0 means black while 1 means white
angle - the rotation angle

drawRectangle

public void drawRectangle(java.awt.Rectangle rectangle,
                          int angle)
Draw a rotated rectangle.
Parameters:
rectangle - the rectangle
angle - the rotation angle

fillRectangle

public void fillRectangle(java.awt.Rectangle rectangle,
                          int angle)
Fill a rotated rectangle.
Parameters:
rectangle - the rectangle
angle - the rotation angle

fillRectangle

public void fillRectangle(java.awt.Rectangle rectangle,
                          float grayValue,
                          int angle)
Fill a rotated rectangle. The shape is filled with a grey texture, the tint of which is given by a real number.
Parameters:
rectangle - the rectangle
grayValue - the gray value. 0 means black while 1 means white
angle - the rotation angle

drawRectangle

public abstract void drawRectangle(double x,
                                   double y,
                                   double width,
                                   double height)
Draw a rectangle.
Parameters:
x - x-coordinate of starting point
y - y-coordinate of starting point
width - width
height - height

fillRectangle

public abstract void fillRectangle(double x,
                                   double y,
                                   double width,
                                   double height)
Fill a rectangle.
Parameters:
x - x-coordinate of starting point
y - y-coordinate of starting point
width - width
height - height

fillRectangle

public abstract void fillRectangle(double x,
                                   double y,
                                   double width,
                                   double height,
                                   float grayValue)
Fill a rectangle. The shape is filled with a grey texture, the tint of which is given by a real number.
Parameters:
x - x-coordinate of starting point
y - y-coordinate of starting point
width - width
height - height
grayValue - the gray value. 0 means black while 1 means white

drawRectangle

public void drawRectangle(java.awt.Point point,
                          java.awt.Dimension dim)
Draw a rectangle.
Parameters:
point - starting point
dim - dimension

fillRectangle

public void fillRectangle(java.awt.Point point,
                          java.awt.Dimension dim)
Fill a rectangle.
Parameters:
point - starting point
dim - dimension

fillRectangle

public void fillRectangle(java.awt.Point point,
                          java.awt.Dimension dim,
                          float grayValue)
Fill a rectangle. The shape is filled with a grey texture, the tint of which is given by a real number.
Parameters:
point - starting point
dim - dimension
grayValue - the gray value. 0 means black while 1 means white

drawRectangle

public void drawRectangle(java.awt.Rectangle rectangle)
Draw a rectangle.
Parameters:
rectangle - the rectangle

fillRectangle

public void fillRectangle(java.awt.Rectangle rectangle)
Fill a rectangle.
Parameters:
rectangle - the rectangle

fillRectangle

public void fillRectangle(java.awt.Rectangle rectangle,
                          float grayValue)
Fill a rectangle. The shape is filled with a grey texture, the tint of which is given by a real number.
Parameters:
rectangle - the rectangle
grayValue - the gray value. 0 means black while 1 means white

drawArc

public abstract void drawArc(double x,
                             double y,
                             double width,
                             double height,
                             int startAngle,
                             int arcAngle)
Draw an elliptical arc, given by its bounding rectangle.
Parameters:
x - x-coordinate of starting point
y - y-coordinate of starting point
width - width
height - height
startAngle - the starting angle in degree, trigonometrical sense
arcAngle - the angular extend of the arc

fillArc

public abstract void fillArc(double x,
                             double y,
                             double width,
                             double height,
                             int startAngle,
                             int arcAngle)
Fill an elliptical arc, given by its bounding rectangle.
Parameters:
x - x-coordinate of starting point
y - y-coordinate of starting point
width - width
height - height
startAngle - the starting angle in degree, trigonometrical sense
arcAngle - the angular extend of the arc

fillArc

public abstract void fillArc(double x,
                             double y,
                             double width,
                             double height,
                             int startAngle,
                             int arcAngle,
                             float grayValue)
Fill an elliptical arc, given by its bounding rectangle. The shape is filled with a grey texture, the tint of which is given by a real number.
Parameters:
x - x-coordinate of starting point
y - y-coordinate of starting point
width - width
height - height
startAngle - the starting angle in degree, trigonometrical sense
arcAngle - the angular extend of the arc
grayValue - the gray value. 0 means black while 1 means white

drawArc

public void drawArc(java.awt.Point point,
                    java.awt.Dimension dim,
                    int startAngle,
                    int arcAngle)
Draw an elliptical arc, given by its bounding rectangle.
Parameters:
point - starting point
dim - dimension
startAngle - the starting angle in degree, trigonometrical sense
arcAngle - the angular extend of the arc

fillArc

public void fillArc(java.awt.Point point,
                    java.awt.Dimension dim,
                    int startAngle,
                    int arcAngle)
Fill an elliptical arc, given by its bounding rectangle.
Parameters:
point - starting point
dim - dimension
startAngle - the starting angle in degree, trigonometrical sense
arcAngle - the angular extend of the arc
grayValue - the gray value. 0 means black while 1 means white

fillArc

public void fillArc(java.awt.Point point,
                    java.awt.Dimension dim,
                    int startAngle,
                    int arcAngle,
                    float grayValue)
Fill an elliptical arc, given by its bounding rectangle. The shape is filled with a grey texture, the tint of which is given by a real number.
Parameters:
point - starting point
dim - dimension
startAngle - the starting angle in degree, trigonometrical sense
arcAngle - the angular extend of the arc
grayValue - the gray value. 0 means black while 1 means white

drawArc

public void drawArc(java.awt.Rectangle rectangle,
                    int startAngle,
                    int arcAngle)
Draw an elliptical arc, given by its bounding rectangle.
Parameters:
rectangle - the rectangle
startAngle - the starting angle in degree, trigonometrical sense
arcAngle - the angular extend of the arc

fillArc

public void fillArc(java.awt.Rectangle rectangle,
                    int startAngle,
                    int arcAngle)
Fill an elliptical arc, given by its bounding rectangle.
Parameters:
rectangle - the rectangle
startAngle - the starting angle in degree, trigonometrical sense
arcAngle - the angular extend of the arc

fillArc

public void fillArc(java.awt.Rectangle rectangle,
                    int startAngle,
                    int arcAngle,
                    float grayValue)
Fill an elliptical arc, given by its bounding rectangle. The shape is filled with a grey texture, the tint of which is given by a real number.
Parameters:
rectangle - the rectangle
startAngle - the starting angle in degree, trigonometrical sense
arcAngle - the angular extend of the arc
grayValue - the gray value. 0 means black while 1 means white

drawPolygon

public abstract void drawPolygon(java.awt.geom.Point2D[] points)
Draw a polygon.
Parameters:
points - the points of the polygon

fillPolygon

public abstract void fillPolygon(java.awt.geom.Point2D[] points)
Fill a polygon.
Parameters:
points - the points of the polygon

fillPolygon

public abstract void fillPolygon(java.awt.geom.Point2D[] points,
                                 float grayValue)
Fill a polygon. The shape is filled with a grey texture, the tint of which is given by a real number.
Parameters:
points - the points of the polygon
grayValue - the gray value. 0 means black while 1 means white

drawPolygon

public void drawPolygon(java.awt.Polygon polygon)
Draw a polygon.
Parameters:
polygon - the polygon

fillPolygon

public void fillPolygon(java.awt.Polygon polygon)
Fill a polygon.
Parameters:
polygon - the polygon

fillPolygon

public void fillPolygon(java.awt.Polygon polygon,
                        float grayValue)
Fill a polygon. The shape is filled with a grey texture, the tint of which is given by a real number.
Parameters:
polygon - the polygon
grayValue - the gray value. 0 means black while 1 means white

drawPath

public abstract void drawPath(java.awt.geom.GeneralPath path)
Draw a path.
Parameters:
path - the path to draw

drawArrow

public abstract void drawArrow(java.awt.geom.GeneralPath path,
                               boolean fill,
                               int tipAngle,
                               int baseAngle,
                               int length,
                               java.awt.geom.GeneralPath arrowPath)
Draw a path with a plain arrow at its end.
Parameters:
path - the path to draw
fill - true iff the arrow is filled
tipAngle - the tip angle
baseAngle - the base angle
length - the length of the arrow
arrowPath - an already constructed path equivalent to the parameters tipangle, baseAngle and length; exporters should use (and draw) this parameter only if the format does not support structural structural descriptions of arrows based on above parameters

drawArrow

public abstract void drawArrow(java.awt.geom.GeneralPath path,
                               boolean fill,
                               int tipAngle,
                               int baseAngle,
                               int length,
                               java.awt.geom.GeneralPath sarrowPath,
                               java.awt.geom.GeneralPath earrowPath)
Draw a path with a plain arrow at both ends.
Parameters:
path - the path to draw
fill - true iff the start arrow is filled
tipAngle - the tip angle of start arrow
baseAngle - the base angle of start arrow
length - the length of the start arrow
sarrowPath - an already constructed path equivalent to the parameters tipangle, baseAngle and length; exporters should use (and draw) this parameter only if the format does not support structural structural descriptions of arrows based on above parameters
earrowPath - an already constructed path equivalent to the parameters tipangle, baseAngle and length; exporters should use (and draw) this parameter only if the format does not support structural structural descriptions of arrows based on above parameters

drawArrow

public abstract void drawArrow(java.awt.geom.GeneralPath path,
                               int tipAngle,
                               int baseAngle,
                               int length,
                               java.awt.geom.GeneralPath arrowPath)
Draw a path with a stick arrow at its end.
Parameters:
path - the path to draw
fill - true iff the arrow is filled
tipAngle - the tip angle
baseAngle - the base angle
length - the length of the arrow
arrowPath - an already constructed path equivalent to the parameters tipangle, baseAngle and length; exporters should use (and draw) this parameter only if the format does not support structural structural descriptions of arrows based on above parameters

drawArrow

public abstract void drawArrow(java.awt.geom.GeneralPath path,
                               int tipAngle,
                               int baseAngle,
                               int length,
                               java.awt.geom.GeneralPath sarrowPath,
                               java.awt.geom.GeneralPath earrowPath)
Draw a path with a stick arrow at both ends.
Parameters:
path - the path to draw
fill - true iff the start arrow is filled
tipAngle - the tip angle of start arrow
baseAngle - the base angle of start arrow
length - the length of the start arrow
sarrowPath - an already constructed path equivalent to the parameters tipangle, baseAngle and length; exporters should use (and draw) this parameter only if the format does not support structural structural descriptions of arrows based on above parameters
earrowPath - an already constructed path equivalent to the parameters tipangle, baseAngle and length; exporters should use (and draw) this parameter only if the format does not support structural structural descriptions of arrows based on above parameters

supportedFormats

public static java.lang.String[] supportedFormats(CoopnEnv env)
Get the supported formats.
Returns:
an array of strings, the indexes of which give the supported format code, and the elements of which give the names of the supported formats.

getExporter

public static GraphicalExporter getExporter(java.io.PrintWriter stream,
                                            int format,
                                            java.lang.String title,
                                            java.awt.Rectangle bounds,
                                            java.awt.Insets insets,
                                            int zoom,
                                            CoopnEnv env)
Get an exporter for a particular format.
Parameters:
stream - the stream used to write the external formatting instructions
format - the format to use, one of the valid indexes of the array returned by
title - the title
bounds - the logical bounds of the picture
insets - the logical inset of the picture
zoom - the zoom factor to use, in percent
env - the environment
Returns:
The adequate graphical exporter, or null if the format not supported.
Throws:
java.lang.IllegalArgumentException - an argument is erroneous.