模型变换工具集
Name | Type | Description |
---|---|---|
layer |
SceneLayer | MapGISM3DSet | Cesium3DTileset | undefined | optional 模型对象 |
callback |
function | optional 模型编辑工具编辑后的回调函数 模型对象为空时,需要在调用具体的变换接口时指定要变换的模型。 推荐在调用变换接口时指定模型。 |
Methods
可视化旋转工具
Name | Type | Description | ||||||
---|---|---|---|---|---|---|---|---|
options |
Object |
|
可视化缩放工具
Name | Type | Default | Description | ||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
options |
Object |
{}
|
optional
工具参数
|
可视化平移工具
Name | Type | Description | ||||||
---|---|---|---|---|---|---|---|---|
options |
Object |
|
取消激活可视化工具
销毁工具
根据模型的tansform矩阵获取欧拉角
Name | Type | Description |
---|---|---|
transformInLocal |
Matrix4 | |
model |
MapGISM3DSet | MapGISM3D | Cesium3DTileset | optional 模型对象; |
rotationPoint |
Cartesian3 | optional 旋转中心;缺省时旋转中心默认为模型外包球中心 |
初始化可视化模型变换工具
Name | Type | Description |
---|---|---|
viewer |
Viewer | Cesium的viewer对象 |
重置模型位置到初始状态,只会重置通过构造函数传入的模型。
控制模型在本地空间下做旋转变换
Name | Type | Description | ||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
options |
Object |
|
Example:
var modelTransformTool = new Cesium.ModelTransformTool();
// 从SceneLayer图层中获取MapGISM3DSet
var model = layer._m3dLayerMap.values()[0];
modelTransformTool.initModelEditor(viewer);
// 通过角度控制
modelTransformTool.rotateLocal({
// 绕Z轴旋转90度
rotation: new Cesium.Cartesian3(0, 0, 90),
model: model,
rotationPoint: model.boundingSphere.center
})
// 通过headingpitchroll控制
modelTransformTool.rotateLocal({
// 绕Z轴旋转90度
rotation: new Cesium.HeadingPitchRoll(CesiumMath.toRadians(90), 0, 0),
model: model,
rotationPoint: model.boundingSphere.center
})
设置模型缩放
Name | Type | Description | |||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
options |
Object |
|
Example:
var modelTransformTool = new Cesium.ModelTransformTool();
modelTransformTool.initModelEditor(viewer);
modelTransformTool.setLocalScala({
size: new Cesium.Cartesian3(2, 2, 2),
// 从SceneLayer图层中获取MapGISM3DSet
model: layer._m3dLayerMap.values()[0]
})
设置M3D模型在笛卡尔世界坐标系下位置
Name | Type | Description | |||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
options |
Object |
|
Example:
var modelTransformTool = new Cesium.ModelTransformTool();
modelTransformTool.initModelEditor(viewer);
modelTransformTool.setPositionWorld({
position: Cesium.Cartesian3.fromDegrees(113.0750, 30, 100),
// 从SceneLayer图层中获取MapGISM3DSet
model: layer._m3dLayerMap.values()[0]
})
模型旋转
Name | Type | Default | Description |
---|---|---|---|
degree |
Number |
0
|
optional 旋转角度,单位度 |
axis |
String |
'Z'
|
optional 旋转轴,X:X轴,Y:Y轴,Z:Z轴 |
模型缩放
Name | Type | Default | Description |
---|---|---|---|
x |
Number |
1
|
optional x轴放大 |
y |
Number |
1
|
optional y轴放大 |
z |
Number |
1
|
optional z轴放大 |
Deprecated:
请使用ModelTransformTool#setLocalScala
模型平移
Name | Type | Default | Description |
---|---|---|---|
longitude |
Number |
0
|
optional 经度 |
latitude |
Number |
0
|
optional 纬度 |
height |
Number |
0
|
optional 高度 |
设置M3D模型在笛卡尔世界坐标系下平移
Name | Type | Description | |||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
options |
Object |
|
Example:
var modelTransformTool = new Cesium.ModelTransformTool();
modelTransformTool.initModelEditor(viewer);
modelTransformTool.translateWorld({
vector: new Cesium.Cartesian3(5000, 0, 1000),
// 从SceneLayer图层中获取MapGISM3DSet
model: layer._m3dLayerMap.values()[0]
})