M/style/Category~Category


import Category from 'M/style/Category';

Main constructor of the class. Creates a category style with parameters specified by the user

new Category(attributeName, categoryStyles, options)

facade/js/style/Category.js, line 30
Name Type Description
attributeName String
categoryStyles object
options object

Extends

  • M.Style

Members

module:M/style/Category~Category.RANDOM_RADIUS_OPTION{number}

This constant defines the radius of random category style.

module:M/style/Category~Category.RANDOM_STROKE_COLOR_OPTION{string}

This constant defines the stroke color of random category style.

module:M/style/Category~Category.RANDOM_STROKE_WIDTH_OPTION{number}

This constant defines the stroke width of random category style.

attributeName_{String}

Attribute name of category

categoryStyles_{Map.<String, M.Style>}

An object that relate category with a style

ORDER

This constant defines the order of style.

Methods

add(styles){M.style.Composite}

facade/js/style/Category.js, line 301

This function adds styles of style Composite

Name Type Description
styles M.style | Array.<M.Style>

applyInternal(layer){M.style.Category}

facade/js/style/Category.js, line 71

This function apply the Category object to specified layer

Name Type Description
layer M.layer.Vector

layer is the layer where we want to apply the new Style

drawGeometryToCanvas(vectorContext)

facade/js/style/Category.js, line 235

Draw the geometry into the canvas style

Name Type Description
vectorContext CanvasRenderingContext2D

context of style canvas

getAttributeName(){String}

facade/js/style/Category.js, line 84

This function return the AttributeName

getCategories(){Array.<String>}

facade/js/style/Category.js, line 112

This function return an Array with the diferents Categories

getStyleForCategory(string){M.style}

facade/js/style/Category.js, line 141

This function return the style of a specified Category defined by user

Name Type Description
string String

string is the name of a category value

setAttributeName(attributeName){M.style.Category}

facade/js/style/Category.js, line 97

This function set the AttributeName defined by user

Name Type Description
attributeName String

newAttributeName is the newAttributeName specified by the user

setCategories(categories){M.style.Category}

facade/js/style/Category.js, line 125

This function sets the object categories

Name Type Description
categories Map.<String, M.style>

setStyleForCategory(category, style){M.style.Category}

facade/js/style/Category.js, line 155

This function set the style of a specified Category defined by user

Name Type Description
category String

category is the name of a category value

style M.style.Simple

style is the new style to switch

toJSON(){object}

facade/js/style/Category.js, line 346

This function implements the mechanism to generate the JSON of this instance

updateCanvas()

facade/js/style/Category.js, line 169

This function updates the canvas of style