Class FeatureCanvas.TextDrawCommand
- All Implemented Interfaces:
AutoCloseable
- Enclosing class:
FeatureCanvas
-
Method Summary
Modifier and TypeMethodDescriptionSets the anchor of the text.void
close()
draped
(boolean draped) Indicates whether or not the text should be draped on top of the terrain.protected void
finalize()
inMeters()
Interpret the text size andoffset
properties
as meters instead of pixels.occlusionMode
(OcclusionMode occlusionMode) Determines when this text should be painted in 3D in relation to other 3D data.orientation
(Azimuth orientation) Sets the azimuth towards which the top side of the text should be oriented.position
(RelativePosition position) Determines the positioning of the text, relative to the anchor.queryable
(boolean queryable) Indicates whether or not the text should be considered when aMap#queryFeatures
is requested.scale
(double scaleFactor) Applies a scale factor to the text size and offsets.void
submit()
Submits this draw command.Sets the text to draw.Sets the text to draw.text
(List<@NotNull String> text, HorizontalAlignment alignment) Sets the text to draw.Sets the styling for the text.zOrder
(int zOrder) The Z-order of the text.
-
Method Details
-
finalize
protected void finalize() -
close
public void close()- Specified by:
close
in interfaceAutoCloseable
-
text
Sets the text to draw.This property is mandatory.
- Parameters:
text
- the text to draw.- Returns:
- this
TextDrawCommand
.
-
text
@NotNull public FeatureCanvas.TextDrawCommand text(@NotNull List<@NotNull String> text, @NotNull HorizontalAlignment alignment) Sets the text to draw.Each element of the vector represents a new line of text to draw.
This property is mandatory.
- Parameters:
text
- the text to draw. Each element of the vector represents a new line of text to draw.alignment
- side where text is aligned. By default text is aligned on the left.- Returns:
- this
TextDrawCommand
.
-
text
Sets the text to draw.Each element of the vector represents a new line of text to draw.
This property is mandatory.
- Parameters:
text
- the text to draw. Each element of the vector represents a new line of text to draw.- Returns:
- this
TextDrawCommand
.
-
anchor
@NotNull public FeatureCanvas.TextDrawCommand anchor(@NotNull Geometry anchor) throws IllegalArgumentException, NullPointerException Sets the anchor of the text.This property is mandatory.
- Parameters:
anchor
- the anchor of the text, cannot benull
. The anchor must be aPoint
.- Returns:
- this
TextDrawCommand
. - Throws:
IllegalArgumentException
- if another geometry than aPoint
is used as anchor.NullPointerException
- if anchor isnull
.
-
position
Determines the positioning of the text, relative to the anchor.The
offset
properties
will be interpreted as device independent pixels ormeters
.This method is optional: if not specified, the default position as defined in
RelativePosition
will be used.- Parameters:
position
- the positioning of the icon, relative to the anchor.- Returns:
- this
IconDrawCommand
.
-
orientation
Sets the azimuth towards which the top side of the text should be oriented.For example, an azimuth of 0 means that the text will be painted upright when the North arrow points upwards, but the text will rotate along when the map is rotated. The anchor point serves as the center of this rotation.
If no orientation is specified, the text will not be oriented and always be displayed with the same angle in view space, independent of how the map is oriented. In order to set the text's rotation in view space, use
position
.- Parameters:
orientation
- the orientation of the text.- Returns:
- this
TextDrawCommand
.
-
textStyle
Sets the styling for the text.This property is optional. See the text style
builder
for the default values.- Parameters:
textStyle
- the styling for the text, cannot benull
.- Returns:
- this
-
draped
Indicates whether or not the text should be draped on top of the terrain.Draping means that the text is painted directly on top of the terrain’s surface relief.
By default, text is not draped.
This setting is only relevant for 3D maps and is ignored for 2D maps.
- Parameters:
draped
- true if the text should be draped over terrain.- Returns:
- this
TextDrawCommand
. - Since:
- 2022.1.04
-
queryable
Indicates whether or not the text should be considered when aMap#queryFeatures
is requested.The default is true.
- Parameters:
queryable
- true if the text should be considered.- Returns:
- this
TextDrawCommand
.
-
zOrder
The Z-order of the text.DrawCommands are painted from lowest to highest Z-order, so DrawCommands with a higher Z-order are painted on top of DrawCommands with a lower Z-order. Note that the Z-order only affects the ordering of features within the same layer. A feature from a certain layer will always get painted above any other feature from a layer that comes lower in the map's layer order, regardless of what Z-order they may have. The default value is 0.
- Parameters:
zOrder
- the Z-order of this text.- Returns:
- this
TextDrawCommand
.
-
scale
@NotNull public FeatureCanvas.TextDrawCommand scale(double scaleFactor) throws IllegalArgumentException Applies a scale factor to the text size and offsets.This method is optional. If it is not called, no scaling will be performed (i.e. a scale of 1.0 is used).
The text size and position on the map is determined using the following methods:
- Parameters:
scaleFactor
- the scale factor to apply to the text size andoffset
properties
.- Returns:
- this
TextDrawCommand
- Throws:
IllegalArgumentException
- if a value equal to or smaller than 0 is provided
-
inMeters
Interpret the text size andoffset
properties
as meters instead of pixels.This method is optional. By default, the size and offsets are interpreted as device independent pixels.
The text size and position on the map is determined using the following methods:
- Returns:
- this
TextDrawCommand
-
occlusionMode
Determines when this text should be painted in 3D in relation to other 3D data.Details and limitations:
- Mode
OcclusionMode#VisibleOnly
shows only the part of the text that is not obscured by other 3D data. This is the default. - Mode
OcclusionMode#AlwaysVisible
shows the entire text even if behind other 3D data. The text will appear in front of other objects. - Mode
OcclusionMode#OccludedOnly
shows only the part of the text that is behind other 3D data. You typically use this to display obscured text in combination with another style that usesOcclusionMode#VisibleOnly
mode. - This parameter is only relevant in 3D. It is ignored on a 2D map.
- This parameter is only applied on non-draped text.
The default is
OcclusionMode#VisibleOnly
.- Parameters:
occlusionMode
- the occlusion mode to use- Returns:
- this
TextDrawCommand
- Since:
- 2024.0
- Mode
-
submit
Submits this draw command.Nothing will be painted if the draw command is not submitted.
- Throws:
IllegalStateException
- when there are missing icon command calls or the command is already submitted.
-