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
-
Object containing a list of values which can be used for
lineDashScaleMode.Properties:
Name Description CONTINUOUSScales dashes continuously with zoom.
DISCRETEScales 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. Its value is:
Example
{ strokeColor: '#05A', fillColor: 'rgba(0, 85, 170, 0.4)', lineWidth: 2, lineCap: 'round', lineDash: [ ], 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 a list of alternating dash and gap lengths. At most the first 4 elements are used (
[dash, gap, dash, gap]). Elements beyond these are ignored. The default is[ ]. -
lineDashImage HTMLCanvasElement | HTMLImageElement | H.map.SpatialStyle.DashImage | undefined
-
The image that is placed as dash. It is used only if the
lineDashis specified. If not specified then no image is used. -
lineDashScaleMode H.map.SpatialStyle.DashScaleMode | undefined
-
The scaling mode of a dashed line to determine how the dashes and gaps scale when zooming the map. The default is
H.map.SpatialStyle.DashScaleMode.CONTINUOUS. It is used only if thelineDashis specified. -
The width of the line in pixels, the default is
2. -
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"or"square". -
Options used to initialize a style. If a property is not set, the default value from
H.map.SpatialStyleis taken.CONTINUOUSscales dashes smoothly with zoom.DISCRETEscales dashes in fixed steps at specific zoom levels.
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.
lineDashArray.<number> <optional>
The line dash pattern as a list of alternating dash and gap lengths. At most the first 4 elements are used (
[dash, gap, dash, gap]). Elements beyond these are ignored. If not defined, a solid line is drawn.lineDashImageHTMLCanvasElement | HTMLImageElement | H.map.SpatialStyle.DashImage <optional>
The image that is placed as dash. It is used only if the
lineDashis specified.lineDashScaleModeH.map.SpatialStyle.DashScaleMode <optional>
The scaling mode of a dashed line to determine how the dashes and gaps scale when zooming the map. The default is
H.map.SpatialStyle.DashScaleMode.CONTINUOUS. It is used only if thelineDashis specified. The following values are supported: