Class TLspStampLabelLocation
- All Implemented Interfaces:
ILcdCloneable
,Cloneable
This label location uses a relative world and view offset.
It describes a label's location with offsets on the object's anchor point:
- World offset: this offset, defined in world coordinates, is added to the anchor point
- View offset: this offset, defined in pixels, is added on the screen to the projected anchor point+offset
This location also defines a rotation that will be applied on the label:
- World rotation: defined as a vector in world coordinates
- View rotation: defined as an angle on the screen
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.
- Since:
- 2012.0
-
Nested Class Summary
Nested classes/interfaces inherited from class com.luciad.view.lightspeed.painter.label.location.ALspStampLabelLocation
ALspStampLabelLocation.LocationData
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionvoid
copyFrom
(ALspLabelLocation aLabelLocation) Copies the location settings from the given label location.boolean
void
getLocationData
(TLspLabelID aLabel, ALspLabelLocations aLabelLocations, ILspStampLocationLabelPainter aLabelPainter, TLspPaintState aPaintState, TLspContext aContext, ALspStampLabelLocation.LocationData aLocationDataSFCT) Calculates thelocation data
of the given label.double
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
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.toString()
Methods inherited from class com.luciad.view.lightspeed.label.location.ALspLabelLocation
clone, isEditedByEditor, isEditedByPlacer, isSticky, setEditedByEditor, setEditedByPlacer, setSticky
-
Constructor Details
-
TLspStampLabelLocation
public TLspStampLabelLocation()Creates a new label location.
-
-
Method Details
-
isAbsoluteViewLocation
public boolean isAbsoluteViewLocation()Returns if this location is an absolute view locations. When this method returnstrue
, this location is anchored to the screen bounds. In that case, only thegetViewOffset()
andgetRotation()
methods are relevant. Also, theisViewDependent
method will returnfalse
, since an absolute view location does not depend on the world to view transformation.- Returns:
- if this location is an absolute view locations.
-
setAbsoluteViewLocation
public void setAbsoluteViewLocation(boolean aAbsoluteViewLocation) Sets if this location is an absolute location.- Parameters:
aAbsoluteViewLocation
-true
if this location is an absolute location.- See Also:
-
getViewOffset
This method returns the view offset and stores it in the given point. The view offset is applied after applying theworld offset
. So the label anchor point defined by this location can be retrieved by taking theanchor object
in world coordinates, adding theworld offset
, converting to view coordinates and adding the view offset.- Parameters:
aViewOffsetSFCT
- the point in which the view offset is stored.- See Also:
-
setViewOffset
public void setViewOffset(double aViewOffsetX, double aViewOffsetY) Sets the view offset. No reference to the given point is stored.- Parameters:
aViewOffsetX
- the x-part of the view offset.aViewOffsetY
- the y-part of the view offset.- See Also:
-
getWorldOffset
This method returns the world offset and stores it in the given point. The world offset is added to theanchor object
in world coordinates. This makes it possible to define labels that are located a fixed distance away from the anchor point.- Parameters:
aWorldOffsetSFCT
- the point in which the world offset is stored.- See Also:
-
setWorldOffset
public void setWorldOffset(double aWorldOffsetX, double aWorldOffsetY, double aWorldOffsetZ) Sets the world offset. No reference to the given point is stored.- Parameters:
aWorldOffsetX
- the x-part of the world offset.aWorldOffsetY
- the y-part of the world offset.aWorldOffsetZ
- the z-part of the world offset.- See Also:
-
getWorldRotationOffset
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.
- Parameters:
aWorldRotationOffsetSFCT
- the point in which the world rotation offset vector is stored.- Returns:
false
if no valid world rotation offset vector is stored.
-
setWorldRotationOffset
public void setWorldRotationOffset(double aWorldRotationOffsetX, double aWorldRotationOffsetY, double aWorldRotationOffsetZ) Sets the world rotation offset vector. When removing the world rotation offset from a location, these values can be set to(0, 0, 0)
.- Parameters:
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 vector- See Also:
-
getRotation
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.
- Returns:
- The rotation of the label in radians.
-
setRotation
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.
- Parameters:
aRotation
- The rotation of the label in radians.- See Also:
-
getLocationData
public void getLocationData(TLspLabelID aLabel, ALspLabelLocations aLabelLocations, ILspStampLocationLabelPainter aLabelPainter, TLspPaintState aPaintState, TLspContext aContext, ALspStampLabelLocation.LocationData aLocationDataSFCT) throws TLcdNoBoundsException Description copied from class:ALspStampLabelLocation
Calculates thelocation data
of the given label.- Specified by:
getLocationData
in classALspStampLabelLocation
- Parameters:
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
- theLocationData
object in which the location data is stored.- Throws:
TLcdNoBoundsException
- when the location data could not be calculated.
-
copyFrom
Description copied from class: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.
- Overrides:
copyFrom
in classALspLabelLocation
- Parameters:
aLabelLocation
- the label location to copy properties from.
-
equals
- Overrides:
equals
in classALspLabelLocation
-
hashCode
public int hashCode()- Overrides:
hashCode
in classALspLabelLocation
-
toString
- Overrides:
toString
in classALspLabelLocation
-