public class TLcdNoDeclutterLabelConflictChecker extends Object implements ILcdLabelConflictChecker
ILcdLabelConflictChecker
doesn't check if label placements overlap with
other label placements. It does check if labels overlap with label obstacles or the view. The
latter is done using the delegate ILcdLabelConflictChecker
that can be set in the
constructor. This delegate should never be a TLcdNoDeclutterLabelConflictChecker
.ILcdLabelConflictChecker.Conflict
Constructor and Description |
---|
TLcdNoDeclutterLabelConflictChecker(ILcdLabelConflictChecker aDelegate)
Creates an new
TLcdNoDeclutterLabelConflictChecker using the given delegate
ILcdLabelConflictChecker used for finding conflicts with label obstacles
or the view bounds. |
Modifier and Type | Method and Description |
---|---|
void |
addLabelObstacle(TLcdLabelObstacle aLabelObstacle)
Add the given obstacle to this label conflict checker.
|
void |
addLabelPlacement(TLcdLabelPlacement aPlacement)
Add the given label placement to this label conflict checker.
|
TLcdNoDeclutterLabelConflictChecker |
clone()
Makes
Object.clone() public. |
ILcdLabelConflictChecker.Conflict |
getConflict(TLcdLabelPlacement aPlacement)
Checks if the given label placement is valid, i.e. if it doesn't overlap with already added
label placements or label obstacles.
|
List<TLcdLabelObstacle> |
getLabelObstacles()
Returns all label obstacles that were added to (and not removed from) this conflict checker.
|
List<TLcdLabelPlacement> |
getLabelPlacements()
Returns all label placements that were added to (and not removed from) this conflict checker.
|
void |
removeLabelObstacle(TLcdLabelObstacle aLabelObstacle)
Removes the given obstacle from the conflict checker.
|
void |
removeLabelPlacement(TLcdLabelPlacement aPlacement)
Removes the given label placement from the conflict checker.
|
void |
reset(Rectangle aViewBounds)
Resets the conflict checker.
|
public TLcdNoDeclutterLabelConflictChecker(ILcdLabelConflictChecker aDelegate)
TLcdNoDeclutterLabelConflictChecker
using the given delegate
ILcdLabelConflictChecker
used for finding conflicts with label obstacles
or the view bounds.aDelegate
- a delegate ILcdLabelConflictChecker
.public TLcdNoDeclutterLabelConflictChecker clone()
ILcdCloneable
Makes Object.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 );
}
}
clone
in interface ILcdCloneable
clone
in class Object
Object.clone()
public void reset(Rectangle aViewBounds)
ILcdLabelConflictChecker
reset
in interface ILcdLabelConflictChecker
aViewBounds
- the view bounds.public void addLabelObstacle(TLcdLabelObstacle aLabelObstacle)
ILcdLabelConflictChecker
getConflict
method can use the given obstacle to detect conflicts.
After calling this method, it is possible that this bounds conflict checker keeps a reference to the given obstacle. By consequence, the given obstacle should not be changed outside this method. The given obstacle cannot be changed inside this method.
Adding the same obstacle instance twice should have the exact same effect as adding the obstacle instance only once.
addLabelObstacle
in interface ILcdLabelConflictChecker
aLabelObstacle
- an obstacle.public void removeLabelObstacle(TLcdLabelObstacle aLabelObstacle)
ILcdLabelConflictChecker
addLabelObstacle
.
After calling this method, it is possible that this bounds conflict checker keeps a reference to the given obstacle. By consequence, the given obstacle should never be changed outside this method. The given obstacle cannot be changed inside this method.
removeLabelObstacle
in interface ILcdLabelConflictChecker
aLabelObstacle
- a label obstacle.public List<TLcdLabelObstacle> getLabelObstacles()
ILcdLabelConflictChecker
getLabelObstacles
in interface ILcdLabelConflictChecker
public void addLabelPlacement(TLcdLabelPlacement aPlacement)
ILcdLabelConflictChecker
getConflict
method can use the given placement to detect conflicts.
After calling this method, it is possible that this bounds conflict checker keeps a reference to the given label placement. By consequence, the bounds information in the given placement should not be changed outside this method. The given label placement cannot be changed inside this method.
Adding the same label placement instance twice should have the exact same effect as adding the label placement instance only once.
addLabelPlacement
in interface ILcdLabelConflictChecker
aPlacement
- a label placement.public void removeLabelPlacement(TLcdLabelPlacement aPlacement)
ILcdLabelConflictChecker
addLabelPlacement
.
After calling this method, it is possible that this bounds conflict checker keeps a reference to the given label placement. By consequence, the bounds inside the given label placement should never be changed outside this method. The given bounds cannot be changed inside this method.
removeLabelPlacement
in interface ILcdLabelConflictChecker
aPlacement
- a label placement.public List<TLcdLabelPlacement> getLabelPlacements()
ILcdLabelConflictChecker
getLabelPlacements
in interface ILcdLabelConflictChecker
public ILcdLabelConflictChecker.Conflict getConflict(TLcdLabelPlacement aPlacement)
ILcdLabelConflictChecker
When no conflict is found, the returned Conflict
should be null
.
getConflict
in interface ILcdLabelConflictChecker
aPlacement
- a label placement.null
if no conflict was found.