Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(geo): add style and change color in feature store #1228

Merged
merged 3 commits into from
May 1, 2023
Merged
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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 @@ -314,11 +318,34 @@ export class SearchResultAddButtonComponent implements OnInit, OnDestroy{
}

createLayer(layerTitle: string, selectedFeature: SearchResult) {

const activeStore: FeatureStore<Feature> = new FeatureStore<Feature>([], {
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)'
})
})
}),
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 @@ -350,6 +377,9 @@ export class SearchResultAddButtonComponent implements OnInit, OnDestroy{
}
}
},
style: function(feature) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@aziz-access . Please, do not create a stylefunction unless you really need it. ==> style: style

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@aziz-access I've done the fix.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

thank you

return style;
},
showInLayerList: true,
exportable: true,
workspace: {
Expand Down