Package net.sf.jaxodraw.object
Class Jaxo3PointObject
- java.lang.Object
-
- net.sf.jaxodraw.object.JaxoObject
-
- net.sf.jaxodraw.object.JaxoExtendedObject
-
- net.sf.jaxodraw.object.JaxoParticleObject
-
- net.sf.jaxodraw.object.Jaxo3PointObject
-
- All Implemented Interfaces:
java.awt.Shape
,java.beans.PropertyChangeListener
,java.io.Serializable
,java.lang.Cloneable
,java.util.EventListener
- Direct Known Subclasses:
JaxoArcObject
,JaxoBezierObject
,JaxoVertexT5
public abstract class Jaxo3PointObject extends JaxoParticleObject
- See Also:
- Serialized Form
-
-
Field Summary
Fields Modifier and Type Field Description static int
SELECT_P3
Third point (index 2).-
Fields inherited from class net.sf.jaxodraw.object.JaxoParticleObject
GHOST_DASH, GLUON_FREQ, PHOTON_FREQ, SCALAR_DASH
-
Fields inherited from class net.sf.jaxodraw.object.JaxoExtendedObject
SELECT_DX, SELECT_DY, SELECT_P2
-
Fields inherited from class net.sf.jaxodraw.object.JaxoObject
D_FORMAT, GRAY_SCALE_FORMAT, SELECT_NONE, SELECT_P1
-
-
Constructor Summary
Constructors Constructor Description Jaxo3PointObject()
-
Method Summary
All Methods Instance Methods Concrete Methods Deprecated Methods Modifier and Type Method Description boolean
canBeSelected(int handle, int mode)
Determines if the object can be selected (moved, edited, etc) from the given point in a given edit mode.void
copyFrom(Jaxo3PointObject temp)
Sets all parameters from the given objet to the current one.int
getGrabbedHandle(int clickX, int clickY, JaxoHandle h)
Determines which handle the user has selected to move/resize/edit an object.int
getPointCount()
Returns the number of points it takes to draw this object.int
getX(int index)
X coordinate of Point 0 <= index < getPointCount().int
getX3()
Returns the x coordinate of the first click point of this arc.int
getY(int index)
Y coordinate of Point 0 <= index < getPointCount().int
getY3()
Returns the y coordinate of the first click point of this arc.boolean
isCopy(JaxoObject comp)
Determines if this JaxoObject is a copy of the specified one.protected boolean
isOneLine()
Determines if the three points lie exactly on one line.void
moveBy(int deltaX, int deltaY)
Reset the coordinates of the object when it is moved by deltaX and deltaY.void
paintHandles(JaxoGraphics2D g2, JaxoHandle h, int editMode)
Paints the handles of this JaxoObject that allow to move/resize/edit it.void
rescaleObject(int orx, int ory, float scale)
Rescale this JaxoObject by the scale factor scale, keeping the point (orx, ory) fixed.void
set3Pts(int x1, int y1, int x2, int y2, int p3, int q3)
Deprecated.unused.void
setLocation(int x1, int y1, int x2, int y2, int p3, int q3)
Sets the points of this 3 point object.void
setX(int index, int value)
Set X coordinate of Point 0 <= index < getPointCount() to 'value'.void
setX3(int newx3)
Sets the x coordinate of the first click point of this arc.void
setY(int index, int value)
Set Y coordinate of Point 0 <= index < getPointCount() to 'value'.void
setY3(int newy3)
Sets the y coordinate of the first click point of this arc.float
smallestDistanceTo(int px, int py)
Determines the smallest distance of any of the handles of this JaxoObject from the given point.-
Methods inherited from class net.sf.jaxodraw.object.JaxoParticleObject
arrowCoordinates, arrowPositionIs, copy, copyFrom, dashIs, dlSepIs, getAmp, getArrow, getArrowPosition, getDash, getDLSeparation, getWiggles, isDoubleLine, isFlip, isPaintArrow, paintArrow, setAmp, setArrow, setArrowPosition, setDash, setDLSeparation, setDoubleLine, setFlip, setPaintArrow, setPreferences, setState, setWiggles
-
Methods inherited from class net.sf.jaxodraw.object.JaxoExtendedObject
copyFrom, getHeight, getRadius, getRelh, getRelSize, getRelw, getSize, getStroke, getStrokeWidth, getWidth, getX2, getY2, latexWidth, resetStroke, setLocation, setRadius, setRelativeHeight, setRelativeWidth, setRelWAndH, setStroke, setStrokeWidth, setX2, setY2, strokeIs
-
Methods inherited from class net.sf.jaxodraw.object.JaxoObject
addPropertyChangeListener, contains, contains, contains, contains, copyFrom, firePropertyChange, getBounds2D, getBoundsWithHandles, getColor, getGeneralPath, getLaTexLocation, getName, getPathIterator, getPathIterator, getPoints, getX, getY, intersects, intersects, isAround, isMarked, latexCommand, paint, paintVisualAid, prepareEditPanel, propertyChange, removePropertyChangeListener, setAsMarked, setColor, setLocation, setParameter, setParameter, setParameter, setParameter, setParameter, setParameter, setParameter, setPointCount, setPoints, setTransient, setX, setXPosition, setY, setYPosition
-
-
-
-
Field Detail
-
SELECT_P3
public static final int SELECT_P3
Third point (index 2).- See Also:
- Constant Field Values
-
-
Method Detail
-
getPointCount
public int getPointCount()
Returns the number of points it takes to draw this object.- Overrides:
getPointCount
in classJaxoExtendedObject
- Returns:
- 3.
-
getX
public int getX(int index)
X coordinate of Point 0 <= index < getPointCount().- Overrides:
getX
in classJaxoExtendedObject
- Parameters:
index
- The index of the point to get.- Returns:
- The x coordinate of the point at the given index.
-
getY
public int getY(int index)
Y coordinate of Point 0 <= index < getPointCount().- Overrides:
getY
in classJaxoExtendedObject
- Parameters:
index
- The index of the point to get.- Returns:
- The y coordinate of the point at the given index.
-
setX
public void setX(int index, int value)
Set X coordinate of Point 0 <= index < getPointCount() to 'value'. Throws IllegalArgumentException if the index is not valid for the given object.- Overrides:
setX
in classJaxoExtendedObject
- Parameters:
index
- The index of the point to set.value
- The value to set.
-
setY
public void setY(int index, int value)
Set Y coordinate of Point 0 <= index < getPointCount() to 'value'. Throws IllegalArgumentException if the index is not valid for the given object.- Overrides:
setY
in classJaxoExtendedObject
- Parameters:
index
- The index of the point to set.value
- The value to set.
-
setX3
public final void setX3(int newx3)
Sets the x coordinate of the first click point of this arc.- Parameters:
newx3
- The x coordinate of the first click point of this arc.
-
getX3
public final int getX3()
Returns the x coordinate of the first click point of this arc.- Returns:
- The x coordinate of the first click point of this arc.
-
setY3
public final void setY3(int newy3)
Sets the y coordinate of the first click point of this arc.- Parameters:
newy3
- The y coordinate of the first click point of this arc.
-
getY3
public final int getY3()
Returns the y coordinate of the first click point of this arc.- Returns:
- The y coordinate of the first click point of this arc.
-
set3Pts
public final void set3Pts(int x1, int y1, int x2, int y2, int p3, int q3)
Deprecated.unused. UsesetLocation(int,int,int,int,int,int)
instead.Sets the points of this 3 point object.- Parameters:
x1
- The x coordinate of the first point.y1
- The y coordinate of the first point.x2
- The x coordinate of the second point.y2
- The y coordinate of the second point.p3
- The x coordinate of the third point.q3
- The y coordinate of the third point.
-
setLocation
public final void setLocation(int x1, int y1, int x2, int y2, int p3, int q3)
Sets the points of this 3 point object.- Parameters:
x1
- The x coordinate of the first point.y1
- The y coordinate of the first point.x2
- The x coordinate of the second point.y2
- The y coordinate of the second point.p3
- The x coordinate of the third point.q3
- The y coordinate of the third point.
-
copyFrom
public void copyFrom(Jaxo3PointObject temp)
Sets all parameters from the given objet to the current one.- Parameters:
temp
- The object to copy from.
-
isCopy
public boolean isCopy(JaxoObject comp)
Determines if this JaxoObject is a copy of the specified one.- Overrides:
isCopy
in classJaxoParticleObject
- Parameters:
comp
- The JaxoObject to compare against.- Returns:
- True if the JaxoObjects are identical.
-
paintHandles
public void paintHandles(JaxoGraphics2D g2, JaxoHandle h, int editMode)
Paints the handles of this JaxoObject that allow to move/resize/edit it.- Overrides:
paintHandles
in classJaxoExtendedObject
- Parameters:
g2
- The corresponding graphics context.h
- A handle object to be used for painting.editMode
- The edit mode that the handles are being painted in.
-
smallestDistanceTo
public float smallestDistanceTo(int px, int py)
Determines the smallest distance of any of the handles of this JaxoObject from the given point.- Overrides:
smallestDistanceTo
in classJaxoExtendedObject
- Parameters:
px
- The x coordinate of the test point.py
- The y coordinate of the test point.- Returns:
- The smallest distance.
-
canBeSelected
public boolean canBeSelected(int handle, int mode)
Determines if the object can be selected (moved, edited, etc) from the given point in a given edit mode.- Overrides:
canBeSelected
in classJaxoExtendedObject
- Parameters:
handle
- One of the static variables SELECT_* defined for this JaxoObject.mode
- The current edit mode.- Returns:
- True if the object may be selected from the given point, false otherwise.
-
getGrabbedHandle
public int getGrabbedHandle(int clickX, int clickY, JaxoHandle h)
Determines which handle the user has selected to move/resize/edit an object.- Overrides:
getGrabbedHandle
in classJaxoExtendedObject
- Parameters:
clickX
- The x coordinate where the mouse click has ocurred.clickY
- The y coordinate where the mouse click has ocurred.h
- A handle object.- Returns:
- One of the static variables SELECT_* defined for this JaxoObject that specifies the handle which the user has clicked.
-
moveBy
public void moveBy(int deltaX, int deltaY)
Reset the coordinates of the object when it is moved by deltaX and deltaY.- Overrides:
moveBy
in classJaxoExtendedObject
- Parameters:
deltaX
- The x displacement.deltaY
- The y displacement.
-
rescaleObject
public void rescaleObject(int orx, int ory, float scale)
Rescale this JaxoObject by the scale factor scale, keeping the point (orx, ory) fixed.- Specified by:
rescaleObject
in classJaxoObject
- Parameters:
orx
- The x-coordinate of the fixed point.ory
- The y-coordinate of the fixed point.scale
- The scale parameter.
-
isOneLine
protected boolean isOneLine()
Determines if the three points lie exactly on one line. Note that the result of this method is independent of the point order.- Returns:
- true if the three points are co-linear.
-
-