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 ARROWArrow image with aspect ratio of 1x1
CIRCLECircle image with aspect ratio of 1x1
-
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
lineDashis 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. -
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
lineCapproperty 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
lineCapproperty 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 otherH.map.SpatialStyle | H.map.SpatialStyle.Options The style object against which to compare the given style object
Returns:
Type Description boolean trueif 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_attributesH.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.SpatialStyleis taken.Properties:
Name Type Argument Description strokeColorstring <optional>
The stroke color in CSS syntax.
fillColorstring <optional>
The fill color in CSS syntax.
lineWidthnumber <optional>
The width of the line in pixels, the default is
2. The maximum supported line width is100.lineCapH.map.SpatialStyle.LineCap <optional>
The cap type of the tail and head of a solid line or, in case of a dashed line, for the tail and head of each dash. The type can be overridden by
lineTailCapandlineHeadCap.lineJoinH.map.SpatialStyle.LineJoin <optional>
The type of corner created when two lines meet.
miterLimitnumber <optional>
The miter length is the distance from the point where the join occurs to the intersection of the line edges on the outside of the join. The miter limit ratio is the maximum allowed ratio of the miter length to half the line width. The default is
1(see CanvasRenderingContext2D.miterLimit). The maximum supported miter limit is100.lineDashArray.<number> <optional>
The line dash pattern as an even-numbered list of distances to alternate lines (dashes) and spaces. If the browser does not support this feature this property is ignored.
lineDashOffsetnumber <optional>
The phase offset of the line dash pattern
lineDashImageHTMLCanvasElement | HTMLImageElement | H.map.SpatialStyle.DashImage <optional>
An image that will be placed inside each dash. Can be used only when the
lineDashis specified. Works only when using map engine typeH.Map.EngineType['HARP'].lineTailCapH.map.SpatialStyle.LineCap <optional>
The cap type of the tail of a solid line or, in case of a dashed line, for the tail of each dash.
lineHeadCapH.map.SpatialStyle.LineCap <optional>
The cap type of the head of a solid line or, in case of a dashed line, for the head of each dash.