Set layerindex
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
616644de6c
commit
1a3bbf26f2
@ -87,15 +87,17 @@ export class ItemLayersComponent extends LayerGroupComponent implements OnChange
|
|||||||
}
|
}
|
||||||
|
|
||||||
createLayer(itemLayer: IItemLayer): Layer {
|
createLayer(itemLayer: IItemLayer): Layer {
|
||||||
var layer: Layer = null;
|
var layer: Layer = null;
|
||||||
|
var layerIndex = -1;
|
||||||
if (itemLayer.item.itemType == 'vnd.farmmaps.itemtype.geotiff.processed') {
|
if (itemLayer.item.itemType == 'vnd.farmmaps.itemtype.geotiff.processed') {
|
||||||
let source = new XYZ({ maxZoom: 19, minZoom: 1, url: `${this._apiEndPoint}/api/v1/items/${itemLayer.item.code}/${itemLayer.layerIndex}/tiles/{z}/{x}/{y}.png?v=${itemLayer.item.updated.getTime()}` });
|
layerIndex = itemLayer.layerIndex != -1 ? itemLayer.layerIndex : itemLayer.item.data.layers[0].index;
|
||||||
|
let source = new XYZ({ maxZoom: 19, minZoom: 1, url: `${this._apiEndPoint}/api/v1/items/${itemLayer.item.code}/tiles/${layerIndex}/{z}/{x}/{y}.png?v=${itemLayer.item.updated.getTime()}` });
|
||||||
layer = new Tile({ source: source });
|
layer = new Tile({ source: source });
|
||||||
var data = itemLayer.item.data;
|
var data = itemLayer.item.data;
|
||||||
var l = (data && data.layers && data.layers.length > 0) ? data.layers[0] : null;
|
var l = (data && data.layers && data.layers.length > 0) ? data.layers[0] : null;
|
||||||
if (l && l.rendering && l.rendering.renderoutputType == "Tiles") {
|
if (l && l.rendering && l.rendering.renderoutputType == "Tiles") {
|
||||||
var rt = l.rendering as IRenderoutputTiles;
|
var rt = l.rendering as IRenderoutputTiles;
|
||||||
let source = new XYZ({ maxZoom: rt.maxzoom, minZoom: rt.minzoom, url: `${this._apiEndPoint}/api/v1/items/${itemLayer.item.code}/${itemLayer.layerIndex}/tiles/{z}/{x}/{y}.png?v=${itemLayer.item.updated.getTime()}` });
|
let source = new XYZ({ maxZoom: rt.maxzoom, minZoom: rt.minzoom, url: `${this._apiEndPoint}/api/v1/items/${itemLayer.item.code}/tiles/${layerIndex}/{z}/{x}/{y}.png?v=${itemLayer.item.updated.getTime()}` });
|
||||||
layer = new Tile({ source: source });
|
layer = new Tile({ source: source });
|
||||||
}
|
}
|
||||||
if (l && l.rendering && l.rendering.renderoutputType == "Image") {
|
if (l && l.rendering && l.rendering.renderoutputType == "Image") {
|
||||||
@ -105,12 +107,12 @@ export class ItemLayersComponent extends LayerGroupComponent implements OnChange
|
|||||||
units: 'pixels',
|
units: 'pixels',
|
||||||
extent: ri.extent
|
extent: ri.extent
|
||||||
});
|
});
|
||||||
let source = new ImageStatic({ imageExtent: ri.extent, projection: projection, url: `${this._apiEndPoint}/api/v1/items/${itemLayer.item.code}/${itemLayer.layerIndex}/mapimage?v=${itemLayer.item.updated.getTime()}` });
|
let source = new ImageStatic({ imageExtent: ri.extent, projection: projection, url: `${this._apiEndPoint}/api/v1/items/${itemLayer.item.code}/mapimage/${layerIndex}?v=${itemLayer.item.updated.getTime()}` });
|
||||||
layer = new Image({ source: source });
|
layer = new Image({ source: source });
|
||||||
}
|
}
|
||||||
} else if (itemLayer.item.itemType == 'vnd.farmmaps.itemtype.shape.processed') {
|
} else if (itemLayer.item.itemType == 'vnd.farmmaps.itemtype.shape.processed') {
|
||||||
var data = itemLayer.item.data;
|
var data = itemLayer.item.data;
|
||||||
var layerIndex = itemLayer.layerIndex != -1 ? itemLayer.layerIndex : itemLayer.item.data.layers[0].index;
|
layerIndex = itemLayer.layerIndex != -1 ? itemLayer.layerIndex : itemLayer.item.data.layers[0].index;
|
||||||
var l = itemLayer.item.data.layers[layerIndex];
|
var l = itemLayer.item.data.layers[layerIndex];
|
||||||
if (l && l.rendering && l.rendering.renderoutputType == "VectorTiles") {
|
if (l && l.rendering && l.rendering.renderoutputType == "VectorTiles") {
|
||||||
var rt = itemLayer.item.data.layers[layerIndex].rendering as IRenderoutputTiles;
|
var rt = itemLayer.item.data.layers[layerIndex].rendering as IRenderoutputTiles;
|
||||||
|
@ -1,30 +1,30 @@
|
|||||||
import { Component, Input, Injectable, OnInit } from '@angular/core';
|
import { Component, Injectable } from '@angular/core';
|
||||||
import { Location } from '@angular/common';
|
import { Location } from '@angular/common';
|
||||||
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, ItemService, FolderService } from '@farmmaps/common';
|
||||||
import { commonReducers, ItemTypeService, IItem, Item, ItemService, FolderService, IListItem} from '@farmmaps/common';
|
import { Router } 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 * as mapActions from '../../actions/map.actions';
|
||||||
import { Observable } from 'rxjs';
|
|
||||||
|
|
||||||
|
@ForItemType("vnd.farmmaps.itemtype.geotiff.processed")
|
||||||
@ForItemType("vnd.farmmaps.itemtype.geotiff.processed")
|
@Injectable()
|
||||||
@Injectable()
|
@Component({
|
||||||
@Component({
|
selector: 'fm-map-selected-item-geotiff',
|
||||||
selector: 'fm-map-selected-item-geotiff',
|
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 {
|
|
||||||
|
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>, itemTypeService: ItemTypeService, location: Location, router: Router, private itemService$: ItemService,private folderService$: FolderService) {
|
super(store, itemTypeService,location,router);
|
||||||
super(store, itemTypeService,location,router);
|
}
|
||||||
}
|
public selectedLayer: number = 0;
|
||||||
public selectedLayer: number = 0;
|
|
||||||
|
onLayerChanged(layerIndex: number) {
|
||||||
onLayerChanged(layerIndex: number) {
|
this.selectedLayer = layerIndex;
|
||||||
this.selectedLayer = layerIndex;
|
this.store.dispatch(new mapActions.SetLayerIndex(layerIndex));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user