|
@@ -21449,65 +21449,64 @@
|
|
|
{
|
|
|
//拿初始数据集作为基准。它的位置要放到000
|
|
|
var locationLonLat = originDataset.location.slice(0, 2);
|
|
|
- if (window.AMapWith84) {
|
|
|
- //需要转换为高德的,但该函数不准确,转入后再转出,和原来的有偏差. navvis的我看data中存的globalLocation直接输入到高德地图后的定位和其要展示的定位一致,而我们要转为高德后才一致,猜测是navvis后台转为了高德可用的经纬度。 若不转的话,其他看起来没问题,仅高德地图定位不准确,因其为被加密后的火星坐标系。
|
|
|
- locationLonLat = AMapWith84.wgs84ToAMap({
|
|
|
- x: locationLonLat[0],
|
|
|
- y: locationLonLat[1]
|
|
|
- });
|
|
|
- locationLonLat = [locationLonLat.x, locationLonLat.y];
|
|
|
- }
|
|
|
+ Potree.setLonlat(locationLonLat[0], locationLonLat[1]);
|
|
|
+ /* if(window.AMapWith84){//需要转换为高德的,但该函数不准确,转入后再转出,和原来的有偏差. navvis的我看data中存的globalLocation直接输入到高德地图后的定位和其要展示的定位一致,而我们要转为高德后才一致,猜测是navvis后台转为了高德可用的经纬度。 若不转的话,其他看起来没问题,仅高德地图定位不准确,因其为被加密后的火星坐标系。
|
|
|
+ locationLonLat = AMapWith84.wgs84ToAMap({x:locationLonLat[0], y:locationLonLat[1]})
|
|
|
+ locationLonLat = [locationLonLat.x,locationLonLat.y]
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
proj4.defs("LOCAL", "+proj=tmerc +ellps=WGS84 +lon_0=" + locationLonLat[0].toPrecision(15) + " +lat_0=" + locationLonLat[1].toPrecision(15)); //高德坐标系
|
|
|
proj4.defs("LOCAL_MAP", "+proj=tmerc +ellps=WGS84 +lon_0=" + locationLonLat[0].toPrecision(15) + " +lat_0=" + locationLonLat[1].toPrecision(15)); //地图和本地一样
|
|
|
proj4.defs("WGS84", "+proj=longlat +ellps=WGS84 +datum=WGS84 +no_defs");
|
|
|
- var transform1 = proj4("WGS84", "LOCAL"); //这个ok 是展开的平面投影 LOCAL即NAVVIS:TMERC
|
|
|
- var transform2 = proj4("+proj=tmerc +lat_0=0 +lon_0=123 +k=1 +x_0=500000 +y_0=0 +ellps=GRS80 +units=m +no_defs;");
|
|
|
+
|
|
|
+ let transform1 = proj4("WGS84", "LOCAL"); //这个ok 是展开的平面投影 LOCAL即NAVVIS:TMERC
|
|
|
+ let transform2 = proj4("+proj=tmerc +lat_0=0 +lon_0=123 +k=1 +x_0=500000 +y_0=0 +ellps=GRS80 +units=m +no_defs;");
|
|
|
//注:转入后再转出,和原来的有偏差。如果输入是local坐标,数字越大偏差越大,当百万时就明显了。如果是lonlat,很奇怪经度小于50时就乱了。
|
|
|
viewer.transform = {
|
|
|
- lonlatToLocal: transform1,
|
|
|
- lonlatTo4550: transform2 // 转大地坐标EPSG:4550
|
|
|
- };
|
|
|
- if (window.AMapWith84 && Potree.settings.mapCompany != 'google') {
|
|
|
- //需要转换, 因本地高德用的lonlat和数据里的84不一样. (google地图在国内也用的高德,国外84)
|
|
|
- var change = transform => {
|
|
|
- var forward = transform.forward;
|
|
|
- var inverse = transform.inverse;
|
|
|
- transform.forward = function (e, not84) {
|
|
|
- var needTran = e.x == void 0;
|
|
|
- if (needTran) var a1 = {
|
|
|
- x: e[0],
|
|
|
- y: e[1]
|
|
|
- };else var a1 = e;
|
|
|
- var a = not84 ? a1 : AMapWith84.wgs84ToAMap(a1);
|
|
|
- if (needTran) {
|
|
|
- a = [a.x, a.y];
|
|
|
- e[2] != void 0 && (a[2] = e[2]);
|
|
|
- } else {
|
|
|
- e.z != void 0 && (a.z = e.z);
|
|
|
- }
|
|
|
- return forward(a);
|
|
|
- };
|
|
|
- transform.inverse = function (e, not84) {
|
|
|
- var needTran = e.x == void 0;
|
|
|
- var a = inverse(e);
|
|
|
- needTran && (a = {
|
|
|
- x: a[0],
|
|
|
- y: a[1]
|
|
|
- });
|
|
|
- a = not84 ? a : AMapWith84.aMapToWgs84(a);
|
|
|
- if (needTran) {
|
|
|
- a = [a.x, a.y];
|
|
|
- e[2] != void 0 && (a[2] = e[2]);
|
|
|
- } else {
|
|
|
- e.z != void 0 && (a.z = e.z);
|
|
|
- }
|
|
|
- return a;
|
|
|
- };
|
|
|
- };
|
|
|
- for (var f in viewer.transform) {
|
|
|
- change(viewer.transform[f]);
|
|
|
- }
|
|
|
- }
|
|
|
+ lonlatToLocal : transform1,
|
|
|
+ lonlatTo4550 : transform2 // 转大地坐标EPSG:4550
|
|
|
+ }
|
|
|
+
|
|
|
+ if(window.AMapWith84 && Potree.settings.mapCompany != 'google'){//需要转换, 因本地高德用的lonlat和数据里的84不一样. (google地图在国内也用的高德,国外84)
|
|
|
+ let change = (transform)=>{
|
|
|
+ let forward = transform.forward
|
|
|
+ let inverse = transform.inverse;
|
|
|
+
|
|
|
+ transform.forward = function(e, not84){
|
|
|
+ let needTran = e.x == void 0
|
|
|
+ if(needTran)var a1 = {x:e[0],y:e[1]}
|
|
|
+ else var a1 = e
|
|
|
+ var a = not84 ? a1 : AMapWith84.wgs84ToAMap(a1)
|
|
|
+ if(needTran){
|
|
|
+ a = [a.x, a.y]; e[2] != void 0 && (a[2] = e[2])
|
|
|
+ }else{
|
|
|
+ e.z != void 0 && (a.z = e.z)
|
|
|
+ }
|
|
|
+ return forward(a)
|
|
|
+ }
|
|
|
+
|
|
|
+ transform.inverse = function(e, not84){
|
|
|
+ let needTran = e.x == void 0
|
|
|
+ var a = inverse(e)
|
|
|
+ needTran && (a = {x:a[0],y:a[1]})
|
|
|
+ a = not84 ? a : AMapWith84.aMapToWgs84(a)
|
|
|
+
|
|
|
+ if(needTran){
|
|
|
+ a = [a.x,a.y]; e[2] != void 0 && (a[2] = e[2])
|
|
|
+ }else{
|
|
|
+ e.z != void 0 && (a.z = e.z)
|
|
|
+ }
|
|
|
+ return a
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
+ }
|
|
|
+ for(let f in viewer.transform){
|
|
|
+ change(viewer.transform[f])
|
|
|
+ }
|
|
|
+ } */
|
|
|
+
|
|
|
viewer.mapViewer && viewer.mapViewer.mapLayer.maps[0].updateProjection();
|
|
|
}
|
|
|
data.forEach((dataset, index) => {
|
|
@@ -91204,6 +91203,13 @@
|
|
|
tileset.nextForceUpdate = true;
|
|
|
v = visi;
|
|
|
}
|
|
|
+ if (v) {
|
|
|
+ this.addEventListener('update_start', () => {
|
|
|
+ this.dispatchEvent('content_changed');
|
|
|
+ }, {
|
|
|
+ once: true
|
|
|
+ });
|
|
|
+ }
|
|
|
};
|
|
|
loadDone(result.model /* , null, fileInfo.url */);
|
|
|
} else if (fileInfo.fileType == 'dxf') {
|
|
@@ -92532,6 +92538,68 @@
|
|
|
fetchMethod: 'post'
|
|
|
}, callback, callback);
|
|
|
}
|
|
|
+ function setLonlat(lon, lat) {
|
|
|
+ var locationLonLat = [lon, lat];
|
|
|
+ if (window.AMapWith84) {
|
|
|
+ //需要转换为高德的,但该函数不准确,转入后再转出,和原来的有偏差. navvis的我看data中存的globalLocation直接输入到高德地图后的定位和其要展示的定位一致,而我们要转为高德后才一致,猜测是navvis后台转为了高德可用的经纬度。 若不转的话,其他看起来没问题,仅高德地图定位不准确,因其为被加密后的火星坐标系。
|
|
|
+ locationLonLat = AMapWith84.wgs84ToAMap({
|
|
|
+ x: lon,
|
|
|
+ y: lat
|
|
|
+ });
|
|
|
+ locationLonLat = [locationLonLat.x, locationLonLat.y];
|
|
|
+ }
|
|
|
+ proj4.defs("LOCAL", "+proj=tmerc +ellps=WGS84 +lon_0=" + locationLonLat[0].toPrecision(15) + " +lat_0=" + locationLonLat[1].toPrecision(15)); //高德坐标系
|
|
|
+ proj4.defs("LOCAL_MAP", "+proj=tmerc +ellps=WGS84 +lon_0=" + locationLonLat[0].toPrecision(15) + " +lat_0=" + locationLonLat[1].toPrecision(15)); //地图和本地一样
|
|
|
+ proj4.defs("WGS84", "+proj=longlat +ellps=WGS84 +datum=WGS84 +no_defs");
|
|
|
+ var transform1 = proj4("WGS84", "LOCAL"); //这个ok 是展开的平面投影 LOCAL即NAVVIS:TMERC
|
|
|
+ var transform2 = proj4("+proj=tmerc +lat_0=0 +lon_0=123 +k=1 +x_0=500000 +y_0=0 +ellps=GRS80 +units=m +no_defs;");
|
|
|
+ //注:转入后再转出,和原来的有偏差。如果输入是local坐标,数字越大偏差越大,当百万时就明显了。如果是lonlat,很奇怪经度小于50时就乱了。
|
|
|
+ viewer.transform = {
|
|
|
+ lonlatToLocal: transform1,
|
|
|
+ lonlatTo4550: transform2 // 转大地坐标EPSG:4550
|
|
|
+ };
|
|
|
+ if (window.AMapWith84 && Potree.settings.mapCompany != 'google') {
|
|
|
+ //需要转换, 因本地高德用的lonlat和数据里的84不一样. (google地图在国内也用的高德,国外84)
|
|
|
+ var change = transform => {
|
|
|
+ var forward = transform.forward;
|
|
|
+ var inverse = transform.inverse;
|
|
|
+ transform.forward = function (e, not84) {
|
|
|
+ var needTran = e.x == void 0;
|
|
|
+ if (needTran) var a1 = {
|
|
|
+ x: e[0],
|
|
|
+ y: e[1]
|
|
|
+ };else var a1 = e;
|
|
|
+ var a = not84 ? a1 : AMapWith84.wgs84ToAMap(a1);
|
|
|
+ if (needTran) {
|
|
|
+ a = [a.x, a.y];
|
|
|
+ e[2] != void 0 && (a[2] = e[2]);
|
|
|
+ } else {
|
|
|
+ e.z != void 0 && (a.z = e.z);
|
|
|
+ }
|
|
|
+ return forward(a);
|
|
|
+ };
|
|
|
+ transform.inverse = function (e, not84) {
|
|
|
+ var needTran = e.x == void 0;
|
|
|
+ var a = inverse(e);
|
|
|
+ needTran && (a = {
|
|
|
+ x: a[0],
|
|
|
+ y: a[1]
|
|
|
+ });
|
|
|
+ a = not84 ? a : AMapWith84.aMapToWgs84(a);
|
|
|
+ if (needTran) {
|
|
|
+ a = [a.x, a.y];
|
|
|
+ e[2] != void 0 && (a[2] = e[2]);
|
|
|
+ } else {
|
|
|
+ e.z != void 0 && (a.z = e.z);
|
|
|
+ }
|
|
|
+ return a;
|
|
|
+ };
|
|
|
+ };
|
|
|
+ for (var f in viewer.transform) {
|
|
|
+ change(viewer.transform[f]);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
|
|
|
//site_model
|
|
|
/* {
|
|
@@ -92853,6 +92921,7 @@
|
|
|
exports.pointBudget = pointBudget;
|
|
|
exports.resourcePath = resourcePath;
|
|
|
exports.saveProject = saveProject;
|
|
|
+ exports.setLonlat = setLonlat;
|
|
|
exports.settings = settings;
|
|
|
exports.start = start;
|
|
|
exports.version = version;
|