|
@@ -619,11 +619,11 @@ export class Viewer extends ViewerBase{
|
|
|
let pointBudget;
|
|
|
var config = Potree.config.pointDensity[density];
|
|
|
|
|
|
- if(this.magnifier.visible){//放大镜打开时不要切换pointBudget,否则点云会闪烁。这时使用最高密度。
|
|
|
+ /* if(this.magnifier.visible){//放大镜打开时不要切换pointBudget,否则点云会闪烁。这时使用最高密度。
|
|
|
pointBudget = Potree.config.pointDensity['magnifier'].pointBudget
|
|
|
}else{
|
|
|
pointBudget = config.pointBudget
|
|
|
- }
|
|
|
+ } */
|
|
|
|
|
|
|
|
|
viewer.setMinNodeSize(config.minNodeSize || Potree.config.minNodeSize)
|
|
@@ -1682,7 +1682,7 @@ export class Viewer extends ViewerBase{
|
|
|
}
|
|
|
|
|
|
setPointBudget (value) { //pointBudget: 每次刷新显示点数量的最大值。 缓存中的点数量也跟此有关,但大于这个数值。
|
|
|
- if (Potree.pointBudget !== value) {
|
|
|
+ if (Potree.pointBudget !== value && value) {
|
|
|
Potree.pointBudget = parseInt(value);
|
|
|
this.dispatchEvent({'type': 'point_budget_changed', 'viewer': this});
|
|
|
}
|
|
@@ -3144,8 +3144,7 @@ export class Viewer extends ViewerBase{
|
|
|
}
|
|
|
|
|
|
params.target || renderer.clear();
|
|
|
-
|
|
|
-
|
|
|
+
|
|
|
}
|
|
|
|
|
|
getBuffer(viewport){//根据不同viewport返回rtEDL的texture
|
|
@@ -3258,6 +3257,7 @@ export class Viewer extends ViewerBase{
|
|
|
this.clear(params)
|
|
|
pRenderer.clearTargets(params);
|
|
|
|
|
|
+
|
|
|
this.renderBG(view)
|
|
|
|
|
|
if(Potree.settings.notAdditiveBlending){
|
|
@@ -3657,7 +3657,7 @@ export class Viewer extends ViewerBase{
|
|
|
|
|
|
{//恢复:
|
|
|
|
|
|
-
|
|
|
+ this.backgroundOpacity = oldStates.bgOpacity;
|
|
|
|
|
|
if(info.type == 'measure' || info.type.includes('prism2d')){
|
|
|
this.modules.SiteModel.pauseUpdateEntity = false
|
|
@@ -3668,13 +3668,12 @@ export class Viewer extends ViewerBase{
|
|
|
|
|
|
if(info.type.includes('prism2d')){
|
|
|
//viewer.mapViewer.transparentBG = false;
|
|
|
- this.backgroundOpacity = oldStates.bgOpacity;
|
|
|
+
|
|
|
(info.prisms || [info.prism]).forEach(prism=>{
|
|
|
prism.changeStyleForScreenshot(false)
|
|
|
})
|
|
|
}
|
|
|
-
|
|
|
-
|
|
|
+
|
|
|
|
|
|
this.images360.panos.forEach(pano=>{
|
|
|
Potree.Utils.updateVisible(pano, 'screenshot', true)
|
|
@@ -3735,7 +3734,8 @@ export class Viewer extends ViewerBase{
|
|
|
let mainViewport = this.mainViewport
|
|
|
let viewports = [], oldStates = {
|
|
|
viewports:[],
|
|
|
- pano: Potree.settings.displayMode == 'showPanos' ? viewer.images360.currentPano : null
|
|
|
+ pano: Potree.settings.displayMode == 'showPanos' ? viewer.images360.currentPano : null,
|
|
|
+ bgOpacity : this.backgroundOpacity
|
|
|
}
|
|
|
if(!info.type.includes('prism2d')){
|
|
|
viewports.push(mainViewport)
|
|
@@ -3759,7 +3759,13 @@ export class Viewer extends ViewerBase{
|
|
|
})
|
|
|
}
|
|
|
Potree.Utils.updateVisible(this.reticule, 'screenshot', false)//令reticule不可见
|
|
|
-
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+ if(info.bgOpacity != void 0){
|
|
|
+ this.backgroundOpacity = info.bgOpacity
|
|
|
+ }
|
|
|
+
|
|
|
Potree.settings.pointDensity = 'screenshot'
|
|
|
|
|
|
|
|
@@ -3896,29 +3902,32 @@ export class Viewer extends ViewerBase{
|
|
|
prism.changeStyleForScreenshot(true, {hideLabel: info.type != 'prism2d-all', showName: info.type == 'prism2d-all' })
|
|
|
|
|
|
})
|
|
|
+ this.scene.measurements.forEach(e=>Potree.Utils.updateVisible(e,'screenshot', prisms.includes(e)) )
|
|
|
+
|
|
|
+
|
|
|
|
|
|
let {promise} = this.focusOnObject({points}, 'prisms2d', 0, {
|
|
|
minMapWidth: 0.5 , onlyMap:true, focusBoundCenter:true, boundExpandRatio:1.4
|
|
|
})
|
|
|
-
|
|
|
- oldStates.bgOpacity = this.backgroundOpacity
|
|
|
+
|
|
|
this.backgroundOpacity = 0
|
|
|
|
|
|
promise.done(()=>{
|
|
|
updateCamera()
|
|
|
-
|
|
|
+ focusDatasets(prisms) //更新平面图 可能有漏洞,当不在任何一个数据集内的话?
|
|
|
+ this.mapViewer.waitLoadDone(screenshot.bind(this))//等待地图所有加载完
|
|
|
+
|
|
|
if(info.type == 'prism2d-all'){//全部 带平面图
|
|
|
- focusDatasets(prisms) //更新平面图 可能有漏洞,当不在任何一个数据集内的话?
|
|
|
- this.mapViewer.waitLoadDone(screenshot.bind(this))//等待地图所有加载完
|
|
|
+
|
|
|
}else{//单个
|
|
|
|
|
|
- this.scene.measurements.forEach(e=>Potree.Utils.updateVisible(e,'screenshot', e == info.prism) )
|
|
|
+
|
|
|
//info.prism.setSelected(true, 'screenshot')
|
|
|
//viewer.mapViewer.transparentBG = true
|
|
|
|
|
|
- Potree.Utils.updateVisible(viewer.mapViewer.mapLayer.sceneGroup, 'screenshot-prism', false)
|
|
|
+ /* Potree.Utils.updateVisible(viewer.mapViewer.mapLayer.sceneGroup, 'screenshot-prism', false)
|
|
|
|
|
|
- screenshot()
|
|
|
+ screenshot() */
|
|
|
}
|
|
|
})
|
|
|
|
|
@@ -4964,68 +4973,7 @@ export class Viewer extends ViewerBase{
|
|
|
return r && r.score > 1 ? result[0].item : null
|
|
|
}
|
|
|
|
|
|
- /* addObjectTest1(){//加水管
|
|
|
-
|
|
|
- if(Potree.settings.number == 't-8KbK1JjubE'){
|
|
|
-
|
|
|
- let boundingBox = new THREE.Box3()
|
|
|
- boundingBox.min.set(-1,-1,-1); boundingBox.max.set(1,1,1)
|
|
|
-
|
|
|
-
|
|
|
- let radius = 0.08;
|
|
|
- let radialSegments = 5
|
|
|
- let radSegments = Math.PI*2 / radialSegments
|
|
|
- var circlePts = [];//横截面
|
|
|
- for(let i=0;i<radialSegments;i++){
|
|
|
- let angle = radSegments * i;
|
|
|
- circlePts.push(new THREE.Vector2(radius * Math.cos(angle), radius * Math.sin(angle) ))
|
|
|
- }
|
|
|
- var count = 0
|
|
|
- var addMesh = (color, path, height)=>{//height:在path之上的高度,负数代表在path之下
|
|
|
- var name = 'cylinder'+count
|
|
|
- var mat = new THREE.MeshStandardMaterial({color, depthTest:false, roughness:0.4,metalness:0.5})
|
|
|
- let linePath = path.map(e=>new THREE.Vector3().copy(e).setZ(e.z+height))
|
|
|
- let geo = MeshDraw.getExtrudeGeo( circlePts, null,{ extrudePath:linePath, tension:0.2} )
|
|
|
- var mesh = new THREE.Mesh(geo,mat);
|
|
|
- mesh.name = name
|
|
|
- window[name] = mesh
|
|
|
-
|
|
|
- mesh.boundingBox = boundingBox
|
|
|
- mesh.matrixAutoUpdate = false
|
|
|
- mesh.matrix.copy(viewer.scene.pointclouds[0].transformMatrix)
|
|
|
- mesh.matrixWorldNeedsUpdate = true
|
|
|
-
|
|
|
- this.scene.scene.add(mesh);
|
|
|
-
|
|
|
- count ++
|
|
|
- }
|
|
|
-
|
|
|
-
|
|
|
- let linePath, height
|
|
|
-
|
|
|
- //地上管子 黄色
|
|
|
- linePath = [{"x":-109.83,"y":-68.33,"z":-7.52},{"x":-95.17,"y":-59.3,"z":-7.38}, {"x":-38.75,"y":-24.01,"z":-6.01},{"x":0.5,"y":0.19,"z":-3.89},{"x":39.29,"y":24.41,"z":-1.31}
|
|
|
- ,{"x":43.58,"y":27.7,"z":-0.97},{"x":40.22,"y":35.37,"z":-0.67}// 拐弯向右
|
|
|
- , {"x":39.18,"y":36.71,"z":0.35},{"x":38.69,"y":36.04,"z":18.04} // 拐弯向上
|
|
|
- ]
|
|
|
- height = radius + 0.05;
|
|
|
- addMesh('#b86', linePath, height)
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
- //地下管子 藍色
|
|
|
- linePath = [{"x":-108.24,"y":-70.61,"z":-7.52}, {"x":-57.8,"y":-39.31,"z":-6.72},{"x":-18.8,"y":-15.35,"z":-5.01},{"x":55.87,"y":31.67,"z":-0.04},{"x":110.53,"y":66.48,"z":5.14}
|
|
|
- ]
|
|
|
- height = -0.5;
|
|
|
- addMesh('#48a', linePath, height)
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
- }
|
|
|
-
|
|
|
-
|
|
|
- }
|
|
|
- */
|
|
|
+
|
|
|
/* createRoomEv(){
|
|
|
|
|
|
const environment = new RoomEnvironment();
|
|
@@ -5578,6 +5526,154 @@ export class Viewer extends ViewerBase{
|
|
|
*/
|
|
|
}
|
|
|
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+ /* addTube(){//加水管 自动生成
|
|
|
+
|
|
|
+ if(Potree.settings.number == 't-8KbK1JjubE'){
|
|
|
+
|
|
|
+ let boundingBox = new THREE.Box3()
|
|
|
+ boundingBox.min.set(-1,-1,-1); boundingBox.max.set(1,1,1)
|
|
|
+
|
|
|
+
|
|
|
+ let radius = 0.08;
|
|
|
+ let radialSegments = 5
|
|
|
+ let radSegments = Math.PI*2 / radialSegments
|
|
|
+ var circlePts = [];//横截面
|
|
|
+ for(let i=0;i<radialSegments;i++){
|
|
|
+ let angle = radSegments * i;
|
|
|
+ circlePts.push(new THREE.Vector2(radius * Math.cos(angle), radius * Math.sin(angle) ))
|
|
|
+ }
|
|
|
+ var count = 0
|
|
|
+ var addMesh = (color, path, height)=>{//height:在path之上的高度,负数代表在path之下
|
|
|
+ var name = 'cylinder'+count
|
|
|
+ var mat = new THREE.MeshStandardMaterial({color, depthTest:false, roughness:0.4,metalness:0.5})
|
|
|
+ let linePath = path.map(e=>new THREE.Vector3().copy(e).setZ(e.z+height))
|
|
|
+ let geo = MeshDraw.getExtrudeGeo( circlePts, null,{ extrudePath:linePath, tension:0.2} )
|
|
|
+ var mesh = new THREE.Mesh(geo,mat);
|
|
|
+ mesh.name = name
|
|
|
+ window[name] = mesh
|
|
|
+
|
|
|
+ mesh.boundingBox = boundingBox
|
|
|
+ mesh.matrixAutoUpdate = false
|
|
|
+ mesh.matrix.copy(viewer.scene.pointclouds[0].transformMatrix)
|
|
|
+ mesh.matrixWorldNeedsUpdate = true
|
|
|
+
|
|
|
+ this.scene.scene.add(mesh);
|
|
|
+
|
|
|
+ count ++
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ let linePath, height
|
|
|
+
|
|
|
+ //地上管子 黄色
|
|
|
+ linePath = [{"x":-109.83,"y":-68.33,"z":-7.52},{"x":-95.17,"y":-59.3,"z":-7.38}, {"x":-38.75,"y":-24.01,"z":-6.01},{"x":0.5,"y":0.19,"z":-3.89},{"x":39.29,"y":24.41,"z":-1.31}
|
|
|
+ ,{"x":43.58,"y":27.7,"z":-0.97},{"x":40.22,"y":35.37,"z":-0.67}// 拐弯向右
|
|
|
+ , {"x":39.18,"y":36.71,"z":0.35},{"x":38.69,"y":36.04,"z":18.04} // 拐弯向上
|
|
|
+ ]
|
|
|
+ height = radius + 0.05;
|
|
|
+ addMesh('#b86', linePath, height)
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+ //地下管子 藍色
|
|
|
+ linePath = [{"x":-108.24,"y":-70.61,"z":-7.52}, {"x":-57.8,"y":-39.31,"z":-6.72},{"x":-18.8,"y":-15.35,"z":-5.01},{"x":55.87,"y":31.67,"z":-0.04},{"x":110.53,"y":66.48,"z":5.14}
|
|
|
+ ]
|
|
|
+ height = -0.5;
|
|
|
+ addMesh('#48a', linePath, height)
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ } */
|
|
|
+
|
|
|
+
|
|
|
+ addTube(datas){//加水管 自动生成
|
|
|
+
|
|
|
+
|
|
|
+ for(let number in datas){
|
|
|
+ if(number == Potree.settings.number){
|
|
|
+
|
|
|
+ let data = datas[number]
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+ let boundingBox = new THREE.Box3()
|
|
|
+ boundingBox.min.set(-1,-1,-1); boundingBox.max.set(1,1,1)
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+ var index = 0
|
|
|
+ var addMesh = ({color, path, height,fromDataset, radius=0.08, datasetId=Potree.settings.originDatasetId, spaceDis, tension=0.1, visiEntity}={})=>{//height:在path之上的高度,负数代表在path之下
|
|
|
+ var name = 'tube_'+index
|
|
|
+
|
|
|
+
|
|
|
+ let radialSegments = 30//THREE.Math.clamp( Math.round(radius * 800), 10, 40)
|
|
|
+ let radSegments = Math.PI*2 / radialSegments
|
|
|
+ var circlePts = [];//横截面
|
|
|
+ for(let i=0;i<radialSegments;i++){
|
|
|
+ let angle = radSegments * i;
|
|
|
+ circlePts.push(new THREE.Vector2(radius * Math.cos(angle), radius * Math.sin(angle) ))
|
|
|
+ }
|
|
|
+
|
|
|
+ var mat = new THREE.MeshStandardMaterial({color, /* wireframe:true, depthTest:false,*/ roughness:0.9,metalness:0.3})
|
|
|
+ let linePath = path.map(e=>{
|
|
|
+ e instanceof Array && (e = new THREE.Vector3().fromArray(e))
|
|
|
+ let pos
|
|
|
+ if(fromDataset){
|
|
|
+ //获取:JSON.stringify(viewer.scene.measurements[0].dataset_points.map(e=>Potree.math.toPrecision(e.toArray(),3)))
|
|
|
+ pos = Potree.Utils.datasetPosTransform({ fromDataset: true, position:e, datasetId})
|
|
|
+ }else{
|
|
|
+ pos = new THREE.Vector3().copy(e)
|
|
|
+ }
|
|
|
+
|
|
|
+ return pos.setZ(pos.z+height)
|
|
|
+ })
|
|
|
+ console.log(linePath)
|
|
|
+ let geo = MeshDraw.getExtrudeGeo( circlePts, null,{ extrudePath:linePath, tension, spaceDis} )
|
|
|
+ var mesh = new THREE.Mesh(geo,mat);
|
|
|
+ mesh.name = name
|
|
|
+ window[name] = mesh
|
|
|
+
|
|
|
+ mesh.boundingBox = boundingBox
|
|
|
+ mesh.matrixAutoUpdate = false
|
|
|
+ fromDataset || mesh.matrix.copy(viewer.scene.pointclouds[0].transformMatrix)
|
|
|
+ mesh.matrixWorldNeedsUpdate = true
|
|
|
+
|
|
|
+ this.scene.scene.add(mesh);
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+ if(visiEntity){
|
|
|
+ this.modules.SiteModel.bus.addEventListener('buildingChange',(e)=>{
|
|
|
+ Potree.Utils.updateVisible(mesh,'isInEntity', e.entity && e.entity.name == visiEntity)
|
|
|
+ })
|
|
|
+ }
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ while(index < data.length){
|
|
|
+ addMesh(data[index])
|
|
|
+ index++
|
|
|
+ }
|
|
|
+
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ /*
|
|
|
+ 可能用到的
|
|
|
+ viewer.scene.measurements.forEach(e=>e.edgeLabels.forEach(e=>Potree.Utils.updateVisible(e,'f',false)))
|
|
|
+ JSON.stringify(viewer.scene.measurements.find(e=>e.visible).dataset_points.map(e=>Potree.math.toPrecision(e.toArray(),3)))
|
|
|
+
|
|
|
+ */
|
|
|
+ }
|
|
|
+
|
|
|
addSprite(e){//api
|
|
|
let sprite
|
|
|
|