Element, InteractionSourceAbstractTile, ElementCircle, ElementImage, ElementPoints, ElementPolygon, ElementSegment, ElementSpring, ElementText, ElementTrail, Grouppublic abstract class Element extends java.lang.Object implements Element
Title: Element
Interaction: An Element includes the following targets:
Copyright: Open Source Physics project
Element.Loader| Modifier and Type | Field | Description |
|---|---|---|
protected InteractionTarget |
targetPosition |
|
protected InteractionTarget |
targetSize |
TARGET_POSITION, TARGET_SIZE| Constructor | Description |
|---|---|
Element() |
| Modifier and Type | Method | Description |
|---|---|---|
void |
addInteractionListener(InteractionListener listener) |
Adds the specified interaction listener to receive interaction events
to any of its targets from this source.
|
protected int |
getAxesMode() |
|
DrawingPanel3D |
getDrawingPanel3D() |
Returns the DrawingPanel3D in which it (or its final ancestor group)
is displayed.
|
protected double[] |
getHotSpotBodyCoordinates(InteractionTarget target) |
Returns the body coordinates of the specified hotspot
|
InteractionTarget |
getInteractionTarget(int target) |
Gives access to one of the targets of this source.
|
java.lang.String |
getName() |
Gets the name of the element
|
double |
getSizeX() |
Get the size along the X axis
|
double |
getSizeY() |
Get the size along the Y axis
|
double |
getSizeZ() |
Get the size along the Z axis
|
Style |
getStyle() |
Gets the style of the element
|
protected InteractionTarget |
getTargetHit(int x,
int y) |
Gets the target that is under the (x,y) position of the screen
|
Transformation |
getTransformation() |
Returns a clone of the element transformation
|
double |
getX() |
Get the X coordinate of the element
|
double |
getY() |
Get the Y coordinate of the element
|
double |
getZ() |
Get the Z coordinate of the element
|
protected boolean |
isReallyVisible() |
Returns the real visibility status of the element, which will be false if
it belongs to an invisible group
|
boolean |
isVisible() |
Whether the element is visible
|
void |
loadUnmutableObjects(XMLControl control) |
Loads unmutable objects of the Element, such as the style,
as well as perform any extra implementation-specific initialization.
|
void |
removeInteractionListener(InteractionListener listener) |
Removes the specified interaction listener
|
void |
setName(java.lang.String aName) |
Gives a name to the element.
|
void |
setSizeX(double sizeX) |
Set the size along the X axis
|
void |
setSizeXYZ(double[] size) |
Sets the size of the element.
|
void |
setSizeXYZ(double sizeX,
double sizeY,
double sizeZ) |
Set the size along the X, Y and Z axes
|
void |
setSizeY(double sizeY) |
Set the size along the Y axis
|
void |
setSizeZ(double sizeZ) |
Set the size along the Z axis
|
void |
setTransformation(Transformation transformation) |
Sets the internal transformation of the element, that is, the
transformation that converts the standard XYZ axes to the body's
internal reference axes.
|
void |
setVisible(boolean _visible) |
Sets the visibility of the element
|
void |
setX(double x) |
Set the X coordinate of the element
|
void |
setXYZ(double[] pos) |
Sets the coordinates of the element.
|
void |
setXYZ(double x,
double y,
double z) |
Set the X, Y, and Z coordinates of the element
|
void |
setY(double y) |
Set the Y coordinate of the element
|
void |
setZ(double z) |
Set the Z coordinate of the element
|
double[] |
toBodyFrame(double[] vector) |
This method converts a double[3] vector from the space's frame to
the body's frame.
|
double[] |
toSpaceFrame(double[] vector) |
This method transforms a double[3] vector from the body's frame to
the space's frame.
|
protected final InteractionTarget targetPosition
protected final InteractionTarget targetSize
public final DrawingPanel3D getDrawingPanel3D()
getDrawingPanel3D in interface Elementprotected int getAxesMode()
public void setName(java.lang.String aName)
Elementpublic final java.lang.String getName()
Elementpublic void setX(double x)
Elementpublic final double getX()
Elementpublic void setY(double y)
Elementpublic final double getY()
Elementpublic void setZ(double z)
Elementpublic final double getZ()
Elementpublic void setXYZ(double x,
double y,
double z)
Elementpublic void setXYZ(double[] pos)
Elementpublic void setSizeX(double sizeX)
Elementpublic final double getSizeX()
Elementpublic void setSizeY(double sizeY)
Elementpublic final double getSizeY()
Elementpublic void setSizeZ(double sizeZ)
Elementpublic final double getSizeZ()
Elementpublic void setSizeXYZ(double sizeX,
double sizeY,
double sizeZ)
ElementsetSizeXYZ in interface ElementsizeX - doublesizeY - doublesizeZ - doublepublic void setSizeXYZ(double[] size)
ElementsetSizeXYZ in interface Elementsize - double[]public void setVisible(boolean _visible)
ElementsetVisible in interface Element_visible - booleanpublic final boolean isVisible()
Elementprotected final boolean isReallyVisible()
public final Style getStyle()
Elementpublic Transformation getTransformation()
ElementgetTransformation in interface Elementpublic void setTransformation(Transformation transformation)
ElementsetTransformation in interface Elementtransformation - the new transformationTransformationpublic double[] toSpaceFrame(double[] vector)
ElementtoSpaceFrame in interface Elementvector - double[] The original coordinates in the body framepublic double[] toBodyFrame(double[] vector)
throws java.lang.UnsupportedOperationException
ElementtoBodyFrame in interface Elementvector - double[] The original coordinates in the spacejava.lang.UnsupportedOperationExceptionpublic InteractionTarget getInteractionTarget(int target)
InteractionSourcegetInteractionTarget in interface InteractionSourcetarget - An integer number that identifies the target in the source.public void addInteractionListener(InteractionListener listener)
InteractionSourceaddInteractionListener in interface InteractionSourcelistener - An object that implements the InteractionListener interfaceInteractionListenerpublic void removeInteractionListener(InteractionListener listener)
InteractionSourceremoveInteractionListener in interface InteractionSourceInteractionListenerprotected InteractionTarget getTargetHit(int x, int y)
x - inty - intprotected double[] getHotSpotBodyCoordinates(InteractionTarget target)
public void loadUnmutableObjects(XMLControl control)
ElementloadUnmutableObjects in interface Elementcontrol - XMLControl