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

32 lines
1.4 KiB
TypeScript
Raw Normal View History

2020-04-16 11:19:06 +00:00
import { Component, Injectable } from '@angular/core';
import { Location } from '@angular/common';
import { AbstractFeatureListComponent } from '../feature-list/feature-list.component';
import { ForItemType } from '../for-item/for-itemtype.decorator';
2020-04-16 13:47:15 +00:00
import { Store,Action } from '@ngrx/store';
2020-04-16 11:19:06 +00:00
import * as mapReducers from '../../reducers/map.reducer';
import { commonReducers, ItemTypeService } from '@farmmaps/common';
import * as mapActions from '../../actions/map.actions';
import { tassign } from 'tassign';
import { Router } from '@angular/router';
2020-04-16 13:47:15 +00:00
import { Feature } from 'ol';
2021-10-05 11:46:10 +00:00
import { Geometry} from 'ol/geom';
2020-04-16 11:19:06 +00:00
@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, private router: Router) {
super(store, itemTypeService, location);
}
2021-10-05 11:46:10 +00:00
getAction(feature:Feature<Geometry>):Action {
2023-03-06 13:04:14 +00:00
const queryState = tassign(mapReducers.initialState.queryState, { parentCode: feature.get('code'), itemType: "vnd.farmmaps.itemtype.cropfield" });
2020-04-16 13:47:15 +00:00
return new mapActions.DoQuery(queryState);
2020-04-16 11:19:06 +00:00
}
}