Class ALspLabelLocations
- Direct Known Subclasses:
TLspLabelLocations
ALspLabelLocations
is the central place where information is kept about the
position of labels and whether or not they are visible. It can store locations and their
visibility for multiple layers.
For a label, this information is updated using
setLabelLocations
: updates the locations and resets all visibilitiesupdateLabelLocations
: updates the locations and visibilities of the given labels only
getLabelLocation
to get information for one labelgetLabelLocations
to get information for a set of labels
It is up to the implementation of this class how this information is stored. One implementation may store the information inside the domain objects, while another implementation may store this information external to the domain object in some sort of map.
- Since:
- 2012.0
-
Nested Class Summary
Modifier and TypeClassDescriptionstatic class
Encapsulates a label and its location and visibility. -
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionabstract void
Adds the specified listener to this information store.abstract ALspLabelLocations.LocationInfo
getLabelLocation
(ILspView aView, TLspLabelID aLabel) Returns the location and visibility for the requested label.abstract Iterable
<ALspLabelLocations.LocationInfo> getLabelLocations
(ILspView aView, ILspLayer aLayer, TLspPaintRepresentation aPaintRepresentation, boolean aVisibleOnly) Retrieves the current set of label locations and visibilities.abstract void
Removes the specified listener.abstract void
setLabelLocations
(List<TLspLabelID> aLabels, List<ALspLabelLocation> aLocations, List<Boolean> aVisibilities, ILspView aView) Stores the given location information so it can beretrieved
later on.abstract void
updateLabelLocations
(List<TLspLabelID> aLabels, List<ALspLabelLocation> aLocations, List<Boolean> aVisibilities, ILspView aView) Stores the given location information so it can beretrieved
later on.
-
Constructor Details
-
ALspLabelLocations
public ALspLabelLocations()
-
-
Method Details
-
addLabelLocationListener
Adds the specified listener to this information store. This listener will be notified of changes in the label information.- Parameters:
aListener
- The listener that should be informed when there are changes in the label information.- See Also:
-
removeLabelLocationListener
Removes the specified listener. This listener will no longer be notified of changes in the label information.- Parameters:
aListener
- The listener to remove.
-
setLabelLocations
public abstract void setLabelLocations(List<TLspLabelID> aLabels, List<ALspLabelLocation> aLocations, List<Boolean> aVisibilities, ILspView aView) Stores the given location information so it can be
retrieved
later on.Note that this call sets all labels that are not explicitly specified to invisible.
This method also allows to remove the information: just let the ALspLabelLocation be
null
.- Parameters:
aLabels
- An array of objects identifying a label to which this information applies.aLocations
- An array of locations. No references to the locations are kept within the implementations of this class. This allows the client of this class to reuse the same locations. If this location isnull
, any label information already present in this instance about the given representation is removed from this class.aVisibilities
- An array ofboolean
s indicating visibility of the labels.aView
- The view for which the location applies.- See Also:
-
updateLabelLocations
public abstract void updateLabelLocations(List<TLspLabelID> aLabels, List<ALspLabelLocation> aLocations, List<Boolean> aVisibilities, ILspView aView) Stores the given location information so it can be
retrieved
later on.This call only changes the location and visibility of the specified labels, and leaves the other labels untouched.
This method also allows to remove the information: just let the ALspLabelLocation be
null
.- Parameters:
aLabels
- An array of objects identifying a label to which this information applies.aLocations
- An array of locations. No references to the locations are kept within the implementations of this class. This allows the client of this class to reuse the same locations. If this location isnull
, any label information already present in this instance about the given representation is removed from this class.aVisibilities
- The identifiers for the labels that should be visible.aView
- The view for which the location applies.- See Also:
-
getLabelLocation
public abstract ALspLabelLocations.LocationInfo getLabelLocation(ILspView aView, TLspLabelID aLabel) Returns the location and visibility for the requested label.This method never return
null
, but the location inside can benull
.- Parameters:
aView
- The viewaLabel
- The label- Returns:
- The location info, never
null
-
getLabelLocations
public abstract Iterable<ALspLabelLocations.LocationInfo> getLabelLocations(ILspView aView, ILspLayer aLayer, TLspPaintRepresentation aPaintRepresentation, boolean aVisibleOnly) Retrieves the current set of label locations and visibilities.- Parameters:
aView
- The view to retrieve the information for, nevernull
aLayer
- The layer to retrieve the information for, can benull
if all layers relevantaPaintRepresentation
- The paint representation to retrieve the information, can benull
if the layer is alsonull
aVisibleOnly
- Indicates whether all information is necessary, or only that of visible labels- Returns:
- A set of labels with their location and visibility.
-