ModelLibraryControl

模型库组件

new YS.ModelLibraryControl(ys, modelLayer, id)

模型库组件
Name Type Description
ys YouScene YouScene对象
modelLayer Object 对象
id String optional 模型库放在哪个盒子里面
Implements:
Example:
var box = '<div id="modelLibraryControl" style="width: 300px; height: 600px; position: fixed; top: 40px; right: 60px; border: 1px solid #ccc;"></div>'
$(document.body).append(box);
var modelLayer = new YS.ModelLayer({}, youScene.earth);
var ModelLibraryControl = new YS.ModelLibraryControl(youScene, modelLayer, "modelLibraryControl");
// 添加默认模型到模型库
ModelLibraryControl.addDefaultModels();
Demo:

Methods

addDefaultModels()

添加默认模型到组件库

addModel(model)

添加自定义模型到模型库组件上
Name Type Description
model Model 对象

clean()

清理组件的临时数据、成果等
Implements:

destroy()Undefined

销毁组件 重载时请务必调用IControl.prototype.destroy.apply(this);
Returns:
Implements:

getByIdIndex(id)Sting

根据id查找模型在模型库中的索引
Name Type Description
id String 模型id
Returns:
返回查找到的模型的索引,找不到返回-1

getByIdModel(id)Model

根据id查找模型在模型库中模型
Name Type Description
id String 模型id
Returns:
返回查找到的模型,找不到返回undefined

remove(model)

移除模型库中的模型
Name Type Description
model Model 模型对象

removeById()

根据id移除模型库中的模型

Events

click

点击模型库列表事件
Name Type Description
点击的模型列表索引 String
Model Object 对象