Class ALcdGXYDiscretePlacementsLabelingAlgorithmWrapper
- All Implemented Interfaces:
ILcdCloneable,ILcdGXYLabelingAlgorithm,Cloneable
- Direct Known Subclasses:
TLcdGXYDependantLabelsRemovalWrapper
ALcdGXYDiscretePlacementsLabelingAlgorithm abstract algorithm.
The implementation of this labeling algorithm is thread-safe if the wrapped labeling algorithm is thread safe.
- Since:
- 10.1
-
Constructor Summary
ConstructorsModifierConstructorDescriptionprotectedALcdGXYDiscretePlacementsLabelingAlgorithmWrapper(ALcdGXYDiscretePlacementsLabelingAlgorithm aDelegate) Creates a new algorithm wrapper wrapping the given discrete placements algorithm. -
Method Summary
Modifier and TypeMethodDescriptionclone()MakesObject.clone()public.collectLabelInfo(List<TLcdLabelIdentifier> aLabelToCollect, Graphics aGraphics, ILcdGXYView aGXYView) This method returns aTLcdCollectedLabelInfoListobject based on the given list ofTLcdLabelIdentifiers.protected Iterator<TLcdCollectedLabelInfo> createLabelIterator(TLcdCollectedLabelInfoList aLabelInfoList, ILcdLabelConflictChecker aBoundsConflictChecker, ILcdGXYView aView) Creates a newIteratorthat iterates over theTLcdCollectedLabelInfos.protected ILcdLabelPlacementEvaluatorcreateLabelPlacementEvaluator(TLcdCollectedLabelInfoList aLabelInfoList, ILcdLabelConflictChecker aBoundsConflictChecker, ILcdGXYView aView) Creates a newILcdLabelPlacementEvaluatorusing the given parameters.protected Iterator<TLcdLabelPlacement> createLabelPlacementIterator(TLcdCollectedLabelInfo aLabel, TLcdCollectedLabelInfoList aLabelInfoList, ILcdLabelConflictChecker aBoundsConflictChecker, ILcdGXYView aView) Creates a newIteratorthat iterates over theTLcdLabelPlacements for the given label.Return the wrapped algorithm.Methods inherited from class com.luciad.view.gxy.labeling.algorithm.discrete.ALcdGXYDiscretePlacementsLabelingAlgorithm
computeLabelPlacements
-
Constructor Details
-
ALcdGXYDiscretePlacementsLabelingAlgorithmWrapper
protected ALcdGXYDiscretePlacementsLabelingAlgorithmWrapper(ALcdGXYDiscretePlacementsLabelingAlgorithm aDelegate) Creates a new algorithm wrapper wrapping the given discrete placements algorithm.- Parameters:
aDelegate- a delegate labeling algorithm.
-
-
Method Details
-
getDelegateAlgorithm
Return the wrapped algorithm.- Returns:
- the wrapped algorithm.
-
clone
Description copied from interface:ILcdCloneableMakes
When for example extending fromObject.clone()public.java.lang.Object, it can be implemented like this:public Object clone() { try { return super.clone(); } catch ( CloneNotSupportedException e ) { // Cannot happen: extends from Object and implements Cloneable (see also Object.clone) throw new RuntimeException( e ); } }- Specified by:
clonein interfaceILcdCloneable- Overrides:
clonein classALcdGXYDiscretePlacementsLabelingAlgorithm- See Also:
-
collectLabelInfo
public TLcdCollectedLabelInfoList collectLabelInfo(List<TLcdLabelIdentifier> aLabelToCollect, Graphics aGraphics, ILcdGXYView aGXYView) Description copied from interface:ILcdGXYLabelingAlgorithmThis method returns aTLcdCollectedLabelInfoListobject based on the given list ofTLcdLabelIdentifiers. The returnedTLcdCollectedLabelInfoListshould contain aTLcdCollectedLabelInfoobject for each label that should be placed.Each
TLcdCollectedLabelInfoshould also contain all information needed bycomputeLabelPlacementsto place the labels. In order to enable correct asynchronous label placing, all calls to the layer and the (label) painters should be done in this method. The results should then be stored in the info objects.It is possible that the returned
TLcdCollectedLabelInfoListdoesn't contain aTLcdCollectedLabelInfoobject for every givenTLcdLabelIdentifier. In that case the missing labels are not placed.- Specified by:
collectLabelInfoin interfaceILcdGXYLabelingAlgorithm- Overrides:
collectLabelInfoin classALcdGXYDiscretePlacementsLabelingAlgorithm- Parameters:
aLabelToCollect- the labels for which aTLcdCollectedLabelInfoListshould be created.aGraphics- the graphics.aGXYView- the view.- Returns:
- a
TLcdCollectedLabelInfoListwhich contains all the information needed to place the labels.
-
createLabelIterator
protected Iterator<TLcdCollectedLabelInfo> createLabelIterator(TLcdCollectedLabelInfoList aLabelInfoList, ILcdLabelConflictChecker aBoundsConflictChecker, ILcdGXYView aView) Description copied from class:ALcdGXYDiscretePlacementsLabelingAlgorithmCreates a newIteratorthat iterates over theTLcdCollectedLabelInfos. The abstract labeling algorithm will continue iterating overTLcdCollectedLabelInfos as long asIterator.hasNext()returnstrue. When it returnsfalse, no more labels will be tried, andcomputeLabelPlacementsreturns.Iterator.hasNext()should always be called before callingIterator.next(), and if it returnstrue,Iterator.next()should never returnnull.The implementation of this method should be as independent as possible. It should not rely on
createLabelPlacementIteratororcreateLabelPlacementEvaluator. Not respecting this might result in unexpected behaviour when wrapping or extending this class.The returned
TLcdCollectedLabelInfoshould be correctly initialized, i.e. it should contain all information needed to create validTLcdLabelPlacements usingcreateLabelPlacementIterator. It should also always point to its correspondingTLcdCollectedLabeledObjectInfo.Override this method to provide a custom implementation.
- Specified by:
createLabelIteratorin classALcdGXYDiscretePlacementsLabelingAlgorithm- Parameters:
aLabelInfoList- the label infos object that contains all information needed to place the labels.aBoundsConflictChecker- the bounds conflict checker to be used when evaluating label placements.aView- the view.- Returns:
- a new
Iteratorthat iterates overTLcdCollectedLabelInfos.
-
createLabelPlacementIterator
protected Iterator<TLcdLabelPlacement> createLabelPlacementIterator(TLcdCollectedLabelInfo aLabel, TLcdCollectedLabelInfoList aLabelInfoList, ILcdLabelConflictChecker aBoundsConflictChecker, ILcdGXYView aView) Description copied from class:ALcdGXYDiscretePlacementsLabelingAlgorithmCreates a newIteratorthat iterates over theTLcdLabelPlacements for the given label. The abstract labeling algorithm will continue iterating overTLcdLabelPlacements as long asIterator.hasNext()returnstrue. When it returnsfalse, a new label will be tried.Iterator.hasNext()should always be called before callingIterator.next(), and if it returnstrue,Iterator.next()should never returnnull.The implementation of this method should be as independent as possible. It should not rely on
createLabelIteratororcreateLabelPlacementEvaluator. Not respecting this might result in unexpected behaviour when wrapping or extending this class.The returned
TLcdLabelPlacementshould be correctly initialized, i.e. it should at least be able to return a valid label location, bounds rectangle and bounds rotation. It should also reference its correspondingTLcdCollectedLabelInfo.Override this method to provide a custom implementation.
- Specified by:
createLabelPlacementIteratorin classALcdGXYDiscretePlacementsLabelingAlgorithm- Parameters:
aLabel- the label for which an iterator should be created.aLabelInfoList- the info object that contains all information needed to place the labels.aBoundsConflictChecker- the bounds conflict checker to be used when evaluating label placements.aView- the view.- Returns:
- a new
Iteratorthat iterates overTLcdLabelPlacements.
-
createLabelPlacementEvaluator
protected ILcdLabelPlacementEvaluator createLabelPlacementEvaluator(TLcdCollectedLabelInfoList aLabelInfoList, ILcdLabelConflictChecker aBoundsConflictChecker, ILcdGXYView aView) Description copied from class:ALcdGXYDiscretePlacementsLabelingAlgorithmCreates a newILcdLabelPlacementEvaluatorusing the given parameters. It evaluates the placements returned bycreateLabelPlacementIterator, and returns aPlacementResultto denote if the placement should be used for its label or not.The following actions are undertaken for the following placement results :
PlacementResult.SUCCESS: the given label placement will be used for its label, it will be added to the list of placed labels, and it will be added to the givenILcdLabelConflictChecker. After that,ILcdLabelPlacementEvaluator.placementAppliedwill be called and no more placements are tried for the label.PlacementResult.FALLBACK: the abstract algorithm will try to find an other placements which returnsPlacementResult.SUCCESS. When no such placement is found, this placement will be added to the list of placed labels, and it will be added to the givenILcdLabelConflictChecker. After that,ILcdLabelPlacementEvaluator.placementAppliedwill be called.PlacementResult.TRY_NEW_PLACEMENT: the abstract algorithm will try to find an other placement which returnsPlacementResult.SUCCESSorPlacementResult.FALLBACK. When no such placement is found,ILcdLabelPlacementEvaluator.noPlacementAppliedis called.PlacementResult.FAILED: the abstract algorithm will immediately callILcdLabelPlacementEvaluator.noPlacementAppliedand will not try to find other placements for the label.
Override this method to provide a custom implementation.
- Specified by:
createLabelPlacementEvaluatorin classALcdGXYDiscretePlacementsLabelingAlgorithm- Parameters:
aLabelInfoList- the info object that contains all information needed to place the labels.aBoundsConflictChecker- the bounds conflict checker to be used when evaluating label placements.aView- the view- Returns:
- a new LabelPlacementEvaluator
- See Also:
-