Class FeatureCanvas.IconDrawCommand
- All Implemented Interfaces:
AutoCloseable
- Enclosing class:
FeatureCanvas
-
Method Summary
Modifier and TypeMethodDescriptionSets the anchor of the icon.void
close()
draped
(boolean draped) Indicates whether or not the icon should be draped on top of the terrain.protected void
finalize()
Specifies the icon to draw.inMeters()
Interpret the icon size andoffset
properties
as meters instead of pixels.occlusionMode
(OcclusionMode occlusionMode) Determines when this icon should be painted in 3D in relation to other 3D data.orientation
(Azimuth orientation) Sets the azimuth towards which the top side of the icon should be oriented.position
(RelativePosition position) Determines the positioning of the icon, relative to the anchor.queryable
(boolean queryable) Indicates whether or not the icon should be considered when aMap#queryFeatures
is requested.scale
(double scaleFactor) Applies a scale factor to the icon's size and offsets.size
(double width, double height) This method overrides the size of the specifiedicon
.void
submit()
Submits this draw command.zOrder
(int zOrder) The Z-order of the icon.
-
Method Details
-
finalize
protected void finalize() -
close
public void close()- Specified by:
close
in interfaceAutoCloseable
-
icon
Specifies the icon to draw.For the best performance, reuse the same
IIcon
instance when calling this function multiple times.- Parameters:
icon
- the icon to draw, cannot benull
.- Returns:
- this
IconDrawCommand
. - Throws:
NullPointerException
- when the icon isnull
.
-
anchor
@NotNull public FeatureCanvas.IconDrawCommand anchor(@NotNull Geometry anchor) throws IllegalArgumentException, NullPointerException Sets the anchor of the icon.This property is mandatory. the anchor must be a
Point
.- Parameters:
anchor
- the anchor of the icon, cannot benull
.- Returns:
- this
IconDrawCommand
. - Throws:
IllegalArgumentException
- if another geometry than aPoint
is used as anchor.NullPointerException
- if anchor isnull
.
-
position
Determines the positioning of the icon, relative to the anchor.The
offset
properties
will be interpreted as 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 icon should be oriented.For example, an azimuth of 0 means that the icon will be painted upright when the North arrow points upwards, but the icon will rotate along when the map is rotated. The anchor point serves as the center of this rotation.
If no orientation is specified, the icon 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 icon's rotation in view space, use
position
.- Parameters:
orientation
- the orientation of the icon.- Returns:
- this
IconDrawCommand
.
-
draped
Indicates whether or not the icon should be draped on top of the terrain.Draping means that the icon is painted directly on top of the terrain’s surface relief.
By default, an icon is draped if the geometry has a zero Z value. Otherwise it will not be draped. You can override the default behaviour by setting this flag true or false. If you explicitly drape for a 3D point with height, its height is discarded.
This setting is only relevant for 3D maps and is ignored for 2D maps.
- Parameters:
draped
- true if the icon should be draped over terrain.- Returns:
- this
IconDrawCommand
.
-
queryable
Indicates whether or not the icon should be considered when aMap#queryFeatures
is requested.The default is true.
- Parameters:
queryable
- true if the icon should be considered.- Returns:
- this
IconDrawCommand
.
-
zOrder
The Z-order of the icon.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 icon.- Returns:
- this
IconDrawCommand
.
-
scale
@NotNull public FeatureCanvas.IconDrawCommand scale(double scaleFactor) throws IllegalArgumentException Applies a scale factor to the icon's 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 icon size and position on the map is determined using the following methods:
- Parameters:
scaleFactor
- the scale factor to apply to theicon's
size
andoffset
properties
.- Returns:
- this
IconDrawCommand
- Throws:
IllegalArgumentException
- if a value equal to or smaller than 0 is provided
-
size
@NotNull public FeatureCanvas.IconDrawCommand size(double width, double height) throws IllegalArgumentException This method overrides the size of the specifiedicon
.This method is optional. If it is not called, the icon's natural size is used.
The icon size and position on the map is determined using the following methods:
- Parameters:
width
- the width of the icon, defined in device independent pixels ormeters
.height
- the height of the icon, defined in device independent pixels ormeters
.- Returns:
- this
IconDrawCommand
- Throws:
IllegalArgumentException
- if a value equal to or smaller than 0 is provided
-
inMeters
Interpret the icon 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 icon size and position on the map is determined using the following methods:
- Returns:
- this
IconDrawCommand
-
occlusionMode
Determines when this icon should be painted in 3D in relation to other 3D data.Details and limitations:
- Mode
OcclusionMode#VisibleOnly
shows only the part of the icon that is not obscured by other 3D data. This is the default. - Mode
OcclusionMode#AlwaysVisible
shows the entire icon even if behind other 3D data. The icon will appear in front of other objects. - Mode
OcclusionMode#OccludedOnly
shows only the part of the icon that is behind other 3D data. You typically use this to display obscured icons 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 icons.
The default is
OcclusionMode#VisibleOnly
.- Parameters:
occlusionMode
- the occlusion mode to use- Returns:
- this
IconDrawCommand
- 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.
-