public static class TLsp3DIconStyle.Builder<B extends TLsp3DIconStyle.Builder<B>> extends ALspStyle.Builder<B> implements ILspEffectsHintStyle.Builder, ILspWorldElevationStyle.Builder
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).
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();
Constructor and Description |
---|
Builder() |
Modifier and Type | Method and Description |
---|---|
B |
all(ALspStyle aStyle)
Sets all builder parameters to the properties of the
provided style.
|
TLsp3DIconStyle |
build()
Builds the resulting 3D icon style.
|
B |
effectsHints(ILspEffectsHintStyle.EffectsHint... aEffectsHints)
Specifies the effects hints to be added to the style.
|
B |
elevationMode(ILspWorldElevationStyle.ElevationMode aMode)
Specifies the elevation mode.
|
B |
icon(ILsp3DIcon aIcon)
Sets the icon.
|
B |
icon(String aPathToIconFile)
Sets the icon by providing the path to the source file of an icon.
|
B |
icon(String aPathToIconFile,
ILcdInputStreamFactory aInputStreamFactory)
Sets the icon by providing the path to the source file of an icon.
|
B |
iconSizeMode(TLsp3DIconStyle.ScalingMode aScalingMode)
Sets the icon size mode that defines how the
icon size should be interpreted.
|
B |
minimumPixelSize(int aMinimumPixelSize)
Sets the minimum icon pixel size.
|
B |
modulationColor(Color aColor)
Sets the color that is modulated with the 3D icon.
|
B |
opacity(float aOpacity)
Sets the opacity (alpha) value for 3D icon.
|
B |
pixelSize(int aPixelSize)
Sets the pixel size of the icon.
|
B |
recenterIcon(boolean aRecenterIcon)
Sets whether or not the icon is recentered at its location.
|
B |
rotate(double aRotationX,
double aRotationY,
double aRotationZ)
Sets the rotation of the icon around each axis separately.
|
B |
scale(double aScaleFactor)
Sets the scale factor of the icon on all the axis.
|
B |
scale(double aScaleX,
double aScaleY,
double aScaleZ)
Sets the scale factor of the icon for each axis separately.
|
B |
translate(double aTranslationX,
double aTranslationY,
double aTranslationZ)
Sets the translation of the icon via each axis.
|
B |
transparent(boolean aTransparent)
Sets whether or not the icon is transparent.
|
B |
verticalOffsetFactor(double aVerticalOffsetFactor)
Sets the vertical offset factor of the icon.
|
B |
worldSize(double aWorldSize)
Sets the world size of the icon.
|
equals, hashCode
public B icon(ILsp3DIcon aIcon)
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 the rotate(double, double, double)
method.
In case of a Collada file, you can also opt to adjust the rotation directly in the Collada file.
Consult the com.luciad.format.object3d
package documentation for more information.
aIcon
- the icon to be usedthis
public B icon(String aPathToIconFile) 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.
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
.
aPathToIconFile
- The path to the icon filethis
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 when aPathToIconFile
does not
refer to one of the supported file types.icon(String, ILcdInputStreamFactory)
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.
com.luciad.format.object3d
for
more information on the supported Collada features.
TLcdOBJMeshDecoder
for more information
on the supported OBJ features.
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
.
aPathToIconFile
- The path to the icon fileaInputStreamFactory
- the input stream factory to convert the file path to an input stream.this
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 when aPathToIconFile
does not
refer to one of the supported file types.public B scale(double aScaleFactor)
TLsp3DIconStyle.ScalingMode.SCALE_FACTOR
.aScaleFactor
- the scale factorthis
TLsp3DIconStyle.ScalingMode
public B scale(double aScaleX, double aScaleY, double aScaleZ)
TLsp3DIconStyle.ScalingMode.SCALE_FACTOR
.aScaleX
- the scale factor on the X axis.aScaleY
- the scale factor on the Y axis.aScaleZ
- the scale factor on the Z axis.this
public B rotate(double aRotationX, double aRotationY, double aRotationZ)
aRotationX
- the counterclockwise rotation angle around the X axisaRotationY
- the counterclockwise rotation angle around the Y axisaRotationZ
- the counterclockwise rotation angle around the Z axisthis
ILcd3DOriented
,
ILcdOriented
public B translate(double aTranslationX, double aTranslationY, double aTranslationZ)
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.public B worldSize(double aWorldSize)
TLsp3DIconStyle.ScalingMode.WORLD_SCALING
.aWorldSize
- the world size in meters.
This size is the maximum of the width, height and length of the icon.this
TLsp3DIconStyle.ScalingMode
public B pixelSize(int aPixelSize)
TLsp3DIconStyle.ScalingMode.VIEW_SCALING
.
By default this value is set to 32.aPixelSize
- the pixel sizethis
TLsp3DIconStyle.ScalingMode
public B minimumPixelSize(int aMinimumPixelSize)
TLsp3DIconStyle.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.aMinimumPixelSize
- the minimum pixel sizethis
public B verticalOffsetFactor(double aVerticalOffsetFactor)
Note: the default value is 0.0.
aVerticalOffsetFactor
- a vertical offset factorthis
TLsp3DIconStyle.getVerticalOffsetFactor()
public B iconSizeMode(TLsp3DIconStyle.ScalingMode aScalingMode)
aScalingMode
- the icon size modethis
public B transparent(boolean aTransparent)
aTransparent
- whether or not the icon is transparentthis
TLsp3DIconStyle.isTransparent()
public B recenterIcon(boolean aRecenterIcon)
Note: default value is true
.
aRecenterIcon
- true
to enable recentering, false
to disablethis
TLsp3DIconStyle.isRecenterIcon()
public B opacity(float aOpacity)
aOpacity
- the alpha value.
Must be contained in the [0,1] interval (0 is fully transparent, 1 is fully opaque).this
public B modulationColor(Color aColor)
Using a white color has no effect.
aColor
- the modulation colorthis
public B effectsHints(ILspEffectsHintStyle.EffectsHint... aEffectsHints)
ILspEffectsHintStyle.Builder
effectsHints
in interface ILspEffectsHintStyle.Builder
aEffectsHints
- the effects hints to be added to the stylethis
public B elevationMode(ILspWorldElevationStyle.ElevationMode aMode)
ILspWorldElevationStyle.Builder
elevationMode
in interface ILspWorldElevationStyle.Builder
this
public B all(ALspStyle aStyle)
all
in class ALspStyle.Builder<B extends TLsp3DIconStyle.Builder<B>>
aStyle
- the style to copythis
public TLsp3DIconStyle build()
build
in class ALspStyle.Builder<B extends TLsp3DIconStyle.Builder<B>>