JSLayerList

Provides an API for managing layers within a map.

Creates a Module.JSLayerList API.

let userlayer = new Module.JSLayerList(true); // Returns a user layer

let serverlayer = new Module.JSLayerList(false); // Returns a service layer

Function

count() → number

Returns the total number of layers.

Total number of user and service layers.

  • Return

    • Total number of layers.

createLayer(name, type) → JSLayer

Creates a new layer with the specified layer type.

Name
Type
Description

name

string

Name of the layer to create.

type

number

  • Return

    • JSLayer : Successfully returns the layer.

    • null : Fails to return the layer.

createObjectLayer(option) → JSLayer

Creates a new layer with the specified layer type.

Sets the layer object with an argument variable.

Returns a user layer.

Name
Type
Description

option

Layer creation property information

  • Return

    • JSLayer : Successfully returns the layer.

    • null : Fails to return the layer.

createWFSLayer(name, type) → JSLayer

Creates a WFS layer.

Requests objects corresponding to the visualized Tile area from the Web Feature Server.

Use new Module.JSLayerList(false) for WFS service layers.

Name
Type
Description

Name

string

Name of the layer to create.

type

number

  • Return

    • JSLayer : Successfully returns the layer.

    • null : Fails to return the layer.

createWMSLayer( name ) → JSLayer

Creates a WMS layer.

Requests terrain imagery images corresponding to the visualized Tile area from the Web Map Server.

Use new Module.JSLayerList(false) for WMS service layers.

Name
Type
Description

Name

string

Name of the layer to create.

  • Return

    • JSLayer : Successfully returns the layer.

    • null : Fails to return the layer.

createXDServerLayer(option) → JSLayer

Creates a new layer with the specified layer type.

Sets the layer object with an argument variable.

Returns a service layer.

Name
Type
Description

option

Layer creation property information

  • Return

    • JSLayer : Successfully returns the layer.

    • null : Fails to return the layer.

delLayerAtFirst() → boolean

Deletes a layer.

Deletes the layer at the first order in the layer list.

Available for both user and service layers.

  • Return

    • true : Successfully deletes the first order layer.

    • false : Fails to delete the first order layer.

delLayerAtIndex(index) → boolean

Deletes a layer.

Deletes the layer at the specified index.

Available for both user and service layers.

Name
Type
Description

index

number

Target layer index.

  • Return

    • true : Successfully deletes the target index layer.

    • false : Fails to delete the target index layer.

delLayerAtLast() → boolean

Deletes a layer.

Deletes the layer at the last order in the layer list.

Available for both user and service layers.

  • Return

    • true : Successfully deletes the last order layer.

    • false : Fails to delete the last order layer.

delLayerAtName(name) → boolean

Deletes a layer.

Deletes the layer with the specified name.

Available for both user and service layers.

Name
Type
Description

name

string

Target layer name.

  • Return

    • true : Successfully deletes the target layer.

    • false : Fails to delete the target layer.

firstAtLayer() → JSLayer

Returns a layer.

Returns the layer at the first order in the layer list.

Available for both user and service layers.

  • Return

    • JSLayer : Successfully returns the layer.

    • null : Fails to return the layer.

indexAtLayer(index) → JSLayer

Returns a layer.

Returns the layer at the specified index.

Available for both user and service layers.

Name
Type
Description

index

number

Target layer index.

  • Return

    • JSLayer : Successfully returns the layer.

    • null : Fails to return the layer.

lastAtLayer() → JSLayer

Returns a layer.

Returns the layer at the last order in the layer list.

Available for both user and service layers.

  • Return

    • JSLayer : Successfully returns the layer.

    • null : Fails to return the layer.

layerAtIndex(layer) → number

Checks the index of the specified layer.

Available for both user and service layers.

Name
Type
Description

layer

Layer to check the index for.

  • Return

    • -1 : If the layer does not exist in the layer list.

    • result>0 : Index number of the checked layer.

nameAtLayer(name) → JSLayer

Returns a created layer.

Returns a layer with the same name.

Available for both user and service layers.

Name
Type
Description

name

string

Name of the layer to return.

  • Return

    • JSLayer : Successfully returns the layer.

    • null : Fails to return the layer.

setLayerMove(layer, type) → boolean

Changes the order of a layer.

Changes the index order of the specified layer based on the move condition.

Available for both user and service layers.

Name
Type
Description

layer

Target layer.

type

boolean

true to increase the index. false to decrease the index.

  • Return

    • true : Successfully changes the order.

    • false: Fails to change the order.

    • Conditions for order change failure

      • Less than 2 layers in the layer list.

      • Attempting to move the last order layer down one level.

      • Attempting to move the first order layer up one level.

setLayerTopNBottom(layer, type) → boolean

Changes the order of a layer.

Changes the index order of the specified layer to the top or bottom based on the type condition.

Available for both user and service layers.

Name
Type
Description

layer

Target layer.

type

boolean

true to move the index to the top. false to move the index to the bottom.

  • Return

    • true : Successfully changes the order.

    • false: Fails to change the order.

    • Conditions for order change failure.

      • Less than 2 layers in the layer list.

      • Attempting to move the last order layer down one level.

      • Attempting to move the first order layer up one level.

getVisible(name) → number

Returns the visibility option information of a layer.

Returns the information on whether the layer is transparent/semi-transparent.

Available for both user and service layers.

Name
Type
Description

name

string

Layer name.

  • Return

    • 0 : Transparent state.

    • 1 : Visible state.

setVisible(name, type)

Sets the visibility option of a layer.

Sets the layer to a transparent/semi-transparent state.

Available for both user and service layers.

Name
Type
Description

name

string

Name of the target layer.

type

boolean

true to make the layer visible. false to hide the layer.

Type Definitions

CreateObjectLayerOptions

Options for creating an object layer.

Name
Type
Attributes
Default
Description

name

String

Name of the layer to create.

type

Type of the layer.

visible

boolean

optional

true

Sets the layer visibility option.

selectable

boolean

optional

true

Sets the option for object selection within the layer.

minDistance

number

optional

0.0

Sets the minimum visibility distance of the layer.

maxDistance

number

optional

3000.0

Sets the maximum visibility distance of the layer.

CreateServerLayerOptions

Options for creating a service layer.

Name
Type
Attributes
Default
Description

name

String

Name of the layer to create.

url

String

Request server URL.

type

Type of the layer.

visible

boolean

optional

true

Sets the layer visibility option.

selectable

boolean

optional

true

Sets the option for object selection within the layer.

minLevel

number

optional

0

Sets the minimum visibility level of the layer.

maxLevel

number

optional

15

Sets the maximum visibility level of the layer.

Last updated