Class TLsp3DIconStyle.Builder<B extends TLsp3DIconStyle.Builder<B>>
- All Implemented Interfaces:
ILspEffectsHintStyle.Builder
,ILspWorldElevationStyle.Builder
- Enclosing class:
TLsp3DIconStyle
ScalingMode.SCALE_FACTOR
, with scale factor (icon size) 1
.
Transparency is set to false
.
The default elevation mode is ILspWorldElevationStyle.ElevationMode.ABOVE_ELLIPSOID
If no icon is set using the icon(com.luciad.view.lightspeed.painter.mesh.ILsp3DIcon)
method, a default arrow icon is used
(pointing along the positive Y axis, with a length of 10,000 units).
Examples
Icons with a minimum size when zooming out
When you have 3D icons representing real world objects like for example aircrafts, you typically want:- That the icons have the real-world size of the object when zooming in.
- That the icons remain visible when zooming out so that you can still see the data
minimumPixelSize(int)
method:
TLsp3DIconStyle iconStyle =
TLsp3DIconStyle.newBuilder()
.icon(aPathToIcon)
.iconSizeMode(TLsp3DIconStyle.ScalingMode.WORLD_SCALING)
.worldSize(aWorldSize)//Specify the real dimension of the icon
.minimumPixelSize(10)//ensure that the icon is rendered with at least 10 pixels
.build();
- Since:
- 2012.0
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionSets all builder parameters to the properties of the provided style.build()
Builds the resulting 3D icon style.effectsHints
(ILspEffectsHintStyle.EffectsHint... aEffectsHints) Specifies the effects hints to be added to the style.Specifies the elevation mode.icon
(ILsp3DIcon aIcon) Sets the icon.Sets the icon by providing the path to the source file of an icon.icon
(String aPathToIconFile, ILcdInputStreamFactory aInputStreamFactory) Sets the icon by providing the path to the source file of an icon.iconSizeMode
(TLsp3DIconStyle.ScalingMode aScalingMode) Sets the icon size mode that defines how the icon size should be interpreted.minimumPixelSize
(int aMinimumPixelSize) Sets the minimum icon pixel size.modulationColor
(Color aColor) Sets the color that is modulated with the 3D icon.opacity
(float aOpacity) Sets the opacity (alpha) value for 3D icon.pixelSize
(int aPixelSize) Sets the pixel size of the icon.recenterIcon
(boolean aRecenterIcon) Sets whether or not the icon is recentered at its location.rotate
(double aRotationX, double aRotationY, double aRotationZ) Sets the rotation of the icon around each axis separately.scale
(double aScaleFactor) Sets the scale factor of the icon on all the axis.scale
(double aScaleX, double aScaleY, double aScaleZ) Sets the scale factor of the icon for each axis separately.translate
(double aTranslationX, double aTranslationY, double aTranslationZ) Sets the translation of the icon via each axis.transparent
(boolean aTransparent) Sets whether or not the icon is transparent.verticalOffsetFactor
(double aVerticalOffsetFactor) Sets the vertical offset factor of the icon.worldSize
(double aWorldSize) Sets the world size of the icon.Methods inherited from class com.luciad.view.lightspeed.style.ALspStyle.Builder
equals, hashCode
-
Constructor Details
-
Builder
public Builder()
-
-
Method Details
-
icon
Sets the icon.
LuciadLightspeed assumes that the icon is oriented in a certain way. This is explained in the class javadoc of
TLsp3DIconStyle
.
When the rotation is incorrect, you can adjust it using therotate(double, double, double)
method. In case of a Collada file, you can also opt to adjust the rotation directly in the Collada file. Consult thecom.luciad.format.object3d
package documentation for more information.- Parameters:
aIcon
- the icon to be used- Returns:
this
-
icon
Sets the icon by providing the path to the source file of an icon. The accepted type of files are Collada (.dae), OBJ (.obj) or OpenFlight (.flt) files.
Note that this method will block until the file is decoded. The decoding takes place on the calling thread. As such, it is strongly suggested to not call this method on the Event Dispatch Thread (EDT). Calling it on the EDT would freeze your UI until the decoding is done.
LuciadLightspeed assumes that the icon is oriented in a certain way. This is explained in the class javadoc of
TLsp3DIconStyle
.- Parameters:
aPathToIconFile
- The path to the icon file- Returns:
this
- Throws:
IllegalArgumentException
- in case of an I/O exception during the decoding of the icon file. In such case, the IOException is wrapped in an IllegalArgumentException. The IllegalArgumentException is also thrown whenaPathToIconFile
does not refer to one of the supported file types.- Since:
- 2015.1
- See Also:
-
icon
public B icon(String aPathToIconFile, ILcdInputStreamFactory aInputStreamFactory) throws IllegalArgumentException Sets the icon by providing the path to the source file of an icon. The accepted type of files are Collada (.dae), OBJ (.obj) or OpenFlight (.flt) files.
Only a subset of the features of those formats are supported.
-
Collada data: consult the package documentation of
com.luciad.format.object3d
for more information on the supported Collada features. -
OBJ data: consult the class javadoc of
TLcdOBJMeshDecoder
for more information on the supported OBJ features. -
OpenFlight data: consult the class javadoc of
TLcdOpenFlightFileDecoder
for more information on the supported OpenFlight features.
Note that this method will block until the file is decoded. The decoding takes place on the calling thread. As such, it is strongly suggested to not call this method on the Event Dispatch Thread (EDT). Calling it on the EDT would freeze your UI until the decoding is done.
LuciadLightspeed assumes that the icon is oriented in a certain way. This is explained in the class javadoc of
TLsp3DIconStyle
.- Parameters:
aPathToIconFile
- The path to the icon fileaInputStreamFactory
- the input stream factory to convert the file path to an input stream.- Returns:
this
- Throws:
IllegalArgumentException
- in case of an I/O exception during the decoding of the icon file. In such case, the IOException is wrapped in an IllegalArgumentException. The IllegalArgumentException is also thrown whenaPathToIconFile
does not refer to one of the supported file types.- Since:
- 2015.1
-
Collada data: consult the package documentation of
-
scale
Sets the scale factor of the icon on all the axis. This factor will only be applied if the icon's scaling mode is set toTLsp3DIconStyle.ScalingMode.SCALE_FACTOR
.- Parameters:
aScaleFactor
- the scale factor- Returns:
this
- See Also:
-
scale
Sets the scale factor of the icon for each axis separately. This factor will only be applied if the icon's scaling mode is set toTLsp3DIconStyle.ScalingMode.SCALE_FACTOR
.- Parameters:
aScaleX
- the scale factor on the X axis.aScaleY
- the scale factor on the Y axis.aScaleZ
- the scale factor on the Z axis.- Returns:
this
-
rotate
Sets the rotation of the icon around each axis separately. Each angle is expressed in degrees.- Parameters:
aRotationX
- the counterclockwise rotation angle around the X axisaRotationY
- the counterclockwise rotation angle around the Y axisaRotationZ
- the counterclockwise rotation angle around the Z axis- Returns:
this
- See Also:
-
translate
Sets the translation of the icon via each axis.- Parameters:
aTranslationX
- the translation in the direction of the X axis.aTranslationY
- the translation in the direction of the Y axis.aTranslationZ
- the translation in the direction of the Z axis.
-
worldSize
Sets the world size of the icon. This factor will only be applied if the icon's scaling mode is set toTLsp3DIconStyle.ScalingMode.WORLD_SCALING
.- Parameters:
aWorldSize
- the world size in meters. This size is the maximum of the width, height and length of the icon.- Returns:
this
- See Also:
-
pixelSize
Sets the pixel size of the icon. This factor will only be applied if the icon's scaling mode is set toTLsp3DIconStyle.ScalingMode.VIEW_SCALING
. By default this value is set to 32.- Parameters:
aPixelSize
- the pixel size- Returns:
this
- See Also:
-
minimumPixelSize
Sets the minimum icon pixel size. This size only affects the style if the scaling mode is set toTLsp3DIconStyle.ScalingMode.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
-
verticalOffsetFactor
Sets the vertical offset factor of the icon.Note: the default value is 0.0.
- Parameters:
aVerticalOffsetFactor
- a vertical offset factor- Returns:
this
- See Also:
-
iconSizeMode
Sets the icon size mode that defines how the icon size should be interpreted.- Parameters:
aScalingMode
- the icon size mode- Returns:
this
-
transparent
Sets whether or not the icon is transparent.- Parameters:
aTransparent
- whether or not the icon is transparent- Returns:
this
- See Also:
-
recenterIcon
Sets whether or not the icon is recentered at its location.Note: default value is
true
.- Parameters:
aRecenterIcon
-true
to enable recentering,false
to disable- Returns:
this
- See Also:
-
opacity
Sets the opacity (alpha) value for 3D icon.- Parameters:
aOpacity
- the alpha value. Must be contained in the [0,1] interval (0 is fully transparent, 1 is fully opaque).- Returns:
this
-
modulationColor
Sets the color that is modulated with the 3D 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. The alpha value of the color is also used to determine the opacity of the icon.Using a white color has no effect.
- Parameters:
aColor
- the modulation color- 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
-
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
-
all
Sets all builder parameters to the properties of the provided style.- Specified by:
all
in classALspStyle.Builder<B extends TLsp3DIconStyle.Builder<B>>
- Parameters:
aStyle
- the style to copy- Returns:
this
-
build
Builds the resulting 3D icon style.- Specified by:
build
in classALspStyle.Builder<B extends TLsp3DIconStyle.Builder<B>>
- Returns:
- the resulting 3D icon style using the set parameters
-