API / reactnative / plot / Plot / Plot
Defines sender of the events. This class implements a dispatcher/listeners pattern. It's inherited by many classes of the toolkit that requires to send events.
Listeners are callbacks(functions) that can be added and removed at any time. Those will be notified when the corresponding event-type is fired on this object.
↳
Plot
Constructors
Methods
Methods
▸ dispose(disposeRoot?): void
Disposes the plot and the associated resources.
This may also call dispose on the root node (see disposeRoot).
The plot should not be used/accessed anymore after this has been called.
| Name | Type | Description |
|---|---|---|
Optional disposeRoot | boolean | Also dispose root node |
void
▸ getAutoUpdateInterval(): number
Returns the time interval for autoupdate mechanism.
number
The time interval in ms
▸ getBoundingClientRect(): DOMRect
Returns the client rect for the plots container element as DOMRect.
DOMRect
the client rect for the plots container element
▸ getCanvas(): SkiaView
Returns the canvas element or elements used by this plot
SkiaView
The canvas element
▸ getClassName(): string
string
▸ getContainingElement(): SkiaView
Returns the containing element for the plot
SkiaView
The canvas
▸ getHeight(): number
Returns the containing element height in virtual pixels.
This returns the raw size given at initialization or through the setSize function.
It ignores any Browser zoom.
number
The canvas height
▸ getRoot(): Node
Returns the root node of the scenegraph.
The root node
▸ getTool(): ToolsContainer
Returns root tool associated to plot
▸ getWidth(): number
Returns the containing element width in virtual pixels.
This returns the raw size given at initialization or through the setSize function.
It ignores any Browser zoom.
number
The canvas width
▸ 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
EventDispatcher.hasEventListener
▸ isAutoUpdate(): boolean
Return true if auto update is enabled.
boolean
The status of autoupdate
▸ isDisposed(): boolean
Returns whether this object has been disposed
boolean
▸ isInfiniteAutoUpdate(): boolean
Return true if infinite auto update is enabled.
boolean
The status of infinite auto update
▸ isSilent(): boolean
Return true if the event dispatcher doesn't notify any events
boolean
▸ notify<E>(type, source, args?): Plot
Notify listeners
| Name | Type |
|---|---|
E | extends string |
| Name | Type | Description |
|---|---|---|
type | E | event types |
source | Plot | of the event |
Optional args | EventMap[E] | arguments of the event |
this
▸ off<E>(type?, callback?): Plot
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: Plot, args: EventMap[E]) => void | function to be called |
this
▸ on<E>(type, callback): Plot
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: Plot, args: EventMap[E]) => void | to be called |
this
▸ resumeUpdate(refresh?): Plot
Resumes plot update, allowing the update function of triggering a render.
| Name | Type | Description |
|---|---|---|
Optional refresh | boolean | If set to true, a render will be run immediately |
this
▸ setAutoUpdate(enable, infinite?): Plot
Enables or disables auto update mechanism.
If auto update is enabled, whenever a node is invalidated it will trigger a Plot update/render.
| Name | Type | Description |
|---|---|---|
enable | boolean | The autoupdate status |
Optional infinite | boolean | Enables or disables infinite auto update mechanism. if true, run timer or request animation frame in infinite loop overwise if node is invalidated it will trigger a Plot update/render. if false, browser pixel scale is not updated. |
this
▸ setAutoUpdateInterval(interval?): Plot
Sets the time interval for autoupdate mechanism.
This will define the delay for polling the status of the Plot and trigger an update/render if necessary.
| Name | Type | Description |
|---|---|---|
Optional interval | number | The time interval in ms. window.requestAnimationFrame will be used if available and interval set to null. |
this
▸ setContext(context): Plot
| Name | Type |
|---|---|
context | SkCanvas |
▸ setRoot(root): Plot
Sets the root node ot be the given node.
| Name | Type | Description |
|---|---|---|
root | Node | The scenegraph root node |
this
▸ setSilent(bool): Plot
Set silent mode
| Name | Type | Description |
|---|---|---|
bool | boolean | flag to enable silent mode |
this
▸ setSize(width, height): Plot
Sets the plot size to the given dimensions.
This will also change the canvas size if autosize is enabled.
If autorootbounds is enabled, this will also update the bounds of the root node.
| Name | Type | Description |
|---|---|---|
width | number | The width of plot |
height | number | The height of plot |
this
▸ setSkiaView(skiaView): Plot
| Name | Type |
|---|---|
skiaView | SkiaView |
▸ setSurface(surface): Plot
| Name | Type |
|---|---|
surface | SkSurface |
▸ setWatermark(watermark): Plot
Sets watermark to have on a plot
Example
import {Text} from '@int/geotoolkit/scene/shapes/Text';
import {AnchorType} from '@int/geotoolkit/util/AnchorType';
const watermark = new Text({
'alignment': AnchorType.LeftBottom, // watermark position on the screen
'textstyle': {
'font': '60px sans-serif'
},
'text': 'My Watermark'
});
plot.setWatermark(watermark);| Name | Type | Description |
|---|---|---|
watermark | AnchoredShape | watermark shape |
this
▸ suspendUpdate(): Plot
Suspends plot update, preventing the update function from triggering a render.
this
▸ update(): Plot
Updates the plot, forcing a render.
This will be called automatically when the plot has been marked as dirty if the autoupdate is enabled.
this
▸ Static getClassName(): string
string