import * as BABYLON from '@babylonjs/core'; /** * uv动画参数 */ export type UvAnimation = { textureName: string; xSpeed: number; ySpeed: number; }; export type ComponentType = 'building' | 'equ'; export type ActionCb = { name: string; type: ComponentType; ids: string[]; objects: BABYLON.AbstractMesh[]; modelName: string; position: Point3D; isHighLighting: boolean; isSelected: boolean; }; /** * 建筑交互的回调函数 */ export type BuildingActionCb = ActionCb; /** * 设备交互的回调函数 */ export type EquActionCb = BuildingActionCb & { buildingName: string; equName: string; category: string; }; /** * 点 */ export type Point2D = { x: number; y: number; }; /** * 点 */ export type Point3D = { x: number; y: number; z: number; }; /** * 颜色 */ export type Color3 = { r: number; g: number; b: number; }; /** * 几何信息 */ export interface Transform3D { position: Point3D; rotation: Point3D; scale: Point3D; } /** * 相机几何信息 */ export interface CameraTransform { position: Point3D; target: Point3D; rotation: Point3D; } /** * 镜头基类 */ export interface IViewPort extends CameraTransform { name: string; fov: number; } /** * 预览镜头 */ export type ArcViewPort = IViewPort & { radius: number; alpha: number; beta: number; /** * 滚轮速度 */ wheelDeltaPercentage: number; wheelPrecision: number; /** * 平移速度 */ panningSensibility: number; /** * 旋转速度 */ angularSensibility: number; radiusMin: number | null; radiusMax: number | null; betaMin: number | null; betaMax: number | null; }; /** * 自由镜头 */ export type FreeViewPort = IViewPort & { speed: number; inverseRotationSpeed: number; /** * 旋转速度 */ angularSensibility: number; }; /** * 第一人称镜头 */ export type FirstPersonViewPort = IViewPort & { speed: number; angularSensibility: number; }; /** * 第三人称镜头 */ export type ThirdPersonViewPort = IViewPort & { radius: number; alpha: number; beta: number; /** * 滚轮速度 */ wheelDeltaPercentage: number; /** * 平移速度 */ panningSensibility: number; /** * 旋转速度 */ angularSensibility: number; radiusMin: number | null; radiusMax: number | null; betaMin: number | null; betaMax: number | null; }; /** * 飞行镜头 */ export type FlyViewPort = IViewPort & { time: number; actionType: 'Linear' | 'easeInSine' | 'easeOutSine' | 'easeInOutSine' | 'easeInQuad' | 'easeOutQuad' | 'easeInOutQuad' | 'easeInCubic' | 'easeOutCubic' | 'easeInOutCubic' | 'easeInQuart' | 'easeOutQuart' | 'easeInOutQuart' | 'easeInQuint' | 'easeOutQuint' | 'easeInOutQuint' | 'easeInExpo' | 'easeOutExpo' | 'easeInOutExpo' | 'easeInCirc' | 'easeOutCirc' | 'easeInOutCirc'; }; /** * 匿名对象 */ export type AnonymousObj = { [key: string]: any; }; /** * 面板的参数 */ /** * 控制器的接口 */ export interface IControlBase { attachControl: () => void; detachControl: () => void; getViewPort: () => IViewPort; setViewPort: (vp: IViewPort, animation: boolean) => void; zoomObjectToFit: (obj: String | BABYLON.AbstractMesh | BABYLON.TransformNode) => void; getClassName: () => string; setTransform: (transform: CameraTransform) => void; getControlType: () => string; } /** * 控制器 */ export type Ctrl = BABYLON.TargetCamera & IControlBase; export type OnCtrlChangedArgs = { newCtrl: Ctrl; oldCtrl: Ctrl; }; /** * 设备的扩展属性 */ export type DeviceMeta = { warningColor: string; warningSpeed: number; warningIdentifier: EquWarningIdentifierSetting; runColor: string; stopColor: string; }; /** * 楼层 */ export type LevelItem = { name: string; modelName: string; }; /** * 建筑 */ export type Building = { name: string; modelName: string; levelItems: LevelItem[]; }; /** * 设备的状态 */ export type DeviceState = 'run' | 'stop' | 'warning'; export type EquWarningIdentifierType = { name: string; } & EquWarningIdentifierSetting; export type EquWarningIdentifierSetting = { panel: EquWarningIdentifierPanel; base: EquWarningIdentifierBase; }; export type EquWarningIdentifierPanel = { enable: boolean; transform: Transform3D; color: string; texture: string; text: string; textSize: number; }; export type EquWarningIdentifierBase = { enable: boolean; transform: Transform3D; color: string; speed: number; }; /** * 设备的扩展属性 */ export type DisplayEquipment = { name: string; modelName: string; position: Point3D; state: DeviceState; runColor: string; stopColor: string; warningColor: string; warningSpeed: number; hasAnimation: boolean; }; /** * 室内或者室外的具体设备 */ export type DisplayBuildingEquipment = { buildingName: string; modelName: string; equs: DisplayEquipment[]; }; /** * 泵站 */ export type Pump = { id: string; name: string; key: string; location: string; primaryModels: string[]; secondaryModels: string[]; hdr: string; env: string; }; /** * 字典 */ export type IDict = { [key: string]: T; }; /** * 集合 */ export type IList = T[]; /** * 建筑相关信息 */ export type BuildingInfo = { name: string; modelName: string; }; /** * 地面隐藏参数 */ export type GroundHideOption = { /** * 地面 */ ground: boolean; /** * 物件小品 */ smallItem: boolean; /** * 植物 */ plant: boolean; }; /** * POI面板1的相关参数 */ export type POIPanel1 = { enable: boolean; transform: Transform3D; color: string; texture: string; text: string; textSize: number; textDirection: 'horizontal' | 'vertical'; }; /** * POI面板2的相关参数 */ export type POIPanel2 = {} & POIPanel1; /** * POI面板3的相关参数 */ export type POIPanel3 = {} & POIPanel1; /** * POI面板4的相关参数 */ export type POIPanel4 = { enable: boolean; transform: Transform3D; texture: string; color: string; speed: 1; }; /** * POI的参数 */ export type CoverPOI = { name: string; modelName: string; position: Point3D; panel1: POIPanel1; panel2: POIPanel2; panel3: POIPanel3; panel4: POIPanel4; }; /** * 火的参数 */ export type CoverFire = { name: string; type: 'fire' | 'fire2'; attachModelName: string; position: Point3D; speed: number; minSize: number; maxSize: number; minLifeTime: number; maxLifeTime: number; }; /** * 路径线的参数 */ export type CoverPathLine = { name: string; color1: string; color2: string; texture: string; textureRepeatFactor: number; coverVisible: boolean; coverSpeed: number; lineWidth: number; lineSpeed: number; points: Point3D[]; }; /** * 位置标签 */ export type CoverPoint = { id: string; number: number; visibility: boolean; isBillboardMode: boolean; position: Point3D; scale: Point3D; }; /** * 热力图点的数据 */ export type HeatMapPoint = { id: string; p: Point2D; value: number; radius: number; }; /** * 热力图设置 */ export type HeatMapSetting = { color25: string; color50: string; color75: string; color100: string; blur: number; opacity: number; points: HeatMapPoint[]; }; /** * 泵站数据集 */ export type PumpContainer = { /** * 水务 */ shuiwu: IList; /** * 冕宁 */ mianning: IList; /** * 罗山 */ luoShan: IList; }; /** * 剖切体样式 */ export type SectionBodyStyle = { id: string; alpha: number; color: string; edgeWidth: number; edgeColor: string; sectionWidth: number; sectionColor: string; }; /** * 剖切方式 */ export type ClippingType = 'Box' | 'Plane'; /** * 剖切体 */ export type SectionBody = { id: string; name: string; enable: boolean; clipType: ClippingType; inner: boolean; edgeWidth?: number; edgeColor?: string; sectionWidth?: number; sectionColor?: string; clippingObjects: string[]; }; /** * 盒子剖切体 */ export type BoxSectionBody = { clipType: 'Box'; bounding?: { min: Point3D; max: Point3D; }; } & SectionBody; /** * 平面剖切体 */ export type PlaneSectionBody = { clipType: 'Plane'; dir: Point3D; position: Point3D; scale: Point3D; } & SectionBody; /** * 编辑方式 */ export type EditMode = '' | 'rotation' | 'scale' | 'position'; /** * 视频融合选项 */ export type VideoFusionOption = { id: string; name: string; enable: boolean; src: string; position: Point3D; dir: Point3D; }; /** * 发光选项 */ export type GlowOption = { enable: boolean; color: string; intensity: number; blurKernelSize: number; }; /** * 描边选项 */ export type HighlightOption = { enable: boolean; innerGlow: boolean; outerGlow: boolean; buildingHoverColor: string; buildingSelectColor: string; equHoverColor: string; equSelectColor: string; }; /** * 路径漫游视角限制 */ export type RoamingSetting = { startLowerRadiusLimit: number; startUpperRadiusLimit: number; pauseLowerRadiusLimit: number; pauseUpperRadiusLimit: number; stopLowerRadiusLimit: number; stopUpperRadiusLimit: number; }; /** * 标高 */ export type LevelInfo = { buildingName: string; levelName: string; level: number; height: number; }; /** * 工人 */ export type WorkerInfo = { id: string; position: Point3D; }; /** * 网格或组 */ export type MeshOrNode = BABYLON.Mesh | BABYLON.TransformNode;