📚 AtmoSwing Web Viewer Docs

← Back to Home

Components

Files


Modules

components/ErrorBoundary

React error boundary component that catches JavaScript errors in the component tree.

components/toolbar/ToolbarSquares

Visual summary of daily and sub-daily synthesis values allowing target date selection.

components/toolbar/ToolbarCenter

Central toolbar controls for forecast date navigation, manual date selection and restoration.

components/toolbar/ToolBar

Main application toolbar providing access to distribution and analog details modals and central navigation controls.

components/snackbars/SnackbarItem

Wrapper around MUI Snackbar with configurable origin and auto-hide.

components/snackbars/AppSnackbars

Global snackbar manager component rendering queued snackbars and workspace validity alerts.

components/sidebar/SidebarWorkspaceDropdown

Dropdown selector for choosing active workspace region.

components/sidebar/SideBar

Application sidebar containing workspace selector and forecast-related panels.

components/panels/index

Barrel file re-exporting panel components for convenient imports.

components/panels/PanelSynthesis

Panel rendering normalized synthesis values per method across daily and sub-daily lead times. Allows selecting target date and method; supports sub-daily segmentation when available.

components/panels/PanelStatus

Standardized status text renderer inside a Panel for loading/error/empty states.

components/panels/PanelStations

Panel for selecting a forecast station/entity from the available entities list.

components/panels/PanelForecasts

Panel for selecting forecast method and configuration using a tree view.

components/panels/PanelDisplay

Panel for adjusting display parameters (percentile & normalization reference).

components/panels/PanelAnalogDates

Panel displaying ranked analog dates with criteria values for the selected method/config and lead time.

components/panels/Panel

Collapsible panel component for sidebar sections.

components/modals/index

Barrel file re-exporting modal components for convenient imports.

components/modals/TimeSeriesModal

Modal displaying time series percentiles, best analogs, reference return periods and previous forecast histories. Supports exporting charts (SVG/PNG/PDF) and dynamic configuration resolution for selected entity.

components/modals/DistributionsModal

Modal displaying precipitation and criteria distributions for a selected method/config/entity/lead. Provides percentile markers, reference return periods, best analog overlays and export options.

components/modals/DetailsAnalogsModal

Modal presenting a detailed list of analogs for a selected method/config/entity/lead with criteria and precipitation values.

components/modals/common/plotConstants

Shared constants and color palettes used by modal charts (time series & distributions).

components/modals/common/exportUtils

Utility helpers for exporting charts: safe filename generation, SVG style inlining, dimension extraction and temporary DOM mounting.

components/modals/common/MethodConfigSelector

Shared modal selection component to pick method, configuration, entity and lead time. Handles chained data fetching, validity maintenance and relevance highlighting.

components/modals/common/ExportMenu

Small dropdown menu component offering export options (PNG, SVG, PDF).

components/modals/charts/TimeSeriesChart

D3-based time series chart rendering percentile envelopes, best analog markers, return periods and forecast history overlays.

components/modals/charts/PrecipitationDistributionChart

D3-based empirical cumulative distribution chart for precipitation analog values with optional overlays.

components/modals/charts/CriteriaDistributionChart

D3-based ordered criteria distribution chart with optional analog criteria fallback.

components/map/mapConstants

Centralized map-related constants for OpenLayers configuration. Avoids magic numbers scattered throughout map components.

components/map/MapViewer

Main map viewer component using OpenLayers for forecast visualization. Displays forecast points, supports entity selection, and manages map layers.

components/map/MapTooltip

Floating tooltip overlay displaying entity name and raw value at pointer position.

components/map/MapLegend

Legend component rendering a horizontal gradient scale for normalized forecast values.

components/map/utils/olStyleUtils

Utilities for OpenLayers style creation and color parsing. Supports hex, rgb, rgba, QGIS-style colors, and style configuration objects.

components/map/utils/olProjectionUtils

Centralized projection utilities for OpenLayers with proj4 integration.

components/map/utils/loadWmtsCapabilities

Utilities for loading WMTS (Web Map Tile Service) capabilities and creating tile layers. Handles fetching capabilities XML, parsing layer options, and caching for reuse.

components/map/utils/buildLegendStops

Generates legend gradient stops for map visualization.

components/map/hooks/useProjectionRegistration

React hook for registering custom map projections with OpenLayers.

components/map/hooks/useOverlayGlobalLayers

Hook for loading and managing global (non-workspace-specific) overlay layers. Supports WMTS and GeoJSON sources with optional periodic refresh.

components/map/hooks/useOverlayConfigLayers

Hook for loading and managing workspace-specific overlay layers (shapefiles). Dynamically adds/removes overlay layers based on workspace configuration.

components/map/hooks/useMapInteractions

Hook for handling map click and pointer interactions with forecast points. Manages entity selection on click and tooltip display on hover.

components/map/hooks/useMapInit

React hook for initializing OpenLayers map with configured layers and controls.

components/map/hooks/useForecastPoints

Hook for rendering forecast points on the map with color-coded values. Handles entity visualization, relevance highlighting, legend updates, and map extent fitting.

components/map/hooks/useDarkMode

React hook for detecting system dark mode preference.

components/ErrorBoundary

React error boundary component that catches JavaScript errors in the component tree.

components/ErrorBoundary.ErrorBoundary ⇐ React.Component

Error boundary component that catches and handles React component errors. Displays fallback UI and provides retry functionality.

Kind: static class of components/ErrorBoundary
Extends: React.Component

new exports.ErrorBoundary(props)

Param Type Description
props Object Component props
props.children React.ReactNode Child components to protect
[props.onError] function Optional error handler callback
[props.fallback] React.ReactNode Optional custom fallback UI

Example

<ErrorBoundary>
  <MyComponent />
</ErrorBoundary>

errorBoundary.componentDidCatch(error, info)

Lifecycle method called after an error is caught. Logs the error and calls the optional onError callback.

Kind: instance method of ErrorBoundary

Param Type Description
error Error The error that was thrown
info Object Error info with componentStack

ErrorBoundary.getDerivedStateFromError(error) ⇒ Object

Updates state when an error is caught.

Kind: static method of ErrorBoundary
Returns: Object - New state object

Param Type Description
error Error The error that was thrown

components/toolbar/ToolbarSquares

Visual summary of daily and sub-daily synthesis values allowing target date selection.

components/toolbar/ToolbarCenter

Central toolbar controls for forecast date navigation, manual date selection and restoration.

components/toolbar/ToolBar

Main application toolbar providing access to distribution and analog details modals and central navigation controls.

components/snackbars/SnackbarItem

Wrapper around MUI Snackbar with configurable origin and auto-hide.

components/snackbars/AppSnackbars

Global snackbar manager component rendering queued snackbars and workspace validity alerts.

components/sidebar/SidebarWorkspaceDropdown

Dropdown selector for choosing active workspace region.

components/sidebar/SideBar

Application sidebar containing workspace selector and forecast-related panels.

components/panels/index

Barrel file re-exporting panel components for convenient imports.

components/panels/PanelSynthesis

Panel rendering normalized synthesis values per method across daily and sub-daily lead times. Allows selecting target date and method; supports sub-daily segmentation when available.

components/panels/PanelStatus

Standardized status text renderer inside a Panel for loading/error/empty states.

module.exports(props) ⇒ React.ReactElement | null

Renders a small status line based on loading/error/empty flags. Priority order: loading > error > empty. Returns null if none are true.

Kind: Exported function
Returns: React.ReactElement | null - Span element or null if no status

Param Type Description
props Object
[props.loading] boolean Whether the panel content is loading
[props.error] boolean Whether an error occurred
[props.empty] boolean Whether there is no data to show
[props.messages] Object Optional custom messages
[props.messages.loading] string Loading message override
[props.messages.error] string Error message override
[props.messages.empty] string Empty message override

components/panels/PanelStations

Panel for selecting a forecast station/entity from the available entities list.

module.exports(props) ⇒ React.ReactElement

PanelStations component rendering a dropdown of entities with loading/error/empty states.

Kind: Exported function

Param Type Description
props Object
[props.defaultOpen] boolean Initial open state of panel

components/panels/PanelForecasts

Panel for selecting forecast method and configuration using a tree view.

module.exports(props) ⇒ React.ReactElement

PanelForecasts component wrapping the method/config tree inside a collapsible panel.

Kind: Exported function

Param Type Description
props Object
[props.defaultOpen] boolean Initial open state for panel

components/panels/PanelDisplay

Panel for adjusting display parameters (percentile & normalization reference).

module.exports(props) ⇒ React.ReactElement

PanelDisplay component rendering controls for percentile and normalization reference selection.

Kind: Exported function

Param Type Description
props Object
[props.defaultOpen] boolean Initial open state

components/panels/PanelAnalogDates

Panel displaying ranked analog dates with criteria values for the selected method/config and lead time.

components/panels/Panel

Collapsible panel component for sidebar sections.

module.exports(props) ⇒ React.ReactElement

Collapsible panel with toggle header.

Kind: Exported function

Param Type Default Description
props Object
props.title string Panel title
props.children React.ReactNode Panel content
[props.defaultOpen] boolean false Initial open state

components/modals/index

Barrel file re-exporting modal components for convenient imports.

components/modals/TimeSeriesModal

Modal displaying time series percentiles, best analogs, reference return periods and previous forecast histories. Supports exporting charts (SVG/PNG/PDF) and dynamic configuration resolution for selected entity.

components/modals/DistributionsModal

Modal displaying precipitation and criteria distributions for a selected method/config/entity/lead. Provides percentile markers, reference return periods, best analog overlays and export options.

components/modals/DetailsAnalogsModal

Modal presenting a detailed list of analogs for a selected method/config/entity/lead with criteria and precipitation values.

components/modals/common/plotConstants

Shared constants and color palettes used by modal charts (time series & distributions).

components/modals/common/plotConstants.DEFAULT_PCTS

Default percentile set (main quantiles).

Kind: static constant of components/modals/common/plotConstants

components/modals/common/plotConstants.FULL_PCTS

Full percentile set for detailed view.

Kind: static constant of components/modals/common/plotConstants

components/modals/common/plotConstants.SELECTED_RPS

Selected return periods displayed when overlays enabled.

Kind: static constant of components/modals/common/plotConstants

components/modals/common/plotConstants.QUANTILE_COLORS

Quantile line colors mapping.

Kind: static constant of components/modals/common/plotConstants

components/modals/common/plotConstants.TEN_YEAR_COLOR

Stroke color for ten-year return period overlay.

Kind: static constant of components/modals/common/plotConstants

components/modals/common/plotConstants.ANALOG_MARKER_COLOR

Marker stroke color for best analog points.

Kind: static constant of components/modals/common/plotConstants

components/modals/common/exportUtils

Utility helpers for exporting charts: safe filename generation, SVG style inlining, dimension extraction and temporary DOM mounting.

components/modals/common/exportUtils.safeForFilename(s) ⇒ string

Sanitize a string for safe use as a filename (drops/normalizes problematic characters)

Kind: static method of components/modals/common/exportUtils
Returns: string - Sanitized filename-friendly string

Param Type Description
s string Input string

components/modals/common/exportUtils.downloadBlob(blob, filename) ⇒ void

Trigger a download of a Blob with the given filename

Kind: static method of components/modals/common/exportUtils

Param Type Description
blob Blob Data blob
filename string Filename to save

components/modals/common/exportUtils.inlineAllStyles(svg) ⇒ void

Inline computed style properties into all nodes of a given SVG element. Helpful to preserve appearance when exporting SVG/PNG/PDF without external CSS.

Kind: static method of components/modals/common/exportUtils

Param Type Description
svg SVGElement Root SVG element to inline styles into

components/modals/common/exportUtils.getSVGSize(svg) ⇒ Object

Determine pixel size of an SVG element using width/height or viewBox fallback.

Kind: static method of components/modals/common/exportUtils
Returns: Object - Dimensions object

Param Type Description
svg SVGElement SVG element

components/modals/common/exportUtils.withTemporaryContainer(node, cb) ⇒ *

Temporarily mount a node (e.g., cloned SVG) in a hidden container in the DOM to allow layout/style computations, then run a callback and cleanup.

Kind: static method of components/modals/common/exportUtils
Returns: * - Return value of callback

Param Type Description
node Node DOM node to mount temporarily
cb function Callback executed while node is mounted

components/modals/common/MethodConfigSelector

Shared modal selection component to pick method, configuration, entity and lead time. Handles chained data fetching, validity maintenance and relevance highlighting.

module.exports(props) ⇒ React.ReactElement

MethodConfigSelector component.

Kind: Exported function

Param Type Default Description
props Object
[props.cachePrefix] string "'modal_'" Prefix for cache keys to avoid collisions across modals
props.open boolean Whether the parent modal is open (controls fetching enablement)
props.value Object Current selection state { methodId, configId, entityId, lead }
props.onChange function Callback receiving updated selection object
[props.children] React.ReactNode Optional extra controls rendered beneath standard selectors

module.exports.useModalSelectionData(cachePrefix, open, selection) ⇒ Object

Hook returning resolved selection data (with fallback config if none explicitly chosen).

Kind: static method of module.exports
Returns: Object - Object with resolvedMethodId, resolvedConfigId, resolvedEntityId

Param Type Description
cachePrefix string Cache key namespace prefix
open boolean Whether owning modal is open
selection Object Raw selection { methodId, configId, entityId }

Example

const { resolvedMethodId, resolvedConfigId } = useModalSelectionData('dist_', open, selection);

components/modals/common/ExportMenu

Small dropdown menu component offering export options (PNG, SVG, PDF).

components/modals/charts/TimeSeriesChart

D3-based time series chart rendering percentile envelopes, best analog markers, return periods and forecast history overlays.

components/modals/charts/PrecipitationDistributionChart

D3-based empirical cumulative distribution chart for precipitation analog values with optional overlays.

components/modals/charts/CriteriaDistributionChart

D3-based ordered criteria distribution chart with optional analog criteria fallback.

components/map/mapConstants

Centralized map-related constants for OpenLayers configuration. Avoids magic numbers scattered throughout map components.

components/map/mapConstants.DEFAULT_PROJECTION

Default map projection (Web Mercator). @constant {string}

Kind: static constant of components/map/mapConstants

components/map/mapConstants.WMTS_MATRIX_SET_DEFAULT

Default WMTS matrix set identifier. @constant {string}

Kind: static constant of components/map/mapConstants

components/map/mapConstants.FIT_PADDING

Padding for map extent fitting [top, right, bottom, left] in pixels. @constant {Array}

Kind: static constant of components/map/mapConstants

components/map/mapConstants.LEGEND_SAMPLES

Number of color gradient samples for legend generation. @constant {number}

Kind: static constant of components/map/mapConstants

components/map/mapConstants.FORECAST_POINT_RADIUS_RELEVANT

Radius for relevant/highlighted forecast points (pixels). @constant {number}

Kind: static constant of components/map/mapConstants

components/map/mapConstants.FORECAST_POINT_RADIUS_NORMAL

Radius for normal forecast points (pixels). @constant {number}

Kind: static constant of components/map/mapConstants

components/map/mapConstants.FORECAST_POINT_STROKE_WIDTH

Stroke width for forecast point borders (pixels). @constant {number}

Kind: static constant of components/map/mapConstants

components/map/mapConstants.FORECAST_POINT_STROKE_COLOR_RELEVANT

Stroke color for relevant forecast points. @constant {string}

Kind: static constant of components/map/mapConstants

components/map/mapConstants.FORECAST_POINT_STROKE_COLOR_DIM

Stroke color for dimmed forecast points. @constant {string}

Kind: static constant of components/map/mapConstants

components/map/mapConstants.FORECAST_POINT_OPACITY_RELEVANT

Opacity for relevant forecast points. @constant {number}

Kind: static constant of components/map/mapConstants

components/map/mapConstants.FORECAST_POINT_OPACITY_DIM

Opacity for dimmed forecast points. @constant {number}

Kind: static constant of components/map/mapConstants

components/map/mapConstants.OVERLAY_LINE_COLOR

Default line color for overlay layers. @constant {string}

Kind: static constant of components/map/mapConstants

components/map/mapConstants.OVERLAY_STROKE_WIDTH

Default stroke width for overlay features (pixels). @constant {number}

Kind: static constant of components/map/mapConstants

components/map/mapConstants.OVERLAY_POLYGON_FILL

Default fill color for overlay polygons. @constant {string}

Kind: static constant of components/map/mapConstants

components/map/mapConstants.OVERLAY_POINT_RADIUS

Default radius for overlay points (pixels). @constant {number}

Kind: static constant of components/map/mapConstants

components/map/mapConstants.OVERLAY_POINT_STROKE_COLOR

Default stroke color for overlay points. @constant {string}

Kind: static constant of components/map/mapConstants

components/map/mapConstants.OVERLAY_POINT_STROKE_WIDTH

Default stroke width for overlay points (pixels). @constant {number}

Kind: static constant of components/map/mapConstants

components/map/mapConstants.OVERLAY_POINT_FILL

Default fill color for overlay points. @constant {string}

Kind: static constant of components/map/mapConstants

components/map/MapViewer

Main map viewer component using OpenLayers for forecast visualization. Displays forecast points, supports entity selection, and manages map layers.

components/map/MapTooltip

Floating tooltip overlay displaying entity name and raw value at pointer position.

components/map/MapLegend

Legend component rendering a horizontal gradient scale for normalized forecast values.

components/map/utils/olStyleUtils

Utilities for OpenLayers style creation and color parsing. Supports hex, rgb, rgba, QGIS-style colors, and style configuration objects.

components/map/utils/olStyleUtils.toRGBA(input, [alphaFallback]) ⇒ string

Converts various color formats to CSS rgba() string. Supports hex, rgb/rgba strings, QGIS-style comma-separated values, and arrays.

Kind: static method of components/map/utils/olStyleUtils
Returns: string - CSS rgba() color string

Param Type Default Description
input string | Array Color in various formats
[alphaFallback] number 1 Default alpha value if not specified

Example

toRGBA('#ff0000') // Returns: "rgba(255,0,0,1)"
toRGBA('255,0,0,128') // Returns: "rgba(255,0,0,0.5)"

components/map/utils/olStyleUtils.styleFromConfigObj([obj]) ⇒ function

Creates an OpenLayers style function from a configuration object. Supports different styles for lines, polygons, and points.

Kind: static method of components/map/utils/olStyleUtils
Returns: function - OpenLayers style function

Param Type Default Description
[obj] Object {} Style configuration object
[obj.line] Object Line style configuration
[obj.polygon] Object Polygon style configuration
[obj.point] Object Point/circle style configuration
[obj.strokeColor] string Fallback stroke color
[obj.strokeWidth] number Fallback stroke width
[obj.fillColor] string Fallback fill color

Example

const style = styleFromConfigObj({
  line: { stroke: { color: '#ff0000', width: 3 } },
  polygon: { fill: { color: 'rgba(255,0,0,0.2)' } }
});

components/map/utils/olProjectionUtils

Centralized projection utilities for OpenLayers with proj4 integration.

components/map/utils/olProjectionUtils.ensureProjDefined(epsg)

Ensures a projection is defined in proj4 and registered with OpenLayers. Uses predefined definitions for known EPSG codes. Handles registration errors silently.

Kind: static method of components/map/utils/olProjectionUtils

Param Type Description
epsg string EPSG code (e.g., "EPSG:2154")

Example

ensureProjDefined('EPSG:2154'); // Registers Lambert-93 for France

components/map/utils/olProjectionUtils~PREDEFINED : Object

Predefined proj4 projection definitions for common EPSG codes.

Kind: inner constant of components/map/utils/olProjectionUtils

components/map/utils/loadWmtsCapabilities

Utilities for loading WMTS (Web Map Tile Service) capabilities and creating tile layers. Handles fetching capabilities XML, parsing layer options, and caching for reuse.

components/map/utils/loadWmtsCapabilities.loadWmtsCapabilities(runtimeConfig, [enqueueWarning], [preferStyleForItem]) ⇒ Promise.<Object>

Fetches WMTS capabilities from configured providers and builds options cache. Processes base layers and overlay layers from runtime config, attempts to load capabilities with preferred styles, and returns a cache of layer options.

Kind: static method of components/map/utils/loadWmtsCapabilities
Returns: Promise.<Object> - Cache object mapping wmtsLayer name to OpenLayers WMTS options

Param Type Description
runtimeConfig Object Runtime configuration with providers and layers
[enqueueWarning] function Optional callback to display warning messages
[preferStyleForItem] function Optional function to determine preferred style for an item

Example

const cache = await loadWmtsCapabilities(config, (msg) => console.warn(msg));
// Returns: { 'layerName': { ...wmtsOptions } }

components/map/utils/loadWmtsCapabilities.createWmtsTileLayer(item, wmtsOptionsCache) ⇒ WMTS | null

Creates an OpenLayers WMTS source from cached layer options.

Kind: static method of components/map/utils/loadWmtsCapabilities
Returns: WMTS | null - OpenLayers WMTS source instance, or null if not found in cache

Param Type Description
item Object Layer configuration item with wmtsLayer property
wmtsOptionsCache Object Cache of WMTS options from loadWmtsCapabilities

Example

const source = createWmtsTileLayer({ wmtsLayer: 'myLayer' }, cache);
if (source) {
  const layer = new TileLayer({ source });
}

components/map/utils/buildLegendStops

Generates legend gradient stops for map visualization.

components/map/utils/buildLegendStops.buildLegendStops([maxVal], [samples]) ⇒ Array.<Object>

Builds an array of color stops for a continuous legend gradient. Each stop represents a point in the gradient from 0 to maxVal.

Kind: static method of components/map/utils/buildLegendStops
Returns: Array.<Object> - Array of legend stops with {color: string, pct: number}

Param Type Default Description
[maxVal] number 1 Maximum value for the legend scale
[samples] number LEGEND_SAMPLES Number of gradient samples to generate

Example

const stops = buildLegendStops(100, 10);
// Returns: [
//   {color: 'rgb(255,255,255)', pct: 0},
//   {color: 'rgb(200,255,200)', pct: 10},
//   ...
//   {color: 'rgb(255,0,0)', pct: 100}
// ]

components/map/hooks/useProjectionRegistration

React hook for registering custom map projections with OpenLayers.

module.exports(epsg) ⇒ React.RefObject

Hook that registers a projection with OpenLayers if not already registered. Uses predefined proj4 definitions for known EPSG codes.

Kind: Exported function
Returns: React.RefObject - Ref containing the last registered projection

Param Type Description
epsg string EPSG code (e.g., "EPSG:2154")

Example

useProjectionRegistration('EPSG:2154'); // Registers Lambert-93 for France

module.exports~PREDEFINED : Object

Predefined projection definitions for common EPSG codes.

Kind: inner constant of module.exports

components/map/hooks/useOverlayGlobalLayers

Hook for loading and managing global (non-workspace-specific) overlay layers. Supports WMTS and GeoJSON sources with optional periodic refresh.

module.exports(params) ⏏

Hook that loads global overlay layers defined in runtime configuration. Handles WMTS capabilities adoption, dynamic GeoJSON fetching, refresh timers, abort controllers, and layer switcher panel updates.

Kind: Exported function

Param Type Description
params Object Hook parameters
params.mapReady boolean Whether map is initialized
params.runtimeConfig Object Runtime configuration object
params.overlayGroupRef React.RefObject Ref to overlay layer group
params.layerSwitcherRef React.RefObject Ref to layer switcher control
[params.enqueueSnackbar] function Optional notification callback

Example

useOverlayGlobalLayers({
  mapReady: true,
  runtimeConfig,
  overlayGroupRef,
  layerSwitcherRef,
  enqueueSnackbar: (msg) => console.warn(msg)
});

components/map/hooks/useOverlayConfigLayers

Hook for loading and managing workspace-specific overlay layers (shapefiles). Dynamically adds/removes overlay layers based on workspace configuration.

module.exports(params) ⏏

Hook that manages workspace-specific overlay layers on the map. Loads shapefiles defined in workspace configuration and adds them as vector layers. Automatically cleans up layers when workspace changes.

Kind: Exported function

Param Type Description
params Object Hook parameters
params.mapReady boolean Whether map is initialized
params.runtimeConfig Object Runtime configuration with workspace definitions
params.workspace string Current workspace key
params.overlayGroupRef React.RefObject Ref to overlay layer group
params.layerSwitcherRef React.RefObject Ref to layer switcher control

Example

useOverlayConfigLayers({
  mapReady: true,
  runtimeConfig: config,
  workspace: 'demo',
  overlayGroupRef,
  layerSwitcherRef
});

components/map/hooks/useMapInteractions

Hook for handling map click and pointer interactions with forecast points. Manages entity selection on click and tooltip display on hover.

module.exports(params) ⏏

Hook that sets up map interaction handlers for forecast point selection and tooltips. Handles single click for entity selection and pointer move/out for tooltip display.

Kind: Exported function

Param Type Description
params Object Hook parameters
params.mapRef React.RefObject Ref to OpenLayers map instance
params.forecastLayerRef React.RefObject Ref to forecast vector layer
params.setSelectedEntityId function Function to set selected entity ID
params.setTooltip function Function to set tooltip state (x, y, name, valueRaw)
params.mapReady boolean Whether map is initialized

Example

useMapInteractions({
  mapRef,
  forecastLayerRef,
  setSelectedEntityId: (id) => console.log('Selected:', id),
  setTooltip: (tooltip) => console.log('Tooltip:', tooltip),
  mapReady: true
});

components/map/hooks/useMapInit

React hook for initializing OpenLayers map with configured layers and controls.

module.exports(params) ⇒ Object

Hook that initializes an OpenLayers map with base layers, overlays, and controls.

Kind: Exported function
Returns: Object - Map refs and ready state

Param Type Description
params Object Hook parameters
params.t function Translation function
params.runtimeConfig Object Runtime config with layer definitions
params.enqueueSnackbar function Notification function

Example

const { containerRef, mapRef, mapReady } = useMapInit({ t, runtimeConfig, enqueueSnackbar });

components/map/hooks/useForecastPoints

Hook for rendering forecast points on the map with color-coded values. Handles entity visualization, relevance highlighting, legend updates, and map extent fitting.

module.exports(params) ⏏

Hook that renders forecast entities as colored points on the OpenLayers map. Updates point colors based on forecast values, highlights relevant entities, manages legend stops, and fits map extent to data.

Kind: Exported function

Param Type Description
params Object Hook parameters
params.ENTITIES_SOURCE_EPSG string EPSG code for entity coordinates
params.mapReady boolean Whether map is initialized
params.entities Array Array of entity objects with coordinates
params.entitiesWorkspace string Workspace key for entities
params.entitiesKey string Cache key for current entities
params.relevantEntities Set Set of relevant entity IDs
params.workspace string Current workspace
params.forecastValuesNorm Object Normalized forecast values by entity ID
params.forecastValues Object Raw forecast values by entity ID
params.forecastUnavailable boolean Whether forecast data is unavailable
params.forecastLayerRef React.RefObject Ref to forecast vector layer
params.mapRef React.RefObject Ref to OpenLayers map instance
params.setLegendStops function Setter for legend gradient stops
params.setLegendMax function Setter for legend maximum value

Example

useForecastPoints({
  ENTITIES_SOURCE_EPSG: 'EPSG:4326',
  mapReady: true,
  entities: [...],
  forecastValuesNorm: { 1: 0.5, 2: 0.8 },
  forecastLayerRef,
  mapRef,
  setLegendStops,
  setLegendMax
});

components/map/hooks/useDarkMode

React hook for detecting system dark mode preference.

module.exports() ⇒ boolean

Hook that detects and tracks the user's dark mode preference. Listens to system preference changes via prefers-color-scheme media query.

Kind: Exported function
Returns: boolean - True if dark mode is preferred, false otherwise
Example

const isDarkMode = useDarkMode();
const tileLayer = isDarkMode ? 'dark-tiles' : 'light-tiles';