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 { Component, Injectable } from '@angular/core';
|
||||
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 { Subscription } from 'rxjs';
|
||||
import * as mapActions from '../../actions/map.actions';
|
||||
import * as mapReducers from '../../reducers/map.reducer';
|
||||
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',
|
||||
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) {
|
||||
super(store, itemTypeService,location,router);
|
||||
}
|
||||
|
||||
ngOnDestroy(): void {
|
||||
if (this.sub) this.sub.unsubscribe();
|
||||
}
|
||||
|
||||
onLayerChanged(layerIndex: number) {
|
||||
this.store.dispatch(new mapActions.SetLayerIndex(layerIndex));
|
||||
}
|
||||
@ -34,7 +40,7 @@ export class SelectedItemGeotiffComponent extends AbstractSelectedItemComponent
|
||||
event.stopPropagation();
|
||||
event.preventDefault();
|
||||
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;
|
||||
})
|
||||
}
|
||||
|
@ -7,7 +7,8 @@
|
||||
<h2 *ngIf="parentOfItemType('vnd.farmmaps.itemtype.cropfield')">{{parentItem.name}}</h2>
|
||||
<h1>{{item.name}}</h1>
|
||||
</div>
|
||||
<div class="legend-container" *ngIf="item?.data.layers;let layers">
|
||||
<ng-container *ngIf="item?.data.layers;let layers">
|
||||
<div class="legend-container">
|
||||
<div class="card menu-card">
|
||||
<div *ngIf="layers.length>1">
|
||||
<select (change)="onLayerChanged($event.target.value)">
|
||||
@ -24,8 +25,10 @@
|
||||
<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>
|
||||
</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>
|
||||
</div>
|
||||
</ng-container>
|
||||
<fm-map-zoom-to-show-alert [layer]="itemLayer?.layer"></fm-map-zoom-to-show-alert>
|
||||
</div>
|
||||
</div>
|
||||
|
@ -1,14 +1,13 @@
|
||||
import { Component, Input, Injectable, OnInit } from '@angular/core';
|
||||
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 * 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 { Router, ActivatedRoute, ParamMap, Event } from '@angular/router';
|
||||
import * as mapReducers from '../../reducers/map.reducer';
|
||||
import { ForItemType } from '../for-item/for-itemtype.decorator';
|
||||
import { AbstractSelectedItemComponent } from '../selected-item/selected-item.component';
|
||||
import { Observable } from 'rxjs';
|
||||
import { Subscription } from 'rxjs';
|
||||
|
||||
|
||||
@ForItemType("vnd.farmmaps.itemtype.shape.processed")
|
||||
@ -18,12 +17,17 @@ import { Observable } from 'rxjs';
|
||||
templateUrl: './selected-item-shape.component.html',
|
||||
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);
|
||||
}
|
||||
public selectedLayer = 0;
|
||||
|
||||
ngOnDestroy(): void {
|
||||
if (this.sub) this.sub.unsubscribe();
|
||||
}
|
||||
|
||||
onLayerChanged(layerIndex: number) {
|
||||
this.store.dispatch(new mapActions.SetLayerIndex(layerIndex));
|
||||
@ -32,4 +36,13 @@ export class SelectedItemShapeComponent extends AbstractSelectedItemComponent {
|
||||
layer(layers:any,layerIndex:number) {
|
||||
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 { Store } from '@ngrx/store';
|
||||
import * as mapReducers from '../../reducers/map.reducer';
|
||||
import { commonReducers, ItemTypeService, IItem, ItemService, IItemLinkType, IUrlType } from '@farmmaps/common';
|
||||
import { Component, Injectable, OnDestroy } from '@angular/core';
|
||||
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 { 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")
|
||||
@Injectable()
|
||||
@ -18,12 +18,17 @@ import {TemporalService} from '../../services/temporal.service';
|
||||
templateUrl: './selected-item-temporal.component.html',
|
||||
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) {
|
||||
super(store, itemTypeService,location,router);
|
||||
}
|
||||
|
||||
ngOnDestroy(): void {
|
||||
if (this.sub) this.sub.unsubscribe();
|
||||
}
|
||||
|
||||
onLayerChanged(layerIndex: number) {
|
||||
this.store.dispatch(new mapActions.SetLayerIndex(layerIndex));
|
||||
}
|
||||
@ -32,8 +37,6 @@ export class SelectedItemTemporalComponent extends AbstractSelectedItemComponent
|
||||
return (this.itemLayer as ITemporalItemLayer)?.selectedItemLayer
|
||||
}
|
||||
|
||||
|
||||
|
||||
handleNextTemporal(event:MouseEvent) {
|
||||
this.store.dispatch(new mapActions.NextTemporal());
|
||||
event.preventDefault();
|
||||
@ -65,7 +68,7 @@ export class SelectedItemTemporalComponent extends AbstractSelectedItemComponent
|
||||
event.stopPropagation();
|
||||
event.preventDefault();
|
||||
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;
|
||||
})
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user