Skip to content

Class: Model

Model()

UniModels类

Constructor

new Model()

Classes

Methods

add3DTiles(param0, param1)

增加3DTiles模型 (旧

Parameters:
NameTypeDescription
param0*经纬高程
param1*属性




Returns:

(async) addGltf(param0, param1)

增加GLTF模型

Parameters:
NameTypeDescription
param0*经纬高程
param1*属性




Returns:

attachGltfset(viewer)

关联GLTF设置

Parameters:
NameTypeDescription
viewer*全局Viewr对象




change3DTilesPos(tileset, axis)

修改3DTiles坐标位置

Parameters:
NameTypeDescription
tileset*使用添加模型方法后返回的模型tileset类
axis*经纬高度




changeColor(model, color, alpha, isSilhouetter, silhouetteSize, colorBlendAmount)

模型颜色调整

Parameters:
NameTypeDefaultDescription
model*使用添加模型方法后返回的模型tileset类
color*颜色
alpha*透明度
isSilhouetter*false是否开启外轮廓线颜色
silhouetteSize*1外轮廓线宽度
colorBlendAmount*0.5颜色混合量




changeModelPos(model, axis, hprs, scales, offsets)

修改模型形态

Parameters:
NameTypeDescription
model*使用添加模型方法后返回的模型tileset类
axis*经纬高度
hprs*俯仰旋转翻转角
scales*三维缩放数值
offsets*三维偏移量




changePos(isAxis, data, hprs, scales, offsets)

针对transform进行修改

Parameters:
NameTypeDefaultDescription
isAxis*truedata是否是axis,否则是transform
data*填入axis坐标或者transform
hprs*俯仰旋转翻转角
scales*三维缩放数值
offsets*三维偏移量




Returns:

clearSurface()

清除surface




createBox(name, size, axis, color, alpha, outline)

建造方块

Parameters:
NameTypeDescription
name*方块名称
size*方块大小
axis*方块坐标
color*方块颜色
alpha*方块透明度
outline*方块边框




Returns:

createMaterialLine(startAxis, endAxis)

创建动态水流线条

Parameters:
NameTypeDescription
startAxis*起始坐标
endAxis*终止坐标




createSurface(pos, type)

挖地底面

Parameters:
NameTypeDescription
pos*位置
type*类型




(async) createTileset(url, options)

异步添加3dTiles模型(新

Parameters:
NameTypeDescription
url*
options*




Returns:

cutModel(tilesetData, originPositions, isCutInside, hpr, scales, offsets, edgeWidth, color)

模型按坐标逆时针剖切

Parameters:
NameTypeDefaultDescription
tilesetData*模型数据
originPositions*切块逆时针坐标数组
isCutInside*false内部剖切选项
hpr*模型headings/pitchs/rolls旋转参数,一般配合changePos()函数使用
scales*缩放系数,配合changePos()函数使用
offsets*偏移系数,配合changePos()函数使用
edgeWidth*边缘宽度
color*边缘颜色




deepClone(obj)

深拷贝对象

Parameters:
NameTypeDescription
obj*对象




Returns:

delLine(id, delLast)

删除绘制线条

Parameters:
NameTypeDefaultDescription
id*线条id
delLast*false是否是被删除的最后一个




depthTestAgainstTerrain(bool)

深度测试开关

Parameters:
NameTypeDescription
bool*




dig(axis, size)

挖地

Parameters:
NameTypeDescription
axis*挖地坐标
size*挖地尺寸




digModel(model, options = { "fb": null, "bf": null, "lr": null, "rl": null, "tb": null, "bt": null }, edgeWidth = 0.0)

模型按方块剖切

Parameters:
NameTypeDefaultDescription
model*使用添加模型方法后返回的模型tileset类
options*剖切方向及设置
edgeWidth*0剖切边缘宽度




fetchPropertys(path)

请求属性数据json

Parameters:
NameTypeDescription
path*




getAxizFromMatrix(matrix, cityAxiz, rotate, setHeight)

根据4*4matrix矩阵以及参考坐标系,获取其旋转后的坐标(用于根据模型元组生成标签)

Parameters:
NameTypeDefaultDescription
matrix*原矩阵
cityAxiz*参考坐标系
rotate*0旋转角度
setHeight*null高程




Returns:

getEntitiesByName(name, bool)

根据Name获取entities

Parameters:
NameTypeDefaultDescription
name*
bool*false




Returns:

getPrimitivesById(id, bool)

根据ID获取Primitives

Parameters:
NameTypeDefaultDescription
id*
bool*false




Returns:

getPrimitivesName(ignore)

查询构件名称并归类(注意,只会获取到有id的Primitive)

Parameters:
NameTypeDefaultDescription
ignore*null需要忽略的构件名称




Returns:

initDigSurface(pos, depth)

顺时针生成挖地底部效果

Parameters:
NameTypeDescription
pos*位置
depth*深度




judgeDirection(points)

输入含有三个经纬坐标值,返回是否顺时针判断

Parameters:
NameTypeDescription
points*




Returns:

paintLine(id, positions, height, color, width)

绘制线条

Parameters:
NameTypeDefaultDescription
id*线条id
positions*线条位置
height*200线条高程
color*#47ffe0线条颜色
width*0.5线条宽度




paintWall(id, positions, height, wallHeight, color)

绘制墙体

Parameters:
NameTypeDefaultDescription
id*
positions*xy坐标
height*200坐标高
wallHeight*50墙体高
color*#47ffe0




pickTilesetByClick(data, callback)

点击3DTiles模型获取属性信息

Parameters:
NameTypeDescription
data*
callback*




pickTilesetByPosition(data, position, callback)

根据鼠标位置获取3DTiles模型属性信息

Parameters:
NameTypeDescription
data*
position*
callback*




setPrimitivesShow(primitiveName, bool, otherbool, ignore)

设置构件显隐

Parameters:
NameTypeDefaultDescription
primitiveName*需要设置的构件名称
bool*false设置的构件是否隐藏,默认false
otherbool*trueid为null的构件是否隐藏,使用该参数默认true以保证工具栏显隐正常使用
ignore*需要忽略的构件名称




shadowChange(bool)

阴影遮挡开关

Parameters:
NameTypeDescription
bool*




tileSet(tileset, longitude, latitude, height)

变换tileSet坐标

Parameters:
NameTypeDescription
tileset*
longitude*
latitude*
height*




undergroundMode(bool)

地下模式

Parameters:
NameTypeDescription
bool*是否开启地下模式