import { Color, Disposable, Listener } from '@vertexvis/utils'; /** * The types of pins that can be performed by this tool. */ export type ViewerPinToolType = 'pin-icon' | 'pin-text'; /** * The mode of the pin tool */ export type ViewerPinToolMode = 'edit' | 'view'; /** * A model representing the state of pins. * */ import { Point, Vector3 } from '@vertexvis/geometry'; interface BasePinAttributes { style?: PinStyleAttributes; } interface BasePin { id: string; worldPosition: Vector3.Vector3; partId?: string; attributes?: BasePinAttributes; } export interface TextPin extends BasePin { type: 'text'; label: PinLabel; } export interface IconPin extends BasePin { type: 'icon'; } export type Pin = IconPin | TextPin; export interface PinLabel { point: Point.Point; text?: string; } export declare function isTextPin(pin?: Pin): pin is TextPin; export interface PinStyleAttributes { primaryColor?: Color.Color | string; accentColor?: Color.Color | string; } export declare function isIconPin(pin?: Pin): pin is Pin; export declare function getPinColors(pin?: Pin): { primaryColor?: string; accentColor?: string; }; export declare class PinModel { private entities; private selectedPinId?; private readonly entityAdded; private readonly entityUpdated; private readonly entitiesChanged; private readonly selectionChanged; /** * Registers an entity to be drawn in the canvas * * @param pin A pin entity to draw. * @returns `true` if the entity has been added. */ addPin(pin: Pin, suppressEvent?: boolean): boolean; /** * Clears all registered entities from the model. */ clearPins(): void; /** * Returns all the entities registered with the model. */ getPins(): Pin[]; /** * Returns single entity by id if present in the model. */ getPinById(id: string): Pin | undefined; getSelectedPinId(): string | undefined; /** * Unregisters an entity from the model. * * @param entity The entity to remove. * @returns `true` if the entity was removed. */ removePin(entity: Pin): boolean; /** * Sets the set of entities to be placed with the model. * * @param entities A set of entities to draw. * @returns `true` if the entity has been added. */ setPins(pins: Set): boolean; /** * Sets the set of entities to be placed with the model. * * @param pin A pin to set * @returns `true` if the entity has been set */ setPin(pin: Pin): boolean; /** * Updates a pin in the model. * * @param pin A pin to update * @returns `true` if the entity has been updated */ updatePin(pin: Pin): boolean; /** * Registers an event listener that will be invoked when the model's * pin entities change. * * @param listener The listener to add. * @returns A disposable that can be used to remove the listener. */ onEntitiesChanged(listener: Listener): Disposable; /** * Registers an event listener that will be invoked when a new pin * is added to the model. * * @param listener The listener to add. * @returns A disposable that can be used to remove the listener. */ onEntityAdded(listener: Listener): Disposable; /** * Registers an event listener that will be invoked when a pin * is updated in the model. * * @param listener The listener to add. * @returns A disposable that can be used to remove the listener. */ onEntityUpdated(listener: Listener): Disposable; /** * Registers an event listener that will be invoked when the model's * pin selection changes * * @param listener The listener to add. * @returns A disposable that can be used to remove the listener. */ onSelectionChange(listener: Listener): Disposable; /** * Sets the selected pin id * @param pinId */ setSelectedPin(pinId?: string): void; } export {};