public abstract class ALspCameraConstraint<T extends ALspViewXYZWorldTransformation> extends Object
Constraint for a view world transformation
.
This abstract class makes it possible to constrain the transformation before it is
applied. An example could be a constraint which limits the scale, or which keeps the camera
above the terrain.
This abstract class can be implemented by overriding constrain
.
fireConstraintChangeEvent
can be called to
notify that this constraint has changed, and that the constrain
method
should be evaluated again.
Constructor and Description |
---|
ALspCameraConstraint() |
Modifier and Type | Method and Description |
---|---|
void |
addConstraintChangeListener(ILcdChangeListener aListener)
Adds the given
ConstraintChangeListener . |
abstract void |
constrain(T aSource,
T aTargetSFCT)
Constrains the given view world transformation.
|
protected void |
fireConstraintChangeEvent()
Fires a constraint change to all listeners registered using
addConstraintChangeListener . |
void |
removeConstraintChangeListener(ILcdChangeListener aListener)
Removes the given
ConstraintChangeListener . |
public void addConstraintChangeListener(ILcdChangeListener aListener)
ConstraintChangeListener
.aListener
- a listener.public void removeConstraintChangeListener(ILcdChangeListener aListener)
ConstraintChangeListener
.aListener
- a listener.protected void fireConstraintChangeEvent()
addConstraintChangeListener
. This method can be used to notify that the constrain
method should be evaluated again.public abstract void constrain(T aSource, T aTargetSFCT)
Constrains the given view world transformation. This method can be implemented by
modifying aTargetSFCT
.
When the original view world transformation is
modified, the changes are first applied on a copy of the transformation (aTargetSFCT
).
This copy is passed to the constraints, which can also modify it. After all constraints are
evaluated, all changes are applied on the original transformation.
aSource
is the original transformation. It is given as context information.
aSource
- the original transformation, on which all changes will be applied after
all constraints are evaluated. It is given as context information.aTargetSFCT
- the view transformation copy which contains the modifications. Constraints
should be applied on this transformation.