bill 1 rok pred
rodič
commit
444a9cdd67
2 zmenil súbory, kde vykonal 52 pridanie a 10 odobranie
  1. 30 0
      src/request/type.ts
  2. 22 10
      src/store/scene.ts

+ 30 - 0
src/request/type.ts

@@ -43,6 +43,7 @@ export type ScenePoint = {
   location: [number, number, number];
   centerLocation: [number, number, number];
   sceneCode: string;
+  sceneNum: string;
 };
 
 export type DefCtrlPoints = {
@@ -67,6 +68,34 @@ export type AutCtrlPoint = {
   roamingPointId2: string;
   epsg: string;
 };
+export type Dataset = {
+  id: any;
+  title: string;
+  sceneName?: string;
+  gfw: boolean;
+  attachId?: string;
+  sceneCode: string;
+  time: any;
+  color: string;
+  sceneNum: string;
+  location: [number, number, number];
+  sceneVersion: "V3" | "V4";
+  version: number;
+  isCalibrated: boolean;
+  orientation: number;
+  shootTime: string;
+  isItself: boolean;
+  pointCount: number;
+  status: number;
+  from: string;
+  plyExist: boolean;
+  lasExist: boolean;
+  objExist: boolean;
+  e57Exist: boolean;
+  file?: File;
+  jobId?: string;
+};
+
 export type CtrlPoints = DefCtrlPoints & AutCtrlPoint & { status: number };
 
 export type Scene = {
@@ -83,6 +112,7 @@ export type Scene = {
   algorithmTime: string;
   endTime: string;
   sceneSource: 0;
+  datasets: Dataset[];
   snCode: string;
   startTime: string;
   userName: string;

+ 22 - 10
src/store/scene.ts

@@ -42,6 +42,12 @@ export const refreshScenes = async () => {
   scenes.value = sscenes.map((scene) => {
     const c = scene.controlPoint;
     let conversion: ReturnType<typeof conversionFactory> | null;
+    let scenesTransform: {
+      [key in string]: { translate: number[]; rotate: number };
+    } = {};
+    if (c) {
+      c.status = 0;
+    }
     if (
       c &&
       c.ageControlLocation1 &&
@@ -52,6 +58,13 @@ export const refreshScenes = async () => {
         [c.ageControlLocation1, c.ageControlLocation2],
         [c.gpsControlCoordinate1, c.gpsControlCoordinate2]
       );
+
+      scene.datasets.forEach((dataset) => {
+        scenesTransform[dataset.sceneCode] = {
+          translate: conversion!.toLocal(dataset.location),
+          rotate: dataset.orientation,
+        };
+      });
     }
 
     return {
@@ -60,17 +73,16 @@ export const refreshScenes = async () => {
         let coord =
           scene.calcStatus !== SceneStatus.SUCCESS ? ([] as any) : pos.pos;
         if (conversion && scene.calcStatus === SceneStatus.SUCCESS) {
-          // 算出当前中心点与地理注册中心点偏差值
-          const center =
-            pos.sceneCode === scene.sceneCode
-              ? [0, 0, 0]
-              : conversion.toLocal(pos.centerLocation);
+          let center = scenesTransform[pos.sceneCode]?.translate || [0, 0, 0];
+          let rotate = scenesTransform[pos.sceneCode]?.rotate || 0;
+          let [x, y, z] = pos.location;
+          console.log(pos.location);
+          const cos = Math.cos(rotate);
+          const sin = Math.sin(rotate);
+          x = x * cos - y * sin + center[0];
+          y = x * sin + y * cos + center[1];
 
-          coord = conversion.toWGS84([
-            pos.location[0] + center[0],
-            pos.location[1] + center[1],
-            pos.location[2],
-          ]);
+          coord = conversion.toWGS84([x, y, z]);
         }
         return {
           ...pos,