UNPKG

2.76 kBTypeScriptView Raw
1import { GoogleMap, LatLngBounds, Marker, MVCObject } from '@agm/core/services/google-maps-types';
2export interface CalculatorResult {
3 text: string;
4 index: number;
5}
6export declare type CalculateFunction = (marker: Marker[], count: number) => CalculatorResult;
7export interface MarkerClustererInstance extends MVCObject {
8 zoomOnClick_: boolean;
9 averageCenter_: boolean;
10 imagePath_: string;
11 minimumClusterSize_: number;
12 imageExtension_: string;
13 new (map: GoogleMap, marker: Marker[], options: ClusterOptions): MarkerClustererInstance;
14 addMarker(marker: Marker, noDraw?: boolean): void;
15 addMarkers(markers: Marker[], noDraw?: boolean): void;
16 clearMarkers(): void;
17 getCalculator(): CalculateFunction;
18 getExtendedBounds(bounds: LatLngBounds): LatLngBounds;
19 getGridSize(): number;
20 getMap(): GoogleMap;
21 getMarkers(): Marker[];
22 getStyles(): ClusterStyle;
23 getTotalClusters(): number;
24 getTotalMarkers(): Marker[];
25 isZoomOnClick(): boolean;
26 redraw(): void;
27 removeMarker(marker: Marker): boolean;
28 resetViewport(): void;
29 setCalculator(calculator: CalculateFunction): void;
30 setGridSize(size: number): void;
31 setMap(map: GoogleMap): void;
32 setMaxZoom(maxZoom: number): void;
33 setStyles(styles: ClusterStyle[]): void;
34}
35export interface ClusterOptions {
36 /**
37 * The grid size of a cluster in pixels.
38 */
39 gridSize?: number;
40 /**
41 * The maximum zoom level that a marker can be part of a cluster.
42 */
43 maxZoom?: number;
44 /**
45 * Whether the default behaviour of clicking on a cluster is to zoom into it.
46 */
47 zoomOnClick?: boolean;
48 /**
49 * Whether the center of each cluster should be the average of all markers in the cluster.
50 */
51 averageCenter?: boolean;
52 /**
53 * The minimum number of markers to be in a cluster before the markers are hidden and a count is shown.
54 */
55 minimumClusterSize?: number;
56 /**
57 * An object that has style properties.
58 */
59 styles?: ClusterStyle[];
60 imagePath?: string;
61 imageExtension?: string;
62 calculator?: CalculateFunction;
63}
64export interface ClusterStyle {
65 /**
66 * The image url.
67 */
68 url?: string;
69 /**
70 * The image height.
71 */
72 height?: number;
73 /**
74 * The image width.
75 */
76 width?: number;
77 /**
78 * The anchor position of the label text.
79 */
80 anchor?: [number, number];
81 /**
82 * The text color.
83 */
84 textColor?: string;
85 /**
86 * The text size.
87 */
88 textSize?: number;
89 /**
90 * The position of the backgound x, y.
91 */
92 backgroundPosition?: string;
93 /**
94 * The anchor position of the icon x, y.
95 */
96 iconAnchor?: [number, number];
97}