Class TLspLabelID

java.lang.Object
com.luciad.view.lightspeed.painter.label.TLspLabelID

public class TLspLabelID extends Object

Class used to uniquely identify a label. A label is specified by its layer, paint representation, domain object, and a sublabel ID.

The sublabel ID is an object that uniquely identifies a label within the set of all labels of a domain object. It should be immutable, and properly implement equals() and hashCode(). Typical sublabel IDs would be a String or Integer object. This object should never be null.

This class implement the equals and hashCode implementations, so it can for example be used as a key in hash maps.

Since:
2012.0
  • Constructor Details

    • TLspLabelID

      public TLspLabelID(ILspLayer aLayer, TLspPaintRepresentation aPaintRepresentation, Object aDomainObject, Object aSubLabelID)
      Create a new label identifier using the labels' domain object and sublabel ID
      Parameters:
      aLayer - the layer to which the domain object of the label belongs.
      aPaintRepresentation - the paint representation state
      aDomainObject - the domain object to which the label belongs.
      aSubLabelID - the Object that can be used to differentiate between multiple labels of the same domain object. This object can be used as a cache key, and shouldn't contain references to e.g. domain objects, layers or views. This object should never be null.
  • Method Details

    • getLayer

      public ILspLayer getLayer()
      Returns the layer this label belongs to.
      Returns:
      the layer this label belongs to.
    • getPaintRepresentation

      public TLspPaintRepresentation getPaintRepresentation()
      Returns the paint representation this label is for.
      Returns:
      the paint representation this label is for.
    • getDomainObject

      public Object getDomainObject()
      Returns the domain object of this label.
      Returns:
      the domain object of this label.
    • getSubLabelID

      public Object getSubLabelID()

      Returns the sublabel ID used to identify a label. This sublabel ID is used to differentiate between multiple labels for the same domain object.

      The sublabel ID is an object that uniquely identifies a label within the set of all labels of a domain object. It should be immutable, and properly implement equals() and hashCode(). Typical sublabel IDs would be a String or Integer object. This object should never be null.

      Note: This object can be used as a cache key, and should not contain references to for example domain objects, layers or views, as this could cause memory leaks.

      Returns:
      the sublabel ID used to identify this label.
    • equals

      public boolean equals(Object o)
      This implementation of equals uses an index to compare label identifiers. It also checks if the domain object is exactly the same (==) as the domain object of the other label identifier.
      Overrides:
      equals in class Object
      Parameters:
      o - an other object.
      Returns:
      true if this label identifier equals the given object, and false otherwise.
    • hashCode

      public int hashCode()
      This implementation of hashCode uses the sublabel ID to create a hash code for this label identifier. It also uses the identity hash code (System.identityHashCode) of the domain object and the layer.
      Overrides:
      hashCode in class Object
      Returns:
      a hash code for this label identifier.
    • toString

      public String toString()
      Overrides:
      toString in class Object