import { LngLatBounds, type LngLatBoundsLike, type Map, type SymbolLayerSpecification } from 'maplibre-gl'; import type { MapLibreStyle } from './themes/maplibre'; export declare const RESULT_NUMBERS = "ogm-result-numbers"; export declare const RESULT_MARKERS = "ogm-result-numbers-markers"; export declare const SEARCH_BOUNDS = "ogm-search-bounds"; export declare const HIGHLIGHT_BOUNDS = "ogm-highlight-bounds"; export type DrawnResults = { extents: (LngLatBoundsLike | undefined)[]; highlighted?: number[]; searchBounds?: LngLatBounds; }; /** * One numbered point per extent, in the order the extents were given. * * A record nobody could place spends its number rather than passing it on. The number is where the * record sits in the list of results being read beside the map, so closing the gap left by a record * with no bounding box would point every result after it at the wrong row. * * A point of our own rather than a label on the box itself, for a reason that only shows up at * size: MapLibre places a polygon's label at the pole of inaccessibility of each tile the polygon * touches, and with collision turned off below there is nothing left to suppress the copies. A * country-sized box would wear its number three or four times. */ export declare const numberedResults: (extents: (LngLatBoundsLike | undefined)[], style: MapLibreStyle, highlighted?: number[]) => GeoJSON.FeatureCollection; /** * What the image for one marker is called: the number it shows, and everything that decides how it * looks. * * The whole look is in the name because that is what makes a picture safe to keep. A name that said * only which marker it was would be reused after a theme swap and the map would go on wearing the last * palette's discs: MapLibre carries images across setStyle, since it diffs the new style document * against the old one and the diff has nothing to say about images. Named this way, a new palette asks * for names that aren't there, gets fresh pictures, and leaves the old names to be taken away - and * everything else, which is most redraws, asks for the names already on the map. See syncMarkerImages. */ export declare const markerImageId: (label: string, style: MapLibreStyle, highlighted?: boolean) => string; /** * How big a marker is drawn, in CSS pixels: the numeral, the disc under it, and the square the two are * drawn in. * * All three off one number, so that a marker grows as one thing - a disc that grew without its numeral * would leave the number looking lost on it. That one number is what makes a highlighted marker bigger * than the rest, and --ogm-text-size is what moves every marker together. * * The ring is added rather than scaled, so it is the same width on a marker that has come forward as on * one that hasn't: what it does is hold a disc off the basemap and off its neighbours, and that job * doesn't change with the size of the disc. */ export declare const markerMetrics: (style: MapLibreStyle, highlighted: boolean) => { size: number; radius: number; box: number; }; /** * The one layer every marker is drawn from: an image apiece, and nothing else. * * A disc with a numeral on it, drawn as one picture rather than as a circle with text over it. Two * layers would be the obvious way and it cannot be made to work: a symbol layer draws all of its text * after all of its icons, and a circle layer draws every circle before any layer above it, so with the * numbers in a layer of their own *every* number lands over *every* disc - including its neighbour's. * One image per marker is what makes overlapping markers read as markers: whichever is on top covers * the one under it whole, disc and number together, which is the only arrangement in which a number is * always the one thing you can see of the marker it belongs to. * * It is also what makes the size of a disc ours rather than MapLibre's, and what lets a numeral be * bold: `text-font` names a fontstack the basemap's glyph endpoint has to serve, and a stack CARTO * doesn't serve draws nothing at all, so nothing asked of MapLibre could be. * * Nothing is ever culled. A number that isn't there is worse than one that overlaps, because the list * beside the map is counting on every one of them being findable. What is deliberately not asked for * is `icon-ignore-placement`: keeping our markers out of the collision grid would leave the basemap's * own labels free to draw underneath them, which is the most cluttered thing they could sit on. In the * grid a basemap label that collides with a marker is dropped instead - and ours still can't be, * because allowing overlap skips the hit test for them entirely and placement runs from the top layer * down, so these are placed before anything the basemap wanted that space for. */ export declare const resultMarkersLayer: () => SymbolLayerSpecification; /** * A disc with a numeral centered on it, as pixels MapLibre can draw as an icon. * * Drawn here rather than described to MapLibre because a marker has to be one picture; see * resultMarkersLayer. Which also means the numeral is placed by measuring it: canvas centers text on * the font's own box, and a digit - which has no descender to speak of - sits high in that box, so * what is centered has to be the ink rather than the line it sits on. * * Drawn at the display's own pixel ratio and handed over with it, so a marker is as crisp as the map * under it - which is also why a highlighted marker is drawn bigger rather than the same picture scaled * up by the layer that draws it. Nothing comes back where there is nothing to draw on - a DOM without a * canvas behind it, or no DOM at all - and the caller carries on without the picture rather than * without the map. */ export declare const markerImage: (label: string, style: MapLibreStyle, highlighted: boolean, pixelRatio: number) => { width: number; height: number; data: Uint8ClampedArray; } | undefined; /** * Put everything an overview draws on the map, and from then on change it where it stands. * * Bottom to top: the area being searched, the extents of the highlighted results, and the markers. That * order is settled the first time this runs and kept by never taking any of it off again - addLayer * appends, so a layer put back on would come back above whatever had been added over it. * * Changed rather than rebuilt, because rebuilding flashes, and the reader sees it: a highlight moves * with the pointer down a list of results, so a set of markers that blinks once per redraw blinks the * whole way down the page. Two things did it. Taking the sources off dropped their tiles on the spot - * see drawInto - and taking the markers' pictures off had MapLibre place every symbol on the map over * again, ours and the basemap's labels with them. So nothing comes off: a highlight arriving is two * calls to setData, and it touches no layer and no picture at all. */ export declare const drawResults: (map: Map, style: MapLibreStyle, { extents, highlighted, searchBounds }: DrawnResults) => void;