|
@@ -53280,6 +53280,8 @@
|
|
|
}
|
|
|
};
|
|
|
|
|
|
+ //THREE.Vector2.name2 = 'Common'
|
|
|
+
|
|
|
var Common = {
|
|
|
|
|
|
|
|
@@ -53397,12 +53399,10 @@
|
|
|
|
|
|
CloneObject : function (copyObj, isSimpleCopy, simpleCopyList = [], judgeSimpleCopyFun) {
|
|
|
//isSimpleCopy 只复制最外层
|
|
|
- //复制json result的可能:普通数字或字符串、普通数组、复杂对象
|
|
|
-
|
|
|
- simpleCopyList.includes(Object3D) || simpleCopyList.push(Object3D); //遇到simpleCopyList中的类直接使用不拷贝
|
|
|
+ //复制json result的可能:普通数字或字符串、普通数组、复杂对象
|
|
|
judgeSimpleCopyFun || (judgeSimpleCopyFun=()=>{});
|
|
|
|
|
|
- if (!copyObj || typeof copyObj == 'number' || typeof copyObj == 'string' || copyObj instanceof Function || simpleCopyList.some(className => copyObj instanceof className) || judgeSimpleCopyFun(copyObj)) {
|
|
|
+ if (!copyObj || typeof copyObj == 'number' || typeof copyObj == 'string' ||copyObj.isObject3D || copyObj instanceof Function || simpleCopyList.some(className => copyObj instanceof className) || judgeSimpleCopyFun(copyObj)) {
|
|
|
return copyObj
|
|
|
}
|
|
|
|
|
@@ -73651,7 +73651,7 @@ void main()
|
|
|
needsUpdate = true;
|
|
|
}
|
|
|
|
|
|
- if(old_visibleNodes) {
|
|
|
+ if(needsUpdate) {
|
|
|
for(let pointcloud of pointclouds){
|
|
|
old_visibleNodes.set(pointcloud, pointcloud.visibleNodes);
|
|
|
}
|
|
@@ -73718,7 +73718,7 @@ void main()
|
|
|
}
|
|
|
}
|
|
|
|
|
|
- if(old_visibleNodes){
|
|
|
+ if(needsUpdate){
|
|
|
for(let pointcloud of pointclouds){ //不恢复的话(尤其cameraChanged时),在下次render前,再次pick可能是错的。表现为多数据集刚开始reticule消失了,直到ifPointBlockedByIntersect停止
|
|
|
pointcloud.visibleNodes = old_visibleNodes.get(pointcloud);
|
|
|
}
|
|
@@ -82608,6 +82608,9 @@ void main()
|
|
|
|
|
|
}
|
|
|
|
|
|
+ //THREE.Vector2.name1 = 'ctrlPolygon'
|
|
|
+
|
|
|
+
|
|
|
const verticalLine = new Line3();
|
|
|
|
|
|
//控制点和边的合集。具有可以拖拽修改的功能,拖拽时能防止线相交。
|
|
@@ -82617,7 +82620,7 @@ void main()
|
|
|
this.type = type;
|
|
|
|
|
|
this.maxMarkers = Number.MAX_SAFE_INTEGER;
|
|
|
-
|
|
|
+
|
|
|
|
|
|
this.transformData(prop);
|
|
|
for(let i in prop){
|
|
@@ -83558,8 +83561,7 @@ void main()
|
|
|
|
|
|
this.name = this.measureType + this.constructor.counter; //'Measure_' + this.constructor.counter;
|
|
|
|
|
|
-
|
|
|
-
|
|
|
+
|
|
|
this.markerLabels = [];
|
|
|
this.edgeLabels = [];
|
|
|
this.angleLabels = [];
|
|
@@ -84055,12 +84057,8 @@ void main()
|
|
|
//add for 调试,方便后期增加点
|
|
|
if(!this.isNew && viewer.inputHandler.pressedKeys['M'.charCodeAt(0)] && this.points.length<this.maxMarkers){
|
|
|
viewer.measuringTool.history.beforeChange(this);
|
|
|
- let curIndex = this.markers.indexOf(marker);
|
|
|
-
|
|
|
- this.cloneMarker(curIndex, curIndex+1);
|
|
|
-
|
|
|
- //this.addMarker({index:curIndex+1, point:marker.position, dataset_point:this.dataset_points[curIndex], points_dataset:this.points_datasets[curIndex]})
|
|
|
-
|
|
|
+ let curIndex = this.markers.indexOf(marker);
|
|
|
+ this.cloneMarker(curIndex, curIndex+1);
|
|
|
}
|
|
|
|
|
|
|
|
@@ -85127,7 +85125,9 @@ void main()
|
|
|
let areaPlaneMats = {
|
|
|
|
|
|
};
|
|
|
-
|
|
|
+
|
|
|
+
|
|
|
+ console.log('prism 11111111111');
|
|
|
|
|
|
class Prism extends Measure$1{
|
|
|
constructor(args){
|
|
@@ -85420,6 +85420,7 @@ void main()
|
|
|
this.history = new History({
|
|
|
applyData: (data)=>{
|
|
|
if(data.measure.parent && data.measure.visible){
|
|
|
+
|
|
|
data = Potree.Common.CloneObject(data); //避免使用后更改数据又被使用
|
|
|
data.measure.reDraw();
|
|
|
data.measure.initData(data);
|
|
@@ -86011,8 +86012,7 @@ void main()
|
|
|
|
|
|
let marker = measure.markers[measure.points.length-1];
|
|
|
this.viewer.inputHandler.startDragging(marker , {endDragFun, notPressMouse:true} );
|
|
|
- e.drag = this.viewer.inputHandler.drag;
|
|
|
-
|
|
|
+
|
|
|
|
|
|
var I = viewer.inputHandler.intersect && (viewer.inputHandler.intersect.orthoIntersect || viewer.inputHandler.intersect.location);
|
|
|
if(I){
|
|
@@ -94528,8 +94528,11 @@ void main()
|
|
|
}
|
|
|
|
|
|
|
|
|
- if(!onlyForTarget){//因为onlyForTarget不传递devicePixelRatio所以不发送了
|
|
|
- this.ifEmitResize({viewport:this.viewports[0], deviceRatio:devicePixelRatio});
|
|
|
+ if(!onlyForTarget){//因为onlyForTarget不传递devicePixelRatio所以不发送了
|
|
|
+ this.dispatchEvent('viewerResize');
|
|
|
+ this.viewports.forEach(e=>{
|
|
|
+ this.ifEmitResize({viewport:e, deviceRatio:devicePixelRatio});
|
|
|
+ });
|
|
|
}
|
|
|
|
|
|
}
|
|
@@ -114407,7 +114410,7 @@ ENDSEC
|
|
|
intersectPointcloudVolume(pointcloud){//和pointcloud的重叠体积
|
|
|
return this.intersectPointcloudArea(pointcloud) * this.coverPointcloudHeight(pointcloud)
|
|
|
}
|
|
|
-
|
|
|
+
|
|
|
|
|
|
coverPointcloudHeight(pointcloud, getPercent){
|
|
|
let bound2 = pointcloud.bound;
|
|
@@ -114655,11 +114658,12 @@ ENDSEC
|
|
|
});
|
|
|
};
|
|
|
let drag = (e) => {
|
|
|
+ this.dispatchEvent('startDragging');
|
|
|
let index = this.midMarkers.indexOf(marker);
|
|
|
let newMarker = this.addMarker({index:(index+1), point:marker.position.clone() });
|
|
|
this.addMidMarker(index+1, new Vector3 );
|
|
|
this.updateTwoMidMarker(index+1);
|
|
|
- this.setMarkerSelected(marker, 'unhover');
|
|
|
+ this.setMarkerSelected(marker, 'unhover');
|
|
|
viewer.inputHandler.startDragging(newMarker , {/* dragViewport:viewer.mapViewer.viewports[0], */ } ); //notPressMouse代表不是通过按下鼠标来拖拽. dragViewport指定了只能在地图上拖拽
|
|
|
};
|
|
|
marker.addEventListener('drag', drag );
|
|
@@ -115120,21 +115124,23 @@ ENDSEC
|
|
|
|
|
|
this.history = new History({
|
|
|
applyData: (data)=>{
|
|
|
- if(data.entity.parent && data.entity.visible){
|
|
|
+ if(data.entity.parent && data.entity.selected ){
|
|
|
data = Potree.Common.CloneObject(data); //避免使用后更改数据又被使用
|
|
|
data.entity.reDraw();
|
|
|
data.entity.initData(data);
|
|
|
- data.entity.addMidMarkers();
|
|
|
+ data.isNew || data.entity.addMidMarkers();
|
|
|
+ data.entity.isNew = data.isNew;
|
|
|
data.entity.dispatchEvent('changeByHistory');
|
|
|
return true
|
|
|
}
|
|
|
},
|
|
|
getData:(entity)=>{
|
|
|
- if(entity.isNew)return
|
|
|
+ //if(entity.isNew)return
|
|
|
return {
|
|
|
entity,
|
|
|
points: entity.points.map(e=>e.clone()),
|
|
|
- ifDraw: true
|
|
|
+ ifDraw: true,
|
|
|
+ isNew : entity.isNew,
|
|
|
}
|
|
|
}
|
|
|
});
|
|
@@ -115399,7 +115405,7 @@ ENDSEC
|
|
|
|
|
|
|
|
|
startInsertion:function(buildType, parent, sid, name, callback, cancelFun){
|
|
|
-
|
|
|
+
|
|
|
let zMin, zMax, entity, resume;
|
|
|
let mapViewport = viewer.mapViewer.viewports[0];
|
|
|
|
|
@@ -115412,7 +115418,7 @@ ENDSEC
|
|
|
entity.reDraw(0);
|
|
|
entity.isNew = true; //当作新的来画
|
|
|
}
|
|
|
-
|
|
|
+
|
|
|
if(!resume){
|
|
|
if(buildType == 'hole' || buildType == 'room'){
|
|
|
zMin = parent.zMin;
|
|
@@ -115465,9 +115471,10 @@ ENDSEC
|
|
|
|
|
|
|
|
|
let endDragFun = (e) => {
|
|
|
- if (e.button == MOUSE.LEFT ) {
|
|
|
+ if (e.button == MOUSE.LEFT ) {
|
|
|
+ this.history.beforeChange(entity);
|
|
|
var marker = entity.addMarker({point:entity.points[entity.points.length - 1].clone()});
|
|
|
-
|
|
|
+ this.history.afterChange(entity);
|
|
|
//entity.editStateChange(true) //重新激活reticule状态
|
|
|
entity.continueDrag(marker, e);
|
|
|
} else if (e.button === MOUSE.RIGHT ) {
|
|
@@ -115542,8 +115549,7 @@ ENDSEC
|
|
|
};
|
|
|
|
|
|
|
|
|
- let Exit = (e)=>{ //强制结束
|
|
|
-
|
|
|
+ let Exit = (e)=>{ //强制结束
|
|
|
entity.removeEventListener('unselect', Exit);
|
|
|
|
|
|
if(viewer.inputHandler.drag){//还未触发drop的话
|
|
@@ -115553,8 +115559,8 @@ ENDSEC
|
|
|
viewer: viewer,
|
|
|
pressDistance:0,
|
|
|
button : MOUSE.RIGHT
|
|
|
- });
|
|
|
- viewer.inputHandler.drag = null;
|
|
|
+ });
|
|
|
+ viewer.inputHandler.drag.object.isDragging = false;
|
|
|
}else {
|
|
|
end({remain:true});
|
|
|
}
|
|
@@ -115564,8 +115570,9 @@ ENDSEC
|
|
|
|
|
|
viewer.dispatchEvent( 'cancel_insertions' );//取消之前的
|
|
|
viewer.addEventListener('cancel_insertions', Exit);
|
|
|
- entity.addEventListener('unselect', Exit);
|
|
|
-
|
|
|
+ setTimeout(()=>{
|
|
|
+ entity.isNew && entity.addEventListener('unselect', Exit);
|
|
|
+ },1);//因为刚创建会unselect一下所以延迟
|
|
|
|
|
|
|
|
|
var marker = entity.addMarker({point:new Vector3(0, 0, 0)});
|
|
@@ -115580,7 +115587,23 @@ ENDSEC
|
|
|
marker.isDragging = true;
|
|
|
viewer.inputHandler.startDragging(marker , {dragViewport:mapViewport, endDragFun, notPressMouse:true} ); //notPressMouse代表不是通过按下鼠标来拖拽. dragViewport指定了只能在地图上拖拽
|
|
|
viewer.dispatchEvent('startBuildEntity');
|
|
|
-
|
|
|
+
|
|
|
+
|
|
|
+ let changeByHistory = (e)=>{
|
|
|
+ if(!entity.isNew)return
|
|
|
+
|
|
|
+ let marker = entity.markers[entity.points.length-1];
|
|
|
+ viewer.inputHandler.startDragging(marker , {dragViewport:mapViewport, endDragFun, notPressMouse:true} );
|
|
|
+
|
|
|
+ var I = viewer.inputHandler.intersect && (viewer.inputHandler.intersect.orthoIntersect || viewer.inputHandler.intersect.location);
|
|
|
+ if(I){
|
|
|
+ entity.dragChange(I.clone(), entity.points.length-1 ); //使最后一个点在鼠标处
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ };
|
|
|
+ entity.addEventListener('changeByHistory',changeByHistory);
|
|
|
+
|
|
|
return entity;
|
|
|
|
|
|
|
|
@@ -118574,6 +118597,32 @@ ENDSEC
|
|
|
SplitScreen : new SplitScreen(),
|
|
|
|
|
|
init(){
|
|
|
+
|
|
|
+
|
|
|
+ this.history = new History({
|
|
|
+ applyData: (data)=>{
|
|
|
+ if(data.object.parent /* && data.object == this.selected */){
|
|
|
+ data = Potree.Common.CloneObject(data); //避免使用后更改数据又被使用
|
|
|
+ data.matrix.decompose( data.object.position, data.object.quaternion, data.object.scale );
|
|
|
+ data.object.boundCenter.copy(data.boundCenter);
|
|
|
+ data.object.dispatchEvent('changeByHistory');
|
|
|
+ data.object.dispatchEvent('transformChanged');
|
|
|
+ viewer.dispatchEvent('content_changed');
|
|
|
+
|
|
|
+ return true
|
|
|
+ }
|
|
|
+ },
|
|
|
+ getData:(object)=>{
|
|
|
+ return {
|
|
|
+ object,
|
|
|
+ matrix: object.matrixWorld.clone(),
|
|
|
+ boundCenter: object.boundCenter.clone()
|
|
|
+ }
|
|
|
+ }
|
|
|
+ });
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
{
|
|
|
|
|
|
Potree.settings.notAdditiveBlending = true;
|
|
@@ -118616,7 +118665,7 @@ ENDSEC
|
|
|
this.transformControls2 = new TransformControls(viewer.mainViewport.camera, viewer.renderArea,{
|
|
|
dontHideWhenFaceCamera: true,
|
|
|
});
|
|
|
- this.transformControls.setSize(1.5);
|
|
|
+ this.transformControls2.setSize(1.5);
|
|
|
viewer.scene.scene.add(this.transformControls2);
|
|
|
Potree.Utils.setObjectLayers(this.transformControls2, 'layer2' );
|
|
|
|
|
@@ -118637,6 +118686,16 @@ ENDSEC
|
|
|
this.transformControls2.addEventListener('mouseUp',mouseUp);
|
|
|
|
|
|
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+ this.transformControls.addEventListener('mouseDown', ()=>{ //dragstart
|
|
|
+ this.history.beforeChange(this.selected);
|
|
|
+ });
|
|
|
+ this.transformControls.addEventListener('transform_end',()=>{
|
|
|
+ this.history.afterChange(this.selected);
|
|
|
+ });
|
|
|
+
|
|
|
}
|
|
|
|
|
|
|
|
@@ -118906,17 +118965,7 @@ ENDSEC
|
|
|
this.transformState = state;
|
|
|
this.clearTranCursor();
|
|
|
},
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
- //---------------------------
|
|
|
-
|
|
|
- /* writeToHistory(content){
|
|
|
- if(!this.prepareRecord)return;
|
|
|
- this.prepareRecord = false
|
|
|
- this.history.push(content)
|
|
|
- }, */
|
|
|
-
|
|
|
+
|
|
|
//---------------------------
|
|
|
|
|
|
getAllObjects(){
|
|
@@ -118989,6 +119038,10 @@ ENDSEC
|
|
|
model.dispatchEvent({type:'changeSelect', selected : state});
|
|
|
}
|
|
|
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
},
|
|
|
|
|
|
|
|
@@ -123813,13 +123866,9 @@ ENDSEC
|
|
|
this.material = new ExtendPointCloudMaterial();
|
|
|
|
|
|
this.material.activeAttributeName = testPoint$1 ? "rgba" : 'prismHeight' ;// 'rgba' indices prismHeight
|
|
|
-
|
|
|
- this.height = {up: 2, down: 1};
|
|
|
-
|
|
|
+
|
|
|
this.prisms = [];
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
+
|
|
|
|
|
|
}
|
|
|
|
|
@@ -125123,24 +125172,9 @@ ENDSEC
|
|
|
|
|
|
}else {
|
|
|
let n = camera.position.distanceTo(this.position);
|
|
|
-
|
|
|
- /* if( n < 1 ){
|
|
|
- if(this.state.cross ){ //测量时更精细些
|
|
|
- s = 0.7 * n
|
|
|
- }else{
|
|
|
- s = 1.1 * n
|
|
|
- }
|
|
|
- }else{
|
|
|
- if(this.state.cross ){
|
|
|
- s = 0.6 + 0.1 * n //n乘以的系数越高,其越不近大远小(大小越恒定)
|
|
|
- }else{
|
|
|
- s = 1 + 0.1 * n;
|
|
|
- }
|
|
|
- } */
|
|
|
-
|
|
|
-
|
|
|
- s = Math.log(n+1); //底数为e的log
|
|
|
-
|
|
|
+
|
|
|
+ s = 0.8 * Math.log2(n+1); //底数为2 ( Math.log()底数为e )
|
|
|
+
|
|
|
if(this.state.cross ){ //测量时更精细些
|
|
|
s /= viewer.images360.zoomLevel;
|
|
|
}
|
|
@@ -152948,7 +152982,12 @@ ENDSEC
|
|
|
|
|
|
this.textureMatrix = new Matrix4();
|
|
|
|
|
|
-
|
|
|
+ viewer.addEventListener('viewerResize',(e)=>{
|
|
|
+ let size = viewer.renderer.getSize(new Vector2);
|
|
|
+ this.renderTargetEdgeBuffer1.setSize(size.x, size.y );
|
|
|
+ this.renderTargetMaskBuffer.setSize(size.x, size.y);
|
|
|
+ this.resolution.set(size.x, size.y);
|
|
|
+ });
|
|
|
|
|
|
};
|
|
|
|
|
@@ -152972,12 +153011,8 @@ ENDSEC
|
|
|
|
|
|
},
|
|
|
setSize: function ( width, height ) {
|
|
|
-
|
|
|
- this.renderTargetEdgeBuffer1.setSize( width, height );
|
|
|
- this.renderTargetMaskBuffer.setSize( width, height );
|
|
|
- this.resolution.set(width,height);
|
|
|
-
|
|
|
- },
|
|
|
+
|
|
|
+ },
|
|
|
|
|
|
changeVisibilityOfSelectedObjects: function ( bVisible ) {
|
|
|
|
|
@@ -157724,7 +157759,7 @@ ENDSEC
|
|
|
this.needRender = true;
|
|
|
|
|
|
if(info.useRenderTarget){
|
|
|
- //离屏渲染 有抗锯齿问题、在手机上速度慢
|
|
|
+ //离屏渲染 有抗锯齿问题、在手机上速度慢 主视图一样会变内容,还是不用这个了
|
|
|
var { dataUrl } = viewerMaster.makeScreenshot( new Vector2(width,height), null, compressRatio );
|
|
|
|
|
|
}else {
|
|
@@ -159017,7 +159052,7 @@ ENDSEC
|
|
|
console.log('setPointStandardMat',state);
|
|
|
if(state){
|
|
|
if(this.pointStatesBefore){
|
|
|
- return console.error('已设置过pointStatesBefore!')
|
|
|
+ return console.warn('已设置过pointStatesBefore!')
|
|
|
}
|
|
|
this.pointStatesBefore = {
|
|
|
opacity : new Map(),
|