Class TLcdGXYCollectedLabelInfoUtil

java.lang.Object
com.luciad.view.gxy.labeling.util.TLcdGXYCollectedLabelInfoUtil

public class TLcdGXYCollectedLabelInfoUtil extends Object
Utility class for collecting labeling info for ILcdGXYLabelingAlgorithms.
Since:
10.1
  • Method Details

    • createCollectedLabelInfoList

      public static TLcdCollectedLabelInfoList createCollectedLabelInfoList(List<TLcdLabelIdentifier> aLabels, ILcdGXYView aGXYView)
      This method creates a TLcdCollectedLabelInfoList from the given list of TLcdLabelIdentifiers. It only does so if the labels layer is a ILcdGXYEditableLabelsLayer.
      Parameters:
      aLabels - a list of labels to be collected and placed.
      aGXYView - the gxy view.
      Returns:
      the TLcdCollectedLabelInfoList created using the list of TLcdLabelIdentifiers.
    • addLabelLocationPrototypeDataSFCT

      public static void addLabelLocationPrototypeDataSFCT(TLcdCollectedLabelInfoList aLabelInfoListSFCT, ILcdGXYView aGXYView)
      This method adds a prototype TLcdLabelLocation to each TLcdCollectedLabelInfo. If its layer is a ILcdGXYEditableLabelsLayer it calls ALcdLabelLocations.createLabelLocation() and ALcdLabelLocations.getDefaultLabelLocationSFCT. Otherwise it just creates a new TLcdLabelLocation.

      This method stored this label location using TLcdCollectedLabelInfo.LABEL_LOCATION_PROTOTYPE_KEY.

      Parameters:
      aLabelInfoListSFCT - the label info list object.
      aGXYView - the gxy view.
    • resolveParentBoundsSFCT

      public static boolean resolveParentBoundsSFCT(TLcdLabelLocation aLabelLocationSFCT, ILcdGXYContext aGXYContext, Graphics aGraphics, int aLabelPainterMode)
      This method resolves the parent bounds of the given label location. For this to work
      • the layer set in the gxy context should be a ILcdGXYEditableLabelsLayer,
      • it should be possible to resolve the parent bounds of the label location of the parent,
      • the label painter of the parent label should be a ILcdGXYLabelPainter2.

      This method works the following way :

      • If the given label location has no parent label, nothing is modified and the method returns true.
      • If the given label location has a parent label, its label location is retrieved from the ALcdLabelLocations in the layer.
      • The parent label location is also resolved (this is done recursively in case the parent has a parent too).
      • The resolved parent label location is set on the label painter, and the bounds are retrieved using ILcdGXYLabelPainter2.labelBoundsSFCT.
      • These bounds are set on the given label location.
      Parameters:
      aLabelLocationSFCT - the label location to be resolved.
      aGXYContext - a gxy context.
      aGraphics - the graphics.
      aLabelPainterMode - the label painter mode.
      Returns:
      true if the parent bounds could be resolved, and false otherwise.
    • addPrioritiesDataSFCT

      public static void addPrioritiesDataSFCT(TLcdCollectedLabelInfoList aLabelInfoListSFCT, ILcdGXYMultiLabelPriorityProvider aPriorityProvider, ILcdGXYView aGXYView)
      This method adds priority data to TLcdCollectedLabelInfo objects when it doesn't exist yet. This priority is stored using TLcdCollectedLabelInfo.PRIORITY_KEY. It does so for all labels of the given TLcdCollectedLabelInfoList object.
      Parameters:
      aLabelInfoListSFCT - the label infos object.
      aPriorityProvider - the priority provider that is used to retrieve priorities.
      aGXYView - the view.
    • addParentLabelIdentifierDataSFCT

      public static void addParentLabelIdentifierDataSFCT(TLcdCollectedLabelInfoList aLabelInfoListSFCT, ILcdGXYView aGXYView)
      This methods add the parent label identifier to TLcdCollectedLabelInfo objects when it doesn't exist yet. This parent label identifier is stored using TLcdCollectedLabelInfo.PARENT_LABEL_IDENTIFIER_KEY. It does so for all labels of the given TLcdCollectedLabelInfoList object.
      Parameters:
      aLabelInfoListSFCT - a label infos object.
      aGXYView - the view.
    • addDimensionAndLabelAnchorOffsetDataSFCT

      public static void addDimensionAndLabelAnchorOffsetDataSFCT(TLcdCollectedLabelInfoList aLabelInfoListSFCT, ILcdGXYView aGXYView, Graphics aGraphics)
      This method adds dimension data to TLcdCollectedLabelInfo objects when it doesn't exist yet. This dimension is stored using TLcdCollectedLabelInfo.LABEL_DIMENSION_KEY. It also adds a label anchor offset, and stores it using TLcdCollectedLabelInfo.LABEL_ANCHOR_OFFSET_KEY. It does so for all labels of the given TLcdCollectedLabelInfoList object.

      The dimension is calculated by retrieving the bounds using a label location with location index -1. When no dimension could be calculated, it is set to null.

      The label anchor offset is found by subtracting the upper left point of the label from its label anchor point. The upper left point is calculated by retrieving the bounds using a label location with location index -1. The label anchor point is retrieved using a label location with location index -1. When no label anchor offset could be found, it is set to (0, 0).

      Parameters:
      aLabelInfoListSFCT - the label infos object.
      aGXYView - the view.
      aGraphics - the graphics.
    • addDimensionDataSFCT

      public static void addDimensionDataSFCT(TLcdCollectedLabelInfoList aLabelInfoListSFCT, ILcdGXYView aGXYView, Graphics aGraphics)
      This method adds dimension data to TLcdCollectedLabelInfo objects when it doesn't exist yet. This dimension is stored using TLcdCollectedLabelInfo.LABEL_DIMENSION_KEY. It does so for all labels of the given TLcdCollectedLabelInfoList object.

      The dimension is calculated by retrieving the bounds using a label location with location index -1. When no dimension could be calculated, it is set to null.

      Parameters:
      aLabelInfoListSFCT - the label infos object.
      aGXYView - the view.
      aGraphics - the graphics.
    • addLabelAnchorOffsetDataSFCT

      public static void addLabelAnchorOffsetDataSFCT(TLcdCollectedLabelInfoList aLabelInfoListSFCT, ILcdGXYView aGXYView, Graphics aGraphics)
      This method calculates label anchor offset data, and stores it using TLcdCollectedLabelInfo.LABEL_ANCHOR_OFFSET_KEY. It does so for all labels of the given TLcdCollectedLabelInfoList object.

      The label anchor offset is found by subtracting the upper left point of the label from its label anchor point. The upper left point is calculated by retrieving the bounds using a label location with location index -1. The label anchor point is retrieved using a label location with location index -1. When no label anchor offset could be found, it is set to (0, 0).

      Parameters:
      aLabelInfoListSFCT - the label infos object.
      aGXYView - the view.
      aGraphics - the graphics.
    • addInteractiveLabelDataSFCT

      public static void addInteractiveLabelDataSFCT(TLcdCollectedLabelInfoList aLabelInfoListSFCT, ILcdGXYView aGXYView)
      This method checks if the given labels are interactive labels and stores it using TLcdCollectedLabelInfo.IS_INTERACTIVE_LABEL. This is done for all labels in the given TLcdCollectedLabelInfoList.
      Parameters:
      aLabelInfoListSFCT - the label infos object.
      aGXYView - the view.
    • addObjectAnchorPointDataSFCT

      public static void addObjectAnchorPointDataSFCT(TLcdCollectedLabelInfoList aLabelInfoListSFCT, ILcdGXYView aGXYView, Graphics aGraphics)
      This method tries to add an anchor point to each TLcdCollectedLabeledObjectInfo object. The anchor point is retrieved by using ILcdGXYPainter.anchorPointSFCT.
      Parameters:
      aLabelInfoListSFCT - the label infos object.
      aGXYView - the view.
      aGraphics - the graphics.
    • addSelectionDataSFCT

      public static void addSelectionDataSFCT(TLcdCollectedLabelInfoList aLabelInfoListSFCT)
      This method adds selection data to each TLcdCollectedLabeledObjectInfo object. This is done using ILcdSelection.isSelected(Object). The retrieved boolean is stored using TLcdCollectedLabeledObjectInfo.OBJECT_SELECTED_KEY.
      Parameters:
      aLabelInfoListSFCT - the label infos object.
    • addDimensionAndLabelAnchorOffsetDataSFCT

      public static boolean addDimensionAndLabelAnchorOffsetDataSFCT(TLcdCollectedLabelInfo aLabelInfoSFCT, ILcdGXYContext aGXYContext, Graphics aGraphics, int aLabelPainterMode)
      This method adds dimension data to the given TLcdCollectedLabelInfo object when it doesn't exist yet. This dimension is stored using TLcdCollectedLabelInfo.LABEL_DIMENSION_KEY. It also adds a label anchor offset, and stores it using TLcdCollectedLabelInfo.LABEL_ANCHOR_OFFSET_KEY.

      The dimension is calculated by retrieving the bounds using a label location with location index -1. When no dimension could be calculated, it is set to null.

      The label anchor offset is found by subtracting the upper left point of the label from its label anchor point. The upper left point is calculated by retrieving the bounds using a label location with location index -1. The label anchor point is retrieved using a label location with location index -1. When no label anchor offset could be found, it is set to (0, 0).

      Parameters:
      aLabelInfoSFCT - a label info object.
      aGXYContext - a gxy context.
      aGraphics - the graphics.
      aLabelPainterMode - the label painter mode to be used.
      Returns:
      true if the dimension and label anchor offset could be calculated or if they were already present, and false otherwise.
    • addDimensionDataSFCT

      public static boolean addDimensionDataSFCT(TLcdCollectedLabelInfo aLabelInfoSFCT, ILcdGXYContext aGXYContext, Graphics aGraphics, int aLabelPainterMode)
      This method adds dimension data to the given TLcdCollectedLabelInfo when it doesn't exist yet. This dimension is stored using TLcdCollectedLabelInfo.LABEL_DIMENSION_KEY.

      The dimension is calculated by retrieving the bounds using a label location with location index -1. When no dimension could be calculated, it is set to null.

      Parameters:
      aLabelInfoSFCT - a label info object.
      aGXYContext - a gxy context.
      aGraphics - the graphics.
      aLabelPainterMode - the label painter mode to be used.
      Returns:
      true if the dimension could be calculated or if it was already present, and false otherwise.
    • addLabelAnchorOffsetDataSFCT

      public static boolean addLabelAnchorOffsetDataSFCT(TLcdCollectedLabelInfo aLabelInfoSFCT, ILcdGXYContext aGXYContext, Graphics aGraphics, int aLabelPainterMode)
      This method calculates label anchor offset data for the given TLcdCollectedLabelInfo, and stores it using TLcdCollectedLabelInfo.LABEL_ANCHOR_OFFSET_KEY.

      The label anchor offset is found by subtracting the upper left point of the label from its label anchor point. The upper left point is calculated by retrieving the bounds using a label location with location index -1. The label anchor point is retrieved using a label location with location index -1. When no label anchor offset could be found, it is set to (0, 0).

      Parameters:
      aLabelInfoSFCT - a label info object.
      aGXYContext - a gxy context.
      aGraphics - the graphics.
      aLabelPainterMode - the label painter mode to be used.
      Returns:
      true if the label anchor offset could be calculated or was already present, and false otherwise.
    • addInteractiveLabelDataSFCT

      public static void addInteractiveLabelDataSFCT(TLcdCollectedLabelInfo aLabelInfoSFCT, ILcdGXYContext aGXYContext)
      This method checks if the given label is an interactive label and stores this using TLcdCollectedLabelInfo.IS_INTERACTIVE_LABEL.
      Parameters:
      aLabelInfoSFCT - a label info object.
      aGXYContext - a gxy context.