Class: LayerManager

LayerManager

Manages the layers for the GoTruckLayer, including initialization, updating, and control. Refactored using SOLID principles, Strategy pattern, and ANT architecture.

IMPORTANT MODIFICATION: The loading system now uses a strategy that loads features only once when initializing or when CQL filters change, instead of loading every time the map view changes (bbox). This improves performance and avoids unnecessary calls to the server when only doing pan/zoom on the map.

To force a reload when filters change, use the method: reloadFeatures()

new LayerManager(goTruckLayer)

Layers/GoTruckLayer/src/LayerManager.ts, line 433

Constructs a LayerManager instance using dependency injection.

Name Type Description
goTruckLayer GoTruckLayer

The GoTruckLayer instance associated with this manager.

Members

goTruckLayer

Gets the GoTruckLayer instance.

Methods

getLayerById(id){VectorLayer.<VectorSource>|undefined}

Layers/GoTruckLayer/src/LayerManager.ts, line 439

Retrieves a layer by its ID from the staging map.

Name Type Description
id string

The ID of the layer to retrieve.

Returns:
Type Description
VectorLayer.<VectorSource> | undefined The retrieved layer or undefined if not found.

getVisibility(){boolean}

Layers/GoXYZLayer/subClases/index.ts, line 86

Gets the visibility status of the managed layer.

Returns:
Type Description
boolean The visibility status of the layer.

asyncloader(extent){Promise.<unknown>}

Layers/GoTruckLayer/src/LayerManager.ts, line 404

Loads features from the server within the specified extent using the strategy pattern.

Name Type Description
extent Extent

The extent within which to load features.

Throws:

Throws an error if the request fails or if the response indicates a problem.

Type
Error
Returns:
Type Description
Promise.<unknown> A promise that resolves with the response data from the server.

reloadFeatures()

Layers/GoTruckLayer/src/LayerManager.ts, line 447

Forces a reload of features when filters change

setZIndex(number)

Layers/GoXYZLayer/subClases/index.ts, line 95

Sets the z-index of the managed layer.

Name Type Description
number number

The z-index value to set.

unmount()

Layers/GoTruckLayer/src/LayerManager.ts, line 412

Unmounts the layer manager and cleans up resources.

LayerManager

new LayerManager(layer)

Layers/GoXYZLayer/subClases/index.ts, line 65

Constructs a LayerManager instance for a given TileLayer.

Name Type Description
layer TileLayer.<TileSource>

The TileLayer to be managed.

Members

goTruckLayer

Gets the GoTruckLayer instance.

Methods

getLayerById(id){VectorLayer.<VectorSource>|undefined}

Layers/GoTruckLayer/src/LayerManager.ts, line 439

Retrieves a layer by its ID from the staging map.

Name Type Description
id string

The ID of the layer to retrieve.

Returns:
Type Description
VectorLayer.<VectorSource> | undefined The retrieved layer or undefined if not found.

getVisibility(){boolean}

Layers/GoXYZLayer/subClases/index.ts, line 86

Gets the visibility status of the managed layer.

Returns:
Type Description
boolean The visibility status of the layer.

asyncloader(extent){Promise.<unknown>}

Layers/GoTruckLayer/src/LayerManager.ts, line 404

Loads features from the server within the specified extent using the strategy pattern.

Name Type Description
extent Extent

The extent within which to load features.

Throws:

Throws an error if the request fails or if the response indicates a problem.

Type
Error
Returns:
Type Description
Promise.<unknown> A promise that resolves with the response data from the server.

reloadFeatures()

Layers/GoTruckLayer/src/LayerManager.ts, line 447

Forces a reload of features when filters change

setZIndex(number)

Layers/GoXYZLayer/subClases/index.ts, line 95

Sets the z-index of the managed layer.

Name Type Description
number number

The z-index value to set.

unmount()

Layers/GoTruckLayer/src/LayerManager.ts, line 412

Unmounts the layer manager and cleans up resources.