Compare commits

..

No commits in common. "79f45631a0ee4f30d83393104970e31467047de1" and "4814b8fbad5c07e91b626c5df7f1e0f68e6a70a2" have entirely different histories.

3 changed files with 10 additions and 15 deletions

View File

@ -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 | (Feature)) { } constructor(public itemType:string,public style:Style) { }
} }
export type Actions = SetMapState export type Actions = SetMapState

View File

@ -120,17 +120,8 @@ 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;
}); });
} }
@ -164,7 +155,11 @@ 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)) {
this.stylesCache[key]=styles[key]; let style = styles[key];
if(style.geometry_ == null) {
style.setGeometry((feature) => this.geometry(feature));
}
this.stylesCache[key]=style;
} }
} }
} }

View File

@ -1,5 +1,5 @@
import {Style,Feature} from 'ol'; import {Style} from 'ol';
export interface IStyles{ export interface IStyles{
[id: string]: Style | (Feature); [id: string]: Style;
}; };