Package net.sf.jaxodraw.object
Class JaxoParticleObject
- java.lang.Object
-
- net.sf.jaxodraw.object.JaxoObject
-
- net.sf.jaxodraw.object.JaxoExtendedObject
-
- net.sf.jaxodraw.object.JaxoParticleObject
-
- All Implemented Interfaces:
java.awt.Shape
,java.beans.PropertyChangeListener
,java.io.Serializable
,java.lang.Cloneable
,java.util.EventListener
- Direct Known Subclasses:
Jaxo3PointObject
,JaxoLineObject
,JaxoLoopObject
public abstract class JaxoParticleObject extends JaxoExtendedObject
The mother of all particle objects (arcs, lines and loops).- Since:
- 2.0
- See Also:
- Serialized Form
-
-
Field Summary
Fields Modifier and Type Field Description static float
GHOST_DASH
Default dash for ghost objects.static float
GLUON_FREQ
Default frequency for gluon objects.static float
PHOTON_FREQ
Default frequency for photon objects.static float
SCALAR_DASH
Default dash for scalar objects.-
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 JaxoParticleObject()
Constructor.
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description abstract JaxoArrow.Coordinates
arrowCoordinates()
Returns the coordinates of the arrow of the current object.boolean
arrowPositionIs(float comp)
Compares the arrowPosition of this JaxoParticleObject to the given float, taking into account a 0.1% error margin.JaxoObject
copy()
Returns an exact copy of the given JaxoObject.void
copyFrom(JaxoParticleObject temp)
Sets all parameters from the given object to the current one.boolean
dashIs(float comp)
Compares the dash of this JaxoParticleObject to the given float, taking into account a 0.1% error margin.boolean
dlSepIs(float comp)
Compares the dlSeparation of this JaxoParticleObject to the given float, taking into account a 0.1% error margin.int
getAmp()
Returns the amp property of this particle object.JaxoArrow
getArrow()
Returns the arrow of this particle object.float
getArrowPosition()
Returns the arrowPosition property of this particle object.float
getDash()
Returns the dash property of this particle object.float
getDLSeparation()
Returns the double line separation of this object.int
getWiggles()
Returns the wiggles property of this particle object.boolean
isCopy(JaxoObject comp)
Determines if this JaxoObject is a copy of the specified one.boolean
isDoubleLine()
Returns the double line property.boolean
isFlip()
Returns the flip property of this particle object.boolean
isPaintArrow()
Determines whether the arrow property of this particle object is set or not.protected void
paintArrow(JaxoGraphics2D g2)
Paints an arrow on this object.void
setAmp(int newAmp)
Sets the amp property of this particle object.void
setArrow(JaxoArrow newArrow)
Sets the dash property of this particle object.void
setArrowPosition(float newArrowPosition)
Sets the arrowPosition property of this particle object.void
setDash(float newDash)
Sets the dash property of this particle object.void
setDLSeparation(float dlsep)
Sets the double line separation property.void
setDoubleLine(boolean dline)
Sets the double line property.void
setFlip(boolean newFlip)
Sets the flip property of this particle object.void
setPaintArrow(boolean arr)
Sets the arrow property of this particle object.void
setPreferences()
Applies default values to this JaxoObject.void
setState(JaxoObject o)
Restore state to the values of 'o'.void
setWiggles(int newWiggles)
Sets the wiggles property of this particle object.-
Methods inherited from class net.sf.jaxodraw.object.JaxoExtendedObject
canBeSelected, copyFrom, getGrabbedHandle, getHeight, getPointCount, getRadius, getRelh, getRelSize, getRelw, getSize, getStroke, getStrokeWidth, getWidth, getX, getX2, getY, getY2, latexWidth, moveBy, paintHandles, resetStroke, setLocation, setRadius, setRelativeHeight, setRelativeWidth, setRelWAndH, setStroke, setStrokeWidth, setX, setX2, setY, setY2, smallestDistanceTo, 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, rescaleObject, setAsMarked, setColor, setLocation, setParameter, setParameter, setParameter, setParameter, setParameter, setParameter, setParameter, setPointCount, setPoints, setTransient, setX, setXPosition, setY, setYPosition
-
-
-
-
Field Detail
-
PHOTON_FREQ
public static final float PHOTON_FREQ
Default frequency for photon objects.- See Also:
- Constant Field Values
-
GLUON_FREQ
public static final float GLUON_FREQ
Default frequency for gluon objects.- See Also:
- Constant Field Values
-
SCALAR_DASH
public static final float SCALAR_DASH
Default dash for scalar objects.- See Also:
- Constant Field Values
-
GHOST_DASH
public static final float GHOST_DASH
Default dash for ghost objects.- See Also:
- Constant Field Values
-
-
Method Detail
-
copy
public JaxoObject copy()
Returns an exact copy of the given JaxoObject. This implementation uses Object.clone(), so the only thing to do in subclasses is to recursively clone mutable object properties.- Overrides:
copy
in classJaxoObject
- Returns:
- The copy of the given JaxoObject.
-
getWiggles
public final int getWiggles()
Returns the wiggles property of this particle object.- Returns:
- The wiggles property of this particle object.
-
setWiggles
public final void setWiggles(int newWiggles)
Sets the wiggles property of this particle object.- Parameters:
newWiggles
- The wiggles property of this particle object.
-
getDash
public final float getDash()
Returns the dash property of this particle object.- Returns:
- The dash property of this particle object.
-
setDash
public final void setDash(float newDash)
Sets the dash property of this particle object.- Parameters:
newDash
- The dash property of this particle object.
-
getAmp
public final int getAmp()
Returns the amp property of this particle object.- Returns:
- The amp property of this particle object.
-
setAmp
public final void setAmp(int newAmp)
Sets the amp property of this particle object.- Parameters:
newAmp
- The amp property of this particle object.
-
isPaintArrow
public final boolean isPaintArrow()
Determines whether the arrow property of this particle object is set or not.- Returns:
- The arrow property of this particle object.
-
setPaintArrow
public final void setPaintArrow(boolean arr)
Sets the arrow property of this particle object.- Parameters:
arr
- The arrow property of this particle object.
-
isFlip
public final boolean isFlip()
Returns the flip property of this particle object.- Returns:
- The flip property of this particle object.
-
setFlip
public final void setFlip(boolean newFlip)
Sets the flip property of this particle object.- Parameters:
newFlip
- The flip property of this particle object.
-
getArrowPosition
public final float getArrowPosition()
Returns the arrowPosition property of this particle object.- Returns:
- The arrowPosition property of this particle object.
-
setArrowPosition
public final void setArrowPosition(float newArrowPosition)
Sets the arrowPosition property of this particle object. Throws IllegalArgumentException if the parameter is not between 0 and 1.- Parameters:
newArrowPosition
- The new arrowPosition property measured as a float number between 0 and 1.
-
setDoubleLine
public final void setDoubleLine(boolean dline)
Sets the double line property.- Parameters:
dline
- The double line boolean variable.
-
isDoubleLine
public final boolean isDoubleLine()
Returns the double line property.- Returns:
- The double line boolean variable of this object.
-
setDLSeparation
public final void setDLSeparation(float dlsep)
Sets the double line separation property.- Parameters:
dlsep
- The double line separation to be set.
-
getDLSeparation
public final float getDLSeparation()
Returns the double line separation of this object.- Returns:
- The double line separation.
-
getArrow
public final JaxoArrow getArrow()
Returns the arrow of this particle object.- Returns:
- The arrow of this particle object.
-
setArrow
public final void setArrow(JaxoArrow newArrow)
Sets the dash property of this particle object.- Parameters:
newArrow
- The arrow of this particle object.
-
isCopy
public boolean isCopy(JaxoObject comp)
Determines if this JaxoObject is a copy of the specified one.- Overrides:
isCopy
in classJaxoExtendedObject
- Parameters:
comp
- The JaxoObject to compare against.- Returns:
- True if the JaxoObjects are identical.
-
copyFrom
public void copyFrom(JaxoParticleObject temp)
Sets all parameters from the given object to the current one.- Parameters:
temp
- The object to copy from.
-
setState
public void setState(JaxoObject o)
Restore state to the values of 'o'. The object 'o' must be an object of the same "type" obtained byJaxoObject.copy()
.- Overrides:
setState
in classJaxoExtendedObject
- Parameters:
o
- the object to copy from.
-
setPreferences
public void setPreferences()
Applies default values to this JaxoObject. All fields except location points are initialized with values taken from thepreferences
.- Overrides:
setPreferences
in classJaxoExtendedObject
-
dashIs
public final boolean dashIs(float comp)
Compares the dash of this JaxoParticleObject to the given float, taking into account a 0.1% error margin.- Parameters:
comp
- The float to compare to.- Returns:
- True, if the dash matches within 0.1%.
-
dlSepIs
public final boolean dlSepIs(float comp)
Compares the dlSeparation of this JaxoParticleObject to the given float, taking into account a 0.1% error margin.- Parameters:
comp
- The float to compare to.- Returns:
- True, if the dlSeparation matches within 0.1%.
-
arrowPositionIs
public final boolean arrowPositionIs(float comp)
Compares the arrowPosition of this JaxoParticleObject to the given float, taking into account a 0.1% error margin.- Parameters:
comp
- The float to compare to.- Returns:
- True, if the arrowPosition matches within 0.1%.
-
paintArrow
protected void paintArrow(JaxoGraphics2D g2)
Paints an arrow on this object.- Parameters:
g2
- The graphics context.
-
arrowCoordinates
public abstract JaxoArrow.Coordinates arrowCoordinates()
Returns the coordinates of the arrow of the current object.- Returns:
- The coordinates of the arrow of the current object.
-
-