supercluster-googlemaps-adapter
Advanced tools
Comparing version 1.0.4 to 1.0.5
/// <reference types="googlemaps" /> | ||
import { Builder } from './builder'; | ||
import { IStyle } from './interfaces'; | ||
import { IStyle, ISuperClusterAdapter } from './interfaces'; | ||
import Supercluster from 'supercluster'; | ||
import * as GeoJSON from 'geojson'; | ||
export declare class SuperClusterAdapter { | ||
export declare class SuperClusterAdapter implements ISuperClusterAdapter { | ||
private pMap; | ||
@@ -42,2 +42,4 @@ private pRadius; | ||
setVisible(v: boolean): void; | ||
setVisibleMarkersAndClusters(v: boolean): void; | ||
setVisibleDataLayerFeatures(v: boolean): void; | ||
getFeaturesBounds(): google.maps.LatLngBounds; | ||
@@ -44,0 +46,0 @@ destroy(): void; |
@@ -1,3 +0,4 @@ | ||
export declare class Loader { | ||
static getClusterer(): Promise<any>; | ||
import { ISuperClusterAdapterStatic } from './interfaces'; | ||
export declare class SuperClusterAdapterLoader { | ||
static getClusterer(): Promise<ISuperClusterAdapterStatic | undefined>; | ||
} |
/// <reference types="googlemaps" /> | ||
import * as GeoJSON from 'geojson'; | ||
import { Builder } from './builder'; | ||
export interface ISuperClusterAdapter { | ||
map: google.maps.Map; | ||
radius: number; | ||
maxZoom: number; | ||
minZoom: number; | ||
styles: IStyle[]; | ||
imagePath: string; | ||
imageExtension: string; | ||
isZoomOnClick: boolean; | ||
numFeatures: number; | ||
hasFeatures: boolean; | ||
features: GeoJSON.Feature<GeoJSON.Point>[]; | ||
setVisible: (v: boolean) => void; | ||
setVisibleMarkersAndClusters: (v: boolean) => void; | ||
setVisibleDataLayerFeatures: (v: boolean) => void; | ||
getFeaturesBounds: () => google.maps.LatLngBounds; | ||
destroy: () => void; | ||
load: (geoJson: GeoJSON.FeatureCollection) => void; | ||
drawServerSideCalculatedClusters: (features: any[]) => void; | ||
} | ||
export interface ISuperClusterAdapterStatic { | ||
Builder: typeof Builder; | ||
} | ||
export interface IStyle { | ||
@@ -3,0 +28,0 @@ url: string; |
{ | ||
"name": "supercluster-googlemaps-adapter", | ||
"version": "1.0.4", | ||
"version": "1.0.5", | ||
"description": "Supercluster Adapter for Google Maps JavaScript API v3", | ||
@@ -5,0 +5,0 @@ "main": "lib/index.js", |
@@ -22,3 +22,3 @@ # Supercluster Adapter for Google Maps JavaScript API v3 | ||
import SuperClusterAdapter from 'supercluster-googlemaps-adapter'; | ||
import { SuperClusterAdapterLoader } from 'supercluster-googlemaps-adapter'; | ||
@@ -44,3 +44,3 @@ Please note that this library depends on the Google Maps JavaScript API, so it should be initialized once the Google Maps JavaScript API is fully loaded. | ||
google.maps.event.addListenerOnce(map, 'tilesloaded', () => { | ||
SuperClusterAdapter.getClusterer().then(Clusterer => { | ||
SuperClusterAdapterLoader.getClusterer().then(Clusterer => { | ||
if (Clusterer) { | ||
@@ -67,11 +67,11 @@ const clusterer = new Clusterer.Builder(map) | ||
Note that clusterer is loaded asynchronously, so the logic should be implemented once MarkerClusterer.getClusterer() promise is resolved. | ||
Note that clusterer is loaded asynchronously, so the logic should be implemented once SuperClusterAdapterLoader.getClusterer() promise is resolved. | ||
### Setting up clusterer | ||
In order to set up a clusterer you should call `SuperClusterAdapter.getClusterer()` method that returns a promise. Once resolved the promise you will have a Clusterer class that should be used to create an instance of clusterer object. | ||
In order to set up a clusterer you should call `SuperClusterAdapterLoader.getClusterer()` method that returns a promise. Once resolved the promise you will have a Clusterer class that should be used to create an instance of clusterer object. | ||
Code snippet is the following | ||
SuperClusterAdapter.getClusterer().then(Clusterer => { | ||
SuperClusterAdapterLoader.getClusterer().then(Clusterer => { | ||
if (Clusterer) { | ||
@@ -317,2 +317,10 @@ // TODO: create instance of clusterer | ||
#### setVisibleMarkersAndClusters(v: boolean) | ||
Allows set visibility for markers and clusters only (items with Point geometry) | ||
#### setVisibleDataLayerFeatures(v: boolean) | ||
Allows set visibility for data layer features (items with non-Point geometry) | ||
#### destroy() | ||
@@ -319,0 +327,0 @@ |
Sorry, the diff of this file is too big to display
243030
21
360
355