|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectjava.awt.geom.Point2D
java.awt.geom.Point2D.Double
org.opensourcephysics.media.core.TPoint
org.opensourcephysics.media.core.TShape
org.opensourcephysics.media.core.TVector
public class TVector
This is a TShape that draws a vector.
| 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.Shape |
head
|
protected int |
length
|
protected java.awt.geom.Line2D |
line
|
protected java.awt.geom.GeneralPath |
path
|
protected java.awt.geom.AffineTransform |
rotation
|
protected java.awt.Shape |
shaft
|
protected TPoint |
tail
|
protected TPoint |
tip
|
protected boolean |
tipEnabled
|
protected java.awt.Rectangle |
tipRect
|
protected int |
width
|
| 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 | |
|---|---|
TVector()
Constructs a default TVector with tail position (0, 0) and components (0, 0). |
|
TVector(double xt,
double yt,
double xc,
double yc)
Constructs a TVector with specified tail and components. |
|
| Method Summary | |
|---|---|
Interactive |
findInteractive(DrawingPanel panel,
int xpix,
int ypix)
Returns the interactive drawable object at the specified pixel position. |
protected java.awt.Shape |
getShape(VideoPanel vidPanel)
Gets the shape to be filled in the draw method. |
TPoint |
getTail()
Gets the tail. |
TPoint |
getTip()
Gets the tip. |
double |
getXComponent()
Gets the x component. |
double |
getYComponent()
Gets the y component. |
boolean |
isTipEnabled()
Gets whether the tip is enabled. |
void |
setStroke(java.awt.BasicStroke stroke)
Overrides TPoint setStroke method. |
void |
setTipEnabled(boolean enabled)
Enables and disables the interactivity of the tip. |
void |
setTipLength(int tipLength)
Sets the length of the arrow tip. |
void |
setXComponent(double x)
Sets the x component. |
void |
setXY(double x,
double y)
Overrides TPoint setXY method to move both tip and tail. |
void |
setXYComponents(double x,
double y)
Sets the x and y components. |
void |
setYComponent(double y)
Sets the y component. |
| Methods inherited from class org.opensourcephysics.media.core.TShape |
|---|
draw, getBounds, getColor, getStroke, isVisible, setColor, setHitRectCenter, setVisible, toString |
| 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 |
|---|
protected java.awt.geom.GeneralPath path
protected java.awt.geom.Line2D line
protected java.awt.Shape head
protected java.awt.Shape shaft
protected int length
protected int width
protected java.awt.geom.AffineTransform rotation
protected TPoint tail
protected TPoint tip
protected java.awt.Rectangle tipRect
protected boolean tipEnabled
| Constructor Detail |
|---|
public TVector()
public TVector(double xt,
double yt,
double xc,
double yc)
xt - x position of tailyt - y position of tailxc - x componentyc - y component| Method Detail |
|---|
public TPoint getTip()
public TPoint getTail()
public void setXComponent(double x)
x - the x componentpublic void setYComponent(double y)
y - the y component
public void setXYComponents(double x,
double y)
x - the x componenty - the y componentpublic double getXComponent()
public double getYComponent()
public void setXY(double x,
double y)
setXY in interface InteractivesetXY in class TPointx - the x positiony - the y positionpublic void setTipEnabled(boolean enabled)
enabled - true to enable the tippublic boolean isTipEnabled()
true if the tip is enabledpublic void setTipLength(int tipLength)
tipLength - the tip length in pixelspublic void setStroke(java.awt.BasicStroke stroke)
setStroke in class TShapestroke - the desired stroke
public Interactive findInteractive(DrawingPanel panel,
int xpix,
int ypix)
findInteractive in interface InteractivefindInteractive in class TShapepanel - the drawing panelxpix - the x pixel position on the panelypix - the y pixel position on the panel
protected java.awt.Shape getShape(VideoPanel vidPanel)
getShape in class TShapevidPanel - the video panel
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||