Layer

Layer instances are generated by the Viewer to point at different layers. You can query layers for whether they are enabled and enable/disable them individually. Some Layer instances point at layer groups, in which case enabling/disabling the group will enable/disable all layers within the group.

You cannot directly create Layer instances.

layer.isGroup()

Returns whether the Layer instance is a group. This is an alias for layer.getChildLayers().length > 0.

layer.getChildLayers()

Returns all child layers that are associated with this layer, in bottom-to-top display order. If this Layer is not a group, then this will be an empty array.

layer.getLayerId()

Returns the layer ID associated with this layer. This is the ID that can be used to access this layer by calling viewer.getLayerById(layerOrGroupId).

layer.getName()

Returns a human-readable name for this layer. This is the same name that is used by PlanStudio for the layer.

layer.isEnabled()

Returns whether the layer is enabled. If this layer is a group, this only returns true if every single layer in the group is enabled.

layer.isPartiallyEnabled()

Returns whether the layer is partially enabled, which occurs in layer groups when some layers in the group are enabled, but not others. This always returns false if layer.isEnabled() === true, as the layer is fully enabled, not partially enabled.

layer.setEnabled(enabled)

Sets whether the layer is enabled or not. If the layer is a group, this sets whether all child layers inside the group are enabled or not.