commited for presentation.
This commit is contained in:
@@ -5,7 +5,7 @@ import { DeepZoomMap } from './map.js'
|
||||
import { PIXIUtils } from '../../../../js/pixi/utils.js'
|
||||
|
||||
/**
|
||||
* GeoGraphics are graphical objects, that does not store the graphics information
|
||||
* * GeoGraphics are graphical objects, that does not store the graphics information
|
||||
* in screen space, but in geographical coordinates. Therefore GeoGraphics must be
|
||||
* placed on GeoLayers to work properly.
|
||||
*
|
||||
@@ -15,11 +15,12 @@ import { PIXIUtils } from '../../../../js/pixi/utils.js'
|
||||
* The geolayers forward this 'adaptTo' to all children that are GeoGraphics.
|
||||
* Which adjust their so called 'point' data to the new map.
|
||||
*
|
||||
* @abstract
|
||||
* @export
|
||||
* @class GeoGraphics
|
||||
*/
|
||||
export class GeoGraphics {
|
||||
constructor(coordinates, { scale = 1, onDraw = null, onDrawEnd = null, debug = false } = {}) {
|
||||
this.coordinates = coordinates
|
||||
this._coordinates = coordinates
|
||||
this.debug = debug
|
||||
this.graphics = new PIXI.Graphics()
|
||||
this.scale = scale
|
||||
@@ -29,6 +30,17 @@ export class GeoGraphics {
|
||||
this._position = null
|
||||
}
|
||||
|
||||
/**
|
||||
* The coordinates of the geographics.
|
||||
*
|
||||
* @member {array}
|
||||
* @readonly
|
||||
* @memberof GeoGraphics
|
||||
*/
|
||||
get coordinates() {
|
||||
return this._coordinates
|
||||
}
|
||||
|
||||
clone() {
|
||||
console.error(`Call of abstract method clone(). Overwrite in subclass.`, this)
|
||||
}
|
||||
@@ -134,6 +146,12 @@ export class GeoGraphics {
|
||||
this._layer = layer
|
||||
}
|
||||
|
||||
/**
|
||||
* Map of the containing layer. Null if on no layer.
|
||||
*
|
||||
* @readonly
|
||||
* @memberof GeoGraphics
|
||||
*/
|
||||
get map() {
|
||||
let map = null
|
||||
if (this.mapLayer) {
|
||||
@@ -142,6 +160,13 @@ export class GeoGraphics {
|
||||
return map
|
||||
}
|
||||
|
||||
/**
|
||||
* MapLayer of the containing layer. Null if on no layer.
|
||||
*
|
||||
* @member {MapLayer}
|
||||
* @readonly
|
||||
* @memberof GeoGraphics
|
||||
*/
|
||||
get mapLayer() {
|
||||
let mapLayer = null
|
||||
if (this.layer) {
|
||||
@@ -200,6 +225,10 @@ export class GeoGraphics {
|
||||
*
|
||||
* This GeoGraphics does not provide any visual representation.
|
||||
* Draw the desired shape in the onDraw callback.
|
||||
*
|
||||
* @export
|
||||
* @class GeoPoint
|
||||
* @extends {GeoGraphics}
|
||||
*/
|
||||
export class GeoPoint extends GeoGraphics {
|
||||
clone() {
|
||||
@@ -229,6 +258,13 @@ export class GeoPoint extends GeoGraphics {
|
||||
_draw() {}
|
||||
}
|
||||
|
||||
/**
|
||||
* Represensts a line between two locations.
|
||||
*
|
||||
* @export
|
||||
* @class GeoLine
|
||||
* @extends {GeoGraphics}
|
||||
*/
|
||||
export class GeoLine extends GeoGraphics {
|
||||
/**
|
||||
* @param {object} opts - Optional values
|
||||
@@ -331,6 +367,13 @@ export class GeoLine extends GeoGraphics {
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Represents a shape on a map.
|
||||
*
|
||||
* @export
|
||||
* @class GeoShape
|
||||
* @extends {GeoGraphics}
|
||||
*/
|
||||
export class GeoShape extends GeoGraphics {
|
||||
clone() {
|
||||
return new GeoShape(this.coordinates, this._cloneOptions)
|
||||
@@ -446,7 +489,7 @@ export class GeoShape extends GeoGraphics {
|
||||
|
||||
/**
|
||||
* a) Draw the hole with a polygon.
|
||||
*
|
||||
*
|
||||
* This may seem redundant to (c), but it's required (in this order(!))
|
||||
* to make the hole clickable.
|
||||
*
|
||||
@@ -479,6 +522,9 @@ export class GeoShape extends GeoGraphics {
|
||||
* The MultiGraphics makes use of the other GeoGraphics to
|
||||
* create a single graphics element out of multiple different
|
||||
* GeoGraphics.
|
||||
*
|
||||
* @class GeoMultiGraphics
|
||||
* @extends {GeoGraphics}
|
||||
*/
|
||||
class GeoMultiGraphics extends GeoGraphics {
|
||||
/**
|
||||
@@ -528,9 +574,8 @@ class GeoMultiGraphics extends GeoGraphics {
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
*
|
||||
* Text that is attatched to a GeoPoint.
|
||||
*
|
||||
* @export
|
||||
* @class GeoText
|
||||
@@ -574,6 +619,8 @@ export class GeoText extends GeoPoint {
|
||||
|
||||
/**
|
||||
* A geotext with a notch at a certain Position.
|
||||
*
|
||||
* TODO: This is a specialization for the Tüsch. This should be inside the Tüsch project.
|
||||
*/
|
||||
export class GeoFlagLabel extends GeoText {
|
||||
constructor(coordinates, text, opts) {
|
||||
@@ -679,6 +726,13 @@ export class GeoFlagLabel extends GeoText {
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* The GeoMultiShape displays multiple forms.
|
||||
*
|
||||
* @export
|
||||
* @class GeoMultiShape
|
||||
* @extends {GeoShape}
|
||||
*/
|
||||
export class GeoMultiShape extends GeoShape {
|
||||
static _manipulatePoints(points, func) {
|
||||
points.forEach(shape => {
|
||||
@@ -718,4 +772,3 @@ export class GeoMultiShape extends GeoShape {
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user