new GoOwnToc()
Methods
-
addLayer(idLayer)
Toc/GoOwnToc.ts, line 1304 -
Adds a single layer back to the TOC and activates its legend entry. This method is typically used to restore a previously removed layer.
WORKFLOW:
- Activates the layer's legend entry if it exists
- Finds the layer in the TOC structure and marks it as active
- Sets the layer visibility and rebuilds the TOC structure
Name Type Description idLayerstring ID of the layer to add back to the TOC
-
addLayerLegend(idLayer)
Toc/GoOwnToc.ts, line 1333 -
Adds a specific layer to the legend display only. If the layer is found in the legend and is currently inactive, it will be activated and the entire layer will be added back to the TOC.
Name Type Description idLayerstring ID of the layer to add to legend display
-
addLayers(idLayers)
Toc/GoOwnToc.ts, line 1354 -
Adds multiple layers back to the TOC structure in a batch operation. This method is more efficient than calling addLayer() multiple times. Note: This method does NOT automatically rebuild the TOC structure - you should call createTocStructure() after if needed.
Name Type Description idLayersArray.<string> Array of layer IDs to add back to TOC
-
addLayersLegend(idLayers)
Toc/GoOwnToc.ts, line 1388 -
This function allows you add a group of layers from the legend
Name Type Description idLayersArray.<string> Array of layers to add
-
addNewLayer(layerConfig){void}
Toc/GoOwnToc.ts, line 1373 -
Adds a new layer to the TOC and updates the configuration.
Name Type Description layerConfigtypes.layerOptions The configuration object for the new layer to be added.
Returns:
Type Description void -
cleanArrFolder(arrFolder)
Toc/GoOwnToc.ts, line 659 -
This function returns a cleaned array without empty elements
Name Type Description arrFolderArray.<string> Array of URL splitted by '/'
-
createCustomLegend(mapID, customLegendElement){GoCustomLegend}
Toc/GoOwnToc.ts, line 1475 -
Creates a custom legend for the map and associates it with the TOC.
Name Type Description mapIDstring The ID of the map for which the custom legend is created.
customLegendElementHTMLDivElement The HTML div element that represents the custom legend.
Returns:
Type Description GoCustomLegend The created GoCustomLegendinstance. -
createStageToc(config)
Toc/GoOwnToc.ts, line 174 -
Initializes the TOC structure based on the provided configuration. This method creates the complete TOC and legend structure from the config.json file.
IMPORTANT: Base layers should NOT be included in legends, so they are filtered out during legend creation.
Name Type Description configany The map configuration object containing layer and TOC settings
-
createTocStructure(stageToc)
Toc/GoOwnToc.ts, line 351 -
This function creates HTML structure taking in account the stageToc generated in previous step
Name Type Description stageTocmodule:types~ownToc TOC configuration variable
-
getFolderId(urlFolder)
Toc/GoOwnToc.ts, line 572 -
This function returns the folder id of any layer defined in config file
Name Type Description urlFolderstring URL of folder defined in config file
-
getFolderName(urlFolder)
Toc/GoOwnToc.ts, line 610 -
This function returns the folder name of any layer defined in config file
Name Type Description urlFolderstring URL of folder defined in config file
-
getLanguage()
Toc/GoOwnToc.ts, line 1128 -
This function allows you get the language in TOC
-
getSubFolderId(subFolderName)
Toc/GoOwnToc.ts, line 646 -
This function creates the id string for any subfolder
Name Type Description subFolderNamestring Name of subfolder defined in config file
-
getSubFolderName(urlFolder)
Toc/GoOwnToc.ts, line 631 -
This function returns the subfolder name of any layer defined in config file
Name Type Description urlFolderstring URL of folder defined in config file
-
getTextFolderId(txtfolder)
Toc/GoOwnToc.ts, line 621 -
This function creates the id string
Name Type Description txtfolderstring Name of folder defined in config file
-
getTheme()
Toc/GoOwnToc.ts, line 1152 -
This function allows you get the theme of TOC
-
hasEvent(eventName){boolean}
Toc/GoOwnToc.ts, line 1515 -
Checks if there are any listeners registered for the specified event.
Name Type Description eventNamestring The name of the event to check for listeners.
Returns:
Type Description boolean True if there are listeners for the event, false otherwise. -
loadOwnTocBody()
Toc/GoOwnToc.ts, line 696 -
This function creates HTML structure of TOC Body
-
loadOwnTocHeader(hasLegend)
Toc/GoOwnToc.ts, line 674 -
This function creates HTML structure of TOC Header
Name Type Description hasLegendboolean Flag to indicate if TOC also shows Legends
-
off(eventName, callback){void}
Toc/GoOwnToc.ts, line 1506 -
Removes an event listener for the specified event.
Name Type Description eventNamestring optional The name of the event to remove listeners for. Optional.
callbackfunction optional The specific function to remove from the event's listeners. Optional.
Returns:
Type Description void -
on(eventName, callback){void}
Toc/GoOwnToc.ts, line 1486 -
Registers an event listener for the specified event.
Name Type Description eventNamestring The name of the event to listen for.
callbackfunction The function to be called when the event is emitted.
Returns:
Type Description void -
once(eventName, callback){void}
Toc/GoOwnToc.ts, line 1496 -
Registers a one-time event listener for the specified event.
Name Type Description eventNamestring The name of the event to listen for once.
callbackfunction The function to be called when the event is emitted.
Returns:
Type Description void -
orderStageTocBySubFolder(stageToc)
Toc/GoOwnToc.ts, line 1036 -
This function orders the subfoders of the TOC by name
Name Type Description stageTocmodule:types~ownToc TOC configuration variable
-
reload()
Toc/GoOwnToc.ts, line 1408 -
This function reload the toc from original config
-
reloadFolderVisibility()
Toc/GoOwnToc.ts, line 1094 -
Updates folder visibility based on the visibility state of their contained layers. A folder is visible only if ALL its layers are visible. This method is typically called after batch layer visibility changes.
-
removeFolderFromToc(stageToc){boolean}
Toc/GoOwnToc.ts, line 106 -
Removes empty folders from the TOC and manages legend visibility based on active layers. This function is called after layer operations to clean up the TOC structure.
IMPORTANT: Base layers should NEVER appear in legends, so they are excluded from legend calculations.
Name Type Description stageToctypes.ownToc The TOC structure containing layers and legends
Returns:
Type Description boolean Returns true when all non-base layers are inactive -
removeLayer(idLayer)
Toc/GoOwnToc.ts, line 1190 -
Removes a single layer from the TOC and its corresponding legend entry. This method handles both the layer visibility in the TOC structure and the legend cleanup.
WORKFLOW:
- Sets layer visibility to true (hide it visually)
- Marks the layer as inactive in the TOC structure
- Deactivates the layer's legend entry
- Checks if the legend group should remain active (if other layers still have active legends)
- Cleans up empty folders and rebuilds the TOC structure
Name Type Description idLayerstring ID of the layer to remove from TOC and legend
-
removeLayerLegend(idLayer)
Toc/GoOwnToc.ts, line 1236 -
Removes a specific layer from the legend only (not from the TOC structure). This method only affects the legend display, leaving the layer active in the TOC.
Name Type Description idLayerstring ID of the layer to remove from legend display
-
removeLayers(idLayers)
Toc/GoOwnToc.ts, line 1256 -
Removes multiple layers from the TOC structure in a batch operation. This method is more efficient than calling removeLayer() multiple times. Note: This method does NOT automatically rebuild the TOC structure - you should call createTocStructure() after if needed.
Name Type Description idLayersArray.<string> Array of layer IDs to remove from TOC
-
removeLayersLegend(idLayers)
Toc/GoOwnToc.ts, line 1277 -
Removes multiple layers from the legend display in a batch operation. This affects only the legend visibility, not the TOC structure.
Name Type Description idLayersArray.<string> Array of layer IDs to remove from legend
-
setHeightOwnToc(ownToc_container, stageToc)
Toc/GoOwnToc.ts, line 1027 -
This function defines the maximum height of TOC container DIV regarding the config variable
Name Type Description ownToc_containerHTMLDivElement Element HTML of TOC container
stageTocmodule:types~ownToc TOC configuration variable
-
setLanguage(idLanguage)
Toc/GoOwnToc.ts, line 1137 -
This function allows you specify the language in TOC
Name Type Description idLanguagelanguages id of the language for the TOC elements
-
setTheme(theme)
Toc/GoOwnToc.ts, line 1161 -
This function allows you specify the theme in TOC
Name Type Description themeconstants.themes id of the theme for the TOC
-
setVisibility(idLayer, visibility, reload)
Toc/GoOwnToc.ts, line 1061 -
Sets the visibility state of a specific layer in the TOC. This method updates the layer's visible property and optionally rebuilds the TOC structure.
BEHAVIOR:
- If the layer is already in the requested visibility state, no action is taken
- If reload is true (default), the TOC structure will be rebuilt after the change
- Emits a LAYER_CHANGE_VISIBILITY event after the operation
Name Type Description idLayerstring ID of the layer to modify
visibilityboolean New visibility state for the layer
reloadboolean Whether to rebuild TOC structure after change (default: true)
-
setVisibilityLayers(idLayers, visibility)
Toc/GoOwnToc.ts, line 1115 -
Sets the visibility state for multiple layers in a batch operation. This method is more efficient than calling setVisibility() multiple times as it only rebuilds the TOC structure once at the end.
Name Type Description idLayersArray.<string> Array of layer IDs to modify
visibilityboolean New visibility state for all specified layers
