From d6f24409f35531e27fa936d0bc65cc0ac8f54fe8 Mon Sep 17 00:00:00 2001 From: aziz Date: Tue, 25 Apr 2023 22:12:58 +0200 Subject: [PATCH 1/3] fear(geo): add style and change color in feature store --- .../search-results-add-button.component.ts | 23 ++++++++++++++++++- 1 file changed, 22 insertions(+), 1 deletion(-) diff --git a/packages/geo/src/lib/search/search-results/search-results-add-button.component.ts b/packages/geo/src/lib/search/search-results/search-results-add-button.component.ts index a1b74377e1..627d98368a 100644 --- a/packages/geo/src/lib/search/search-results/search-results-add-button.component.ts +++ b/packages/geo/src/lib/search/search-results/search-results-add-button.component.ts @@ -29,6 +29,10 @@ import { import { EntityStore } from '@igo2/common'; import { getTooltipsOfOlGeometry } from '../../measure'; import OlOverlay from 'ol/Overlay'; +import Stroke from 'ol/style/Stroke'; +import Fill from 'ol/style/Fill'; +import Style from 'ol/style/Style'; +import Circle from 'ol/style/Circle'; import { VectorSourceEvent as OlVectorSourceEvent } from 'ol/source/Vector'; import { default as OlGeometry } from 'ol/geom/Geometry'; import { QueryableDataSourceOptions } from '../../query'; @@ -314,11 +318,25 @@ export class SearchResultAddButtonComponent implements OnInit, OnDestroy{ } createLayer(layerTitle: string, selectedFeature: SearchResult) { - const activeStore: FeatureStore = new FeatureStore([], { map: this.map }); + const style = [ + new Style({ + image: new Circle({ + radius: 5, + stroke: new Stroke({ + width: 1, + color: 'rgba(143,7,7,1)' + }), + fill: new Fill({ + color: 'rgba(143,7,7,1)' + }) + }) + }) + ]; + // set layer id let layerCounterID: number = 0; for (const layer of this.allLayers) { @@ -350,6 +368,9 @@ export class SearchResultAddButtonComponent implements OnInit, OnDestroy{ } } }, + style: function(feature) { + return style; + }, showInLayerList: true, exportable: true, workspace: { From 0239c4c168edb70e9d8cdf575de535325a5e32c6 Mon Sep 17 00:00:00 2001 From: aziz Date: Thu, 27 Apr 2023 15:48:22 +0200 Subject: [PATCH 2/3] add polygone style and color --- .../search-results-add-button.component.ts | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/packages/geo/src/lib/search/search-results/search-results-add-button.component.ts b/packages/geo/src/lib/search/search-results/search-results-add-button.component.ts index 627d98368a..f166404d21 100644 --- a/packages/geo/src/lib/search/search-results/search-results-add-button.component.ts +++ b/packages/geo/src/lib/search/search-results/search-results-add-button.component.ts @@ -334,6 +334,15 @@ export class SearchResultAddButtonComponent implements OnInit, OnDestroy{ color: 'rgba(143,7,7,1)' }) }) + }), + new Style({ + stroke: new Stroke({ + width: 1, + color: 'rgba(143,7,7,1)' + }), + fill: new Fill({ + color: 'rgba(0, 0, 255, 0.1)', + }), }) ]; From 629e27d81e712e2671f7cbaf94ec2240a516212b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Pierre-=C3=89tienne=20Lord?= Date: Mon, 1 May 2023 13:04:28 -0400 Subject: [PATCH 3/3] refactor(search-add-button): direct style instead of a stylefunction --- .../search-results/search-results-add-button.component.ts | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/packages/geo/src/lib/search/search-results/search-results-add-button.component.ts b/packages/geo/src/lib/search/search-results/search-results-add-button.component.ts index f166404d21..2762521fc0 100644 --- a/packages/geo/src/lib/search/search-results/search-results-add-button.component.ts +++ b/packages/geo/src/lib/search/search-results/search-results-add-button.component.ts @@ -322,7 +322,7 @@ export class SearchResultAddButtonComponent implements OnInit, OnDestroy{ map: this.map }); - const style = [ + const styles = [ new Style({ image: new Circle({ radius: 5, @@ -377,9 +377,7 @@ export class SearchResultAddButtonComponent implements OnInit, OnDestroy{ } } }, - style: function(feature) { - return style; - }, + style: styles, showInLayerList: true, exportable: true, workspace: {