org.opensourcephysics.media.core
Class TCoordAxes

java.lang.Object
  extended by java.awt.geom.Point2D
      extended by java.awt.geom.Point2D.Double
          extended by org.opensourcephysics.media.core.TPoint
              extended by org.opensourcephysics.media.core.TShape
                  extended by org.opensourcephysics.media.core.TCoordAxes
All Implemented Interfaces:
java.io.Serializable, java.lang.Cloneable, Drawable, Interactive, Measurable, Trackable

public class TCoordAxes
extends TShape

This draws the worldspace origin and axes of an image coordinate system.

Version:
1.0
Author:
Douglas Brown
See Also:
Serialized Form

Nested Class Summary
 
Nested classes/interfaces inherited from class java.awt.geom.Point2D
java.awt.geom.Point2D.Double, java.awt.geom.Point2D.Float
 
Field Summary
protected  java.awt.geom.GeneralPath axes
           
protected  org.opensourcephysics.media.core.TCoordAxes.Origin origin
           
protected  boolean originEnabled
           
protected  java.awt.geom.GeneralPath originShape
           
protected  VideoPanel vidPanel
           
protected  java.awt.geom.GeneralPath xaxis
           
protected  boolean xaxisEnabled
           
 
Fields inherited from class org.opensourcephysics.media.core.TShape
color, fillShape, hitRect, stroke, visible
 
Fields inherited from class org.opensourcephysics.media.core.TPoint
coordinateStrBuilder, coordsEditTrigger, coordsVisibleInMouseBox, enabled, screenPt, stepEditTrigger, support, trackEditTrigger, worldPt
 
Fields inherited from class java.awt.geom.Point2D.Double
x, y
 
Constructor Summary
TCoordAxes(VideoPanel panel)
          Constructs a TCoordAxes object for the specified video panel.
 
Method Summary
 void draw(DrawingPanel panel, java.awt.Graphics g)
          Overrides TShape draw method.
 Interactive findInteractive(DrawingPanel panel, int xpix, int ypix)
          Overrides TShape findInteractive method.
 TPoint getOrigin()
          Gets the origin.
protected  java.awt.Shape getShape(VideoPanel vidPanel)
          Overrides TShape getShape method.
 boolean isOriginEnabled()
          Gets whether the origin responds to mouse hits.
 boolean isXAxisEnabled()
          Gets whether the x-axis responds to mouse hits.
 void setOriginEnabled(boolean enabled)
          Sets whether the origin responds to mouse hits.
 void setStroke(java.awt.BasicStroke stroke)
          Overrides TShape setStroke method.
 void setXAxisEnabled(boolean enabled)
          Sets whether the x-axis responds to mouse hits.
 void setXY(double x, double y)
          Overrides TPoint setXY method.
 java.lang.String toString()
          Returns a String describing this object.
 
Methods inherited from class org.opensourcephysics.media.core.TShape
getBounds, getColor, getStroke, isVisible, setColor, setHitRectCenter, setVisible
 
Methods inherited from class org.opensourcephysics.media.core.TPoint
addPropertyChangeListener, addPropertyChangeListener, angle, angle, center, cos, cos, equals, getFrameNumber, getScreenPosition, getWorldPosition, getXMax, getXMin, getYMax, getYMin, isCoordsEditTrigger, isEnabled, isMeasured, isStepEditTrigger, isTrackEditTrigger, removePropertyChangeListener, removePropertyChangeListener, setCoordsEditTrigger, setEnabled, setLocation, setPositionOnLine, setScreenPosition, setScreenPosition, setStepEditTrigger, setTrackEditTrigger, setX, setY, showCoordinates, sin, sin, translate
 
Methods inherited from class java.awt.geom.Point2D.Double
getX, getY
 
Methods inherited from class java.awt.geom.Point2D
clone, distance, distance, distance, distanceSq, distanceSq, distanceSq, hashCode, setLocation
 
Methods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface org.opensourcephysics.display.Interactive
getX, getY
 

Field Detail

vidPanel

protected VideoPanel vidPanel

axes

protected java.awt.geom.GeneralPath axes

origin

protected org.opensourcephysics.media.core.TCoordAxes.Origin origin

originEnabled

protected boolean originEnabled

xaxisEnabled

protected boolean xaxisEnabled

originShape

protected java.awt.geom.GeneralPath originShape

xaxis

protected java.awt.geom.GeneralPath xaxis
Constructor Detail

TCoordAxes

public TCoordAxes(VideoPanel panel)
Constructs a TCoordAxes object for the specified video panel.

Parameters:
panel - the video panel
Method Detail

getOrigin

public TPoint getOrigin()
Gets the origin.

Returns:
the origin

draw

public void draw(DrawingPanel panel,
                 java.awt.Graphics g)
Overrides TShape draw method.

Specified by:
draw in interface Drawable
Overrides:
draw in class TShape
Parameters:
panel - the drawing panel requesting the drawing
g - the graphics context on which to draw

setXY

public void setXY(double x,
                  double y)
Overrides TPoint setXY method. Sets the angle of the x axis.

Specified by:
setXY in interface Interactive
Overrides:
setXY in class TPoint
Parameters:
x - the x position
y - the y position

setStroke

public void setStroke(java.awt.BasicStroke stroke)
Overrides TShape setStroke method.

Overrides:
setStroke in class TShape
Parameters:
stroke - the desired stroke

setOriginEnabled

public void setOriginEnabled(boolean enabled)
Sets whether the origin responds to mouse hits.

Parameters:
enabled - true if origin responds to mouse hits.

isOriginEnabled

public boolean isOriginEnabled()
Gets whether the origin responds to mouse hits.

Returns:
true if the origin responds to mouse hits.

setXAxisEnabled

public void setXAxisEnabled(boolean enabled)
Sets whether the x-axis responds to mouse hits.

Parameters:
enabled - true if x-axis responds to mouse hits.

isXAxisEnabled

public boolean isXAxisEnabled()
Gets whether the x-axis responds to mouse hits.

Returns:
true if the x-axis responds to mouse hits.

findInteractive

public Interactive findInteractive(DrawingPanel panel,
                                   int xpix,
                                   int ypix)
Overrides TShape findInteractive method.

Specified by:
findInteractive in interface Interactive
Overrides:
findInteractive in class TShape
Parameters:
panel - the drawing panel
xpix - the x pixel position on the panel
ypix - the y pixel position on the panel
Returns:
the interactive drawable object

toString

public java.lang.String toString()
Returns a String describing this object.

Overrides:
toString in class TShape
Returns:
a descriptive string

getShape

protected java.awt.Shape getShape(VideoPanel vidPanel)
Overrides TShape getShape method.

Overrides:
getShape in class TShape
Parameters:
vidPanel - the video panel
Returns:
the axes shape