public class TLspModelElementTrackingPointProvider extends ALspTrackingPointProvider
This ALspTrackingPointProvider
follows a given set
of model elements.
The target world point is chosen at the center point of the bounds of the group of tracked objects.
The target world orientation corresponds to the orientation (in world coordinates) of
the first ILcdOriented
element found in the list of objects tracked by
this camera.
The tracked objects can be set using setTrackedObjects
.
Tracking can be disabled by calling stopTracking
.
Note: This tracking point provider only tracks the given model elements. It doesn't check if the used model element and respective models are actually in the view. This should be checked externally if needed.
Constructor and Description |
---|
TLspModelElementTrackingPointProvider() |
Modifier and Type | Method and Description |
---|---|
ILcdModel[] |
getModels()
Returns the models containing the objects tracked by this camera.
|
double |
getTargetPitch()
Provides the pitch angle (in degrees) to be used for orienting the camera, or
Double.Nan if no pitch could be calculated. |
ILcdPoint |
getTargetPoint()
Selects a target point that is to be followed by the camera, in world coordinates.
|
double |
getTargetRoll()
Provides the roll angle (in degrees) to be used for orienting the camera, or
Double.NaN if no roll could be calculated. |
double |
getTargetYaw()
Provides the world rotation (yaw) angle (in degrees) to be used for orienting the camera.
|
Object[] |
getTrackedObjects()
Returns the array of objects tracked by this camera.
|
ILspView |
getView()
Returns the view in which tracking is done.
|
void |
setTrackedObjects(ILspView aView,
Object[] aTrackedObjects,
ILcdModel[] aModels)
Sets the target objects that the camera must track.
|
void |
stopTracking()
Stops tracking the objects and models set in
setTrackedObjects . |
addTrackingPointChangeListener, fireTrackingPointChange, removeTrackingPointChangeListener
public TLspModelElementTrackingPointProvider()
public Object[] getTrackedObjects()
public ILcdModel[] getModels()
public ILspView getView()
ALspTrackingPointProvider
getView
in class ALspTrackingPointProvider
public void setTrackedObjects(ILspView aView, Object[] aTrackedObjects, ILcdModel[] aModels)
Sets the target objects that the camera must track.
In order to stop tracking the objects and models passed in this method,
stopTracking()
should be called.
aView
- the view for which this camera is used.aTrackedObjects
- the tracked objects that the camera has to follow.aModels
- the models the tracked objects belong to. This array must have the same
size as aTrackedObjects
.IllegalArgumentException
- when one of the arguments is null
or when
the arrays have different sizes.public void stopTracking()
setTrackedObjects
.public ILcdPoint getTargetPoint()
ALspTrackingPointProvider
getTargetPoint
in class ALspTrackingPointProvider
null
if none was found.public double getTargetYaw()
ALspTrackingPointProvider
Double.NaN
should be returned. This method
can be used for 2D as well as 3D cameras.getTargetYaw
in class ALspTrackingPointProvider
Double.NaN
if no orientation could be calculated.public double getTargetPitch()
ALspTrackingPointProvider
Double.Nan
if no pitch could be calculated. This method should only
be used for 3D cameras.getTargetPitch
in class ALspTrackingPointProvider
public double getTargetRoll()
ALspTrackingPointProvider
Double.NaN
if no roll could be calculated. This method should only
be used for 3D camera.getTargetRoll
in class ALspTrackingPointProvider