API / geotoolkit / axis / Grid / Grid
Creates a grid that will fill its parent container with grid lines
↳
Grid
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 |
|---|---|---|
cssclass | string | The css class name of this node |
htg | TickGenerator | Horizontal tick generator |
htg-labelstyles | TextStyle | An object containing label style for specified grades |
htg-labelstyles-alignment | AlignmentStyle | Alignment |
htg-labelstyles-autosize | boolean | Auto font size on high definition display |
htg-labelstyles-background | string | Background style |
htg-labelstyles-background | FillStyle | Background style |
htg-labelstyles-background-color | string | Color in CSS form |
htg-labelstyles-background-evenoddmode | boolean | Even-odd fill mode |
htg-labelstyles-background-fillpattern | Pattern | Pattern |
htg-labelstyles-background-fillpattern-containername | string | An 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-patternname | string | Name of this pattern for indexing |
htg-labelstyles-background-fillpattern-scalable | boolean | Flag that sets scalability of the pattern coordinates, or relative to the shape it is filling (It is not supported) |
htg-labelstyles-background-foreground | string | Foreground color |
htg-labelstyles-background-pattern | Pattern | Pattern |
htg-labelstyles-baseline | BaseLineStyle | Base line |
htg-labelstyles-color | string | Color in CSS form |
htg-labelstyles-fill | FillStyle | Text fill style |
htg-labelstyles-font | string | Font see |
htg-labelstyles-fonturl | string | The place from which the font will be loaded, if null - uses system fonts. It can be base64 with url keyword |
htg-labelstyles-lineheight | string | number | Line height |
htg-labelstyles-multiline | boolean | Allow multi-line text |
htg-labelstyles-outline | string | Outline style |
htg-labelstyles-outline | LineStyle | Outline style |
htg-labelstyles-outline-color | string | Color in CSS form |
htg-labelstyles-outline-fill | string | Optional fill style to be used to fill lines generated with this style |
htg-labelstyles-outline-fill | FillStyle | Optional fill style to be used to fill lines generated with this style |
htg-labelstyles-outline-linecap | CapStyle | The line cap style |
htg-labelstyles-outline-linedashoffset | number | Line dash offset of dashed line |
htg-labelstyles-outline-linejoin | JoinStyle | The line join style |
htg-labelstyles-outline-pixelsnapmode | boolean | Pixel Snap Mode, default( |
htg-labelstyles-outline-scalable | boolean | True if width should depend on transformation |
htg-labelstyles-outline-unit | string | Optional unit for the width |
htg-labelstyles-outline-width | number | string | The line thickness |
htg-labelstyles-overflowwrap | OverflowWrapStyle | Overflow wrap |
htg-labelstyles-strikethrough | string | Strikethrough style |
htg-labelstyles-strikethrough | LineStyle | Strikethrough style |
htg-labelstyles-textoverflow | TextOverflowStyle | Text overflow |
htg-labelstyles-underline | string | Underline style |
htg-labelstyles-underline | LineStyle | Underline style |
htg-labelstyles-underlineoffset | string | number | Underline offset distance |
htg-labelstyles-whitespace | WhiteSpaceStyle | White space |
htg-labelstyles-wordbreak | WordBreakStyle | Word break |
htg-tag | any | Tag user can specify info associated with current object |
htg-tickstyles | LineStyle | An object containing tick styles for specified grades |
id | string | number | Id of the node, its a unique identifier |
infinity | boolean | Infinity mode flag |
name | string | Name of the node. It is often used for debugging purposes or to simplify queries |
selectable | boolean | Selectable node, a boolean to determine if selection should consider this node |
tag | any | Custom 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 |
visible | boolean | Visibility of the node, a boolean to determine if the node should be rendered or not |
vtg | TickGenerator | Vertical tick generator |
z-index | number | Define node z-index |
Constructors
• new Grid(htg, vtg?)
| Name | Type |
|---|---|
htg | TickGenerator |
Optional vtg | TickGenerator |
Node.constructor
• new Grid(options?)
| Name | Type |
|---|---|
Optional options | Options |
Node.constructor
Methods
▸ addCssClass(cssclass): Grid
Adds new css class to node
| Name | Type | Description |
|---|---|---|
cssclass | string | string[] | css class name('s) |
this
▸ addInvalidateHandler(handler): Grid
Add invalidate handler
Deprecated
since 4.0, use Node.on instead
| Name | Type | Description |
|---|---|---|
handler | Function | handler to be notified about invalidation |
this
▸ checkCollision(context): boolean
Check if this node is within the area being rendered by the context
| Name | Type | Description |
|---|---|---|
context | RenderingContext | Rendering Context |
boolean
true if object is inside of renderable area
▸ clone(): Grid
All subclasses should override copyConstructor or provide custom implementation for this method
clone
▸ 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
| Name | Type | Description |
|---|---|---|
style | EventDispatcher | connect style |
type | string | type of event or property |
callback | AttributeCallback<EventDispatcher> | function to be called |
this
▸ 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.
| Name | Type | Description |
|---|---|---|
src | Grid | Source to copy from |
Optional deepCopy | boolean | deep copy |
this
▸ disconnectStyle(style, type, callback): Grid
Disconnect style
This convenience method un-subscribes a listener to given style for the specified type.
| Name | Type | Description |
|---|---|---|
style | EventDispatcher | connect style |
type | string | type of event or property |
callback | AttributeCallback<EventDispatcher> | function to be called |
this
▸ 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.
void
▸ 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();| Name | Type | Description |
|---|---|---|
enable | boolean | enable |
this
▸ 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");
});| Name | Type | Description |
|---|---|---|
delegate | (this: Grid) => void | Function to execute |
The result if any or this
▸ execute<T>(delegate): T
| Name |
|---|
T |
| Name | Type |
|---|---|
delegate | (this: Grid) => T |
T
▸ getAxisDimension(orient): AxisMappingDimension
Returns axis dimension to synchronize tick generator parameters with external source
| Name | Type | Description |
|---|---|---|
orient | Orientation | orientation |
▸ getBounds(): Rect
Gets bounds in the parent coordinates
a bounds in the parent coordinates.
▸ getClassName(): string
string
▸ getCssClass(): string
Returns css class name to be used to apply CSS style
string
the css class name
▸ getCssClasses(): string[]
Gets list of css class names which applied to this node
string[]
▸ getId(): string | number
Returns the associated identifier of the node
string | number
The node's id
▸ getInfiniteMode(): boolean
Return infinity mode flag
boolean
flag
▸ getLineStyle(orient, tickGrade): LineStyle
Gets line style for the specified tick type and orientation
| Name | Type | Description |
|---|---|---|
orient | Orientation | orientation |
tickGrade | string | tick type, which supports tick generator like "major", "minor" |
▸ getModelLimits(): Rect
Gets model limits, the limits of this node inside space.
▸ getName(): string
Returns the node name
string
The node name
▸ getParent(): Node
Return parent node
parent node
▸ getProperties(): OptionsOut
Gets all the properties pertaining to this object
properties
▸ getProperty(name): any
Gets dynamic property by name. These properties can be used as a property bags
| Name | Type | Description |
|---|---|---|
name | string | property name |
any
▸ getPropertyKeys(): string[]
Returns known properties keys
string[]
▸ getRoot(): Node
Returns root node.
If node doesn't have parent then it returns itself.
the root node
▸ getSceneTransform(): Transformation
Returns transformation from node to root scene
a transformation from node to root scene
▸ getTag(): any
Returns the object associated with the node by user.
any
The node's user-object
▸ getTickGenerator(orient): TickGenerator
Return tick generator
| Name | Type | Description |
|---|---|---|
orient | Orientation | orientation |
tickgenerator
▸ getVisible(): boolean
Return visibility of the node
boolean
true if node is visible
▸ getWorldTransform(): Transformation
getWorldTransform retrieves the local transformation of the inner node coordinates to parent coordinates.
the world transform.
▸ getZIndex(): number
Returns node z-index (null if not set)
number
▸ hasCssClass(cssClass): boolean
Check if node has specified css class
| Name | Type | Description |
|---|---|---|
cssClass | string | css class name |
boolean
▸ 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
▸ invalidate(bounds?, force?): Grid
Invalidate area of the shape. This method invalidates parent by default. invalidated from parent to root node.
| Name | Type | Description |
|---|---|---|
Optional bounds | Rect | bounds of the invalid rectangle in the inner node coordinates |
Optional force | boolean | true 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 |
this
▸ 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
| Name | Type | Description |
|---|---|---|
Optional bounds | Rect | bounds of the invalid rectangle in the inner node coordinates |
Optional force | boolean | force rendering |
this
▸ isDisposed(): boolean
Returns whether this object has been disposed
boolean
▸ isEventPropagationEnabled(): boolean
Return true if event propagation is enabled from child to parent
boolean
Node.isEventPropagationEnabled
▸ isNotificationEnabled(): boolean
return state of notification
boolean
current notification state
▸ isSelectable(): boolean
Returns true if node can be picked/selected.
boolean
The selectable flag
▸ isSilent(): boolean
Return true if the event dispatcher doesn't notify any events
boolean
▸ notify<E>(event, source, args?): Grid
Notify listeners of the Node
| Name | Type |
|---|---|
E | extends string |
| Name | Type | Description |
|---|---|---|
event | E | type of event |
source | Node | source who called the event |
Optional args | EventMap[E] | event arguments |
this
▸ 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.
| Name | Type |
|---|---|
E | extends string |
| Name | Type | Description |
|---|---|---|
Optional type | E | type of the event |
Optional callback | (eventType: E, sender: Grid, args: EventMap[E]) => void | function to be called |
this
▸ 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.
| Name | Type |
|---|---|
E | extends string |
| Name | Type | Description |
|---|---|---|
type | E | type of event or property |
callback | (eventType: E, sender: Grid, args: EventMap[E]) => void | to be called |
this
▸ Protected onAxisDimensionChanged(dimension): void
Called if axis dimension is changed
| Name | Type | Description |
|---|---|---|
dimension | AxisDimension | dimension |
void
▸ Protected onParentChanged(node): Grid
This method is called when parent changes. Do not call it directly.
| Name | Type | Description |
|---|---|---|
node | Node | node to change parent |
this
▸ Protected onVisibilityChanged(): void
This method is called if visibility is changed. Send event Events.VisibilityChanged
void
▸ removeCssClass(cssclass): Grid
Removes css class from node
| Name | Type | Description |
|---|---|---|
cssclass | string | string[] | css class name('s) |
this
▸ removeInvalidateHandler(handler): Grid
Remove invalidate handler
Deprecated
since 4.0, use Node.off instead
| Name | Type | Description |
|---|---|---|
handler | Function | handler to be notified about invalidation |
this
▸ render(context): void
Renders node
| Name | Type | Description |
|---|---|---|
context | RenderingContext | The rendering context to be used to draw the node |
void
▸ renderAsync(context, callback): void
Render node in asynchronous mode. Default implementation creates call method "render" inside
| Name | Type | Description |
|---|---|---|
context | RenderingContext | The rendering context to be used to draw the node |
callback | () => void | callback function |
void
▸ setAxisDimension(orient, dimension): Grid
Sets axis dimension to synchronize tick generator parameters with external source
| Name | Type | Description |
|---|---|---|
orient | Orientation | orientation |
dimension | AxisMappingDimension | dimension |
▸ setCssClass(name): Grid
Sets css class name of the node to be used to apply CSS style
| Name | Type | Description |
|---|---|---|
name | string | css class name of the node |
this
▸ setId(id): Grid
Allows the user to associate any identifier
| Name | Type | Description |
|---|---|---|
id | string | number | object id |
this
▸ setInfiniteMode(infinityMode): Grid
Set infinity mode flag to draw axis outside the model limits
| Name | Type | Description |
|---|---|---|
infinityMode | boolean | infinity mode flag |
this
▸ setLineStyle(orient, tickGrade, lineStyle, merge?): Grid
Sets line style for the specified tick type and orientation
| Name | Type | Description |
|---|---|---|
orient | Orientation | orientation |
tickGrade | string | tick type, which supports tick generator like "major", "minor" |
lineStyle | Type | line style for the specified tick type |
Optional merge | boolean | true if you want to merge lineStyle with existing attribute, false by default |
this
▸ setName(name): Grid
Sets name of the node
| Name | Type | Description |
|---|---|---|
name | string | The node name |
this
▸ setNotification(notify, force?): Grid
set notification state
| Name | Type | Description |
|---|---|---|
notify | boolean | flag set to invalidate parent or not |
Optional force | boolean | true if parent should be invalidated immediately |
this
▸ setProperties(properties?): Grid
Sets all the properties pertaining to this object
| Name | Type | Description |
|---|---|---|
Optional properties | Options | An object containing the properties to set |
▸ setProperty(name, value): Grid
Sets dynamic property by name
| Name | Type | Description |
|---|---|---|
name | string | property name |
value | any | property value |
this
▸ setSelectable(selectable): Grid
Allows to select node. If node is not selectable then child node is not selectable.
| Name | Type | Description |
|---|---|---|
selectable | boolean | flag to allow node selection |
this
▸ setSilent(bool): Grid
Set silent mode
| Name | Type | Description |
|---|---|---|
bool | boolean | flag to enable silent mode |
this
▸ setTag(tag): Grid
Allows the user to associate any arbitrary object with the node.
| Name | Type | Description |
|---|---|---|
tag | any | The object to be associated with the node. |
this
▸ setTickGenerator(orient, tg): Grid
Sets tick generator
| Name | Type | Description |
|---|---|---|
orient | Orientation | orientation |
tg | TickGenerator | a new tick generator |
▸ setVisible(value): Grid
Sets visibility of the node. Send event Events.VisibilityChanged
| Name | Type | Description |
|---|---|---|
value | boolean | flag specifying visibility of the node |
this
▸ setZIndex(value): Grid
Sets z-index for node (set null for default)
| Name | Type | Description |
|---|---|---|
value | number | index determining node z-position |
this
▸ toString(): string
Returns a string representation of this object (generally the classname)
string
A string representation
▸ updateSceneTransformation(): Grid
Update scene transformation
this
Node.updateSceneTransformation
▸ 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
| Name | Type | Description |
|---|---|---|
Optional regions | Rect[] | optional array to return invalid rectangles in the parent coordinates |
Optional changes | StateChanges | optional parameter to specify a reason of changes |
this
▸ Protected updateTimeStamp(): Grid
Update time stamp to indicate that Node or Children has been changed.
this
▸ Static enableSceneGraphNotification(enabled): void
Enable / disable all notifications
| Name | Type | Description |
|---|---|---|
enabled | boolean | sets if this object sends notifications |
void
Node.enableSceneGraphNotification
▸ Static findParent<T>(node, classType, filter?): InstanceType<T>
Find root of the node with specified type
| Name | Type |
|---|---|
T | extends Constructor<any> |
| Name | Type | Description |
|---|---|---|
node | Node | node to start search |
classType | T | type of the class to search for |
Optional filter | (node: Node) => boolean | additional filter to apply |
InstanceType<T>
▸ Static findParent(node, classType, filter?): Node
Find root of the node with specified type
| Name | Type | Description |
|---|---|---|
node | Node | node to start search |
classType | string | interface name to search for |
Optional filter | (node: Node) => boolean | additional filter to apply |
▸ Static getClassName(): string
string
▸ Static isSceneGraphNotificationEnabled(): boolean
Return status of the global notification for all nodes.
boolean