public static class TLspLineStyle.Builder<B extends TLspLineStyle.Builder<B>> extends ALspStyle.Builder<B> implements ILspTexturedStyle.Builder, ILspEffectsHintStyle.Builder, ILspWorldElevationStyle.Builder
ILspWorldElevationStyle.ElevationMode.OBJECT_DEPENDENT
and not blended together when multiple lines overlap.
Example usages:
To create the default line style: TLspLineStyle whiteOnePixelNotDraped = TLspLineStyle.newBuilder().build();
To create a 4-pixel wide red line style for shapes that are draped:TLspLineStyle redFourPixelsDraped = TLspLineStyle.newBuilder().color(Color.red).lineWidth(4f).elevationMode(ON_TERRAIN).build();
To style objects based its properties use TLspParameterizedLineStyle
Modifier | Constructor and Description |
---|---|
protected |
Builder()
Default constructor.
|
Modifier and Type | Method and Description |
---|---|
B |
all(ALspStyle aLineStyle)
Sets all parameters on the builder based on the given style.
|
B |
blendOverlap(boolean aBlendOverlap)
Deprecated.
|
B |
blendOverlap(TLspLineStyle.BlendOverlapMode aBlendOverlap)
Sets whether different lines that are painted with the same style and
that cover the same pixels are blended together or not.
|
TLspLineStyle |
build()
Builds the style with the set parameters.
|
B |
color(Color aColor)
Sets the color.
|
B |
dashPattern(TLspLineStyle.DashPattern aDashPattern)
Sets the dash pattern.
|
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 |
opacity(float aOpacity)
Sets the opacity (alpha) value for the color.
|
B |
pixelOffset(double aPixels)
Sets the offset in pixels.
|
B |
repeatTexture(boolean aRepeatTexture)
Specifies whether the texture map should be repeated (tiled) or not.
|
B |
rotateTexture(double aAlpha)
Rotates the texture.
|
B |
scaleTexture(double aSX,
double aSY,
double aSZ)
Scales the texture.
|
B |
texture(RenderedImage aTexture)
Specifies the image to be used as a texture map.
|
B |
textureCoordinatesMode(ILspTexturedStyle.TextureCoordinatesMode aMode)
Specifies whether the texture coordinates computed to apply the texture map should be
relative to the bounds of the object or not.
|
B |
textureInterpolationType(ELcdInterpolationType aInterpolationType)
Specifies whether linear or nearest neighbor interpolation should be
used for the texture.
|
B |
textureMatrix(double[] aTextureMatrix)
Specifies the 4x4 matrix that should be applied to the texture coordinates when mapping the
texture given by this style.
|
B |
textureObject(ALsp2DTextureObject aTextureObject)
Specifies the texture object to be used.
|
String |
toString() |
B |
translateTexture(double aDX,
double aDY,
double aDZ)
Translates the textures.
|
B |
width(double aLineWidth)
Sets the line width (pixels).
|
B |
zOrder(int aZOrder)
Sets the Z-order of this style.
|
equals, hashCode
public B color(Color aColor)
null
.aColor
- the colorthis
IllegalArgumentException
- if aColor==null
public B opacity(float aOpacity)
color(...)
method.
However, this method leaves the RGB values intact and only
modifies the alpha value. Note that, the other way around,
the color(...)
method does override the set alpha value.aOpacity
- the alpha value.
Must be contained in the [0,1] interval (0 is fully transparent, 1 is fully opaque).this
public B width(double aLineWidth)
aLineWidth
- the line widththis
public B zOrder(int aZOrder)
aZOrder
- the z orderthis
public B pixelOffset(double aPixels)
aPixels
from the original geometry. By default, no offset is
used.
A positive offset will result in a line that is painted to the left of
the original line, or on the outside of the original polygon/ring. A
negative offset will paint the line to the right or on the inside.aPixels
- an offset in pixels.this
@Deprecated public B blendOverlap(boolean aBlendOverlap)
blendOverlap(TLspLineStyle.BlendOverlapMode)
When set to false
, all pixels covered will receive the same
color, even if this color is transparent and if multiple lines cover the
same pixel. If set to true
, overlapping (transparent) lines will
be blended together resulting in a less transparent color at their
crossings.
For example, when painting street data, you do not want the color to
change at a crossroad. In that case, you would set this parameter to
false
to ensure that different streets are not blended together.
When painting 3D trajectories however, you do want to accumulate the
transparent color of overlapping trajectories. In that case, set this
parameter to true
.
The default value is false
.
aBlendOverlap
- whether or not overlapping lines are blended togetherthis
public B blendOverlap(TLspLineStyle.BlendOverlapMode aBlendOverlap)
When set to BlendOverlapMode#NEVER
, all pixels covered will
receive the same color, even if this color is transparent and if multiple
lines cover the same pixel. If set to BlendOverlapMode#ALWAYS
,
overlapping (transparent) lines will be blended together resulting in a
less transparent color at their crossings.
Finally the BlendOverlapMode#AUTO
chooses the mode that gives the
best results depending on the context. For instance, lines that are not
draped in a 3D view should be blended. Lines that are draped, or painted
in a 2D view will not be blended.
For example, when painting street data, you do not want the color to
change at a crossroad. In that case, you would set this parameter to
BlendOverlapMode#NEVER
to ensure that different streets are not
blended together.
When painting 3D trajectories however, you do want to accumulate the
transparent color of overlapping trajectories. In that case, set this
parameter to BlendOverlapMode#ALWAYS
.
In both cases, you can also use BlendOverlapMode#AUTO
. You only
need to explicitly set the mode in case the automatic mode does not
produce the desired result.
The default value is BlendOverlapMode#AUTO
.
aBlendOverlap
- whether or not overlapping lines are blended togetherthis
public B elevationMode(ILspWorldElevationStyle.ElevationMode aMode)
ILspWorldElevationStyle.Builder
elevationMode
in interface ILspWorldElevationStyle.Builder
this
public B texture(RenderedImage aTexture)
ILspTexturedStyle.Builder
ILspTexturedStyle.Builder.textureObject(ALsp2DTextureObject)
can be used.
This image should never be modified. To change the texture you should create a new style with
a different image instance.
If a texture object was set via ILspTexturedStyle.Builder.textureObject(ALsp2DTextureObject)
before calling this,
it will be replaced by a texture created from the image.texture
in interface ILspTexturedStyle.Builder
aTexture
- the image to be used as a texture mapthis
public B textureObject(ALsp2DTextureObject aTextureObject)
ILspTexturedStyle.Builder
ILspTexturedStyle.Builder.texture(RenderedImage)
can be used.
To change the texture you should create a new style with a different texture object instance.
If an image to be used as a texture was set via ILspTexturedStyle.Builder.texture(RenderedImage)
before calling this,
it will be replaced by this texture.textureObject
in interface ILspTexturedStyle.Builder
aTextureObject
- the texture object.this
public B repeatTexture(boolean aRepeatTexture)
ILspTexturedStyle.Builder
repeatTexture
in interface ILspTexturedStyle.Builder
aRepeatTexture
- whether the texture map should be repeated (tiled) or notthis
public B textureInterpolationType(ELcdInterpolationType aInterpolationType)
ILspTexturedStyle.Builder
textureInterpolationType
in interface ILspTexturedStyle.Builder
aInterpolationType
- the interpolation method to use for the texture (note that CUBIC
is not currently supported)this
public B textureCoordinatesMode(ILspTexturedStyle.TextureCoordinatesMode aMode)
ILspTexturedStyle.Builder
textureCoordinatesMode
in interface ILspTexturedStyle.Builder
aMode
- specifies whether the texture coordinates computed to apply the texture map should be
relative to the bounds of the object or correspond to the object's model coordinates.this
public B scaleTexture(double aSX, double aSY, double aSZ)
ILspTexturedStyle.Builder
scaleTexture
in interface ILspTexturedStyle.Builder
aSX
- amount by which the x-coordinates of the texture are scaledaSY
- amount by which the x-coordinates of the texture are scaledaSZ
- amount by which the x-coordinates of the texture are scaledthis
public B rotateTexture(double aAlpha)
ILspTexturedStyle.Builder
rotateTexture
in interface ILspTexturedStyle.Builder
aAlpha
- the amount by which the texture is rotated, in radians.this
public B translateTexture(double aDX, double aDY, double aDZ)
ILspTexturedStyle.Builder
translateTexture
in interface ILspTexturedStyle.Builder
aDX
- amount by which the x-coordinates of the texture are translatedaDY
- amount by which the y-coordinates of the texture are translatedaDZ
- amount by which the z-coordinates of the texture are translatedthis
public B textureMatrix(double[] aTextureMatrix)
ILspTexturedStyle.Builder
textureMatrix
in interface ILspTexturedStyle.Builder
aTextureMatrix
- Specifies the 4x4 matrix that should be applied to the texture coordinates when
mapping the texture given by this stylethis
ILspTexturedStyle.Builder.translateTexture(double, double, double)
,
ILspTexturedStyle.Builder.rotateTexture(double)
public B dashPattern(TLspLineStyle.DashPattern aDashPattern)
aDashPattern
- a dash pattern. Must not be null
this
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 all(ALspStyle aLineStyle)
ALspStyle.Builder
all
in class ALspStyle.Builder<B extends TLspLineStyle.Builder<B>>
aLineStyle
- the style to copythis
public TLspLineStyle build()
ALspStyle.Builder
build
in interface ILspTexturedStyle.Builder
build
in class ALspStyle.Builder<B extends TLspLineStyle.Builder<B>>