# Class Model

Five 模型

#### Description

通过 work 数据加载, 适配 at3d、pbm、dome、domez 格式的文件 可以通过 jsonp 解析 base64 的 dataURL 内容， 需要满足 your/path/filename.at3d.json_xxxxxx, 通过 json_xxxxxx() 方式返回。

#### Hierarchy

- Object3D
  - Model

- Defined in lib/five/model/model.ts:20
- Defined in lib/five/model/model.ts:56

##### Index

### Constructors

constructor

### Properties

add
autoRefine
boundingBox
children
fiveId
floorLength
initReady
loaded
loadedReady
metaPending
needsRender
outdated
parameter
parent
refined
refineProgress
work

### Accessors

bounding
brightness
clippers
customShaders
empty
shownFloor
shownFloorIndex
viewLayers

### Methods

addEventListener
dispatchEvent
dispose
enuToLocal
enuToWorld
getEdgesBySphere
getMaterial
intersectRaycaster
localToEnu
removeEventListener
resetBrightness
setMaterial
show
update
worldToEnu

## Constructors

### constructor

- new Model(
  fiveId: string,
  work: Work,
  options?: { light?: boolean; textureOptions?: TextureOptions },
  ): Model

  #### Parameters

  - fiveId: string
  - work: Work
  - options: { light?: boolean; textureOptions?: TextureOptions } = {}

  #### Returns Model

  - Defined in lib/five/model/model.ts:101

## Properties

### add

add: (...object: ViewLayer[]) => this

Adds object as child of this object.

- Defined in lib/five/model/model.ts:65

### autoRefine

autoRefine: boolean = true

是否自动细化

- Defined in lib/five/model/model.ts:78

### boundingBox

boundingBox: Box3 = ...

外接盒子的大小

- Defined in lib/five/model/model.ts:96

### children

children: ViewLayer[]

Array with object's children.

- Defined in lib/five/model/model.ts:64

### fiveId

fiveId: string

- Defined in lib/five/model/model.ts:58

### floorLength

floorLength: number

所有楼层

- Defined in lib/five/model/model.ts:99

### initReady

initReady: Promise<Model>

初始化完成

- Defined in lib/five/model/model.ts:90

### loaded

loaded: boolean = false

模型已经加载

- Defined in lib/five/model/model.ts:83

### loadedReady

loadedReady: Promise<Model>

初次加载完成

- Defined in lib/five/model/model.ts:93

### metaPending

metaPending: boolean = false

是否在加载元信息

- Defined in lib/five/model/model.ts:81

### needsRender

needsRender: boolean

- Defined in lib/five/model/model.ts:62

### outdated

outdated: boolean = false

是否过期

- Defined in lib/five/model/model.ts:75

### parameter

parameter: Parameter = ...

- Defined in lib/five/model/model.ts:69

### parent

parent: ModelScene | null

Object's parent in the scene graph.

- Defined in lib/five/model/model.ts:60

### refined

refined: boolean = false

模型是否已经细化

- Defined in lib/five/model/model.ts:85

### refineProgress

refineProgress: [number, number] = ...

模型细化进度

- Defined in lib/five/model/model.ts:87

### work

work: Work

work

- Defined in lib/five/model/model.ts:72

## Accessors

### bounding

- get bounding(): Box3

  #### Returns Box3

  #### Deprecated

  Use `.boundingBox` instead

  - Defined in lib/five/model/model.ts:392

### brightness

- get brightness(): number

  #### Returns number

  #### Deprecated

  Use `.parameter.brightness` `.parameter.set('brightness', brightness)` instead

  - Defined in lib/five/model/model.ts:435
- set brightness(brightness: number): void

  #### Parameters

  - brightness: number

  #### Returns void

  - Defined in lib/five/model/model.ts:442

### clippers

- get clippers(): readonly PBMClipperParameter[]

  #### Returns readonly PBMClipperParameter[]

  #### Deprecated

  Use `.parameter.clippers` `.parameter.set('clippers', clippers)` instead

  - Defined in lib/five/model/model.ts:450
- set clippers(clippers: readonly PBMClipperParameter[]): void

  #### Parameters

  - clippers: readonly PBMClipperParameter[]

  #### Returns void

  - Defined in lib/five/model/model.ts:457

### customShaders

- get customShaders(): readonly PBMCustomShader[]

  #### Returns readonly PBMCustomShader[]

  #### Deprecated

  Use `.parameter.customShaders` `.parameter.set('customShaders', customShaders)` instead

  - Defined in lib/five/model/model.ts:465
- set customShaders(customShaders: readonly PBMCustomShader[]): void

  #### Parameters

  - customShaders: readonly PBMCustomShader[]

  #### Returns void

  - Defined in lib/five/model/model.ts:472

### empty

- get empty(): boolean

  模型内容是否为空

  #### Returns boolean

  - Defined in lib/five/model/model.ts:219

### shownFloor

- get shownFloor(): number | null

  当前显示的楼层

  #### Returns number | null

  - Defined in lib/five/model/model.ts:366
- set shownFloor(floor: number | null): void

  #### Parameters

  - floor: number | null

  #### Returns void

  - Defined in lib/five/model/model.ts:369

### shownFloorIndex

- get shownFloorIndex(): number

  #### Returns number

  #### Deprecated

  Use `.parameter.shownFloorIndex` `.parameter.set('brightness', brightness)` instead

  - Defined in lib/five/model/model.ts:420
- set shownFloorIndex(floorIndex: number): void

  #### Parameters

  - floorIndex: number

  #### Returns void

  - Defined in lib/five/model/model.ts:427

### viewLayers

- get viewLayers(): ViewLayer[]

  模型的不同图层

  #### Returns ViewLayer[]

  - Defined in lib/five/model/model.ts:224

## Methods

### addEventListener

- addEventListener(
  type: "error",
  listener: (event: Event & { error: Error; type: "error" }) => void,
  ): void

  #### Parameters

  - type: "error"
  - listener: (event: Event & { error: Error; type: "error" }) => void

  #### Returns void

  - Defined in lib/five/model/model.ts:30
- addEventListener(
  type: "load",
  listener: (event: Event & { type: "load" }) => void,
  ): void

  #### Parameters

  - type: "load"
  - listener: (event: Event & { type: "load" }) => void

  #### Returns void

  - Defined in lib/five/model/model.ts:31
- addEventListener(
  type: "dispose",
  listener: (event: Event & { type: "dispose" }) => void,
  ): void

  #### Parameters

  - type: "dispose"
  - listener: (event: Event & { type: "dispose" }) => void

  #### Returns void

  - Defined in lib/five/model/model.ts:32
- addEventListener(
  type: "changeShownFloor",
  listener: (
  event: Event & { floorIndex: number | null; type: "changeShownFloor" },
  ) => void,
  ): void

  #### Parameters

  - type: "changeShownFloor"
  - listener: (event: Event & { floorIndex: number | null; type: "changeShownFloor" }) => void

  #### Returns void

  - Defined in lib/five/model/model.ts:33
- addEventListener(
  type: "tileLoad",
  listener: (event: Event & { tile: Tile; type: "tileLoad" }) => void,
  ): void

  #### Parameters

  - type: "tileLoad"
  - listener: (event: Event & { tile: Tile; type: "tileLoad" }) => void

  #### Returns void

  - Defined in lib/five/model/model.ts:34
- addEventListener(
  type: "tileUnload",
  listener: (event: Event & { tile: Tile; type: "tileUnload" }) => void,
  ): void

  #### Parameters

  - type: "tileUnload"
  - listener: (event: Event & { tile: Tile; type: "tileUnload" }) => void

  #### Returns void

  - Defined in lib/five/model/model.ts:35
- addEventListener(type: string, listener: (event: Event) => void): void

  #### Parameters

  - type: string
  - listener: (event: Event) => void

  #### Returns void

  - Defined in lib/five/model/model.ts:36

### dispatchEvent

- dispatchEvent(event: { error: Error; type: "error" }): void

  #### Parameters

  - event: { error: Error; type: "error" }

  #### Returns void

  - Defined in lib/five/model/model.ts:22
- dispatchEvent(event: { type: "load" }): void

  #### Parameters

  - event: { type: "load" }

  #### Returns void

  - Defined in lib/five/model/model.ts:23
- dispatchEvent(event: { type: "dispose" }): void

  #### Parameters

  - event: { type: "dispose" }

  #### Returns void

  - Defined in lib/five/model/model.ts:24
- dispatchEvent(
  event: { floorIndex: number | null; type: "changeShownFloor" },
  ): void

  #### Parameters

  - event: { floorIndex: number | null; type: "changeShownFloor" }

  #### Returns void

  - Defined in lib/five/model/model.ts:25
- dispatchEvent(event: { tile: Tile; type: "tileLoad" }): void

  #### Parameters

  - event: { tile: Tile; type: "tileLoad" }

  #### Returns void

  - Defined in lib/five/model/model.ts:26
- dispatchEvent(event: { tile: Tile; type: "tileUnload" }): void

  #### Parameters

  - event: { tile: Tile; type: "tileUnload" }

  #### Returns void

  - Defined in lib/five/model/model.ts:27
- dispatchEvent(event: { type: string; [attachment: string]: any }): void

  #### Parameters

  - event: { type: string; [attachment: string]: any }

  #### Returns void

  - Defined in lib/five/model/model.ts:28

### dispose

- dispose(): void

  析构函数 一旦析构，则不能使用

  #### Returns void

  - Defined in lib/five/model/model.ts:203

### enuToLocal

- enuToLocal(vector: Vector3): Vector3

  #### Parameters

  - vector: Vector3

  #### Returns Vector3

  - Defined in lib/five/model/model.ts:350

### enuToWorld

- enuToWorld(vector: Vector3): Vector3

  #### Parameters

  - vector: Vector3

  #### Returns Vector3

  - Defined in lib/five/model/model.ts:358

### getEdgesBySphere

- getEdgesBySphere(sphere: Sphere, threshold?: number): Line3[]

  获取模型边界线

  #### Parameters

  - sphere: Sphere

    获取区域

  - threshold: number = ...

    面片间夹角阈值

  #### Returns Line3[]

  所有模型边界线

  - Defined in lib/five/model/model.ts:234

### getMaterial

- getMaterial(): ParameterValue

  #### Returns ParameterValue

  #### Deprecated

  Use `.parameter.get` instead

  - Defined in lib/five/model/model.ts:408

### intersectRaycaster

- intersectRaycaster(
  raycaster: Raycaster,
  target?: Intersection[],
  ): Intersection[]

  计算模型射线碰撞检测

  #### Parameters

  - raycaster: Raycaster

    THREE 射线对象

  - `Optional` target: Intersection[]

    返回碰撞

  #### Returns Intersection[]

  返回碰撞

  - Defined in lib/five/model/model.ts:244

### localToEnu

- localToEnu(vector: Vector3): Vector3

  #### Parameters

  - vector: Vector3

  #### Returns Vector3

  - Defined in lib/five/model/model.ts:346

### removeEventListener

- removeEventListener(
  type: "error",
  listener: (event: Event & { error: Error; type: "error" }) => void,
  ): void

  #### Parameters

  - type: "error"
  - listener: (event: Event & { error: Error; type: "error" }) => void

  #### Returns void

  - Defined in lib/five/model/model.ts:38
- removeEventListener(
  type: "load",
  listener: (event: Event & { type: "load" }) => void,
  ): void

  #### Parameters

  - type: "load"
  - listener: (event: Event & { type: "load" }) => void

  #### Returns void

  - Defined in lib/five/model/model.ts:39
- removeEventListener(
  type: "dispose",
  listener: (event: Event & { type: "dispose" }) => void,
  ): void

  #### Parameters

  - type: "dispose"
  - listener: (event: Event & { type: "dispose" }) => void

  #### Returns void

  - Defined in lib/five/model/model.ts:40
- removeEventListener(
  type: "changeShownFloor",
  listener: (
  event: Event & { floorIndex: number | null; type: "changeShownFloor" },
  ) => void,
  ): void

  #### Parameters

  - type: "changeShownFloor"
  - listener: (event: Event & { floorIndex: number | null; type: "changeShownFloor" }) => void

  #### Returns void

  - Defined in lib/five/model/model.ts:41
- removeEventListener(
  type: "tileLoad",
  listener: (event: Event & { tile: Tile; type: "tileLoad" }) => void,
  ): void

  #### Parameters

  - type: "tileLoad"
  - listener: (event: Event & { tile: Tile; type: "tileLoad" }) => void

  #### Returns void

  - Defined in lib/five/model/model.ts:42
- removeEventListener(
  type: "tileUnload",
  listener: (event: Event & { tile: Tile; type: "tileUnload" }) => void,
  ): void

  #### Parameters

  - type: "tileUnload"
  - listener: (event: Event & { tile: Tile; type: "tileUnload" }) => void

  #### Returns void

  - Defined in lib/five/model/model.ts:43
- removeEventListener(type: string, listener: (event: Event) => void): void

  #### Parameters

  - type: string
  - listener: (event: Event) => void

  #### Returns void

  - Defined in lib/five/model/model.ts:44

### resetBrightness

- resetBrightness(): void

  #### Returns void

  #### Deprecated

  Use `.parameter.reset('brightness')` instead

  - Defined in lib/five/model/model.ts:480

### setMaterial

- setMaterial(parameter: Partial<ParameterValue>): void

  #### Parameters

  - parameter: Partial<ParameterValue>

  #### Returns void

  #### Deprecated

  Use `.parameter.set` instead

  - Defined in lib/five/model/model.ts:400

### show

- show(floor?: number | null): void

  显示某楼层

  #### Parameters

  - `Optional` floor: number | null

  #### Returns void

  #### Example

      model.show() //显示全部楼层
      model.show(1) //显示第一楼层

  - Defined in lib/five/model/model.ts:381

### update

- update(renderer: WebGLRenderer, camera: Camera, modelScene: ModelScene): boolean

  #### Parameters

  - renderer: WebGLRenderer
  - camera: Camera
  - modelScene: ModelScene

  #### Returns boolean

  - Defined in lib/five/model/model.ts:262

### worldToEnu

- worldToEnu(vector: Vector3): Vector3

  #### Parameters

  - vector: Vector3

  #### Returns Vector3

  - Defined in lib/five/model/model.ts:354