GraphicalLayer.ts 588 B

12345678910111213141516171819202122
  1. import { v4 as uuidv4 } from "uuid";
  2. import { GraphicalObject } from "./GraphicalObject";
  3. export class GraphicalLayer<T extends GraphicalObject> {
  4. public readonly UUID: string;
  5. public Name: string;
  6. public MemberObjects: T[];
  7. constructor(layerName?: string, UUID?: string) {
  8. this.Name = layerName;
  9. if (UUID) {
  10. this.UUID = UUID;
  11. } else {
  12. this.UUID = uuidv4();
  13. }
  14. this.MemberObjects = [];
  15. }
  16. public Equals(otherLayer: GraphicalLayer<T>): boolean {
  17. return this.UUID === otherLayer.UUID;
  18. }
  19. }