diff --git a/projects/common-map/src/fm-map/components/feature-list-feature-cropfield/feature-list-feature-cropfield.component.html b/projects/common-map/src/fm-map/components/feature-list-feature-cropfield/feature-list-feature-cropfield.component.html index 2892358..9788b8b 100644 --- a/projects/common-map/src/fm-map/components/feature-list-feature-cropfield/feature-list-feature-cropfield.component.html +++ b/projects/common-map/src/fm-map/components/feature-list-feature-cropfield/feature-list-feature-cropfield.component.html @@ -1,6 +1,7 @@ -
-
-

{{feature.get('name')}}

-
{{feature.get('datadate')|date}} - {{feature.get('dataenddate')|date}}
-
-
+
+
+

{{feature.get('name')}}

+
{{areaInHa(feature)| number:'1.2-2'}} ha {{feature.get('cropTypeName')}}
+
{{feature.get('datadate')|date}} - {{feature.get('dataenddate')|date}}
+
+
diff --git a/projects/common-map/src/fm-map/components/feature-list-feature-cropfield/feature-list-feature-cropfield.component.ts b/projects/common-map/src/fm-map/components/feature-list-feature-cropfield/feature-list-feature-cropfield.component.ts index 43169f6..0698217 100644 --- a/projects/common-map/src/fm-map/components/feature-list-feature-cropfield/feature-list-feature-cropfield.component.ts +++ b/projects/common-map/src/fm-map/components/feature-list-feature-cropfield/feature-list-feature-cropfield.component.ts @@ -1,22 +1,30 @@ -import { Component, Input, Injectable} from '@angular/core'; -import { Feature } from 'ol'; -import { Store } from '@ngrx/store'; -import * as mapReducers from '../../reducers/map.reducer'; -import { commonReducers,ItemTypeService,AppConfig } from '@farmmaps/common'; -import { AbstractFeatureListFeatureComponent } from '../feature-list-feature/feature-list-feature.component'; -import { ForItemType } from '../for-item/for-itemtype.decorator'; - - -@ForItemType("vnd.farmmaps.itemtype.cropfield") -@Injectable() -@Component({ - selector: 'fm-map-feature-list-feature-cropfield', - templateUrl: './feature-list-feature-cropfield.component.html', - styleUrls: ['./feature-list-feature-cropfield.component.scss'] -}) -export class FeatureListFeatureCropfieldComponent extends AbstractFeatureListFeatureComponent { - - constructor(store: Store, itemTypeService: ItemTypeService,config:AppConfig) { - super(store, itemTypeService,config); - } -} +import { Component, Input, Injectable} from '@angular/core'; +import { Feature } from 'ol'; +import { Store } from '@ngrx/store'; +import * as mapReducers from '../../reducers/map.reducer'; +import { commonReducers,ItemTypeService,AppConfig } from '@farmmaps/common'; +import { AbstractFeatureListFeatureComponent } from '../feature-list-feature/feature-list-feature.component'; +import { ForItemType } from '../for-item/for-itemtype.decorator'; + + +@ForItemType("vnd.farmmaps.itemtype.cropfield") +@Injectable() +@Component({ + selector: 'fm-map-feature-list-feature-cropfield', + templateUrl: './feature-list-feature-cropfield.component.html', + styleUrls: ['./feature-list-feature-cropfield.component.scss'] +}) +export class FeatureListFeatureCropfieldComponent extends AbstractFeatureListFeatureComponent { + + constructor(store: Store, itemTypeService: ItemTypeService,config:AppConfig) { + super(store, itemTypeService,config); + } + + areaInHa(feature:Feature):number { + if(!feature) return 0; + // get area from faeture if 0 calculate from polygon + let a = feature.get('area'); + if(a) return a; + return (feature.getGeometry().getArea() / 10000); + } +}