/** * Represents a single issue that prevents a layer from being visible. * * NOTE: More issue types may be added in future versions. */ type VisibilityIssue = /** * The (sub-)layer is not configured to be visible. */ "not-visible" /** * The (sub-)layer is not visible, because some of its parent(s) are not configured to be visible. */ | "parent-not-visible" /** * The (sub-)layer is invisible because its opacity is set to 0. */ | "hidden-by-opacity" /** * The (sub-)layer is invisible because some of its parent(s) opacity is set to 0. */ | "parent-hidden-by-opacity" /** * The "full extent" of the (sub-)layer is not visible in the current view. */ | "invisible-at-extent" /** * The (sub-)layer cannot be shown at the current scale. */ | "invisible-at-scale" /** * The (sub-)layer cannot be shown at the current time extent. */ | "invisible-at-time-extent" /** * The layer can only be shown in 3D. * This flag is only available for layers (not for sub-layers). */ | "unsupported-in-2d" /** * The current spatial reference system is not supported. * This flag is only available for layers (not for sub-layers). */ | "unsupported-srs" /** * The layer is either not loaded at all or still loading. * This flag is only available for layers (not for sub-layers). */ | "not-loaded" /** * The layer failed to load, for example due to a network problem. * This flag is only available for layers (not for sub-layers). */ | "load-failed" /** * No layer view is present for this layer. * This is a generic error where we can't determine the actual cause. * This flag is only available for layers (not for sub-layers). */ | "no-layer-view" /** * The sub layer is not ready to be displayed, because the layer to which it belongs has issues. * This flag is only available for sub-layers. * A sublayer is marked by this state if the root layer has one of the following states: not-loaded, load-failed, no-layer-view, unsupported-srs, unsupported-in-2d. */ | "root-layer-not-ready" /** * This info object has been destroyed, likely because the associated (sub-)layer was removed from the map. */ | "destroyed"; /** * Record with visibility issue type names. */ type VisibilityIssueFilter = Record; /** * Holds effective visibility information for a specific layer in the map. */ interface LayerVisibility { /** * Returns true if the layer is currently visible to the user. * * This check takes various states into account: * * - Is the layer enabled at all (`layer.visible`)? * - Are the layer's parents visible? * - Is the layer visible in the current extent or zoom level? * - Does the layer support the current spatial reference system or view mode? * - ... */ readonly isEffectivelyVisible: boolean; /** * Visibility issues that prevent the layer from being visible. * * This array is non-empty if {@link isEffectivelyVisible} is false. */ readonly visibilityIssues: VisibilityIssue[]; /** * Filters visibility issues based on the provided filter. * @param filter The filter to apply. */ filterIssues(filter: VisibilityIssueFilter): Keys[]; /** * Checks if there are any visibility issues that match the provided filter. * @param filter The filter to apply. */ hasIssues(filter: VisibilityIssueFilter): boolean; } export type { LayerVisibility, VisibilityIssue, VisibilityIssueFilter };