Class Icon
- All Implemented Interfaces:
Serializable
Feature, by
using it as the feature's Style.setImage(ImageStyle)- Since:
- 23.0
- See Also:
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic classstatic enumstatic classDeprecated.static class -
Field Summary
Fields inherited from class com.vaadin.flow.component.map.configuration.AbstractConfigurationObject
propertyChangeSupport -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionThe anchor position of the image.The origin of thegetAnchor()position.getColor()Color to tint the icon's image with.The cross-origin attribute value for loaded images.The height in pixels at which the icon's image is rendered.getImg()Deprecated.usegetImg()insteadThe stream resource from which the icon's image should be loaded.Deprecated.this option has no effect on how the icon is rendered, and calls to it can be removedgetSrc()The source URL from which the icon's image should be loaded.getType()The unique type name of this class.getWidth()The width in pixels at which the icon's image is rendered.voidsetAnchor(Icon.Anchor anchor) Sets the anchor position of the icon's imagevoidsetScale(double scale) Sets the scaling of the image's size.Methods inherited from class com.vaadin.flow.component.map.configuration.style.ImageStyle
getOpacity, getRotation, getScale, isRotateWithView, setOpacity, setRotateWithView, setRotationMethods inherited from class com.vaadin.flow.component.map.configuration.AbstractConfigurationObject
addChild, addNullableChild, addPropertyChangeListener, collectChanges, deepMarkAsDirty, getId, markAsDirty, notifyChange, notifyChange, removeChild, removePropertyChangeListener, setId, update
-
Constructor Details
-
Icon
-
-
Method Details
-
getType
Description copied from class:AbstractConfigurationObjectThe unique type name of this class. Used by the client-side synchronization mechanism to determine which OpenLayers class to synchronize into.- Specified by:
getTypein classAbstractConfigurationObject
-
getAnchor
The anchor position of the image. This defines how the image should be aligned from thegetAnchorOrigin(). The anchor position is specified in relative units, based on the size of the image. Valid values range from0to1, where1moves the image by its full width or height from the anchor origin. Default value is{x: 0.5, y: 0.5}, which centers the image.- Returns:
- the current anchor
-
setAnchor
Sets the anchor position of the icon's image- Parameters:
anchor- the new anchor
-
getAnchorOrigin
The origin of thegetAnchor()position. Defaults toIcon.AnchorOrigin.TOP_LEFT.This value can not be changed after constructing an instance, it can only be set initially by passing an options object to the constructor.
- Returns:
- the current anchor origin
-
getColor
Color to tint the icon's image with. If not specified, the image will not be modified.This value can not be changed after constructing an instance, it can only be set initially by passing an options object to the constructor.
- Returns:
- the current color tint
-
getCrossOrigin
The cross-origin attribute value for loaded images.This value can not be changed after constructing an instance, it can only be set initially by passing an options object to the constructor.
- Returns:
- the cross-origin attribute value
-
getSrc
The source URL from which the icon's image should be loaded. Either this, orgetImg()must be specified in the options for the icon, and only one of the two options must be provided.This value can not be changed after constructing an instance, it can only be set initially by passing an options object to the constructor.
- Returns:
- the source URL for the icon's image
-
getImg
Deprecated.usegetImg()insteadThe stream resource from which the icon's image should be loaded. Either this orgetSrc()must be specified in the options for the icon, and only one of the two options must be provided.This value can not be changed after constructing an instance, it can only be set initially by passing an options object to the constructor.
- Returns:
- the stream resource containing the icon's image
-
getImgHandler
The stream resource from which the icon's image should be loaded. Either this orgetSrc()must be specified in the options for the icon, and only one of the two options must be provided.This value can not be changed after constructing an instance, it can only be set initially by passing an options object to the constructor.
- Returns:
- the stream resource containing the icon's image
- Since:
- 24.8
-
getImgSize
Deprecated.this option has no effect on how the icon is rendered, and calls to it can be removedThe size of the image in pixels.This value can not be changed after constructing an instance, it can only be set initially by passing an options object to the constructor.
- Returns:
- the size of the image
-
getWidth
The width in pixels at which the icon's image is rendered. If only the width is specified, the height is adjusted to preserve the image's aspect ratio. If both width and height are specified, the image is stretched to exactly that size. If neither is specified, the image is rendered at its natural size.Sizing the icon in pixels can not be combined with a
scale, an icon with a width or height always has a scale of1.This value can not be changed after constructing an instance, it can only be set initially by passing an options object to the constructor.
- Returns:
- the width in pixels, or
nullif not specified - Since:
- 25.4
-
getHeight
The height in pixels at which the icon's image is rendered. If only the height is specified, the width is adjusted to preserve the image's aspect ratio. If both width and height are specified, the image is stretched to exactly that size. If neither is specified, the image is rendered at its natural size.Sizing the icon in pixels can not be combined with a
scale, an icon with a width or height always has a scale of1.This value can not be changed after constructing an instance, it can only be set initially by passing an options object to the constructor.
- Returns:
- the height in pixels, or
nullif not specified - Since:
- 25.4
-
setScale
public void setScale(double scale) Sets the scaling of the image's size.- Overrides:
setScalein classImageStyle- Parameters:
scale- the new scaling- Throws:
IllegalStateException- if the icon has awidthorheight, as a size can not be combined with a scale
-
getImgSize()option, which has no effect on how the icon is rendered