Bladeren bron

Merge branch 'master' of http://192.168.0.115:3000/4dkankan/laser_v1

jinx 4 jaren geleden
bovenliggende
commit
fd674f4d38
5 gewijzigde bestanden met toevoegingen van 111 en 19 verwijderingen
  1. 24 9
      IndoorViewerAPI.js
  2. 25 4
      locat/addDataSet.html
  3. 3 1
      locat/components/image-transform/index.js
  4. 1 0
      locat/js/proj4.js
  5. 58 5
      笔记.js

+ 24 - 9
IndoorViewerAPI.js

@@ -191420,18 +191420,33 @@ and limitations under the License.
         ,
         t.prototype.updateSubTiles = function(e, n, r, o, a, s, c) {
             for (var l = !0, u = [-.25 * o, .25 * o, -.25 * o, .25 * o], d = [.25 * o, .25 * o, -.25 * o, -.25 * o], p = 0; p < 4; ++p) {
-                var h = c + p.toString(10);
-                if (!e.tilePresenceMap || e.tilePresenceMap[h]) {
+                var h = c + p.toString(10);  //一级(512):0 1 2 3分别为左上、右上、左下、右下。二级(1024)就是把一级的每一块分裂,如00 01 02 03分别是0的左上、右上、左下、右下……
+                //if (!e.tilePresenceMap || e.tilePresenceMap[h]) { //去掉判断,直接显示
                     var f = a + u[p]
                       , m = s + d[p];
-                    i.sharedData.tempVector.set(f, m, 0),
-                    e.isTileVisible(i.sharedData.tempVector, .5 * o, n) ? (this.children[p] || (this.children[p] = new t(this.mapLayer,this.objectGroup,this.tileColor)),
+                    i.sharedData.tempVector.set(f, m, 0);
+                    if(e.isTileVisible(i.sharedData.tempVector, .5 * o, n)){
+                        if(log ){
+                            console.log('isTileVisible '+h)
+                        }
+                         
+                        this.children[p] || (this.children[p] = new t(this.mapLayer,this.objectGroup,this.tileColor))
+                        l = this.children[p].update(e, n, r - 1, .5 * o, f, m, h, log) && l  
+                    }else{
+                        if(this.children[p]){
+                            this.children[p].remove() 
+                            delete this.children[p]
+                        }
+                          
+                    }
+                    /* e.isTileVisible(i.sharedData.tempVector, .5 * o, n) ? (this.children[p] || (this.children[p] = new t(this.mapLayer,this.objectGroup,this.tileColor)),
                     l = this.children[p].update(e, n, r - 1, .5 * o, f, m, h) && l) : this.children[p] && (this.children[p].remove(),
-                    delete this.children[p])
-                }
+                    delete this.children[p]) */
+                //}
             }
             return l && this.removeObject3D(),
-            l
+            l 
+            
         }
         ,
         t.prototype.createTileObject = function(t, e, n, a) {
@@ -191603,7 +191618,7 @@ and limitations under the License.
             c.projection = n.crsLocal,
             c.zIndex = 0,
             c.textureLoader = a.getTextureLoader(),
-            c._tilePresenceMap = e.decodeBitStream(c.tiledMapEntity.quadtree),
+            c._tilePresenceMap = e.decodeBitStream(c.tiledMapEntity.quadtree),//包含tile分裂信息,如果写错了会造成tile显示不全
             c
         }
         return r(e, t),
@@ -208435,7 +208450,7 @@ and limitations under the License.
             }
         }
         ,
-        t.prototype.getTransformationMatrix = function(t) {
+        t.prototype.getTransformationMatrix = function(t) {//点云截取   所有点在乘上这个矩阵后, 还能落在 1 * 1 * 1的box内的点就是所裁剪的
             var e = this.ViewService.mainView.getVolumeClippingLayer().getBoxFrame()
               , n = (new o.Matrix4).getInverse(e.matrixWorld)
               , i = t.m2w_;

+ 25 - 4
locat/addDataSet.html

@@ -136,10 +136,10 @@
                             </div>
                         </div>
 
-                        <p class="itemTitle">EPSG 坐标系 4326</p>
+                        <p class="itemTitle">EPSG 坐标系 </p>
                         <div class="formItem">
                             <div class="allIpt">
-                                <input type="text" v-model="EPSG" name="EPSG" id="EPSG" value="EPSG:4326" />
+                                <input type="text" v-model="EPSG" name="EPSG" id="EPSG" />
                             </div>
 
                         </div>
@@ -173,12 +173,33 @@
 
     <script src="./js/vue.js"></script>
     <script src="./js/axios.min.js"></script>
+    <script src="./js/proj4.js"></script>
     <script src="./components/image-transform/index.js"></script>
     <script type="text/javascript">
         //输入经纬度就可以定位
     </script>
 
     <script>
+        //坐标转换定义  部分 定义一个 cgc_2000的38度带投影坐标系
+        proj4.defs( "EPSG:99999", "+proj=tmerc +lat_0=0 +lon_0=114 +k=1 +x_0=500000 +y_0=0 +ellps=GRS80  +units=m +no_defs");
+        var projection = new ol.proj.Projection({
+            code: "EPSG:99999",
+            extent: [334238.8538694997, 425861.702215328, 599418.034383447, 5936877.5664797],
+            units: 'm',
+            axisOrientation: 'neu',
+            global: false
+        });
+        //结合proj4在ol中自定义坐标系
+        ol.proj.addProjection(projection);
+        ol.proj.addCoordinateTransforms("EPSG:4326", "EPSG:99999",
+            function (coordinate) {
+                return proj4("EPSG:4326", "EPSG:99999", coordinate);
+            },
+            function (coordinate) {
+                return proj4("EPSG:99999", "EPSG:4326", coordinate);
+            }
+        );  
+
         new Vue({
             el: '#app',
             data() {
@@ -199,7 +220,7 @@
                     blon: '123',
                     blat: '22',
                     balt: '0',
-                    EPSG: 'EPSG:4326',
+                    EPSG: 'EPSG:99999',
                     ageControlLocation1: [],
                     ageControlLocation2: [],
                     gpsControlCoordinate1: [],
@@ -294,7 +315,7 @@
                     vLayer.type = "con_point";
                     this.map.addLayer(vLayer)
                     this.pointLayerArray.push(vLayer);
-                    let labelCoords = ol.proj.transform([lon, lat], "EPSG:4326", "EPSG:3857");
+                    let labelCoords = ol.proj.transform([lon, lat], 'EPSG:4326', 'EPSG:99999');
                     let feature = new ol.Feature({
                         geometry: new ol.geom.Point(labelCoords)
                     });

+ 3 - 1
locat/components/image-transform/index.js

@@ -13,7 +13,7 @@
             },
             screenToLatlan({ x, y }) {
                 const real = map.getCoordinateFromPixel([x, y])
-                const latlan = ol.proj.transform(real, 'EPSG:3857', 'EPSG:4326')
+                const latlan = ol.proj.transform(real, 'EPSG:4326', 'EPSG:99999')
                 return latlan
             }
         }
@@ -116,6 +116,7 @@
 
     const genImgCanvasTransfrom = (canvas, arrayImgs, scale, initPos) =>
         (transform) => {
+            console.log(scale)
             const ctx = canvas.getContext('2d');
             const dscale = transform.scale || [1, 1]
             const resize = 1 / (scale * 10)
@@ -203,6 +204,7 @@
                         imgData.height = height
                     }
                 })
+                console.log(scale, size)
                 // pos.x -= imgData.width / 2 * scale
                 // pos.y -= imgData.height / 2 * scale
                 canvas.width = size[0];

File diff suppressed because it is too large
+ 1 - 0
locat/js/proj4.js


+ 58 - 5
笔记.js

@@ -8,31 +8,84 @@ filter中的:
 数据集校准后不变的值有:
 dataset_orientation(永远存储最初始的点位的quaternion,在旋转时也不变,因此它等于没有旋转时的orientation)---- image.datasetOrientation
 dataset_floor_orientation(一般和dataset_orientation值一样) 
-dataset_location
+dataset_location 真实的三维坐标
 dataset_floor_location
 
 
 
 数据集校准后改变的值有:
 orientation----image.orientation(在旋转时实时变,且是根据模型旋转度数和dataset_orientation来算的,所以如果dataset_orientation不对,就会算错。)
-location----image.location
+location----image.location   xy为经纬度
 floor_location
 
 
 ------------------------------------------------
 
+查看全局: 
+var view = window.IV.getMainView()
+view.currentImage.id  
+view.ImageService.images
 
-MeasurementLineMaterial : 测量线材质, 有蓝色标准实线和灰色透明虚线两种状态
 
 
-this.underlayScene.children[3] 包含32个子mesh, 是全景图sphere   其材质fragment在下方
 
-加载深度图loadDepthImage   获取深度值getDepth(用于更新reticule位置)。深度图用于修改全景图sphere的gl_FragDepthEXT
 
 
+POI: 兴趣点   PoiService  PoiEditorDirective PoiEntity
+t.prototype.isPreviewMenuVisible  ---- canDisplayResultDetails  --- PoiService.openedPoi - setOpenedPoi
+
+MeasurementLineMaterial : 测量线材质, 有蓝色标准实线和灰色透明虚线两种状态
 
 
+数据集校准 saveAlignment =      selectedDatasets
 
+this.underlayScene.children[3] 包含32个子mesh, 是全景图sphere   其材质fragment在下方
+overlayScene 里有marker , name: "location" ?
+
+QuaternionFactory VectorFactory
+ 
+加载深度图loadDepthImage   获取深度值getDepth(用于更新reticule位置)。深度图用于修改全景图sphere的gl_FragDepthEXT
+getCoordinates doPointCloudPicking doDepthImagePicking
+
+t.NORMAL = "normal",
+t.DATASET_ALIGNMENT = "datasetAlignment",
+t.GEO_REGISTRATION = "GeoRegistration",
+t.SITE_MODEL_EDITOR = "SiteModelEditor",
+t.NAV_GRAPH_EDITOR = "NavGraphEditor",
+t.DOWNLOAD_POINT_CLOUD = "DownloadPointCloud",
+t.MEASUREMENTS = "Measurements"
+
+
+//--关于地图和 地图上的图片-------关键词mapSizeM
+updateSubTiles更新地图tile,如果不存在就加载
+
+
+//图片上传https://testlaser.4dkankan.com/maxkk/t-iksBApb/locat/addDataSet.html
+var QuaternionFactory = { // 同 IndoorViewerAPI的 QuaternionFactory.toArray
+    toArray : function(quaternion){ 
+        var rot90 =  (new THREE.Quaternion).setFromAxisAngle(new THREE.Vector3(0,0,1), THREE.Math.degToRad(-90)) //add 转入时旋转90度
+          , rot90Invert = rot90.clone().inverse()//add 转出时旋回90度
+        var t1 = quaternion.clone().multiply(rot90Invert); 
+        var e = t1.toArray();
+        return [e[3], e[0], e[1], e[2]] 
+    }
+}
+//获取旋转:
+var getQuaternion = function(angle){//angle:0-360 角度
+    var quaternion = new THREE.Quaternion().setFromEuler(new THREE.Euler(0,0,THREE.Math.degToRad(-angle)));
+    return QuaternionFactory.toArray(quaternion)
+    
+}
+//获取缩放    
+var getSize = function(imgWidth, scale){//imgWidth:图片宽度, scale缩放值(x==y)
+    var level = imgWidth / 1024;  //以1024为基准
+    return 95.54628610610962 * level * scale; // 95.54628610610962 = 38.21851444244385 * (2+0.5), 其中38.21851444244385 = mapSizeM / Math.pow(2,maxDepth) = 40075017 / Math.pow(2,20) 可能表示地图在缩放zoom为20时的单块宽度
+                                            //0.5是试出来的,因为图片层的bias=0.5, 暂不知道其用处,所以试用了下……
+                                            //另:可能不是*2.5,  也许是*256/100 ?  不知道如何精确测试下
+                                            //有出现过一次错误是2048时的图但是大了一倍,发现是传图的那个网页在缩放值为0.1(即图为1:1显示,函数canvasFunction(extent, scale )时只有1024大小,后来刷新重新操作就是2048然后就正确。所以可能是这个网页出错。
+} 
+//位置直接使用中心点的经纬度               
+//-------------------------------------------------
 
 =======shader=======
 全景图 fragment