Removing layer dependency from geolayers and refactoring maps.

This commit is contained in:
2019-11-04 18:20:32 +01:00
parent 938b3e2f3c
commit ff0606d0a7
12 changed files with 1519 additions and 1340 deletions
+19 -21
View File
@@ -1,7 +1,6 @@
import { Points } from '../../utils.js'
import { EventHandler } from './utils.js'
import { FlagPolygon } from '../graphics/label.js'
import { GeoLayer, MapLayer } from './geolayer.js'
import { DeepZoomMap } from './map.js'
/**
@@ -97,10 +96,9 @@ export class GeoGraphics {
this.draw()
}
/**
* Redraws the graphics.
*
*
* This should be only called if you require an redraw independent of an adapt.
*
* @memberof GeoGraphics
@@ -127,23 +125,23 @@ export class GeoGraphics {
return this._position
}
get map() {
if (
this.graphics.layer &&
(this.graphics.layer instanceof GeoLayer || this.graphics.layer instanceof MapLayer)
) {
return this.graphics.layer.map
} else return null
}
// get map() {
// if (
// this.graphics.layer &&
// (this.graphics.layer instanceof GeoLayer || this.graphics.layer instanceof MapLayer)
// ) {
// return this.graphics.layer.map
// } else return null
// }
get mapLayer() {
if (
this.graphics.layer &&
(this.graphics.layer instanceof GeoLayer || this.graphics.layer instanceof MapLayer)
) {
return this.graphics.layer.mapLayer
} else return null
}
// get mapLayer() {
// if (
// this.graphics.layer &&
// (this.graphics.layer instanceof GeoLayer || this.graphics.layer instanceof MapLayer)
// ) {
// return this.graphics.layer.mapLayer
// } else return null
// }
/**
* Prepare draw is a private function, that prepares the graphics
@@ -204,8 +202,8 @@ export class GeoPoint extends GeoGraphics {
_adaptCoordinates(map) {
let scale = 1
if (this.mapLayer.map instanceof DeepZoomMap) {
scale = this.mapLayer.map.image.scale.x
if (map instanceof DeepZoomMap) {
scale = map.image.scale.x
}
scale = scale / 4