AW-3101 vnd.farmmaps.itemtype.shape.processed download as shape (zip)
This commit is contained in:
parent
f039898c26
commit
2e55b5a70e
@ -1,8 +1,9 @@
|
|||||||
import { Location } from '@angular/common';
|
import { Location } from '@angular/common';
|
||||||
import { Component, Injectable } from '@angular/core';
|
import { Component, Injectable, OnDestroy } from '@angular/core';
|
||||||
import { Router } from '@angular/router';
|
import { Router } from '@angular/router';
|
||||||
import { commonReducers, FolderService, IItem, IItemLinkType, ItemService, ItemTypeService, IUrlType } from '@farmmaps/common';
|
import { commonReducers, FolderService, IItem, IItemLinkType, ItemService, ItemTypeService, IUrlType } from '@farmmaps/common';
|
||||||
import { Store } from '@ngrx/store';
|
import { Store } from '@ngrx/store';
|
||||||
|
import { Subscription } from 'rxjs';
|
||||||
import * as mapActions from '../../actions/map.actions';
|
import * as mapActions from '../../actions/map.actions';
|
||||||
import * as mapReducers from '../../reducers/map.reducer';
|
import * as mapReducers from '../../reducers/map.reducer';
|
||||||
import { ForItemType } from '../for-item/for-itemtype.decorator';
|
import { ForItemType } from '../for-item/for-itemtype.decorator';
|
||||||
@ -16,12 +17,17 @@ import { AbstractSelectedItemComponent } from '../selected-item/selected-item.co
|
|||||||
templateUrl: './selected-item-geotiff.component.html',
|
templateUrl: './selected-item-geotiff.component.html',
|
||||||
styleUrls: ['./selected-item-geotiff.component.scss']
|
styleUrls: ['./selected-item-geotiff.component.scss']
|
||||||
})
|
})
|
||||||
export class SelectedItemGeotiffComponent extends AbstractSelectedItemComponent {
|
export class SelectedItemGeotiffComponent extends AbstractSelectedItemComponent implements OnDestroy {
|
||||||
|
sub: Subscription;
|
||||||
|
|
||||||
constructor(store: Store<mapReducers.State | commonReducers.State>, public itemService: ItemService, itemTypeService: ItemTypeService, location: Location, router: Router, private itemService$: ItemService,private folderService$: FolderService) {
|
constructor(store: Store<mapReducers.State | commonReducers.State>, public itemService: ItemService, itemTypeService: ItemTypeService, location: Location, router: Router, private itemService$: ItemService,private folderService$: FolderService) {
|
||||||
super(store, itemTypeService,location,router);
|
super(store, itemTypeService,location,router);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
ngOnDestroy(): void {
|
||||||
|
if (this.sub) this.sub.unsubscribe();
|
||||||
|
}
|
||||||
|
|
||||||
onLayerChanged(layerIndex: number) {
|
onLayerChanged(layerIndex: number) {
|
||||||
this.store.dispatch(new mapActions.SetLayerIndex(layerIndex));
|
this.store.dispatch(new mapActions.SetLayerIndex(layerIndex));
|
||||||
}
|
}
|
||||||
@ -34,7 +40,7 @@ export class SelectedItemGeotiffComponent extends AbstractSelectedItemComponent
|
|||||||
event.stopPropagation();
|
event.stopPropagation();
|
||||||
event.preventDefault();
|
event.preventDefault();
|
||||||
const itemLink : IItemLinkType = {itemcode:item.code,query:`layer=${this.layer(layers,layerIndex).name}`,pathsuffix:"download", validminutes:10}
|
const itemLink : IItemLinkType = {itemcode:item.code,query:`layer=${this.layer(layers,layerIndex).name}`,pathsuffix:"download", validminutes:10}
|
||||||
const foo = this.itemService.getItemLink(itemLink).subscribe((itemLinkUrl:IUrlType) => {
|
this.sub = this.itemService.getItemLink(itemLink).subscribe((itemLinkUrl:IUrlType) => {
|
||||||
window.location.href = itemLinkUrl.url;
|
window.location.href = itemLinkUrl.url;
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
@ -7,25 +7,28 @@
|
|||||||
<h2 *ngIf="parentOfItemType('vnd.farmmaps.itemtype.cropfield')">{{parentItem.name}}</h2>
|
<h2 *ngIf="parentOfItemType('vnd.farmmaps.itemtype.cropfield')">{{parentItem.name}}</h2>
|
||||||
<h1>{{item.name}}</h1>
|
<h1>{{item.name}}</h1>
|
||||||
</div>
|
</div>
|
||||||
<div class="legend-container" *ngIf="item?.data.layers;let layers">
|
<ng-container *ngIf="item?.data.layers;let layers">
|
||||||
<div class="card menu-card">
|
<div class="legend-container">
|
||||||
<div *ngIf="layers.length>1">
|
<div class="card menu-card">
|
||||||
<select (change)="onLayerChanged($event.target.value)">
|
<div *ngIf="layers.length>1">
|
||||||
<option *ngFor="let l of layers;" [value]="l.index" [selected]="itemLayer.layerIndex == l.index">{{l.name}}</option>
|
<select (change)="onLayerChanged($event.target.value)">
|
||||||
</select>
|
<option *ngFor="let l of layers;" [value]="l.index" [selected]="itemLayer.layerIndex == l.index">{{l.name}}</option>
|
||||||
|
</select>
|
||||||
|
</div>
|
||||||
|
<fm-map-layer-legend [showTitle]="layers.length==1" [layer]="layer(layers,itemLayer.layerIndex)" [histogramenabled]="true"></fm-map-layer-legend>
|
||||||
</div>
|
</div>
|
||||||
<fm-map-layer-legend [showTitle]="layers.length==1" [layer]="layer(layers,itemLayer.layerIndex)" [histogramenabled]="true"></fm-map-layer-legend>
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
<div class="card menu-card">
|
||||||
<div class="card menu-card">
|
<ul class="p-0 mt-2">
|
||||||
<ul class="p-0 mt-2">
|
<li *ngIf="item.isEditable"><a href="#" class="mt-1 me-1" (click)="handleOnEdit(item)" ><i class="fal fa-pencil" aria-hidden="true" i18n-title title="Edit"></i> <span i18n>Edit</span></a></li>
|
||||||
<li *ngIf="item.isEditable"><a href="#" class="mt-1 me-1" (click)="handleOnEdit(item)" ><i class="fal fa-pencil" aria-hidden="true" i18n-title title="Edit"></i> <span i18n>Edit</span></a></li>
|
<ng-container *ngIf="itemTypeService.isLayer(item)">
|
||||||
<ng-container *ngIf="itemTypeService.isLayer(item)">
|
<li *ngIf="!getItemLayer(item,itemLayer.layerIndex)"><a href="#" (click)="handleAddAsLayer(item,itemLayer.layerIndex)" ><i class="fas fa-layer-olus" aria-hidden="true" i18n-title title="Add as layer"></i> <span i18n>Add as overlay</span></a></li>
|
||||||
<li *ngIf="!getItemLayer(item,itemLayer.layerIndex)"><a href="#" (click)="handleAddAsLayer(item,itemLayer.layerIndex)" ><i class="fas fa-layer-olus" aria-hidden="true" i18n-title title="Add as layer"></i> <span i18n>Add as overlay</span></a></li>
|
<li *ngIf="getItemLayer(item,itemLayer.layerIndex)"><a href="#" (click)="handleRemoveLayer(item,itemLayer.layerIndex)" ><i class="fas fa-layer-minus" aria-hidden="true" i18n-title title="Remove overlay"></i> <span i18n>Remove overlay</span></a></li>
|
||||||
<li *ngIf="getItemLayer(item,itemLayer.layerIndex)"><a href="#" (click)="handleRemoveLayer(item,itemLayer.layerIndex)" ><i class="fas fa-layer-minus" aria-hidden="true" i18n-title title="Remove overlay"></i> <span i18n>Remove overlay</span></a></li>
|
</ng-container>
|
||||||
</ng-container>
|
<li><a href="#" (click)="download($event,item,layers,itemLayer.layerIndex)"><i class="fal fa-download" aria-hidden="true" i18n-title title="Download"></i> <span i18n>Download</span></a></li>
|
||||||
</ul>
|
</ul>
|
||||||
</div>
|
</div>
|
||||||
|
</ng-container>
|
||||||
<fm-map-zoom-to-show-alert [layer]="itemLayer?.layer"></fm-map-zoom-to-show-alert>
|
<fm-map-zoom-to-show-alert [layer]="itemLayer?.layer"></fm-map-zoom-to-show-alert>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
@ -1,14 +1,13 @@
|
|||||||
import { Component, Input, Injectable, OnInit } from '@angular/core';
|
|
||||||
import { Location } from '@angular/common';
|
import { Location } from '@angular/common';
|
||||||
import { Feature } from 'ol';
|
import { Component, Injectable, OnDestroy } from '@angular/core';
|
||||||
|
import { Router } from '@angular/router';
|
||||||
|
import { commonReducers, FolderService, IItem, IItemLinkType, ItemService, ItemTypeService, IUrlType } from '@farmmaps/common';
|
||||||
import { Store } from '@ngrx/store';
|
import { Store } from '@ngrx/store';
|
||||||
import * as mapReducers from '../../reducers/map.reducer';
|
|
||||||
import { commonReducers, ItemTypeService, IItem, Item, ItemService, FolderService, IListItem} from '@farmmaps/common';
|
|
||||||
import * as mapActions from '../../actions/map.actions';
|
import * as mapActions from '../../actions/map.actions';
|
||||||
import { Router, ActivatedRoute, ParamMap, Event } from '@angular/router';
|
import * as mapReducers from '../../reducers/map.reducer';
|
||||||
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 { Subscription } from 'rxjs';
|
||||||
|
|
||||||
|
|
||||||
@ForItemType("vnd.farmmaps.itemtype.shape.processed")
|
@ForItemType("vnd.farmmaps.itemtype.shape.processed")
|
||||||
@ -18,12 +17,17 @@ import { Observable } from 'rxjs';
|
|||||||
templateUrl: './selected-item-shape.component.html',
|
templateUrl: './selected-item-shape.component.html',
|
||||||
styleUrls: ['./selected-item-shape.component.scss']
|
styleUrls: ['./selected-item-shape.component.scss']
|
||||||
})
|
})
|
||||||
export class SelectedItemShapeComponent extends AbstractSelectedItemComponent {
|
export class SelectedItemShapeComponent extends AbstractSelectedItemComponent implements OnDestroy {
|
||||||
|
public selectedLayer = 0;
|
||||||
|
sub: Subscription;
|
||||||
|
|
||||||
constructor(store: Store<mapReducers.State | commonReducers.State>, itemTypeService: ItemTypeService, location: Location, router: Router, private itemService$: ItemService,private folderService$: FolderService) {
|
constructor(store: Store<mapReducers.State | commonReducers.State>, public itemService: ItemService, itemTypeService: ItemTypeService, location: Location, router: Router, private itemService$: ItemService,private folderService$: FolderService) {
|
||||||
super(store, itemTypeService,location,router);
|
super(store, itemTypeService,location,router);
|
||||||
}
|
}
|
||||||
public selectedLayer = 0;
|
|
||||||
|
ngOnDestroy(): void {
|
||||||
|
if (this.sub) this.sub.unsubscribe();
|
||||||
|
}
|
||||||
|
|
||||||
onLayerChanged(layerIndex: number) {
|
onLayerChanged(layerIndex: number) {
|
||||||
this.store.dispatch(new mapActions.SetLayerIndex(layerIndex));
|
this.store.dispatch(new mapActions.SetLayerIndex(layerIndex));
|
||||||
@ -32,4 +36,13 @@ export class SelectedItemShapeComponent extends AbstractSelectedItemComponent {
|
|||||||
layer(layers:any,layerIndex:number) {
|
layer(layers:any,layerIndex:number) {
|
||||||
return layers.find(l => l.index == layerIndex);
|
return layers.find(l => l.index == layerIndex);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
download(event:MouseEvent,item:IItem,layers:any,layerIndex:number) {
|
||||||
|
event.stopPropagation();
|
||||||
|
event.preventDefault();
|
||||||
|
const itemLink : IItemLinkType = {itemcode:item.code,query:`layer=${this.layer(layers,layerIndex).name}`,pathsuffix:"download", validminutes:10}
|
||||||
|
this.sub = this.itemService.getItemLink(itemLink).subscribe((itemLinkUrl:IUrlType) => {
|
||||||
|
window.location.href = itemLinkUrl.url;
|
||||||
|
})
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,15 +1,15 @@
|
|||||||
import { Component, Injectable } from '@angular/core';
|
|
||||||
import { Location } from '@angular/common';
|
import { Location } from '@angular/common';
|
||||||
import { Store } from '@ngrx/store';
|
import { Component, Injectable, OnDestroy } from '@angular/core';
|
||||||
import * as mapReducers from '../../reducers/map.reducer';
|
|
||||||
import { commonReducers, ItemTypeService, IItem, ItemService, IItemLinkType, IUrlType } from '@farmmaps/common';
|
|
||||||
import { Router } from '@angular/router';
|
import { Router } from '@angular/router';
|
||||||
|
import { commonReducers, IItem, IItemLinkType, ItemService, ItemTypeService, IUrlType } from '@farmmaps/common';
|
||||||
|
import { Store } from '@ngrx/store';
|
||||||
|
import { Subscription } from 'rxjs';
|
||||||
|
import * as mapActions from '../../actions/map.actions';
|
||||||
|
import { IItemLayer, ITemporalItemLayer } from '../../models/item.layer';
|
||||||
|
import * as mapReducers from '../../reducers/map.reducer';
|
||||||
|
import { TemporalService } from '../../services/temporal.service';
|
||||||
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 { ITemporalItemLayer} from '../../models/item.layer';
|
|
||||||
import * as mapActions from '../../actions/map.actions';
|
|
||||||
import { IItemLayer } from '../../models/item.layer';
|
|
||||||
import {TemporalService} from '../../services/temporal.service';
|
|
||||||
|
|
||||||
@ForItemType("vnd.farmmaps.itemtype.temporal")
|
@ForItemType("vnd.farmmaps.itemtype.temporal")
|
||||||
@Injectable()
|
@Injectable()
|
||||||
@ -18,12 +18,17 @@ import {TemporalService} from '../../services/temporal.service';
|
|||||||
templateUrl: './selected-item-temporal.component.html',
|
templateUrl: './selected-item-temporal.component.html',
|
||||||
styleUrls: ['./selected-item-temporal.component.scss']
|
styleUrls: ['./selected-item-temporal.component.scss']
|
||||||
})
|
})
|
||||||
export class SelectedItemTemporalComponent extends AbstractSelectedItemComponent {
|
export class SelectedItemTemporalComponent extends AbstractSelectedItemComponent implements OnDestroy {
|
||||||
|
sub: Subscription;
|
||||||
|
|
||||||
constructor(store: Store<mapReducers.State | commonReducers.State>, public itemService: ItemService, itemTypeService: ItemTypeService, location: Location, router: Router,public temporalService:TemporalService) {
|
constructor(store: Store<mapReducers.State | commonReducers.State>, public itemService: ItemService, itemTypeService: ItemTypeService, location: Location, router: Router,public temporalService:TemporalService) {
|
||||||
super(store, itemTypeService,location,router);
|
super(store, itemTypeService,location,router);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
ngOnDestroy(): void {
|
||||||
|
if (this.sub) this.sub.unsubscribe();
|
||||||
|
}
|
||||||
|
|
||||||
onLayerChanged(layerIndex: number) {
|
onLayerChanged(layerIndex: number) {
|
||||||
this.store.dispatch(new mapActions.SetLayerIndex(layerIndex));
|
this.store.dispatch(new mapActions.SetLayerIndex(layerIndex));
|
||||||
}
|
}
|
||||||
@ -32,8 +37,6 @@ export class SelectedItemTemporalComponent extends AbstractSelectedItemComponent
|
|||||||
return (this.itemLayer as ITemporalItemLayer)?.selectedItemLayer
|
return (this.itemLayer as ITemporalItemLayer)?.selectedItemLayer
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
handleNextTemporal(event:MouseEvent) {
|
handleNextTemporal(event:MouseEvent) {
|
||||||
this.store.dispatch(new mapActions.NextTemporal());
|
this.store.dispatch(new mapActions.NextTemporal());
|
||||||
event.preventDefault();
|
event.preventDefault();
|
||||||
@ -65,7 +68,7 @@ export class SelectedItemTemporalComponent extends AbstractSelectedItemComponent
|
|||||||
event.stopPropagation();
|
event.stopPropagation();
|
||||||
event.preventDefault();
|
event.preventDefault();
|
||||||
const itemLink : IItemLinkType = {itemcode:item.code,query:`layer=${this.layer(layers,layerIndex).name}`,pathsuffix:"download", validminutes:10}
|
const itemLink : IItemLinkType = {itemcode:item.code,query:`layer=${this.layer(layers,layerIndex).name}`,pathsuffix:"download", validminutes:10}
|
||||||
const foo = this.itemService.getItemLink(itemLink).subscribe((itemLinkUrl:IUrlType) => {
|
this.sub = this.itemService.getItemLink(itemLink).subscribe((itemLinkUrl:IUrlType) => {
|
||||||
window.location.href = itemLinkUrl.url;
|
window.location.href = itemLinkUrl.url;
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user