Maps API for JavaScript Developer's Guide

H.map.SpatialStyle

Class Summary

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.

[ For full details, see the Class Details ]

Property Summary

Table 1. Properties
Properties

strokeColor : {string}

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

fillColor : {string}

The filling color in CSS syntax, the default is 'rgba(0, 85, 170, 0.4)'.

lineWidth : {number}

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

lineCap : {H.map.SpatialStyle.LineCap}

The style of the end caps for a line, the default is 'round'.

lineJoin : {H.map.SpatialStyle.LineJoin}

The type of the corner created when two lines meet, the default is 'miter'.

miterLimit : {number}

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

lineDash : {Array<number>}

The line dash pattern as an even-numbered list of distances produce a line of alternating dashes and spaces. The default is [ ].

lineDashOffset : {number}

The phase offset for the line dash pattern The default is 0.

static MAX_LINE_WIDTH : {number}

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

static DEFAULT_STYLE : {H.map.SpatialStyle}

This static member defines the default style for spatial objects on the map. It's value is:

Method Summary

Table 2. Methods
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.

getCopy (opt_attributes) : {H.map.SpatialStyle}

This method obtains a copy of the given spatial style object and sets its attributes.

Class Description

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.

Constructor Details

H.map.SpatialStyle(opt_options)

Parameters:
 
opt_options:
{(H.map.SpatialStyle | H.map.SpatialStyle.Options)=} [optional]
 
An object specifying style attributes

Property Details

strokeColor: {string}

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

fillColor: {string}

The filling color in CSS syntax, the default is 'rgba(0, 85, 170, 0.4)'.

lineWidth: {number}

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

lineCap: {H.map.SpatialStyle.LineCap}

The style of the end caps for a line, the default is 'round'.

lineJoin: {H.map.SpatialStyle.LineJoin}

The type of the corner created when two lines meet, the default is 'miter'.

miterLimit: {number}

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

lineDash: {Array<number>}

The line dash pattern as an even-numbered list of distances produce a line of alternating dashes and spaces. The default is [ ].

lineDashOffset: {number}

The phase offset for the line dash pattern The default is 0.

static MAX_LINE_WIDTH: {number}

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

static DEFAULT_STYLE: {H.map.SpatialStyle}

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: 10,
  lineDash: [ ],
  lineDashOffset: 0
}

Method Details

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.

Parameters:
 
other:
{(H.map.SpatialStyle | H.map.SpatialStyle.Options)}
 
The style object against which to compare the given style object
Returns:
 
{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.

Parameters:
 
opt_attributes:
{H.map.SpatialStyle.Options=} [optional]
 
The style attributes to set on the copy of the given style instance
Returns:
 
{H.map.SpatialStyle}