Package com.luciad.view.lightspeed.style
Class TLspIconStyle.Builder<B extends TLspIconStyle.Builder<B>>
java.lang.Object
com.luciad.view.lightspeed.style.ALspStyle.Builder<B>
com.luciad.view.lightspeed.style.TLspIconStyle.Builder<B>
- All Implemented Interfaces:
ILspEffectsHintStyle.Builder
,ILspWorldElevationStyle.Builder
- Enclosing class:
TLspIconStyle
public static class TLspIconStyle.Builder<B extends TLspIconStyle.Builder<B>>
extends ALspStyle.Builder<B>
implements ILspWorldElevationStyle.Builder, ILspEffectsHintStyle.Builder
Builder for icon styles. The default icon style has a white color and scale
factor 1, offsets 0, and uses
ILspWorldElevationStyle.ElevationMode.OBJECT_DEPENDENT
.
Use the icon(com.luciad.gui.ILcdIcon)
method to set a valid icon.
Example usages:
To create an icon style using an image as an icon: TLspIconStyle iconStyle = TLspIconStyle.newBuilder().icon(new TLcdImageIcon(pathToImage)).build();
To create an icon style using a symbol as an icon: TLspIconStyle iconStyle = TLspIconStyle.newBuilder().icon(new TLcdSymbol(TLcdSymbol.CIRCLE)).build();
To style objects based its properties use TLspParameterizedIconStyle
- Since:
- 2012.0
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionSets all builder parameters to the properties of the provided style.build()
Builds the icon style with the set parameters.effectsHints
(ILspEffectsHintStyle.EffectsHint... aEffectsHints) Specifies the effects hints to be added to the style.Specifies the elevation mode.Sets the icon.minimumPixelSize
(int aMinimumPixelSize) Sets the minimum icon pixel size.modulationColor
(Color aColor) Sets the color that is modulated with the icon.offset
(double aOffsetX, double aOffsetY) Sets icon offsets in 2D view coordinates.opacity
(float aOpacity) Sets the opacity of the modulation color.scale
(double aScaleFactor) Sets the scale factor.scalingMode
(TLspIconStyle.ScalingMode aScalingMode) Sets the scaling mode of the icons.toString()
useOrientation
(boolean aOrientationEnabled) Sets whether the icon should respect its orientation.worldSize
(double aWorldSize) Sets the icon size in meters.zOrder
(int aZOrder) Sets the Z-order of this style.Methods inherited from class com.luciad.view.lightspeed.style.ALspStyle.Builder
equals, hashCode
-
Constructor Details
-
Builder
public Builder()
-
-
Method Details
-
zOrder
Sets the Z-order of this style. Styles should be painted from lowest to highest Z-order. Increasing the number of different Z-orders can negatively impact painting performance. By default, it is set to 0.- Parameters:
aZOrder
- the z order- Returns:
this
-
icon
Sets the icon. If the icon is an ILcdAnchoredIcon, the anchor point will automatically become the point of rotation, as well as the anchor point of the icon in the view. This icon should never be modified. To change the icon you should create a new style with a different icon instance. This method throws an exception when the given icon isnull
. Useful implementations are for exampleTLcdSymbol
, orTLcdImageIcon
.- Parameters:
aIcon
- the icon- Returns:
this
-
useOrientation
Sets whether the icon should respect its orientation. By default, this is set to false. The actual orientation that is applied to the icon will be retrieved from theILcdOriented
interface. Either the geometry returned by theALspStyleTargetProvider
or the model object should implement this interface. The geometry takes precedence if both objects implement this interface. The orientation is interpreted as an azimuth.- Parameters:
aOrientationEnabled
- a flag indicating whether or not the icon should respect its orientation- Returns:
this
-
scale
Sets the scale factor.- Parameters:
aScaleFactor
- the scale factor- Returns:
this
-
offset
Sets icon offsets in 2D view coordinates. This offset is applied after all other transformations have been applied. In other words: Scaling and rotation are applied first. Then this offset is done as a post-effect.
To support anchored icons, and rotations of icons around a specific point in the icon, please supply the icon(com.luciad.gui.ILcdIcon) method with an
ILcdAnchoredIcon
.- Parameters:
aOffsetX
- the offset in X directionaOffsetY
- the offset in Y direction- Returns:
this
;- See Also:
-
modulationColor
Sets the color that is modulated with the icon. For example using an icon with gray-scale colors and a red modulation color will result in a resulting painted icon with red hues.Using a white color has no effect.
- Parameters:
aColor
- the modulation color- Returns:
this
-
worldSize
Sets the icon size in meters. This size only affects the style if the scaling mode is set toScalingMode.WORLD_SCALING
orScalingMode.WORLD_SCALING_CLAMPED
. The world size is applied to the width of the icon. I.e. when the icon is not square, the width will correspond to this world size, but the height will not. By default this is set to 50000m.- Parameters:
aWorldSize
- a positive number expressing the icon size in meters.- Returns:
this
-
scalingMode
Sets the scaling mode of the icons. By default this is set toScalingMode.VIEW_SCALING
.- Parameters:
aScalingMode
- a scaling mode- Returns:
this
-
opacity
Sets the opacity of the modulation color. This can also be achieved by setting the color with opacity directly.- Parameters:
aOpacity
- the alpha value. Must be contained in the [0,1] interval (0 is fully transparent, 1 is fully opaque).- Returns:
this
-
elevationMode
Description copied from interface:ILspWorldElevationStyle.Builder
Specifies the elevation mode. The default mode depends on the specific implementation.- Specified by:
elevationMode
in interfaceILspWorldElevationStyle.Builder
- Parameters:
aMode
-- Returns:
this
-
effectsHints
Description copied from interface:ILspEffectsHintStyle.Builder
Specifies the effects hints to be added to the style.- Specified by:
effectsHints
in interfaceILspEffectsHintStyle.Builder
- Parameters:
aEffectsHints
- the effects hints to be added to the style- Returns:
this
-
minimumPixelSize
Sets the minimum icon pixel size. This size only affects the style if the scaling mode is set toScalingMode.WORLD_SCALING_CLAMPED
orScalingMode.WORLD_SCALING
. As soon as the largest dimension (i.e. width or height) of the icon is smaller than this minimum pixel size, the icon will be scaled to satisfy this minimum size. By default this value is set to 0, which indicates that no minimum size will be enforced.- Parameters:
aMinimumPixelSize
- the minimum pixel size- Returns:
this
-
all
Sets all builder parameters to the properties of the provided style.- Specified by:
all
in classALspStyle.Builder<B extends TLspIconStyle.Builder<B>>
- Parameters:
aStyle
- the style to copy- Returns:
this
-
build
Builds the icon style with the set parameters.- Specified by:
build
in classALspStyle.Builder<B extends TLspIconStyle.Builder<B>>
- Returns:
- the resulting icon style
-
toString
-