From cbf3e1f5d3fc7cbb4cb2aba5b9a0d498160003d1 Mon Sep 17 00:00:00 2001 From: Bernd Hacker Date: Mon, 3 Jul 2017 09:16:19 +0200 Subject: [PATCH 1/5] fix H.map.layer.ObjectLayer constructor --- types/heremaps/index.d.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/types/heremaps/index.d.ts b/types/heremaps/index.d.ts index ca32173bed..a4010e8d09 100644 --- a/types/heremaps/index.d.ts +++ b/types/heremaps/index.d.ts @@ -2938,7 +2938,7 @@ declare namespace H { * @param provider {H.map.provider.ObjectProvider} - the ObjectProvider which provides the map objects to this object layer. * @param opt_options {H.map.layer.ObjectLayer.Options=} - The options for this layer */ - constructor(provider: H.map.provider.ObjectProvider, opt_options?: H.map.layer.ObjectLayer.Options); + constructor(provider: H.map.provider.ObjectProvider | H.clustering.Provider, opt_options?: H.map.layer.ObjectLayer.Options); /** * This method returns current ObjectLayer's data provider From f584af65b7c2a85ed3193ee310ac1ffa5ca97e05 Mon Sep 17 00:00:00 2001 From: Bernd Hacker Date: Mon, 3 Jul 2017 09:21:42 +0200 Subject: [PATCH 2/5] fix types for H.service.PlatformcreateDefaultLayers() --- types/heremaps/index.d.ts | 22 +++++++++++++++++----- 1 file changed, 17 insertions(+), 5 deletions(-) diff --git a/types/heremaps/index.d.ts b/types/heremaps/index.d.ts index a4010e8d09..22bd3c8a52 100644 --- a/types/heremaps/index.d.ts +++ b/types/heremaps/index.d.ts @@ -4017,6 +4017,17 @@ declare namespace H { type Options = any; } + /** + * This property specifies collection of pre-configured HERE layers + */ + interface DefaultLayers { + normal: H.service.MapType; + satellite: H.service.MapType; + terrain: H.service.MapType; + incidents: H.map.layer.MarkerTileLayer; + venues: H.map.layer.TileLayer; + } + /** * This class encapsulates Enterprise Routing REST API as a service stub. An instance of this class can be retrieved by calling the factory method on a platform instance. * H.service.Platform#getEnterpriseRoutingService. @@ -4473,17 +4484,18 @@ declare namespace H { /** * This method creates a pre-configured set of HERE tile layers for convenient use with the map. * @param opt_tileSize {(H.service.Platform.DefaultLayersOptions | number)=} - When a number – optional tile size to be queried from the HERE Map Tile API, default is 256. - * If theparameter is an object, then it represents options and all remaining below parameters should be omitted. + * If this parameter is a number, it indicates the tile size to be queried from the HERE Map Tile API (the default value is 256); if this parameter is an object, it represents configuration options for the layer and all the remaining parameters (below) should be omitted * @param opt_ppi {number=} - optional 'ppi' parameter to use when querying tiles, default is not specified * @param opt_lang {string=} - optional primary language parameter, default is not specified * @param opt_secondaryLang {string=} - optional secondary language parameter, default is not specified * @param opt_style {string=} - optional 'style' parameter to use when querying map tiles, default is not specified * @param opt_pois {(string | boolean)=} - indicates if pois are displayed on the map. Pass true to indicate that all pois should be visible. Alternatively you can specify mask for the * POI Categories as described at the Map Tile API documentation POI Categories chapter. - * @returns {Object} - a set of tile layers ready to use + * @returns {H.service.DefaultLayers} - a set of tile layers ready to use */ - createDefaultLayers(opt_tileSize?: (H.service.Platform.DefaultLayersOptions | number), opt_ppi?: number, opt_lang?: string, opt_secondaryLang?: string, opt_style?: string, - opt_pois?: (string | boolean)): H.service.Platform.MapTypes; + createDefaultLayers(opt_tileSize?: (H.service.Platform.DefaultLayersOptions | number), opt_ppi?: number, + opt_lang?: string, opt_secondaryLang?: string, opt_style?: string, + opt_pois?: (string | boolean)): H.service.DefaultLayers; /** * This method returns an instance of H.service.RoutingService to query the Routing API. @@ -5681,7 +5693,7 @@ declare namespace H { * @param opt_locale {(H.ui.i18n.Localization | string)=} - the language to use (or a full localization object). * @returns {H.ui.UI} - the UI instance configured with the default controls */ - static createDefault(map: H.Map, mapTypes: H.service.Platform.MapTypes, opt_locale?: H.ui.i18n.Localization | string): UI; + static createDefault(map: H.Map, mapTypes: H.service.MapType | H.service.DefaultLayers, opt_locale?: H.ui.i18n.Localization | string): H.ui.UI; /** * This method is used to capture the element view From a487f0436e031de2f3369939967145d4b5bdf44c Mon Sep 17 00:00:00 2001 From: Bernd Hacker Date: Mon, 3 Jul 2017 09:26:49 +0200 Subject: [PATCH 3/5] fix lint errors, add test --- types/heremaps/heremaps-tests.ts | 13 +++++++++++++ types/heremaps/index.d.ts | 5 +++-- 2 files changed, 16 insertions(+), 2 deletions(-) diff --git a/types/heremaps/heremaps-tests.ts b/types/heremaps/heremaps-tests.ts index d3e161cb74..97a2a82477 100644 --- a/types/heremaps/heremaps-tests.ts +++ b/types/heremaps/heremaps-tests.ts @@ -160,3 +160,16 @@ enterprieseRouter.calculateIsoline( console.log(error); } ); + +// Create a clustering provider +const clusteredDataProvider = new H.clustering.Provider([], { +clusteringOptions: { + // Maximum radius of the neighborhood + eps: 64, + // minimum weight of points required to form a cluster + minWeight: 3 +} +}); + +// Create a layer that will consume objects from our clustering provider +const layer = new H.map.layer.ObjectLayer(clusteredDataProvider); diff --git a/types/heremaps/index.d.ts b/types/heremaps/index.d.ts index 22bd3c8a52..8241d749b3 100644 --- a/types/heremaps/index.d.ts +++ b/types/heremaps/index.d.ts @@ -4484,7 +4484,8 @@ declare namespace H { /** * This method creates a pre-configured set of HERE tile layers for convenient use with the map. * @param opt_tileSize {(H.service.Platform.DefaultLayersOptions | number)=} - When a number – optional tile size to be queried from the HERE Map Tile API, default is 256. - * If this parameter is a number, it indicates the tile size to be queried from the HERE Map Tile API (the default value is 256); if this parameter is an object, it represents configuration options for the layer and all the remaining parameters (below) should be omitted + * If this parameter is a number, it indicates the tile size to be queried from the HERE Map Tile API (the default value is 256); if this parameter is an object, it represents + * configuration options for the layer and all the remaining parameters (below) should be omitted * @param opt_ppi {number=} - optional 'ppi' parameter to use when querying tiles, default is not specified * @param opt_lang {string=} - optional primary language parameter, default is not specified * @param opt_secondaryLang {string=} - optional secondary language parameter, default is not specified @@ -4493,7 +4494,7 @@ declare namespace H { * POI Categories as described at the Map Tile API documentation POI Categories chapter. * @returns {H.service.DefaultLayers} - a set of tile layers ready to use */ - createDefaultLayers(opt_tileSize?: (H.service.Platform.DefaultLayersOptions | number), opt_ppi?: number, + createDefaultLayers(opt_tileSize?: (H.service.Platform.DefaultLayersOptions | number), opt_ppi?: number, opt_lang?: string, opt_secondaryLang?: string, opt_style?: string, opt_pois?: (string | boolean)): H.service.DefaultLayers; From c56337307a22b99d863e40198f5729b23d38c37b Mon Sep 17 00:00:00 2001 From: Bernd Hacker Date: Thu, 6 Jul 2017 08:31:13 +0200 Subject: [PATCH 4/5] address feedback from pr --- types/heremaps/index.d.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/types/heremaps/index.d.ts b/types/heremaps/index.d.ts index 8241d749b3..16147224f6 100644 --- a/types/heremaps/index.d.ts +++ b/types/heremaps/index.d.ts @@ -4496,7 +4496,7 @@ declare namespace H { */ createDefaultLayers(opt_tileSize?: (H.service.Platform.DefaultLayersOptions | number), opt_ppi?: number, opt_lang?: string, opt_secondaryLang?: string, opt_style?: string, - opt_pois?: (string | boolean)): H.service.DefaultLayers; + opt_pois?: (string | boolean)): H.service.Platform.MapTypes | H.service.DefaultLayers; /** * This method returns an instance of H.service.RoutingService to query the Routing API. @@ -5694,7 +5694,7 @@ declare namespace H { * @param opt_locale {(H.ui.i18n.Localization | string)=} - the language to use (or a full localization object). * @returns {H.ui.UI} - the UI instance configured with the default controls */ - static createDefault(map: H.Map, mapTypes: H.service.MapType | H.service.DefaultLayers, opt_locale?: H.ui.i18n.Localization | string): H.ui.UI; + static createDefault(map: H.Map, mapTypes: H.service.Platform.MapTypes | H.service.MapType | H.service.DefaultLayers, opt_locale?: H.ui.i18n.Localization | string): H.ui.UI; /** * This method is used to capture the element view From a3edea48b361788657cea94f87294e92bdaae8ab Mon Sep 17 00:00:00 2001 From: Bernd Hacker Date: Fri, 7 Jul 2017 15:38:21 +0200 Subject: [PATCH 5/5] fix pr feedback --- types/heremaps/index.d.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/types/heremaps/index.d.ts b/types/heremaps/index.d.ts index 16147224f6..89e0992b82 100644 --- a/types/heremaps/index.d.ts +++ b/types/heremaps/index.d.ts @@ -4496,7 +4496,7 @@ declare namespace H { */ createDefaultLayers(opt_tileSize?: (H.service.Platform.DefaultLayersOptions | number), opt_ppi?: number, opt_lang?: string, opt_secondaryLang?: string, opt_style?: string, - opt_pois?: (string | boolean)): H.service.Platform.MapTypes | H.service.DefaultLayers; + opt_pois?: (string | boolean)): H.service.DefaultLayers; /** * This method returns an instance of H.service.RoutingService to query the Routing API. @@ -5694,7 +5694,7 @@ declare namespace H { * @param opt_locale {(H.ui.i18n.Localization | string)=} - the language to use (or a full localization object). * @returns {H.ui.UI} - the UI instance configured with the default controls */ - static createDefault(map: H.Map, mapTypes: H.service.Platform.MapTypes | H.service.MapType | H.service.DefaultLayers, opt_locale?: H.ui.i18n.Localization | string): H.ui.UI; + static createDefault(map: H.Map, mapTypes: H.service.Platform.MapTypes | H.service.DefaultLayers, opt_locale?: H.ui.i18n.Localization | string): H.ui.UI; /** * This method is used to capture the element view