Refactoring types
This commit is contained in:
@@ -1,6 +1,7 @@
|
||||
import { Component, Input, Injectable,Directive,SimpleChanges } from '@angular/core';
|
||||
import { Location } from '@angular/common';
|
||||
import { Feature } from 'ol';
|
||||
import { Geometry} from 'ol/geom';
|
||||
import { Store,Action} from '@ngrx/store';
|
||||
import * as mapReducers from '../../reducers/map.reducer';
|
||||
import { commonReducers,ItemTypeService, IItem, Item } from '@farmmaps/common';
|
||||
@@ -14,20 +15,20 @@ import { IQueryState } from '@farmmaps/common';
|
||||
@Injectable()
|
||||
@Directive()
|
||||
export abstract class AbstractFeatureListComponent {
|
||||
@Input() features: Array<Feature>;
|
||||
@Input() features: Array<Feature<Geometry>>;
|
||||
@Input() queryState: IQueryState;
|
||||
@Input() selectedFeature: Feature;
|
||||
@Input() selectedFeature: Feature<Geometry>;
|
||||
constructor(public store: Store<mapReducers.State | commonReducers.State>, public itemTypeService: ItemTypeService, private location: Location) {
|
||||
}
|
||||
|
||||
handleFeatureClick(feature:Feature) {
|
||||
handleFeatureClick(feature:Feature<Geometry>) {
|
||||
if(feature) {
|
||||
let action = this.getAction(feature);
|
||||
this.store.dispatch(action);
|
||||
}
|
||||
}
|
||||
|
||||
getAction(feature:Feature):Action {
|
||||
getAction(feature:Feature<Geometry>):Action {
|
||||
var newQuery: any = tassign(mapReducers.initialState.queryState);
|
||||
newQuery.parentCode = feature.get('parentCode');
|
||||
newQuery.itemCode = feature.get('code');
|
||||
@@ -48,7 +49,7 @@ export abstract class AbstractFeatureListComponent {
|
||||
this.location.back();
|
||||
}
|
||||
|
||||
isFeatureSelected(feature:Feature):boolean {
|
||||
isFeatureSelected(feature:Feature<Geometry>):boolean {
|
||||
if(!this.selectedFeature) return false;
|
||||
return feature.getId() == this.selectedFeature.getId();
|
||||
}
|
||||
|
Reference in New Issue
Block a user