xzw 1 rok pred
rodič
commit
51763b5f98

+ 2 - 1
package.json

@@ -9,12 +9,13 @@
     "preview": "vite preview"
   },
   "dependencies": {
-    "simaqcore": "1.2.0",
     "@vueup/vue-quill": "^1.2.0",
     "ant-design-vue": "^3.3.0-beta.3",
     "axios": "^0.27.2",
+    "coordtransform": "^2.1.2",
     "less": "^4.1.3",
     "mitt": "^3.0.0",
+    "simaqcore": "1.2.0",
     "vite-plugin-mkcert": "^1.10.1",
     "vue": "^3.2.37",
     "vue-cropper": "1.0.2",

+ 123 - 54
public/lib/potree/potree.js

@@ -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;

Rozdielové dáta súboru neboli zobrazené, pretože súbor je príliš veľký
+ 1 - 1
public/lib/potree/potree.js.map


+ 4 - 4
public/test-case/model-list.json

@@ -16,7 +16,7 @@
                 ],
                 "position": {
                     "x": -0.32228,
-                    "y": -48.50493,
+                    "y": -0.50493,
                     "z": 0.0
                 },
                 "rotation": {
@@ -76,7 +76,7 @@
                 ],
                 "position": {
                     "x": 0.16552170253057596,
-                    "y": -11.152602403,
+                    "y": -0.152602403,
                     "z": 0.10249640482
                 },
                 "rotation": {
@@ -135,8 +135,8 @@
                     100.0
                 ],
                 "position": {
-                    "x": -11.43192,
-                    "y": -17.28869,
+                    "x": -0.43192,
+                    "y": -0.28869,
                     "z": 2.31154
                 },
                 "rotation": {

+ 31 - 4
src/sdk/cover/index.js

@@ -2,7 +2,27 @@ import mitt from 'mitt'
 
 import axios from 'axios' //{ axios } from '@/api'
 //import * as THREE from '@/assets/lib/three.module.min.js'
+/* import libTransform from 'coordtransform';
 
+// 84坐标转高德 (国外地区用84,所以地理注册时填的是84,我这需要转成高德)
+const wgs84ToAMap = (pos ) => {
+  const latlng = libTransform.wgs84togcj02(pos.x, pos.y)
+  return {
+    x: latlng[0],
+    y: latlng[1]
+  }
+}
+// 高德坐标转84
+const aMapToWgs84 = (pos ) => { 
+  const latlng = libTransform.gcj02towgs84(pos.x, pos.y)
+  return {
+    x: latlng[0],
+    y: latlng[1]
+  }
+}
+window.AMapWith84 = {
+    aMapToWgs84, wgs84ToAMap
+} */
 /* 
 
 新版的融合 支持全景漫游
@@ -62,8 +82,13 @@ export const enter = ({dom, mapDom, isLocal, lonlat, scenes }) => {
             timeline: false,
             navigationHelpButton: false,
             //imageryProvider : Cesium.createOpenStreetMapImageryProvider({url : 'https://a.tile.openstreetmap.org/'}),
-            imageryProvider : Cesium.UrlTemplateImageryProvider({
-                url : 'https://webst0{0-7}.is.autonavi.com/appmaptile?lang=zh_cn&size=1&scale=1&style=7&x={x}&y={y}&z={z}&token=YOUR_API_KEY',
+            imageryProvider : Cesium.UrlTemplateImageryProvider({ //直接用84坐标,不用转高德
+                
+            //"https://wprd04.is.autonavi.com/appmaptile?lang=zh_cn&style=7&yrs=m&x=${x}&y=${y}&z=${z}"    //  
+                  
+                
+                //url : 'https://webst0{0-7}.is.autonavi.com/appmaptile?lang=zh_cn&size=1&scale=1&style=7&x={x}&y={y}&z={z}&token=YOUR_API_KEY',
+                url : 'https://wprd04.is.autonavi.com/appmaptile?lang=zh_cn&size=1&scale=1&style=7&x={x}&y={y}&z={z}&token=YOUR_API_KEY',
                 minimumLevel : 0,
                 maximumLevel : 19
             }),
@@ -73,7 +98,7 @@ export const enter = ({dom, mapDom, isLocal, lonlat, scenes }) => {
             terrainShadows: Cesium.ShadowMode.DISABLED, //terrain地形
         }); 
         
-        proj4.defs("LOCAL", "+proj=tmerc +ellps=WGS84 +lon_0=" + lonlat[0].toPrecision(15) + " +lat_0=" + lonlat[1].toPrecision(15)); //高德坐标系
+       /*  proj4.defs("LOCAL", "+proj=tmerc +ellps=WGS84 +lon_0=" + lonlat[0].toPrecision(15) + " +lat_0=" + lonlat[1].toPrecision(15)); //高德坐标系
         proj4.defs("LOCAL_MAP", "+proj=tmerc +ellps=WGS84 +lon_0=" + lonlat[0].toPrecision(15) + " +lat_0=" + lonlat[1].toPrecision(15)); //地图和本地一样
         proj4.defs("WGS84", "+proj=longlat +ellps=WGS84 +datum=WGS84 +no_defs");
          
@@ -83,7 +108,9 @@ export const enter = ({dom, mapDom, isLocal, lonlat, scenes }) => {
         viewer.transform = {
             lonlatToLocal : transform1,
             lonlatTo4550 : transform2       // 转大地坐标EPSG:4550  
-        }  
+        }  */  
+        //lonlat = [113.595236803415,22.3665168584444]//[113.600356,22.364093]
+        Potree.setLonlat(lonlat[0],lonlat[1])
     }