Last updated

API / geotoolkit / axis / Grid / Grid

Class: Grid

axis.Grid.Grid

Creates a grid that will fill its parent container with grid lines

Hierarchy

Implements

Table of contents

Constructors
[new Grid(htg, vtg)](/solutions/geotoolkit/apis/classes/geotoolkit.axis.grid.grid.md#new grid(htg, vtg))[new Grid(options)](/solutions/geotoolkit/apis/classes/geotoolkit.axis.grid.grid.md#new grid(options))
Methods
Css Properties
Name Type Description
cssclassstringThe css class name of this node
htgTickGeneratorHorizontal tick generator
htg-labelstylesTextStyleAn object containing label style for specified grades
htg-labelstyles-alignmentAlignmentStyleAlignment
htg-labelstyles-autosizebooleanAuto font size on high definition display
htg-labelstyles-backgroundstringBackground style
htg-labelstyles-backgroundFillStyleBackground style
htg-labelstyles-background-colorstringColor in CSS form
htg-labelstyles-background-evenoddmodebooleanEven-odd fill mode
htg-labelstyles-background-fillpatternPatternPattern
htg-labelstyles-background-fillpattern-containernamestringAn optional container name, which creates an image pattern. This parameter is used for serialization if you want to save are reference to pattern instead of the pattern itself
htg-labelstyles-background-fillpattern-patternnamestringName of this pattern for indexing
htg-labelstyles-background-fillpattern-scalablebooleanFlag that sets scalability of the pattern coordinates, or relative to the shape it is filling (It is not supported)
htg-labelstyles-background-foregroundstringForeground color
htg-labelstyles-background-patternPatternPattern
htg-labelstyles-baselineBaseLineStyleBase line
htg-labelstyles-colorstringColor in CSS form
htg-labelstyles-fillFillStyleText fill style
htg-labelstyles-fontstringFont see
htg-labelstyles-fonturlstringThe place from which the font will be loaded, if null - uses system fonts. It can be base64 with url keyword
htg-labelstyles-lineheightstring | numberLine height
htg-labelstyles-multilinebooleanAllow multi-line text
htg-labelstyles-outlinestringOutline style
htg-labelstyles-outlineLineStyleOutline style
htg-labelstyles-outline-colorstringColor in CSS form
htg-labelstyles-outline-fillstringOptional fill style to be used to fill lines generated with this style
htg-labelstyles-outline-fillFillStyleOptional fill style to be used to fill lines generated with this style
htg-labelstyles-outline-linecapCapStyleThe line cap style
htg-labelstyles-outline-linedashoffsetnumberLine dash offset of dashed line
htg-labelstyles-outline-linejoinJoinStyleThe line join style
htg-labelstyles-outline-pixelsnapmodebooleanPixel Snap Mode, default(
htg-labelstyles-outline-scalablebooleanTrue if width should depend on transformation
htg-labelstyles-outline-unitstringOptional unit for the width
htg-labelstyles-outline-widthnumber | stringThe line thickness
htg-labelstyles-overflowwrapOverflowWrapStyleOverflow wrap
htg-labelstyles-strikethroughstringStrikethrough style
htg-labelstyles-strikethroughLineStyleStrikethrough style
htg-labelstyles-textoverflowTextOverflowStyleText overflow
htg-labelstyles-underlinestringUnderline style
htg-labelstyles-underlineLineStyleUnderline style
htg-labelstyles-underlineoffsetstring | numberUnderline offset distance
htg-labelstyles-whitespaceWhiteSpaceStyleWhite space
htg-labelstyles-wordbreakWordBreakStyleWord break
htg-taganyTag user can specify info associated with current object
htg-tickstylesLineStyleAn object containing tick styles for specified grades
idstring | numberId of the node, its a unique identifier
infinitybooleanInfinity mode flag
namestringName of the node. It is often used for debugging purposes or to simplify queries
selectablebooleanSelectable node, a boolean to determine if selection should consider this node
taganyCustom information associated with node. It is a user object which can be used by client code to store information or attach an application object to the shape
visiblebooleanVisibility of the node, a boolean to determine if the node should be rendered or not
vtgTickGeneratorVertical tick generator
z-indexnumberDefine node z-index

Contents

Constructors

new Grid(htg, vtg)

new Grid(htg, vtg?)

Parameters

Name Type
htgTickGenerator
Optional vtgTickGenerator

Overrides

Node.constructor


new Grid(options)

new Grid(options?)

Parameters

Name Type
Optional optionsOptions

Overrides

Node.constructor

Methods

addCssClass

addCssClass(cssclass): Grid

Adds new css class to node

Parameters

Name Type Description
cssclassstring | string[]css class name('s)

Returns

Grid

this

Inherited from

Node.addCssClass


addInvalidateHandler

addInvalidateHandler(handler): Grid

Add invalidate handler

Deprecated

since 4.0, use Node.on instead

Parameters

Name Type Description
handlerFunctionhandler to be notified about invalidation

Returns

Grid

this

Inherited from

Node.addInvalidateHandler


checkCollision

checkCollision(context): boolean

Check if this node is within the area being rendered by the context

Parameters

Name Type Description
contextRenderingContextRendering Context

Returns

boolean

true if object is inside of renderable area

Inherited from

Node.checkCollision


clone

clone(): Grid

All subclasses should override copyConstructor or provide custom implementation for this method

Returns

Grid

clone

Overrides

Node.clone


connectStyle

connectStyle(style, type, callback): Grid

Connects style.

This convenience method subscribes a listener to given style for the specified type.
And automatically un-subscribes listener if node is disposed to prevent memory leaks

Parameters

Name Type Description
styleEventDispatcherconnect style
typestringtype of event or property
callbackAttributeCallback<EventDispatcher>function to be called

Returns

Grid

this

Inherited from

Node.connectStyle


copyConstructor

Protected copyConstructor(src, deepCopy?): Grid

Copy constructor function.
Function used as part of the cloning mechanism.
Implementations should copy the given instance state to this instance.

Parameters

Name Type Description
srcGridSource to copy from
Optional deepCopybooleandeep copy

Returns

Grid

this

Overrides

Node.copyConstructor


disconnectStyle

disconnectStyle(style, type, callback): Grid

Disconnect style
This convenience method un-subscribes a listener to given style for the specified type.

Parameters

Name Type Description
styleEventDispatcherconnect style
typestringtype of event or property
callbackAttributeCallback<EventDispatcher>function to be called

Returns

Grid

this

Inherited from

Node.disconnectStyle


dispose

dispose(): void

Disposes this node, once disposes a node should not be used anymore.
Clear all listeners, and disconnect styles to avoid memory leaks.
Also aggressively 'cleanup' this node by setting some of its members to null.

Returns

void

Inherited from

Node.dispose


enableEventPropagation

enableEventPropagation(enable): Grid

Enable event propagation from the node hierarchy from bottom to top

This option is similar to DOM Event bubbling, which allows to get any event from child node. By default it is disabled for better performance.

Example

import {Group} from '@int/geotoolkit/scene/Group';
import {Events as SceneEvents} from '@int/geotoolkit/scene/Node';
const parentGroup = new Group()
.setName('ParentGroup')
.enableEventPropagation(true);
const childGroup = new Group()
.setName('ChildGroup');

parentGroup.addChild(childGroup);
parentGroup.on(SceneEvents.Invalidate, (eventName, sender, args) => {
// Got notifications from all children of parent group
});
childGroup.invalidate();

Parameters

Name Type Description
enablebooleanenable

Returns

Grid

this

Inherited from

Node.enableEventPropagation


execute

execute(delegate): Grid

Executes delegate and return the result. It allows us to keep all initialization calls in one place,
and we do not need to scroll up or down in IDE to find how and where it was initialized.

Example

// All setters (.setName() for example) returns reference to the this.
// In order to modify inner object like LineStyle or Pattern, to get this object (property) we should call getter to get object reference.
// Then modify it as shown below in Option 1 or you can use execute methods shown in Option 2.
import {Group} from '@int/geotoolkit/scene/Group';
import {Rect} from '@int/geotoolkit/util/Rect';
// Option 1
const group = new Group()
.setName('MyGroup')
.setBounds(new Rect(0, 0, 42, 16))
.enableClipping(true)
.setTag({'type': 'sometype'});

group.getLineStyle().setPattern('pattern');
return group;

// Options 2 ( using execute method )
return group
.execute(function () {
this.getLineStyle()
.setPattern("pattern");
});

Parameters

Name Type Description
delegate(this: Grid) => voidFunction to execute

Returns

Grid

The result if any or this

Inherited from

Node.execute

execute<T>(delegate): T

Type parameters

Name
T

Parameters

Name Type
delegate(this: Grid) => T

Returns

T

Inherited from

Node.execute


getAxisDimension

getAxisDimension(orient): AxisMappingDimension

Returns axis dimension to synchronize tick generator parameters with external source

Parameters

Name Type Description
orientOrientationorientation

Returns

AxisMappingDimension


getBounds

getBounds(): Rect

Gets bounds in the parent coordinates

Returns

Rect

a bounds in the parent coordinates.

Implementation of

IModel.getBounds


getClassName

getClassName(): string

Returns

string

Inherited from

Node.getClassName


getCssClass

getCssClass(): string

Returns css class name to be used to apply CSS style

Returns

string

the css class name

Inherited from

Node.getCssClass


getCssClasses

getCssClasses(): string[]

Gets list of css class names which applied to this node

Returns

string[]

Inherited from

Node.getCssClasses


getId

getId(): string | number

Returns the associated identifier of the node

Returns

string | number

The node's id

Inherited from

Node.getId


getInfiniteMode

getInfiniteMode(): boolean

Return infinity mode flag

Returns

boolean

flag


getLineStyle

getLineStyle(orient, tickGrade): LineStyle

Gets line style for the specified tick type and orientation

Parameters

Name Type Description
orientOrientationorientation
tickGradestringtick type, which supports tick generator like "major", "minor"

Returns

LineStyle


getModelLimits

getModelLimits(): Rect

Gets model limits, the limits of this node inside space.

Returns

Rect

Implementation of

IModel.getModelLimits


getName

getName(): string

Returns the node name

Returns

string

The node name

Inherited from

Node.getName


getParent

getParent(): Node

Return parent node

Returns

Node

parent node

Inherited from

Node.getParent


getProperties

getProperties(): OptionsOut

Gets all the properties pertaining to this object

Returns

OptionsOut

properties

Overrides

Node.getProperties


getProperty

getProperty(name): any

Gets dynamic property by name. These properties can be used as a property bags

Parameters

Name Type Description
namestringproperty name

Returns

any

Inherited from

Node.getProperty


getPropertyKeys

getPropertyKeys(): string[]

Returns known properties keys

Returns

string[]

Inherited from

Node.getPropertyKeys


getRoot

getRoot(): Node

Returns root node.
If node doesn't have parent then it returns itself.

Returns

Node

the root node

Inherited from

Node.getRoot


getSceneTransform

getSceneTransform(): Transformation

Returns transformation from node to root scene

Returns

Transformation

a transformation from node to root scene

Inherited from

Node.getSceneTransform


getTag

getTag(): any

Returns the object associated with the node by user.

Returns

any

The node's user-object

Inherited from

Node.getTag


getTickGenerator

getTickGenerator(orient): TickGenerator

Return tick generator

Parameters

Name Type Description
orientOrientationorientation

Returns

TickGenerator

tickgenerator


getVisible

getVisible(): boolean

Return visibility of the node

Returns

boolean

true if node is visible

Inherited from

Node.getVisible


getWorldTransform

getWorldTransform(): Transformation

getWorldTransform retrieves the local transformation of the inner node coordinates to parent coordinates.

Returns

Transformation

the world transform.

Inherited from

Node.getWorldTransform


getZIndex

getZIndex(): number

Returns node z-index (null if not set)

Returns

number

Inherited from

Node.getZIndex


hasCssClass

hasCssClass(cssClass): boolean

Check if node has specified css class

Parameters

Name Type Description
cssClassstringcss class name

Returns

boolean

Inherited from

Node.hasCssClass


hasEventListener

hasEventListener(type, callback?): boolean

Check if a list of event listeners for this type contains this listener

Parameters

Name Type Description
typestringtype of event or property
Optional callbackFunctionto be called, if null, check if any callback is registered

Returns

boolean

Inherited from

Node.hasEventListener


invalidate

invalidate(bounds?, force?): Grid

Invalidate area of the shape. This method invalidates parent by default. invalidated from parent to root node.

Parameters

Name Type Description
Optional boundsRectbounds of the invalid rectangle in the inner node coordinates
Optional forcebooleantrue if parent should be invalidated immediately if null is provided then cache (if any will be completely refreshed) otherwise only specified rect or node.bounds will be refreshed

Returns

Grid

this

Inherited from

Node.invalidate


invalidateParent

Protected invalidateParent(bounds?, force?): Grid

Invalidate parent and notify all listeners. NOTE: Don't keep arguments of the event, because instance can be changed

Fires

Events.Invalidate

Parameters

Name Type Description
Optional boundsRectbounds of the invalid rectangle in the inner node coordinates
Optional forcebooleanforce rendering

Returns

Grid

this

Inherited from

Node.invalidateParent


isDisposed

isDisposed(): boolean

Returns whether this object has been disposed

Returns

boolean

Inherited from

Node.isDisposed


isEventPropagationEnabled

isEventPropagationEnabled(): boolean

Return true if event propagation is enabled from child to parent

Returns

boolean

Inherited from

Node.isEventPropagationEnabled


isNotificationEnabled

isNotificationEnabled(): boolean

return state of notification

Returns

boolean

current notification state

Inherited from

Node.isNotificationEnabled


isSelectable

isSelectable(): boolean

Returns true if node can be picked/selected.

Returns

boolean

The selectable flag

Inherited from

Node.isSelectable


isSilent

isSilent(): boolean

Return true if the event dispatcher doesn't notify any events

Returns

boolean

Inherited from

Node.isSilent


notify

notify<E>(event, source, args?): Grid

Notify listeners of the Node

Type parameters

NameType
Eextends string

Parameters

Name Type Description
eventEtype of event
sourceNodesource who called the event
Optional argsEventMap[E]event arguments

Returns

Grid

this

Inherited from

Node.notify


off

off<E>(type?, callback?): Grid

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.

Type parameters

NameType
Eextends string

Parameters

Name Type Description
Optional typeEtype of the event
Optional callback(eventType: E, sender: Grid, args: EventMap[E]) => voidfunction to be called

Returns

Grid

this

Inherited from

Node.off


on

on<E>(type, callback): Grid

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.

Type parameters

NameType
Eextends string

Parameters

Name Type Description
typeEtype of event or property
callback(eventType: E, sender: Grid, args: EventMap[E]) => voidto be called

Returns

Grid

this

Inherited from

Node.on


onAxisDimensionChanged

Protected onAxisDimensionChanged(dimension): void

Called if axis dimension is changed

Parameters

Name Type Description
dimensionAxisDimensiondimension

Returns

void


onParentChanged

Protected onParentChanged(node): Grid

This method is called when parent changes. Do not call it directly.

Parameters

Name Type Description
nodeNodenode to change parent

Returns

Grid

this

Inherited from

Node.onParentChanged


onVisibilityChanged

Protected onVisibilityChanged(): void

This method is called if visibility is changed. Send event Events.VisibilityChanged

Returns

void

Inherited from

Node.onVisibilityChanged


removeCssClass

removeCssClass(cssclass): Grid

Removes css class from node

Parameters

Name Type Description
cssclassstring | string[]css class name('s)

Returns

Grid

this

Inherited from

Node.removeCssClass


removeInvalidateHandler

removeInvalidateHandler(handler): Grid

Remove invalidate handler

Deprecated

since 4.0, use Node.off instead

Parameters

Name Type Description
handlerFunctionhandler to be notified about invalidation

Returns

Grid

this

Inherited from

Node.removeInvalidateHandler


render

render(context): void

Renders node

Parameters

Name Type Description
contextRenderingContextThe rendering context to be used to draw the node

Returns

void

Overrides

Node.render


renderAsync

renderAsync(context, callback): void

Render node in asynchronous mode. Default implementation creates call method "render" inside

Parameters

Name Type Description
contextRenderingContextThe rendering context to be used to draw the node
callback() => voidcallback function

Returns

void

Inherited from

Node.renderAsync


setAxisDimension

setAxisDimension(orient, dimension): Grid

Sets axis dimension to synchronize tick generator parameters with external source

Parameters

Name Type Description
orientOrientationorientation
dimensionAxisMappingDimensiondimension

Returns

Grid


setCssClass

setCssClass(name): Grid

Sets css class name of the node to be used to apply CSS style

Parameters

Name Type Description
namestringcss class name of the node

Returns

Grid

this

Inherited from

Node.setCssClass


setId

setId(id): Grid

Allows the user to associate any identifier

Parameters

Name Type Description
idstring | numberobject id

Returns

Grid

this

Inherited from

Node.setId


setInfiniteMode

setInfiniteMode(infinityMode): Grid

Set infinity mode flag to draw axis outside the model limits

Parameters

Name Type Description
infinityModebooleaninfinity mode flag

Returns

Grid

this


setLineStyle

setLineStyle(orient, tickGrade, lineStyle, merge?): Grid

Sets line style for the specified tick type and orientation

Parameters

Name Type Description
orientOrientationorientation
tickGradestringtick type, which supports tick generator like "major", "minor"
lineStyleTypeline style for the specified tick type
Optional mergebooleantrue if you want to merge lineStyle with existing attribute, false by default

Returns

Grid

this


setName

setName(name): Grid

Sets name of the node

Parameters

Name Type Description
namestringThe node name

Returns

Grid

this

Inherited from

Node.setName


setNotification

setNotification(notify, force?): Grid

set notification state

Parameters

Name Type Description
notifybooleanflag set to invalidate parent or not
Optional forcebooleantrue if parent should be invalidated immediately

Returns

Grid

this

Inherited from

Node.setNotification


setProperties

setProperties(properties?): Grid

Sets all the properties pertaining to this object

Parameters

Name Type Description
Optional propertiesOptionsAn object containing the properties to set

Returns

Grid

Overrides

Node.setProperties


setProperty

setProperty(name, value): Grid

Sets dynamic property by name

Parameters

Name Type Description
namestringproperty name
valueanyproperty value

Returns

Grid

this

Inherited from

Node.setProperty


setSelectable

setSelectable(selectable): Grid

Allows to select node. If node is not selectable then child node is not selectable.

Parameters

Name Type Description
selectablebooleanflag to allow node selection

Returns

Grid

this

Inherited from

Node.setSelectable


setSilent

setSilent(bool): Grid

Set silent mode

Parameters

Name Type Description
boolbooleanflag to enable silent mode

Returns

Grid

this

Inherited from

Node.setSilent


setTag

setTag(tag): Grid

Allows the user to associate any arbitrary object with the node.

Parameters

Name Type Description
taganyThe object to be associated with the node.

Returns

Grid

this

Inherited from

Node.setTag


setTickGenerator

setTickGenerator(orient, tg): Grid

Sets tick generator

Parameters

Name Type Description
orientOrientationorientation
tgTickGeneratora new tick generator

Returns

Grid


setVisible

setVisible(value): Grid

Sets visibility of the node. Send event Events.VisibilityChanged

Parameters

Name Type Description
valuebooleanflag specifying visibility of the node

Returns

Grid

this

Inherited from

Node.setVisible


setZIndex

setZIndex(value): Grid

Sets z-index for node (set null for default)

Parameters

Name Type Description
valuenumberindex determining node z-position

Returns

Grid

this

Inherited from

Node.setZIndex


toString

toString(): string

Returns a string representation of this object (generally the classname)

Returns

string

A string representation

Inherited from

Node.toString


updateSceneTransformation

updateSceneTransformation(): Grid

Update scene transformation

Returns

Grid

this

Inherited from

Node.updateSceneTransformation


updateState

updateState(regions?, changes?): Grid

Update state. These methods reset node state and update state for children. this method is useful to refresh a scene graph

Parameters

Name Type Description
Optional regionsRect[]optional array to return invalid rectangles in the parent coordinates
Optional changesStateChangesoptional parameter to specify a reason of changes

Returns

Grid

this

Inherited from

Node.updateState


updateTimeStamp

Protected updateTimeStamp(): Grid

Update time stamp to indicate that Node or Children has been changed.

Returns

Grid

this

Inherited from

Node.updateTimeStamp


enableSceneGraphNotification

Static enableSceneGraphNotification(enabled): void

Enable / disable all notifications

Parameters

Name Type Description
enabledbooleansets if this object sends notifications

Returns

void

Inherited from

Node.enableSceneGraphNotification


findParent

Static findParent<T>(node, classType, filter?): InstanceType<T>

Find root of the node with specified type

Type parameters

NameType
Textends Constructor<any>

Parameters

Name Type Description
nodeNodenode to start search
classTypeTtype of the class to search for
Optional filter(node: Node) => booleanadditional filter to apply

Returns

InstanceType<T>

Inherited from

Node.findParent

Static findParent(node, classType, filter?): Node

Find root of the node with specified type

Parameters

Name Type Description
nodeNodenode to start search
classTypestringinterface name to search for
Optional filter(node: Node) => booleanadditional filter to apply

Returns

Node

Inherited from

Node.findParent


getClassName

Static getClassName(): string

Returns

string

Inherited from

Node.getClassName


isSceneGraphNotificationEnabled

Static isSceneGraphNotificationEnabled(): boolean

Return status of the global notification for all nodes.

Returns

boolean

Inherited from

Node.isSceneGraphNotificationEnabled