changed image api

This commit is contained in:
Mark van der Wal 2020-02-19 10:53:14 +01:00
parent 3baf0b15c7
commit aa6cd254c7

View File

@ -87,15 +87,15 @@ export class ItemLayersComponent extends LayerGroupComponent implements OnChange
}
createLayer(itemLayer: IItemLayer): Layer {
var layer: Layer = null;
var layer: Layer = null;
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 });
var data = itemLayer.item.data;
var l = (data && data.layers && data.layers.length > 0) ? data.layers[0] : null;
if (l && l.rendering && l.rendering.renderoutputType == "Tiles") {
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 });
}
if (l && l.rendering && l.rendering.renderoutputType == "Image") {
@ -105,7 +105,7 @@ export class ItemLayersComponent extends LayerGroupComponent implements OnChange
units: 'pixels',
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 });
}
} else if (itemLayer.item.itemType == 'vnd.farmmaps.itemtype.shape.processed') {
@ -123,7 +123,7 @@ export class ItemLayersComponent extends LayerGroupComponent implements OnChange
url: `${this._apiEndPoint}/api/v1/items/${itemLayer.item.code}/vectortiles/{z}/{x}/{y}.pbf?v=${itemLayer.item.updated.getTime()}`
}),
style: (feature) => {
return this.getColorFromGradient(l, feature);
return this.getColorFromGradient(l, feature);
}
})
} else if (l && l.rendering && l.rendering.renderoutputType == "Tiles") {
@ -184,7 +184,7 @@ export class ItemLayersComponent extends LayerGroupComponent implements OnChange
return this.styleCache[key];
}
});
}
}
} else if (itemLayer.item.itemType == 'vnd.farmmaps.itemtype.layer') {
let data = itemLayer.item.data as ILayerData;
switch (data.interfaceType) {
@ -255,7 +255,7 @@ export class ItemLayersComponent extends LayerGroupComponent implements OnChange
olLayers.removeAt(i);
}
}
}
}
}
ngOnChanges(changes: SimpleChanges) {