Compare commits
2 Commits
7502bc54d1
...
b652555f37
Author | SHA1 | Date | |
---|---|---|---|
|
b652555f37 | ||
|
3db09c1e2a |
26
package-lock.json
generated
26
package-lock.json
generated
@ -102,15 +102,15 @@
|
|||||||
"tslib": "^2.0.0"
|
"tslib": "^2.0.0"
|
||||||
},
|
},
|
||||||
"peerDependencies": {
|
"peerDependencies": {
|
||||||
"@angular/core": "~14.0.0",
|
"@angular/core": ">=14.0.0",
|
||||||
"@farmmaps/common": ">=^2.0.0",
|
"@farmmaps/common": ">=2.0.0",
|
||||||
"@ngrx/effects": "^14.0.0",
|
"@ngrx/effects": ">=14.0.0",
|
||||||
"@ngrx/router-store": "^14.0.0",
|
"@ngrx/router-store": ">=14.0.0",
|
||||||
"@ngrx/store": "^14.0.0",
|
"@ngrx/store": ">=14.0.0",
|
||||||
"ngrx-store-localstorage": "^14.0.0",
|
"ngrx-store-localstorage": ">=14.0.0",
|
||||||
"ngx-openlayers": "1.0.0-next.19",
|
"ngx-openlayers": ">=1.0.0-next.19",
|
||||||
"ol": "6.8.1",
|
"ol": ">=6.8.1",
|
||||||
"tassign": "^1.0.0"
|
"tassign": ">=1.0.0"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"dist/common-map3d": {
|
"dist/common-map3d": {
|
||||||
@ -120,11 +120,11 @@
|
|||||||
"tslib": "^2.0.0"
|
"tslib": "^2.0.0"
|
||||||
},
|
},
|
||||||
"peerDependencies": {
|
"peerDependencies": {
|
||||||
"@angular/common": "^14.0.0",
|
"@angular/common": ">=14.0.0",
|
||||||
"@angular/core": "^14.0.0",
|
"@angular/core": ">=14.0.0",
|
||||||
"cesium": "^1.82.1",
|
"cesium": ">=1.82.1",
|
||||||
"ngx-openlayers": "1.0.0-next.19",
|
"ngx-openlayers": "1.0.0-next.19",
|
||||||
"ol-cesium": "^2.13.0"
|
"ol-cesium": ">=2.13.0"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"node_modules/@adobe/css-tools": {
|
"node_modules/@adobe/css-tools": {
|
||||||
|
@ -364,34 +364,28 @@ export class ItemLayersComponent extends LayerGroupComponent implements OnChange
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
installTopLayerPrerenderEventhandler() {
|
installTopLayerPrerenderEventhandler(olLayer : Layer<Source>) {
|
||||||
if(!this.topLayerPrerenderEventhandlerInstalled && this.onPrerender.observers.length > 0 ) {
|
if(!this.topLayerPrerenderEventhandlerInstalled && this.onPrerender.observers.length > 0 && olLayer) {
|
||||||
if(this.instance.getVisible()) {
|
if(this.instance.getVisible()) {
|
||||||
var olLayers = this.instance.getLayers().getArray().filter(l=> l.getVisible());
|
olLayer.on('prerender',this.topLayerPrerenderEventhandler);
|
||||||
if(olLayers.length >0) {
|
olLayer.on('postrender',this.topLayerPostrenderEventhandler);
|
||||||
var topLayer = olLayers[0] as any;
|
|
||||||
topLayer.on('prerender',this.topLayerPrerenderEventhandler);
|
|
||||||
topLayer.on('postrender',this.topLayerPostrenderEventhandler);
|
|
||||||
this.topLayerPrerenderEventhandlerInstalled = true;
|
this.topLayerPrerenderEventhandlerInstalled = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
unInstallTopLayerPrerenderEventhandler() {
|
unInstallTopLayerPrerenderEventhandler() {
|
||||||
if(this.topLayerPrerenderEventhandlerInstalled && this.onPrerender.observers.length > 0 )
|
if(this.topLayerPrerenderEventhandlerInstalled && this.onPrerender.observers.length > 0 )
|
||||||
{
|
{
|
||||||
if(this.instance.getVisible()) {
|
if(this.instance.getVisible()) {
|
||||||
var olLayers = this.instance.getLayers().getArray().filter(l=> l.getVisible());
|
var olLayers = this.instance.getLayers().getArray().forEach((l:any) => {
|
||||||
if(olLayers.length >0) {
|
l.un('prerender',this.topLayerPrerenderEventhandler);
|
||||||
var topLayer = olLayers[0] as any;
|
l.un('postrender',this.topLayerPostrenderEventhandler);
|
||||||
topLayer.un('prerender',this.topLayerPrerenderEventhandler);
|
});
|
||||||
topLayer.un('postrender',this.topLayerPostrenderEventhandler);
|
|
||||||
this.topLayerPrerenderEventhandlerInstalled = false;
|
this.topLayerPrerenderEventhandlerInstalled = false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
addOrUpdateOlLayer(itemLayer:IItemLayer,index:number):Layer<Source> {
|
addOrUpdateOlLayer(itemLayer:IItemLayer,index:number):Layer<Source> {
|
||||||
@ -418,11 +412,19 @@ export class ItemLayersComponent extends LayerGroupComponent implements OnChange
|
|||||||
return layer;
|
return layer;
|
||||||
}
|
}
|
||||||
|
|
||||||
updateLayers(itemLayers: IItemLayer[]) {
|
updateLayers(itemLayers: IItemLayer[] | IItemLayer) {
|
||||||
this.unInstallTopLayerPrerenderEventhandler();
|
this.unInstallTopLayerPrerenderEventhandler();
|
||||||
|
let dataLayer = false;
|
||||||
|
var ils:IItemLayer[] = [];
|
||||||
|
if(Array.isArray(itemLayers)) {
|
||||||
|
ils = itemLayers;
|
||||||
|
} else {
|
||||||
|
dataLayer=true;
|
||||||
|
ils=[itemLayers];
|
||||||
|
}
|
||||||
let newLayers: Layer<Source>[] = [];
|
let newLayers: Layer<Source>[] = [];
|
||||||
if (itemLayers) {
|
if (ils) {
|
||||||
itemLayers.forEach((itemLayer, index) => {
|
ils.forEach((itemLayer, index) => {
|
||||||
if(itemLayer.item.itemType == 'vnd.farmmaps.itemtype.temporal') {
|
if(itemLayer.item.itemType == 'vnd.farmmaps.itemtype.temporal') {
|
||||||
let il = itemLayer as ITemporalItemLayer;
|
let il = itemLayer as ITemporalItemLayer;
|
||||||
let previousLayer = this.addOrUpdateOlLayer(il.previousItemLayer,newLayers.length);
|
let previousLayer = this.addOrUpdateOlLayer(il.previousItemLayer,newLayers.length);
|
||||||
@ -431,9 +433,11 @@ export class ItemLayersComponent extends LayerGroupComponent implements OnChange
|
|||||||
if(selectedLayer) newLayers.push(selectedLayer);
|
if(selectedLayer) newLayers.push(selectedLayer);
|
||||||
let nextLayer = this.addOrUpdateOlLayer(il.nextItemLayer,newLayers.length);
|
let nextLayer = this.addOrUpdateOlLayer(il.nextItemLayer,newLayers.length);
|
||||||
if(nextLayer) newLayers.push(nextLayer);
|
if(nextLayer) newLayers.push(nextLayer);
|
||||||
|
this.installTopLayerPrerenderEventhandler(selectedLayer);
|
||||||
} else {
|
} else {
|
||||||
let layer = this.addOrUpdateOlLayer(itemLayer,newLayers.length);
|
let layer = this.addOrUpdateOlLayer(itemLayer,newLayers.length);
|
||||||
if(layer) newLayers.push(layer);
|
if(layer) newLayers.push(layer);
|
||||||
|
this.installTopLayerPrerenderEventhandler(layer);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
// Remove the layers that have disapeared from childrenLayers
|
// Remove the layers that have disapeared from childrenLayers
|
||||||
@ -442,12 +446,11 @@ export class ItemLayersComponent extends LayerGroupComponent implements OnChange
|
|||||||
olLayers.removeAt(newLayers.length);
|
olLayers.removeAt(newLayers.length);
|
||||||
}
|
}
|
||||||
this.selectionLayer=null;
|
this.selectionLayer=null;
|
||||||
if(this.mapEventHandlerInstalled && itemLayers.length==1 && this.getItemlayer(itemLayers[0]).item.itemType == 'vnd.farmmaps.itemtype.shape.processed') {
|
if(this.mapEventHandlerInstalled && ils.length==1 && this.getItemlayer(itemLayers[0]).item.itemType == 'vnd.farmmaps.itemtype.shape.processed') {
|
||||||
this.selectionLayer = this.createSelectionLayer(this.getItemlayer(itemLayers[0]));
|
this.selectionLayer = this.createSelectionLayer(this.getItemlayer(itemLayers[0]));
|
||||||
if(this.selectionLayer) olLayers.push(this.selectionLayer)
|
if(this.selectionLayer) olLayers.push(this.selectionLayer)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
this.installTopLayerPrerenderEventhandler();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
topLayerPrerenderEventhandler = (event) => {
|
topLayerPrerenderEventhandler = (event) => {
|
||||||
|
Loading…
Reference in New Issue
Block a user