Skip to content

Commit

Permalink
fix(cesium): Add missing Injectable, add GUI essentials
Browse files Browse the repository at this point in the history
  • Loading branch information
jmacura committed Mar 22, 2024
1 parent f853201 commit abb710f
Show file tree
Hide file tree
Showing 3 changed files with 26 additions and 8 deletions.
29 changes: 22 additions & 7 deletions projects/cesium-test-app/src/app/app.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,10 @@ import {transform} from 'ol/proj';
import {HsCesiumConfig} from 'hslayers-cesium/src/hscesium-config.service';
import {HsConfig} from 'hslayers-ng/config';
import {HsLayoutService} from 'hslayers-ng/services/layout';
import {
HsOverlayConstructorService,
HsPanelConstructorService,
} from 'hslayers-ng/services/panel-constructor';
import {HslayersCesiumComponent} from 'hslayers-cesium/src/hscesium.component';

@Component({
Expand All @@ -18,9 +22,11 @@ import {HslayersCesiumComponent} from 'hslayers-cesium/src/hscesium.component';
})
export class AppComponent implements OnInit {
constructor(
public HsConfig: HsConfig,
private HsCesiumConfig: HsCesiumConfig,
private HsLayoutService: HsLayoutService,
public hsConfig: HsConfig,
private hsCesiumConfig: HsCesiumConfig,
private hsLayoutService: HsLayoutService,
private hsOverlayConstructorService: HsOverlayConstructorService,
private hsPanelConstructorService: HsPanelConstructorService,
) {
const geojsonObject = {
'type': 'FeatureCollection',
Expand Down Expand Up @@ -118,7 +124,7 @@ export class AppComponent implements OnInit {
visible: false,
opacity: 1,
});
this.HsConfig.update({
this.hsConfig.update({
datasources: [
{
title: 'Layman',
Expand Down Expand Up @@ -243,13 +249,22 @@ export class AppComponent implements OnInit {
opticalMap,
],
});
if (!this.HsCesiumConfig.cesiumBase) {
this.HsCesiumConfig.cesiumBase = '/assets/cesium/';
if (!this.hsCesiumConfig.cesiumBase) {
this.hsCesiumConfig.cesiumBase = '/assets/cesium/';
}
}
title = 'hslayers-workspace';

ngOnInit(): void {
this.HsLayoutService.addMapVisualizer(HslayersCesiumComponent);
/**
* Create panel components
*/
this.hsPanelConstructorService.createActivePanels();

/**
* Create GUI overlay
*/
this.hsOverlayConstructorService.createGuiOverlay();
this.hsLayoutService.addMapVisualizer(HslayersCesiumComponent);
}
}
4 changes: 3 additions & 1 deletion projects/hslayers-cesium/src/hscesium-config.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,9 @@ export class HsCesiumConfigObject {
cesiumTime?: JulianDate;
constructor() {}
}
@Injectable()
@Injectable({
providedIn: 'root',
})
export class HsCesiumConfig extends HsCesiumConfigObject {
/**
* Triggered when cesiumConfig is updated using 'update' function of HsCesiumService.
Expand Down
1 change: 1 addition & 0 deletions projects/hslayers-cesium/src/hscesium.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@ export class HslayersCesiumComponent implements AfterViewInit {
description: 'Switch between 3D (Cesium) and 2D (OpenLayers)',
icon: 'icon-globealt',
click: () => this.toggleCesiumMap(),
order: -1,
});

this.HsEventBusService.layermanagerDimensionChanges.subscribe((data) =>
Expand Down

0 comments on commit abb710f

Please sign in to comment.