-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathMPEntity.ts
60 lines (56 loc) · 1.15 KB
/
MPEntity.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
import { MPPoint } from "../../index";
/**
* An interface describing trivial properties of a MapsIndoors geographical entities.
*
* @export
* @abstract
* @class MPEntity
* @typedef {MPEntity}
*/
export default abstract class MPEntity {
/**
* The position of the entity, oftenmost its anchorpoint.
*
* @public
* @abstract
* @type {?MPPoint}
*/
public abstract position?: MPPoint;
/**
* Whether the entity's geometry is a point.
*
* @public
* @abstract
* @readonly
* @type {boolean}
*/
public abstract get isPoint(): boolean;
/**
* The type of the entity (eg. MPLocation).
*
* @public
* @readonly
* @type {string}
*/
public readonly type: string;
/**
* Creates an instance of MPEntity.
*
* @constructor
* @protected
* @param {string} type
* @param {?boolean} [isPoint]
*/
protected constructor(type: string) {
this.type = type;
}
/**
* Stringifies the entity.
*
* @public
* @returns {string}
*/
public toJson(): string {
return JSON.stringify(this);
}
}