Fix static image layer

2022.01
Willem Dantuma 2020-09-18 16:05:44 +02:00
parent 15d1f14ee1
commit c606e02673
2 changed files with 8 additions and 4 deletions

View File

@ -103,8 +103,10 @@ export class ItemLayersComponent extends LayerGroupComponent implements OnChange
layer = new Tile({ source: source });
}
if (l && l.rendering && l.rendering.renderoutputType == "Image") {
var ri = l.rendering as IRenderoutputImage;
let source = new ImageStatic({ imageExtent: ri.extent, crossOrigin: 'use-credentials',projection: "EPSG:3857", url: `${this._apiEndPoint}/api/v1/items/${item.code}/mapimage/${layerIndex}?v=${Date.parse(item.updated)}` });
var ri = l.rendering as IRenderoutputImage;
// convert to EPSG:4326 asworkaround for cesium
var projectedExtent = proj.transformExtent( ri.extent, 'EPSG:3857','EPSG:4326');
let source = new ImageStatic({ imageExtent:projectedExtent,projection:'EPSG:4326', crossOrigin: 'use-credentials', url: `${this._apiEndPoint}/api/v1/items/${item.code}/mapimage/${layerIndex}?v=${Date.parse(item.updated)}` });
layer = new Image({ source: source });
}
return layer;

View File

@ -1,6 +1,7 @@
import { Component, OnInit,Input,Host } from '@angular/core';
import { MapComponent } from 'ngx-openlayers';
import OLCesium from 'ol-cesium';
//import OLCesium from '../../../../../../../../ol-cesium/src/olcs/OLCesium.js';
declare var olcs: any;
@ -30,13 +31,14 @@ export class Switch2D3DComponent {
}
ngOnInit() {
this.ol3d = new OLCesium({ map: this.map.instance,createSynchronizers: (map,scene) => {
createSynchronizers: (map,scene) => {
this.synchronizers = [
new olcs.RasterSynchronizer(map,scene),
new olcs.VectorSynchronizer(map,scene)
];
return this.synchronizers;
},stopOpenLayersEventsPropagation:true});
}
this.ol3d = new OLCesium({ map: this.map.instance,stopOpenLayersEventsPropagation:true});
}
synchronize() {