AW-3101 vnd.farmmaps.itemtype.shape.processed download as shape (zip)
This commit is contained in:
@@ -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,13 +17,18 @@ 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;
|
||||
})
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user