Class TLspStampLabelLocation

All Implemented Interfaces:
ILcdCloneable, Cloneable

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:

  • 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
  • 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 returns 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.

      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

      public void getViewOffset(ILcd2DEditablePoint aViewOffsetSFCT)
      This method returns the view offset and stores it in the given point. The view offset is applied after applying the 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.
      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

      public void getWorldOffset(ILcd3DEditablePoint aWorldOffsetSFCT)
      This method returns the world offset and stores it in the given point. The world offset is added to the anchor 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

      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.

      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 vector
      aWorldRotationOffsetY - the y component of the world rotation offset vector
      aWorldRotationOffsetZ - 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 the location data of the given label.
      Specified by:
      getLocationData in class ALspStampLabelLocation
      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 - the LocationData object in which the location data is stored.
      Throws:
      TLcdNoBoundsException - when the location data could not be calculated.
    • copyFrom

      public void copyFrom(ALspLabelLocation aLabelLocation)
      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 class ALspLabelLocation
      Parameters:
      aLabelLocation - the label location to copy properties from.
    • equals

      public boolean equals(Object o)
      Overrides:
      equals in class ALspLabelLocation
    • hashCode

      public int hashCode()
      Overrides:
      hashCode in class ALspLabelLocation
    • toString

      public String toString()
      Overrides:
      toString in class ALspLabelLocation