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 {
|
export class SetStyle implements Action {
|
||||||
readonly type = SETSTYLE;
|
readonly type = SETSTYLE;
|
||||||
|
|
||||||
constructor(public itemType:string,public style:Style) { }
|
constructor(public itemType:string,public style: Style | (Feature)) { }
|
||||||
}
|
}
|
||||||
|
|
||||||
export type Actions = SetMapState
|
export type Actions = SetMapState
|
||||||
|
@ -120,8 +120,17 @@ export class ItemVectorSourceComponent extends SourceVectorComponent implements
|
|||||||
key = 'file';
|
key = 'file';
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
let evaluatedStyle =null;
|
||||||
var styleEntry = this.stylesCache[key];
|
var styleEntry = this.stylesCache[key];
|
||||||
return styleEntry;
|
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;
|
let styles = changes["styles"].currentValue;
|
||||||
for (const key in styles) {
|
for (const key in styles) {
|
||||||
if (styles.hasOwnProperty(key)) {
|
if (styles.hasOwnProperty(key)) {
|
||||||
let style = styles[key];
|
this.stylesCache[key]=styles[key];
|
||||||
if(style.geometry_ == null) {
|
|
||||||
style.setGeometry((feature) => this.geometry(feature));
|
|
||||||
}
|
|
||||||
this.stylesCache[key]=style;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
import {Style} from 'ol';
|
import {Style,Feature} from 'ol';
|
||||||
|
|
||||||
export interface IStyles{
|
export interface IStyles{
|
||||||
[id: string]: Style;
|
[id: string]: Style | (Feature);
|
||||||
};
|
};
|
Loading…
Reference in New Issue
Block a user