import { Point, Rectangle } from '@vertexvis/geometry'; import { PmiAnnotationOperationsBuilder, SceneItemOperationsBuilder } from './scene'; interface AllQueryExpression { type: 'all'; } export interface SceneTreeRange { start: number; end: number; } export interface AnnotationQueryExpression { type: 'annotation-id'; value: string; } interface ItemQueryExpression { type: 'item-id' | 'supplied-id'; value: string; } export interface AndExpression { type: 'and'; expressions: QueryExpression[]; } export interface OrExpression { type: 'or'; expressions: QueryExpression[]; } interface SceneTreeRangeQueryExpression { type: 'scene-tree-range'; range: SceneTreeRange; } interface NotQueryExpression { type: 'not'; query: QueryExpression; } interface MetadataQueryExpression { type: 'metadata'; filter: string; keys: string[]; exactMatch: boolean; removeHiddenItems?: boolean; } interface AllSelectedQueryExpression { type: 'all-selected'; } interface AllVisibleQueryExpression { type: 'all-visible'; } interface PointQueryExpression { type: 'point'; point: Point.Point; } interface VolumeIntersectionQueryExpression { type: 'volume-intersection'; rectangle: Rectangle.Rectangle; exclusive: boolean; } /** * Represents the sum of all possible types of expressions. */ export type QueryExpression = AllQueryExpression | AnnotationQueryExpression | ItemQueryExpression | AndExpression | OrExpression | SceneTreeRangeQueryExpression | PointQueryExpression | VolumeIntersectionQueryExpression | MetadataQueryExpression | AllSelectedQueryExpression | AllVisibleQueryExpression | NotQueryExpression; /** * An interface that represents a query is "complete" and can be turned into an * expression. */ declare abstract class TerminalQuery { protected inverted: boolean; constructor(inverted: boolean); build(): QueryExpression; abstract queryExpressionBuilder(): QueryExpression; } interface ItemQuery { withItemId(id: string): N; withSuppliedId(id: string): N; } interface AnnotationQuery { withAnnotationId(id: string): N; } interface BooleanQuery { and(): AndSceneItemQuery; or(): OrSceneItemQuery; } interface BooleanAnnotationQuery { and(): AndAnnotationQuery; or(): OrAnnotationQuery; } export declare class RootQuery implements ItemQuery { private inverted; constructor(inverted?: boolean); /** * Specifies that the operation should be performed on all items in the scene. * * @example * ```typescript * const viewer = document.querySelector('vertex-viewer'); * const scene = await viewer.scene(); * * // Deselect all items in the scene * await scene.elements((op) => [op.items.where((q) => q.all()).deselect()]).execute(); * ``` */ all(): AllQuery; /** * Specifies that the operation should be performed on all items that do not match any following queries. * * @example * ```typescript * const viewer = document.querySelector('vertex-viewer'); * const scene = await viewer.scene(); * * // Hide all items that are not selected * await scene.elements((op) => [op.items.where((q) => q.not().withSelected()).hide()]).execute(); * ``` */ not(): RootQuery; /** * Specifies that the operation should be performed on any item matching any one of the provided IDs. * * @example * ```typescript * const viewer = document.querySelector('vertex-viewer'); * const scene = await viewer.scene(); * * // Hide the item with the `item-uuid-1` ID and the `item-uuid-2` ID * await scene.elements((op) => [ * op.items.where((q) => q.withItemIds(['item-uuid-1', 'item-uuid-2'])).hide(), * ]).execute(); * ``` */ withItemIds(ids: string[]): BulkQuery; /** * Specifies that the operation should be performed on any item matching any one of the provided custom supplied IDs. * * @example * ```typescript * const viewer = document.querySelector('vertex-viewer'); * const scene = await viewer.scene(); * * // Hide the item with the `item-supplied-id-1` supplied ID * // and the `item-supplied-id-2` supplied ID * await scene.elements((op) => [ * op * .items.where((q) => q.withItemIds(['item-supplied-id-1', 'item-supplied-id-2'])) * .hide(), * ]).execute(); * ``` */ withSuppliedIds(ids: string[]): BulkQuery; /** * Specifies that the operation should be performed on any item matching the provided ID. * * @example * ```typescript * const viewer = document.querySelector('vertex-viewer'); * const scene = await viewer.scene(); * * // Hide the item with the `item-uuid` ID * await scene.elements((op) => [ * op.items.where((q) => q.withItemId('item-uuid')).hide(), * ]).execute(); * ``` */ withItemId(id: string): SingleSceneItemQuery; /** * Specifies that the operation should be performed on any item matching the provided custom supplied ID. * * @example * ```typescript * const viewer = document.querySelector('vertex-viewer'); * const scene = await viewer.scene(); * * // Hide the item with the `item-supplied-id` supplied ID * await scene.elements((op) => [ * op.items.where((q) => q.withSuppliedId('item-supplied-id')).hide(), * ]).execute(); * ``` */ withSuppliedId(id: string): SingleSceneItemQuery; /** * Specifies that the operation should be performed on a range within the `` component. * * @example * ```typescript * const viewer = document.querySelector('vertex-viewer'); * const scene = await viewer.scene(); * * // Hide all items from the 2nd row to the 5th row of the scene-tree * await scene.elements((op) => [ * op * .items.where((q) => * q.withSceneTreeRange({ * start: 2, * end: 5, * }) * ) * .hide(), * ]).execute(); * ``` */ withSceneTreeRange(range: SceneTreeRange): SceneTreeRangeQuery; /** * Specifies that the operation should be performed on any item that has a metadata value matching the * filter provided for any of the keys specified. Can optionally be set to perform an exactMatch, * which will require that the filter matches the value exactly. * * @example * ```typescript * const viewer = document.querySelector('vertex-viewer'); * const scene = await viewer.scene(); * * // Hide all items where the `PART_NAME_KEY` includes a value of `PartName` * await scene.elements((op) => [ * op.items.where((q) => q.withMetadata('PartName', ['PART_NAME_KEY'])).hide(), * ]).execute(); * * // Hide all items where the `PART_NAME_KEY` has exactly a value of `PartName` * await scene.elements((op) => [ * op.items.where((q) => q.withMetadata('PartName', ['PART_NAME_KEY'], true)).hide(), * ]).execute(); * ``` */ withMetadata(filter: string, keys: string[], exactMatch: boolean, removeHiddenItems?: boolean): MetadataQuery; /** * Specifies that the operation should be performed on any item that has been selected. * * @example * ```typescript * const viewer = document.querySelector('vertex-viewer'); * const scene = await viewer.scene(); * * // Hide all items that are selected * await scene.elements((op) => [op.items.where((q) => q.withSelected()).hide()]).execute(); * ``` */ withSelected(): AllSelectedQuery; /** * Specifies that the operation should be performed on any item that is visible. * * @example * ```typescript * const viewer = document.querySelector('vertex-viewer'); * const scene = await viewer.scene(); * * // Select all items that are visible * await scene.elements((op) => [op.items.where((q) => q.withVisible()).select()]).execute(); * ``` */ withVisible(): AllVisibleQuery; /** * Specifies that the operation should be performed on any item present at the provided `point` in the image. * This query operates on the item found at that `point` similar to using `withItemId` in combination with * `raycaster.hitItems`, which can be useful if the additional metadata from the `raycaster.hitItems` * method is not needed to eliminate a network request. * * @example * ```typescript * const viewer = document.querySelector('vertex-viewer'); * const scene = await viewer.scene(); * * // Select the item present at the [100, 100] coordinate of the image * await scene.elements((op) => [ * op.items.where((q) => q.withPoint(Point.create(100, 100))).select(), * ]).execute(); * ``` */ withPoint(point: Point.Point): PointQuery; /** * Specifies that the operation should be performed on items within the specified `rectangle` boundary * within the Viewer. The `exclusive` flag here determines whether items that intersect with the `rectangle`, * but are not contained should be included in the result. * * @example * ```typescript * const viewer = document.querySelector('vertex-viewer'); * const scene = await viewer.scene(); * // Select all items within the specified 100x100 region of the image * // excluding any elements that are not fully contained by the region * await scene.elements((op) => [ * op * .items.where((q) => * q.withVolumeIntersection( * Rectangle.create(100, 100, 100, 100), * true * ) * ) * .hide(), * ]).execute(); * // Select all items within the specified 100x100 region of the image * // including any elements that intersect with the region * await scene.elements((op) => [ * op * .items.where((q) => * q.withVolumeIntersection( * Rectangle.create(100, 100, 100, 100), * false * ) * ) * .hide(), * ]).execute(); * ``` */ withVolumeIntersection(rectangle: Rectangle.Rectangle, exclusive?: boolean): VolumeIntersectionQuery; } export declare class NotSceneItemQuery extends RootQuery { constructor(inverted: boolean); } export declare class PmiAnnotationRootQuery implements AnnotationQuery { private inverted; constructor(inverted?: boolean); /** * Specifies that the operation should be performed on all PMI annotations in the scene. * * @example * ```typescript * const viewer = document.querySelector('vertex-viewer'); * const scene = await viewer.scene(); * * // Deselect all PMI annotations in the scene * await scene.elements((op) => [op.annotations.where((q) => q.all()).deselect()]).execute(); * ``` */ all(): AllQuery; /** * Specifies that the operation should be performed on all annotations that do not match any following queries. * * @example * ```typescript * const viewer = document.querySelector('vertex-viewer'); * const scene = await viewer.scene(); * * // Hide all PMI annotations that are not selected * await scene.elements((op) => [op.annotations.where((q) => q.not().withSelected()).hide()]).execute(); * ``` */ not(): PmiAnnotationRootQuery; /** * Specifies that the operation should be performed on any annotation matching any one of the provided IDs. * * @example * ```typescript * const viewer = document.querySelector('vertex-viewer'); * const scene = await viewer.scene(); * * // Hide the annotation with the `item-uuid-1` ID and the `item-uuid-2` ID * await scene.elements((op) => [ * op.annotations.where((q) => q.withAnnotationIds(['item-uuid-1', 'item-uuid-2'])).hide(), * ]).execute(); * ``` */ withAnnotationIds(ids: string[]): BulkQuery; /** * Specifies that the operation should be performed on any annotation matching the provided ID. * * @example * ```typescript * const viewer = document.querySelector('vertex-viewer'); * const scene = await viewer.scene(); * * // Hide the item with the `item-uuid` ID * await scene.elements((op) => [ * op.annotations.where((q) => q.withAnnotationId('item-uuid')).hide(), * ]).execute(); * ``` */ withAnnotationId(id: string): SingleAnnotationQuery; } export declare class NotAnnotationQuery extends PmiAnnotationRootQuery { constructor(inverted: boolean); } export declare class AllQuery extends TerminalQuery { constructor(inverted?: boolean); queryExpressionBuilder(): QueryExpression; } export declare class SceneTreeRangeQuery extends TerminalQuery { private readonly range; constructor(range: SceneTreeRange, inverted: boolean); queryExpressionBuilder(): SceneTreeRangeQueryExpression; } export declare class MetadataQuery extends TerminalQuery { private filter; private keys; private exactMatch; private removeHiddenItems?; constructor(filter: string, keys: string[], exactMatch: boolean, inverted: boolean, removeHiddenItems?: boolean | undefined); queryExpressionBuilder(): MetadataQueryExpression; } export declare class AllSelectedQuery extends TerminalQuery { constructor(inverted: boolean); queryExpressionBuilder(): AllSelectedQueryExpression; } export declare class AllVisibleQuery extends TerminalQuery { constructor(inverted: boolean); queryExpressionBuilder(): AllVisibleQueryExpression; } export declare class PointQuery extends TerminalQuery { private point; constructor(point: Point.Point, inverted: boolean); queryExpressionBuilder(): PointQueryExpression; } export declare class VolumeIntersectionQuery extends TerminalQuery { private rectangle; private exclusive?; constructor(rectangle: Rectangle.Rectangle, inverted: boolean, exclusive?: boolean | undefined); queryExpressionBuilder(): VolumeIntersectionQueryExpression; } export declare class BulkQuery extends TerminalQuery { private ids; private type; constructor(ids: string[], type: 'item-id' | 'supplied-id' | 'annotation-id', inverted: boolean); queryExpressionBuilder(): QueryExpression; } declare class SingleSceneItemQuery extends TerminalQuery implements BooleanQuery { private query; constructor(query: QueryExpression, inverted: boolean); queryExpressionBuilder(): QueryExpression; and(): AndSceneItemQuery; or(): OrSceneItemQuery; } export declare class OrSceneItemQuery extends TerminalQuery implements ItemQuery { private expressions; constructor(expressions: QueryExpression[], inverted: boolean); queryExpressionBuilder(): QueryExpression; withItemId(id: string): OrSceneItemQuery; withSuppliedId(id: string): OrSceneItemQuery; or(): this; } export declare class AndSceneItemQuery extends TerminalQuery implements ItemQuery { private expressions; constructor(expressions: QueryExpression[], inverted: boolean); queryExpressionBuilder(): QueryExpression; withItemId(id: string): AndSceneItemQuery; withSuppliedId(id: string): AndSceneItemQuery; and(): this; } declare class SingleAnnotationQuery extends TerminalQuery implements BooleanAnnotationQuery { private query; constructor(query: QueryExpression, inverted: boolean); queryExpressionBuilder(): QueryExpression; and(): AndAnnotationQuery; or(): OrAnnotationQuery; } export declare class OrAnnotationQuery extends TerminalQuery implements AnnotationQuery { private expressions; constructor(expressions: QueryExpression[], inverted: boolean); queryExpressionBuilder(): QueryExpression; withAnnotationId(id: string): OrAnnotationQuery; or(): this; } export declare class AndAnnotationQuery extends TerminalQuery implements AnnotationQuery { private expressions; constructor(expressions: QueryExpression[], inverted: boolean); queryExpressionBuilder(): QueryExpression; withAnnotationId(id: string): AndAnnotationQuery; and(): this; } export declare class SceneElementQueryExecutor { get items(): SceneItemQueryExecutor; get annotations(): PmiAnnotationsQueryExecutor; } export declare class PmiAnnotationsQueryExecutor { where(query: (q: PmiAnnotationRootQuery) => TerminalQuery): PmiAnnotationOperationsBuilder; } export declare class SceneItemQueryExecutor { where(query: (q: RootQuery) => TerminalQuery): SceneItemOperationsBuilder; } export {};