Class: SpatialStyle
- Last UpdatedJul 9, 2025
- 4 minute read
This class represents a style with which spatial objects such as polylines and polygons are drawn. A SpatialStyle instance is always treated as immutable to avoid inconsistencies and must not modified.
Name | Type | Description |
---|---|---|
opt_options |
H.map.SpatialStyle | H.map.SpatialStyle.Options |
optional
An object specifying style attributes |
Members
-
Object containing a list of images which can be used for
lineDashImage
.Properties:
Name Description ARROW
Arrow image with aspect ratio of 1x1
CIRCLE
Circle image with aspect ratio of 1x1
-
Object containing a list of values which can be used for
lineDashScaleMode
.Properties:
Name Description CONTINUOUS
Scales dashes continuously with zoom.
DISCRETE
Scales dashes in fixed steps at specific zoom levels.
-
H.map.SpatialStyle.DEFAULT_STYLE H.map.SpatialStyle staticconstantnon-null
-
This static member defines the default style for spatial objects on the map. It's value is:
Example
{ strokeColor: '#05A', fillColor: 'rgba(0, 85, 170, 0.4)' lineWidth: 1, lineCap: 'round', lineJoin: 'miter', miterLimit: 1, lineDash: [ ], lineDashOffset: 0, lineDashImage: undefined }
-
This constant represents the maximum line width which can be used for rendering.
-
The filling color in CSS syntax, the default is
"rgba(0, 85, 170, 0.4)"
. -
lineCap H.map.SpatialStyle.LineCap non-null
-
The style of the end caps for a line, the default is
"round"
. -
The line dash pattern as an even-numbered list of distances produce a line of alternating dashes and spaces. The default is
[ ]
. -
lineDashImage HTMLCanvasElement | HTMLImageElement | H.map.SpatialStyle.DashImage | undefined
-
An image that will be placed inside each dash. Can be used only when the
lineDash
is specified. Works only when using map engine typeH.Map.EngineType['HARP']
. If not specified then no image is used. -
The phase offset for the line dash pattern The default is
0
. -
lineDashScaleMode H.map.SpatialStyle.DashScaleMode | undefined
-
The scaling mode of the dashes for a dashed line. Works only when using map engine type
H.Map.EngineType['HARP']
. The Default is H.map.SpatialStyle.DashScaleMode['CONTINUOUS']. -
lineHeadCap H.map.SpatialStyle.LineCap | undefined
-
The cap type of the head of a solid line or, in case of a dashed line, for the head of each dash. If not specified the
lineCap
property is used. -
lineJoin H.map.SpatialStyle.LineJoin non-null
-
The type of the corner created when two lines meet, the default is
"miter"
. -
lineTailCap H.map.SpatialStyle.LineCap | undefined
-
The cap type of the tail of a solid line or, in case of a dashed line, for the tail of each dash. If not specified then the
lineCap
property is used. -
The width of the line in pixels, the default is
2
. -
The miter length as the distance between the inner corner and the outer corner where two lines meet. The default is
1
. -
The color of the stroke in CSS syntax, the default is
"rgba(0, 85, 170, 0.6)"
.
Methods
-
This method checks if the given style object is the same as the style object supplied by the caller. Two style objects are equal if the values of their properties are equal.
Name Type Description other
H.map.SpatialStyle | H.map.SpatialStyle.Options The style object against which to compare the given style object
Returns:
Type Description boolean true
if the styles are value-equal, otherwisefalse
-
getCopy (opt_attributes)H.map.SpatialStyle
-
This method obtains a copy of the given spatial style object and sets its attributes.
Name Type Description opt_attributes
H.map.SpatialStyle.Options optional The style attributes to set on the copy of the given style instance
Returns:
Type Description H.map.SpatialStyle
Type Definitions
-
The style of the end caps for a line, one of
"butt"
,"round"
,"square"
,"arrow-head"
or"arrow-tail"
. -
The type of the corner created when two lines meet, one of
"round"
,"bevel"
or"miter"
. -
Options used to initialize a style. If a property is not set, the default value from
H.map.SpatialStyle
is taken.Properties: