import { GeometryStage } from "../methods/geometry.js"; import { NativePcmItem, PcmItem } from "./item.js"; /** * A geometry from the PCM. */ export interface PcmGeometry extends PcmItem { /** * A unique but human-readable alias of the geometry. */ alias?: string; /** * The url to the geometry in the GLTF format. */ url: string; /** * The url to the geometry's icon. */ iconUrl?: string; /** * The default scale of the geometry. */ defaultScale: [number, number, number]; /** * Whether or not the geometry should automatically scale with the mappings. */ scaleWithMapping: boolean; /** * Whether or not this geometry supports cutout textures. * * While you can still set cutout textures for unsupported geometries, the * rendering might be buggy. */ supportsCutoutTextures: boolean; /** * The stages of the geometry. * * A stage is an area on the geometry that a texture can be drawn on. */ stages: PcmGeometryStage[]; /** * @internal */ overrideConfig?: PcmOverrideConfig; } /** * An area on a geometry that a texture can be drawn on. */ export type PcmGeometryStage = GeometryStage & { /** * The human-readable display name of the stage. */ displayName: string; /** * A normal vector that can be used to rotate to this stage. */ normalVector: [number, number, number]; /** * Size of the (flattened) stage surface in millimeters. * * If the stage is not rectangular the size defines the bounding box of the label. */ size?: [number, number]; }; /** * @internal The geometry how it is returned by the PCM api. */ interface NativePcmGeometry extends NativePcmItem { alias?: string; baseModelFile: string; iconUrl: string | null; baseIsOverlayMaterial: boolean; overlayKeepAspectRatio: boolean; available: boolean; useCutoutTexture: boolean; defaultScale: [number, number, number]; stages: { [stageId: string]: NativePcmGeometryStage; }; scaleWithMapping: boolean; special: boolean; overrideConfig?: PcmOverrideConfig; } /** * @internal The geometry stage how it is returned by the PCM api. */ interface NativePcmGeometryStage { name: string; normalVector: [number, number, number]; tris: []; uvColor: [number, number, number]; axes?: [number, number]; size?: [number, number]; } /** * Checks if the given object is a PcmGeometry. * * @param obj The object to check. * @returns True if the object is a PcmGeometry, false otherwise. */ export declare function isPcmGeometry(obj: unknown): obj is PcmGeometry; /** * Gets a list with all available geometries. * * @param auth The authorisation information. * @param baseUrl The base url. * @returns A list with all available geometries. */ export declare function getGeometries(auth?: import("../methods/auth.js").Auth, baseUrl?: string): Promise; /** * Gets an geometry by its id. * * Using the id is not filtered (e.g., permissions, deprecations, etc.) and may * return elements that are not returned by {@link getGeometries}. * * @param id The id of the geometry. * @param auth The authorisation information. * @param baseUrl The base url. * @returns The geometry with the given id or undefined if no geometry with the * given id exists. */ export declare function getGeometryById(id: string, auth?: import("../methods/auth.js").Auth, baseUrl?: string): Promise; /** * Subset of the `EditablePcmGeometryData` that are required for the * modification and creation of a geometry */ export type EditablePcmGeometryData = Pick & { stages: EditablePcmGeometryStage[]; }; /** * Subset of the `PcmGeometryStage` that are required for the * modification and creation of a geometry */ export type EditablePcmGeometryStage = Pick & Partial>; /** * @internal * Subset of the `NativePcmGeometry` that are required for the * modification and creation of a geometry */ export type NativeEditablePcmGeometryData = Pick & { stages: { [stageId: string]: Pick & Partial>; }; }; /** * Creates a new geometry with a given glTF 2.0 file and configuration. * * If the file or configuration is invalid a exception is thrown. * * After a successful creation the access right `PermissionRole.OWNER` is * automatically added to the newly created item * * @param temporaryFileId Reference of the uploaded glTF 2.0 file. It can be * obtained with the `validateGeometryFile()` function. * @param config The user defined configuration of the geometry. * @param auth The authorisation information. * @param baseUrl The base url. * @returns The newly created geometry */ export declare function createGeometry(temporaryFileId: string, config: EditablePcmGeometryData, auth?: import("../methods/auth.js").Auth, baseUrl?: string): Promise; /** * Partially updates the values of the given geometry. * * This requires `PermissionRole.OWNER` access rights on the given item. * Otherwise a exception is thrown. * * @param geometryId The id of the geometry that should be modified * @param config The values that should be updated for the geometry * @param auth The authorisation information. * @param baseUrl The base url. * @returns The updated geometry */ export declare function patchGeometry(geometryId: string, config: Partial, auth?: import("../methods/auth.js").Auth, baseUrl?: string): Promise; /** * Permanently deletes the given geometry. This action can`t be reverted! * * This requires `PermissionRole.OWNER` access rights on the given item. * Otherwise a exception is thrown. * * @param geometry The geometry that should be deleted * @param auth The authorisation information. * @param baseUrl The base url. * @returns `true` if the deletion was successful. Otherwise `false` */ export declare function deleteGeometry(geometry: PcmGeometry, auth?: import("../methods/auth.js").Auth, baseUrl?: string): Promise; /** * @internal Possible overrides for a geometry */ export interface PcmOverrideConfig { presets?: PcmOverridePreset[]; defaultPreset?: string; propertyOverrides?: PcmPropertyOverride[]; } /** * @internal Override presets for a geometry. Components are referencing PropertyOverrides */ export interface PcmOverridePreset { id: string; name: string; visible: boolean; components: Array<{ property: string; selection: string; }>; } /** * @internal Override settings for a property */ export interface PcmPropertyOverride { id: string; target: string[]; name: string; customData: unknown; visible: boolean; options: Array<{ id: string; name: string; data: Record | Array>; visible: boolean; }>; } export {};