|
@@ -3547,7 +3547,7 @@ export class Viewer extends ViewerBase{
|
|
|
let finishDeferred = info.finishDeferred || $.Deferred();
|
|
|
|
|
|
let viewerMaster = info.map ? this.mapViewer : this; //截图主体
|
|
|
- let useMap = info.type == 'measure' || info.map
|
|
|
+ let useMap = info.type == 'measure' || info.map || info.type == 'prism2d-all'
|
|
|
|
|
|
|
|
|
if(Potree.settings.displayMode == 'showPanos' && viewer.scene.view.isFlying('pos')){//如果在飞,飞完再截图
|
|
@@ -3715,10 +3715,13 @@ export class Viewer extends ViewerBase{
|
|
|
|
|
|
let mapViewport
|
|
|
let mainViewport = this.mainViewport
|
|
|
- let viewports = [mainViewport];
|
|
|
- let oldStates = {
|
|
|
- viewports : [mainViewport.clone()],
|
|
|
- pano: Potree.settings.displayMode == 'showPanos' ? viewer.images360.currentPano : null,
|
|
|
+ let viewports = [], oldStates = {
|
|
|
+ viewports:[],
|
|
|
+ pano: Potree.settings.displayMode == 'showPanos' ? viewer.images360.currentPano : null
|
|
|
+ }
|
|
|
+ if(!info.type.includes('prism2d')){
|
|
|
+ viewports.push(mainViewport)
|
|
|
+ oldStates.viewports.push(mainViewport.clone())
|
|
|
}
|
|
|
if(useMap){
|
|
|
mapViewport = this.mapViewer.viewports[0]
|
|
@@ -3791,6 +3794,20 @@ export class Viewer extends ViewerBase{
|
|
|
}
|
|
|
|
|
|
|
|
|
+ let focusDatasets = (measurements)=>{
|
|
|
+ this.focusDatasets = []
|
|
|
+ measurements.forEach(measure=>{
|
|
|
+ measure.points_datasets.forEach(e=>{
|
|
|
+ let p = viewer.scene.pointclouds.find(a=>a.dataset_id == e)
|
|
|
+ if(p && !this.focusDatasets.includes(p)){
|
|
|
+ this.focusDatasets.push(p)
|
|
|
+ }
|
|
|
+ })
|
|
|
+ })
|
|
|
+ this.updateFpVisiDatasets()
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
if(info.type == 'measure'){//要截图双屏
|
|
|
this.scene.measurements.forEach(e=>Potree.Utils.updateVisible(e,'screenshot',e == info.measurement) )
|
|
|
info.measurement.setSelected(true, 'screenshot')
|
|
@@ -3829,14 +3846,7 @@ export class Viewer extends ViewerBase{
|
|
|
this.updateDatasetAt(true)
|
|
|
this.modules.SiteModel.updateEntityAt(true, {measure:info.measurement}) //更新测量线所在楼层,展示俯视图
|
|
|
if(!this.modules.SiteModel.inEntity){
|
|
|
- this.focusDatasets = []
|
|
|
- info.measurement.points_datasets.forEach(e=>{
|
|
|
- let p = viewer.scene.pointclouds.find(a=>a.dataset_id == e)
|
|
|
- if(p && !this.focusDatasets.includes(p)){
|
|
|
- this.focusDatasets.push(p)
|
|
|
- }
|
|
|
- })
|
|
|
- this.updateFpVisiDatasets()
|
|
|
+ focusDatasets([info.measurement])
|
|
|
}
|
|
|
|
|
|
this.modules.SiteModel.pauseUpdateEntity = true
|
|
@@ -3857,7 +3867,25 @@ export class Viewer extends ViewerBase{
|
|
|
}
|
|
|
|
|
|
})
|
|
|
+ }else if(info.type.includes('prism2d')){
|
|
|
+ let points = [], prisms = info.type == 'prism2d-all' ? this.modules.volumeComputer.prisms : [info.prism]
|
|
|
|
|
|
+ viewer.mapViewer.updateScreenSize({forceUpdateSize:true, width, height, forTarget:info.useRenderTarget}) //更新viewports相机透视 使focusOnObject在此窗口大小下
|
|
|
+
|
|
|
+ prisms.forEach(e=>points.push(...e.points))
|
|
|
+
|
|
|
+ let {promise} = this.focusOnObject({points}, 'prisms2d', 0, {
|
|
|
+ minMapWidth: 0.2 , onlyMap:true, focusBoundCenter:true
|
|
|
+ })
|
|
|
+ promise.done(()=>{
|
|
|
+ if(info.type == 'prism2d-all'){//全部 带平面图
|
|
|
+ focusDatasets(prisms) //更新平面图 可能有漏洞,当不在任何一个数据集内的话?
|
|
|
+ this.mapViewer.waitLoadDone(screenshot.bind(this))//等待地图所有加载完
|
|
|
+ }else{//单个
|
|
|
+ screenshot()
|
|
|
+ }
|
|
|
+ })
|
|
|
+
|
|
|
}else{
|
|
|
|
|
|
waitPointLoad()
|
|
@@ -3891,6 +3919,38 @@ export class Viewer extends ViewerBase{
|
|
|
return console.error('focusOnObject暂不支持OrthographicCamera。因情况复杂,请视情况使用splitScreenTool.viewportFitBound')
|
|
|
} */
|
|
|
|
|
|
+ let moveMap = ()=>{
|
|
|
+ if(this.mapViewer){
|
|
|
+ //console.log('mapFocusOn: '+target.toArray())
|
|
|
+ const minMapWidth = o.minMapWidth || 2 //截图的时候要显示的地图范围较大,为了显示出地区名字
|
|
|
+ const minBound = new THREE.Vector2(minMapWidth,minMapWidth)//针对垂直线,在地图上只有一个点
|
|
|
+ //原始的bound
|
|
|
+ let boundOri
|
|
|
+ if(object.points){
|
|
|
+ boundOri = new THREE.Box3()
|
|
|
+ object.points.forEach(e=>{
|
|
|
+ boundOri.expandByPoint(e)
|
|
|
+ })
|
|
|
+ }else{
|
|
|
+ boundOri = object.boundingBox
|
|
|
+ }
|
|
|
+
|
|
|
+ if(o.focusBoundCenter){
|
|
|
+ boundOri.getCenter(target)
|
|
|
+ }
|
|
|
+ let boundSizeOri = boundOri.getSize(new THREE.Vector3)
|
|
|
+
|
|
|
+ let boundSizeMap = boundSizeOri.clone().multiplyScalar(2)
|
|
|
+ boundSizeMap.x = Math.max(minBound.x, boundSizeMap.x )
|
|
|
+ boundSizeMap.y = Math.max(minBound.y, boundSizeMap.y )
|
|
|
+ this.mapViewer.moveTo(target.clone(), boundSizeMap, duration)
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ if(o.onlyMap){
|
|
|
+ return moveMap()
|
|
|
+ }
|
|
|
+
|
|
|
let getPosWithFullBound = (points, boundingBox, target, cameraPos )=>{//使boundingBox差不多占满屏幕时的相机到target的距离
|
|
|
// points 和 boundingBox 至少有一个
|
|
|
|
|
@@ -4051,38 +4111,14 @@ export class Viewer extends ViewerBase{
|
|
|
}
|
|
|
//截图时直接飞到最佳视角,也就是平视它所在面。其余时候为了避免镜头旋转过大就算了。
|
|
|
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
+
|
|
|
|
|
|
|
|
|
|
|
|
position = getPosWithFullBound(object.points, null, target, cameraPos )
|
|
|
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
- if(this.mapViewer/* .attachedToViewer */){
|
|
|
- //console.log('mapFocusOn: '+target.toArray())
|
|
|
- const minMapWidth = o.minMapWidth || 2 //截图的时候要显示的地图范围较大,为了显示出地区名字
|
|
|
- const minBound = new THREE.Vector2(minMapWidth,minMapWidth)//针对垂直线,在地图上只有一个点
|
|
|
- //原始的bound
|
|
|
- let boundOri = new THREE.Box3()
|
|
|
- object.points.forEach(e=>{
|
|
|
- boundOri.expandByPoint(e)
|
|
|
- })
|
|
|
- let boundSizeOri = boundOri.getSize(new THREE.Vector3)
|
|
|
-
|
|
|
-
|
|
|
- let boundSizeMap = boundSizeOri.clone().multiplyScalar(2)
|
|
|
- boundSizeMap.x = Math.max(minBound.x, boundSizeMap.x )
|
|
|
- boundSizeMap.y = Math.max(minBound.y, boundSizeMap.y )
|
|
|
- this.mapViewer.moveTo(target.clone(), boundSizeMap, duration)
|
|
|
- }
|
|
|
-
|
|
|
-
|
|
|
+
|
|
|
+ moveMap()
|
|
|
|
|
|
|
|
|
if(Potree.settings.displayMode == 'showPointCloud'){ //点云
|
|
@@ -4290,6 +4326,7 @@ export class Viewer extends ViewerBase{
|
|
|
/* if(o.dontChangeCamDir){
|
|
|
target = null
|
|
|
} */
|
|
|
+ moveMap()
|
|
|
}
|
|
|
|
|
|
}
|
|
@@ -4322,8 +4359,11 @@ export class Viewer extends ViewerBase{
|
|
|
//console.log('focusOnObjectSuccess: '+object.name, type)
|
|
|
deferred.resolve()
|
|
|
}
|
|
|
- }
|
|
|
- )}
|
|
|
+ })
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+ }
|
|
|
|
|
|
this.dispatchEvent({type:'focusOnObject', CamTarget:target, position}) //给controls发送信息
|
|
|
|