"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.LandmarkSizePM = void 0;
exports.makeLandmarkSizePM = makeLandmarkSizePM;
const core_1 = require("@vived/core");
const LandmarkEntity_1 = require("../Entities/LandmarkEntity");
class LandmarkSizePM extends core_1.AppObjectPM {
    static get(id, appObjects) {
        return appObjects
            .get(id)
            ?.getComponent(LandmarkSizePM.type);
    }
}
exports.LandmarkSizePM = LandmarkSizePM;
LandmarkSizePM.type = "LandmarkSizePM";
function makeLandmarkSizePM(appObject) {
    return new LandmarkSizePMImp(appObject);
}
class LandmarkSizePMImp extends LandmarkSizePM {
    get landmarkEntity() {
        return this.getCachedLocalComponent(LandmarkEntity_1.LandmarkEntity.type);
    }
    vmsAreEqual(a, b) {
        return a === b;
    }
    constructor(appObject) {
        super(appObject, LandmarkSizePM.type);
        this.onRepoChange = () => {
            if (!this.landmarkEntity)
                return;
            this.doUpdateView(this.landmarkEntity.size);
        };
        this.dispose = () => {
            super.dispose();
            this.landmarkEntity?.removeChangeObserver(this.onRepoChange);
            this.landmarkEntity?.removeOnDisposeObserver(this.dispose);
        };
        this.landmarkEntity?.addChangeObserver(this.onRepoChange);
        this.onRepoChange();
    }
}
//# sourceMappingURL=LandmarkSizePM.js.map