|
@@ -8,8 +8,8 @@ import {View} from "../../viewer/View.js";
|
|
import Viewport from "../../viewer/Viewport.js";
|
|
import Viewport from "../../viewer/Viewport.js";
|
|
import Sprite from "../../objects/Sprite.js";
|
|
import Sprite from "../../objects/Sprite.js";
|
|
import {transitions, easing, lerp} from '../../utils/transitions.js'
|
|
import {transitions, easing, lerp} from '../../utils/transitions.js'
|
|
-
|
|
|
|
-
|
|
|
|
|
|
+import {TransformControls} from "../../objects/tool/TransformControls.js";
|
|
|
|
+import SplitScreen from "../../utils/SplitScreen.js"
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@@ -18,7 +18,7 @@ let images360, Alignment, SiteModel
|
|
|
|
|
|
const texLoader = new THREE.TextureLoader()
|
|
const texLoader = new THREE.TextureLoader()
|
|
texLoader.crossOrigin = "anonymous"
|
|
texLoader.crossOrigin = "anonymous"
|
|
-
|
|
|
|
|
|
+const rotQua = new THREE.Quaternion().setFromAxisAngle(new THREE.Vector3(0,0,1), Math.PI)
|
|
const lineMats = {}
|
|
const lineMats = {}
|
|
const circleMats = {}
|
|
const circleMats = {}
|
|
|
|
|
|
@@ -40,22 +40,18 @@ const opacitys = {
|
|
const cameraProps = [
|
|
const cameraProps = [
|
|
{
|
|
{
|
|
name : 'top',
|
|
name : 'top',
|
|
- axis:["x","y"],
|
|
|
|
- //相机位置在z轴正向
|
|
|
|
- currentDir : new THREE.Vector3(0,0,-1), //镜头朝向
|
|
|
|
|
|
+ axis:["x","y"],
|
|
|
|
+ direction : new THREE.Vector3(0,0,-1), //镜头朝向
|
|
openCount:0,
|
|
openCount:0,
|
|
},
|
|
},
|
|
{
|
|
{
|
|
name : 'right',
|
|
name : 'right',
|
|
axis:["y","z"],
|
|
axis:["y","z"],
|
|
- currentDir : new THREE.Vector3(1,0,0),
|
|
|
|
- //相机位置在x轴正向
|
|
|
|
|
|
+ direction : new THREE.Vector3(1,0,0),
|
|
openCount:0,
|
|
openCount:0,
|
|
}
|
|
}
|
|
]
|
|
]
|
|
|
|
|
|
-const targetPlane = new THREE.Plane()
|
|
|
|
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@@ -73,8 +69,7 @@ class PanoEditor extends THREE.EventDispatcher{
|
|
this.orthoCamera = new THREE.OrthographicCamera(-100, 100, 100, 100, 0.01, 10000)
|
|
this.orthoCamera = new THREE.OrthographicCamera(-100, 100, 100, 100, 0.01, 10000)
|
|
this.selectedPano;
|
|
this.selectedPano;
|
|
this.selectedGroup;
|
|
this.selectedGroup;
|
|
- this.operation;
|
|
|
|
- this.shiftTarget = new THREE.Vector3 //project在targetPlane上的位置
|
|
|
|
|
|
+ this.operation;
|
|
this.visiblePanos = []
|
|
this.visiblePanos = []
|
|
}
|
|
}
|
|
|
|
|
|
@@ -99,7 +94,55 @@ class PanoEditor extends THREE.EventDispatcher{
|
|
|
|
|
|
}
|
|
}
|
|
|
|
|
|
-
|
|
|
|
|
|
+ {
|
|
|
|
+ this.transformControls = new TransformControls(viewer.mainViewport.camera, viewer.renderArea,{
|
|
|
|
+ dontHideWhenFaceCamera: true,
|
|
|
|
+ });
|
|
|
|
+ this.transformControls.setSize(1.5)
|
|
|
|
+ viewer.scene.scene.add(this.transformControls)
|
|
|
|
+ this.transformControls._gizmo.hideAxis = {translate:[], rotate:['x','y','e'] }
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+ this.fakeMarkerForTran = new THREE.Mesh(new THREE.BoxBufferGeometry(0.3,0.3,0.3) , new THREE.MeshBasicMaterial({
|
|
|
|
+ color:"#FFFFFF", opacity:0.4, transparent:true, visible:false
|
|
|
|
+ }));//一个看不见的mesh,只是为了让transformControls移动点云
|
|
|
|
+ viewer.scene.scene.add(this.fakeMarkerForTran)
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+ let afterMoveCircle = (type)=>{
|
|
|
|
+
|
|
|
|
+ if(type == 'position'){
|
|
|
|
+ let moveVec = new THREE.Vector3().subVectors(this.fakeMarkerForTran.position, this.fakeMarkerForTran.oldState.position)
|
|
|
|
+ this.selectedClouds.forEach(cloud=>Alignment.translate(cloud, moveVec))
|
|
|
|
+ }else{
|
|
|
|
+ let center = this.selectedPano.position;
|
|
|
|
+ let forward = new THREE.Vector3(0,1,0);
|
|
|
|
+ let vec1 = forward.clone().applyQuaternion(this.fakeMarkerForTran.oldState.quaternion)
|
|
|
|
+ let vec2 = forward.clone().applyQuaternion(this.fakeMarkerForTran.quaternion)
|
|
|
|
+
|
|
|
|
+ let diffAngle = math.getAngle(vec1,vec2,'z')
|
|
|
|
+
|
|
|
|
+ this.selectedClouds.forEach(cloud=>{
|
|
|
|
+ Alignment.rotateAround(center, cloud, null, diffAngle)
|
|
|
|
+ })
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+ this.fakeMarkerForTran.oldState = {
|
|
|
|
+ position: this.fakeMarkerForTran.position.clone(),
|
|
|
|
+ quaternion: this.fakeMarkerForTran.quaternion.clone(),
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ this.fakeMarkerForTran.addEventListener('position_changed', afterMoveCircle.bind(this,'position'))
|
|
|
|
+ this.fakeMarkerForTran.addEventListener("rotation_changed", afterMoveCircle.bind(this,'rotation') )
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+
|
|
this.initViews()
|
|
this.initViews()
|
|
|
|
|
|
|
|
|
|
@@ -131,9 +174,14 @@ class PanoEditor extends THREE.EventDispatcher{
|
|
this.switchView('top')
|
|
this.switchView('top')
|
|
|
|
|
|
SiteModel.bus.addEventListener('initDataDone',()=>{
|
|
SiteModel.bus.addEventListener('initDataDone',()=>{
|
|
- this.gotoFloor(SiteModel.entities.find(e=>e.buildType == 'floor')) //任意一层
|
|
|
|
|
|
+ let floor = SiteModel.entities.find(e=>e.buildType == 'floor' && e.panos.length) //选择有漫游点的一层
|
|
|
|
+ if(!floor){
|
|
|
|
+ floor = 'all' //SiteModel.entities.find(e=>e.buildType == 'floor')
|
|
|
|
+ console.log('没有一层有漫游点?!')
|
|
|
|
+ }
|
|
|
|
+ this.gotoFloor(floor)
|
|
})
|
|
})
|
|
-
|
|
|
|
|
|
+
|
|
|
|
|
|
Alignment.bus.addEventListener('switchHandle', this.updateCursor.bind(this))
|
|
Alignment.bus.addEventListener('switchHandle', this.updateCursor.bind(this))
|
|
|
|
|
|
@@ -144,8 +192,12 @@ class PanoEditor extends THREE.EventDispatcher{
|
|
this.setLinkOperateState('addLink',false)
|
|
this.setLinkOperateState('addLink',false)
|
|
this.setLinkOperateState('removeLink',false)
|
|
this.setLinkOperateState('removeLink',false)
|
|
}else if(this.clickToZoomInEnabled){
|
|
}else if(this.clickToZoomInEnabled){
|
|
-
|
|
|
|
- this.zoomIn(e.intersectPoint.orthoIntersect, e.pointer)
|
|
|
|
|
|
+ if(this.activeViewName == 'mainView'){
|
|
|
|
+ viewer.controls.zoomToLocation(e.mouse)
|
|
|
|
+ }else{
|
|
|
|
+ this.zoomIn(e.intersect.orthoIntersect, e.pointer)
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
|
|
this.setZoomInState(false)
|
|
this.setZoomInState(false)
|
|
}
|
|
}
|
|
@@ -184,7 +236,7 @@ class PanoEditor extends THREE.EventDispatcher{
|
|
if(this.operation != 'addLink' || this.activeViewName != 'top' || !this.selectedPano){
|
|
if(this.operation != 'addLink' || this.activeViewName != 'top' || !this.selectedPano){
|
|
return this.linkGuideLine.visible = false
|
|
return this.linkGuideLine.visible = false
|
|
}
|
|
}
|
|
- LineDraw.updateLine(this.linkGuideLine, [this.selectedPano.position, e.intersectPoint.orthoIntersect.clone().setZ(this.selectedPano.position.z)] )
|
|
|
|
|
|
+ LineDraw.updateLine(this.linkGuideLine, [this.selectedPano.position, e.intersect.orthoIntersect.clone().setZ(this.selectedPano.position.z)] )
|
|
this.linkGuideLine.visible = true
|
|
this.linkGuideLine.visible = true
|
|
}
|
|
}
|
|
|
|
|
|
@@ -200,19 +252,49 @@ class PanoEditor extends THREE.EventDispatcher{
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
-
|
|
|
|
|
|
+ setTranMode(mode){//rotate or translate
|
|
|
|
+ this.tranMode = mode
|
|
|
|
+ if(this.activeViewName == 'mainView'){
|
|
|
|
+ mode && this.transformControls.setMode(mode)
|
|
|
|
+ this.updateTranCtl()
|
|
|
|
+ }else{
|
|
|
|
+ Alignment.switchHandle(mode)
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ updateTranCtl(){// 设置3D页面的transformControls相关
|
|
|
|
+ if(!this.tranMode || !this.selectedPano || this.activeViewName != 'mainView' ) {
|
|
|
|
+ return this.transformControls.detach()
|
|
|
|
+ }else if(this.checkIfAllLinked({group:this.selectedGroup})){
|
|
|
|
+ this.dispatchEvent('needToDisConnect')
|
|
|
|
+ return this.transformControls.detach()
|
|
|
|
+ }
|
|
|
|
+ this.transformControls.attach(this.fakeMarkerForTran)
|
|
|
|
+ let {position, quaternion} = this.getPanoPose(this.selectedPano);
|
|
|
|
+ this.fakeMarkerForTran.position.copy(position)
|
|
|
|
+ this.fakeMarkerForTran.quaternion.copy(quaternion)
|
|
|
|
+ this.fakeMarkerForTran.oldState = {
|
|
|
|
+ position: position.clone(),
|
|
|
|
+ quaternion: quaternion.clone(),
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//////////////////////////////////
|
|
//////////////////////////////////
|
|
- initViews(){
|
|
|
|
|
|
+ initViews(){
|
|
|
|
+ this.splitScreenTool = new SplitScreen
|
|
|
|
+ this.targetPlane = viewer.mainViewport.targetPlane = new THREE.Plane()
|
|
|
|
+ this.shiftTarget = viewer.mainViewport.shiftTarget = new THREE.Vector3 //project在targetPlane上的位置
|
|
|
|
+
|
|
|
|
+
|
|
for(let i=0;i<2;i++){
|
|
for(let i=0;i<2;i++){
|
|
let prop = cameraProps[i];
|
|
let prop = cameraProps[i];
|
|
let view = new View()
|
|
let view = new View()
|
|
this.views[prop.name] = view
|
|
this.views[prop.name] = view
|
|
this.cameras[prop.name] = this.orthoCamera
|
|
this.cameras[prop.name] = this.orthoCamera
|
|
-
|
|
|
|
- view.direction = prop.currentDir
|
|
|
|
|
|
+
|
|
|
|
+ view.direction = prop.direction
|
|
}
|
|
}
|
|
this.views.mainView = viewer.mainViewport.view
|
|
this.views.mainView = viewer.mainViewport.view
|
|
this.cameras.mainView = viewer.mainViewport.camera
|
|
this.cameras.mainView = viewer.mainViewport.camera
|
|
@@ -230,14 +312,15 @@ class PanoEditor extends THREE.EventDispatcher{
|
|
this.activeViewName = name
|
|
this.activeViewName = name
|
|
let lastView = this.views[this.lastViewName]
|
|
let lastView = this.views[this.lastViewName]
|
|
let lastCamera = this.cameras[this.lastViewName]
|
|
let lastCamera = this.cameras[this.lastViewName]
|
|
-
|
|
|
|
- //let aspect = viewer.mainViewport.camera.aspect
|
|
|
|
viewer.mainViewport.view = view
|
|
viewer.mainViewport.view = view
|
|
viewer.mainViewport.camera = camera
|
|
viewer.mainViewport.camera = camera
|
|
- //targetPlane.setFromNormalAndCoplanarPoint( prop.currentDir.clone(), center )
|
|
|
|
- targetPlane.setFromNormalAndCoplanarPoint( view.direction.clone(), center )
|
|
|
|
- targetPlane.projectPoint(view.position, this.shiftTarget ) //target转换到过模型中心的平面,以保证镜头一定在模型外
|
|
|
|
- view.position.copy(this.getPosOutOfModel())
|
|
|
|
|
|
+ if(lastCamera)lastView.zoom = lastCamera.zoom
|
|
|
|
+
|
|
|
|
+ this.targetPlane.setFromNormalAndCoplanarPoint( view.direction.clone(), center )
|
|
|
|
+ this.targetPlane.projectPoint(view.position, this.shiftTarget ) //target转换到过模型中心的平面,以保证镜头一定在模型外
|
|
|
|
+ view.position.copy(this.splitScreenTool.getPosOutOfModel(viewer.mainViewport))
|
|
|
|
+ if(view.zoom)camera.zoom = view.zoom//恢复上次的zoom
|
|
|
|
+
|
|
|
|
|
|
viewer.updateScreenSize({forceUpdateSize:true})//更新camera aspect left等
|
|
viewer.updateScreenSize({forceUpdateSize:true})//更新camera aspect left等
|
|
this.updateCursor()
|
|
this.updateCursor()
|
|
@@ -245,7 +328,7 @@ class PanoEditor extends THREE.EventDispatcher{
|
|
|
|
|
|
|
|
|
|
|
|
|
|
- if(name == 'mainView'){
|
|
|
|
|
|
+ if(name == 'mainView'){
|
|
viewer.mainViewport.alignment = null
|
|
viewer.mainViewport.alignment = null
|
|
viewer.scene.pointclouds.forEach(e=>{
|
|
viewer.scene.pointclouds.forEach(e=>{
|
|
e.material.activeAttributeName = 'rgba'
|
|
e.material.activeAttributeName = 'rgba'
|
|
@@ -254,7 +337,7 @@ class PanoEditor extends THREE.EventDispatcher{
|
|
|
|
|
|
})
|
|
})
|
|
viewer.updateVisible(viewer.reticule, 'force', true)
|
|
viewer.updateVisible(viewer.reticule, 'force', true)
|
|
-
|
|
|
|
|
|
+
|
|
if(lastView){
|
|
if(lastView){
|
|
|
|
|
|
view.copy(lastView)
|
|
view.copy(lastView)
|
|
@@ -268,18 +351,20 @@ class PanoEditor extends THREE.EventDispatcher{
|
|
|
|
|
|
console.log('最近',nearestPano )
|
|
console.log('最近',nearestPano )
|
|
|
|
|
|
- if(nearestPano && nearestPano[0] ){
|
|
|
|
-
|
|
|
|
-
|
|
|
|
|
|
+ if(nearestPano && nearestPano[0] ){ //尽量不变画面范围,使pano点保持原位,转换到mainView
|
|
let halfHeight = lastCamera.top/lastCamera.zoom
|
|
let halfHeight = lastCamera.top/lastCamera.zoom
|
|
let dis = halfHeight / Math.tan( THREE.Math.degToRad(camera.fov/2))
|
|
let dis = halfHeight / Math.tan( THREE.Math.degToRad(camera.fov/2))
|
|
view.position.add(direction.clone().multiplyScalar(-nearestPano[0].score - dis))
|
|
view.position.add(direction.clone().multiplyScalar(-nearestPano[0].score - dis))
|
|
- console.log('getCloser', -nearestPano[0].score - dis)
|
|
|
|
|
|
+ //console.log('getCloser', -nearestPano[0].score - dis)
|
|
|
|
+ this.lastDisToPano = dis //记录一下
|
|
}
|
|
}
|
|
|
|
|
|
}
|
|
}
|
|
|
|
+
|
|
|
|
+ viewer.fpControls.lockKey = false
|
|
|
|
+
|
|
}else{
|
|
}else{
|
|
- if(prop.openCount == 0){
|
|
|
|
|
|
+ if(prop.openCount == 0){//只需执行一次
|
|
this.viewportFitBound(name, boundSize, center)
|
|
this.viewportFitBound(name, boundSize, center)
|
|
}
|
|
}
|
|
prop.openCount ++;
|
|
prop.openCount ++;
|
|
@@ -301,17 +386,27 @@ class PanoEditor extends THREE.EventDispatcher{
|
|
viewer.updateVisible(viewer.reticule, 'force', false)
|
|
viewer.updateVisible(viewer.reticule, 'force', false)
|
|
|
|
|
|
if(name == 'top') viewer.mainViewport.alignment = {rotate:true,translate:true};
|
|
if(name == 'top') viewer.mainViewport.alignment = {rotate:true,translate:true};
|
|
- else if(name == 'right') viewer.mainViewport.alignment = {translate:true, rotateSide:true};
|
|
|
|
-
|
|
|
|
|
|
+ if(name == 'right'){
|
|
|
|
+ viewer.mainViewport.alignment = {translate:true, rotateSide:true};
|
|
|
|
+ viewer.mainViewport.rotateSide = true
|
|
|
|
+ }else{
|
|
|
|
+ viewer.mainViewport.rotateSide = false
|
|
|
|
+ }
|
|
|
|
+ viewer.fpControls.lockKey = true
|
|
|
|
+
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+
|
|
|
|
+ this.updateTranCtl()
|
|
|
|
+ this.setTranMode() // update
|
|
this.setZoomInState(false) //取消放大模式
|
|
this.setZoomInState(false) //取消放大模式
|
|
|
|
+
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
//new THREE.Plane().setFromNormalAndCoplanarPoint( normal, this.points[0] )
|
|
//new THREE.Plane().setFromNormalAndCoplanarPoint( normal, this.points[0] )
|
|
|
|
|
|
- viewportFitBound(name, boundSize_, target){ //使一个viewport聚焦在某个范围
|
|
|
|
|
|
+ viewportFitBound(/* name, boundSize_, target */){ //使一个viewport聚焦在某个范围
|
|
/* let viewport = viewer.mainViewport
|
|
/* let viewport = viewer.mainViewport
|
|
let {boundSize, center} = viewer.bound
|
|
let {boundSize, center} = viewer.bound
|
|
|
|
|
|
@@ -319,10 +414,10 @@ class PanoEditor extends THREE.EventDispatcher{
|
|
|
|
|
|
let expand = 10;
|
|
let expand = 10;
|
|
|
|
|
|
- targetPlane.setFromNormalAndCoplanarPoint( prop.currentDir.clone(), center )
|
|
|
|
|
|
+ targetPlane.setFromNormalAndCoplanarPoint( prop.direction.clone(), center )
|
|
let shiftTarget = targetPlane.projectPoint(target, new THREE.Vector3() ) //target转换到过模型中心的平面,以保证镜头一定在模型外
|
|
let shiftTarget = targetPlane.projectPoint(target, new THREE.Vector3() ) //target转换到过模型中心的平面,以保证镜头一定在模型外
|
|
|
|
|
|
- this.setCameraPose(shiftTarget, prop.currentDir)
|
|
|
|
|
|
+ this.setCameraPose(shiftTarget, prop.direction)
|
|
|
|
|
|
|
|
|
|
if(name == 'top'){
|
|
if(name == 'top'){
|
|
@@ -332,8 +427,8 @@ class PanoEditor extends THREE.EventDispatcher{
|
|
|
|
|
|
let vec1 = new THREE.Vector3(boundSize_.x, 0,0);
|
|
let vec1 = new THREE.Vector3(boundSize_.x, 0,0);
|
|
let vec2 = new THREE.Vector3(0,boundSize_.y,0);
|
|
let vec2 = new THREE.Vector3(0,boundSize_.y,0);
|
|
- let v1 = vec1.projectOnPlane( prop.currentDir.clone() )
|
|
|
|
- let v2 = vec2.projectOnPlane( prop.currentDir.clone() )
|
|
|
|
|
|
+ let v1 = vec1.projectOnPlane( prop.direction.clone() )
|
|
|
|
+ let v2 = vec2.projectOnPlane( prop.direction.clone() )
|
|
|
|
|
|
|
|
|
|
var width = Math.max(v1.length()+v2.length(), boundSize_.z * viewport.camera.aspect)//视口宽度(米)
|
|
var width = Math.max(v1.length()+v2.length(), boundSize_.z * viewport.camera.aspect)//视口宽度(米)
|
|
@@ -345,31 +440,34 @@ class PanoEditor extends THREE.EventDispatcher{
|
|
|
|
|
|
if(viewer.mainViewport.resolution.x == 0 || viewer.mainViewport.resolution.y == 0){
|
|
if(viewer.mainViewport.resolution.x == 0 || viewer.mainViewport.resolution.y == 0){
|
|
return setTimeout(()=>{
|
|
return setTimeout(()=>{
|
|
- this.viewportFitBound(name, boundSize_, target)
|
|
|
|
|
|
+ this.viewportFitBound(/* name, boundSize_, target */)
|
|
},10)
|
|
},10)
|
|
}
|
|
}
|
|
- this.gotoFloor(this.currentFloor, true, 0)
|
|
|
|
|
|
+
|
|
|
|
+ this.gotoFloor(this.currentFloor, true, 0, null, true)
|
|
|
|
|
|
|
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
-
|
|
|
|
-
|
|
|
|
rotateSideCamera(angle){//侧视图绕模型中心水平旋转
|
|
rotateSideCamera(angle){//侧视图绕模型中心水平旋转
|
|
|
|
+ this.splitScreenTool.rotateSideCamera(viewer.mainViewport, angle)
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ /* rotateSideCamera(angle){//侧视图绕模型中心水平旋转
|
|
var prop = cameraProps.find(v => v.name == 'right' )
|
|
var prop = cameraProps.find(v => v.name == 'right' )
|
|
|
|
|
|
let {boundSize, center} = viewer.bound
|
|
let {boundSize, center} = viewer.bound
|
|
|
|
|
|
|
|
|
|
//找到平移向量
|
|
//找到平移向量
|
|
- targetPlane.setFromNormalAndCoplanarPoint(viewer.mainViewport.view.direction /* prop.currentDir.clone() */, center )
|
|
|
|
|
|
+ targetPlane.setFromNormalAndCoplanarPoint(viewer.mainViewport.view.direction , center )
|
|
targetPlane.projectPoint(viewer.mainViewport.view.position, this.shiftTarget ) //target转换到过模型中心的平面,以保证镜头一定在模型外
|
|
targetPlane.projectPoint(viewer.mainViewport.view.position, this.shiftTarget ) //target转换到过模型中心的平面,以保证镜头一定在模型外
|
|
let vec = new THREE.Vector3().subVectors(center, this.shiftTarget)//相对于中心的偏移值,旋转后偏移值也旋转
|
|
let vec = new THREE.Vector3().subVectors(center, this.shiftTarget)//相对于中心的偏移值,旋转后偏移值也旋转
|
|
|
|
|
|
//旋转
|
|
//旋转
|
|
var rotMatrix = new THREE.Matrix4().makeRotationAxis(new THREE.Vector3(0,0,1), angle)
|
|
var rotMatrix = new THREE.Matrix4().makeRotationAxis(new THREE.Vector3(0,0,1), angle)
|
|
- //prop.currentDir.applyMatrix4(rotMatrix)
|
|
|
|
|
|
+ //prop.direction.applyMatrix4(rotMatrix)
|
|
viewer.mainViewport.view.direction = viewer.mainViewport.view.direction.applyMatrix4(rotMatrix)
|
|
viewer.mainViewport.view.direction = viewer.mainViewport.view.direction.applyMatrix4(rotMatrix)
|
|
|
|
|
|
|
|
|
|
@@ -377,13 +475,13 @@ class PanoEditor extends THREE.EventDispatcher{
|
|
this.shiftTarget.subVectors(center,vec) //新的
|
|
this.shiftTarget.subVectors(center,vec) //新的
|
|
|
|
|
|
|
|
|
|
- viewer.mainViewport.view.position = this.getPosOutOfModel()
|
|
|
|
- //this.setCameraPose(/* this.shiftTarget, prop.currentDir */)
|
|
|
|
|
|
+ viewer.mainViewport.view.position = this.splitScreenTool.getPosOutOfModel(viewer.mainViewport) // this.getPosOutOfModel()
|
|
|
|
+
|
|
|
|
|
|
- }
|
|
|
|
|
|
+ } */
|
|
|
|
|
|
|
|
|
|
- getPosOutOfModel(){//已知shiftTarget和currentDir后
|
|
|
|
|
|
+ /* getPosOutOfModel(){//已知shiftTarget和currentDir后
|
|
let {boundSize, center} = viewer.bound
|
|
let {boundSize, center} = viewer.bound
|
|
let expand = 10;
|
|
let expand = 10;
|
|
let view = viewer.mainViewport.view
|
|
let view = viewer.mainViewport.view
|
|
@@ -393,12 +491,12 @@ class PanoEditor extends THREE.EventDispatcher{
|
|
return position
|
|
return position
|
|
|
|
|
|
|
|
|
|
- }
|
|
|
|
|
|
+ } */
|
|
|
|
|
|
- zoomIn(intersectPoint, pointer){
|
|
|
|
|
|
+ zoomIn(intersect, pointer){
|
|
let camera = viewer.mainViewport.camera
|
|
let camera = viewer.mainViewport.camera
|
|
let endZoom = 700
|
|
let endZoom = 700
|
|
- //this.moveFit(intersectPoint, {endZoom:viewer.mainViewport.camera.zoom < aimZoom ? aimZoom : null} , 300)
|
|
|
|
|
|
+ //this.moveFit(intersect, {endZoom:viewer.mainViewport.camera.zoom < aimZoom ? aimZoom : null} , 300)
|
|
let startZoom = camera.zoom
|
|
let startZoom = camera.zoom
|
|
if(startZoom >= endZoom){return}
|
|
if(startZoom >= endZoom){return}
|
|
|
|
|
|
@@ -411,17 +509,19 @@ class PanoEditor extends THREE.EventDispatcher{
|
|
let radius = boundSize.length() / 2
|
|
let radius = boundSize.length() / 2
|
|
return radius + expand
|
|
return radius + expand
|
|
} */
|
|
} */
|
|
- moveFit(pos, info, duration){
|
|
|
|
- targetPlane.projectPoint(pos, this.shiftTarget) //target转换到过模型中心的平面,以保证镜头一定在模型外
|
|
|
|
|
|
+ moveFit(pos, info, duration){
|
|
|
|
+ var margin = {x:200, y:230}
|
|
|
|
+ this.splitScreenTool.viewportFitBound(viewer.mainViewport, info.bound, pos, duration, margin )
|
|
|
|
+ /* targetPlane.projectPoint(pos, this.shiftTarget) //target转换到过模型中心的平面,以保证镜头一定在模型外 this.shiftTarget是得到的
|
|
info.endPosition = this.getPosOutOfModel()
|
|
info.endPosition = this.getPosOutOfModel()
|
|
- info.margin = {x:200, y:230}
|
|
|
|
|
|
+ info
|
|
let view = viewer.mainViewport.view
|
|
let view = viewer.mainViewport.view
|
|
- view.moveOrthoCamera(viewer.mainViewport, info , duration )
|
|
|
|
|
|
+ view.moveOrthoCamera(viewer.mainViewport, info , duration ) */
|
|
|
|
|
|
}
|
|
}
|
|
|
|
|
|
setZoomInState(state, informinformBy2d){//是否点击后可放大
|
|
setZoomInState(state, informinformBy2d){//是否点击后可放大
|
|
- if(state && this.activeViewName == 'mainView')return console.log('3D不可放大')
|
|
|
|
|
|
+ //if(state && this.activeViewName == 'mainView')return console.log('3D不可放大')
|
|
this.clickToZoomInEnabled = !!state
|
|
this.clickToZoomInEnabled = !!state
|
|
|
|
|
|
|
|
|
|
@@ -439,7 +539,7 @@ class PanoEditor extends THREE.EventDispatcher{
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
- gotoFloor(floor, force, duration = 600, informBy2d){// 选择不同楼层, 切换点位显示。 'all'为全部显示
|
|
|
|
|
|
+ gotoFloor(floor, force, duration = 600, informBy2d, fitBound){// 选择不同楼层, 切换点位显示。 'all'为全部显示
|
|
|
|
|
|
floor = floor || 'all'
|
|
floor = floor || 'all'
|
|
|
|
|
|
@@ -479,7 +579,7 @@ class PanoEditor extends THREE.EventDispatcher{
|
|
}
|
|
}
|
|
|
|
|
|
if(this.activeViewName != 'mainView' ){
|
|
if(this.activeViewName != 'mainView' ){
|
|
- this.moveFit(center, {bound}, duration)
|
|
|
|
|
|
+ fitBound && this.moveFit(center, {bound}, duration)
|
|
}else if(this.activeViewName == 'mainView'){
|
|
}else if(this.activeViewName == 'mainView'){
|
|
if(floor != 'all'){ //切换一下位置,因为原处点云会消失
|
|
if(floor != 'all'){ //切换一下位置,因为原处点云会消失
|
|
viewer.scene.view.setView({position:center, duration })
|
|
viewer.scene.view.setView({position:center, duration })
|
|
@@ -590,9 +690,16 @@ class PanoEditor extends THREE.EventDispatcher{
|
|
|
|
|
|
let old = this.operation
|
|
let old = this.operation
|
|
this.operation = state ? name : null
|
|
this.operation = state ? name : null
|
|
- if(this.selectedLine){
|
|
|
|
- this.selectedLine.dispatchEvent('click')//删除
|
|
|
|
- }
|
|
|
|
|
|
+
|
|
|
|
+ if(this.operation == 'removeLink'){
|
|
|
|
+ if(this.selectedLine){
|
|
|
|
+ this.selectedLine.dispatchEvent('click')//删除
|
|
|
|
+ }
|
|
|
|
+ if(this.selectedPano){
|
|
|
|
+ this.selectedPano.circle.dispatchEvent('click')//删除
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+
|
|
if(this.operation != 'addLink'){
|
|
if(this.operation != 'addLink'){
|
|
this.linkGuideLine.visible = false
|
|
this.linkGuideLine.visible = false
|
|
}
|
|
}
|
|
@@ -635,25 +742,30 @@ class PanoEditor extends THREE.EventDispatcher{
|
|
|
|
|
|
|
|
|
|
|
|
|
|
- groupChange(pano0, pano1, type){//修改group
|
|
|
|
|
|
+ groupChange(pano0, pano1, type){//修改group (type == 'remove'时,pano1可以为空)
|
|
if(type == 'add'){
|
|
if(type == 'add'){
|
|
Common.pushToGroupAuto([pano0, pano1], this.panoGroup )
|
|
Common.pushToGroupAuto([pano0, pano1], this.panoGroup )
|
|
}else{
|
|
}else{
|
|
- let atGroup = this.panoGroup.find(e=>e.includes(pano0) && e.includes(pano1));//所在组
|
|
|
|
|
|
+ let atGroup = this.panoGroup.find(e=>e.includes(pano0) && (e.includes(pano1) || !pano1));//所在组
|
|
|
|
|
|
if(!atGroup){
|
|
if(!atGroup){
|
|
- return console.log('这两个pano原本就不在一个组', pano0.id, pano1.id)
|
|
|
|
|
|
+ if(pano1){
|
|
|
|
+ console.log('这两个pano原本就不在一个组', pano0.id, pano1.id)
|
|
|
|
+ }else{
|
|
|
|
+ console.log('pano0不在任何组', pano0)
|
|
|
|
+ }
|
|
|
|
+ return
|
|
}
|
|
}
|
|
|
|
|
|
//断开连接时,因为组内没有其他成员的连接信息,所以需要清除整组,并将剩余的一个个重新连接
|
|
//断开连接时,因为组内没有其他成员的连接信息,所以需要清除整组,并将剩余的一个个重新连接
|
|
this.panoGroup.splice(this.panoGroup.indexOf(atGroup),1) //删除
|
|
this.panoGroup.splice(this.panoGroup.indexOf(atGroup),1) //删除
|
|
|
|
|
|
|
|
|
|
- atGroup.forEach(pano=>{//然后再重新生成这两个和组的关系,各组分组
|
|
|
|
|
|
+ atGroup.forEach(pano=>{//然后再重新生成这两个和组的关系,各自分组
|
|
if(pano == pano0 || pano == pano1)return
|
|
if(pano == pano0 || pano == pano1)return
|
|
- for(let i in this.panoLink[pano.id]){
|
|
|
|
- if(this.panoLink[pano.id][i]){
|
|
|
|
- let pano_ = images360.getPano(i)
|
|
|
|
|
|
+ for(let id in this.panoLink[pano.id]){
|
|
|
|
+ if(this.panoLink[pano.id][id]){
|
|
|
|
+ let pano_ = images360.getPano(id)
|
|
Common.pushToGroupAuto([pano, pano_], this.panoGroup )
|
|
Common.pushToGroupAuto([pano, pano_], this.panoGroup )
|
|
}
|
|
}
|
|
}
|
|
}
|
|
@@ -664,16 +776,38 @@ class PanoEditor extends THREE.EventDispatcher{
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
- linkChange(pano0, pano1, type){//修改link
|
|
|
|
|
|
+ linkChange(pano0, pano1, type){//修改link (type == 'remove'时,pano1可以为空)
|
|
|
|
+
|
|
|
|
|
|
|
|
+ let temp = []
|
|
|
|
+
|
|
if(type == 'add'){
|
|
if(type == 'add'){
|
|
|
|
+ if(!pano1)return console.error('不支持add时pano1为空')
|
|
this.panoLink[pano0.id][pano1.id] = this.panoLink[pano0.id][pano1.id] || {}
|
|
this.panoLink[pano0.id][pano1.id] = this.panoLink[pano0.id][pano1.id] || {}
|
|
this.panoLink[pano1.id][pano0.id] = this.panoLink[pano1.id][pano0.id] || {}
|
|
this.panoLink[pano1.id][pano0.id] = this.panoLink[pano1.id][pano0.id] || {}
|
|
|
|
+ }else{
|
|
|
|
+ if(!pano1){
|
|
|
|
+ for(let id in this.panoLink[pano0.id]){
|
|
|
|
+ if(this.panoLink[pano0.id][id]){
|
|
|
|
+ this.panoLink[id][pano0.id] = false
|
|
|
|
+ temp.push(id)
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ this.panoLink[pano0.id] = {} //全部断连
|
|
|
|
+ }else{
|
|
|
|
+ this.panoLink[pano0.id][pano1.id] = false
|
|
|
|
+ this.panoLink[pano1.id][pano0.id] = false
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ if(!pano1){ //全部断连
|
|
|
|
+ temp.forEach(id=>{
|
|
|
|
+ this.lineChange(pano0, images360.getPano(id) , type)
|
|
|
|
+ })
|
|
}else{
|
|
}else{
|
|
- this.panoLink[pano0.id][pano1.id] = false
|
|
|
|
- this.panoLink[pano1.id][pano0.id] = false
|
|
|
|
|
|
+ this.lineChange(pano0, pano1, type)
|
|
}
|
|
}
|
|
- this.lineChange(pano0, pano1, type)
|
|
|
|
|
|
+
|
|
this.groupChange(pano0, pano1, type)
|
|
this.groupChange(pano0, pano1, type)
|
|
|
|
|
|
//this.updateSelectGroup()
|
|
//this.updateSelectGroup()
|
|
@@ -687,12 +821,13 @@ class PanoEditor extends THREE.EventDispatcher{
|
|
if(this.panoLink[pano0.id][pano1.id].line) return
|
|
if(this.panoLink[pano0.id][pano1.id].line) return
|
|
let line = LineDraw.createFatLine([pano0.position, pano1.position], {material:lineMats.default})
|
|
let line = LineDraw.createFatLine([pano0.position, pano1.position], {material:lineMats.default})
|
|
line.name = `${pano0.id}-${pano1.id}`
|
|
line.name = `${pano0.id}-${pano1.id}`
|
|
- line.renderOrder = renderOrders.line
|
|
|
|
|
|
+ line.renderOrder = line.pickOrder = renderOrders.line
|
|
this.lineMeshes.add(line)
|
|
this.lineMeshes.add(line)
|
|
this.panoLink[pano0.id][pano1.id].line = this.panoLink[pano1.id][pano0.id].line = line
|
|
this.panoLink[pano0.id][pano1.id].line = this.panoLink[pano1.id][pano0.id].line = line
|
|
|
|
|
|
|
|
|
|
line.addEventListener('mouseover', ()=>{
|
|
line.addEventListener('mouseover', ()=>{
|
|
|
|
+ if(this.clickToZoomInEnabled)return
|
|
if(this.activeViewName == 'mainView')return
|
|
if(this.activeViewName == 'mainView')return
|
|
if(this.selectedLine != line)line.material = lineMats.hovered
|
|
if(this.selectedLine != line)line.material = lineMats.hovered
|
|
viewer.dispatchEvent({
|
|
viewer.dispatchEvent({
|
|
@@ -700,6 +835,7 @@ class PanoEditor extends THREE.EventDispatcher{
|
|
});
|
|
});
|
|
});
|
|
});
|
|
line.addEventListener('mouseleave', ()=>{
|
|
line.addEventListener('mouseleave', ()=>{
|
|
|
|
+ if(this.clickToZoomInEnabled)return
|
|
//if(this.activeViewName == 'mainView')return
|
|
//if(this.activeViewName == 'mainView')return
|
|
if(this.selectedLine != line)line.material = lineMats.default
|
|
if(this.selectedLine != line)line.material = lineMats.default
|
|
viewer.dispatchEvent({
|
|
viewer.dispatchEvent({
|
|
@@ -707,6 +843,7 @@ class PanoEditor extends THREE.EventDispatcher{
|
|
});
|
|
});
|
|
});
|
|
});
|
|
line.addEventListener('click', (e)=>{
|
|
line.addEventListener('click', (e)=>{
|
|
|
|
+ if(this.clickToZoomInEnabled)return
|
|
if(this.activeViewName == 'mainView')return
|
|
if(this.activeViewName == 'mainView')return
|
|
if(this.operation == 'removeLink'){
|
|
if(this.operation == 'removeLink'){
|
|
if(this.selectedLine == line) this.selectLine(null)
|
|
if(this.selectedLine == line) this.selectLine(null)
|
|
@@ -741,6 +878,9 @@ class PanoEditor extends THREE.EventDispatcher{
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+
|
|
addPanoMesh(){
|
|
addPanoMesh(){
|
|
let map = texLoader.load(Potree.resourcePath+'/textures/correct_n.png' )
|
|
let map = texLoader.load(Potree.resourcePath+'/textures/correct_n.png' )
|
|
circleMats.default = new THREE.MeshBasicMaterial({
|
|
circleMats.default = new THREE.MeshBasicMaterial({
|
|
@@ -785,7 +925,8 @@ class PanoEditor extends THREE.EventDispatcher{
|
|
var circle = new Sprite({mat: circleMats.default, sizeInfo:{
|
|
var circle = new Sprite({mat: circleMats.default, sizeInfo:{
|
|
minSize : 50 , maxSize : 120, nearBound : 2, farBound : 10,
|
|
minSize : 50 , maxSize : 120, nearBound : 2, farBound : 10,
|
|
},
|
|
},
|
|
- renderOrder : renderOrders.circle
|
|
|
|
|
|
+ renderOrder : renderOrders.circle,
|
|
|
|
+ pickOrder: renderOrders.circle
|
|
}) //new THREE.Sprite(circleMats.default)
|
|
}) //new THREE.Sprite(circleMats.default)
|
|
|
|
|
|
circle.name = 'panoCircle'
|
|
circle.name = 'panoCircle'
|
|
@@ -796,7 +937,6 @@ class PanoEditor extends THREE.EventDispatcher{
|
|
this.panoMeshs.add(circle)
|
|
this.panoMeshs.add(circle)
|
|
|
|
|
|
|
|
|
|
-
|
|
|
|
setPos(circle)
|
|
setPos(circle)
|
|
pano.addEventListener('rePos', setPos.bind(this,circle))
|
|
pano.addEventListener('rePos', setPos.bind(this,circle))
|
|
|
|
|
|
@@ -819,7 +959,12 @@ class PanoEditor extends THREE.EventDispatcher{
|
|
this.hoverPano(pano,false)
|
|
this.hoverPano(pano,false)
|
|
})
|
|
})
|
|
circle.addEventListener('click', ()=>{
|
|
circle.addEventListener('click', ()=>{
|
|
- if(this.activeViewName == 'mainView')return
|
|
|
|
|
|
+ //if(this.activeViewName == 'mainView')return
|
|
|
|
+ if(this.clickToZoomInEnabled)return
|
|
|
|
+ if(this.operation == 'removeLink'){
|
|
|
|
+ this.linkChange(pano, null, 'remove') //删除所有连接
|
|
|
|
+ }
|
|
|
|
+
|
|
if(this.selectedPano == circle.pano) return this.selectPano(null)
|
|
if(this.selectedPano == circle.pano) return this.selectPano(null)
|
|
if(this.operation == 'addLink' && this.selectedPano){
|
|
if(this.operation == 'addLink' && this.selectedPano){
|
|
this.linkChange(this.selectedPano, circle.pano, 'add')
|
|
this.linkChange(this.selectedPano, circle.pano, 'add')
|
|
@@ -830,7 +975,9 @@ class PanoEditor extends THREE.EventDispatcher{
|
|
// this.linkChange(this.selectedPano, circle.pano, 'remove')
|
|
// this.linkChange(this.selectedPano, circle.pano, 'remove')
|
|
// //this.setLinkOperateState('removeLink',false)
|
|
// //this.setLinkOperateState('removeLink',false)
|
|
// return
|
|
// return
|
|
- // }
|
|
|
|
|
|
+ // }
|
|
|
|
+
|
|
|
|
+
|
|
this.selectPano(circle.pano)
|
|
this.selectPano(circle.pano)
|
|
})
|
|
})
|
|
|
|
|
|
@@ -840,6 +987,7 @@ class PanoEditor extends THREE.EventDispatcher{
|
|
|
|
|
|
|
|
|
|
hoverPano(pano, state){
|
|
hoverPano(pano, state){
|
|
|
|
+ if(this.clickToZoomInEnabled)return
|
|
if(pano && state){ //在hover一个pano之前,一定会先取消已经hover的pano, 最多存在一个hovered的pano
|
|
if(pano && state){ //在hover一个pano之前,一定会先取消已经hover的pano, 最多存在一个hovered的pano
|
|
if(this.hoveredPano == pano)return
|
|
if(this.hoveredPano == pano)return
|
|
|
|
|
|
@@ -851,7 +999,7 @@ class PanoEditor extends THREE.EventDispatcher{
|
|
pano.hovered = true
|
|
pano.hovered = true
|
|
|
|
|
|
|
|
|
|
- if(this.activeViewName == 'mainView' || Alignment.handleState && this.selectedPano && this.selectedPano == pano)return
|
|
|
|
|
|
+ if(/* this.activeViewName == 'mainView' || */Alignment.handleState && this.selectedPano && this.selectedPano == pano)return
|
|
|
|
|
|
if(this.operation != 'addLink' || !this.selectedPano || this.selectedPano == pano){ // this.selectedPano == pano?
|
|
if(this.operation != 'addLink' || !this.selectedPano || this.selectedPano == pano){ // this.selectedPano == pano?
|
|
viewer.dispatchEvent({
|
|
viewer.dispatchEvent({
|
|
@@ -878,20 +1026,20 @@ class PanoEditor extends THREE.EventDispatcher{
|
|
selectPano(pano, informinformBy2d, force){
|
|
selectPano(pano, informinformBy2d, force){
|
|
if(this.selectedPano == pano && !force)return
|
|
if(this.selectedPano == pano && !force)return
|
|
|
|
|
|
-
|
|
|
|
|
|
+ let lastSeletedPano = this.selectedPano
|
|
if(this.selectedPano){
|
|
if(this.selectedPano){
|
|
|
|
+
|
|
this.selectedPano.circle.material = circleMats.default
|
|
this.selectedPano.circle.material = circleMats.default
|
|
this.selectedPano.circle.renderOrder = renderOrders.circle
|
|
this.selectedPano.circle.renderOrder = renderOrders.circle
|
|
|
|
|
|
- if(this.activeViewName != 'mainView'){
|
|
|
|
|
|
+ if(this.activeViewName == 'mainView'){
|
|
|
|
+
|
|
|
|
+ }else{
|
|
this.selectedClouds.forEach(e=>{
|
|
this.selectedClouds.forEach(e=>{
|
|
e.changePointOpacity(opacitys.default,true)
|
|
e.changePointOpacity(opacitys.default,true)
|
|
e.material.color = pointColor.default;
|
|
e.material.color = pointColor.default;
|
|
})
|
|
})
|
|
-
|
|
|
|
- //this.selectedPano.pointcloud.changePointOpacity(opacitys.default,true)
|
|
|
|
- //this.selectedPano.pointcloud.material.color = Potree.config.material.pointColor
|
|
|
|
- }
|
|
|
|
|
|
+ }
|
|
|
|
|
|
}
|
|
}
|
|
|
|
|
|
@@ -901,14 +1049,16 @@ class PanoEditor extends THREE.EventDispatcher{
|
|
|
|
|
|
if(pano){
|
|
if(pano){
|
|
this.selectedPano.circle.material = circleMats.selected
|
|
this.selectedPano.circle.material = circleMats.selected
|
|
- this.selectedPano.circle.renderOrder = renderOrders.circleSelected //侧视图能显示在最前
|
|
|
|
- //this.selectedPano.pointcloud.material.color = '#ff0000'
|
|
|
|
- //this.selectedPano.pointcloud.changePointOpacity(opacitys.selected,true)
|
|
|
|
- this.selectedClouds.forEach(e=>{
|
|
|
|
- e.changePointOpacity(opacitys.selected,true)
|
|
|
|
- e.material.color = pointColor.selected;
|
|
|
|
- })
|
|
|
|
-
|
|
|
|
|
|
+ this.selectedPano.circle.renderOrder = this.selectedPano.circle.pickOrder = renderOrders.circleSelected //侧视图能显示在最前
|
|
|
|
+
|
|
|
|
+ if(this.activeViewName == 'mainView'){
|
|
|
|
+
|
|
|
|
+ }else{
|
|
|
|
+ this.selectedClouds.forEach(e=>{
|
|
|
|
+ e.changePointOpacity(opacitys.selected,true)
|
|
|
|
+ e.material.color = pointColor.selected;
|
|
|
|
+ })
|
|
|
|
+ }
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@@ -929,14 +1079,25 @@ class PanoEditor extends THREE.EventDispatcher{
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
- this.updateCursor()
|
|
|
|
|
|
+ this.updateCursor()
|
|
|
|
+ this.updateTranCtl()
|
|
|
|
|
|
|
|
|
|
-
|
|
|
|
-
|
|
|
|
-
|
|
|
|
- informinformBy2d || this.dispatchEvent({type:'panoSelect', pano })
|
|
|
|
-
|
|
|
|
|
|
+ if(informinformBy2d){
|
|
|
|
+ if(this.selectedPano){
|
|
|
|
+ if(this.activeViewName == 'mainView'){ //平移,focus选中的pano
|
|
|
|
+ let distance = this.lastDisToPano || 5;
|
|
|
|
+ if(lastSeletedPano){
|
|
|
|
+ distance = viewer.mainViewport.camera.position.distanceTo(lastSeletedPano.position)
|
|
|
|
+ }
|
|
|
|
+ viewer.focusOnObject({ position:this.selectedPano.position}, 'point', null, {distance })
|
|
|
|
+ }else{
|
|
|
|
+ this.moveFit(this.selectedPano.position, {}, 500)
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ }else{
|
|
|
|
+ this.dispatchEvent({type:'panoSelect', pano })
|
|
|
|
+ }
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
@@ -975,14 +1136,25 @@ class PanoEditor extends THREE.EventDispatcher{
|
|
group = this.panoGroup.find(panos=>panos[0].pointcloud.dataset_id == datasetId )
|
|
group = this.panoGroup.find(panos=>panos[0].pointcloud.dataset_id == datasetId )
|
|
if(!group)return //要找的数据集的pano全部都孤立了
|
|
if(!group)return //要找的数据集的pano全部都孤立了
|
|
}
|
|
}
|
|
-
|
|
|
|
|
|
+ if(!datasetId)return
|
|
let panos = Potree.settings.datasetsPanos[datasetId].panos
|
|
let panos = Potree.settings.datasetsPanos[datasetId].panos
|
|
return panos.length == group.length
|
|
return panos.length == group.length
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+ getPanoPose(pano){
|
|
|
|
+ let pose = {
|
|
|
|
+ position: pano.position.clone(),
|
|
|
|
+ quaternion: new THREE.Quaternion().setFromRotationMatrix(pano.panoMatrix).premultiply(rotQua) ,
|
|
|
|
+ }
|
|
|
|
+ return pose
|
|
|
|
+
|
|
|
|
+ }
|
|
|
|
+
|
|
exportSavingData(){//输出漫游点新的坐标和朝向、以及连接信息
|
|
exportSavingData(){//输出漫游点新的坐标和朝向、以及连接信息
|
|
let sweepLocations = {}
|
|
let sweepLocations = {}
|
|
-
|
|
|
|
|
|
+
|
|
for(let datasetId in Potree.settings.datasetsPanos ) {
|
|
for(let datasetId in Potree.settings.datasetsPanos ) {
|
|
let {panos} = Potree.settings.datasetsPanos[datasetId]
|
|
let {panos} = Potree.settings.datasetsPanos[datasetId]
|
|
let data = panos.map(pano=>{
|
|
let data = panos.map(pano=>{
|
|
@@ -992,13 +1164,18 @@ class PanoEditor extends THREE.EventDispatcher{
|
|
visibles.push(viewer.images360.getPano(id).index)
|
|
visibles.push(viewer.images360.getPano(id).index)
|
|
}
|
|
}
|
|
}
|
|
}
|
|
-
|
|
|
|
|
|
+ let {position, quaternion} = this.getPanoPose(pano);
|
|
return Object.assign({}, pano.panosData, {
|
|
return Object.assign({}, pano.panosData, {
|
|
uuid: pano.uuid,
|
|
uuid: pano.uuid,
|
|
- pose:{
|
|
|
|
- translation: dealData(pano.position.clone().negate()),
|
|
|
|
- rotation: dealData(new THREE.Quaternion().setFromRotationMatrix(pano.panoMatrix) ),
|
|
|
|
|
|
+ /* pose:{
|
|
|
|
+ translation: dealData(pano.position.clone() ),
|
|
|
|
+ rotation: dealData(new THREE.Quaternion().setFromRotationMatrix(pano.panoMatrix).premultiply(rotQua) ),
|
|
|
|
+ }, */
|
|
|
|
+ pose : {
|
|
|
|
+ translation : dealData(position),
|
|
|
|
+ rotation : dealData(quaternion)
|
|
},
|
|
},
|
|
|
|
+
|
|
visibles,
|
|
visibles,
|
|
|
|
|
|
//subgroup: 0,group: 1, "id_view":..
|
|
//subgroup: 0,group: 1, "id_view":..
|