Class ALspLabelLocationProvider

java.lang.Object
com.luciad.view.lightspeed.label.algorithm.ALspLabelLocationProvider
Direct Known Subclasses:
ALspStampLabelLocationProvider, TLspFixedInPathLabelLocationProvider, TLspFixedOnPathLabelLocationProvider

public abstract class ALspLabelLocationProvider extends Object
This abstract class is used to provide a fixed number of locations for a label. It is used by TLspLabelingAlgorithm. The algorithm will first call getMaxLocationCount and will then call getLocation.
Since:
2012.0
  • Constructor Details

    • ALspLabelLocationProvider

      public ALspLabelLocationProvider()
  • Method Details

    • getMaxLocationCount

      public int getMaxLocationCount(TLspLabelID aLabel, TLspPaintState aPaintState, ILspLabelingAlgorithm.LabelContext aLabelContext, ILspView aView)
      Returns the maximal number of locations to be tried for the given label. Override this method to return a custom number of locations. When overriding this method, one should also make sure that the getLocation method can create the same number of locations as returned by this method. By default, this method returns 1.
      Parameters:
      aLabel - the label.
      aPaintState - the paint state.
      aLabelContext - provides context information, such as priorities, PaintState, ...
      aView - the view.
      Returns:
      the maximal number of locations to be tried.
    • getLocation

      public abstract TLspLabelPlacement getLocation(TLspLabelID aLabel, int aLocationIndex, ALspLabelLocations aCurrentLabelLocations, TLspPaintState aPaintState, ILspLabelingAlgorithm.LabelContext aLabelContext, ILspView aView)
      This method returns a location for the given label using the given location index. Override this method to create custom locations for a label.
      Parameters:
      aLabel - a label.
      aLocationIndex - the location index.
      aCurrentLabelLocations - an ALspLabelLocations object containing locations for the currently placed labels.
      aPaintState - the paint state
      aLabelContext - provides context information, such as priorities, PaintState, ...
      aView - the view.
      Returns:
      the label location for the given label and index, or null if no location could be calculated.
    • isValidLocation

      public boolean isValidLocation(TLspLabelPlacement aLocation, ALspLabelLocations aCurrentLabelLocations, TLspPaintState aPaintState, ILspLabelingAlgorithm.LabelContext aLabelContext, ILspView aView)
      Checks if the given location is a valid location. This check should be used if this label location provider is capable of producing the given location. Labeling algorithms may use this method for previous label locations. I.e. when using a previous label locations, this method can be used to verify if the previous label location can be used.

      By default, this method returns true.

      Parameters:
      aLocation - the location to check.
      aCurrentLabelLocations - an ALspLabelLocations object containing locations for the currently placed labels.
      aPaintState - the paint state.
      aLabelContext - provides context information, such as priorities, PaintState, ...
      aView - the view.
      Returns:
      if the given location is a valid location.