Reference · Markers on the globe
Markerstype
The markers on one globe: add, update, remove and find them, show or hide groups, and detach.
Import it
import type { Markers } from "@johnmorrisdotca/chikyu-earth/markers";
Definition
interface Markers {
add(marker: MarkerInput): void;
addAll(markers: readonly MarkerInput[]): void;
update(id: string, patch: Partial<Omit<MarkerInput, "id">>): void;
remove(id: string): void;
clear(): void;
get(id: string): MarkerInput | undefined;
list(): MarkerInput[];
readonly size: number;
groups(): GroupInfo[];
showGroup(name: string): void;
hideGroup(name: string): void;
toggleGroup(name: string, force?: boolean): boolean;
readonly stats: {
markers: number;
clusters: number;
labels: number;
renders: number;
};
detach(): void;
}
Members
| Name | Type | Description |
|---|---|---|
add | (marker: MarkerInput): void | |
addAll | (markers: readonly MarkerInput[]): void | |
update | (id: string, patch: Partial<Omit<MarkerInput, "id">>): void | |
remove | (id: string): void | |
clear | (): void | |
get | (id: string): MarkerInput | undefined | |
list | (): MarkerInput[] | |
size | number | |
groups | (): GroupInfo[] | |
showGroup | (name: string): void | |
hideGroup | (name: string): void | |
toggleGroup | (name: string, force?: boolean): boolean | Show it if hidden and hide it if shown (or set it with |
stats | { markers: number; clusters: number; labels: number; renders: number; } | Markers and clusters drawn at the last render (for a page or a test). |
detach | (): void |
Examples
import { attachMarkers, type Markers, type OverlayElement } from "@johnmorrisdotca/chikyu-earth/markers";
declare const earth: OverlayElement;
const markers: Markers = attachMarkers(earth);
markers.add({ id: "tokyo", lon: 139.69, lat: 35.69, label: "Tokyo", group: "Cities" });
markers.toggleGroup("Cities");
console.log(markers.size, markers.groups());