|
@@ -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,
|