|
|
@@ -4515,7 +4515,7 @@
|
|
|
//isSimpleCopy 只复制最外层
|
|
|
//复制json result的可能:普通数字或字符串、普通数组、复杂对象
|
|
|
judgeSimpleCopyFun || (judgeSimpleCopyFun = () => {});
|
|
|
- if (!copyObj || typeof copyObj == 'number' || typeof copyObj == 'string' || copyObj.isObject3D || copyObj instanceof Function || simpleCopyList.some(className => copyObj instanceof className) || judgeSimpleCopyFun(copyObj)) {
|
|
|
+ if (!copyObj || typeof copyObj != 'object' || copyObj.isObject3D || simpleCopyList.some(className => copyObj instanceof className) || judgeSimpleCopyFun(copyObj)) {
|
|
|
return copyObj;
|
|
|
}
|
|
|
if (copyObj instanceof Array) {
|
|
|
@@ -43172,10 +43172,10 @@
|
|
|
} else if (this.center) {
|
|
|
return this.center.clone();
|
|
|
} else {
|
|
|
- var center = this.points.reduce(function (total, currentValue) {
|
|
|
+ var center = points.reduce(function (total, currentValue) {
|
|
|
return total.add(currentValue);
|
|
|
}, new Vector3());
|
|
|
- this.points.length && center.multiplyScalar(1 / this.points.length);
|
|
|
+ points.length && center.multiplyScalar(1 / points.length);
|
|
|
return center; //求不出重心呜呜
|
|
|
}
|
|
|
}
|
|
|
@@ -45287,6 +45287,10 @@
|
|
|
viewer.measuringTool.history.afterChange(this);
|
|
|
this.updateEdge();
|
|
|
this.hideArrowUntilUpdate();
|
|
|
+ this.dispatchEvent({
|
|
|
+ type: 'addMarkerByUser',
|
|
|
+ index
|
|
|
+ });
|
|
|
this.dispatchEvent('changed');
|
|
|
} else {
|
|
|
this.isNew || viewer.measuringTool.isAdding || this.setSelected('click'); //viewer.focusOnObject(this, 'measure') //正在添加测量线时不要focus其他线(容易误触)
|
|
|
@@ -45529,8 +45533,9 @@
|
|
|
this.pauseUpdateEdge = false;
|
|
|
this.updateEdge();
|
|
|
}
|
|
|
- updateEdge(force) {
|
|
|
- if (!force && (this.pauseUpdateEdge || this.lastUpdatePoints_ && Potree.Common.ifSame(this.lastUpdatePoints_, this.points) && this.halfPathWidth == this.lastHalfPathWidth)) return; //没变 不更新
|
|
|
+ updateEdge() {
|
|
|
+ var o = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
|
|
+ if (!o.force && (this.pauseUpdateEdge || this.lastUpdatePoints_ && Potree.Common.ifSame(this.lastUpdatePoints_, this.points) && this.halfPathWidth == this.lastHalfPathWidth)) return; //没变 不更新
|
|
|
//this.edge.geometry = MeshDraw.getExtrudeGeo(edgeExtrudePoints, null, {extrudePath: this.points, openEnded:true, shapeDontClose:true/* , dontSmooth:true, steps: this.points.length-1 */})
|
|
|
//getExtrudeGeo是平滑过的曲线,和设计不一样,且容易翻转,转角有时候细分过少
|
|
|
|
|
|
@@ -45763,7 +45768,7 @@
|
|
|
var points = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : this.points;
|
|
|
//更新端点 (这把points提到参数里是因为有个隐藏点的项目)
|
|
|
var len = points.length;
|
|
|
- var pts = this.geoPoints.length > 0 ? this.geoPoints : this.points;
|
|
|
+ var pts = this.geoPoints.length > 0 ? this.geoPoints : points;
|
|
|
var len2 = pts.length;
|
|
|
this.endCaps.forEach((e, i) => {
|
|
|
Potree.Utils.updateVisible(e, 'hasPoints', len > 0);
|
|
|
@@ -45774,7 +45779,7 @@
|
|
|
} else {
|
|
|
i == 0 ? e.quaternion.set(0, 0, 0, 1) : e.quaternion.set(0, 0, 1, 0); //两个半圆拼成一个圆点
|
|
|
}
|
|
|
- e.position.copy(this.points[i == 0 ? 0 : len - 1]);
|
|
|
+ e.position.copy(points[i == 0 ? 0 : len - 1]);
|
|
|
var s = this.halfPathWidth * 2.15;
|
|
|
e.scale.set(s, s, s);
|
|
|
}
|
|
|
@@ -45856,10 +45861,12 @@
|
|
|
this.isEditing = state;
|
|
|
}
|
|
|
removePoint(index) {
|
|
|
+ //外部调用
|
|
|
+
|
|
|
if (index == -1) {
|
|
|
return; //双击会这样,加了迅速删除, 可能因为没来得及删
|
|
|
}
|
|
|
- viewer.measuringTool.history.beforeChange(this);
|
|
|
+ viewer.measuringTool.history.beforeChange(this); //不同于通过点击marker来删除的已在别处执行了,外部调用的话要补
|
|
|
this.removeMarker(index);
|
|
|
this.hideArrowUntilUpdate();
|
|
|
viewer.measuringTool.history.afterChange(this);
|
|
|
@@ -45872,6 +45879,25 @@
|
|
|
});
|
|
|
}
|
|
|
}
|
|
|
+ removeMarker(index) {
|
|
|
+ //通过pen点击marker来删除点
|
|
|
+
|
|
|
+ super.removeMarker(index);
|
|
|
+ this.points_datasets.splice(index, 1);
|
|
|
+ this.dataset_points && this.dataset_points.splice(index, 1);
|
|
|
+ var labelIndex = index;
|
|
|
+ if (this.markerLabels[labelIndex]) {
|
|
|
+ this.markerLabels[labelIndex].dispose();
|
|
|
+ this.markerLabels.splice(labelIndex, 1);
|
|
|
+ }
|
|
|
+ this.update({
|
|
|
+ index: this.getIndex(index, -1)
|
|
|
+ });
|
|
|
+ this.dispatchEvent({
|
|
|
+ type: 'marker_removed',
|
|
|
+ measurement: this
|
|
|
+ });
|
|
|
+ }
|
|
|
setMarkerSelected(marker, state) {
|
|
|
state == 'hover' && (marker.markerSelectStates.hover = true);
|
|
|
state == 'unhover' && (marker.markerSelectStates.hover = false);
|
|
|
@@ -45968,23 +45994,6 @@
|
|
|
e.material.uniforms.occlusionDistance.value = this.selectStates.click ? 0.6 : this.selectStates.hover ? 0.7 : depthProps.occlusionDistance;
|
|
|
});
|
|
|
}
|
|
|
- removeMarker(index) {
|
|
|
- super.removeMarker(index);
|
|
|
- this.points_datasets.splice(index, 1);
|
|
|
- this.dataset_points && this.dataset_points.splice(index, 1);
|
|
|
- var labelIndex = index;
|
|
|
- if (this.markerLabels[labelIndex]) {
|
|
|
- this.markerLabels[labelIndex].dispose();
|
|
|
- this.markerLabels.splice(labelIndex, 1);
|
|
|
- }
|
|
|
- this.update({
|
|
|
- index: this.getIndex(index, -1)
|
|
|
- });
|
|
|
- this.dispatchEvent({
|
|
|
- type: 'marker_removed',
|
|
|
- measurement: this
|
|
|
- });
|
|
|
- }
|
|
|
setPosition(index, position) {
|
|
|
super.setPosition(index, position);
|
|
|
var event = {
|
|
|
@@ -46276,7 +46285,7 @@
|
|
|
unExist || this.redoList.push(last);
|
|
|
unExist && this.undo(); //找不到就回退下一个。
|
|
|
this.dispatchEvent('undo');
|
|
|
- console.log(this.sid, 'undo', this.undoList.length);
|
|
|
+ //console.log(this.sid, 'undo', this.undoList.length )
|
|
|
}
|
|
|
}
|
|
|
redo() {
|
|
|
@@ -46301,10 +46310,13 @@
|
|
|
afterChange(o) {
|
|
|
//变化结束,从beforeChange到此算一次操作。
|
|
|
if (this.dataBefore) {
|
|
|
- this.writeIn({
|
|
|
- before: this.dataBefore,
|
|
|
- after: this.getData(o)
|
|
|
- }); //写入某物体变化前和变化后的状态
|
|
|
+ var after = this.getData(o);
|
|
|
+ if (!Potree.Common.ifSame(this.dataBefore, after)) {
|
|
|
+ this.writeIn({
|
|
|
+ before: this.dataBefore,
|
|
|
+ after
|
|
|
+ }); //写入某物体变化前和变化后的状态
|
|
|
+ }
|
|
|
this.dataBefore = null;
|
|
|
}
|
|
|
}
|
|
|
@@ -46611,14 +46623,15 @@
|
|
|
data.measure.initData(data);
|
|
|
data.measure.isNew = data.isNew;
|
|
|
|
|
|
- //console.log('changeByHistory points', data.points.length)
|
|
|
- data.measure.dispatchEvent('changeByHistory');
|
|
|
-
|
|
|
/* if(data.measure.isPrism){
|
|
|
data.measure.needsCompute = data.needsCompute
|
|
|
} */
|
|
|
data.measure.facePlane = data.facePlane && data.facePlane.clone();
|
|
|
data.measure.cannotConfirmNormal = data.cannotConfirmNormal;
|
|
|
+ data.measure.dispatchEvent({
|
|
|
+ type: 'changeByHistory',
|
|
|
+ data
|
|
|
+ });
|
|
|
return true;
|
|
|
}
|
|
|
},
|
|
|
@@ -46634,6 +46647,10 @@
|
|
|
facePlane: measure.facePlane && measure.facePlane.clone(),
|
|
|
cannotConfirmNormal: measure.cannotConfirmNormal
|
|
|
};
|
|
|
+ measure.dispatchEvent({
|
|
|
+ type: 'historyGetData',
|
|
|
+ data
|
|
|
+ });
|
|
|
/* if(measure.isPrism){ //没用
|
|
|
data.volumeInfo = measure.volumeInfo
|
|
|
data.needsCompute = measure.needsCompute
|