Skip to content

Commit

Permalink
feat(geo): add style and change color in feature store (#1228)
Browse files Browse the repository at this point in the history
* fear(geo): add style and change color in feature store

* add polygone style and color

* refactor(search-add-button): direct style instead of a stylefunction

---------

Co-authored-by: Pierre-Étienne Lord <pierre-etienne.lord@transports.gouv.qc.ca>
  • Loading branch information
aziz-access and pelord authored May 1, 2023
1 parent eafbd0c commit ce14056
Showing 1 changed file with 29 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -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';
Expand Down Expand Up @@ -319,11 +323,34 @@ export class SearchResultAddButtonComponent implements OnInit, OnDestroy{
}

createLayer(layerTitle: string, selectedFeature: SearchResult) {

const activeStore: FeatureStore<Feature> = new FeatureStore<Feature>([], {
map: this.map
});

const styles = [
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)'
})
})
}),
new Style({
stroke: new Stroke({
width: 1,
color: 'rgba(143,7,7,1)'
}),
fill: new Fill({
color: 'rgba(0, 0, 255, 0.1)',
}),
})
];

// set layer id
let layerCounterID: number = 0;
for (const layer of this.allLayers) {
Expand Down Expand Up @@ -355,6 +382,7 @@ export class SearchResultAddButtonComponent implements OnInit, OnDestroy{
}
}
},
style: styles,
showInLayerList: true,
exportable: true,
workspace: {
Expand Down

0 comments on commit ce14056

Please sign in to comment.