API / geotoolkit / map / layers / WMSTile / WMSTile
This shape connects to WMS server to display a map with the tiles approach. Has its pros and cons compared to the standard WMS layer such as strict tiling structure but potentially better performance.
↳
WMSTile
Constructors
Methods
Css Properties
| Name | Type | Description |
|---|---|---|
alpha | number | The alpha of the layer |
cssclass | string | The css class name of this node |
format | string | The image format used by the layer |
id | string | number | Id of the node, its a unique identifier |
imagepool | number | The amount of cache for the tile images |
limits | Rect | Limits of this layer |
limits-height | number | Height |
limits-readonly | boolean | Readonly |
limits-width | number | Width |
limits-x | number | Left |
limits-y | number | Top |
maxlod | number | The maximum level of details for the tiles |
minlod | number | The minimum level of details for the tiles |
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 |
source | AbstractSource | The layer data source |
source-system | string | Initial data coordinate system |
source-url | string | Data server url |
source | Tile | Tile source |
source-imagepool | number | The amount of cache for the tile images |
source-maxlod | number | The maximum level of details for the tiles |
source-minlod | number | The minimum level of details for the tiles |
source-system | string | Initial data coordinate system |
source-tileheight | number | Height for the tiles to use (in px) |
source-tilewidth | number | Width for the tiles to use (in px) |
source-token | string | Authorization token (for ArcGIS tile servers if needed) |
source-url | string | Data server url |
system | GeodeticSystem | Coordinate system this layer's data is in |
system | string | Initial data coordinate system |
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 |
tileheight | number | Height for the tiles to use (in px) |
tilewidth | number | Width for the tiles to use (in px) |
token | string | Authorization token (for ArcGIS tile servers if needed) |
transparent | boolean | The layer transparency |
url | string | Server url |
url | string | Data server url |
version | string | The WMS version currently used |
visible | boolean | Visibility of the node, a boolean to determine if the node should be rendered or not |
z-index | number | Define node z-index |
Constructors
• new WMSTile(options?)
| Name | Type | Description |
|---|---|---|
Optional options | Options | layer options |
Tile.constructor
Methods
▸ addCssClass(cssclass): WMSTile
Adds new css class to node
| Name | Type | Description |
|---|---|---|
cssclass | string | string[] | css class name('s) |
this
▸ addInvalidateHandler(handler): WMSTile
Add invalidate handler
Deprecated
since 4.0, use Node.on instead
| Name | Type | Description |
|---|---|---|
handler | Function | handler to be notified about invalidation |
this
▸ Protected calculateDefaultModelLimits(data?): Rect
Returns default model limits (based on the map coordinate system)
| Name | Type | Description |
|---|---|---|
Optional data | AbstractFeature[] | Iterator<AbstractFeature> | feature data changed (for feature layers), nothing otherwise |
Tile.calculateDefaultModelLimits
▸ 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
▸ clearCache(): WMSTile
Clear cache
this
▸ clone(): Node
All subclasses should override copyConstructor or provide custom implementation for this method
clone
▸ connectStyle(style, type, callback): WMSTile
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?): WMSTile
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 | AbstractLayer | Source to copy from |
Optional deepCopy | boolean | deep copy |
this
▸ disconnectStyle(style, type, callback): WMSTile
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 layer, once disposed it should not be used anymore.
void
▸ enableEventPropagation(enable): WMSTile
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): WMSTile
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: WMSTile) => void | Function to execute |
The result if any or this
▸ execute<T>(delegate): T
| Name |
|---|
T |
| Name | Type |
|---|---|
delegate | (this: WMSTile) => T |
T
▸ getCache(): Cache
Return cache strategy to be used to cache children nodes
cache cache strategy
▸ getClassName(): string
string
▸ getCoordinateSystem(): AbstractSystem
Return coordinate system for this layer
▸ 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[]
▸ getDataSource(): AbstractSource
Returns current data source
source
▸ getDefaultModelLimits(): Rect
Gets calculated model limits
limits calculated model limits
▸ getId(): string | number
Returns the associated identifier of the node
string | number
The node's id
▸ getImageFormat(): string
Returns the image format used by the layer
string
format image format that is used
▸ getImageFormatter(): FormatterCallback
Gets the current formatter function if the function format is used
▸ getLayerAlpha(): number
Return a the alpha of the layer between 0.0 (fully transparent) and 1.0 (fully opaque). The default value is 1.0.
number
alpha alpha
▸ getLayers(): LayerServerData[]
Gets the JSON data of the available layers for the server
▸ getMapCoordinateSystem(): AbstractSystem
Return a map coordinate system
▸ getMaxLod(): number
Gets the maximum Lod for the server
number
▸ getMinLod(): number
Gets the minimum Lod for the server
number
▸ getModelLimits(): Rect
Gets user defined model limits if set; calculated model limits otherwise
limits user defined or calculated model limits
▸ getName(): string
Returns the node name
string
The node name
▸ getOptions(): Options
Gets options
options options
▸ getParent(): Node
Return parent node
parent node
▸ getProperties(): OptionsOut
Gets all the properties pertaining to this object
object containing the 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
▸ getServerURL(): string | string[]
Gets the server url from the layer source
string | string[]
▸ getTag(): any
Returns the object associated with the node by user.
any
The node's user-object
▸ getTileResolution(): Dimension
Returns current tile resolution (in px)
▸ getTooltipFormatter(): Formatter
Returns the format function to use for the tooltip info (null if tooltips are not visible)
▸ getTransparent(): boolean
Returns the transparency of the layer
boolean
bool true if layer is transparent
▸ getVersion(): string
Returns WMS version currently used
string
▸ getVisible(): boolean
Return visibility of the node
boolean
true if node is visible
▸ getVisibleLayers(): (string | number)[]
Returns the server layer names that are requested.
(string | number)[]
layers
▸ getVisibleModelLimits(ignoreModelLimits?): Rect
Return visible model limits
| Name | Type | Description |
|---|---|---|
Optional ignoreModelLimits | boolean | flag defines whether to ignore ModelLimits or not |
▸ 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
▸ getZoomLevel(): number
Gets map zoom level
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
▸ hideLayers(id?): WMSTile
Adds the passed in ID's to the list of layers to hide
| Name | Type | Description |
|---|---|---|
Optional id | string | number | (string | number)[] | ID(s) for the layers to show |
this
▸ hitTest(pt, radius?): (AbstractNode | AbstractFeature)[]
Performs selection of the data with its device coordinates. Returns null, if no data available but will be loaded asynchronously later (fires Events.InfoUpdated).
| Name | Type | Description |
|---|---|---|
pt | Point | is the device coordinates to select |
Optional radius | number | the radius of selection (in px) |
(AbstractNode | AbstractFeature)[]
data data selected
▸ invalidate(bounds?, force?): WMSTile
Invalidate layer
| 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?): WMSTile
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
Tile.isEventPropagationEnabled
▸ isLoading(): boolean
Checks if layer data is still loading and not ready
boolean
▸ 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
▸ load(): Promise<WMSTile>
Returns promise that is resolved when all layer data is loaded and ready to be rendered
Promise<WMSTile>
▸ notify<E>(type, source, args?): WMSTile
Notify listeners of the Node
| Name | Type |
|---|---|
E | extends string |
| Name | Type | Description |
|---|---|---|
type | E | type of event |
source | AbstractLayer | source who called the event |
Optional args | EventMap[E] | event arguments |
this
▸ off<E>(type?, callback?): WMSTile
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: WMSTile, args: EventMap[E]) => void | function to be called |
this
▸ on<E>(type, callback): WMSTile
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: WMSTile, args: EventMap[E]) => void | to be called |
this
▸ Protected onParentChanged(node): WMSTile
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): WMSTile
Removes css class from node
| Name | Type | Description |
|---|---|---|
cssclass | string | string[] | css class name('s) |
this
▸ removeInvalidateHandler(handler): WMSTile
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
▸ renderContent(context): void
Renders layer content
| Name | Type | Description |
|---|---|---|
context | RenderingContext | rendering context |
void
▸ renderContentAsync(context, callback): void
Renders async layer content
| Name | Type | Description |
|---|---|---|
context | RenderingContext | the Rendering Context |
callback | () => void | callback to be called after rendering of layer content |
void
▸ setCache(cache): WMSTile
Sets cache to be used to cache
| Name | Type | Description |
|---|---|---|
cache | Cache | cache to be used |
this
▸ setCssClass(name): WMSTile
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): WMSTile
Allows the user to associate any identifier
| Name | Type | Description |
|---|---|---|
id | string | number | object id |
this
▸ setImageFormat(format): WMSTile
Sets the image format to use by the layer
| Name | Type | Description |
|---|---|---|
format | string | image format to use |
this
▸ setImageFormatter(formatter): WMSTile
Sets image format for the server This converts the z, x, y image indexes into a path that is added to the server param to locate the requested tile.
| Name | Type | Description |
|---|---|---|
formatter | FormatterCallback | image formatter |
this
▸ setLayerAlpha(alpha): WMSTile
Set the alpha of the layer
| Name | Type | Description |
|---|---|---|
alpha | number | between 0.0 (fully transparent) and 1.0 (fully opaque). The default value is 1.0. |
this
▸ setLods(min, max): WMSTile
Sets the min/max numbers of details for the server
| Name | Type | Description |
|---|---|---|
min | number | minimum Lod |
max | number | maximum Lod |
this
▸ setMapCoordinateSystem(system?): WMSTile
Sets a map coordinate system
| Name | Type | Description |
|---|---|---|
Optional system | number | AbstractSystem | GeodeticSystem | new map coordinate system |
▸ setModelLimits(limits): WMSTile
Sets model limits
| Name | Type | Description |
|---|---|---|
limits | Rect | new model limits |
this
▸ setName(name): WMSTile
Sets name of the node
| Name | Type | Description |
|---|---|---|
name | string | The node name |
this
▸ setNotification(notify, force?): WMSTile
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
▸ setOptions(options?): WMSTile
Sets options
| Name | Type | Description |
|---|---|---|
Optional options | OptionsBase & OptionsBase | object containing the properties |
this
▸ setProperties(properties?): WMSTile
Sets all the properties pertaining to this object
| Name | Type | Description |
|---|---|---|
Optional properties | Options | object containing the properties |
this
▸ setProperty(name, value): WMSTile
Sets dynamic property by name
| Name | Type | Description |
|---|---|---|
name | string | property name |
value | any | property value |
this
▸ setSelectable(selectable): WMSTile
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
▸ setServerURL(url): WMSTile
Sets the url to the layer source
| Name | Type | Description |
|---|---|---|
url | string | string[] | server url |
▸ setSilent(bool): WMSTile
Set silent mode
| Name | Type | Description |
|---|---|---|
bool | boolean | flag to enable silent mode |
this
▸ setTag(tag): WMSTile
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
▸ setTileResolution(width, height): WMSTile
Sets the resolution of the tiles from the server
| Name | Type | Description |
|---|---|---|
width | number | tile width (in px) |
height | number | tile height (in px) |
this
▸ setTransparent(transparent): WMSTile
Sets the transparency of the layer
| Name | Type | Description |
|---|---|---|
transparent | boolean | true if layer should be transparent |
this
▸ setVersion(version): WMSTile
Sets WMS version to use
| Name | Type | Description |
|---|---|---|
version | string | version to use (in '1.3.0' format) |
this
▸ setVisible(value): WMSTile
Sets visibility of the node. Send event Events.VisibilityChanged
| Name | Type | Description |
|---|---|---|
value | boolean | flag specifying visibility of the node |
this
▸ setZIndex(value): WMSTile
Sets z-index for node (set null for default)
| Name | Type | Description |
|---|---|---|
value | number | index determining node z-position |
this
▸ showLayers(id): WMSTile
Adds the passed in ID's to the list of layers to show
| Name | Type | Description |
|---|---|---|
id | string | number | (string | number)[] | id(s) for the layer(s) to show |
this
▸ toString(): string
Returns a string representation of this object (generally the classname)
string
A string representation
▸ transformFromMap(point, dst?, clamp?): Point
Transform a point from map coordinate system to layer coordinate system
| Name | Type | Description |
|---|---|---|
point | Point | point to transform |
Optional dst | Point | optional destination point |
Optional clamp | boolean | if set to true, coordinate values will be clamped |
▸ transformPoint(point, from, to, dst?, clamp?): Point
Transform point
| Name | Type | Description |
|---|---|---|
point | Point | point to transform |
from | AbstractSystem | GeodeticSystem | system converting from |
to | AbstractSystem | GeodeticSystem | system converting to |
Optional dst | Point | optional destination point |
Optional clamp | boolean | if set to true, coordinate values will be clamped |
▸ transformToMap(point, dst?, clamp?): Point
Transform a point from layer coordinate system to map coordinate system
| Name | Type | Description |
|---|---|---|
point | Point | point to transform |
Optional dst | Point | optional destination point |
Optional clamp | boolean | if set to true, coordinate values will be clamped |
▸ updateSceneTransformation(): WMSTile
Update scene transformation
this
Tile.updateSceneTransformation
▸ updateState(regions?, changes?): WMSTile
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(): WMSTile
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
Tile.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