cesium米转换经纬度_cesium 笛卡尔坐标(单位:米) 与 经纬度(单位:弧度/度) 之间的转换。...
this.model.readyPromise.then(function (tileset) {
//記錄模型原始的中心點
var boundingSphere = tileset.boundingSphere;
that.boundingSphere = boundingSphere;
//模型原始的中心點。此處是笛卡爾坐標,單位:米。
var position = boundingSphere.center;
// 此處是經緯度,單位:弧度;高度單位:米。
var catographic = Cesium.Cartographic.fromCartesian(position);
var height = Number(catographic.height.toFixed(2));
// 此處是經緯度,單位:度。
var longitude = Number(Cesium.Math.toDegrees(catographic.longitude).toFixed(6));
var latitude = Number(Cesium.Math.toDegrees(catographic.latitude).toFixed(6));
that.originalCenter = { x: longitude, y: latitude, z: height };
console.log((that.config.name || "") + " 模型原始位置:" + JSON.stringify(that.originalCenter));
//offsetopt.x,y不能多次更改
updateMatrix: function (offsetopt) {
if (this.model == null) return;
console.log(" 模型修改后位置:" + JSON.stringify(offsetopt));
var boundingSphere = this.model.boundingSphere;
var catographic = Cesium.Cartographic.fromCartesian(boundingSphere.center);
var surface = Cesium.Cartesian3.fromRadians(catographic.longitude, catographic.latitude, 0.0);
// 此處展示了,從經緯度(單位:度)-->笛卡爾坐標(單位:米)。
var offset = Cesium.Cartesian3.fromDegrees(offsetopt.x, offsetopt.y, offsetopt.z);
var translation = Cesium.Cartesian3.subtract(offset, surface, new Cesium.Cartesian3());
this.model.modelMatrix = Cesium.Matrix4.fromTranslation(translation);
//this.model.update();
},
總結
以上是生活随笔為你收集整理的cesium米转换经纬度_cesium 笛卡尔坐标(单位:米) 与 经纬度(单位:弧度/度) 之间的转换。...的全部內容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: 大通草的功效与作用、禁忌和食用方法
- 下一篇: ios 顶部tab滑动实现_iOS开发之