Add area and croptype to feature-list-feature-cropfield
All checks were successful
FarmMaps.Develop/FarmMapsLib/develop This commit looks good
All checks were successful
FarmMaps.Develop/FarmMapsLib/develop This commit looks good
This commit is contained in:
parent
f8c3a0db98
commit
d3b10d46ad
@ -1,6 +1,7 @@
|
|||||||
<div *ngIf="feature;let feature" class="row m-0">
|
<div *ngIf="feature;let feature" class="row m-0">
|
||||||
<div class="col p-2">
|
<div class="col p-2">
|
||||||
<h1 class="card-title" title="{{feature.get('name')}}">{{feature.get('name')}}</h1>
|
<h1 class="card-title" title="{{feature.get('name')}}">{{feature.get('name')}}</h1>
|
||||||
<div class="card-text"><span>{{feature.get('datadate')|date}}</span> - <span>{{feature.get('dataenddate')|date}}</span> </div>
|
<div class="card-text"><span>{{areaInHa(feature)| number:'1.2-2'}} ha</span> <span>{{feature.get('cropTypeName')}}</span> </div>
|
||||||
</div>
|
<div class="card-text"><span>{{feature.get('datadate')|date}}</span> - <span>{{feature.get('dataenddate')|date}}</span> </div>
|
||||||
</div>
|
</div>
|
||||||
|
</div>
|
||||||
|
@ -1,22 +1,30 @@
|
|||||||
import { Component, Input, Injectable} from '@angular/core';
|
import { Component, Input, Injectable} from '@angular/core';
|
||||||
import { Feature } from 'ol';
|
import { Feature } from 'ol';
|
||||||
import { Store } from '@ngrx/store';
|
import { Store } from '@ngrx/store';
|
||||||
import * as mapReducers from '../../reducers/map.reducer';
|
import * as mapReducers from '../../reducers/map.reducer';
|
||||||
import { commonReducers,ItemTypeService,AppConfig } from '@farmmaps/common';
|
import { commonReducers,ItemTypeService,AppConfig } from '@farmmaps/common';
|
||||||
import { AbstractFeatureListFeatureComponent } from '../feature-list-feature/feature-list-feature.component';
|
import { AbstractFeatureListFeatureComponent } from '../feature-list-feature/feature-list-feature.component';
|
||||||
import { ForItemType } from '../for-item/for-itemtype.decorator';
|
import { ForItemType } from '../for-item/for-itemtype.decorator';
|
||||||
|
|
||||||
|
|
||||||
@ForItemType("vnd.farmmaps.itemtype.cropfield")
|
@ForItemType("vnd.farmmaps.itemtype.cropfield")
|
||||||
@Injectable()
|
@Injectable()
|
||||||
@Component({
|
@Component({
|
||||||
selector: 'fm-map-feature-list-feature-cropfield',
|
selector: 'fm-map-feature-list-feature-cropfield',
|
||||||
templateUrl: './feature-list-feature-cropfield.component.html',
|
templateUrl: './feature-list-feature-cropfield.component.html',
|
||||||
styleUrls: ['./feature-list-feature-cropfield.component.scss']
|
styleUrls: ['./feature-list-feature-cropfield.component.scss']
|
||||||
})
|
})
|
||||||
export class FeatureListFeatureCropfieldComponent extends AbstractFeatureListFeatureComponent {
|
export class FeatureListFeatureCropfieldComponent extends AbstractFeatureListFeatureComponent {
|
||||||
|
|
||||||
constructor(store: Store<mapReducers.State | commonReducers.State>, itemTypeService: ItemTypeService,config:AppConfig) {
|
constructor(store: Store<mapReducers.State | commonReducers.State>, itemTypeService: ItemTypeService,config:AppConfig) {
|
||||||
super(store, itemTypeService,config);
|
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);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user