Make itemtypes public
All checks were successful
FarmMaps.Develop/FarmMapsLib/develop This commit looks good

This commit is contained in:
Willem Dantuma 2019-08-08 14:12:51 +02:00
parent ec9bd4b974
commit 4ec7a9a982

View File

@ -6,30 +6,34 @@ import {IItem} from '../models/item'
@Injectable() @Injectable()
export class ItemTypeService { export class ItemTypeService {
private _itemTypes: IItemTypes; public itemTypes: IItemTypes;
constructor(private store: Store<appCommonReducer.State> ) { constructor(private store: Store<appCommonReducer.State> ) {
this.store.select(appCommonReducer.selectGetItemTypes).subscribe((itemTypes) => { this.store.select(appCommonReducer.selectGetItemTypes).subscribe((itemTypes) => {
this._itemTypes = itemTypes; this.itemTypes = itemTypes;
}); });
} }
getIcon(itemType: string) { getIcon(itemType: string) {
var icon = "fa-file-o"; var icon = "fa-file-o";
if (this._itemTypes[itemType]) icon = this._itemTypes[itemType].icon; if (this.itemTypes[itemType]) icon = this.itemTypes[itemType].icon;
return icon; return icon;
} }
getColor(itemType: string) { getColor(itemType: string) {
var color = "#000000"; var color = "#000000";
if (this._itemTypes[itemType]) color = this._itemTypes[itemType].iconColor; if (this.itemTypes[itemType]) color = this.itemTypes[itemType].iconColor;
return color; return color;
} }
hasViewer(item: IItem) { hasViewer(item: IItem) {
let itemType: string = item.itemType; let itemType: string = item.itemType;
if (this._itemTypes[itemType]) return this._itemTypes[itemType].viewer !== undefined; if (this.itemTypes[itemType]) return this.itemTypes[itemType].viewer !== undefined;
return false; return false;
} }
isLayer(item: IItem) {
let itemType: string = item.itemType;
return itemType == "vnd.farmmaps.itemtype.geotiff.processed" || itemType == "vnd.farmmaps.itemtype.layer" || itemType == "vnd.farmmaps.itemtype.shape.processed";
}
} }