Compare commits
2 Commits
4814b8fbad
...
79f45631a0
Author | SHA1 | Date | |
---|---|---|---|
|
79f45631a0 | ||
|
6060a8b86a |
@ -207,7 +207,7 @@ export class DoQuery implements Action {
|
||||
export class SetStyle implements Action {
|
||||
readonly type = SETSTYLE;
|
||||
|
||||
constructor(public itemType:string,public style:Style) { }
|
||||
constructor(public itemType:string,public style: Style | (Feature)) { }
|
||||
}
|
||||
|
||||
export type Actions = SetMapState
|
||||
|
@ -120,8 +120,17 @@ export class ItemVectorSourceComponent extends SourceVectorComponent implements
|
||||
key = 'file';
|
||||
}
|
||||
}
|
||||
var styleEntry = this.stylesCache[key];
|
||||
return styleEntry;
|
||||
let evaluatedStyle =null;
|
||||
var styleEntry = this.stylesCache[key];
|
||||
if(typeof styleEntry === 'function') {
|
||||
evaluatedStyle = styleEntry(feature);
|
||||
} else {
|
||||
evaluatedStyle = styleEntry;
|
||||
}
|
||||
if(evaluatedStyle.geometry_ == null) {
|
||||
evaluatedStyle.setGeometry((feature) => this.geometry(feature));
|
||||
}
|
||||
return evaluatedStyle;
|
||||
});
|
||||
}
|
||||
|
||||
@ -155,11 +164,7 @@ export class ItemVectorSourceComponent extends SourceVectorComponent implements
|
||||
let styles = changes["styles"].currentValue;
|
||||
for (const key in styles) {
|
||||
if (styles.hasOwnProperty(key)) {
|
||||
let style = styles[key];
|
||||
if(style.geometry_ == null) {
|
||||
style.setGeometry((feature) => this.geometry(feature));
|
||||
}
|
||||
this.stylesCache[key]=style;
|
||||
this.stylesCache[key]=styles[key];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1,5 +1,5 @@
|
||||
import {Style} from 'ol';
|
||||
import {Style,Feature} from 'ol';
|
||||
|
||||
export interface IStyles{
|
||||
[id: string]: Style;
|
||||
[id: string]: Style | (Feature);
|
||||
};
|
Loading…
Reference in New Issue
Block a user