public class TLspStampLabelLocation extends ALspStampLabelLocation
This label location uses a relative world and view offset.
It describes a label's location with offsets on the object's anchor point:
This location also defines a rotation that will be applied on the label:
This label location can also represent an absolute view location. In that case, the location
is anchored to the upper-left corner of the screen. Only the getViewOffset()
and getRotation()
methods are used then.
ALspStampLabelLocation.LocationData
Constructor and Description |
---|
TLspStampLabelLocation()
Creates a new label location.
|
Modifier and Type | Method and Description |
---|---|
void |
copyFrom(ALspLabelLocation aLabelLocation)
Copies the location settings from the given label location.
|
boolean |
equals(Object o) |
void |
getLocationData(TLspLabelID aLabel,
ALspLabelLocations aLabelLocations,
ILspStampLocationLabelPainter aLabelPainter,
TLspPaintState aPaintState,
TLspContext aContext,
ALspStampLabelLocation.LocationData aLocationDataSFCT)
Calculates the
location data of the given label. |
double |
getRotation()
Returns the rotation of the label around its anchor point.
|
void |
getViewOffset(ILcd2DEditablePoint aViewOffsetSFCT)
This method returns the view offset and stores it in the given point.
|
void |
getWorldOffset(ILcd3DEditablePoint aWorldOffsetSFCT)
This method returns the world offset and stores it in the given point.
|
boolean |
getWorldRotationOffset(ILcd3DEditablePoint aWorldRotationOffsetSFCT)
This method returns a world rotation offset vector.
|
int |
hashCode() |
boolean |
isAbsoluteViewLocation()
Returns if this location is an absolute view locations.
|
void |
setAbsoluteViewLocation(boolean aAbsoluteViewLocation)
Sets if this location is an absolute location.
|
void |
setRotation(double aRotation)
Sets the rotation of the label around its anchor point.
|
void |
setViewOffset(double aViewOffsetX,
double aViewOffsetY)
Sets the view offset.
|
void |
setWorldOffset(double aWorldOffsetX,
double aWorldOffsetY,
double aWorldOffsetZ)
Sets the world offset.
|
void |
setWorldRotationOffset(double aWorldRotationOffsetX,
double aWorldRotationOffsetY,
double aWorldRotationOffsetZ)
Sets the world rotation offset vector.
|
String |
toString() |
clone, isEditedByEditor, isEditedByPlacer, isSticky, setEditedByEditor, setEditedByPlacer, setSticky
public TLspStampLabelLocation()
public boolean isAbsoluteViewLocation()
true
, this location is anchored to the screen bounds. In that case, only
the getViewOffset()
and getRotation()
methods
are relevant.
Also, the isViewDependent
method will return
false
, since an absolute view location does not depend on the world to view
transformation.public void setAbsoluteViewLocation(boolean aAbsoluteViewLocation)
aAbsoluteViewLocation
- true
if this location is an absolute location.isAbsoluteViewLocation()
public void getViewOffset(ILcd2DEditablePoint aViewOffsetSFCT)
world offset
. So the label anchor
point defined by this location can be retrieved by taking the
anchor object
in world coordinates, adding the world offset
, converting to view
coordinates and adding the view offset.aViewOffsetSFCT
- the point in which the view offset is stored.setViewOffset(double, double)
public void setViewOffset(double aViewOffsetX, double aViewOffsetY)
aViewOffsetX
- the x-part of the view offset.aViewOffsetY
- the y-part of the view offset.getViewOffset(com.luciad.shape.shape2D.ILcd2DEditablePoint)
public void getWorldOffset(ILcd3DEditablePoint aWorldOffsetSFCT)
anchor object
in world coordinates. This makes it possible to define labels that are
located a fixed distance away from the anchor point.aWorldOffsetSFCT
- the point in which the world offset is stored.setWorldOffset(double, double, double)
public void setWorldOffset(double aWorldOffsetX, double aWorldOffsetY, double aWorldOffsetZ)
aWorldOffsetX
- the x-part of the world offset.aWorldOffsetY
- the y-part of the world offset.aWorldOffsetZ
- the z-part of the world offset.getWorldOffset(com.luciad.shape.shape3D.ILcd3DEditablePoint)
public boolean getWorldRotationOffset(ILcd3DEditablePoint aWorldRotationOffsetSFCT)
This method returns a world rotation offset vector. This world rotation can be calculated using
two points. One point is determined by worldObjectAnchorPointSFCT
+ getWorldOffset
. The other point is the first
point, with the world rotation offset vector added. These two world points can be transformed to view
coordinates, and using these view coordinates a screen rotation can be calculated.
The advantage of using this world rotation offset vector is that label positions and rotations can be represented independently from the view-world transformation.
aWorldRotationOffsetSFCT
- the point in which the world rotation offset vector is stored.false
if no valid world rotation offset vector is stored.public void setWorldRotationOffset(double aWorldRotationOffsetX, double aWorldRotationOffsetY, double aWorldRotationOffsetZ)
(0, 0, 0)
.aWorldRotationOffsetX
- the x component of the world rotation offset vectoraWorldRotationOffsetY
- the y component of the world rotation offset vectoraWorldRotationOffsetZ
- the z component of the world rotation offset vectorgetWorldRotationOffset(com.luciad.shape.shape3D.ILcd3DEditablePoint)
public double getRotation()
Returns the rotation of the label around its anchor point. This rotation is given in radians, clockwise and with 0 radians at 3 o'clock.
public void setRotation(double aRotation)
Sets the rotation of the label around its anchor point. This rotation is given in radians, clockwise and with 0 radians at 3 o'clock.
aRotation
- The rotation of the label in radians.getRotation()
public void getLocationData(TLspLabelID aLabel, ALspLabelLocations aLabelLocations, ILspStampLocationLabelPainter aLabelPainter, TLspPaintState aPaintState, TLspContext aContext, ALspStampLabelLocation.LocationData aLocationDataSFCT) throws TLcdNoBoundsException
ALspStampLabelLocation
location data
of the given label.getLocationData
in class ALspStampLabelLocation
aLabel
- the label for which to calculate the location data.aLabelLocations
- context information. Can be used when a label depends on an other label.aLabelPainter
- the label painter using which the location data is calculated.aPaintState
- the paint state.aContext
- the context.aLocationDataSFCT
- the LocationData
object in which the location data is stored.TLcdNoBoundsException
- when the location data could not be calculated.public void copyFrom(ALspLabelLocation aLabelLocation)
ALspLabelLocation
Copies the location settings from the given label location.
When creating an extension of this class, also overwrite this method to make sure your extra properties are copied.
copyFrom
in class ALspLabelLocation
aLabelLocation
- the label location to copy properties from.public boolean equals(Object o)
equals
in class ALspLabelLocation
public int hashCode()
hashCode
in class ALspLabelLocation
public String toString()
toString
in class ALspLabelLocation