API / geotoolkit / util / DefaultLogColorProvider / DefaultLogColorProvider
util.DefaultLogColorProvider.DefaultLogColorProvider
Creates a representation of Log color provider
Example
//Log Color Provider emulates logarithmic behavior
const logCP = new DefaultLogColorProvider({
'values' : [ 1 , 10 , 100 , 300 , 1000 ],
'colors' : ['orange', 'yellow', 'blue', 'green', 'gray']
});↳
DefaultLogColorProvider
Constructors
Methods
Css Properties
| Name | Type | Description |
|---|---|---|
max | number | |
max | number | End value for the scale |
min | number | |
min | number | Start value for the scale |
reversed | boolean | Boolean to define the sorting direction |
scale | KnownScales | |
scale | KnownScales | A predefined set of colors |
style | DisplayStyle | Enum of display style |
Constructors
• new DefaultLogColorProvider(values?, colors?)
| Name | Type | Description |
|---|---|---|
Optional values | number[] | Options | list of values |
Optional colors | (string | RgbaColor)[] | list of colors |
DefaultColorProvider.constructor
Methods
▸ addColor(value, color): DefaultLogColorProvider
Add color to the collection Compatibility: old JSON format {'value': 0, 'red': 255, 'green': 255, 'blue': 255, 'alpha': 1} is supported, but new parameter list is recommended
| Name | Type | Description |
|---|---|---|
value | number | index of this color on the colorbar |
color | string | RgbaColor | CSS color string or RgbaColor object |
this
▸ addColor(json): DefaultLogColorProvider
Deprecated
| Name | Type |
|---|---|
json | Object |
Optional json.alpha | number |
Optional json.blue | number |
json.color | string | RgbaColor |
Optional json.green | number |
Optional json.red | number |
json.value | number |
▸ clone(): ColorProvider
Returns clone of color provider
▸ Protected copyConstructor(src): DefaultLogColorProvider
Copy constructor
| Name | Type | Description |
|---|---|---|
src | ColorProvider | Source to copy from |
this
DefaultColorProvider.copyConstructor
▸ dispose(): void
Dispose.
void
▸ exportToImage(width, height, isVertical, surface?): Surface
returns surface that represents color map
| Name | Type | Description |
|---|---|---|
width | number | The image width |
height | number | The image height |
isVertical | boolean | True if image is oriented vertically |
Optional surface | Surface | output surface |
surface The canvas surface
DefaultColorProvider.exportToImage
▸ getClassName(): string
string
DefaultColorProvider.getClassName
▸ getColor(value): RgbaColor
Return color for the current value
| Name | Type | Description |
|---|---|---|
value | number | value |
color
▸ getColors(): RgbaColor[]
an array of the colors
DefaultColorProvider.getColors
▸ Protected getColorsProperties(): ColorsProperties
Returns colors and values to be serialized
colors and values
DefaultColorProvider.getColorsProperties
▸ Protected getDataMaxValue(): number
Returns the maximum data value set in this collection
number
DefaultColorProvider.getDataMaxValue
▸ Protected getDataMinValue(): number
Returns the minimum data value set in this collection
number
DefaultColorProvider.getDataMinValue
▸ getDisplayStyle(): DisplayStyle
display style.
▸ getMaxValue(): number
Returns the maximum value set in this collection
number
DefaultColorProvider.getMaxValue
▸ getMinValue(): number
Returns minimum value set in the collection
number
DefaultColorProvider.getMinValue
▸ getNamedColor(colorName): string | NamedColorValue
Returns known color value
| Name | Type | Description |
|---|---|---|
colorName | string | color name, if not specified then returns list of known colors |
string | NamedColorValue
color
DefaultColorProvider.getNamedColor
▸ getNamedColors(): NamedColor[]
Returns known colors
array of color pair
DefaultColorProvider.getNamedColors
▸ getProperties(): OptionsOut
get Properties
DefaultColorProvider.getProperties
▸ getRaster(xMin?, yMin?, xMax?, yMax?): Raster
Returns a new instance of Raster
| Name | Type | Description |
|---|---|---|
Optional xMin | number | x Min position to get color |
Optional yMin | number | y Min position to get color |
Optional xMax | number | x Max position to get color |
Optional yMax | number | y Max position to get color |
DefaultColorProvider.getRaster
▸ getScale(): KnownScales
scale scale being used
▸ getStopPoints(): { color: string ; value: number }[]
{ color: string ; value: number }[]
an array of the {color,values} couples
DefaultColorProvider.getStopPoints
▸ getValues(): number[]
Always return a reference to sorted array of values. Don't change this array.
number[]
an array of the values
DefaultColorProvider.getValues
▸ hasEventListener(type, callback?): boolean
Check if a list of event listeners for this type contains this listener
| Name | Type | Description |
|---|---|---|
type | string | type of event or property |
Optional callback | Function | to be called, if null, check if any callback is registered |
boolean
DefaultColorProvider.hasEventListener
▸ hasNamedColor(colorName): boolean
Check if specified named color exists
| Name | Type | Description |
|---|---|---|
colorName | string | color name |
boolean
true if color exists
DefaultColorProvider.hasNamedColor
▸ invalidate(): DefaultLogColorProvider
Invalidate Default ColorProvider and notify visuals for update
DefaultColorProvider.invalidate
▸ isDisposed(): boolean
Returns whether this object has been disposed
boolean
DefaultColorProvider.isDisposed
▸ isNotificationEnabled(): boolean
Return state of notification
boolean
current notification state
DefaultColorProvider.isNotificationEnabled
▸ isReversed(): boolean
return true if the min / max is reversed
boolean
DefaultColorProvider.isReversed
▸ isSilent(): boolean
Return true if the event dispatcher doesn't notify any events
boolean
▸ notify<E>(type, source, args?): DefaultLogColorProvider
Notify listeners
| Name | Type |
|---|---|
E | extends string |
| Name | Type | Description |
|---|---|---|
type | E | event types |
source | ColorProvider | of the event |
Optional args | EventMap[E] | arguments of the event |
this
▸ off<E>(type?, callback?): DefaultLogColorProvider
Detach listener on event. Calling .off() with no arguments removes all attached listeners. Calling .off(type) with no callback removes all attached listeners for specific type.
| Name | Type |
|---|---|
E | extends string |
| Name | Type | Description |
|---|---|---|
Optional type | E | type of the event |
Optional callback | (eventType: E, sender: DefaultLogColorProvider, args: EventMap[E]) => void | function to be called |
this
▸ on<E>(type, callback): DefaultLogColorProvider
Attach listener on event that will be called whenever the specified event is delivered to the target
If the callback function is already in the list of event listeners for this target, the function is not added a second time.
If a particular anonymous function is in the list of event listeners registered for a certain target, and then later in the code, an identical anonymous function is given in an "on" call, the second function will also be added to the list of event listeners for that target.
| Name | Type |
|---|---|
E | extends string |
| Name | Type | Description |
|---|---|---|
type | E | type of event or property |
callback | (eventType: E, sender: DefaultLogColorProvider, args: EventMap[E]) => void | to be called |
this
▸ removeColor(value): DefaultLogColorProvider
Remove color from the collection
| Name | Type | Description |
|---|---|---|
value | number | value to remove color |
this
DefaultColorProvider.removeColor
▸ reverse(): DefaultLogColorProvider
reverse the axis
▸ scaleTo(start, end, logValue?): DefaultLogColorProvider
set the min/max of the color provider, interpolating all values on the way.
| Name | Type | Description |
|---|---|---|
start | number | Start value to use |
end | number | End value to use |
Optional logValue | boolean | apply scale for logarithm of values |
this
▸ setColors(values, colors): DefaultLogColorProvider
Replace all colors in the collection by this set
| Name | Type | Description |
|---|---|---|
values | number[] | new values |
colors | (string | RgbaColor)[] | new colors |
this
DefaultColorProvider.setColors
▸ setDisplayStyle(style): DefaultLogColorProvider
Method used to set graphical representation of DefaultLogColorProvider in a fillStyle
| Name | Type | Description |
|---|---|---|
style | DisplayStyle | display style |
this
▸ setNamedColor(colorName, colorValue): DefaultLogColorProvider
Set color value
Example
import {KnownColors} from '@int/geotoolkit/util/ColorProvider';
colorProvider.setNamedColor(KnownColors.NaN, { // set color for NaN values
'title': 'absent', // title to use when displaying, e.g. by ColorBar shape
'enabled': true, // enable state (default is not false)
'value': 'black' // color to use for NaNs
});Example
// use 'red' color for values greater than maxValue (default '+∞' title is used)
colorProvider.setNamedColor(KnownColors.PositiveInfinity, 'red');| Name | Type | Description |
|---|---|---|
colorName | string | color name |
colorValue | string | NamedColorValue | color or title/value settings object |
this
DefaultColorProvider.setNamedColor
▸ setNotification(enable, force?): DefaultLogColorProvider
Enable / disable notification
| Name | Type | Description |
|---|---|---|
enable | boolean | enable or disable notifications |
Optional force | boolean | true if parent should be invalidated immediately |
this
DefaultColorProvider.setNotification
▸ setProperties(properties?): DefaultLogColorProvider
set Properties of the object
| Name | Type | Description |
|---|---|---|
Optional properties | Options | Json with properties to set |
this
DefaultColorProvider.setProperties
▸ setScale(scale, min, max, logValue?): DefaultLogColorProvider
Replace all colors in the collection by this scale
| Name | Type | Description |
|---|---|---|
scale | string | { logValue?: boolean ; max: number ; min: number ; values: number[] } | Scale to Use |
min | number | Minimum to Use |
max | number | Maximum to Use |
Optional logValue | boolean | apply scale for logarithm of values |
this
▸ setSilent(bool): DefaultLogColorProvider
Set silent mode
| Name | Type | Description |
|---|---|---|
bool | boolean | flag to enable silent mode |
this
DefaultColorProvider.setSilent
▸ Static fromObject(object): DefaultLogColorProvider
Create or get DefaultLogColorProvider from an object
| Name | Type | Description |
|---|---|---|
object | any | to get provider from |
provider
DefaultColorProvider.fromObject
▸ Static getClassName(): string
string
DefaultColorProvider.getClassName
▸ Static getColorProviderType(objectType?): ClassType<any>
Return ColorProvider constructor from the object class name or type.
Deprecated
since 4.1 Use ColorProvider implementation directly
| Name | Type | Description |
|---|---|---|
Optional objectType | string | ColorProvider class name |
ClassType<any>
ColorProvider constructor