UNPKG

29.2 kBTypeScriptView Raw
1// Type definitions for MarkerClustererPlus for Google Maps V3 2.1
2// Project: https://github.com/mahnunchik/markerclustererplus
3// Definitions by: Mathias Rodriguez <https://github.com/enanox>
4// Michael Ledin <https://github.com/mxl>
5// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
6// TypeScript Version: 2.2
7
8/// <reference types="google-maps" />
9
10/**
11 * This class represents the object for values in the <code>styles</code> array passed
12 * to the {@link MarkerClusterer} constructor. The element in this array that is used to
13 * style the cluster icon is determined by calling the <code>calculator</code> function.
14 */
15interface ClusterIconStyle {
16 /** The URL of the cluster icon image file. Required. */
17 url: string;
18 /** Height The display height (in pixels) of the cluster icon. Required. */
19 height: number;
20 /** Width The display width (in pixels) of the cluster icon. Required. */
21 width: number;
22 /**
23 * [anchorText] The position (in pixels) from the center of the cluster icon to
24 * where the text label is to be centered and drawn. The format is <code>[yoffset, xoffset]</code>
25 * where <code>yoffset</code> increases as you go down from center and <code>xoffset</code>
26 * increases to the right of center. The default is <code>[0, 0]</code>.
27 */
28 anchorText?: number[];
29 /**
30 * [anchorIcon] The anchor position (in pixels) of the cluster icon. This is the
31 * spot on the cluster icon that is to be aligned with the cluster position. The format is
32 * <code>[yoffset, xoffset]</code> where <code>yoffset</code> increases as you go down and
33 * <code>xoffset</code> increases to the right of the top-left corner of the icon. The default
34 * anchor position is the center of the cluster icon.
35 */
36 anchorIcon?: number[];
37 /** [textColor="black"] The color of the label text shown on the cluster icon. */
38 textColor?: string;
39 /** textSize=11] The size (in pixels) of the label text shown on the cluster icon. */
40 textSize?: number;
41 /**
42 * [textDecoration="none"] The value of the CSS <code>text-decoration</code>
43 * property for the label text shown on the cluster icon.
44 */
45 textDecoration?: string;
46 /**
47 * [fontWeight="bold"] The value of the CSS <code>font-weight</code>
48 * property for the label text shown on the cluster icon.
49 */
50 fontWeight?: string;
51 /**
52 * [fontStyle="normal"] The value of the CSS <code>font-style</code>
53 * property for the label text shown on the cluster icon.
54 */
55 fontStyle?: string;
56 /**
57 * [fontFamily="Arial,sans-serif"] The value of the CSS <code>font-family</code>
58 * property for the label text shown on the cluster icon.
59 */
60 fontFamily?: string;
61 /**
62 * [backgroundPosition="0 0"] The position of the cluster icon image
63 * within the image defined by <code>url</code>. The format is <code>"xpos ypos"</code>
64 * (the same format as for the CSS <code>background-position</code> property). You must set
65 * this property appropriately when the image defined by <code>url</code> represents a sprite
66 * containing multiple images. Note that the position <i>must</i> be specified in px units.
67 */
68 backgroundPosition?: string;
69}
70
71/**
72 * the object that a <code>calculator</code> function returns.
73 *
74 * array to be used to style the cluster icon.
75 * If this value is <code>undefined</code> or <code>""</code>, <code>title</code> is set to the
76 * value of the <code>title</code> property passed to the MarkerClusterer.
77 */
78interface ClusterIconInfo {
79 text: string;
80 index: number;
81 title: string;
82}
83
84declare class ClusterIcon extends google.maps.OverlayView {
85 /**
86 * A cluster icon.
87 *
88 * @param cluster The cluster with which the icon is to be associated.
89 * @param [styles] An array of {@link ClusterIconStyle} defining the cluster icons
90 * to use for various cluster sizes.
91 */
92 constructor(cluster: Cluster, styles: ClusterIconStyle[]);
93
94 /**
95 * Adds the icon to the DOM.
96 */
97 onAdd(): void;
98
99 /**
100 * Removes the icon from the DOM.
101 */
102 onRemove(): void;
103
104 /**
105 * Draws the icon.
106 */
107 draw(): void;
108
109 /**
110 * Hides the icon.
111 */
112 hide(): void;
113
114 /**
115 * Positions and shows the icon.
116 */
117 show(): void;
118
119 /**
120 * Sets the icon styles to the appropriate element in the styles array.
121 *
122 * @param style The icon label text and styles index.
123 */
124 useStyle(style: ClusterIconInfo): void;
125
126 /**
127 * Sets the position at which to center the icon.
128 *
129 * @param center The latlng to set as the center.
130 */
131 setCenter(center: google.maps.LatLng): void;
132
133 /**
134 * Creates the cssText style parameter based on the position of the icon.
135 *
136 * @param pos The position of the icon.
137 * @return The CSS style text.
138 */
139 createCss(pos: google.maps.Point): string;
140
141 /**
142 * Returns the position at which to place the DIV depending on the latlng.
143 *
144 * @param latLng The position in latlng.
145 * @return The position in pixels.
146 */
147 getPosFromLatLng_(latLng: google.maps.LatLng): google.maps.Point;
148}
149
150declare class Cluster {
151 /**
152 * Creates a single cluster that manages a group of proximate markers.
153 * Used internally, do not call this constructor directly.
154 * @param mc The <code>MarkerClusterer</code> object with which this
155 * cluster is associated.
156 */
157 constructor(mc: MarkerClusterer);
158
159 /**
160 * Returns the number of markers managed by the cluster. You can call this from
161 * a <code>click</code>, <code>mouseover</code>, or <code>mouseout</code> event handler
162 * for the <code>MarkerClusterer</code> object.
163 *
164 * @return The number of markers in the cluster.
165 */
166 getSize(): number;
167
168 /**
169 * Returns the array of markers managed by the cluster. You can call this from
170 * a <code>click</code>, <code>mouseover</code>, or <code>mouseout</code> event handler
171 * for the <code>MarkerClusterer</code> object.
172 *
173 * @return The array of markers in the cluster.
174 */
175 getMarkers(): google.maps.Marker[];
176
177 /**
178 * Returns the center of the cluster. You can call this from
179 * a <code>click</code>, <code>mouseover</code>, or <code>mouseout</code> event handler
180 * for the <code>MarkerClusterer</code> object.
181 *
182 * @return The center of the cluster.
183 */
184 getCenter(): google.maps.LatLng;
185
186 /**
187 * Returns the map with which the cluster is associated.
188 *
189 * @return The map.
190 * @ignore
191 */
192 getMap(): google.maps.Map;
193
194 /**
195 * Returns the <code>MarkerClusterer</code> object with which the cluster is associated.
196 *
197 * @return The associated marker clusterer.
198 * @ignore
199 */
200 getMarkerClusterer(): MarkerClusterer;
201
202 /**
203 * Returns the bounds of the cluster.
204 *
205 * @return the cluster bounds.
206 * @ignore
207 */
208 getBounds(): google.maps.LatLngBounds;
209
210 /**
211 * Removes the cluster from the map.
212 *
213 * @ignore
214 */
215 remove(): void;
216
217 /**
218 * Adds a marker to the cluster.
219 *
220 * @param marker The marker to be added.
221 * @return True if the marker was added.
222 * @ignore
223 */
224 addMarker(marker: google.maps.Marker): boolean;
225
226 /**
227 * Determines if a marker lies within the cluster's bounds.
228 *
229 * @param marker The marker to check.
230 * @return True if the marker lies in the bounds.
231 * @ignore
232 */
233 isMarkerInClusterBounds(marker: google.maps.Marker): boolean;
234
235 /**
236 * Calculates the extended bounds of the cluster with the grid.
237 */
238 calculateBounds_(): void;
239
240 /**
241 * Updates the cluster icon.
242 */
243 updateIcon_(): void;
244
245 /**
246 * Determines if a marker has already been added to the cluster.
247 *
248 * @param marker The marker to check.
249 * @return True if the marker has already been added.
250 */
251 isMarkerAlreadyAdded_(marker: google.maps.Marker): boolean;
252}
253
254type Calculator = (markers: google.maps.Marker[], clusterIconStylesCount: number) => ClusterIconInfo;
255
256/**
257 * Optional parameter passed to the {@link MarkerClusterer} constructor.
258 */
259interface MarkerClustererOptions {
260 /** [gridSize=60] The grid size of a cluster in pixels. The grid is a square. */
261 gridSize?: number;
262 /**
263 * [maxZoom=null] The maximum zoom level at which clustering is enabled or
264 * <code>null</code> if clustering is to be enabled at all zoom levels.
265 */
266 maxZoom?: number;
267 /**
268 * [zoomOnClick=true] Whether to zoom the map when a cluster marker is
269 * clicked. You may want to set this to <code>false</code> if you have installed a handler
270 * for the <code>click</code> event and it deals with zooming on its own.
271 */
272 zoomOnClick?: boolean;
273 /**
274 * [averageCenter=false] Whether the position of a cluster marker should be
275 * the average position of all markers in the cluster. If set to <code>false</code>, the
276 * cluster marker is positioned at the location of the first marker added to the cluster.
277 */
278 averageCenter?: boolean;
279 /**
280 * [minimumClusterSize=2] The minimum number of markers needed in a cluster
281 * before the markers are hidden and a cluster marker appears.
282 */
283 minimumClusterSize?: number;
284 /**
285 * [ignoreHidden=false] Whether to ignore hidden markers in clusters. You
286 * may want to set this to <code>true</code> to ensure that hidden markers are not included
287 * in the marker count that appears on a cluster marker (this count is the value of the
288 * <code>text</code> property of the result returned by the default <code>calculator</code>).
289 * If set to <code>true</code> and you change the visibility of a marker being clustered, be
290 * sure to also call <code>MarkerClusterer.repaint()</code>.
291 */
292 ignoreHidden?: boolean;
293 /**
294 * [title=""] The tooltip to display when the mouse moves over a cluster
295 * marker. (Alternatively, you can use a custom <code>calculator</code> function to specify a
296 * different tooltip for each cluster marker.)
297 */
298 title?: string;
299 /**
300 * [calculator=MarkerClusterer.CALCULATOR] The function used to determine
301 * the text to be displayed on a cluster marker and the index indicating which style to use
302 * for the cluster marker. The input parameters for the function are (1) the array of markers
303 * represented by a cluster marker and (2) the number of cluster icon styles. It returns a
304 * {@link ClusterIconInfo} object. The default <code>calculator</code> returns a
305 * <code>text</code> property which is the number of markers in the cluster and an
306 * <code>index</code> property which is one higher than the lowest integer such that
307 * <code>10^i</code> exceeds the number of markers in the cluster, or the size of the styles
308 * array, whichever is less. The <code>styles</code> array element used has an index of
309 * <code>index</code> minus 1. For example, the default <code>calculator</code> returns a
310 * <code>text</code> value of <code>"125"</code> and an <code>index</code> of <code>3</code>
311 * for a cluster icon representing 125 markers so the element used in the <code>styles</code>
312 * array is <code>2</code>. A <code>calculator</code> may also return a <code>title</code>
313 * property that contains the text of the tooltip to be used for the cluster marker. If
314 * <code>title</code> is not defined, the tooltip is set to the value of the <code>title</code>
315 * property for the MarkerClusterer.
316 */
317 calculator?: Calculator;
318 /**
319 * [clusterClass="cluster"] The name of the CSS class defining general styles
320 * for the cluster markers. Use this class to define CSS styles that are not set up by the code
321 * that processes the <code>styles</code> array.
322 */
323 clusterClass?: string;
324 /**
325 * [styles] An array of {@link ClusterIconStyle} elements defining the styles
326 * of the cluster markers to be used. The element to be used to style a given cluster marker
327 * is determined by the function defined by the <code>calculator</code> property.
328 * The default is an array of {@link ClusterIconStyle} elements whose properties are derived
329 * from the values for <code>imagePath</code>, <code>imageExtension</code>, and
330 * <code>imageSizes</code>.
331 */
332 styles?: ClusterIconStyle[];
333 /**
334 * [enableRetinaIcons=false] Whether to allow the use of cluster icons that
335 * have sizes that are some multiple (typically double) of their actual display size. Icons such
336 * as these look better when viewed on high-resolution monitors such as Apple's Retina displays.
337 * Note: if this property is <code>true</code>, sprites cannot be used as cluster icons.
338 */
339 enableRetinaIcons?: boolean;
340 /**
341 * [batchSize=MarkerClusterer.BATCH_SIZE] Set this property to the
342 * number of markers to be processed in a single batch when using a browser other than
343 * Internet Explorer (for Internet Explorer, use the batchSizeIE property instead).
344 */
345 batchSize?: number;
346 /**
347 * [batchSizeIE=MarkerClusterer.BATCH_SIZE_IE] When Internet Explorer is
348 * being used, markers are processed in several batches with a small delay inserted between
349 * each batch in an attempt to avoid Javascript timeout errors. Set this property to the
350 * number of markers to be processed in a single batch; select as high a number as you can
351 * without causing a timeout error in the browser. This number might need to be as low as 100
352 * if 15,000 markers are being managed, for example.
353 */
354 batchSizeIE?: number;
355 /**
356 * [imagePath=MarkerClusterer.IMAGE_PATH]
357 * The full URL of the root name of the group of image files to use for cluster icons.
358 * The complete file name is of the form <code>imagePath</code>n.<code>imageExtension</code>
359 * where n is the image file number (1, 2, etc.).
360 */
361 imagePath?: string;
362 /**
363 * [imageExtension=MarkerClusterer.IMAGE_EXTENSION]
364 * The extension name for the cluster icon image files (e.g., <code>"png"</code> or
365 * <code>"jpg"</code>).
366 */
367 imageExtension?: string;
368 /**
369 * [imageSizes=MarkerClusterer.IMAGE_SIZES]
370 * An array of numbers containing the widths of the group of
371 * <code>imagePath</code>n.<code>imageExtension</code> image files.
372 * (The images are assumed to be square.)
373 */
374 imageSizes?: number[];
375}
376
377declare class MarkerClusterer extends google.maps.OverlayView {
378 /**
379 * Creates a MarkerClusterer object with the options specified in {@link MarkerClustererOptions}.
380 * @param map The Google map to attach to.
381 * @param [markers] The markers to be added to the cluster.
382 * @param [options] The optional parameters.
383 */
384 constructor(map: google.maps.Map, markers?: google.maps.Marker[], options?: MarkerClustererOptions);
385
386 /**
387 * Implementation of the onAdd interface method.
388 * @ignore
389 */
390 onAdd(): void;
391
392 /**
393 * Implementation of the onRemove interface method.
394 * Removes map event listeners and all cluster icons from the DOM.
395 * All managed markers are also put back on the map.
396 * @ignore
397 */
398 onRemove(): void;
399
400 /**
401 * Implementation of the draw interface method.
402 * @ignore
403 */
404 draw(): void;
405
406 /**
407 * Sets up the styles object.
408 */
409 setupStyles_(): void;
410
411 /**
412 * Fits the map to the bounds of the markers managed by the clusterer.
413 */
414 fitMapToMarkers(): void;
415
416 /**
417 * Returns the value of the <code>gridSize</code> property.
418 *
419 * @return The grid size.
420 */
421 getGridSize(): number;
422
423 /**
424 * Sets the value of the <code>gridSize</code> property.
425 *
426 * @param gridSize The grid size.
427 */
428 setGridSize(gridSize: number): void;
429
430 /**
431 * Returns the value of the <code>minimumClusterSize</code> property.
432 *
433 * @return The minimum cluster size.
434 */
435 getMinimumClusterSize(): number;
436
437 /**
438 * Sets the value of the <code>minimumClusterSize</code> property.
439 *
440 * @param minimumClusterSize The minimum cluster size.
441 */
442 setMinimumClusterSize(minimumClusterSize: number): void;
443
444 /**
445 * Returns the value of the <code>maxZoom</code> property.
446 *
447 * @return The maximum zoom level.
448 */
449 getMaxZoom(): number;
450
451 /**
452 * Sets the value of the <code>maxZoom</code> property.
453 *
454 * @param maxZoom The maximum zoom level.
455 */
456 setMaxZoom(maxZoom: number): void;
457
458 /**
459 * Returns the value of the <code>styles</code> property.
460 *
461 * @return The array of styles defining the cluster markers to be used.
462 */
463 getStyles(): ClusterIconStyle[];
464
465 /**
466 * Sets the value of the <code>styles</code> property.
467 *
468 * @param styles The array of styles to use.
469 */
470 setStyles(styles: ClusterIconStyle[]): void;
471
472 /**
473 * Returns the value of the <code>title</code> property.
474 *
475 * @return The content of the title text.
476 */
477 getTitle(): string;
478
479 /**
480 * Sets the value of the <code>title</code> property.
481 *
482 * @param title The value of the title property.
483 */
484 setTitle(title: string): void;
485
486 /**
487 * Returns the value of the <code>zoomOnClick</code> property.
488 *
489 * @return True if zoomOnClick property is set.
490 */
491 getZoomOnClick(): boolean;
492
493 /**
494 * Sets the value of the <code>zoomOnClick</code> property.
495 *
496 * @param zoomOnClick The value of the zoomOnClick property.
497 */
498 setZoomOnClick(zoomOnClick: boolean): void;
499
500 /**
501 * Returns the value of the <code>averageCenter</code> property.
502 *
503 * @return True if averageCenter property is set.
504 */
505 getAverageCenter(): boolean;
506
507 /**
508 * Sets the value of the <code>averageCenter</code> property.
509 *
510 * @param averageCenter The value of the averageCenter property.
511 */
512 setAverageCenter(averageCenter: boolean): void;
513
514 /**
515 * Returns the value of the <code>ignoreHidden</code> property.
516 *
517 * @return True if ignoreHidden property is set.
518 */
519 getIgnoreHidden(): boolean;
520
521 /**
522 * Sets the value of the <code>ignoreHidden</code> property.
523 *
524 * @param ignoreHidden The value of the ignoreHidden property.
525 */
526 setIgnoreHidden(ignoreHidden: boolean): void;
527
528 /**
529 * Returns the value of the <code>enableRetinaIcons</code> property.
530 *
531 * @return True if enableRetinaIcons property is set.
532 */
533 getEnableRetinaIcons(): boolean;
534
535 /**
536 * Sets the value of the <code>enableRetinaIcons</code> property.
537 *
538 * @param enableRetinaIcons The value of the enableRetinaIcons property.
539 */
540 setEnableRetinaIcons(enableRetinaIcons: boolean): void;
541
542 /**
543 * Returns the value of the <code>imageExtension</code> property.
544 *
545 * @return The value of the imageExtension property.
546 */
547 getImageExtension(): string;
548
549 /**
550 * Sets the value of the <code>imageExtension</code> property.
551 *
552 * @param imageExtension The value of the imageExtension property.
553 */
554 setImageExtension(imageExtension: string): void;
555
556 /**
557 * Returns the value of the <code>imagePath</code> property.
558 *
559 * @return The value of the imagePath property.
560 */
561 getImagePath(): string;
562
563 /**
564 * Sets the value of the <code>imagePath</code> property.
565 *
566 * @param imagePath The value of the imagePath property.
567 */
568 setImagePath(imagePath: string): void;
569
570 /**
571 * Returns the value of the <code>imageSizes</code> property.
572 *
573 * @return The value of the imageSizes property.
574 */
575 getImageSizes(): number[];
576
577 /**
578 * Sets the value of the <code>imageSizes</code> property.
579 *
580 * @param imageSizes The value of the imageSizes property.
581 */
582 setImageSizes(imageSizes: number[]): void;
583
584 /**
585 * Returns the value of the <code>calculator</code> property.
586 *
587 * @return the value of the calculator property.
588 */
589 getCalculator(): Calculator;
590
591 /**
592 * Sets the value of the <code>calculator</code> property.
593 *
594 * @param calculator The value
595 * of the calculator property.
596 */
597 setCalculator(calculator: Calculator): void;
598
599 /**
600 * Sets the value of the <code>hideLabel</code> property.
601 *
602 * @param printable The value of the hideLabel property.
603 */
604 setHideLabel(printable: boolean): void;
605
606 /**
607 * Returns the value of the <code>hideLabel</code> property.
608 *
609 * @return the value of the hideLabel property.
610 */
611 getHideLabel(): boolean;
612
613 /**
614 * Returns the value of the <code>batchSizeIE</code> property.
615 *
616 * @return the value of the batchSizeIE property.
617 */
618 getBatchSizeIE(): number;
619
620 /**
621 * Sets the value of the <code>batchSizeIE</code> property.
622 *
623 * @param batchSizeIE The value of the batchSizeIE property.
624 */
625 setBatchSizeIE(batchSizeIE: number): void;
626
627 /**
628 * Returns the value of the <code>clusterClass</code> property.
629 *
630 * @return the value of the clusterClass property.
631 */
632 getClusterClass(): string;
633
634 /**
635 * Sets the value of the <code>clusterClass</code> property.
636 *
637 * @param clusterClass The value of the clusterClass property.
638 */
639 setClusterClass(clusterClass: string): void;
640
641 /**
642 * Returns the array of markers managed by the clusterer.
643 *
644 * @return The array of markers managed by the clusterer.
645 */
646 getMarkers(): google.maps.Marker[];
647
648 /**
649 * Returns the number of markers managed by the clusterer.
650 *
651 * @return The number of markers.
652 */
653 getTotalMarkers(): number;
654
655 /**
656 * Returns the current array of clusters formed by the clusterer.
657 *
658 * @return The array of clusters formed by the clusterer.
659 */
660 getClusters(): Cluster[];
661
662 /**
663 * Returns the number of clusters formed by the clusterer.
664 *
665 * @return The number of clusters formed by the clusterer.
666 */
667 getTotalClusters(): number;
668
669 /**
670 * Adds a marker to the clusterer. The clusters are redrawn unless
671 * <code>noDraw</code> is set to <code>true</code>.
672 *
673 * @param marker The marker to add.
674 * @param [noDraw] Set to <code>true</code> to prevent redrawing.
675 */
676 addMarker(marker: google.maps.Marker, noDraw?: boolean): void;
677
678 /**
679 * Adds an array of markers to the clusterer. The clusters are redrawn unless
680 * <code>noDraw</code> is set to <code>true</code>.
681 *
682 * @param markers The markers to add.
683 * @param [noDraw] Set to <code>true</code> to prevent redrawing.
684 */
685 addMarkers(markers: google.maps.Marker[], noDraw?: boolean): void;
686
687 /**
688 * Pushes a marker to the clusterer.
689 *
690 * @param marker The marker to add.
691 */
692 pushMarkerTo_(marker: google.maps.Marker): void;
693
694 /**
695 * Removes a marker from the cluster and map. The clusters are redrawn unless
696 * <code>noDraw</code> is set to <code>true</code>. Returns <code>true</code> if the
697 * marker was removed from the clusterer.
698 *
699 * @param marker The marker to remove.
700 * @param [noDraw] Set to <code>true</code> to prevent redrawing.
701 * @param [noMapRemove] Set to <code>true</code> to prevent removal from map but still removing from cluster management
702 * @return True if the marker was removed from the clusterer.
703 */
704 removeMarker(marker: google.maps.Marker, noDraw?: boolean, noMapRemove?: boolean): boolean;
705
706 /**
707 * Removes an array of markers from the cluster and map. The clusters are redrawn unless
708 * <code>noDraw</code> is set to <code>true</code>. Returns <code>true</code> if markers
709 * were removed from the clusterer.
710 *
711 * @param markers The markers to remove.
712 * @param [noDraw] Set to <code>true</code> to prevent redrawing.
713 * @param [noMapRemove] Set to <code>true</code> to prevent removal from map but still removing from cluster management
714 * @return True if markers were removed from the clusterer.
715 */
716 removeMarkers(markers: google.maps.Marker[], noDraw?: boolean, noMapRemove?: boolean): boolean;
717
718 /**
719 * Removes a marker and returns true if removed, false if not.
720 *
721 * @param marker The marker to remove
722 * @param removeFromMap set to <code>true</code> to explicitly remove from map as well as cluster manangement
723 * @return Whether the marker was removed or not
724 */
725 removeMarker_(marker: google.maps.Marker, removeFromMap?: boolean): boolean;
726
727 /**
728 * Removes all clusters and markers from the map and also removes all markers
729 * managed by the clusterer.
730 */
731 clearMarkers(): void;
732
733 /**
734 * Recalculates and redraws all the marker clusters from scratch.
735 * Call this after changing any properties.
736 */
737 repaint(): void;
738
739 /**
740 * Returns the current bounds extended by the grid size.
741 *
742 * @param bounds The bounds to extend.
743 * @return The extended bounds.
744 * @ignore
745 */
746 getExtendedBounds(bounds: google.maps.LatLngBounds): google.maps.LatLngBounds;
747
748 /**
749 * Redraws all the clusters.
750 */
751 redraw_(): void;
752
753 /**
754 * Removes all clusters from the map. The markers are also removed from the map
755 * if <code>hide</code> is set to <code>true</code>.
756 *
757 * @param [hide] Set to <code>true</code> to also remove the markers
758 * from the map.
759 */
760 resetViewport_(hide?: boolean): void;
761
762 /**
763 * Calculates the distance between two latlng locations in km.
764 *
765 * @param p1 The first lat lng point.
766 * @param p2 The second lat lng point.
767 * @return The distance between the two points in km.
768 * @see http://www.movable-type.co.uk/scripts/latlong.html
769 */
770 distanceBetweenPoints_(p1: google.maps.LatLng, p2: google.maps.LatLng): number;
771
772 /**
773 * Determines if a marker is contained in a bounds.
774 *
775 * @param marker The marker to check.
776 * @param bounds The bounds to check against.
777 * @return True if the marker is in the bounds.
778 */
779 isMarkerInBounds_(marker: google.maps.Marker, bounds: google.maps.LatLngBounds): boolean;
780
781 /**
782 * Adds a marker to a cluster, or creates a new cluster.
783 *
784 * @param marker The marker to add.
785 */
786 addToClosestCluster_(marker: google.maps.Marker): void;
787
788 /**
789 * Creates the clusters. This is done in batches to avoid timeout errors
790 * in some browsers when there is a huge number of markers.
791 *
792 * @param iFirst The index of the first marker in the batch of
793 * markers to be added to clusters.
794 */
795 createClusters_(iFirst: number): void;
796
797 /**
798 * Extends an object's prototype by another's.
799 *
800 * @param obj1 The object to be extended.
801 * @param obj2 The object to extend with.
802 * @return The new extended object.
803 * @ignore
804 */
805 extend(obj1: object, obj2: object): object;
806
807 /**
808 * The default function for determining the label text and style
809 * for a cluster icon.
810 *
811 * @param markers The array of markers represented by the cluster.
812 * @param numStyles The number of marker styles available.
813 * @return The information resource for the cluster.
814 * @ignore
815 */
816 static CALCULATOR: Calculator;
817
818 /**
819 * The number of markers to process in one batch.
820 *
821 */
822 static BATCH_SIZE: number;
823
824 /**
825 * The number of markers to process in one batch (IE only).
826 *
827 */
828 static BATCH_SIZE_IE: number;
829
830 /**
831 * The default root name for the marker cluster images.
832 *
833 */
834 static IMAGE_PATH: string;
835
836 /**
837 * The default extension name for the marker cluster images.
838 *
839 */
840 static IMAGE_EXTENSION: string;
841
842 /**
843 * The default array of sizes for the marker cluster images.
844 *
845 */
846 static IMAGE_SIZES: number[];
847}
848
849interface String {
850 trim(): string;
851}