From 4872dee0940499755f5b4c0e345725f3b04a9483 Mon Sep 17 00:00:00 2001 From: Willem Dantuma Date: Wed, 28 Sep 2022 21:16:21 +0200 Subject: [PATCH] Upgrade cesium to 1.97 --- custom-webpack.config.js | 9 ++++-- package.json | 15 +++++++--- .../olcs/switch2d3d/switch2d3d.component.ts | 29 +++++++++++++++++-- 3 files changed, 44 insertions(+), 9 deletions(-) diff --git a/custom-webpack.config.js b/custom-webpack.config.js index 46c8f29..e8981af 100644 --- a/custom-webpack.config.js +++ b/custom-webpack.config.js @@ -4,9 +4,12 @@ module.exports = { // Resolve node module use of fs fs: "empty", Buffer: false, - http: "empty", - https: "empty", - zlib: "empty" + http: require.resolve("stream-http"), + https: require.resolve("https-browserify"), + url: require.resolve("url/"), + zlib: require.resolve('browserify-zlib'), + assert: require.resolve("assert/"), + util: require.resolve("util/") } } }; \ No newline at end of file diff --git a/package.json b/package.json index 72f368b..21b90a9 100644 --- a/package.json +++ b/package.json @@ -28,11 +28,14 @@ "@ngrx/router-store": "^12.0", "@ngrx/store": "^12.0", "angular-oauth2-oidc": "^12.0", + "assert": "^2.0.0", "bootstrap": "^4.6.0", - "cesium": "^1.82.1", + "browserify-zlib": "^0.2.0", + "cesium": "^1.97.0", "core-js": "^2.6.12", - "moment": "^2.29.1", - "ngrx-store-localstorage": "^12.0", + "https-browserify": "^1.0.0", + "moment": "^2.29.4", + "ngrx-store-localstorage": "^14", "ngx-avatar": "^4.1.0", "ngx-clipboard": "^14.0.1", "ngx-image-cropper": "^3.3.5", @@ -42,8 +45,12 @@ "ol-cesium": "^2.13.1", "resumablejs": "^1.1.0", "rxjs": "^6.6.7", + "stream": "^0.0.2", + "stream-http": "^3.2.0", "tassign": "^1.0.0", - "tslib": "^2.2.0", + "tslib": "^2.4.0", + "url": "^0.11.0", + "util": "^0.12.4", "zone.js": "~0.11.4" }, "devDependencies": { diff --git a/projects/common-map3d/src/fm-map3d/components/olcs/switch2d3d/switch2d3d.component.ts b/projects/common-map3d/src/fm-map3d/components/olcs/switch2d3d/switch2d3d.component.ts index 8e82530..ab92fdf 100644 --- a/projects/common-map3d/src/fm-map3d/components/olcs/switch2d3d/switch2d3d.component.ts +++ b/projects/common-map3d/src/fm-map3d/components/olcs/switch2d3d/switch2d3d.component.ts @@ -1,4 +1,7 @@ import { Component, OnInit,Input,Host } from '@angular/core'; +import { OldCircularArc } from 'arcgis-rest-api'; +import { Map } from 'ol'; +import { Interaction} from 'ol/interaction'; import { MapComponent } from 'ngx-openlayers'; import OLCesium from 'ol-cesium'; @@ -16,6 +19,7 @@ export class Switch2D3DComponent { private ol3d: OLCesium; private synchronizers:any[]; public loading:boolean = true; + private interactions:Interaction[] = []; constructor(private map: MapComponent) { @@ -41,12 +45,33 @@ export class Switch2D3DComponent { }); } + disableInteractions() { + this.interactions=[]; + this.map.instance.getInteractions().forEach((i) => { + if(i.getActive()) { + this.interactions.push(i); + i.setActive(false); + } + }); + } + + enableInteractions() { + this.interactions.forEach((i) => { + i.setActive(true); + }); + } + handleClick(event) { this.enable = !this.enable; if(this.enable) { - this.synchronize(); + this.disableInteractions(); + this.synchronize(); + this.ol3d.setEnabled(true); + } else { + this.ol3d.setEnabled(false); + this.enableInteractions(); } - this.ol3d.setEnabled(this.enable); + this.label = this.enable?"2D":"3D"; } }