|
@@ -42073,7 +42073,8 @@
|
|
label: 4
|
|
label: 4
|
|
};
|
|
};
|
|
var arrowCountMax = 100; //箭头总数不能超过这个值。 The count value passed into the constructor represents the maximum number of instances of this mesh. You can change the number of instances at runtime to an integer value in the range [0, count].If you need more instances than the original count value, you have to create a new InstancedMesh.
|
|
var arrowCountMax = 100; //箭头总数不能超过这个值。 The count value passed into the constructor represents the maximum number of instances of this mesh. You can change the number of instances at runtime to an integer value in the range [0, count].If you need more instances than the original count value, you have to create a new InstancedMesh.
|
|
- var lastArrowSpace;
|
|
|
|
|
|
+ var lastArrowCamPos,
|
|
|
|
+ lastArrowCount = 0;
|
|
var depthProps = {
|
|
var depthProps = {
|
|
useDepth: true,
|
|
useDepth: true,
|
|
//startClipDis : 0.5,
|
|
//startClipDis : 0.5,
|
|
@@ -42732,7 +42733,11 @@
|
|
Potree.Utils.setObjectLayers(this.arrows, 'measure');
|
|
Potree.Utils.setObjectLayers(this.arrows, 'measure');
|
|
}
|
|
}
|
|
}
|
|
}
|
|
- this.arrows && Potree.Utils.updateVisible(this.arrows, 'show', show);
|
|
|
|
|
|
+ if (this.arrows) {
|
|
|
|
+ Potree.Utils.updateVisible(this.arrows, 'show', show);
|
|
|
|
+ show && Path$1.waitUpdateArrows();
|
|
|
|
+ }
|
|
|
|
+ viewer.dispatchEvent('content_changed');
|
|
}
|
|
}
|
|
hideArrowUntilUpdate() {
|
|
hideArrowUntilUpdate() {
|
|
this.arrows && Potree.Utils.updateVisible(this.arrows, 'changing', false);
|
|
this.arrows && Potree.Utils.updateVisible(this.arrows, 'changing', false);
|
|
@@ -42746,6 +42751,8 @@
|
|
}, 300); //为了防止不停点击不停更新,所以隐藏一下不变了再更新
|
|
}, 300); //为了防止不停点击不停更新,所以隐藏一下不变了再更新
|
|
}
|
|
}
|
|
static updateArrows(force) {
|
|
static updateArrows(force) {
|
|
|
|
+ var far = math.linearClamp(Potree.fpsRendered2, [10, 60], [80, 180]); //几乎看不见了
|
|
|
|
+
|
|
var paths = viewer.scene.measurements.filter(e => {
|
|
var paths = viewer.scene.measurements.filter(e => {
|
|
var _e$arrows;
|
|
var _e$arrows;
|
|
return e instanceof Path$1 && ((_e$arrows = e.arrows) === null || _e$arrows === void 0 ? void 0 : _e$arrows.visible);
|
|
return e instanceof Path$1 && ((_e$arrows = e.arrows) === null || _e$arrows === void 0 ? void 0 : _e$arrows.visible);
|
|
@@ -42757,6 +42764,9 @@
|
|
var lines = [];
|
|
var lines = [];
|
|
paths.forEach(path => {
|
|
paths.forEach(path => {
|
|
var len = path.points.length;
|
|
var len = path.points.length;
|
|
|
|
+ var far_ = path.halfPathWidth * far;
|
|
|
|
+ far_ = path.fadeFar ? Math.min(far_, path.fadeFar * 1.2) : far_;
|
|
|
|
+ var farSquared_ = far_ * far_;
|
|
for (var i = 0; i < len - 1; i++) {
|
|
for (var i = 0; i < len - 1; i++) {
|
|
var thisPoint = path.points[i];
|
|
var thisPoint = path.points[i];
|
|
var nextPoint = path.points[i + 1];
|
|
var nextPoint = path.points[i + 1];
|
|
@@ -42764,6 +42774,7 @@
|
|
var closetPoint = line.closestPointToPoint(viewer.mainViewport.view.position, true, new Vector3()); //过相机到line的垂足,限制在线段内
|
|
var closetPoint = line.closestPointToPoint(viewer.mainViewport.view.position, true, new Vector3()); //过相机到line的垂足,限制在线段内
|
|
|
|
|
|
var disSq = closetPoint.distanceToSquared(viewer.mainViewport.view.position);
|
|
var disSq = closetPoint.distanceToSquared(viewer.mainViewport.view.position);
|
|
|
|
+ if (disSq > farSquared_ && lastArrowCount > 0) continue;
|
|
minDisSq = Math.min(minDisSq, disSq);
|
|
minDisSq = Math.min(minDisSq, disSq);
|
|
lines.push({
|
|
lines.push({
|
|
line,
|
|
line,
|
|
@@ -42772,18 +42783,16 @@
|
|
});
|
|
});
|
|
}
|
|
}
|
|
});
|
|
});
|
|
- var spaceDis = MathUtils.clamp(math.toPrecision(Math.pow(minDisSq, 0.1) * 4, 1), 5, 8); //箭头之间的间距
|
|
|
|
-
|
|
|
|
- if (isNaN(spaceDis)) {
|
|
|
|
- console.log(1);
|
|
|
|
- }
|
|
|
|
- if (lastArrowSpace == spaceDis && !force) return;
|
|
|
|
- lastArrowSpace = spaceDis;
|
|
|
|
|
|
+ var spaceDis = MathUtils.clamp(math.toPrecision(Math.pow(minDisSq, 0.1) * 5, 1), 5, 8); //箭头之间的间距,适当调节稀疏
|
|
|
|
+ spaceDis *= math.linearClamp(Potree.fpsRendered2, [10, 60], [3, 1]);
|
|
|
|
+ if ((lastArrowCamPos && math.closeTo(lastArrowCamPos, viewer.mainViewport.view.position, 2) || lines.length == 0) && !force) return; //很远的时候lines空的不更新(不清空)
|
|
|
|
+ lastArrowCamPos = viewer.mainViewport.view.position.clone();
|
|
viewer.scene.measurements.forEach(e => e instanceof Path$1 && e.arrows && (e.arrows.count = 0)); //归零
|
|
viewer.scene.measurements.forEach(e => e instanceof Path$1 && e.arrows && (e.arrows.count = 0)); //归零
|
|
|
|
|
|
lines.sort((a, b) => {
|
|
lines.sort((a, b) => {
|
|
return a.disSq - b.disSq;
|
|
return a.disSq - b.disSq;
|
|
- });
|
|
|
|
|
|
+ }); //尽快收集好就近的,使后加的都比waitAdd最后一个大,减少比较
|
|
|
|
+
|
|
lines.forEach(info => {
|
|
lines.forEach(info => {
|
|
if (waitAdd[arrowCountMax - 1] && info.disSq > waitAdd[arrowCountMax - 1].disSq) return; //线段最近点已经超过当前list中最远的那个
|
|
if (waitAdd[arrowCountMax - 1] && info.disSq > waitAdd[arrowCountMax - 1].disSq) return; //线段最近点已经超过当前list中最远的那个
|
|
|
|
|
|
@@ -42841,99 +42850,9 @@
|
|
e.lineInfo.path.arrows.setMatrixAt(e.lineInfo.path.arrows.count - 1, matrix);
|
|
e.lineInfo.path.arrows.setMatrixAt(e.lineInfo.path.arrows.count - 1, matrix);
|
|
e.lineInfo.path.arrows.instanceMatrix.needsUpdate = true;
|
|
e.lineInfo.path.arrows.instanceMatrix.needsUpdate = true;
|
|
});
|
|
});
|
|
|
|
+ lastArrowCount = waitAdd.length;
|
|
console.log('updateArrows spaceDis', spaceDis, 'count', waitAdd.length, 'cost', performance.now() - startTime);
|
|
console.log('updateArrows spaceDis', spaceDis, 'count', waitAdd.length, 'cost', performance.now() - startTime);
|
|
}
|
|
}
|
|
-
|
|
|
|
- /* static updateArrows(){
|
|
|
|
- let far = this.fadeFar ? Math.min(this.fadeFar, 1000) : 1000
|
|
|
|
- let farSquared = far * far
|
|
|
|
- let len = this.points.length
|
|
|
|
-
|
|
|
|
- let waitAdd = []
|
|
|
|
-
|
|
|
|
- for(let i=0, i<len-1; i++){
|
|
|
|
- let thisPoint = this.points[i];
|
|
|
|
- let nextPoint = this.points[i+1]
|
|
|
|
- let line = new THREE.Line3(thisPoint, nextPoint)
|
|
|
|
-
|
|
|
|
- //let at = line.closestPointToPointParameter(viewer.mainViewport.position, true)
|
|
|
|
- let closetPoint = line.closestPointToPoint( viewer.mainViewport.position, true, new THREE.Vector3() )
|
|
|
|
- //let closetPoint = line.delta( new THREE.Vector3() ).multiplyScalar( at ).add( line.start );
|
|
|
|
- let disSq = closetPoint.distanceToSquared(viewer.mainViewport.position)
|
|
|
|
-
|
|
|
|
- if(disSq < farSquared){
|
|
|
|
- let space = Math.sqrt(disSq) * 0.5
|
|
|
|
-
|
|
|
|
- let lineDir = new THREE.Vector3().subVectors(nextPoint,thisPoint).normalize()
|
|
|
|
- let lineLen = nextPoint.distanceTo(thisPoint)
|
|
|
|
- if(lineLen< space*2 ){
|
|
|
|
- let mid = new THREE.Vector3().addVectors(nextPoint,thisPoint).multiplyScalar(0.5)
|
|
|
|
- waitAdd.push({point:mid, line})
|
|
|
|
- }else{
|
|
|
|
- let dis =
|
|
|
|
- thisPoint
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
- waitAdd
|
|
|
|
-
|
|
|
|
-
|
|
|
|
-
|
|
|
|
-
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
- } */
|
|
|
|
-
|
|
|
|
- /* static updateArrows(){
|
|
|
|
- let far = this.fadeFar ? Math.min(this.fadeFar, 1000) : 1000
|
|
|
|
- let farSquared = far * far
|
|
|
|
- let len = this.points.length
|
|
|
|
- for(let i=0, i<len-1; i++){
|
|
|
|
- let thisPoint = this.points[i];
|
|
|
|
- let nextPoint = this.points[i+1]
|
|
|
|
- let line = new THREE.Line3(thisPoint, nextPoint)
|
|
|
|
-
|
|
|
|
- let at = line.closestPointToPointParameter(viewer.mainViewport.position, true)
|
|
|
|
- //let closetPoint = line.closestPointToPoint( viewer.mainViewport.position, true, new THREE.Vector3() )
|
|
|
|
- let closetPoint = line.delta( new THREE.Vector3() ).multiplyScalar( at ).add( line.start );
|
|
|
|
- let disSq = closetPoint.distanceToSquared(viewer.mainViewport.position)
|
|
|
|
-
|
|
|
|
- if(disSq < farSquared){
|
|
|
|
-
|
|
|
|
- let lineDir = new THREE.Vector3().subVectors(nextPoint,thisPoint).normalize()
|
|
|
|
- let lineLen = nextPoint.distanceTo(thisPoint)
|
|
|
|
- let space = Math.sqrt(disSq) / 2
|
|
|
|
-
|
|
|
|
- addArrow(closetPoint, line)
|
|
|
|
-
|
|
|
|
- ;[-1, 1].forEach(axis=>{
|
|
|
|
- let atStart = at
|
|
|
|
- let space_ = axis*space
|
|
|
|
-
|
|
|
|
- let vec = lineDir.clone().multiplyScalar(space_)
|
|
|
|
- atStart += space_ / lineLen
|
|
|
|
-
|
|
|
|
- while(){
|
|
|
|
- if(atStart < -1 || atStart > 1){
|
|
|
|
- break
|
|
|
|
- }
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
- })
|
|
|
|
-
|
|
|
|
-
|
|
|
|
-
|
|
|
|
-
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
-
|
|
|
|
-
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
-
|
|
|
|
-
|
|
|
|
- } */
|
|
|
|
}
|
|
}
|
|
Path$1.prototype.cloneMarker = Measure$1.prototype.cloneMarker;
|
|
Path$1.prototype.cloneMarker = Measure$1.prototype.cloneMarker;
|
|
Path$1.prototype.updateDatasetBelong = Measure$1.prototype.updateDatasetBelong;
|
|
Path$1.prototype.updateDatasetBelong = Measure$1.prototype.updateDatasetBelong;
|
|
@@ -80869,7 +80788,7 @@
|
|
if (e.viewport == viewer.mainViewport && e.changeInfo.positionChanged) {
|
|
if (e.viewport == viewer.mainViewport && e.changeInfo.positionChanged) {
|
|
Common.intervalTool.isWaiting('updatePathArrows', () => {
|
|
Common.intervalTool.isWaiting('updatePathArrows', () => {
|
|
Potree.Path.updateArrows();
|
|
Potree.Path.updateArrows();
|
|
- }, 2000);
|
|
|
|
|
|
+ }, 1000);
|
|
}
|
|
}
|
|
});
|
|
});
|
|
}
|
|
}
|
|
@@ -87058,14 +86977,12 @@
|
|
seeMarkers: e.visibles, */
|
|
seeMarkers: e.visibles, */
|
|
}
|
|
}
|
|
async function loadImgVersion(callback) {
|
|
async function loadImgVersion(callback) {
|
|
|
|
+ if (Potree.settings.isLocal || !Potree.settings.isOfficial) {
|
|
|
|
+ //potree本地请求不到
|
|
|
|
+ return callback({});
|
|
|
|
+ }
|
|
var path;
|
|
var path;
|
|
- //let query = `?datasetId=${datasetId}` //`?lat=${center.lat}&lon=${center.lon}&radius=200000`
|
|
|
|
- /* if(Potree.fileServer){
|
|
|
|
- path = `/laser/filter/${Potree.settings.number}/query`
|
|
|
|
- }else{ */
|
|
|
|
path = "/laser/init/getSceneNumVersion/".concat(Potree.settings.number);
|
|
path = "/laser/init/getSceneNumVersion/".concat(Potree.settings.number);
|
|
- //api/laser/init
|
|
|
|
- //}
|
|
|
|
return loadFile(path, {
|
|
return loadFile(path, {
|
|
fetchMethod: 'post'
|
|
fetchMethod: 'post'
|
|
}, callback, callback);
|
|
}, callback, callback);
|