cox.jmatt.java.MathTools.markup.latex
Class LaPicture

java.lang.Object
  extended by cox.jmatt.java.MathTools.markup.latex.LaBaseTag
      extended by cox.jmatt.java.MathTools.markup.latex.LaPicture

public class LaPicture
extends LaBaseTag

This class provides the '/picture' environment complete with '/setlength{/unitlength}{}' directive. It provides both single ('/put') and multiple ('/multiput') versions for all drawing commands that allow them. The Bezier drawing command ('/qbezier') has only the standard version. No value-checking is done for the commands that restrict the (integer) values of the direction vectors.


Field Summary
 
Fields inherited from class cox.jmatt.java.MathTools.markup.latex.LaBaseTag
BS, DBS, DBSN, myAuthor, myDate, myEndTag, myEnvironment, myEnvParams, myOptions, myPicHasOrigin, myPicX, myPicXOrigin, myPicY, myPicYOrigin, mySectionLabel, myTagName, myTitle
 
Constructor Summary
LaPicture(int pX, int pY)
          Standard constructor.
LaPicture(int pX, int pY, int pX0, int pY0)
          Constructor to specify width, height and relative origin values.
 
Method Summary
 LaPicture circle(double pX, double pY, double pDiameter)
          This command draws an unfilled circle.
 LaPicture circle(double pX, double pY, double pDiameter, double pDX, double pDY, int pNum)
          The '/multiput' circle command.
 LaPicture closeSaveBox(boolean pForce)
          Close any open savebox.
 LaPicture copyOf()
          Copy the current picture information.
 LaPicture copyOfSET()
          Copy the current picture information with no end tag.
 LaPicture disc(double pX, double pY, double pDiameter)
          This command draws a filled circle.
 LaPicture disc(double pX, double pY, double pDiameter, double pDX, double pDY, int pNum)
          The '/multiput' disc command.
 LaPicture line(double pX, double pY, int pDirX, int pDirY, double pLen)
          Draw a single line.
 LaPicture line(double pX, double pY, int pDirX, int pDirY, double pLen, double pDX, double pDY, int pNum)
          Draw a '/multiput' line.
 LaPicture openSaveBox(java.lang.String pName, double pWidth, double pHeight, java.lang.String pPos)
          Create and open a savebox.
 LaPicture oval(double pX, double pY, double pWidth, double pHeight, java.lang.String pPos)
          Place a single oval in the drawing.
 LaPicture oval(double pX, double pY, double pWidth, double pHeight, java.lang.String pPos, double pDX, double pDY, int pNum)
          Multi-put oval.
 LaPicture put(double pX, double pY, double pDX, double pDY, double pNum, java.lang.String pObject)
          This method implements the '/multiput' directive.
 LaPicture put(double pX, double pY, java.lang.String pObject)
          This is the basic '/put' command used to put things into the picture.
 LaPicture qBezier(double x1, double y1, double cX, double cY, double x2, double y2)
          Put a quadratic Bezier curve into the picture.
 void reset()
          Overridden to reset the unit length ONLY to its default value.
 LaPicture setLineThickness(java.lang.String pThickness)
          Set the line thickness.
 LaPicture setUnitLength(java.lang.String pLength)
          Set the unit length.
 LaPicture thick()
          Issue a '/thicklines' command.
 LaPicture thin()
          Issue a '/thinlines' command.
 java.lang.String toString()
          Overridden to set unit length prior to output.
 java.lang.String toStringSET()
          Overridden to set unit length first.
 LaPicture useBox(double pX, double pY, java.lang.String pBoxName)
          Use a (presumably) previously-defined savebox.
 LaPicture vector(double pX, double pY, int pDirX, int pDirY, double pLen)
          Draw a single vector (arrow).
 LaPicture vector(double pX, double pY, int pDirX, int pDirY, double pLen, double pDX, double pDY, int pNum)
          Draw a '/multiput' arrow.
 
Methods inherited from class cox.jmatt.java.MathTools.markup.latex.LaBaseTag
_addContent, _addRawContent, _getContent, _setEndTagEnabled, _setETEn, getEndTag, hasEndTag, isEndTagEnabled, setLabel
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

LaPicture

public LaPicture(int pX,
                 int pY)
Standard constructor. The height and width of the picture box are required.


LaPicture

public LaPicture(int pX,
                 int pY,
                 int pX0,
                 int pY0)
Constructor to specify width, height and relative origin values.

Method Detail

reset

public void reset()
Overridden to reset the unit length ONLY to its default value. Size and origin values are not affected. This method does close a savebox, if one is open.

Overrides:
reset in class LaBaseTag

setUnitLength

public LaPicture setUnitLength(java.lang.String pLength)
Set the unit length. A null or blank resets it to the default value: 1 point ('1pt').


put

public LaPicture put(double pX,
                     double pY,
                     java.lang.String pObject)
This is the basic '/put' command used to put things into the picture. It is used for all single items except Bezier curves. If the object argument is null or blank nothing happens. This is also the method to use to place text or formulas on the picture.

Parameters:
pX - The x-coordinate of the item's location.
pY - The y-coordinate of the location.
pObject - The object to be placed in the picture.

put

public LaPicture put(double pX,
                     double pY,
                     double pDX,
                     double pDY,
                     double pNum,
                     java.lang.String pObject)
This method implements the '/multiput' directive. A null or blank object is silently ignored.

Parameters:
pX - The x-coordinate of the item's location.
pY - The y-coordinate of the location.
pDX - The x-value of the translation vector.
pDY - The y-value of the translation vector.
pNum - The number of copies to put.
pObject - The object to be placed in the picture.

thick

public LaPicture thick()
Issue a '/thicklines' command.


thin

public LaPicture thin()
Issue a '/thinlines' command.


setLineThickness

public LaPicture setLineThickness(java.lang.String pThickness)
Set the line thickness. A null or blank value sets the value '1pt'.


line

public LaPicture line(double pX,
                      double pY,
                      int pDirX,
                      int pDirY,
                      double pLen)
Draw a single line.

Parameters:
pX - The x-coordinate of the line's origin.
pY - The y-coordiante of the origin.
pDirX - The x-value of the direction vector.
pDirY - The y-value of the direction vector.
pLen - The length of the line.

line

public LaPicture line(double pX,
                      double pY,
                      int pDirX,
                      int pDirY,
                      double pLen,
                      double pDX,
                      double pDY,
                      int pNum)
Draw a '/multiput' line.

Parameters:
pX - The x-coordinate of the line's origin.
pY - The y-coordiante of the origin.
pDirX - The x-value of the direction vector.
pDirY - The y-value of the direction vector.
pLen - The length of the line.
pDX - The '/multiput' translation vector x-value.
pDY - The '/multipyt' translation vector y-value.
pNum - The number of copies to make.

vector

public LaPicture vector(double pX,
                        double pY,
                        int pDirX,
                        int pDirY,
                        double pLen)
Draw a single vector (arrow).

Parameters:
pX - The x-coordinate of the line's origin.
pY - The y-coordiante of the origin.
pDirX - The x-value of the direction vector.
pDirY - The y-value of the direction vector.
pLen - The length of the line.

vector

public LaPicture vector(double pX,
                        double pY,
                        int pDirX,
                        int pDirY,
                        double pLen,
                        double pDX,
                        double pDY,
                        int pNum)
Draw a '/multiput' arrow.

Parameters:
pX - The x-coordinate of the line's origin.
pY - The y-coordiante of the origin.
pDirX - The x-value of the direction vector.
pDirY - The y-value of the direction vector.
pLen - The length of the line.
pDX - The '/multiput' translation vector x-value.
pDY - The '/multipyt' translation vector y-value.
pNum - The number of copies to make.

circle

public LaPicture circle(double pX,
                        double pY,
                        double pDiameter)
This command draws an unfilled circle. NOTE: The argument given is diameter and not radius!

Parameters:
pX - The x-coordinate of the center of the circle.
pY - The y-coordinate of the center.
pDiameter - The diameter of the circle.

circle

public LaPicture circle(double pX,
                        double pY,
                        double pDiameter,
                        double pDX,
                        double pDY,
                        int pNum)
The '/multiput' circle command.


disc

public LaPicture disc(double pX,
                      double pY,
                      double pDiameter)
This command draws a filled circle. NOTE: The argument given is diameter and not radius!

Parameters:
pX - The x-coordinate of the center of the circle.
pY - The y-coordinate of the center.
pDiameter - The diameter of the circle.

disc

public LaPicture disc(double pX,
                      double pY,
                      double pDiameter,
                      double pDX,
                      double pDY,
                      int pNum)
The '/multiput' disc command.


oval

public LaPicture oval(double pX,
                      double pY,
                      double pWidth,
                      double pHeight,
                      java.lang.String pPos)
Place a single oval in the drawing. The parameters are standard save for the last. The position argument, omitted if null or blank, must consist of characters from: 't', 'b', 'l' and 'r'. These commands draw, respectively, the top, bottom, left or right portion of the oval.

Parameters:
pX - The x-cordinate of the oval's center.
pY - The y-coordinate of the center.
pWidth - The width of the oval.
pHeight - The height of the oval.
pPos - The 'position' argument of the oval.

oval

public LaPicture oval(double pX,
                      double pY,
                      double pWidth,
                      double pHeight,
                      java.lang.String pPos,
                      double pDX,
                      double pDY,
                      int pNum)
Multi-put oval.


qBezier

public LaPicture qBezier(double x1,
                         double y1,
                         double cX,
                         double cY,
                         double x2,
                         double y2)
Put a quadratic Bezier curve into the picture. It is given as two endpoints and a single control point: (x1, y1), (x2, y2) and (cX, cY) respectively. The arguments to the method are in the same order as those in the '/qbezier' command.


openSaveBox

public LaPicture openSaveBox(java.lang.String pName,
                             double pWidth,
                             double pHeight,
                             java.lang.String pPos)

Create and open a savebox. All subsequent drawing commands fall within the savebox until it is closed or another is opened. If the name assigned to the savebox is null or blank no box is opened. The backslash IS provided automatically so the name does not need it.

CRITICAL NOTES: The state of an open savebox is NOT preserved during a copy operation. If a LaPicture is copied with a savebox opened it must be forcibly closed manually. Also, saveboxes cannot be nested!


closeSaveBox

public LaPicture closeSaveBox(boolean pForce)
Close any open savebox. If there is not an open box (or a copy operation has occurred!) this method returns silently. If there IS an open savebox it is properly closed. If the 'force' parameter is true a closing brace is emitted.


useBox

public LaPicture useBox(double pX,
                        double pY,
                        java.lang.String pBoxName)
Use a (presumably) previously-defined savebox. If the name supplied is null or blank nothing happens.

Parameters:
pX - The x-coordinate of the used box.
pY - The y-coordinate of the used box.
pBoxName - The name of the savebox to use. The backslash before the name IS provided automatically.

copyOf

public LaPicture copyOf()
Copy the current picture information.

Specified by:
copyOf in class LaBaseTag

copyOfSET

public LaPicture copyOfSET()
Copy the current picture information with no end tag.

Specified by:
copyOfSET in class LaBaseTag

toString

public java.lang.String toString()
Overridden to set unit length prior to output.

Overrides:
toString in class LaBaseTag

toStringSET

public java.lang.String toStringSET()
Overridden to set unit length first.

Overrides:
toStringSET in class LaBaseTag