Powered by Zoomin Software. For more details please contactZoomin

HERE Maps API for JavaScript - API Reference

Product category
Technology
Doc type
Version
Product lifecycle
This publication

HERE Maps API for JavaScript - API Reference: Class: SpatialStyle

Table of Contents

Class: SpatialStyle

H.map.SpatialStyle

new H.map.SpatialStyle (opt_options)

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

H.map.SpatialStyle.DashImage HTMLImageElement static

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

H.map.SpatialStyle.DashScaleMode static

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
}

H.map.SpatialStyle.MAX_LINE_WIDTH number staticconstant

This constant represents the maximum line width which can be used for rendering.

fillColor string

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".

lineDash Array.<number> non-null

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 type H.Map.EngineType['HARP']. If not specified then no image is used.

lineDashOffset number

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.

lineWidth number

The width of the line in pixels, the default is 2.

miterLimit number

The miter length as the distance between the inner corner and the outer corner where two lines meet. The default is 1.

strokeColor string

The color of the stroke in CSS syntax, the default is "rgba(0, 85, 170, 0.6)".

Methods

equals (other)boolean

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, otherwise false

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

H.map.SpatialStyle.LineCap string

The style of the end caps for a line, one of "butt", "round", "square", "arrow-head" or "arrow-tail".

H.map.SpatialStyle.LineJoin string

The type of the corner created when two lines meet, one of "round", "bevel" or "miter".

H.map.SpatialStyle.Options Object

Options used to initialize a style. If a property is not set, the default value from H.map.SpatialStyle is taken.

Properties:
Was this article helpful?
TitleResults for “How to create a CRG?”Also Available inAlert