|
@@ -110,7 +110,9 @@ export class MapComponent implements OnInit, OnDestroy, OnChanges {
|
|
|
// multiWorld: false,
|
|
// multiWorld: false,
|
|
|
//zoom: 6
|
|
//zoom: 6
|
|
|
})
|
|
})
|
|
|
- });
|
|
|
|
|
|
|
+ },
|
|
|
|
|
+ null
|
|
|
|
|
+ );
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
ngOnInit(): void {
|
|
ngOnInit(): void {
|
|
@@ -121,13 +123,14 @@ export class MapComponent implements OnInit, OnDestroy, OnChanges {
|
|
|
//this.dataReady = true;
|
|
//this.dataReady = true;
|
|
|
|
|
|
|
|
//if (this.mapReady)
|
|
//if (this.mapReady)
|
|
|
- this.HsMapService.loaded().then((map) => {
|
|
|
|
|
|
|
+ this.HsMapService.loaded(null).then((map) => {
|
|
|
this.initMap();
|
|
this.initMap();
|
|
|
|
|
+ let mapObj = this.HsMapService.getMap(null);
|
|
|
|
|
|
|
|
let unitsExtent: Extent = this.unitsLayer.getSource().getExtent();
|
|
let unitsExtent: Extent = this.unitsLayer.getSource().getExtent();
|
|
|
- this.HsMapService.map.getView().fit(unitsExtent, { size: this.HsMapService.map.getSize() });
|
|
|
|
|
|
|
+ mapObj.getView().fit(unitsExtent, { size: mapObj.getSize() });
|
|
|
|
|
|
|
|
- this.HsMapService.map.on("pointermove", function (evt) {
|
|
|
|
|
|
|
+ mapObj.on("pointermove", function (evt) {
|
|
|
var hit = this.forEachFeatureAtPixel(evt.pixel, function (feature, layer) {
|
|
var hit = this.forEachFeatureAtPixel(evt.pixel, function (feature, layer) {
|
|
|
return true;
|
|
return true;
|
|
|
});
|
|
});
|
|
@@ -148,8 +151,10 @@ export class MapComponent implements OnInit, OnDestroy, OnChanges {
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
initMap(): void {
|
|
initMap(): void {
|
|
|
- this.unitsLayer = this.initUnitsLayer(this.HsMapService.map);
|
|
|
|
|
- this.HsMapService.map.addLayer(this.unitsLayer);
|
|
|
|
|
|
|
+ let mapObj = this.HsMapService.getMap(null);
|
|
|
|
|
+
|
|
|
|
|
+ this.unitsLayer = this.initUnitsLayer(mapObj);
|
|
|
|
|
+ mapObj.addLayer(this.unitsLayer);
|
|
|
|
|
|
|
|
// this.HsMapService.map.on('click', function (evt) {
|
|
// this.HsMapService.map.on('click', function (evt) {
|
|
|
// var feature = this.HsMapService.map.forEachFeatureAtPixel(evt.pixel,
|
|
// var feature = this.HsMapService.map.forEachFeatureAtPixel(evt.pixel,
|