public abstract class JaObject extends Object implements Serializable
Modifier and Type | Field and Description |
---|---|
static int |
BB_MAX_X
The component of the boundingbox array that contains the
upper x value of the boundingbox.
|
static int |
BB_MAX_Y
The component of the boundingbox array that contains the
upper y value of the boundingbox.
|
static int |
BB_MIN_X
The component of the boundingbox array that contains the
lower x value of the boundingbox.
|
static int |
BB_MIN_Y
The component of the boundingbox array that contains the
lower y value of the boundingbox.
|
static int |
COPY
An integer that indicates the current edit mode COPY.
|
static DecimalFormat |
D_FORMAT
The decimal format used for numbers in LaTeX output.
|
static int |
INIT_SIZE
An integer that gives the initial size of an object.
|
static int |
LENGTH
An integer that gives the length of the handle sides.
|
static int |
MOVE
An integer that indicates the current edit mode MOVE.
|
static int |
RESIZE
An integer that indicates the current edit mode RESIZE.
|
static int |
SELECT_BODY
An integer that indicates that the user grabbed the
body of an object.
|
static int |
SELECT_LL
An integer that indicates that the user grabbed the
lower left handle of an object.
|
static int |
SELECT_LR
An integer that indicates that the user grabbed the
lower right handle of an object.
|
static int |
SELECT_NONE
An integer that indicates that the user did not grab any object.
|
static int |
SELECT_P1
An integer that specifies the first point of an arc object.
|
static int |
SELECT_P2
An integer that specifies the second point of an arc object.
|
static int |
SELECT_P3
An integer that specifies the third point of an arc object.
|
static int |
SELECT_UL
An integer that indicates that the user grabbed the
upper left handle of an object.
|
static int |
SELECT_UR
An integer that indicates that the user grabbed the
upper right handle of an object.
|
Constructor and Description |
---|
JaObject() |
Modifier and Type | Method and Description |
---|---|
abstract JaObject |
copy()
Returns an exact copy of the given JaObject.
|
abstract void |
drawHandles(org.freehep.graphics2d.VectorGraphics g2)
Draws the handles of this JaObject that allow
to move/resize/edit it.
|
void |
drawVisualAid(org.freehep.graphics2d.VectorGraphics g2)
Draws a visual aid for the user during dragging of certain JaxoObjects.
|
abstract boolean |
editPanel()
Brings up the edit panel that allows to change the parameters of
this object.
|
double[] |
getBoundingBox()
Returns the bounding box of this JaObject.
|
Color |
getColor()
Returns the color of this object.
|
GeneralPath |
getGeneralPath()
Returns the GeneralPath that draws this JaObject.
|
abstract int |
getGrabbedHandle(int clickX,
int clickY,
int editmode)
Determines which handle the user has selected to move/resize/edit
an object.
|
int |
getHeight()
Returns the height of this object.
|
int |
getRelh()
Returns the relative height of this object.
|
double |
getRelHndc()
Returns the relative height of this object in NDC.
|
double |
getRelHuser()
Returns the relative height of this object in USER.
|
Dimension |
getRelSize()
Returns the relative width and height of this object.
|
int |
getRelw()
Returns the relative width of this object.
|
double |
getRelWndc()
Returns the relative width of this object in NDC.
|
double |
getRelWuser()
Returns the relative width of this object in USER.
|
Dimension |
getSize()
Returns the width and height of this object.
|
int |
getWidth()
Returns the width of this object.
|
int |
getX()
Returns the x coordinate of this object.
|
double |
getXndc()
Returns the NDC x coordinate of this object.
|
double |
getXuser()
Returns the USER x coordinate of this object.
|
int |
getY()
Returns the y coordinate of this object.
|
double |
getYndc()
Returns the NDC y coordinate of this object.
|
double |
getYuser()
Returns the USER y coordinate of this object.
|
abstract boolean |
isCopy(JaObject testObject)
Determines if this JaObject is a copy of the specified one.
|
boolean |
isMarked()
Determines whether this JaObject is marked as an element
of a group or not.
|
boolean |
isUser()
Set to true if coordinates were set using USER coordinate system
attached to axes
|
abstract void |
jaxoDraw(org.freehep.graphics2d.VectorGraphics g2,
boolean drawToScreen)
The method that draws the JaObject.
|
abstract String |
latexCommand(float scale,
Dimension canvasDim)
The LaTeX command that is necessary to draw the given JaObject
using the axodraw.sty package.
|
abstract String |
latexWidth()
The LaTeX command that sets the width for this JaObject,
using the axodraw.sty package.
|
void |
moveBy(int deltaX,
int deltaY)
Reset the x, and y coordinates of the object when it is moved
by deltaX and deltaY.
|
abstract void |
rescaleObject(int orx,
int ory,
float scale)
Abstract class to rescale this JaObject by the scale factor scale,
keeping the point (orx, ory) fixed.
|
Point2D |
scalePoint(double orx,
double ory,
double scale,
double px,
double py)
Returns a point that is obtained from a point (px, py) after a scale
transformation scale, keeping the point (orx, ory) fixed.
|
void |
setAsMarked(boolean mark)
Sets this JaObject as element of a group.
|
void |
setBoundingBox(double[] bb)
Sets the bounding box of this JaObject.
|
void |
setColor(Color c)
Sets the color of this object.
|
void |
setLocation(double xc,
double yc,
String what)
Set location of the object in the NDC or USER coordinates.
|
void |
setLocation(int newX,
int newY)
Sets the x and y coordinate of this object.
|
void |
setRelh(int newRelh)
Sets the relative height of this object.
|
void |
setRelw(int newRelw)
Sets the relative width of this object.
|
void |
setRelWAndH(int w,
int h)
Sets the relative width and height of this object.
|
void |
setRelWH(double w,
double h,
String what)
Set relative size in the NDC or USER coordinates
|
void |
setSize(int w,
int h,
int rw,
int rh)
Reset the size (width, height, relative width and height)
of this object.
|
void |
setX(int newX)
Sets the x coordinate of this object.
|
void |
setY(int newY)
Sets the y coordinate of this object.
|
void |
updateCoor() |
void |
updateNDC() |
public static final int SELECT_NONE
public static final int SELECT_BODY
public static final int SELECT_UL
public static final int SELECT_UR
public static final int SELECT_LR
public static final int SELECT_LL
public static final int MOVE
public static final int RESIZE
public static final int COPY
public static final int LENGTH
public static final int INIT_SIZE
public static final int SELECT_P1
public static final int SELECT_P2
public static final int SELECT_P3
public static final int BB_MIN_X
public static final int BB_MIN_Y
public static final int BB_MAX_X
public static final int BB_MAX_Y
public static final DecimalFormat D_FORMAT
public final GeneralPath getGeneralPath()
public void updateCoor()
public void updateNDC()
public double[] getBoundingBox()
public final void setBoundingBox(double[] bb)
bb
- The bounding box to be set for this JaObject.public final void setAsMarked(boolean mark)
mark
- A boolean variable indicating whether this
JaObject should be set as an element of a group or not.public final boolean isMarked()
public boolean isUser()
public final int getX()
public final double getXndc()
public final double getXuser()
public final void setX(int newX)
newX
- The x coordinate of this object.public final int getY()
public final double getYndc()
public final double getYuser()
public final void setY(int newY)
newY
- The y coordinate of this object.public void setLocation(double xc, double yc, String what)
xc
- X locationyc
- Y locationwhat
- if "NDC", coordinate in NDC (from 0 to 1), if "USER" coordinates are
in the user system given by the axes.public void setRelWH(double w, double h, String what)
w
- width of the objecth
- height of the objectwhat
- if "NDC", coordinate in NDC (from 0 to 1), if "USER" coordinates are
in the user system given by the axes.public final int getWidth()
public final int getHeight()
public final int getRelw()
public final void setRelw(int newRelw)
newRelw
- The relative width of this object.public final int getRelh()
public final double getRelHndc()
public final double getRelHuser()
public final double getRelWndc()
public final double getRelWuser()
public final void setRelh(int newRelh)
newRelh
- The relative height of this object.public final Color getColor()
public final void setColor(Color c)
c
- The color of this object.public final void setRelWAndH(int w, int h)
w
- The relative width of this object.h
- The relative height of this object.public final void setLocation(int newX, int newY)
newX
- The x coordinate of this object.newY
- The y coordinate of this object.public void moveBy(int deltaX, int deltaY)
deltaX
- The x displacement.deltaY
- The y displacement.public final void setSize(int w, int h, int rw, int rh)
w
- The width of this object.h
- The heightof this object.rw
- The relative width of this object.rh
- The relative height of this object.public final Dimension getSize()
public final Dimension getRelSize()
public void drawVisualAid(org.freehep.graphics2d.VectorGraphics g2)
g2
- The graphics context to draw the visual aid.public Point2D scalePoint(double orx, double ory, double scale, double px, double py)
orx
- The x-coordinate of the fixed point.ory
- The y-coordinate of the fixed point.scale
- The scale factor.px
- The x-coordinate of the point to be transformed.py
- The y-coordinate of the point to be transformed.public abstract void jaxoDraw(org.freehep.graphics2d.VectorGraphics g2, boolean drawToScreen)
g2
- The graphics context where the object has to be drawn.drawToScreen
- A boolean variable that indicates whether
the drawing is done on the screen or somewhere else. This is used
for exporting/printing, where the object handles should not be painted,
even if they are visible on the screen.public abstract void drawHandles(org.freehep.graphics2d.VectorGraphics g2)
g2
- The corresponding graphics context.public abstract int getGrabbedHandle(int clickX, int clickY, int editmode)
clickX
- The x coordinate where the mouse click has ocurred.clickY
- The y coordinate where the mouse click has ocurred.editmode
- The current edit mode.public abstract JaObject copy()
public abstract boolean isCopy(JaObject testObject)
testObject
- The JaObject to compare against.public abstract String latexCommand(float scale, Dimension canvasDim)
scale
- A scale factor to translate Java coordinates to
LaTeX coordinates.canvasDim
- The current dimension of the canvas.public abstract String latexWidth()
public abstract void rescaleObject(int orx, int ory, float scale)
orx
- The x-coordinate of the fixed point.ory
- The y-coordinate of the fixed point.scale
- The scale parameter.public abstract boolean editPanel()
jHepWork 3.8 ©