xzw 1 год назад
Родитель
Сommit
9d53f15969
2 измененных файлов с 51 добавлено и 40 удалено
  1. 1 1
      src/custom/objects/tool/MeasuringTool.js
  2. 50 39
      src/custom/viewer/map/Map.js

+ 1 - 1
src/custom/objects/tool/MeasuringTool.js

@@ -617,7 +617,7 @@ export class MeasuringTool extends THREE.EventDispatcher{
 	
     
 	render(o={}){
-        if(this.scene.children.length == 0)return
+        if(this.scene.children.filter(e=>e.visible).length == 0)return
         
         Potree.Utils.setCameraLayers(o.camera, ['measure'])
 		

+ 50 - 39
src/custom/viewer/map/Map.js

@@ -216,10 +216,9 @@ export class MapLayer extends THREE.EventDispatcher{ // 包括了 MapLayerBase S
  
 
 export class TiledMapBase extends THREE.EventDispatcher{
-    constructor(/* t,  */name, mapLayer, tileColor, projection){
+    constructor( name, mapLayer, tileColor, projection){
         super();
-        this.name = name
-        //this.TransformService = t,
+        this.name = name 
         this.mapLayer = mapLayer,
         this.tileColor = tileColor,
         this.bias = 0 
@@ -229,13 +228,10 @@ export class TiledMapBase extends THREE.EventDispatcher{
         this.objectGroupAdded = !1,
         this.baseTile = new MapTile(this, this.objectGroup, this.tileColor, null, '0'),
         this.isTileVisibleBox = new THREE.Box3,
-        this.isTileVisibleVec = new THREE.Vector3
-        
-        
+        this.isTileVisibleVec = new THREE.Vector3 
         this.projection = projection
         this._zoomLevel = 0;//1-20
-        
-        
+         
         this.objectGroup.addEventListener('isVisible',()=>{
             this.mapLayer.viewer.mapChanged = true
         })
@@ -718,38 +714,24 @@ proj4.defs("EPSG:3857", "+title=WGS 84 / Pseudo-Mercator +proj=merc +a=6378137 +
 
 export class TiledMapOpenStreetMap extends TiledMapBase{
     constructor(mapLayer, tileColor){
-        
-        let baseUrl, attribution, projection, maxDepth;
          
+        //Potree.settings.mapCompany = 'google' 
         
-        
-        if(Potree.settings.mapCompany == 'google'){
-            projection = "EPSG:900913"//"EPSG:4326"//4550
-            baseUrl = "https://mt2.google.com/vt/lyrs=m@159000000&hl=zh-CN&gl=cn&x=${x}&y=${y}&z=${z}&s=mt1"  /* "http://mt2.google.cn/vt/lyrs=m@177000000&hl=zh-CN&gl=cn&src=app&x=${x}&y=${y}&z=${z}"  */   //最高只到19
-            attribution = "© PopSmart,  © 谷歌地图"
-            maxDepth = 22           
-        }else{
-            projection = "EPSG:3857"
-            baseUrl = "https://wprd04.is.autonavi.com/appmaptile?lang=zh_cn&style=7&yrs=m&x=${x}&y=${y}&z=${z}"    // 
-            //baseUrl = "https://webst01.is.autonavi.com/appmaptile?lang=zh_cn&style=6&yrs=m&x=${x}&y=${y}&z=${z}"    //卫星 maxDepth = 18   
-            //搜索高德地图瓦片url 
-            
-            attribution = "© PopSmart,  © 高德地图"
-            maxDepth = 19   
-        }
-        
-        super('map', mapLayer, tileColor,  projection ) //EPSG projection
+        super('map', mapLayer, tileColor/* ,  projection */ ) //EPSG projection
         //this.baseUrl = "https://wprd03.is.autonavi.com/appmaptile?style=7&x=${x}&y=${y}&z=${z}",
         //this.baseUrl = "https://webrd01.is.autonavi.com/appmaptile?lang=zh_cn&size=1&scale=1&style=7&x=${x}&y=${y}&z=${z}" //最高只到18 level
-        this.maxDepth = maxDepth
-        this.baseUrl = baseUrl; 
-        this.attribution = attribution
+        this.switchStyle()
         this.tileSizePx = 256
         this.mapSizeM = 40075017   //总占据多少米(地球赤道周长)    和三维空间的不一样 - -, 空间上的是直径,地图上的是半个圆周
-        
         this.bias = 0.5 
          
-  
+        if(Potree.settings.mapCompany == 'google'){
+            this.attribution = "© PopSmart,  © 谷歌地图"
+            this.projection = "EPSG:900913"      //"EPSG:4326"//4550
+        }else{
+            this.attribution = "© PopSmart,  © 高德地图"
+            this.projection = "EPSG:3857"
+        }
             
     }
     
@@ -759,17 +741,46 @@ export class TiledMapOpenStreetMap extends TiledMapBase{
 
 
     switchStyle(style = 'standard'){
-        if(Potree.settings.mapCompany == 'google')return 
+        //if(Potree.settings.mapCompany == 'google')return 
         if(style == this.style)return
         
-        if(style == 'satellite'){//卫星
-            this.maxDepth = 18
-            this.baseUrl = "https://webst01.is.autonavi.com/appmaptile?lang=zh_cn&style=6&yrs=m&x=${x}&y=${y}&z=${z}"
-        }else{
-            this.maxDepth = 19
-            this.baseUrl = "https://wprd04.is.autonavi.com/appmaptile?lang=zh_cn&style=7&yrs=m&x=${x}&y=${y}&z=${z}"    // 
+        if(Potree.settings.mapCompany == 'google'){
+            if(style == 'satellite'){//卫星
+                this.baseUrl = "https://mt2.google.com/vt/lyrs=y@159000000&hl=zh-CN&gl=cn&x=${x}&y=${y}&z=${z}&s=mt1"  /* "http://mt2.google.cn/vt/lyrs=m@177000000&hl=zh-CN&gl=cn&src=app&x=${x}&y=${y}&z=${z}"  */   //最高只到19
+                this.maxDepth = 22     
+            }else{
+                this.baseUrl = "https://mt2.google.com/vt/lyrs=m@159000000&hl=zh-CN&gl=cn&x=${x}&y=${y}&z=${z}&s=mt1"  /* "http://mt2.google.cn/vt/lyrs=m@177000000&hl=zh-CN&gl=cn&src=app&x=${x}&y=${y}&z=${z}"  */   //最高只到19
+                this.maxDepth = 22     
+            }     
+            /* 1)lyrs= 表示的是图层类型,即瓦片类型,具体含义如下: 
+            m:路线图 
+            t:地形图 
+            p:带标签的地形图 
+            s:卫星图 
+            y:带标签的卫星图 
+            h:标签层(路名、地名等)
+            2)& gl=CN 
+            谷歌地图针对中国有两套坐标,一套做了偏移,一套没有。经测试在url加入gl=cn地图会有偏移。 
+            Tips:如果谷歌地图和RTK测量的WGS84坐标有偏差,可以尝试在url里去掉& gl=cn。
+            5)&hl= 
+            设置地图注记文字语言类型,缺省默认为中文。 
+            hl=nl 中英双语 
+            hl=zh-CN 中文
+            */
             
+        }else{
+            //baseUrl = "https://webst01.is.autonavi.com/appmaptile?lang=zh_cn&style=6&yrs=m&x=${x}&y=${y}&z=${z}"    //卫星 maxDepth = 18   
+            //搜索高德地图瓦片url 
+              
+            if(style == 'satellite'){//卫星
+                this.maxDepth = 18
+                this.baseUrl = "https://webst01.is.autonavi.com/appmaptile?lang=zh_cn&style=6&yrs=m&x=${x}&y=${y}&z=${z}"
+            }else{
+                this.maxDepth = 19
+                this.baseUrl = "https://wprd04.is.autonavi.com/appmaptile?lang=zh_cn&style=7&yrs=m&x=${x}&y=${y}&z=${z}"    // 
+            }
         }
+        
         this.style = style
         this.setEnable(false)
         this.setEnable(true)