new FdRectanglePickPMComponent(viewer)
Parameters:
Name | Type | Description |
---|---|---|
viewer |
Viewer |
Example
var rpm = new Freedo.FdMicroApp.FdRectanglePickPMComponent(viewer); rpm.start(); // 获取框选结果 rpm.on(function(et, ev) { if (et === "DataChanged") { console.log(ev); } });
Methods
-
addIgnoreID(ignoreID)
-
增加ID过滤
Parameters:
Name Type Description ignoreID
Array.<String> 包含要过滤ID的数组
-
addIgnorePModel(pModel)
-
添加一个PModel到忽略列表(PModel)中
Parameters:
Name Type Description pModel
PModelSet 忽略的PModel
-
clearIgnorePModel()
-
清空pModel过滤
-
createBB(boundsMin, boundsMax, modelMatrix)
-
绘制部件边框
Parameters:
Name Type Description boundsMin
String 部件最小包围盒字符串
boundsMax
String 部件最大包围盒字符串
modelMatrix
Matrix4 世界变换矩阵
Returns:
返回pritimive对象
- Type
- Object
-
getData()
-
获取数据
Returns:
返回值格式:
[ { componentid: 组件ID, tileset: tileset对象, tilesetURL: tileset地址 }, ... ]
- Type
- Array.<Object>
-
getMode()
-
获取显示模式
Returns:
显示模式
- Type
- String
-
getSingleMode()
-
获取单选模式
Returns:
true为单选模式
- Type
- Boolean
-
getUidBoundingSphere(pModel, componentid, callback)
-
获取部件包围球
Parameters:
Name Type Description pModel
Object 模型
componentid
String 部件ID
callback
FdMicroApp.FdRectanglePickPMComponent~Callback 获取部件包围球信息的回调函数
-
hideAllComponents()
-
隐藏所有部件
-
hideAllComponentsBoundingBox()
-
取消所有部件的边框高亮
-
highlightComponent(componentid, tileset, r, g, b, a)
-
高亮单个部件
Parameters:
Name Type Description componentid
String 部件ID
tileset
Object 模型
r
Number 颜色R分量,范围0~255
g
Number 颜色G分量,范围0~255
b
Number 颜色B分量,范围0~255
a
Number 透明度,范围0~1
Returns:
返回true表示设置成功,否则表示未成功
- Type
- Boolean
-
highlightComponents(data, r, g, b, a)
-
批量高亮部件
Parameters:
Name Type Description data
Array.<Object> 部件数据
data[i].componentid
String 部件id
data[i].tileset
Object 模型
r
Number 颜色R分量,范围0~255
g
Number 颜色G分量,范围0~255
b
Number 颜色B分量,范围0~255
a
Number 透明度,范围0~1
Returns:
返回true表示设置成功,否则表示未成功
- Type
- Boolean
-
highlightComponentsArray(componentsAndColorArray, tilesets, restColor)
-
根据部件id数组和数据集数组批量高亮部件
Parameters:
Name Type Description componentsAndColorArray
Array.<Object> 部件数组和颜色
componentsAndColorArray[i].components
Array.<String> 部件数组
componentsAndColorArray[i].color
Array.<Number> 部件颜色
tilesets
Array.<Freedo.FreedoPModelset> 需要设置的数据集数组
restColor
Array.<Number> 除去componentsAndColorArray中指定的部件,剩余部件的颜色
-
on(listener [, scope])
-
注册事件捕捉
Parameters:
Name Type Argument Description listener
FdMicroApp.FdRectanglePickPMComponent~FdRectanglePickPMComponentCallback 当有事件触发时被执行的函数。
scope
Object <optional>
listener函数执行时的绑定的对象。
Returns:
返回一个函数,调用该函数可以取消监听。
- Type
- Freedo.Event~RemoveCallback
-
setBaseColor(r, g, b, a)
-
设置场景模型基本颜色
Parameters:
Name Type Description r
number 颜色R分量,范围0~255
g
number 颜色G分量,范围0~255
b
number 颜色B分量,范围0~255
a
number 透明度,范围0~1
-
setBBoxColor(r, g, b, a)
-
设置线框颜色
Parameters:
Name Type Description r
Number 颜色R分量,范围0~255
g
Number 颜色G分量,范围0~255
b
Number 颜色B分量,范围0~255
a
Number 透明度,范围0~1
-
setClearOnEmptySelect( [clear])
-
选取空白处时是否清空特效
Parameters:
Name Type Argument Default Description clear
Boolean <optional>
true true时为清空,false为不清空
-
setHighlightColor(r, g, b, a)
-
设置高亮颜色
Parameters:
Name Type Description r
Number 颜色R分量,范围0~255
g
Number 颜色G分量,范围0~255
b
Number 颜色B分量,范围0~255
a
Number 透明度,范围0~1
-
setIgnoreIDs(ignoreIDs)
-
设置忽略列表
Parameters:
Name Type Description ignoreIDs
Array.<String> 包含要过滤ID的数组
-
setIgnorePModels(pModels)
-
设置忽略列表(PModel)
Parameters:
Name Type Description pModels
Array.<PModelSet> 包含pMode对象的数组
-
setMode(mode)
-
设置显示模式
Parameters:
Name Type Description mode
String 显示模式,HIGH_LIGHT(高亮模式),SHOW_HIDE(隐藏模式),PICK_MODE(选取模式,无特效),BLINK_MODE(闪烁模式),BBOX_MODE(线框模式)
-
setMouseMode(mode)
-
设置鼠标操作模式(可多选)
Parameters:
Name Type Description mode
String 可设置为'left' 'right' 'middle'中的一个或多个,当设置多个时,使用'|'分隔,如:'left|right'
-
setPMTSManager()
-
设置PMTSManager
-
setSingleMode( [single])
-
设置单选模式
Parameters:
Name Type Argument Default Description single
Boolean <optional>
true true为单选模式
-
showAllComponents()
-
显示所有部件
-
showComponent(componentid, tileset, show)
-
显示或者隐藏某个部件
Parameters:
Name Type Description componentid
String 部件ID
tileset
Object 模型
show
Boolean 显示用true表示,隐藏用false表示
Returns:
设置成功返回true,否则返回false
- Type
- Boolean
-
showComponentBBoxByUid(pmtsId, uid)
-
通过uid高亮某个部件的边框
Parameters:
Name Type Description pmtsId
String pmtsId
uid
String 部件uid
-
showComponentBoundingBox(componentid, tileset)
-
高亮某个部件的边框
Parameters:
Name Type Description componentid
String 部件id
tileset
Object 模型
Returns:
返回true表示设置成功,否则表示未成功
- Type
- Boolean
-
showComponents(data, show)
-
批量显示或者隐藏部件
Parameters:
Name Type Description data
Array.<Object> 部件数据
data[i].componentid
String 部件id
data[i].tileset
Object 模型
data[i].ancestorComponents
String | Array.<String> show
Boolean 显示用true表示,隐藏用false表示
Returns:
设置成功返回true,否则返回false
- Type
- Boolean
-
showComponentsArray(componentsArray, tilesets, show)
-
根据部件数组和数据集数组批量显隐部件
Parameters:
Name Type Description componentsArray
Array.<String> 部件数组
tilesets
Array.<Freedo.FreedoPModelset> 需要设置的数据集数组
show
Boolean 部件数组的显隐
-
showComponentsBBoxByUid(data)
-
通过uid批量高亮多个部件的边框
Parameters:
Name Type Description data
Array.<Object> 部件数据
data[i].pmtsId
String 部件id
data[i].uid
String 部件uid
Returns:
返回true表示设置成功,否则表示未成功
- Type
- Boolean
-
showComponentsBoundingBox(data)
-
批量高亮部件的边框
Parameters:
Name Type Description data
Array.<Object> 部件数据
data[i].componentid
String 部件id
data[i].tileset
Object 模型
Returns:
返回true表示设置成功,否则表示未成功
- Type
- Boolean
-
start( [restore])
-
开始
Parameters:
Name Type Argument Default Description restore
Boolean <optional>
true true表示清空之前的操作
-
unhighlightAllComponents()
-
取消所有高亮
-
unhighlightComponent(componentid, tileset)
-
取消某个高亮部件
Parameters:
Name Type Description componentid
String 部件ID
tileset
Object 模型
Returns:
返回true表示设置成功,否则表示未成功
- Type
- Boolean
-
unhighlightComponents(data)
-
批量取消高亮部件
Parameters:
Name Type Description data
Array.<Object> 部件数据
data[i].componentid
String 部件id
data[i].tileset
Object 模型
Returns:
返回true表示设置成功,否则表示未成功
- Type
- Boolean
Type Definitions
-
Callback( [result] [, error])
-
FdPickPMComponent的回调函数类型
Parameters:
Name Type Argument Description result
Object <optional>
包围球对象,如果出现错误,则此参数为undefined
error
String <optional>
返回错误字符串,如果是undefined,则表示没有错误
-
FdRectanglePickPMComponentCallback(eventType, eventArg)
-
Parameters:
Name Type Description eventType
String 事件类型有:DataChanged
eventArg
Object DataChanged事件返回模型和部件ID