FarmMapsLib/projects/common-map/src/fm-map/components/feature-list-croppingscheme/feature-list-croppingscheme...

31 lines
1.4 KiB
TypeScript

import { Location } from '@angular/common';
import { Component, Injectable } from '@angular/core';
import { ItemTypeService, commonReducers } from '@farmmaps/common';
import { Action, Store } from '@ngrx/store';
import { Feature } from 'ol';
import { Geometry } from 'ol/geom';
import { tassign } from 'tassign';
import * as mapActions from '../../actions/map.actions';
import * as mapReducers from '../../reducers/map.reducer';
import { AbstractFeatureListComponent } from '../feature-list/feature-list.component';
import { ForItemType } from '../for-item/for-itemtype.decorator';
@ForItemType("vnd.farmmaps.itemtype.croppingscheme")
@Injectable()
@Component({
selector: 'fm-map-feature-list-croppingscheme',
templateUrl: './feature-list-croppingscheme.component.html',
styleUrls: ['./feature-list-croppingscheme.component.scss']
})
export class FeatureListCroppingschemeComponent extends AbstractFeatureListComponent {
constructor(store: Store<mapReducers.State | commonReducers.State>, itemTypeService: ItemTypeService, location: Location) {
super(store, itemTypeService, location);
}
getAction(feature:Feature<Geometry>):Action {
const queryState = tassign(mapReducers.initialState.queryState, { parentCode: feature.get('code'), itemType: "vnd.farmmaps.itemtype.cropfield" });
return new mapActions.DoQuery(queryState);
}
}