bill 2 лет назад
Родитель
Сommit
093772d28b
5 измененных файлов с 25 добавлено и 150 удалено
  1. 0 9
      public/static/lib/socketlib.js
  2. 0 2
      src/sdk/laser/index.ts
  3. 0 129
      src/sdk/laser/transform.ts
  4. 0 1
      src/sdk/types/sdk.ts
  5. 25 9
      src/store/setup.ts

Разница между файлами не показана из-за своего большого размера
+ 0 - 9
public/static/lib/socketlib.js


+ 0 - 2
src/sdk/laser/index.ts

@@ -10,8 +10,6 @@ export const laserFactory = (props: LaserSDKProps, store?: Store): LaserSDK => {
   const laser = enter({
     dom: props.sceneEl,
     number: props.num,
-    cropArgs: store?.setup.crop?.models || null,
-    datasetId: store ? store.setup.datasetId : null,
     staticPrefix,
     ...props,
   } as any);

+ 0 - 129
src/sdk/laser/transform.ts

@@ -1,129 +0,0 @@
-import { Pos } from '../types'
-import proj4 from 'proj4'
-
-export type Conversion = {
-    scale: number
-    rotation: number
-    translate: Pos
-}
-
-enum Coordinate {
-    AMap = `EPSG:4490`,
-    WebMercator = `EPSG:4547`,
-}
-
-const definitions = {
-    [Coordinate.AMap]: `+proj=longlat +ellps=GRS80 +no_defs`,
-    [Coordinate.WebMercator]: `+proj=tmerc +lat_0=0 +lon_0=114 +k=1 +x_0=500000 +y_0=0 +ellps=GRS80 +units=m +no_defs`,
-} as const
-
-for (const coord in definitions) {
-    proj4.defs(coord, definitions[coord])
-}
-
-/**
- * 通过两个映射点计算出矩阵
- */
-export const calcTransformByPoints = () => {
-    // 数据集初始化校准
-    // var fakePositions = [ {
-    //         x: -1.208132028579712,
-    //         y: 0.04820600152015686,
-    //         z: -2.257599115371704,
-    //     },
-    //     {
-    //         x: 1.6327489614486694,
-    //         y: 0.056550998240709305,
-    //         z: -2.1368539333343506,
-    //     },{
-    //         x: 0.05691400170326233,
-    //         y: 0.04810800030827522,
-    //         z: 0.97919100522995,
-    //     },{
-    //         x: -0.5570799708366394,
-    //         y: 0.04639599844813347,
-    //         z: 3.0515389442443848 ,
-    //     }
-    // ]
-    // var realPositions = [
-    //         { x: 458249.577950831, y: 2474529.667443291  },
-    //         { x: 458247.51758545433, y: 2474531.6324389814 },
-    //         {x: 458250.7569026919, y: 2474532.9341176464 },
-    //         {x: 458252.6196984933, y: 2474534.0980041157 }
-    //     ]//正确点位的点位
-    // fakePositions = fakePositions.map(e=>{
-    //     return new THREE.Vector3(e.x, -e.z, 0);
-    // })
-    // realPositions = realPositions.map(e=>{
-    //     return new THREE.Vector3(e.x, e.y, 0);
-    // })
-    // var moveVec = new THREE.Vector3().subVectors(realPositions[0], fakePositions[0]) //平移向量
-    // var vec1 = new THREE.Vector3().subVectors(fakePositions[0], fakePositions[1]) //旧的向量
-    // var vec2 = new THREE.Vector3().subVectors(realPositions[0], realPositions[1])//新的向量
-    // var angle = vec1.angleTo(vec2)
-    // if(vec1.clone().cross(vec2).z < 0)angle *= -1 //这里不确定是<0还是>0
-    // var matrix = new THREE.Matrix4().setPosition(moveVec.clone().sub(realPositions[0]))
-    // var rotateMatrix = new THREE.Matrix4().makeRotationAxis(new THREE.Vector3(0,0,1), angle );
-    // matrix.premultiply(rotateMatrix)
-    // var moveBackMatrix = new THREE.Matrix4().setPosition(realPositions[0])
-    // matrix.premultiply(moveBackMatrix)
-    // var pos = fakePositions.map(e=>{
-    //     return e.clone().applyMatrix4(matrix)
-    // })
-}
-
-/**
- * 通过矩阵信息推导转化后的点信息
- */
-export const transformPoint = (point: Pos, cover: Conversion) => {
-    const ctrla = cover.scale * Math.cos(cover.rotation)
-    const ctrlb = cover.scale * Math.sign(cover.rotation)
-
-    return {
-        x: ctrla * point.x - ctrlb * point.y + cover.translate.x,
-        y: ctrlb * point.x + ctrla * point.y + cover.translate.y,
-    }
-}
-
-/**
- * 转换完成的点通过举证信息推到转换前的点
- */
-export const recoverTransformPoint = (after: Pos, cover: Conversion) => {
-    const ctrla = cover.scale * Math.cos(cover.rotation)
-    const ctrlb = cover.scale * Math.sign(cover.rotation)
-    const y = (ctrla * (after.y - cover.translate.y) - ctrlb * (after.x - cover.translate.x)) / (Math.pow(ctrlb, 2) + Math.pow(ctrla, 2))
-    const x = (after.y - ctrla * y - cover.translate.y) / ctrlb
-
-    return { x, y }
-}
-
-/**
- * 本地坐标转墨卡托投影
- */
-export const locationToMercator = transformPoint
-
-/**
- * 墨卡托投影转本地坐标
- */
-export const mercatorToLocation = recoverTransformPoint
-
-/**
- * 墨卡托投影转高德坐标
- */
-export const mercatorToAmap = (point: Pos) => proj4(Coordinate.WebMercator, Coordinate.AMap, point)
-
-/**
- * 高德坐标转墨卡托投影
- */
-export const amapToMercator = (point: Pos) => proj4(Coordinate.AMap, Coordinate.WebMercator, point)
-
-/**
- * 本地坐标转高德坐标
- */
-export const locationToAMap = (point: Pos, cover: Conversion) => mercatorToAmap(locationToMercator(point, cover))
-
-/**
- * 高德坐标转本地坐标
- */
-export const amapToLocation = (point: Pos, cover: Conversion) => mercatorToLocation(amapToMercator(point), cover)
-const merPos = amapToMercator({ x: 113.59582840373051, y: 22.3666282638448 })

+ 0 - 1
src/sdk/types/sdk.ts

@@ -324,7 +324,6 @@ export type Map = Emitter<{ mapZoomLevelChange: ZoomInfo }> &
 export type LaserSDKProps = {
   sceneEl: Element;
   num: string;
-  gps: Pos;
   webSite: string;
   isDebug?: boolean;
   axios: any;

+ 25 - 9
src/store/setup.ts

@@ -106,25 +106,41 @@ export const recovery = () => {
 };
 
 export const requestData = async () => {
-  const [infoRes, inis] = await Promise.all([
-    axios.get(URL.setupInfo),
-    axios.get(URL.inis),
-  ]);
+  // const [infoRes, inis] = await Promise.all([
+  //   axios.get(URL.setupInfo),
+  //   axios.get(URL.inis),
+  // ]);
+  const infoRes = {
+    msg: "操作成功",
+    code: 200,
+    data: {
+      sceneCode: "SS-t-P1d6CwREny2",
+      title: "F01C室外测试",
+      password: "",
+      isOpen: true,
+      disableFloorPan: false,
+      status: 2,
+      showMode: 0,
+      datasetId: "-1",
+      jobStatus: 0,
+    },
+  };
+  const inis = { msg: "查询失败,无数据", code: 200 };
   if (infoRes.code !== Code.SUSSESS) {
     status.value = StatusEum.un;
   } else {
     const info = infoRes.data;
-    id.value = info.id;
+    // id.value = info.id;
     title.value = info.title;
-    sceneVersion.value = info.sceneVersion;
-    initPic.value = info.initPic;
+    // sceneVersion.value = info.sceneVersion;
+    // initPic.value = info.initPic;
     password.value = info.password;
     isOpen.value = info.isOpen;
     disableFloorPan.value = info.disableFloorPan;
-    pose.value = inis;
+    // pose.value = inis;
     showMode.value = customMap.mode = info.showMode ? info.showMode : Mode.pano;
     status.value = info.status;
-    webSite.value = info.webSite;
+    // webSite.value = info.webSite;
     datasetId.value = info.datasetId;
   }
 };