|
@@ -63567,17 +63567,17 @@ void main() {
|
|
|
};
|
|
|
|
|
|
|
|
|
- /* var transformPointcloud = (pointcloud )=>{ //初始化位置
|
|
|
- viewer.sidebar && viewer.sidebar.addAlignmentButton(pointcloud)
|
|
|
+ var transformPointcloud = (pointcloud )=>{ //初始化位置
|
|
|
+ viewer.sidebar && viewer.sidebar.addAlignmentButton(pointcloud);
|
|
|
|
|
|
- let orientation = pointcloud.panos[0].dataRotation.z
|
|
|
- let location = pointcloud.panos[0].dataPosition.clone().negate()
|
|
|
- Alignment.rotate(pointcloud, null, orientation )
|
|
|
- Alignment.translate(pointcloud, location )
|
|
|
+ let orientation = pointcloud.panos[0].dataRotation.z;
|
|
|
+ let location = pointcloud.panos[0].dataPosition.clone().negate();
|
|
|
+ Alignment.rotate(pointcloud, null, orientation );
|
|
|
+ Alignment.translate(pointcloud, location );
|
|
|
|
|
|
- pointcloud.updateMatrixWorld()
|
|
|
+ pointcloud.updateMatrixWorld();
|
|
|
|
|
|
- } */
|
|
|
+ };
|
|
|
|
|
|
|
|
|
|
|
@@ -84020,6 +84020,7 @@ void main() {
|
|
|
|
|
|
let pointclouds;
|
|
|
let Alignment = window.viewer.modules.Alignment;
|
|
|
+ let MergeEditor = window.viewer.modules.MergeEditor;
|
|
|
let handleState = Alignment.handleState;
|
|
|
|
|
|
let a = e.buttons === Buttons.LEFT && viewport.alignment && handleState && viewport.alignment[handleState];
|
|
@@ -84039,8 +84040,13 @@ void main() {
|
|
|
}
|
|
|
|
|
|
if(!pointclouds && e.buttons === Buttons.LEFT && viewport.alignment.rotateSide){
|
|
|
- return PanoEditor.rotateSideCamera(e.drag.pointerDelta.x)
|
|
|
+ return PanoEditor.rotateSideCamera(-e.drag.pointerDelta.x)
|
|
|
}
|
|
|
+ }else if(Potree.settings.editType == 'merge'){
|
|
|
+ if(e.buttons === Buttons.LEFT && viewport.alignment.rotateSide){
|
|
|
+ return MergeEditor.rotateSideCamera(-e.drag.pointerDelta.x)
|
|
|
+ }
|
|
|
+
|
|
|
}else {
|
|
|
/* if(Alignment.selectedClouds && Alignment.selectedClouds.length){
|
|
|
pointclouds = a && e.drag.intersectStart.pointclouds && Common.getMixedSet(Alignment.selectedClouds, e.drag.intersectStart.pointclouds).length && Alignment.selectedClouds
|
|
@@ -112011,29 +112017,26 @@ ENDSEC
|
|
|
viewer.updateScreenSize({forceUpdateSize:true});
|
|
|
}
|
|
|
|
|
|
- viewportFitBound(viewport, bound, center, duration=0){
|
|
|
+ viewportFitBound(viewport, bound, center, duration=0, margin){
|
|
|
let view = viewport.view;
|
|
|
let info = {bound};
|
|
|
|
|
|
viewport.targetPlane.setFromNormalAndCoplanarPoint( view.direction.clone(), viewer.bound.center );
|
|
|
viewport.targetPlane.projectPoint(center, viewport.shiftTarget); //target转换到过模型中心的平面,以保证镜头一定在模型外 this.shiftTarget是得到的
|
|
|
|
|
|
- info.endPosition = this.getPosOutOfModel(viewport.shiftTarget, view );
|
|
|
+ info.endPosition = this.getPosOutOfModel(viewport);
|
|
|
|
|
|
//if(viewport.name == 'mapViewport')info.endPosition.z = Math.max(Potree.config.map.cameraHeight, info.endPosition.z)
|
|
|
-
|
|
|
|
|
|
-
|
|
|
-
|
|
|
- info.margin = {x:30, y:30};
|
|
|
+ info.margin = margin || {x:30, y:30};
|
|
|
view.moveOrthoCamera(viewport, info , duration );
|
|
|
}
|
|
|
|
|
|
- getPosOutOfModel(shiftTarget, view){
|
|
|
+ getPosOutOfModel(viewport){
|
|
|
let {boundSize, center} = viewer.bound;
|
|
|
let expand = 10;
|
|
|
let radius = boundSize.length() / 2;
|
|
|
- let position = shiftTarget.clone().sub(view.direction.clone().multiplyScalar(radius + expand));
|
|
|
+ let position = viewport.shiftTarget.clone().sub(viewport.view.direction.clone().multiplyScalar(radius + expand));
|
|
|
|
|
|
return position
|
|
|
}
|
|
@@ -112051,7 +112054,28 @@ ENDSEC
|
|
|
});
|
|
|
}
|
|
|
|
|
|
-
|
|
|
+ rotateSideCamera(viewport, angle){//侧视图绕模型中心水平旋转
|
|
|
+
|
|
|
+ let {boundSize, center} = viewer.bound;
|
|
|
+
|
|
|
+ //找到平移向量
|
|
|
+ viewport.targetPlane.setFromNormalAndCoplanarPoint(viewport.view.direction , center );
|
|
|
+ viewport.targetPlane.projectPoint(viewport.view.position, viewport.shiftTarget ); //target转换到过模型中心的平面,以保证镜头一定在模型外
|
|
|
+ let vec = new Vector3().subVectors(center, viewport.shiftTarget);//相对于中心的偏移值,旋转后偏移值也旋转
|
|
|
+
|
|
|
+ //旋转
|
|
|
+ var rotMatrix = new Matrix4().makeRotationAxis(new Vector3(0,0,1), angle);
|
|
|
+
|
|
|
+ viewport.view.direction = viewport.view.direction.applyMatrix4(rotMatrix);
|
|
|
+
|
|
|
+
|
|
|
+ vec.applyMatrix4(rotMatrix);
|
|
|
+ viewport.shiftTarget.subVectors(center,vec); //新的
|
|
|
+
|
|
|
+
|
|
|
+ viewport.view.position = this.getPosOutOfModel(viewport);
|
|
|
+
|
|
|
+ }
|
|
|
|
|
|
getOrthoCamera(){
|
|
|
return new OrthographicCamera(-100, 100, 100, 100, 0.01, 10000)
|
|
@@ -115084,17 +115108,20 @@ ENDSEC
|
|
|
},
|
|
|
|
|
|
|
|
|
- enterSplit(){
|
|
|
+ enterSplit(){
|
|
|
this.SplitScreen.splitStart(viewportProps$1);
|
|
|
-
|
|
|
-
|
|
|
+ viewer.setControls(viewer.fpControls);
|
|
|
+ viewer.viewports.find(e=>e.name == 'right').alignment = {rotateSide : true};
|
|
|
},
|
|
|
|
|
|
leaveSplit(){
|
|
|
this.SplitScreen.unSplit();
|
|
|
+ viewer.setControls(viewer.orbitControls);
|
|
|
},
|
|
|
|
|
|
-
|
|
|
+ rotateSideCamera(angle){
|
|
|
+ this.SplitScreen.rotateSideCamera(viewer.viewports.find(e=>e.name == 'right'), angle);
|
|
|
+ },
|
|
|
|
|
|
//---------------------------
|
|
|
|
|
@@ -118811,7 +118838,7 @@ ENDSEC
|
|
|
}
|
|
|
];
|
|
|
|
|
|
- const targetPlane = new Plane();
|
|
|
+
|
|
|
|
|
|
|
|
|
|
|
@@ -118830,8 +118857,7 @@ ENDSEC
|
|
|
this.orthoCamera = new OrthographicCamera(-100, 100, 100, 100, 0.01, 10000);
|
|
|
this.selectedPano;
|
|
|
this.selectedGroup;
|
|
|
- this.operation;
|
|
|
- this.shiftTarget = new Vector3; //project在targetPlane上的位置
|
|
|
+ this.operation;
|
|
|
this.visiblePanos = [];
|
|
|
}
|
|
|
|
|
@@ -118885,7 +118911,7 @@ ENDSEC
|
|
|
|
|
|
|
|
|
|
|
|
- this.switchView('top');
|
|
|
+ this.switchView('right'/* 'top' */);
|
|
|
|
|
|
SiteModel$1.bus.addEventListener('initDataDone',()=>{
|
|
|
this.gotoFloor(SiteModel$1.entities.find(e=>e.buildType == 'floor')); //任意一层
|
|
@@ -118962,13 +118988,18 @@ ENDSEC
|
|
|
|
|
|
|
|
|
//////////////////////////////////
|
|
|
- initViews(){
|
|
|
+ initViews(){
|
|
|
+ this.splitScreenTool = new SplitScreen;
|
|
|
+ this.targetPlane = viewer.mainViewport.targetPlane = new Plane();
|
|
|
+ this.shiftTarget = viewer.mainViewport.shiftTarget = new Vector3; //project在targetPlane上的位置
|
|
|
+
|
|
|
+
|
|
|
for(let i=0;i<2;i++){
|
|
|
let prop = cameraProps[i];
|
|
|
let view = new View();
|
|
|
this.views[prop.name] = view;
|
|
|
this.cameras[prop.name] = this.orthoCamera;
|
|
|
-
|
|
|
+
|
|
|
view.direction = prop.direction;
|
|
|
}
|
|
|
this.views.mainView = viewer.mainViewport.view;
|
|
@@ -118987,14 +119018,15 @@ ENDSEC
|
|
|
this.activeViewName = name;
|
|
|
let lastView = this.views[this.lastViewName];
|
|
|
let lastCamera = this.cameras[this.lastViewName];
|
|
|
-
|
|
|
- //let aspect = viewer.mainViewport.camera.aspect
|
|
|
viewer.mainViewport.view = view;
|
|
|
viewer.mainViewport.camera = camera;
|
|
|
- //targetPlane.setFromNormalAndCoplanarPoint( prop.direction.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等
|
|
|
this.updateCursor();
|
|
@@ -119025,13 +119057,12 @@ ENDSEC
|
|
|
|
|
|
console.log('最近',nearestPano );
|
|
|
|
|
|
- if(nearestPano && nearestPano[0] ){
|
|
|
-
|
|
|
-
|
|
|
+ if(nearestPano && nearestPano[0] ){ //尽量不变画面范围,使pano点保持原位,转换到mainView
|
|
|
let halfHeight = lastCamera.top/lastCamera.zoom;
|
|
|
let dis = halfHeight / Math.tan( MathUtils.degToRad(camera.fov/2));
|
|
|
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; //记录一下
|
|
|
}
|
|
|
|
|
|
}
|
|
@@ -119058,7 +119089,9 @@ ENDSEC
|
|
|
viewer.updateVisible(viewer.reticule, 'force', false);
|
|
|
|
|
|
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};
|
|
|
+ }
|
|
|
|
|
|
}
|
|
|
|
|
@@ -119068,7 +119101,7 @@ ENDSEC
|
|
|
|
|
|
//new THREE.Plane().setFromNormalAndCoplanarPoint( normal, this.points[0] )
|
|
|
|
|
|
- viewportFitBound(name, boundSize_, target){ //使一个viewport聚焦在某个范围
|
|
|
+ viewportFitBound(/* name, boundSize_, target */){ //使一个viewport聚焦在某个范围
|
|
|
/* let viewport = viewer.mainViewport
|
|
|
let {boundSize, center} = viewer.bound
|
|
|
|
|
@@ -119102,7 +119135,7 @@ ENDSEC
|
|
|
|
|
|
if(viewer.mainViewport.resolution.x == 0 || viewer.mainViewport.resolution.y == 0){
|
|
|
return setTimeout(()=>{
|
|
|
- this.viewportFitBound(name, boundSize_, target);
|
|
|
+ this.viewportFitBound(/* name, boundSize_, target */);
|
|
|
},10)
|
|
|
}
|
|
|
|
|
@@ -119112,46 +119145,48 @@ ENDSEC
|
|
|
}
|
|
|
|
|
|
|
|
|
-
|
|
|
-
|
|
|
rotateSideCamera(angle){//侧视图绕模型中心水平旋转
|
|
|
- var prop = cameraProps.find(v => v.name == 'right' );
|
|
|
+ this.splitScreenTool.rotateSideCamera(viewer.mainViewport, angle);
|
|
|
+ }
|
|
|
+
|
|
|
+ /* rotateSideCamera(angle){//侧视图绕模型中心水平旋转
|
|
|
+ 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.direction.clone() */, center );
|
|
|
- targetPlane.projectPoint(viewer.mainViewport.view.position, this.shiftTarget ); //target转换到过模型中心的平面,以保证镜头一定在模型外
|
|
|
- let vec = new Vector3().subVectors(center, this.shiftTarget);//相对于中心的偏移值,旋转后偏移值也旋转
|
|
|
+ targetPlane.setFromNormalAndCoplanarPoint(viewer.mainViewport.view.direction , center )
|
|
|
+ targetPlane.projectPoint(viewer.mainViewport.view.position, this.shiftTarget ) //target转换到过模型中心的平面,以保证镜头一定在模型外
|
|
|
+ let vec = new THREE.Vector3().subVectors(center, this.shiftTarget)//相对于中心的偏移值,旋转后偏移值也旋转
|
|
|
|
|
|
//旋转
|
|
|
- var rotMatrix = new Matrix4().makeRotationAxis(new Vector3(0,0,1), angle);
|
|
|
+ var rotMatrix = new THREE.Matrix4().makeRotationAxis(new THREE.Vector3(0,0,1), angle)
|
|
|
//prop.direction.applyMatrix4(rotMatrix)
|
|
|
- viewer.mainViewport.view.direction = viewer.mainViewport.view.direction.applyMatrix4(rotMatrix);
|
|
|
+ viewer.mainViewport.view.direction = viewer.mainViewport.view.direction.applyMatrix4(rotMatrix)
|
|
|
|
|
|
|
|
|
- vec.applyMatrix4(rotMatrix);
|
|
|
- this.shiftTarget.subVectors(center,vec); //新的
|
|
|
+ vec.applyMatrix4(rotMatrix)
|
|
|
+ this.shiftTarget.subVectors(center,vec) //新的
|
|
|
|
|
|
|
|
|
- viewer.mainViewport.view.position = this.getPosOutOfModel();
|
|
|
- //this.setCameraPose(/* this.shiftTarget, prop.direction */)
|
|
|
+ viewer.mainViewport.view.position = this.splitScreenTool.getPosOutOfModel(viewer.mainViewport) // this.getPosOutOfModel()
|
|
|
+
|
|
|
|
|
|
- }
|
|
|
+ } */
|
|
|
|
|
|
|
|
|
- getPosOutOfModel(){//已知shiftTarget和currentDir后
|
|
|
- let {boundSize, center} = viewer.bound;
|
|
|
+ /* getPosOutOfModel(){//已知shiftTarget和currentDir后
|
|
|
+ let {boundSize, center} = viewer.bound
|
|
|
let expand = 10;
|
|
|
- let view = viewer.mainViewport.view;
|
|
|
- let radius = boundSize.length() / 2;
|
|
|
- let position = this.shiftTarget.clone().sub(view.direction.clone().multiplyScalar(radius + expand));
|
|
|
+ let view = viewer.mainViewport.view
|
|
|
+ let radius = boundSize.length() / 2
|
|
|
+ let position = this.shiftTarget.clone().sub(view.direction.clone().multiplyScalar(radius + expand))
|
|
|
|
|
|
return position
|
|
|
|
|
|
|
|
|
- }
|
|
|
+ } */
|
|
|
|
|
|
zoomIn(intersectPoint, pointer){
|
|
|
let camera = viewer.mainViewport.camera;
|
|
@@ -119169,12 +119204,14 @@ ENDSEC
|
|
|
let radius = boundSize.length() / 2
|
|
|
return radius + expand
|
|
|
} */
|
|
|
- moveFit(pos, info, duration){
|
|
|
- targetPlane.projectPoint(pos, this.shiftTarget); //target转换到过模型中心的平面,以保证镜头一定在模型外 this.shiftTarget是得到的
|
|
|
- info.endPosition = this.getPosOutOfModel();
|
|
|
- info.margin = {x:200, y:230};
|
|
|
- let view = viewer.mainViewport.view;
|
|
|
- view.moveOrthoCamera(viewer.mainViewport, info , duration );
|
|
|
+ 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
|
|
|
+ let view = viewer.mainViewport.view
|
|
|
+ view.moveOrthoCamera(viewer.mainViewport, info , duration ) */
|
|
|
|
|
|
}
|
|
|
|
|
@@ -119636,8 +119673,9 @@ ENDSEC
|
|
|
selectPano(pano, informinformBy2d, force){
|
|
|
if(this.selectedPano == pano && !force)return
|
|
|
|
|
|
-
|
|
|
+ let lastSeletedPano = this.selectedPano;
|
|
|
if(this.selectedPano){
|
|
|
+
|
|
|
this.selectedPano.circle.material = circleMats.default;
|
|
|
this.selectedPano.circle.renderOrder = renderOrders.circle;
|
|
|
|
|
@@ -119692,9 +119730,21 @@ ENDSEC
|
|
|
|
|
|
|
|
|
|
|
|
-
|
|
|
- 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 });
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
|