new ViewerDrawing()
二维矢量
Methods
addModel(viewMetaData)
Parameters:
Name | Type | Description |
---|---|---|
viewMetaData |
Object | viewtoken关联的属性信息 |
changeLayers(layers)
更新图层的显隐
Parameters:
Name | Type | Description |
---|---|---|
layers |
Object | 图层的数据 |
clearElementBox()
清除所有图元的包围盒
clearHighlight()
清除构件高亮
clientToModelWorld(clientPosition) → {object}
获取客户端坐标对应的model世界坐标
Parameters:
Name | Type | Description |
---|---|---|
clientPosition |
object |
Returns:
Type | Description |
---|---|
object |
worldPosition |
clientToWorld(clientPosition) → {object}
获取客户端坐标对应的世界坐标
Parameters:
Name | Type | Description |
---|---|---|
clientPosition |
object |
Returns:
Type | Description |
---|---|
object |
worldPosition |
createSnapshotAsync(color, callback)
生成图纸当前的视图截图
Parameters:
Name | Type | Description |
---|---|---|
color |
object | 截图的背景颜色 |
callback |
function | 返回截图的BASE64字符串的回调函数 |
enableFullScreen(isEnabled)
进入全屏显示
Parameters:
Name | Type | Description |
---|---|---|
isEnabled |
bool | 进入或者退出全屏状态 |
enableHighlightEvent(bool)
是否开启通知高亮
Parameters:
Name | Type | Description |
---|---|---|
bool |
bool | true|false |
fromRevitId(RevitId)
三维构件ID换取对应的图纸构件ID
Parameters:
Name | Type | Description |
---|---|---|
RevitId |
number | 构件ID |
getColor(color) → {string}
将图层数据的纯数字color格式转化为rgba
Parameters:
Name | Type | Description |
---|---|---|
color |
int | 图层的颜色 |
Returns:
Type | Description |
---|---|
string |
rgba |
getCurrentState()
获取当前图纸视图的状态
Returns:
Type | Description |
---|
getCurrentViewId()
获取当前的layout ID
Returns:
Type | Description |
---|
getLayers() → {Object}
获取所有图层的数据
Returns:
Type | Description |
---|---|
Object |
layers 图层的数据 |
getObjectBoundingBox(id) → {array}
通过ID获取boundingbox
Parameters:
Name | Type | Description |
---|---|---|
id |
int | 构件id |
Returns:
Type | Description |
---|---|
array |
bbox boundingbox |
getViews()
Returns:
Type | Description |
---|
getViewScale()
获取ViewScale
getVisibleBoxIds() → {array}
获得所有的box被显示的element的ID
Returns:
Type | Description |
---|---|
array |
ids |
getZoomFactor()
获取当前的缩放比例
Returns:
Type | Description |
---|
getZoomRatio()
获取滚轮缩放的倍率
Returns:
Type | Description |
---|
hideAllLayers()
隐藏所有图层
hideElementBox(id)
隐藏图元的包围盒
Parameters:
Name | Type | Description |
---|---|---|
id |
int | 图元id |
hideLayer(layerid)
隐藏某个图层
Parameters:
Name | Type | Description |
---|---|---|
layerid |
string | 图层的ID |
highlightById(id)
高亮构件
Parameters:
Name | Type | Description |
---|---|---|
id |
int | array | 图元id |
home()
进入home视角
ignoreImage(bool)
忽略渲染跨域的图片
Parameters:
Name | Type | Description |
---|---|---|
bool |
bool | 是否忽略图片 |
load(viewToken, drawingIdopt)
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
viewToken |
String | ||
drawingId |
int |
<optional> |
rectZoom()
进入框选放大状态
resize()
调整大小
setNavigationMode(navigationMode)
设置导航模式
Parameters:
Name | Type | Description |
---|---|---|
navigationMode |
string | 导航模式 |
setPrintMode(isPrintMode)
设置图纸为黑白模式或者普通模式
Parameters:
Name | Type | Description |
---|---|---|
isPrintMode |
bool | true:黑白模式 false:普通模式 |
setState(state)
设置图纸视图的状态
Parameters:
Name | Type | Description |
---|---|---|
state |
object | 状态 |
setViewScale(scale)
设置ViewScale
Parameters:
Name | Type | Description |
---|---|---|
scale |
number |
setZoomRatio(ratio)
设置滚轮缩放的倍率
Parameters:
Name | Type | Description |
---|---|---|
ratio |
number | 缩放倍率,默认为1.1 ,上限小于2 下限大于0 |
showAllLayers()
显示所有图层
showElementBox(id)
显示图元的包围盒
Parameters:
Name | Type | Description |
---|---|---|
id |
int | 图元id |
showElementBoxByBBox(bbox)
通过boundingbox显示图元的包围盒
Parameters:
Name | Type | Description |
---|---|---|
bbox |
arr | boundingbox |
showLayer(layerid)
显示某个图层
Parameters:
Name | Type | Description |
---|---|---|
layerid |
string | 图层的ID |
showLineWidth(bool)
显示线宽
Parameters:
Name | Type | Description |
---|---|---|
bool |
bool | 是否显示线宽 |
showViewById(id)
根据layout ID 显示相应的视图
Parameters:
Name | Type | Description |
---|---|---|
id |
int | 布局ID |
toDrawingId(RevitId)
三维构件ID换取对应的图纸构件ID
Parameters:
Name | Type | Description |
---|---|---|
RevitId |
number | 构件ID |
toModelId(id)
图纸构件ID换取对应的三维构件ID
Parameters:
Name | Type | Description |
---|---|---|
id |
number | 构件ID |
toRevitId(id)
图纸构件ID换取对应的三维构件ID
Parameters:
Name | Type | Description |
---|---|---|
id |
number | 构件ID |
update(boolopt)
更新图纸状态
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
bool |
bool |
<optional> |
true:强制刷新 |
worldToClient(worldPosition) → {object}
获取世界坐标对应的客户端坐标
Parameters:
Name | Type | Description |
---|---|---|
worldPosition |
object |
Returns:
Type | Description |
---|---|
object |
clientPosition |
zoom(zoomScale)
图纸缩放
Parameters:
Name | Type | Description |
---|---|---|
zoomScale |
number | 缩放数值 |
zoomIn()
图纸放大
zoomOut()
图纸缩小
zoomToObject(id)
缩放并高亮构件
Parameters:
Name | Type | Description |
---|---|---|
id |
number | 构件ID {number} ratio 缩放倍率,默认为0.5 |