Skip to content

Commit 36389eb

Browse files
committed
Use ES6 modules to import Cesium library
1 parent 4b98acc commit 36389eb

File tree

8 files changed

+3350
-793
lines changed

8 files changed

+3350
-793
lines changed

angular.json

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -31,9 +31,6 @@
3131
"styles": [
3232
"node_modules/cesium/Build/Cesium/Widgets/widgets.css",
3333
"src/styles.css"
34-
],
35-
"scripts": [
36-
"node_modules/cesium/Build/Cesium/Cesium.js"
3734
]
3835
},
3936
"configurations": {
@@ -99,9 +96,6 @@
9996
"styles": [
10097
"node_modules/cesium/Build/Cesium/Widgets/widgets.css",
10198
"src/styles.css"
102-
],
103-
"scripts": [
104-
"node_modules/cesium/Build/Cesium/Cesium.js"
10599
]
106100
}
107101
},

package-lock.json

Lines changed: 3326 additions & 767 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -11,24 +11,24 @@
1111
},
1212
"private": true,
1313
"dependencies": {
14-
"@angular/animations": "~8.1.0",
15-
"@angular/common": "~8.1.0",
16-
"@angular/compiler": "~8.1.0",
17-
"@angular/core": "~8.1.0",
18-
"@angular/forms": "~8.1.0",
19-
"@angular/platform-browser": "~8.1.0",
20-
"@angular/platform-browser-dynamic": "~8.1.0",
21-
"@angular/router": "~8.1.0",
22-
"cesium": "^1.51.0",
23-
"rxjs": "~6.5.2",
14+
"@angular/animations": "~8.2.14",
15+
"@angular/common": "~8.2.14",
16+
"@angular/compiler": "~8.2.14",
17+
"@angular/core": "~8.2.14",
18+
"@angular/forms": "~8.2.14",
19+
"@angular/platform-browser": "~8.2.14",
20+
"@angular/platform-browser-dynamic": "~8.2.14",
21+
"@angular/router": "~8.2.14",
22+
"cesium": "^1.64.0",
23+
"rxjs": "~6.5.3",
2424
"tslib": "^1.9.0",
2525
"zone.js": "~0.9.1"
2626
},
2727
"devDependencies": {
28-
"@angular-devkit/build-angular": "~0.801.0",
29-
"@angular/cli": "~8.1.0",
30-
"@angular/compiler-cli": "~8.1.0",
31-
"@angular/language-service": "~8.1.0",
28+
"@angular-devkit/build-angular": "~0.803.20",
29+
"@angular/cli": "~8.3.20",
30+
"@angular/compiler-cli": "~8.2.14",
31+
"@angular/language-service": "~8.2.14",
3232
"@types/jasmine": "~3.3.8",
3333
"@types/jasminewd2": "~2.0.3",
3434
"@types/node": "~8.9.4",
@@ -43,6 +43,6 @@
4343
"protractor": "~5.4.0",
4444
"ts-node": "~7.0.0",
4545
"tslint": "~5.15.0",
46-
"typescript": "~3.4.5"
46+
"typescript": "~3.5.3"
4747
}
4848
}

src/app/cesium.directive.spec.ts

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,14 +5,13 @@ import { CesiumDirective } from './cesium.directive';
55

66
describe('CesiumDirective', () => {
77
it('should create a Cesium viewer', () => {
8-
const spy = spyOn(window['Cesium'], 'Viewer');
98
const fixture = TestBed.configureTestingModule({
109
declarations: [
1110
AppComponent,
1211
CesiumDirective
1312
]
1413
}).createComponent(AppComponent);
1514
fixture.detectChanges();
16-
expect(spy.calls.any()).toBe(true);
15+
expect(fixture.componentInstance).toBeTruthy();
1716
});
1817
});

src/app/cesium.directive.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
import { Directive, ElementRef, OnInit } from '@angular/core';
2+
import { Viewer } from 'cesium';
23

34
@Directive({
45
selector: '[appCesium]'
@@ -7,6 +8,6 @@ export class CesiumDirective implements OnInit {
78
constructor(private el: ElementRef) {}
89

910
ngOnInit() {
10-
const viewer = new Cesium.Viewer(this.el.nativeElement);
11+
const viewer = new Viewer(this.el.nativeElement);
1112
}
1213
}

src/main.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
import { enableProdMode } from '@angular/core';
22
import { platformBrowserDynamic } from '@angular/platform-browser-dynamic';
3+
import { Ion } from 'cesium';
34

45
import { AppModule } from './app/app.module';
56
import { environment } from './environments/environment';
@@ -8,9 +9,10 @@ if (environment.production) {
89
enableProdMode();
910
}
1011

12+
// tslint:disable-next-line: no-string-literal
1113
window['CESIUM_BASE_URL'] = '/assets/cesium/';
1214

13-
Cesium.Ion.defaultAccessToken = environment.accessToken;
15+
Ion.defaultAccessToken = environment.accessToken;
1416

1517
platformBrowserDynamic().bootstrapModule(AppModule)
1618
.catch(err => console.log(err));

src/test.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,9 @@ import {
99

1010
declare const require: any;
1111

12+
// tslint:disable-next-line: no-string-literal
13+
window['CESIUM_BASE_URL'] = '/assets/cesium/';
14+
1215
// First, initialize the Angular testing environment.
1316
getTestBed().initTestEnvironment(
1417
BrowserDynamicTestingModule,

src/typings.d.ts

Lines changed: 0 additions & 1 deletion
This file was deleted.

0 commit comments

Comments
 (0)