/*---------------------------------------------------------------------------------------------
* Copyright (c) Bentley Systems, Incorporated. All rights reserved.
* See LICENSE.md in the project root for license terms and full copyright notice.
*--------------------------------------------------------------------------------------------*/
/** @packageDocumentation
 * @module Views
 */
import { SpatialClassifiers } from "@itwin/core-common";
/** The front-end representation of [SpatialClassifiers]($common) that adds support for classifying a reality model using non-persistent
 * geometry via [[DynamicSpatialClassifier]].
 *
 * @see [[ContextRealityModelState.classifiers]] or [[SpatialModelState.classifiers]] to access the classifiers for a particular reality model.
 * @public
 */
export class SpatialClassifiersState extends SpatialClassifiers {
    _dynamicClassifier;
    constructor(container) {
        super(container);
    }
    /** The classifier currently being used to classify the reality model.
     * This may be either a [SpatialClassifier]($common) already defined in the set of available [SpatialClassifiers]($common), or a [[DynamicSpatialClassifier]].
     * @note Unlike [[PersistentSpatialClassifier]]s, [[DynamicSpatialClassifier]]s are not preserved when saving and recalling a view.
     */
    get activeClassifier() {
        return this._dynamicClassifier ?? this.active;
    }
    set activeClassifier(active) {
        if (active === this.activeClassifier) {
            return;
        }
        this._dynamicClassifier = undefined;
        if (active?.tileTreeReference) {
            this._dynamicClassifier = active;
        }
        else {
            this.setActive(active);
        }
    }
    /** @internal */
    static create(container) {
        return new SpatialClassifiersState(container);
    }
}
//# sourceMappingURL=SpatialClassifiersState.js.map