Make itemtypes public
FarmMaps.Develop/FarmMapsLib/develop This commit looks good Details

pull/1/head
Willem Dantuma 2019-08-08 14:12:51 +02:00
parent ec9bd4b974
commit 4ec7a9a982
1 changed files with 10 additions and 6 deletions

View File

@ -6,30 +6,34 @@ import {IItem} from '../models/item'
@Injectable()
export class ItemTypeService {
private _itemTypes: IItemTypes;
public itemTypes: IItemTypes;
constructor(private store: Store<appCommonReducer.State> ) {
this.store.select(appCommonReducer.selectGetItemTypes).subscribe((itemTypes) => {
this._itemTypes = itemTypes;
this.itemTypes = itemTypes;
});
}
getIcon(itemType: string) {
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;
}
getColor(itemType: string) {
var color = "#000000";
if (this._itemTypes[itemType]) color = this._itemTypes[itemType].iconColor;
if (this.itemTypes[itemType]) color = this.itemTypes[itemType].iconColor;
return color;
}
hasViewer(item: IItem) {
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;
}
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";
}
}