Package org.opensourcephysics.media.core
Class TLine
java.lang.Object
java.awt.geom.Point2D
java.awt.geom.Point2D.Double
org.opensourcephysics.media.core.TPoint
org.opensourcephysics.media.core.TShape
org.opensourcephysics.media.core.TLine
- All Implemented Interfaces:
Serializable
,Cloneable
,Drawable
,Interactive
,Measurable
,Trackable
- Direct Known Subclasses:
TLineProfile
This is a TShape that draws a line.
- Version:
- 1.0
- Author:
- Douglas Brown
- See Also:
-
Nested Class Summary
Nested classes/interfaces inherited from class java.awt.geom.Point2D
Point2D.Double, Point2D.Float
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected TPoint
protected Rectangle
protected TPoint
protected Rectangle
protected Line2D
Fields inherited from class org.opensourcephysics.media.core.TShape
color, fillShape, hitRect, stroke, visible
Fields inherited from class org.opensourcephysics.media.core.TPoint
attachedTo, coordsEditTrigger, coordsVisibleInMouseBox, enabled, isAdjusting, prevX, prevY, screenPt, stepEditTrigger, support, toScreen, trackEditTrigger, worldPt, xyStringBuilder
Fields inherited from class java.awt.geom.Point2D.Double
x, y
Fields inherited from interface org.opensourcephysics.media.core.Trackable
PROPERTY_ADJUSTING
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionfindInteractive
(DrawingPanel panel, int xpix, int ypix) Returns the interactive drawable object at the specified pixel position.getEnd1()
Gets end 1.getEnd2()
Gets end 2.protected Shape
getShape
(VideoPanel vidPanel) Gets the shape to be filled in the draw method.void
setStroke
(BasicStroke stroke) Overrides TShape setStroke method.void
setXY
(double x, double y) Sets the x and y positions in imagespace.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, attachTo, center, cos, cos, detach, equals, getFrameNumber, getScreenPosition, getWorldPosition, getXMax, getXMin, getYMax, getYMin, isAdjusting, isAttached, isCoordsEditTrigger, isEnabled, isMeasured, isStepEditTrigger, isTrackEditTrigger, removePropertyChangeListener, removePropertyChangeListener, setAdjusting, setCoordsEditTrigger, setEnabled, setLocation, setPositionOnLine, setScreenPosition, setScreenPosition, setStepEditTrigger, setTrackEditTrigger, setWorldPosition, 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, isInteractive
-
Field Details
-
line
-
end1
-
end2
-
end1Rect
-
end2Rect
-
-
Constructor Details
-
TLine
public TLine()Constructs a default TLine with end points at (0, 0). -
TLine
public TLine(double x1, double y1, double x2, double y2) Constructs a TLine with specified end points.- Parameters:
x1
- x position of end 1y1
- y position of end 1x2
- x position of end 2y2
- y position of end 2
-
-
Method Details
-
getEnd1
Gets end 1.- Returns:
- end 1
-
getEnd2
Gets end 2.- Returns:
- end 2
-
setStroke
Overrides TShape setStroke method. -
setXY
public void setXY(double x, double y) Sets the x and y positions in imagespace.- Specified by:
setXY
in interfaceInteractive
- Overrides:
setXY
in classTPoint
- Parameters:
x
- the x positiony
- the y position
-
findInteractive
Returns the interactive drawable object at the specified pixel position.- Specified by:
findInteractive
in interfaceInteractive
- Overrides:
findInteractive
in classTShape
- Parameters:
panel
- the drawing panelxpix
- the x pixel position on the panelypix
- the y pixel position on the panel- Returns:
- the interactive drawable object
-
getShape
Gets the shape to be filled in the draw method.
-