Class TLspLabelLocationProvider
This label location provider offers a set of possible locations based on the cardinal (N, E, S, W) and inter-cardinal (NE, SE, SW, NW) directions.
- Since:
- 2012.0
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic enumPossible locations that are based on the cardinal and inter-cardinal directions. -
Constructor Summary
ConstructorsConstructorDescriptionTLspLabelLocationProvider(int aShiftX, int aShiftY, double aRotation, TLspLabelLocationProvider.Location... aLocations) Creates a new location provider with the given x and y shift, the given possibleTLspLabelLocationProvider.Locations and a given rotation.TLspLabelLocationProvider(int aShiftX, int aShiftY, TLspLabelLocationProvider.Location... aLocations) Creates a new location provider with the given x and y shift, the given possibleTLspLabelLocationProvider.Locations and a rotation of 0.TLspLabelLocationProvider(int aShift, TLspLabelLocationProvider.Location... aLocations) Creates a new location provider with the given shift, the given possibleTLspLabelLocationProvider.Locations and a rotation of 0.TLspLabelLocationProvider(TLspLabelLocationProvider.Location... aLocations) Creates a new location provider with default shift 2, the given possibleTLspLabelLocationProvider.Locations and a rotation of 0. -
Method Summary
Modifier and TypeMethodDescriptiondoublecalculateLocation(int aLocationIndex, TLspLabelID aLabel, ILcdPoint aObjectAnchorPoint, Dimension2D aDimension, TLspContext aContext, ILcd3DEditablePoint aUpperLeftPointSFCT) Returns the rotation and calculates the upper left corner of the bounds for the given domain object and sublabel ID, given the dimension.booleanAn object is considered equal to this shape if it has the same class.intgetMaxLocationCount(TLspLabelID aLabel, TLspPaintState aPaintState, ILspLabelingAlgorithm.LabelContext aLabelContext, ILspView aView) Returns the maximal number of locations to be tried for the given label.inthashCode()The hash code of this shape is the hash code of its class, in order to be consistent with theALspStampLabelLocationProvider.equals(Object)method.protected booleanisValidLocation(TLspLabelID aLabelID, ILcdPoint aObjectAnchorPoint, Dimension2D aDimension, TLspContext aContext, ILcdPoint aUpperLeftPoint, double aRotation) Checks if the given upper left point and rotation are valid.toString()Methods inherited from class com.luciad.view.lightspeed.label.algorithm.ALspStampLabelLocationProvider
getLocation, isValidLocation
-
Constructor Details
-
TLspLabelLocationProvider
Creates a new location provider with default shift 2, the given possible
TLspLabelLocationProvider.Locations and a rotation of 0.If no locations are passed, all locations are considered possible.
- Parameters:
aLocations- the possible locations
-
TLspLabelLocationProvider
Creates a new location provider with the given shift, the given possible
TLspLabelLocationProvider.Locations and a rotation of 0.If no locations are passed, all locations are considered possible.
- Parameters:
aShift- the label offset (x and y), in pixelsaLocations- the allowed positions
-
TLspLabelLocationProvider
public TLspLabelLocationProvider(int aShiftX, int aShiftY, TLspLabelLocationProvider.Location... aLocations) Creates a new location provider with the given x and y shift, the given possible
TLspLabelLocationProvider.Locations and a rotation of 0.If no locations are passed, all locations are considered possible.
- Parameters:
aShiftX- the label x offset, in pixelsaShiftY- the label y offset, in pixelsaLocations- the allowed positions
-
TLspLabelLocationProvider
public TLspLabelLocationProvider(int aShiftX, int aShiftY, double aRotation, TLspLabelLocationProvider.Location... aLocations) Creates a new location provider with the given x and y shift, the given possible
TLspLabelLocationProvider.Locations and a given rotation.If no locations are passed, all locations are considered possible.
- Parameters:
aShiftX- the label x offset, in pixelsaShiftY- the label y offset, in pixelsaRotation- the rotation of the labelaLocations- the allowed positions
-
-
Method Details
-
getMaxLocationCount
public int getMaxLocationCount(TLspLabelID aLabel, TLspPaintState aPaintState, ILspLabelingAlgorithm.LabelContext aLabelContext, ILspView aView) Description copied from class:ALspLabelLocationProviderReturns 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 thegetLocationmethod can create the same number of locations as returned by this method. By default, this method returns1.- Overrides:
getMaxLocationCountin classALspLabelLocationProvider- 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.
-
calculateLocation
public double calculateLocation(int aLocationIndex, TLspLabelID aLabel, ILcdPoint aObjectAnchorPoint, Dimension2D aDimension, TLspContext aContext, ILcd3DEditablePoint aUpperLeftPointSFCT) throws TLcdNoBoundsException Description copied from class:ALspStampLabelLocationProviderReturns the rotation and calculates the upper left corner of the bounds for the given domain object and sublabel ID, given the dimension.- Specified by:
calculateLocationin classALspStampLabelLocationProvider- Parameters:
aLocationIndex- the location index, can be a number from0togetMaxLocationCount.aLabel- the label for which a location should be calculated.aObjectAnchorPoint- the object anchor point for the given label, in view coordinates.aDimension- the dimension of the label.aContext- the context.aUpperLeftPointSFCT- the point in which the upper left corner of the label bounds should be stored. The upper left corner of the label should be specified in view coordinates.- Returns:
- the rotation of the label in radians, clockwise, 0 radians at 3 o'clock. The rotation is relative to the view rotation.
- Throws:
TLcdNoBoundsException- when the rotation or upper left corner could not be calculated.
-
isValidLocation
protected boolean isValidLocation(TLspLabelID aLabelID, ILcdPoint aObjectAnchorPoint, Dimension2D aDimension, TLspContext aContext, ILcdPoint aUpperLeftPoint, double aRotation) Description copied from class:ALspStampLabelLocationProviderChecks if the given upper left point and rotation are valid. This check should be used if thecalculateLocationmethod is capable of producing the given point and rotation. 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 returnstrue.- Overrides:
isValidLocationin classALspStampLabelLocationProvider- Parameters:
aLabelID- the labelaObjectAnchorPoint- the object anchor point for the given label, in view coordinates.aDimension- the dimension of the label.aContext- the context.aUpperLeftPoint- the upper left corner of the labelaRotation- the rotation- Returns:
- if the given upper left point and rotation are valid.
-
toString
-
equals
Description copied from class:ALspStampLabelLocationProviderAn object is considered equal to this shape if it has the same class. Extensions should refine this comparison, based on their properties.- Overrides:
equalsin classALspStampLabelLocationProvider
-
hashCode
public int hashCode()Description copied from class:ALspStampLabelLocationProviderThe hash code of this shape is the hash code of its class, in order to be consistent with theALspStampLabelLocationProvider.equals(Object)method. Extensions should refine this implementation, based on their properties.- Overrides:
hashCodein classALspStampLabelLocationProvider
-