Merge branch 'features/geotiff_band_rendering' into develop

This commit is contained in:
Willem Dantuma 2020-02-19 14:56:22 +01:00
commit 616644de6c
2 changed files with 12 additions and 7 deletions

View File

@ -89,13 +89,13 @@ export class ItemLayersComponent extends LayerGroupComponent implements OnChange
createLayer(itemLayer: IItemLayer): Layer { createLayer(itemLayer: IItemLayer): Layer {
var layer: Layer = null; var layer: Layer = null;
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}/tiles/{z}/{x}/{y}.png?v=${itemLayer.item.updated.getTime()}` }); 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()}` });
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}/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}/${itemLayer.layerIndex}/tiles/{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,7 +105,7 @@ 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}/mapimage?v=${itemLayer.item.updated.getTime()}` }); 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()}` });
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') {

View File

@ -8,6 +8,11 @@
</div> </div>
<div class="legend-container" *ngIf="item?.data.layers;let layers"> <div class="legend-container" *ngIf="item?.data.layers;let layers">
<div class="card menu-card"> <div class="card menu-card">
<div *ngIf="layers.length>1">
<select (change)="onLayerChanged($event.target.value)">
<option *ngFor="let l of layers;let layerIndex = index" [value]="layerIndex">{{l.name}}</option>
</select>
</div>
<fm-map-layer-legend [layer]="layers[selectedLayer]" [histogramenabled]="true"></fm-map-layer-legend> <fm-map-layer-legend [layer]="layers[selectedLayer]" [histogramenabled]="true"></fm-map-layer-legend>
</div> </div>
</div> </div>