From 72587a30c4e64a47c1a65d2ab9cd7d4883a73d5f Mon Sep 17 00:00:00 2001 From: drekss Date: Tue, 5 May 2020 08:29:22 -0400 Subject: [PATCH 1/2] add params to clusterStyle --- .../geo/src/lib/layer/shared/clusterParam.ts | 3 +++ .../geo/src/lib/layer/shared/style.service.ts | 20 +++++++++++++++++++ 2 files changed, 23 insertions(+) diff --git a/packages/geo/src/lib/layer/shared/clusterParam.ts b/packages/geo/src/lib/layer/shared/clusterParam.ts index 2e1fe1e0e9..7a251fba54 100644 --- a/packages/geo/src/lib/layer/shared/clusterParam.ts +++ b/packages/geo/src/lib/layer/shared/clusterParam.ts @@ -6,5 +6,8 @@ export interface ClusterParam { export interface ClusterRange { minRadius?: number; maxRadius?: number; + showRange?: boolean; + dynamicRadius?: boolean; style: { [key: string]: any }; + } diff --git a/packages/geo/src/lib/layer/shared/style.service.ts b/packages/geo/src/lib/layer/shared/style.service.ts index fc1c048b09..51b52ac739 100644 --- a/packages/geo/src/lib/layer/shared/style.service.ts +++ b/packages/geo/src/lib/layer/shared/style.service.ts @@ -193,6 +193,26 @@ export class StyleService { (!r.maxRadius || r.maxRadius >= size) ) { style = this.createStyle(r.style); + + if (r.showRange) { + const text = new olstyle.Text({ + text: size.toString(), + fill: new olstyle.Fill({ + color: '#fff' + }) + }); + style.setText(text); + } + + if (r.dynamicRadius) { + let clusterRadius: number; + const radiusMin = style.image_.getRadius(); + clusterRadius = 5 * Math.log(size); + if (clusterRadius < radiusMin) { + clusterRadius = radiusMin; + } + style.image_.setRadius(clusterRadius); + } break; } } From 20f905dc96dac982e1fdd36634a09a8901e17855 Mon Sep 17 00:00:00 2001 From: drekss Date: Mon, 25 May 2020 11:56:58 -0400 Subject: [PATCH 2/2] share-map cerf fixed --- .../lib/context-manager/shared/layer-context.directive.ts | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/packages/context/src/lib/context-manager/shared/layer-context.directive.ts b/packages/context/src/lib/context-manager/shared/layer-context.directive.ts index dcd2230763..0686918a5a 100644 --- a/packages/context/src/lib/context-manager/shared/layer-context.directive.ts +++ b/packages/context/src/lib/context-manager/shared/layer-context.directive.ts @@ -50,10 +50,11 @@ export class LayerContextDirective implements OnInit, OnDestroy { this.route.options.contextKey ) { const queryParams$$ = this.route.queryParams - .pipe(skip(1)) .subscribe(params => { - this.queryParams = params; - queryParams$$.unsubscribe(); + if ( Object.keys(params).length > 0 ) { + this.queryParams = params; + queryParams$$.unsubscribe(); + } }); } }