Constructor
new AssetColorPalette()
- Since:
- Source:
Extends
Members
defaults :Object
Default attributes for AssetColorPalette models
Type:
Properties:
| Name |
Type |
Attributes |
Default |
Description |
paletteType |
'categorical'
|
'continuous'
|
'classified'
|
<optional>
|
'categorical'
|
Set to 'categorical', 'continuous', or
'classified'. NOTE: Currently only categorical and continuous palettes are
supported.
- Categorical: the color conditions will be interpreted such that one color
represents a single value (e.g. a discrete palette).
- Continuous: each color in the colors attribute will represent a point in a
gradient. The point in the gradient will be associated with the number set
with the color, and numbers in between points will be set to an interpolated
color.
- Classified: the numbers set in the colors attribute will be interpreted as
maximums. Continuous properties will be forced into discrete bins. |
property |
string
|
|
|
The name (ID) of the property in the asset layer's
attribute table to color the vector data by (or for imagery data that does not
have an attribute table, just the name of the attribute that these colors map
to). |
label |
string
|
<optional>
|
null
|
A user-friendly name to display instead of
the actual property name. |
colors |
AssetColors
|
<optional>
|
new AssetColors()
|
The colors to use in the
color palette, along with the conditions associated with each color (i.e. the
properties of the feature that must be true to use the given color.) . The last
color in the collection will always be treated as the default color - any
feature that doesn't match the other colors will be colored with this color. |
- Source:
type :string
The name of this type of model
Type:
- Source:
Methods
Given properties of a feature, returns the color associated with that feature.
Parameters:
| Name |
Type |
Description |
properties |
Object
|
The properties of the feature to get the color for.
(See the 'properties' attribute of Feature#defaults.) |
- Source:
Returns:
The color associated with the given set of
properties.
-
Type
-
AssetColor#Color
Gets the default color for the color palette, returns it as an object of RGB
intestines between 0 and 1.
- Source:
Returns:
The default color for the palette.
-
Type
-
AssetColor#Color
initialize(paletteConfigopt)
Executed when a new AssetColorPalette model is created.
Parameters:
| Name |
Type |
Attributes |
Description |
paletteConfig |
MapConfig#ColorPaletteConfig
|
<optional>
|
The initial values of the
attributes, which will be set on the model. |
- Source:
interpolate(color1, color2, fraction) → {AssetColor#Color}
Given two colors, returns a color that is a linear interpolation between the
two colors.
Parameters:
| Name |
Type |
Description |
color1 |
AssetColor#Color
|
The first color. |
color2 |
AssetColor#Color
|
The second color. |
fraction |
number
|
The percentage of the way between the two colors, 0-1. |
- Source:
Returns:
The interpolated color.
-
Type
-
AssetColor#Color