Compare commits
No commits in common. "6916e4650aca9aadd5fe38e843ac1a99d4305be1" and "9c103a0c40bd33c0f27453efe6bf67595a597009" have entirely different histories.
6916e4650a
...
9c103a0c40
@ -5,7 +5,6 @@ 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';
|
||||||
import {getArea} from 'ol/sphere';
|
|
||||||
|
|
||||||
|
|
||||||
@ForItemType("vnd.farmmaps.itemtype.cropfield")
|
@ForItemType("vnd.farmmaps.itemtype.cropfield")
|
||||||
@ -26,6 +25,6 @@ export class FeatureListFeatureCropfieldComponent extends AbstractFeatureListFea
|
|||||||
// get area from faeture if 0 calculate from polygon
|
// get area from faeture if 0 calculate from polygon
|
||||||
let a = feature.get('area');
|
let a = feature.get('area');
|
||||||
if(a) return a;
|
if(a) return a;
|
||||||
return getArea(feature.getGeometry(),{projectio:"EPSG:3857"}) / 10000;
|
return (feature.getGeometry().getArea() / 10000);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -6,8 +6,8 @@
|
|||||||
<div class="card menu-card">
|
<div class="card menu-card">
|
||||||
<h1>Cropfield</h1>
|
<h1>Cropfield</h1>
|
||||||
<h4>{{item.name}}</h4>
|
<h4>{{item.name}}</h4>
|
||||||
<div class="card-text"><span>{{areaInHa(item)| number:'1.2-2'}} ha</span> <span>{{item.data.cropTypeName}}</span></div>
|
<div>{{item.data.cropTypeName}}</div>
|
||||||
<div class="card-text"><span>{{item.data.startDate|date}}</span> - <span>{{item.data.endDate|date}}</span> </div>
|
<div><span>{{item.data.startDate|date}}</span> - <span>{{item.data.endDate|date}}</span> </div>
|
||||||
<ul class="p-0 mt-2">
|
<ul class="p-0 mt-2">
|
||||||
<li *ngIf="item.isEditable"><a href="#" (click)="handleOnEdit(item)" i18n><i class="fa fa-pencil" aria-hidden="true" title="Edit"></i> Edit</a></li>
|
<li *ngIf="item.isEditable"><a href="#" (click)="handleOnEdit(item)" i18n><i class="fa fa-pencil" aria-hidden="true" title="Edit"></i> Edit</a></li>
|
||||||
</ul>
|
</ul>
|
||||||
|
@ -1,43 +1,30 @@
|
|||||||
import { Component, Input, Injectable, OnInit } from '@angular/core';
|
import { Component, Input, Injectable, OnInit } from '@angular/core';
|
||||||
import { Location } from '@angular/common';
|
import { Location } from '@angular/common';
|
||||||
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, IItem, Item, ItemService, FolderService, IListItem} from '@farmmaps/common';
|
import { commonReducers, ItemTypeService, IItem, Item, ItemService, FolderService, IListItem} from '@farmmaps/common';
|
||||||
import { Router, ActivatedRoute, ParamMap, Event } from '@angular/router';
|
import { Router, ActivatedRoute, ParamMap, Event } from '@angular/router';
|
||||||
import { ForItemType } from '../for-item/for-itemtype.decorator';
|
import { ForItemType } from '../for-item/for-itemtype.decorator';
|
||||||
import { AbstractSelectedItemComponent } from '../selected-item/selected-item.component';
|
import { AbstractSelectedItemComponent } from '../selected-item/selected-item.component';
|
||||||
import { Observable } from 'rxjs';
|
import { Observable } from 'rxjs';
|
||||||
import {GeoJSON} from 'ol/format';
|
|
||||||
import {getArea} from 'ol/sphere';
|
|
||||||
|
@ForItemType("vnd.farmmaps.itemtype.cropfield")
|
||||||
|
@Injectable()
|
||||||
@ForItemType("vnd.farmmaps.itemtype.cropfield")
|
@Component({
|
||||||
@Injectable()
|
selector: 'fm-map-selected-item-cropfield',
|
||||||
@Component({
|
templateUrl: './selected-item-cropfield.component.html',
|
||||||
selector: 'fm-map-selected-item-cropfield',
|
styleUrls: ['./selected-item-cropfield.component.scss']
|
||||||
templateUrl: './selected-item-cropfield.component.html',
|
})
|
||||||
styleUrls: ['./selected-item-cropfield.component.scss']
|
export class SelectedItemCropfieldComponent extends AbstractSelectedItemComponent implements OnInit{
|
||||||
})
|
|
||||||
export class SelectedItemCropfieldComponent extends AbstractSelectedItemComponent implements OnInit{
|
public items: Observable<IListItem[]>;
|
||||||
|
|
||||||
public items: Observable<IListItem[]>;
|
constructor(store: Store<mapReducers.State | commonReducers.State>, itemTypeService: ItemTypeService, location: Location, router: Router, private itemService$: ItemService,private folderService$: FolderService) {
|
||||||
|
super(store, itemTypeService,location,router);
|
||||||
constructor(store: Store<mapReducers.State | commonReducers.State>, itemTypeService: ItemTypeService, location: Location, router: Router, private itemService$: ItemService,private folderService$: FolderService) {
|
}
|
||||||
super(store, itemTypeService,location,router);
|
ngOnInit() {
|
||||||
}
|
this.items = this.folderService$.getItems(this.item.code, 0, 1000);
|
||||||
|
}
|
||||||
areaInHa(item:IItem):number {
|
}
|
||||||
if(!item) return 0;
|
|
||||||
// get area from faeture if 0 calculate from polygon
|
|
||||||
let a = item.data.area;
|
|
||||||
if(a) return a;
|
|
||||||
let format = new GeoJSON();
|
|
||||||
let polygon = format.readGeometry(item.geometry);
|
|
||||||
return getArea(polygon,{projection:"EPSG:4326"}) / 10000;
|
|
||||||
}
|
|
||||||
|
|
||||||
ngOnInit() {
|
|
||||||
this. items = this.folderService$.getItems(this.item.code, 0, 1000);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
Loading…
Reference in New Issue
Block a user