Package net.sf.jaxodraw.object.loop
Class JaxoLoopObject
- java.lang.Object
-
- net.sf.jaxodraw.object.JaxoObject
-
- net.sf.jaxodraw.object.JaxoExtendedObject
-
- net.sf.jaxodraw.object.JaxoParticleObject
-
- net.sf.jaxodraw.object.loop.JaxoLoopObject
-
- All Implemented Interfaces:
java.awt.Shape,java.beans.PropertyChangeListener,java.io.Serializable,java.lang.Cloneable,java.util.EventListener
- Direct Known Subclasses:
JaxoDashLoop,JaxoFLoop,JaxoGlLoop,JaxoPLoop
public abstract class JaxoLoopObject extends JaxoParticleObject
A general loop object.- Since:
- 2.0
- See Also:
- Serialized Form
-
-
Field Summary
-
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 JaxoLoopObject()
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description JaxoArrow.CoordinatesarrowCoordinates()Returns the coordinates of the arrow of the current object.JaxoObjectcopy(JaxoLoopObject temp)Returns an exact copy of this JaxoLoop.protected abstract java.lang.StringgetAxo4JOptions(float scale)Return the option part of the LaTeX command for this line.java.awt.RectanglegetBounds()Returns the bounding box of this object.java.awt.geom.Point2D.Float[]getEquidistantPoints(int n)Dividing the loop into n equidistant segments of length d, so n * d = 2 * r * PI is the circumference of the loop, this routine returns the n + 1 loop points that are i * d away from P1, where 0 <= i <= n.protected java.awt.geom.Point2DgetLaTexAngles()Returns an angle which is used by the latexCommand method.protected java.awt.geom.Point2DgetLaTexCenter(float scaleFactor, int canvasHeight)Returns a center point which is used by the latexCommand method.protected floatgetLaTexRadius(float scaleFactor)Returns a radius which is used by the latexCommand method.protected abstract java.awt.geom.GeneralPathgetObjectPath()Get the GeneralPath that paints this loop.booleanisCopy(JaxoObject comp)Determines if this JaxoObject is a copy of the specified one.java.lang.StringlatexCommand(float scale, java.awt.Dimension canvasDim)The LaTeX command that is necessary to draw the given JaxoObject using the axodraw.sty package.voidpaint(JaxoGraphics2D g2)The method that paints the JaxoObject.voidpaintVisualAid(JaxoGraphics2D g2)Paints a visual aid for the user during dragging (moving or resizing) of this JaxoObject.voidrescaleObject(int orx, int ory, float scale)Rescale this JaxoObject by the scale factor scale, keeping the point (orx, ory) fixed.-
Methods inherited from class net.sf.jaxodraw.object.JaxoParticleObject
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
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, prepareEditPanel, propertyChange, removePropertyChangeListener, setAsMarked, setColor, setLocation, setParameter, setParameter, setParameter, setParameter, setParameter, setParameter, setParameter, setPointCount, setPoints, setTransient, setX, setXPosition, setY, setYPosition
-
-
-
-
Method Detail
-
copy
public final JaxoObject copy(JaxoLoopObject temp)
Returns an exact copy of this JaxoLoop.- Parameters:
temp- An instance of the loop to copy to (since this is an abstract class, we have to provide an instance of a sub-class).- Returns:
- A copy of this JaxoLoop.
-
isCopy
public boolean isCopy(JaxoObject comp)
Determines if this JaxoObject is a copy of the specified one.- Overrides:
isCopyin classJaxoParticleObject- Parameters:
comp- The JaxoObject to compare against.- Returns:
- True if the JaxoObjects are identical.
-
paint
public void paint(JaxoGraphics2D g2)
The method that paints the JaxoObject.- Specified by:
paintin classJaxoObject- Parameters:
g2- The graphics context where the object has to be painted.
-
getBounds
public java.awt.Rectangle getBounds()
Returns the bounding box of this object.- Returns:
- the bounding box of this object.
-
latexCommand
public java.lang.String latexCommand(float scale, java.awt.Dimension canvasDim)The LaTeX command that is necessary to draw the given JaxoObject using the axodraw.sty package.- Specified by:
latexCommandin classJaxoObject- Parameters:
scale- A scale factor to translate Java coordinates to LaTeX coordinates.canvasDim- The current dimension of the canvas.- Returns:
- The corresponding axodraw LaTeX command.
-
paintVisualAid
public final void paintVisualAid(JaxoGraphics2D g2)
Paints a visual aid for the user during dragging (moving or resizing) of this JaxoObject.- Overrides:
paintVisualAidin classJaxoObject- Parameters:
g2- The graphics context to paint the visual aid.
-
arrowCoordinates
public JaxoArrow.Coordinates arrowCoordinates()
Returns the coordinates of the arrow of the current object.- Specified by:
arrowCoordinatesin classJaxoParticleObject- Returns:
- The coordinates of the arrow of the current object.
-
rescaleObject
public final void rescaleObject(int orx, int ory, float scale)Rescale this JaxoObject by the scale factor scale, keeping the point (orx, ory) fixed.- Specified by:
rescaleObjectin classJaxoObject- Parameters:
orx- The x-coordinate of the fixed point.ory- The y-coordinate of the fixed point.scale- The scale parameter.
-
getLaTexCenter
protected java.awt.geom.Point2D getLaTexCenter(float scaleFactor, int canvasHeight)Returns a center point which is used by the latexCommand method.- Parameters:
scaleFactor- A scale factor.canvasHeight- The height of the current canvas.- Returns:
- A Point2D object holding the center point.
-
getEquidistantPoints
public final java.awt.geom.Point2D.Float[] getEquidistantPoints(int n)
Dividing the loop into n equidistant segments of length d, so n * d = 2 * r * PI is the circumference of the loop, this routine returns the n + 1 loop points that are i * d away from P1, where 0 <= i <= n.- Parameters:
n- The number of segments to divide the loop.- Returns:
- The equidistant points of the loop.
-
getLaTexRadius
protected float getLaTexRadius(float scaleFactor)
Returns a radius which is used by the latexCommand method.- Parameters:
scaleFactor- A scale factor.- Returns:
- The latex radius.
-
getLaTexAngles
protected java.awt.geom.Point2D getLaTexAngles()
Returns an angle which is used by the latexCommand method. This is basically the relative angle between the center and the second (release) point of the loop.- Returns:
- A Point2D object with x-component the starting angle and y-component the starting angle + 360.
-
getObjectPath
protected abstract java.awt.geom.GeneralPath getObjectPath()
Get the GeneralPath that paints this loop.- Returns:
- GeneralPath. May be null for an object that cannot be painted.
-
getAxo4JOptions
protected abstract java.lang.String getAxo4JOptions(float scale)
Return the option part of the LaTeX command for this line.- Parameters:
scale- the axodraw4j scale factor.- Returns:
- the option String.
-
-