浏览代码

fix: shape 解析的bug

xzw 7 月之前
父节点
当前提交
0313fb0481
共有 2 个文件被更改,包括 19 次插入15 次删除
  1. 18 14
      public/lib/potree/potree.js
  2. 1 1
      public/lib/potree/potree.js.map

+ 18 - 14
public/lib/potree/potree.js

@@ -22078,7 +22078,7 @@
 	          //移动过后使用移动后的坐标
 	          model.position.copy(prop.position);
 	        } else {
-	          //用户没设置位置
+	          //用户没设置位置(首次添加后没按保存)
 	          if (!model.isPointcloud && prop.raw.wgs84) {
 	            //有经纬度   
 	            var locationLonLat = prop.raw.wgs84.split(',').map(e => parseFloat(e));
@@ -39176,7 +39176,7 @@
 	          };
 	          resolve(_transform2);
 	        } catch (e) {
-	          console.log(e, '建立proj4 transform 失败', name);
+	          console.warn(e, '建立proj4 transform 失败', name);
 	          resolve();
 	        }
 	      }, () => {
@@ -39188,6 +39188,7 @@
 	}
 	;
 	function parsePrjToProj4(prjString, model) {
+	  var _json$geogcs;
 	  //将prj的内容变为proj4的transform
 
 	  var def = '';
@@ -39195,15 +39196,15 @@
 	  var projectionType;
 	  var datum = '';
 	  var ellipsoid = '';
-	  var centralMeridian = '';
+	  var centralLon = '0',
+	    centralLat = '0';
 	  var scaleFactor = '1';
-	  var falseEasting = '0';
-	  var falseNorthing = '0';
-	  var latitudeOfOrigin = '0';
+	  var falseEasting = '0',
+	    falseNorthing = '0';
 	  if (json.projection == 'Transverse_Mercator') {
 	    projectionType = 'tmerc';
 	  } else if (!json.projection) {
-	    projectionType = 'lonlat';
+	    projectionType = 'longlat';
 	  } else {
 	    projectionType = projection;
 	    console.log('unknown projection:', json.projection);
@@ -39211,19 +39212,22 @@
 	  if (json.parameters) {
 	    falseEasting = json.parameters.false_easting;
 	    falseNorthing = json.parameters.false_northing;
-	    centralMeridian = json.parameters.central_meridian;
-	    latitudeOfOrigin = json.parameters.latitude_of_origin;
+	    centralLon = json.parameters.central_meridian;
+	    centralLat = json.parameters.latitude_of_origin;
 	    scaleFactor = json.parameters.scale_factor;
 	  }
-	  if (json.spheroid) {
-	    if (json.spheroid.name.toLowerCase().includes('wgs84')) ellipsoid = 'WGS84';
+	  if ((_json$geogcs = json.geogcs) !== null && _json$geogcs !== void 0 && _json$geogcs.spheroid) {
+	    var spheroid = json.geogcs.spheroid.name.toLowerCase().replace('_', '');
+	    if (spheroid.includes('wgs84') || spheroid.includes('wgs1984')) ellipsoid = 'WGS84';
 	  }
-	  def += "+proj=".concat(projectionType);
-	  def += "+lat_0=".concat(latitudeOfOrigin, " ");
-	  def += "+lon_0=".concat(centralMeridian, " ");
+	  def += "+proj=".concat(projectionType, " ");
+	  def += "+lat_0=".concat(centralLat, " ");
+	  def += "+lon_0=".concat(centralLon, " ");
 	  def += "+k=".concat(scaleFactor, " ");
 	  def += "+x_0=".concat(falseEasting, " ");
 	  def += "+y_0=".concat(falseNorthing, " ");
+	  ellipsoid && (def += "+ellps=".concat(ellipsoid, " "));
+	  def += '+units=m +no_defs';
 	  return def;
 	}
 	function prjToJson(prjString) {

文件差异内容过多而无法显示
+ 1 - 1
public/lib/potree/potree.js.map