import '../../../globals.js';
// Copyright 2023-2024, University of Colorado Boulder
/**
 * Representation of a winding map for a face (or an edge as a delta)
 *
 * @author Jonathan Olson <jonathan.olson@colorado.edu>
 */
import { alpenglow } from '../imports.js';
export default class WindingMap {
    constructor(map = new Map()) {
        this.map = map;
    }
    getWindingNumber(renderPath) {
        return this.map.get(renderPath) || 0;
    }
    addWindingNumber(renderPath, amount) {
        const current = this.getWindingNumber(renderPath);
        this.map.set(renderPath, current + amount);
    }
    addWindingMap(windingMap) {
        for (const [renderPath, winding] of windingMap.map) {
            this.addWindingNumber(renderPath, winding);
        }
    }
    equals(windingMap) {
        if (this.map.size !== windingMap.map.size) {
            return false;
        }
        for (const [renderPath, winding] of this.map) {
            if (winding !== windingMap.getWindingNumber(renderPath)) {
                return false;
            }
        }
        return true;
    }
}
alpenglow.register('WindingMap', WindingMap);
//# sourceMappingURL=WindingMap.js.map