WIP: changed image api #1
@ -87,15 +87,15 @@ 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') {
|
||||||
@ -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()}`
|
url: `${this._apiEndPoint}/api/v1/items/${itemLayer.item.code}/vectortiles/{z}/{x}/{y}.pbf?v=${itemLayer.item.updated.getTime()}`
|
||||||
}),
|
}),
|
||||||
style: (feature) => {
|
style: (feature) => {
|
||||||
return this.getColorFromGradient(l, feature);
|
return this.getColorFromGradient(l, feature);
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
} else if (l && l.rendering && l.rendering.renderoutputType == "Tiles") {
|
} else if (l && l.rendering && l.rendering.renderoutputType == "Tiles") {
|
||||||
@ -184,7 +184,7 @@ export class ItemLayersComponent extends LayerGroupComponent implements OnChange
|
|||||||
return this.styleCache[key];
|
return this.styleCache[key];
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
} else if (itemLayer.item.itemType == 'vnd.farmmaps.itemtype.layer') {
|
} else if (itemLayer.item.itemType == 'vnd.farmmaps.itemtype.layer') {
|
||||||
let data = itemLayer.item.data as ILayerData;
|
let data = itemLayer.item.data as ILayerData;
|
||||||
switch (data.interfaceType) {
|
switch (data.interfaceType) {
|
||||||
@ -255,7 +255,7 @@ export class ItemLayersComponent extends LayerGroupComponent implements OnChange
|
|||||||
olLayers.removeAt(i);
|
olLayers.removeAt(i);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
ngOnChanges(changes: SimpleChanges) {
|
ngOnChanges(changes: SimpleChanges) {
|
||||||
|
@ -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>
|
||||||
|
Loading…
Reference in New Issue
Block a user