"use strict";
/*---------------------------------------------------------------------------------------------
* Copyright (c) Bentley Systems, Incorporated. All rights reserved.
* See LICENSE.md in the project root for license terms and full copyright notice.
*--------------------------------------------------------------------------------------------*/
Object.defineProperty(exports, "__esModule", { value: true });
exports.RecurseToCurvesGeometryHandler = exports.NullGeometryHandler = exports.GeometryHandler = void 0;
/**
 * `GeometryHandler` defines the base abstract methods for double-dispatch geometry computation.
 * * User code that wants to handle one or all of the commonly known geometry types implements a handler class.
 * * User code that does not handle all types is most likely to start with `NullGeometryHandler`, which will provide
 * No-action implementations for all types.
 * @public
 */
class GeometryHandler {
    /** Handle strongly typed  [[CurveCollection]]  */
    handleCurveCollection(_g) { }
    /** Handle strongly typed [[Path]] (base class method calls [[handleCurveCollection]]) */
    handlePath(g) {
        return this.handleCurveCollection(g);
    }
    /** Handle strongly typed [[Loop]] (base class method calls [[handleCurveCollection]]) */
    handleLoop(g) {
        return this.handleCurveCollection(g);
    }
    /** Handle strongly typed [[ParityRegion]] (base class method calls [[handleCurveCollection]]) */
    handleParityRegion(g) {
        return this.handleCurveCollection(g);
    }
    /** Handle strongly typed [[UnionRegion]] (base class method calls [[handleCurveCollection]]) */
    handleUnionRegion(g) {
        return this.handleCurveCollection(g);
    }
    /** Handle strongly typed [[BagOfCurves]] (base class method calls [[handleCurveCollection]]) */
    handleBagOfCurves(g) {
        return this.handleCurveCollection(g);
    }
    /** Handle strongly typed [[CurveChainWithDistanceIndex]] (base class method calls [[handlePath]] or [[handleLoop]]) */
    handleCurveChainWithDistanceIndex(g) {
        return this.handlePath(g.path);
    }
}
exports.GeometryHandler = GeometryHandler;
/**
 * `NullGeometryHandler` is a base class for dispatching various geometry types to application specific implementation
 * of some service.
 * To use:
 * * Derive a class from `NullGeometryHandler`
 * * Re-implement any or all of the specific `handleXXXX` methods
 * * Create a handler instance `myHandler`
 * * To send a `GeometryQuery` object `candidateGeometry` through the (fast) dispatch, invoke
 * `candidateGeometry.dispatchToHandler (myHandler).
 * * The appropriate method or methods will get called with a strongly typed `_g ` value.
 * @public
 */
class NullGeometryHandler extends GeometryHandler {
    /** No-action implementation */
    handleLineSegment3d(_g) {
        return undefined;
    }
    /** No-action implementation */
    handleLineString3d(_g) {
        return undefined;
    }
    /** No-action implementation */
    handleArc3d(_g) {
        return undefined;
    }
    /** No-action implementation */
    handleCurveCollection(_g) {
        return undefined;
    }
    /** No-action implementation */
    handleCurveChainWithDistanceIndex(_g) {
        return undefined;
    }
    /** No-action implementation */
    handleBSplineCurve3d(_g) {
        return undefined;
    }
    /** No-action implementation */
    handleInterpolationCurve3d(_g) {
        return undefined;
    }
    /** No-action implementation */
    handleAkimaCurve3d(_g) {
        return undefined;
    }
    /** No-action implementation */
    handleBSplineCurve3dH(_g) {
        return undefined;
    }
    /** No-action implementation */
    handleBSplineSurface3d(_g) {
        return undefined;
    }
    /** No-action implementation */
    handleCoordinateXYZ(_g) {
        return undefined;
    }
    /** No-action implementation */
    handleBSplineSurface3dH(_g) {
        return undefined;
    }
    /** No-action implementation */
    handleIndexedPolyface(_g) {
        return undefined;
    }
    /** No-action implementation */
    handleTransitionSpiral(_g) {
        return undefined;
    }
    /** No-action implementation */
    handlePath(_g) {
        return undefined;
    }
    /** No-action implementation */
    handleLoop(_g) {
        return undefined;
    }
    /** No-action implementation */
    handleParityRegion(_g) {
        return undefined;
    }
    /** No-action implementation */
    handleUnionRegion(_g) {
        return undefined;
    }
    /** No-action implementation */
    handleBagOfCurves(_g) {
        return undefined;
    }
    /** No-action implementation */
    handleSphere(_g) {
        return undefined;
    }
    /** No-action implementation */
    handleCone(_g) {
        return undefined;
    }
    /** No-action implementation */
    handleBox(_g) {
        return undefined;
    }
    /** No-action implementation */
    handleTorusPipe(_g) {
        return undefined;
    }
    /** No-action implementation */
    handleLinearSweep(_g) {
        return undefined;
    }
    /** No-action implementation */
    handleRotationalSweep(_g) {
        return undefined;
    }
    /** No-action implementation */
    handleRuledSweep(_g) {
        return undefined;
    }
    /** No-action implementation */
    handlePointString3d(_g) {
        return undefined;
    }
    /** No-action implementation */
    handleBezierCurve3d(_g) {
        return undefined;
    }
    /** No-action implementation */
    handleBezierCurve3dH(_g) {
        return undefined;
    }
}
exports.NullGeometryHandler = NullGeometryHandler;
/**
 * Implement GeometryHandler methods, but override `handleCurveCollection` so that all methods
 * that operate on a [[CurveCollection]] recurse to their children.
 * @public
 */
class RecurseToCurvesGeometryHandler extends GeometryHandler {
    /** No-action implementation */
    handleLineSegment3d(_g) {
        return undefined;
    }
    /** No-action implementation */
    handleLineString3d(_g) {
        return undefined;
    }
    /** No-action implementation */
    handleArc3d(_g) {
        return undefined;
    }
    /** No-action implementation */
    handleBSplineCurve3d(_g) {
        return undefined;
    }
    /** No-action implementation */
    handleInterpolationCurve3d(_g) {
        return undefined;
    }
    /** No-action implementation */
    handleAkimaCurve3d(_g) {
        return undefined;
    }
    /** No-action implementation */
    handleBSplineCurve3dH(_g) {
        return undefined;
    }
    /** No-action implementation */
    handleBSplineSurface3d(_g) {
        return undefined;
    }
    /** No-action implementation */
    handleCoordinateXYZ(_g) {
        return undefined;
    }
    /** No-action implementation */
    handleBSplineSurface3dH(_g) {
        return undefined;
    }
    /** No-action implementation */
    handleIndexedPolyface(_g) {
        return undefined;
    }
    /** No-action implementation */
    handleTransitionSpiral(_g) {
        return undefined;
    }
    /** Invoke `child.dispatchToGeometryHandler(this)` for each child in the array returned by the query `g.children` */
    handleChildren(g) {
        const children = g.children;
        if (children)
            for (const child of children) {
                child.dispatchToGeometryHandler(this);
            }
    }
    /** Recurse to children */
    handleCurveCollection(g) {
        return this.handleChildren(g);
    }
    /** No-action implementation */
    handleSphere(_g) {
        return undefined;
    }
    /** No-action implementation */
    handleCone(_g) {
        return undefined;
    }
    /** No-action implementation */
    handleBox(_g) {
        return undefined;
    }
    /** No-action implementation */
    handleTorusPipe(_g) {
        return undefined;
    }
    /** No-action implementation */
    handleLinearSweep(_g) {
        return undefined;
    }
    /** No-action implementation */
    handleRotationalSweep(_g) {
        return undefined;
    }
    /** No-action implementation */
    handleRuledSweep(_g) {
        return undefined;
    }
    /** No-action implementation */
    handlePointString3d(_g) {
        return undefined;
    }
    /** No-action implementation */
    handleBezierCurve3d(_g) {
        return undefined;
    }
    /** No-action implementation */
    handleBezierCurve3dH(_g) {
        return undefined;
    }
}
exports.RecurseToCurvesGeometryHandler = RecurseToCurvesGeometryHandler;
//# sourceMappingURL=GeometryHandler.js.map