|
@@ -599,7 +599,7 @@ var Clip = {
|
|
return new Promise((resolve,reject)=>{
|
|
return new Promise((resolve,reject)=>{
|
|
if(Clip.screenshoting )return reject()
|
|
if(Clip.screenshoting )return reject()
|
|
let rulerBound = {}//因为margin 扩大bound
|
|
let rulerBound = {}//因为margin 扩大bound
|
|
-
|
|
|
|
|
|
+ let meterPerPixel
|
|
|
|
|
|
let visiPointclouds = viewer.scene.pointclouds.filter(e=> Potree.Utils.getObjVisiByReason(e, 'datasetSelection'))
|
|
let visiPointclouds = viewer.scene.pointclouds.filter(e=> Potree.Utils.getObjVisiByReason(e, 'datasetSelection'))
|
|
let camera = viewer.mainViewport.camera
|
|
let camera = viewer.mainViewport.camera
|
|
@@ -662,7 +662,7 @@ var Clip = {
|
|
s = minWidth/max
|
|
s = minWidth/max
|
|
}
|
|
}
|
|
w *= s, h *= s
|
|
w *= s, h *= s
|
|
- material.size *= s
|
|
|
|
|
|
+
|
|
s != 1 && console.log('宽度缩放倍数',s)
|
|
s != 1 && console.log('宽度缩放倍数',s)
|
|
|
|
|
|
|
|
|
|
@@ -672,7 +672,7 @@ var Clip = {
|
|
w = Math.round(w)
|
|
w = Math.round(w)
|
|
h = Math.round(h)
|
|
h = Math.round(h)
|
|
|
|
|
|
- let focusObjectInfo = [{boundingBox, points}, 'boundingBox', 0, { dontChangeCamDir:true, dontMoveMap:true, boundScale:1 }]
|
|
|
|
|
|
+ let focusObjectInfo = [{boundingBox, points}, 'boundingBox', 0, { dontChangeCamDir:true, dontMoveMap:true, boundScale:1, minBound : 0.1 }]
|
|
|
|
|
|
|
|
|
|
//分块渲染截图,最后拼合图片。需要使每一块的点数不超过pointBudget, 且尺寸不超过4096(会崩溃),过小的话一般不会超过pointBudget,除非是深度较大后排点云多。
|
|
//分块渲染截图,最后拼合图片。需要使每一块的点数不超过pointBudget, 且尺寸不超过4096(会崩溃),过小的话一般不会超过pointBudget,除非是深度较大后排点云多。
|
|
@@ -685,17 +685,20 @@ var Clip = {
|
|
|
|
|
|
console.log({wc,hc,w,h})
|
|
console.log({wc,hc,w,h})
|
|
|
|
|
|
- let meterPerPixel = boundSize.x / w
|
|
|
|
|
|
|
|
- /* let text = `1 : ${(meterPerPixel).toFixed(4)}(${unitText})` */
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
let beforeScreenshot = ()=>{
|
|
let beforeScreenshot = ()=>{
|
|
- if(rulerToolFactory){
|
|
|
|
|
|
+ //if(rulerToolFactory){
|
|
let ruler = Clip.getRulerBound()
|
|
let ruler = Clip.getRulerBound()
|
|
Object.assign(rulerBound,ruler)
|
|
Object.assign(rulerBound,ruler)
|
|
- }
|
|
|
|
|
|
+ //因为focusOnObject时有最小边界,所以当box很小时截图区域不止box
|
|
|
|
+ let cameraBoundSizeX = ruler.right-ruler.left
|
|
|
|
+ meterPerPixel = cameraBoundSizeX / w
|
|
|
|
+ let zoom = viewer.mainViewport.camera.zoom
|
|
|
|
+ material.size *= Math.min(zoom / minZoom, 10 );//限制一下,避免测试时界面点云很小,截图点云很大
|
|
|
|
+ //}
|
|
}
|
|
}
|
|
|
|
|
|
let {getImagePromise, finishPromise} = viewer.startScreenshot({ type: 'default', bgOpacity:0, focusObjectInfo, maxTimeForPointLoad : 3e5, pointDensity:'screenshot2', splitRenderInfo, beforeScreenshot }, w, h, 1 )
|
|
let {getImagePromise, finishPromise} = viewer.startScreenshot({ type: 'default', bgOpacity:0, focusObjectInfo, maxTimeForPointLoad : 3e5, pointDensity:'screenshot2', splitRenderInfo, beforeScreenshot }, w, h, 1 )
|
|
@@ -724,11 +727,11 @@ var Clip = {
|
|
let rulerMargin = 20//标尺外的margin px
|
|
let rulerMargin = 20//标尺外的margin px
|
|
let labelInfo = {
|
|
let labelInfo = {
|
|
bottomRatioToImg, horizonCenter:true,//leftRatioToImg,
|
|
bottomRatioToImg, horizonCenter:true,//leftRatioToImg,
|
|
- textColor: /* rulerToolFactory ? */ {r: 0, g: 0, b: 0, a: 1} /* : { r: 255, g: 255, b: 255, a: 1 } */,
|
|
|
|
|
|
+ textColor: rulerToolFactory ? {r: 0, g: 0, b: 0, a: 1} : { r: 255, g: 255, b: 255, a: 1 } ,
|
|
textBorderColor : { r: 30, g: 30, b: 30, a: 1 },
|
|
textBorderColor : { r: 30, g: 30, b: 30, a: 1 },
|
|
textBorderThick : rulerToolFactory ? 0 : 1 ,
|
|
textBorderThick : rulerToolFactory ? 0 : 1 ,
|
|
fontsize,
|
|
fontsize,
|
|
- fontWeight: /* rulerToolFactory ? */ 'normal'/* :'Bold' */,
|
|
|
|
|
|
+ fontWeight: rulerToolFactory ? 'normal' :'Bold' ,
|
|
outputCanvas : true,
|
|
outputCanvas : true,
|
|
bgColor: rulerToolFactory ? {r:255,g:255,b:255,a:255}:null
|
|
bgColor: rulerToolFactory ? {r:255,g:255,b:255,a:255}:null
|
|
}
|
|
}
|