/** @packageDocumentation
 * @module Geometry
 */
import { Id64String } from "@itwin/core-bentley";
import { Angle, AnyGeometryQuery, GeometryQuery, IModelJson as GeomJson, LowAndHighXYZ, Point2d, Point3d, Range3d, Transform, TransformProps, XYZProps, YawPitchRollAngles, YawPitchRollProps } from "@itwin/core-geometry";
import { ColorDefProps } from "../ColorDef";
import { GeometricElement2dProps, GeometricElement3dProps, GeometryPartProps, PlacementProps } from "../ElementProps";
import { BackgroundFill, FillDisplay, GeometryClass, GeometryParams } from "../GeometryParams";
import { Gradient } from "../Gradient";
import { AreaPattern } from "./AreaPattern";
import { ImageGraphic, ImageGraphicProps } from "./ImageGraphic";
import { LineStyle } from "./LineStyle";
import { TextString, TextStringProps } from "./TextString";
import { Base64EncodedString } from "../Base64EncodedString";
import { TextBlockGeometryProps } from "../annotation/TextBlockGeometryProps";
/** Establish a non-default [[SubCategory]] or to override [[SubCategoryAppearance]] for the geometry that follows.
 * A GeometryAppearanceProps always signifies a reset to the [[SubCategoryAppearance]] for subsequent [[GeometryStreamProps]] entries for undefined values.
 * @see [[GeometryStreamEntryProps]]
 * @public
 * @extensions
 */
export interface GeometryAppearanceProps {
    /** Optional [[SubCategory]] id for subsequent geometry. Use to create a GeometryStream with geometry that is not on the default [[SubCategory]] for the element's [[Category]] or is has geometry on multiple subCategories. */
    subCategory?: Id64String;
    /** Optional color to override [[SubCategoryAppearance.color]] for subsequent geometry. */
    color?: ColorDefProps;
    /** Optional weight to override [[SubCategoryAppearance.weight]] for subsequent geometry. */
    weight?: number;
    /** Optional style to override [[SubCategoryAppearance.styleId]] for subsequent geometry. */
    style?: Id64String;
    /** Optional transparency, 0.0 if undefined. Effective transparency is a combination of this value and [[SubCategoryAppearance.color]]. */
    transparency?: number;
    /** Optional display priority (2d only), 0 if undefined. Effective display priority is a combination of this value and [[SubCategoryAppearance.priority]]. */
    displayPriority?: number;
    /** Optional GeometryClass (for DGN compatibility, subCategories preferred), [[GeometryClass.Primary]] if undefined. */
    geometryClass?: GeometryClass;
}
/** Add a [[gradient]], [[backgroundFill]], or solid [[color]] fill to subsequent planar regions (or meshes).
 * Only one value among [[gradient]], [[backgroundFill]], and [[color]] should be set.
 * @see [[GeometryStreamEntryProps]]
 * @public
 * @extensions
 */
export interface AreaFillProps {
    /** Fill display type, must be set to something other than [[FillDisplay.Never]] to display fill */
    display: FillDisplay;
    /** Optional fill transparency, will be the same as outline transparency if undefined. Allows for different fill and outline transparencies */
    transparency?: number;
    /** Set fill color to view background color. Use [[BackgroundFill.Solid]] for an opaque fill and [[BackgroundFill.Outline]] to display an outline using the line color */
    backgroundFill?: BackgroundFill;
    /** Set fill color to a specific color. If the fill color the same as the line color, it is an opaque fill, otherwise it is an outline fill */
    color?: ColorDefProps;
    /** Set fill using gradient properties. */
    gradient?: Gradient.SymbProps;
}
/** Override [[SubCategoryAppearance.materialId]] for subsequent surface and solid geometry.
 * @see [[GeometryStreamEntryProps]]
 * @public
 * @extensions
 */
export interface MaterialProps {
    /** Material id to use, specify an invalid [[Id64]] to override [[SubCategoryAppearance.materialId]] with no material. */
    materialId?: Id64String;
    /** @internal */
    origin?: XYZProps;
    /** @internal */
    size?: XYZProps;
    /** @internal */
    rotation?: YawPitchRollProps;
}
/** JSON representation of a brep GeometryStream entry.
 * @public
 */
export declare namespace BRepEntity {
    /** Enum for type of solid kernel entity this represents */
    enum Type {
        /** Body consisting of at least one solid region */
        Solid = 0,
        /** Body consisting of connected sets of faces having edges that are shared by a maximum of two faces */
        Sheet = 1,
        /** Body consisting of connected sets of edges having vertices that are shared by a maximum of two edges */
        Wire = 2
    }
    /** Optional symbology that can be assigned to individual faces of a solid or sheet body */
    interface FaceSymbologyProps {
        /** Optional color override for face */
        color?: ColorDefProps;
        /** Optional transparency override for face */
        transparency?: number;
        /** Optional material override for face */
        materialId?: Id64String;
    }
    /** Geometry entry representing raw brep data.
     * @see [[GeometryStreamEntryProps]]
     */
    interface DataProps {
        /** data as Base64 encoded string. Must be specifically requested using [[ElementLoadProps.wantBRepData]]. */
        data?: Base64EncodedString;
        /** body type, default is Solid */
        type?: Type;
        /** body transform, default is identity */
        transform?: TransformProps;
        /** body face attachments */
        faceSymbology?: FaceSymbologyProps[];
    }
}
/** Add a reference to a [[GeometryPart]] from the GeometryStream of a [[GeometricElement]].
 * @see [[GeometryStreamEntryProps]]
 * @public
 * @extensions
 */
export interface GeometryPartInstanceProps {
    /** GeometryPart id */
    part: Id64String;
    /** Optional translation relative to element's placement, 0.0,0.0,0.0 if undefined. For a 2d element/translation, supply non-zero x and y only */
    origin?: XYZProps;
    /** Optional rotation relative to element's placement, 0.0,0.0,0.0 if undefined. For a 2d element/rotation, supply a non-zero yaw angle only */
    rotation?: YawPitchRollProps;
    /** Optional scale to apply to part, 1.0 if undefined */
    scale?: number;
}
/** Flags applied to the entire contents of a [[GeometryStreamProps]].
 * @see GeometryStreamHeaderProps
 * @public
 * @extensions
 */
export declare enum GeometryStreamFlags {
    /** No flags. */
    None = 0,
    /** When the geometry is displayed, it is always oriented to face the viewer. The placement origin of the element associated with the geometry is used as the rotation point.
     * If the placement origin is outside of the view, the geometry will not necessarily be displayed, even if rotating it to face the viewer would cause its range to intersect the viewed volume.
     */
    ViewIndependent = 1
}
/** An entry in a [[GeometryStreamProps]] containing [[GeometryStreamFlags]] that apply to the geometry stream as a whole.
 * If this entry exists in the [[GeometryStreamProps]] array, it will always be the *first* entry.
 * @public
 * @extensions
 */
export interface GeometryStreamHeaderProps {
    /** The flags applied to the geometry stream. */
    flags: GeometryStreamFlags;
}
/** Allowed GeometryStream entries - should only set one value.
 * @see [GeometryStream]($docs/learning/common/geometrystream.md)
 * @public
 * @extensions
 */
export interface GeometryStreamEntryProps extends GeomJson.GeometryProps {
    header?: GeometryStreamHeaderProps;
    appearance?: GeometryAppearanceProps;
    styleMod?: LineStyle.ModifierProps;
    fill?: AreaFillProps;
    pattern?: AreaPattern.ParamsProps;
    material?: MaterialProps;
    geomPart?: GeometryPartInstanceProps;
    textString?: TextStringProps;
    brep?: BRepEntity.DataProps;
    image?: ImageGraphicProps;
    subRange?: LowAndHighXYZ;
}
/** A [[GeometricElement]]'s GeometryStream is represented by an array of [[GeometryStreamEntryProps]].
 * @public
 * @extensions
 */
export type GeometryStreamProps = GeometryStreamEntryProps[];
/** GeometryStreamBuilder is a helper class for populating the [[GeometryStreamProps]] array needed to create a [[GeometricElement]] or [[GeometryPart]].
 * @public
 */
export declare class GeometryStreamBuilder {
    /** Current inverse placement transform, used for converting world coordinate input to be placement relative */
    private _worldToLocal?;
    /** GeometryStream entries */
    readonly geometryStream: GeometryStreamProps;
    /** Supply optional local to world transform. Used to transform world coordinate input relative to element placement.
     * For a [[GeometricElement]]'s placement to be meaningful, world coordinate geometry should never be appended to an element with an identity placement.
     * Can be called with undefined or identity transform to start appending geometry supplied in local coordinates again.
     */
    setLocalToWorld(localToWorld?: Transform): void;
    /** Supply local to world transform from a Point3d and optional YawPitchRollAngles.
     * @see [[Placement3d]]
     */
    setLocalToWorld3d(origin: Point3d, angles?: YawPitchRollAngles): void;
    /** Supply local to world transform from a Point2d and optional Angle.
     * @see [[Placement2d]]
     */
    setLocalToWorld2d(origin: Point2d, angle?: Angle): void;
    /** Supply local to world transform from a PlacementProps2d or PlacementProps3d.
     * @see [[PlacementProps]]
     */
    setLocalToWorldFromPlacement(props: PlacementProps): void;
    /** Store local ranges in GeometryStream for all subsequent geometry appended. Can improve performance of range testing for elements with a GeometryStream
     * containing more than one [[GeometryQuery]] differentiable by range. Not useful for a single [[GeometryQuery]] as its range and that of the [[GeometricElement]] are the same.
     * Ignored when defining a [[GeometryPart]] and not needed when only appending [[GeometryPart]] instances to a [[GeometricElement]] as these store their own range.
     */
    appendGeometryRanges(): void;
    /** Change [[SubCategory]] or reset to [[SubCategoryAppearance]] for subsequent geometry.
     *  An invalid sub-category id can be supplied to force a reset to the current [[SubCategoryAppearance]].
     *  It is not valid to change the sub-category when defining a [[GeometryPart]]. A [[GeometryPart]] inherit the symbology of their instance for anything not explicitly overridden.
     */
    appendSubCategoryChange(subCategoryId: Id64String): boolean;
    /** Change [[GeometryParams]] for subsequent geometry.
     *  It is not valid to change the sub-category when defining a [[GeometryPart]]. A [[GeometryPart]] inherits the symbology of their instance for anything not explicitly overridden.
     */
    appendGeometryParamsChange(geomParams: GeometryParams): boolean;
    /** Append a [[GeometryPart]] instance with relative position, orientation, and scale to a [[GeometryStreamProps]] array for creating a [[GeometricElement3d]].
     *  Not valid when defining a [[GeometryPart]] as nesting of parts is not supported.
     */
    appendGeometryPart3d(partId: Id64String, instanceOrigin?: Point3d, instanceRotation?: YawPitchRollAngles, instanceScale?: number): boolean;
    /** Append a [[GeometryPart]] instance with relative position, orientation, and scale to a [[GeometryStreamProps]] array for creating a [[GeometricElement2d]].
     *  Not valid when defining a [[GeometryPart]] as nesting of parts is not supported.
     */
    appendGeometryPart2d(partId: Id64String, instanceOrigin?: Point2d, instanceRotation?: Angle, instanceScale?: number): boolean;
    /** Append a [[TextString]] supplied in either local or world coordinates to the [[GeometryStreamProps]] array */
    appendTextString(textString: TextString): boolean;
    /** Append a series of entries representing a [[TextBlock]] to the [[GeometryStreamProps]] array.
     * @beta
     */
    appendTextBlock(block: TextBlockGeometryProps): boolean;
    /** Append an [[ImageGraphic]] supplied in either local or world coordinates. */
    appendImage(image: ImageGraphic): boolean;
    /** Append a [[GeometryQuery]] supplied in either local or world coordinates to the [[GeometryStreamProps]] array */
    appendGeometry(geometry: GeometryQuery): boolean;
    /** Append [[BRepEntity.DataProps]] supplied in either local or world coordinates to the [[GeometryStreamProps]] array
     * @beta
     */
    appendBRepData(brep: BRepEntity.DataProps): boolean;
    /** @internal */
    getHeader(): GeometryStreamHeaderProps | undefined;
    /** @internal */
    obtainHeader(): GeometryStreamHeaderProps;
    /** Controls whether or not the geometry in the stream should be displayed as view-independent.
     * When view-independent geometry is displayed, it is always oriented to face the viewer, using the placement origin of the element as the rotation point.
     * If the placement origin is outside of the view, the geometry will not necessarily be displayed, even if rotating it to face the viewer would cause its range to intersect the viewed volume
     * @public
     */
    get isViewIndependent(): boolean;
    set isViewIndependent(viewIndependent: boolean);
}
/** Represents a text string within a GeometryStream.
 * @public
 * @extensions
 */
export interface TextStringPrimitive {
    type: "textString";
    readonly textString: TextString;
}
/** Represents an image within a GeometryStream.
 * @public
 * @extensions
 */
export interface ImagePrimitive {
    type: "image";
    readonly image: ImageGraphic;
}
/** Represents a reference to a GeometryPart within a GeometryStream.
 * @public
 * @extensions
 */
export interface PartReference {
    type: "partReference";
    part: {
        id: Id64String;
        readonly toLocal?: Transform;
    };
}
/** Represents a BRep within a GeometryStream.
 * @public
 * @extensions
 */
export interface BRepPrimitive {
    type: "brep";
    /** @beta */
    readonly brep: BRepEntity.DataProps;
}
/** Represents one of a variety of GeometryQuery objects within a GeometryStream.
 * @public
 * @extensions
 */
export interface GeometryPrimitive {
    type: "geometryQuery";
    readonly geometry: AnyGeometryQuery;
}
/** Union of all possible geometric primitive types that may appear within a GeometryStream.
 * @public
 * @extensions
 */
export type GeometryStreamPrimitive = TextStringPrimitive | PartReference | BRepPrimitive | GeometryPrimitive | ImagePrimitive;
/** Holds current state information for [[GeometryStreamIterator]]. Each entry represents exactly one geometry primitive in the stream.
 * @public
 * @extensions
 */
export interface GeometryStreamIteratorEntry {
    /** A [[GeometryParams]] representing the appearance of the current geometric entry */
    readonly geomParams: GeometryParams;
    /** Placement transform, used for converting placement relative, local coordinate entries to world */
    readonly localToWorld?: Transform;
    /** Optional stored local range for the current geometric entry */
    readonly localRange?: Range3d;
    /** Returns the geometric primitive represented by this entry. */
    readonly primitive: GeometryStreamPrimitive;
}
/** GeometryStreamIterator is a helper class for iterating a [[GeometryStreamProps]].
 * A [[GeometricElement]]'s GeometryStream must be specifically requested using [[ElementLoadProps.wantGeometry]].
 * Each [[GeometryStreamIteratorEntry]] returned by the iterator represents exactly one geometric primitive in the stream.
 * @public
 */
export declare class GeometryStreamIterator implements IterableIterator<GeometryStreamIteratorEntry> {
    /** GeometryStream entries */
    geometryStream: GeometryStreamProps;
    /** Flags applied to the entire geometry stream. */
    readonly flags: GeometryStreamFlags;
    /** Current entry position */
    private _index;
    /** Allocated on first call to next() and reused thereafter. */
    private _entry?;
    /** Used to initialize this._entry. */
    private readonly _appearance;
    private readonly _localToWorld?;
    /** Construct a new GeometryStreamIterator given a [[GeometryStreamProps]] from either a [[GeometricElement3d]], [[GeometricElement2d]], or [[GeometryPart]].
     * Supply the [[GeometricElement]]'s category to initialize the appearance information for each geometric entry.
     */
    constructor(geometryStream: GeometryStreamProps, categoryOrGeometryParams?: Id64String | GeometryParams, localToWorld?: Transform);
    private get entry();
    /** Create a new GeometryStream iterator for a [[GeometricElement3d]].
     * If [[GeometricElement3dProps.placement]] is not undefined, placement relative entries will be returned transformed to world coordinates.
     * @throws [[IModelError]] if element.geom is undefined.
     */
    static fromGeometricElement3d(element: Pick<GeometricElement3dProps, "geom" | "placement" | "category">): GeometryStreamIterator;
    /** Create a new GeometryStream iterator for a [[GeometricElement2d]].
     * If [[GeometricElement2dProps.placement]] is not undefined, placement relative entries will be returned transformed to world coordinates.
     * @throws [[IModelError]] if element.geom is undefined.
     */
    static fromGeometricElement2d(element: Pick<GeometricElement2dProps, "geom" | "placement" | "category">): GeometryStreamIterator;
    /** Create a new GeometryStream iterator for a [[GeometryPart]].
     * To iterate a part's GeometryStream in the context of a part instance found for a [[GeometricElement]], provide the optional [[GeometryParams]] and Transform from the [[GeometricElement]]'s [[GeometryStreamIterator]].
     * Supply the [[GeometryParams]] to return appearance information as inherited from the [[GeometricElement]].
     * Supply the partToWorld transform to return the part geometry in world coordinates.
     * Supply the partToLocal transform to return the part geometry relative to the [[GeometricElement]]'s placement.
     * @throws [[IModelError]] if geomPart.geom is undefined.
     */
    static fromGeometryPart(geomPart: Pick<GeometryPartProps, "geom">, geomParams?: GeometryParams, partTransform?: Transform): GeometryStreamIterator;
    /** Get the transform that if applied to a [[GeometryPart]]'s GeometryStream entries would return them in world coordinates. */
    partToWorld(): Transform | undefined;
    /** Advance to next displayable geometric entry while updating the current [[GeometryParams]] from appearance related entries.
     * Geometric entries are [[TextString]], [[GeometryQuery]], [[GeometryPart]], [[ImageGraphic]], and [[BRepEntity.DataProps]].
     */
    next(): IteratorResult<GeometryStreamIteratorEntry>;
    [Symbol.iterator](): IterableIterator<GeometryStreamIteratorEntry>;
    /** @internal */
    get isViewIndependent(): boolean;
}
//# sourceMappingURL=GeometryStream.d.ts.map