API / geotoolkit / util / RangeColorProvider / RangeColorProvider
util.RangeColorProvider.RangeColorProvider
Creates a representation of Range color provider
Example
import {Range} from '@int/geotoolkit/util/Range';
import {RangeColorProvider} from '@int/geotoolkit/util/RangeColorProvider';
// Discrete Range Color Provider allows for specific bins
const rangem2 = new Range(-2,-1.5); // set color orange in the [-2,-1.5] range.
...
// Do the same for the [-1.5, 0], [0, 0.5], [0.5,1] and [1,2] ranges
const rangeCP = new RangeColorProvider({
'values' : [ rangem2, rangem1, range0, rangep1, rangep2 ],
'colors' : ['orange', 'yellow', 'blue', 'green', 'gray']
});↳
RangeColorProvider
Constructors
Methods
Css Properties
| Name | Type | Description |
|---|---|---|
default | string | Default color |
intervaltype | IntervalType | Interval orientation, default if 'left' |
max | number | |
min | number | |
scale | KnownScales | |
style | DisplayStyle | Display style |
Constructors
• new RangeColorProvider(values?, colors?)
Creates color provider
| Name | Type | Description |
|---|---|---|
Optional values | number[] | Range[] | Options | list of ranges or properties object |
Optional colors | (string | RgbaColor)[] | list of colors |
ColorProvider.constructor
Methods
▸ clone(): ColorProvider
Returns clone of color provider
▸ Protected copyConstructor(src): RangeColorProvider
Copy constructor
| Name | Type | Description |
|---|---|---|
src | ColorProvider | Source to copy from |
this
▸ 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
▸ getClassName(): string
string
▸ getColor(value): RgbaColor
Return color for the current value
| Name | Type | Description |
|---|---|---|
value | number | value |
color
▸ getColorNumber(): number
Returns how many colors can be provided
number
▸ getDefaultColor(): RgbaColor
gets the default/out of range color
▸ getDisplayStyle(): DisplayStyle
display style.
▸ getIntervalType(): IntervalType
Returns interval type
interval type
▸ getMaxValue(): number
Returns the maximum value set in this collection
number
▸ getMinValue(): number
Returns minimum value set in the collection
number
▸ 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
▸ getNamedColors(): NamedColor[]
Returns known colors
array of color pair
▸ getProperties(): OptionsOut
Returns color provider properties
▸ 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 |
▸ getStopPoints(): { color: string ; value: number }[]
Return list of used Stop Points
{ color: string ; value: number }[]
▸ 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
ColorProvider.hasEventListener
▸ hasNamedColor(colorName): boolean
Check if specified named color exists
| Name | Type | Description |
|---|---|---|
colorName | string | color name |
boolean
true if color exists
▸ invalidate(): RangeColorProvider
Invalidate Default ColorProvider and notify visuals for update
▸ isDisposed(): boolean
Returns whether this object has been disposed
boolean
▸ isNotificationEnabled(): boolean
Return state of notification
boolean
current notification state
ColorProvider.isNotificationEnabled
▸ isSilent(): boolean
Return true if the event dispatcher doesn't notify any events
boolean
▸ notify<E>(type, source, args?): RangeColorProvider
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?): RangeColorProvider
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: RangeColorProvider, args: EventMap[E]) => void | function to be called |
this
▸ on<E>(type, callback): RangeColorProvider
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: RangeColorProvider, args: EventMap[E]) => void | to be called |
this
▸ setColors(values, colors?): RangeColorProvider
Replace all colors in the collection by this set
| Name | Type | Description |
|---|---|---|
values | Options | list of ranges or properties object |
Optional colors | (string | RgbaColor)[] | list of colors |
this
▸ setDefaultColor(color): RangeColorProvider
sets the default/out of range color
| Name | Type | Description |
|---|---|---|
color | string | RgbaColor | default/out of range color |
▸ setDisplayStyle(style): RangeColorProvider
Method used to set graphical representation of LogColorProvider in a fillStyle
| Name | Type | Description |
|---|---|---|
style | DisplayStyle | display style |
this
▸ setIntervalType(intervalType): RangeColorProvider
Set interval type
| Name | Type | Description |
|---|---|---|
intervalType | IntervalType | interval type |
this
▸ setNamedColor(colorName, colorValue): RangeColorProvider
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
▸ setNotification(enable, force?): RangeColorProvider
Enable / disable notification
| Name | Type | Description |
|---|---|---|
enable | boolean | enable or disable notifications |
Optional force | boolean | true if parent should be invalidated immediately |
this
▸ setProperties(properties?): RangeColorProvider
Sets properties
| Name | Type | Description |
|---|---|---|
Optional properties | Options | properties |
this
▸ setSilent(bool): RangeColorProvider
Set silent mode
| Name | Type | Description |
|---|---|---|
bool | boolean | flag to enable silent mode |
this
▸ Static fromObject(object): RangeColorProvider
Create or get RangeColorProvider from an object
| Name | Type | Description |
|---|---|---|
object | RangeColorProvider | Options | color provider |
provider
▸ Static getClassName(): string
string
▸ 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