|
@@ -60743,7 +60743,7 @@ void main() {
|
|
|
let center = new Vector3().addVectors(p1,p2).multiplyScalar(0.5);
|
|
|
label.setPos(center);
|
|
|
distance = distance == void 0 ? p1.distanceTo(p2) : distance;
|
|
|
- var text = viewer.unitConvert.convert(distance, 'distance', void 0, this.unitSystem, 0.1 , true);//distance要传0.1 这个factor
|
|
|
+ var text = viewer.unitConvert.convert(distance, 'distance', 3, this.unitSystem, 0.1 , true);//distance要传0.1 这个factor
|
|
|
label.setText(text);
|
|
|
return distance
|
|
|
};
|
|
@@ -60806,7 +60806,7 @@ void main() {
|
|
|
this.areaLabel.setVisible(false)
|
|
|
}else{ */
|
|
|
let area = Math.abs(math.getArea(this.point2dInfo.points2d));//this.getArea();
|
|
|
- let msg = viewer.unitConvert.convert(area, 'area', void 0, this.unitSystem/* , 0.1 */ );
|
|
|
+ let msg = viewer.unitConvert.convert(area, 'area', 3, this.unitSystem/* , 0.1 */ );
|
|
|
this.area = {value:area, string:msg};
|
|
|
|
|
|
this.areaLabel.setPos(this.center);
|
|
@@ -62208,7 +62208,7 @@ void main() {
|
|
|
}
|
|
|
|
|
|
static getMousePointCloudIntersection (viewport, mouse, pointer, camera, viewer, pointclouds, pickParams = {} ) {
|
|
|
- if(!pointclouds)return
|
|
|
+ if(!pointclouds || pointclouds.length == 0)return
|
|
|
|
|
|
let renderer = viewer.renderer;
|
|
|
|
|
@@ -62320,8 +62320,9 @@ void main() {
|
|
|
location: closestIntersection,
|
|
|
distance: closestDistance,
|
|
|
pointcloud: selectedPointcloud,
|
|
|
- pointclouds: allPointclouds, //add
|
|
|
- point: closestPoint
|
|
|
+ point: closestPoint,
|
|
|
+ pointclouds: allPointclouds, //add
|
|
|
+ normal: new Vector3().fromArray(closestPoint.normal )//add
|
|
|
};
|
|
|
} else {
|
|
|
return null;
|
|
@@ -63597,7 +63598,7 @@ void main() {
|
|
|
|
|
|
|
|
|
|
|
|
- let loadPanosDone = Potree.loadPanosDone = (datasetId, panoData)=>{ //一个数据集获取到它的panos后
|
|
|
+ let loadPanosDone = Potree.loadPanosDone = (datasetId, panoData )=>{ //一个数据集获取到它的panos后
|
|
|
|
|
|
Potree.settings.datasetsPanos[datasetId] = {panoData, panos:[]};
|
|
|
|
|
@@ -69851,7 +69852,7 @@ void main() {
|
|
|
|
|
|
|
|
|
ifContainsPoint(pos){
|
|
|
- if(!this.bound.containsPoint(pos))return
|
|
|
+ if(!this.bound || !this.bound.containsPoint(pos))return
|
|
|
var points = this.getUnrotBoundPoint();
|
|
|
return math.isPointInArea(points, null, pos)
|
|
|
}
|
|
@@ -79052,7 +79053,7 @@ void main() {
|
|
|
});
|
|
|
|
|
|
pickSphere.addEventListener("click", e => {
|
|
|
- e.consume();
|
|
|
+ //e.consume();
|
|
|
});
|
|
|
|
|
|
pickSphere.addEventListener("mouseleave", e => {
|
|
@@ -79151,15 +79152,15 @@ void main() {
|
|
|
//pickSphere.addEventListener("drag", e => {});
|
|
|
|
|
|
pickSphere.addEventListener("mouseup", e => {
|
|
|
- e.consume();
|
|
|
+ //e.consume();
|
|
|
});
|
|
|
|
|
|
pickSphere.addEventListener("mousedown", e => {
|
|
|
- e.consume();
|
|
|
+ //e.consume();
|
|
|
});
|
|
|
|
|
|
pickSphere.addEventListener("click", e => {
|
|
|
- e.consume();
|
|
|
+ //e.consume();
|
|
|
|
|
|
let selected = this.selection[0];
|
|
|
let maxScale = Math.max(...selected.scale.toArray());
|
|
@@ -84029,11 +84030,11 @@ void main() {
|
|
|
}
|
|
|
}
|
|
|
|
|
|
- if(!pointclouds && e.buttons === Buttons.LEFT && viewport.alignment.rotateSide){
|
|
|
+ if(!pointclouds && e.buttons === Buttons.LEFT && viewport.rotateSide){
|
|
|
return PanoEditor.rotateSideCamera(-e.drag.pointerDelta.x)
|
|
|
}
|
|
|
}else if(Potree.settings.editType == 'merge'){
|
|
|
- if(e.buttons === Buttons.LEFT && viewport.alignment && viewport.alignment.rotateSide){
|
|
|
+ if(e.buttons === Buttons.LEFT && viewport.alignment && viewport.rotateSide){
|
|
|
return MergeEditor.rotateSideCamera(-e.drag.pointerDelta.x)
|
|
|
}
|
|
|
|
|
@@ -85311,13 +85312,17 @@ void main() {
|
|
|
|
|
|
}
|
|
|
|
|
|
+
|
|
|
+ let consumed = false;
|
|
|
+ let consume = () => { return consumed = true; };
|
|
|
let desc = this.getEventDesc(e,isTouch);
|
|
|
//if(!clickElement){
|
|
|
this.viewer.dispatchEvent($.extend(
|
|
|
desc,
|
|
|
{
|
|
|
type: 'global_click',
|
|
|
- pressDistance
|
|
|
+ pressDistance,
|
|
|
+ consume
|
|
|
}
|
|
|
));
|
|
|
//}
|
|
@@ -85328,7 +85333,7 @@ void main() {
|
|
|
this.needSingleClick = true;
|
|
|
|
|
|
|
|
|
- setTimeout(()=>{
|
|
|
+ consumed || setTimeout(()=>{
|
|
|
if(this.needSingleClick){
|
|
|
this.viewer.dispatchEvent($.extend(
|
|
|
desc,
|
|
@@ -85531,7 +85536,8 @@ void main() {
|
|
|
intersectOnModel = {//模拟点云的intersectPoint的结构写法
|
|
|
hoveredElement : intesects[0] ,
|
|
|
location: intesects[0].point,
|
|
|
- point: {normal: intesects[0].face.normal },
|
|
|
+ //point: {normal: intesects[0].face.normal },
|
|
|
+ normal: intesects[0].face.normal,
|
|
|
distance: intesects[0].distance,
|
|
|
object: intesects[0].object
|
|
|
};
|
|
@@ -85609,9 +85615,9 @@ void main() {
|
|
|
let intersect;
|
|
|
|
|
|
|
|
|
- if(e.onlyGetIntersect || Potree.settings.intersectWhenHover && (!this.drag || this.drag.object || viewport.alignment) ){ //没有拖拽物体,但按下鼠标了的话,不intersect
|
|
|
+ if(e.onlyGetIntersect || Potree.settings.intersectWhenHover && (!this.drag || this.drag.object || viewport.alignment ) ){ //没有拖拽物体,但按下鼠标了的话,不intersect
|
|
|
|
|
|
- let dontIntersect = this.drag && viewport.alignment && Potree.settings.editType == 'pano' || isFlying;/* viewer.images360.flying */ // flying 时可能卡顿
|
|
|
+ let dontIntersect = this.drag && viewport.alignment/* && Potree.settings.editType == 'pano' */|| isFlying;/* viewer.images360.flying */ // flying 时可能卡顿
|
|
|
//console.log('dontIntersectPointcloud',dontIntersectPointcloud)
|
|
|
intersect = this.getIntersect(viewport, e.onlyGetIntersect, e.pickWindowSize, dontIntersect, e.whichPointcloud); //数据集多的时候卡顿
|
|
|
//console.log('intersectPoint', intersectPoint)
|
|
@@ -87324,11 +87330,15 @@ void main() {
|
|
|
if(!this.pointcloud.hasDepthTex || this.depthTex || this.depthTexLoading)return
|
|
|
this.depthTexLoading = true;
|
|
|
let src = Potree.settings.number == 'SS-t-7DUfWAUZ3V' ? `${Potree.scriptPath}/data/${Potree.settings.number}/depthMap/${this.originID}.png`
|
|
|
- : `https://laser-oss.4dkankan.com/testdata/${Potree.settings.number}/data/${Potree.settings.number}/depthmap/${this.originID}.png`;
|
|
|
+ : `https://laser-oss.4dkankan.com/testdata/${this.pointcloud.sceneCode}/data/${this.pointcloud.sceneCode}/depthmap/${this.originID}.png`;
|
|
|
let texture = texLoader$2.load( src, ()=>{
|
|
|
this.depthTex = texture;
|
|
|
- this.images360.dispatchEvent({type:'loadedDepthImg', pano:this});
|
|
|
+ this.images360.dispatchEvent({type:'loadedDepthImg', pano:this, loaded:true});
|
|
|
this.depthTexLoading = false;
|
|
|
+ },(e)=>{//error
|
|
|
+ console.error('loadDepthImg失败, 数据集sceneCode'+ this.pointcloud.sceneCode, this.id );
|
|
|
+ this.pointcloud.hasDepthTex = false;
|
|
|
+ this.images360.dispatchEvent({type:'loadedDepthImg', pano:this, });
|
|
|
});
|
|
|
texture.wrapS = RepeatWrapping;
|
|
|
texture.flipY = false;
|
|
@@ -89296,6 +89306,10 @@ void main() {
|
|
|
|
|
|
|
|
|
getTiles(d, sceneNum){
|
|
|
+ if(Potree.settings.isLocal2){//新的地址 scene_view_data/场景码/images/tiles
|
|
|
+ return `${Potree.settings.urls.prefix3}/scene_view_data/${sceneNum}/images/${d}`
|
|
|
+ }
|
|
|
+
|
|
|
return `${Potree.settings.urls.prefix3}/images/images${sceneNum}/${d}`
|
|
|
}
|
|
|
|
|
@@ -91166,7 +91180,7 @@ void main() {
|
|
|
|
|
|
this.depthSampler = new DepthImageSampler();
|
|
|
this.addEventListener('loadedDepthImg',(e)=>{
|
|
|
- this.updateDepthTex(e.pano);
|
|
|
+ e.loaded && this.updateDepthTex(e.pano);
|
|
|
});
|
|
|
|
|
|
|
|
@@ -93166,7 +93180,7 @@ void main() {
|
|
|
|
|
|
|
|
|
isNeighbour(pano0, pano1){//是否之间没有遮挡(在加载visibles之前,自己算) 最好pano0是currentPano
|
|
|
-
|
|
|
+ if(!pano0 || !pano1)return
|
|
|
let map0 = this.neighbourMap[pano0.id];
|
|
|
if(!map0){
|
|
|
map0 = {};
|
|
@@ -93178,7 +93192,7 @@ void main() {
|
|
|
this.neighbourMap[pano1.id] = map1;
|
|
|
}
|
|
|
|
|
|
-
|
|
|
+
|
|
|
let ifNeighbour = map0[pano1.id];//map0.get(pano1)
|
|
|
|
|
|
if(ifNeighbour == void 0){
|
|
@@ -102984,10 +102998,10 @@ ENDSEC
|
|
|
|
|
|
this.build();
|
|
|
|
|
|
- this.spot.addEventListener('mouseover',()=>{
|
|
|
+ /* this.spot.addEventListener('mouseover',()=>{
|
|
|
|
|
|
- console.log('over');
|
|
|
- });
|
|
|
+
|
|
|
+ }) */
|
|
|
|
|
|
}
|
|
|
|
|
@@ -103105,7 +103119,7 @@ ENDSEC
|
|
|
|
|
|
|
|
|
startInsertion (args = {}, callback, cancelFun) {
|
|
|
-
|
|
|
+ let deferred = $.Deferred();
|
|
|
|
|
|
this.viewer.dispatchEvent({
|
|
|
type: 'start_inserting_tag'
|
|
@@ -103131,18 +103145,22 @@ ENDSEC
|
|
|
|
|
|
|
|
|
let tag = new Tag({
|
|
|
- title: '1', position: localPos, normal:e.intersect.point.normal,
|
|
|
+ title: '1', position: localPos, normal:e.intersect.normal,
|
|
|
root: e.intersect.pointcloud || e.intersect.object}
|
|
|
);
|
|
|
|
|
|
-
|
|
|
+ //pointcloud里加一个normal 的非float32
|
|
|
|
|
|
|
|
|
|
|
|
end();
|
|
|
+ e.consume && e.consume();
|
|
|
+ deferred.resolve(tag);
|
|
|
+ return {stopContinue:true}
|
|
|
+
|
|
|
};
|
|
|
- this.viewer.addEventListener('global_click', click);
|
|
|
-
|
|
|
+ this.viewer.addEventListener('global_click', click, 10);
|
|
|
+ return deferred.promise()
|
|
|
}
|
|
|
|
|
|
|
|
@@ -112335,14 +112353,14 @@ ENDSEC
|
|
|
viewportFitBound(viewport, bound, center, duration=0, margin){
|
|
|
let view = viewport.view;
|
|
|
let info = {bound};
|
|
|
- let {modelSize, modelCenter} = this.getModelBound(viewport);
|
|
|
+ let {boundSize, boundCenter} = this.getViewBound(viewport);
|
|
|
|
|
|
|
|
|
|
|
|
- viewport.targetPlane.setFromNormalAndCoplanarPoint( view.direction.clone(), modelCenter );
|
|
|
+ viewport.targetPlane.setFromNormalAndCoplanarPoint( view.direction.clone(), boundCenter );
|
|
|
viewport.targetPlane.projectPoint(center, viewport.shiftTarget); //target转换到过模型中心的平面,以保证镜头一定在模型外 this.shiftTarget是得到的
|
|
|
|
|
|
- info.endPosition = this.getPosOutOfModel(viewport, modelSize);
|
|
|
+ info.endPosition = this.getPosOutOfModel(viewport, boundSize);
|
|
|
|
|
|
//if(viewport.name == 'mapViewport')info.endPosition.z = Math.max(Potree.config.map.cameraHeight, info.endPosition.z)
|
|
|
|
|
@@ -112351,9 +112369,9 @@ ENDSEC
|
|
|
}
|
|
|
|
|
|
|
|
|
- getModelBound(viewport){
|
|
|
+ getViewBound(viewport){
|
|
|
let {boundSize, center} = viewer.bound;
|
|
|
- if(viewport.viewContainsPoints){//视野范围内必须要包含的点,直接算入模型区域
|
|
|
+ if(viewport.viewContainsPoints){//视野范围内必须要包含的点,直接算入模型区域。这时候得到的boundCenter和模型中心不重合
|
|
|
let boundingBox = viewer.bound.boundingBox.clone();
|
|
|
viewport.viewContainsPoints.forEach(point=>{
|
|
|
boundingBox.expandByPoint(point);
|
|
@@ -112361,14 +112379,15 @@ ENDSEC
|
|
|
boundSize = boundingBox.getSize(new Vector3);
|
|
|
center = boundingBox.getCenter(new Vector3);
|
|
|
}
|
|
|
- return {modelSize:boundSize, modelCenter:center}
|
|
|
+
|
|
|
+ return {boundSize, boundCenter:center }
|
|
|
}
|
|
|
|
|
|
getPosOutOfModel(viewport, boundSize){
|
|
|
//let {boundSize, center} = viewer.bound
|
|
|
- boundSize = boundSize || this.getModelBound(viewport).modelSize;
|
|
|
+ boundSize = boundSize || this.getViewBound(viewport).boundSize;
|
|
|
let expand = 10;
|
|
|
- let radius = boundSize.length() / 2;
|
|
|
+ let radius = boundSize.length(); // / 2
|
|
|
let position = viewport.shiftTarget.clone().sub(viewport.view.direction.clone().multiplyScalar(radius + expand));
|
|
|
|
|
|
return position
|
|
@@ -112377,11 +112396,11 @@ ENDSEC
|
|
|
updateCameraOutOfModel(){//因为移动模型导致模型超出相机外,所以更新位置
|
|
|
viewer.viewports.forEach((viewport, i )=>{
|
|
|
if(viewport != viewer.mainViewport){
|
|
|
- let {modelSize, modelCenter} = this.getModelBound(viewport);
|
|
|
- viewport.targetPlane.setFromNormalAndCoplanarPoint( viewport.view.direction.clone(), modelCenter);
|
|
|
+ let {boundSize, boundCenter} = this.getViewBound(viewport);
|
|
|
+ viewport.targetPlane.setFromNormalAndCoplanarPoint( viewport.view.direction.clone(), boundCenter);
|
|
|
viewport.targetPlane.projectPoint(viewport.view.position, viewport.shiftTarget); //target转换到过模型中心的平面,以保证镜头一定在模型外 this.shiftTarget是得到的
|
|
|
|
|
|
- let endPosition = this.getPosOutOfModel(viewport, modelSize);
|
|
|
+ let endPosition = this.getPosOutOfModel(viewport, boundSize);
|
|
|
//if(viewport.name == 'mapViewport')endPosition.z = Math.max(Potree.config.map.cameraHeight, endPosition.z)
|
|
|
viewport.view.position.copy(endPosition);
|
|
|
}
|
|
@@ -112391,11 +112410,13 @@ ENDSEC
|
|
|
rotateSideCamera(viewport, angle){//侧视图绕模型中心水平旋转
|
|
|
|
|
|
//let {boundSize, center} = viewer.bound
|
|
|
- let {modelSize, modelCenter} = this.getModelBound(viewport);
|
|
|
+ let {boundSize, boundCenter } = this.getViewBound(viewport);
|
|
|
+ let center = this.focusCenter || boundCenter; //旋转中心,一般是所有模型的中心,除非想指定中心点
|
|
|
+
|
|
|
//找到平移向量
|
|
|
- viewport.targetPlane.setFromNormalAndCoplanarPoint(viewport.view.direction , modelCenter );
|
|
|
+ viewport.targetPlane.setFromNormalAndCoplanarPoint(viewport.view.direction , center );
|
|
|
viewport.targetPlane.projectPoint(viewport.view.position, viewport.shiftTarget ); //target转换到过模型中心的平面,以保证镜头一定在模型外
|
|
|
- let vec = new Vector3().subVectors(modelCenter, viewport.shiftTarget);//相对于中心的偏移值,旋转后偏移值也旋转
|
|
|
+ let vec = new Vector3().subVectors(center, viewport.shiftTarget);//相对于中心的偏移值,旋转后偏移值也旋转
|
|
|
|
|
|
//旋转
|
|
|
var rotMatrix = new Matrix4().makeRotationAxis(new Vector3(0,0,1), angle);
|
|
@@ -112404,10 +112425,10 @@ ENDSEC
|
|
|
|
|
|
|
|
|
vec.applyMatrix4(rotMatrix);
|
|
|
- viewport.shiftTarget.subVectors(modelCenter,vec); //新的
|
|
|
+ viewport.shiftTarget.subVectors(center,vec); //新的
|
|
|
|
|
|
|
|
|
- viewport.view.position = this.getPosOutOfModel(viewport, modelSize);
|
|
|
+ viewport.view.position = this.getPosOutOfModel(viewport, boundSize);
|
|
|
|
|
|
}
|
|
|
|
|
@@ -112783,27 +112804,68 @@ ENDSEC
|
|
|
});
|
|
|
};
|
|
|
|
|
|
+ class History extends EventDispatcher{
|
|
|
+
|
|
|
+ constructor(o){
|
|
|
+ super();
|
|
|
+
|
|
|
+ this.list = [];
|
|
|
+
|
|
|
+ this.callback = o.callback;
|
|
|
+ }
|
|
|
+
|
|
|
+ undo(){
|
|
|
+ let last = this.list.pop();
|
|
|
+ last && this.callback && this.callback(last);
|
|
|
+
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ redo(){//暂时不写
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
+ writeIn(item){
|
|
|
+
|
|
|
+ this.list.push(item);
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ clear(){
|
|
|
+
|
|
|
+ this.list.length = 0;
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
var Alignment = {
|
|
|
SplitScreen: SplitScreen4Views,
|
|
|
handleState:null, //操作状态 'translate'|'rotate'
|
|
|
bus: new EventDispatcher(),
|
|
|
- history:[],
|
|
|
+
|
|
|
prepareRecord : true,
|
|
|
|
|
|
writeToHistory(content){
|
|
|
if(!this.prepareRecord)return;
|
|
|
this.prepareRecord = false;
|
|
|
- this.history.push(content);
|
|
|
+ this.history.writeIn(content);
|
|
|
},
|
|
|
|
|
|
|
|
|
- undo(){//撤销一步
|
|
|
+ /* undo(){//撤销一步
|
|
|
let last = this.history.pop();
|
|
|
last && last.forEach(item=>{
|
|
|
- this.applyTemp(item);
|
|
|
- });
|
|
|
+ this.applyTemp(item)
|
|
|
+ })
|
|
|
|
|
|
- },
|
|
|
+ }, */
|
|
|
|
|
|
applyTemp(item){
|
|
|
var pointcloud = viewer.scene.pointclouds.find(p=>p.dataset_id+p.name == item.sid);
|
|
@@ -112834,6 +112896,9 @@ ENDSEC
|
|
|
|
|
|
|
|
|
this.writeToHistory(this.getTemp(e.pointclouds) );
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
|
|
|
|
|
|
if(this.handleState == 'translate'){
|
|
@@ -112913,7 +112978,7 @@ ENDSEC
|
|
|
|
|
|
viewer.inputHandler.addEventListener('keydown',e=>{
|
|
|
if(e.keyCode == 90 && e.event.ctrlKey){//Z
|
|
|
- this.undo();
|
|
|
+ this.history.undo();
|
|
|
}
|
|
|
});
|
|
|
|
|
@@ -113082,7 +113147,7 @@ ENDSEC
|
|
|
viewer.updateVisible(pano.mapMarker, 'split4Screens', true);
|
|
|
});
|
|
|
this.editing = false;
|
|
|
- this.history.length = 0;
|
|
|
+ this.history.clear();
|
|
|
viewer.updateFpVisiDatasets();
|
|
|
|
|
|
}
|
|
@@ -113138,6 +113203,15 @@ ENDSEC
|
|
|
|
|
|
};
|
|
|
|
|
|
+
|
|
|
+ Alignment.history = new History({
|
|
|
+ callback: (data)=>{
|
|
|
+ data.forEach(item=>{
|
|
|
+ Alignment.applyTemp(item);
|
|
|
+ });
|
|
|
+ }
|
|
|
+ });
|
|
|
+
|
|
|
let texLoader$7 = new TextureLoader();
|
|
|
|
|
|
|
|
@@ -117304,6 +117378,7 @@ ENDSEC
|
|
|
if( viewer.scene.cameraAnimations.some(c=>c.onUpdate) //正在播放
|
|
|
|| e.drag && e.drag.notPressMouse //在加测量线
|
|
|
|| viewer.mainViewport.view.isFlying() //有其他校准
|
|
|
+ || this.split //分屏中
|
|
|
//e.clickElement && e.clickElement != e.intersect.object
|
|
|
){
|
|
|
return
|
|
@@ -117337,19 +117412,78 @@ ENDSEC
|
|
|
//Potree.settings.intersectWhenHover = false
|
|
|
//viewer.updateVisible(viewer.reticule, 'force', false)
|
|
|
|
|
|
- viewer.mainViewport.camera.near = 0.02;
|
|
|
+ viewer.mainViewport.camera.near = 0.05; // too small will result in z-fighting
|
|
|
+
|
|
|
+ viewer.addEventListener('updateModelBound', (e)=>{
|
|
|
+ if(this.split){
|
|
|
+ this.SplitScreen.updateCameraOutOfModel(/* this.selected && [this.selected] */);
|
|
|
+ }
|
|
|
+ });
|
|
|
|
|
|
|
|
|
+ {
|
|
|
+
|
|
|
+ let dragInfo;
|
|
|
+ let drag = (e)=>{
|
|
|
+ if(this.split && e.dragViewport.name == 'top' && this.selected){
|
|
|
+ if(this.transformState && e.intersect && e.intersect.object == this.selected ){
|
|
|
+
|
|
|
+ if(this.transformState == 'translate'){
|
|
|
+
|
|
|
+ let moveVec = Potree.Utils.getOrthoCameraMoveVec(e.drag.pointerDelta, e.dragViewport.camera );//最近一次移动向量
|
|
|
+ this.selected.position.add(moveVec);
|
|
|
+
|
|
|
+ this.selected.dispatchEvent("position_changed");
|
|
|
+ }else if(this.transformState == 'rotate'){
|
|
|
+
|
|
|
+ let vec = new Vector3().subVectors(e.intersect.orthoIntersect || e.intersect.location, this.selected.boundCenter).setZ(0);
|
|
|
+
|
|
|
+ if(dragInfo == void 0){
|
|
|
+ dragInfo = {
|
|
|
+ lastVec: vec
|
|
|
+ };
|
|
|
+ return
|
|
|
+ }
|
|
|
+
|
|
|
+ let angle = math.getAngle(dragInfo.lastVec, vec, 'z');
|
|
|
+ dragInfo.lastVec = vec;
|
|
|
+
|
|
|
+ this.selected.rotation.z += angle;
|
|
|
+ this.selected.dispatchEvent("rotation_changed");
|
|
|
+ }
|
|
|
+
|
|
|
+ return {stopContinue:true}
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ };
|
|
|
+
|
|
|
+ viewer.addEventListener('global_mousedown', drag);
|
|
|
+ viewer.addEventListener('global_drag', drag, 10);
|
|
|
+
|
|
|
+ viewer.addEventListener('global_drop', (e)=>{
|
|
|
+ dragInfo = null;
|
|
|
+
|
|
|
+ });
|
|
|
+
|
|
|
+ }
|
|
|
},
|
|
|
|
|
|
|
|
|
enterSplit(){
|
|
|
+ this.split = true;
|
|
|
+ if(this.selected) this.SplitScreen.focusCenter = this.selected.boundCenter; //旋转中心。注意 boundCenter不能直接赋值,否则改变后focusCenter也要改
|
|
|
+ else this.SplitScreen.focusCenter = null;
|
|
|
+
|
|
|
this.SplitScreen.splitStart(viewportProps$1);
|
|
|
viewer.setControls(viewer.fpControls);
|
|
|
- viewer.viewports.find(e=>e.name == 'right').alignment = {rotateSide : true};
|
|
|
+ viewer.viewports.find(e=>e.name == 'right').rotateSide = true;
|
|
|
+ viewer.viewports.find(e=>e.name == 'top').alignment = true;
|
|
|
+
|
|
|
},
|
|
|
|
|
|
leaveSplit(){
|
|
|
+ this.split = false;
|
|
|
this.SplitScreen.unSplit();
|
|
|
viewer.setControls(viewer.orbitControls);
|
|
|
},
|
|
@@ -117358,8 +117492,18 @@ ENDSEC
|
|
|
this.SplitScreen.rotateSideCamera(viewer.viewports.find(e=>e.name == 'right'), angle);
|
|
|
},
|
|
|
|
|
|
+ setTransformState(state){//校准时
|
|
|
+ this.transformState = state;
|
|
|
+ },
|
|
|
//---------------------------
|
|
|
|
|
|
+ /* writeToHistory(content){
|
|
|
+ if(!this.prepareRecord)return;
|
|
|
+ this.prepareRecord = false
|
|
|
+ this.history.push(content)
|
|
|
+ }, */
|
|
|
+
|
|
|
+ //---------------------------
|
|
|
|
|
|
getAllObjects(){
|
|
|
return viewer.objs.children.concat(viewer.scene.pointclouds)
|
|
@@ -117476,9 +117620,9 @@ ENDSEC
|
|
|
|
|
|
if(fitBound){
|
|
|
viewer.focusOnObject({boundingBox}, 'boundingBox', duration, {dontLookUp});
|
|
|
- }else {
|
|
|
+ }else {
|
|
|
let position = viewer.inputHandler.intersect ? viewer.inputHandler.intersect.location : boundingBox.getCenter(new Vector3);
|
|
|
- viewer.focusOnObject({position}, 'point', duration, {dontChangePos: true});
|
|
|
+ position && viewer.focusOnObject({position}, 'point', duration, {dontChangePos: true});
|
|
|
}
|
|
|
|
|
|
|
|
@@ -117518,7 +117662,7 @@ ENDSEC
|
|
|
model.position.y += diff.y;
|
|
|
/* model.updateMatrixWorld()
|
|
|
this.getBoundCenter(model)//再次更新,它需要和center1相同 */
|
|
|
- model.boundCenter = center1;
|
|
|
+ model.boundCenter.copy(center1);
|
|
|
},
|
|
|
|
|
|
moveBoundCenterTo(model,pos){ //使boundCenter在所要的位置
|
|
@@ -117527,7 +117671,8 @@ ENDSEC
|
|
|
},
|
|
|
|
|
|
getBoundCenter(model){
|
|
|
- model.boundCenter = model.boundingBox.getCenter(new Vector3).applyMatrix4(model.matrixWorld);
|
|
|
+ if(!model.boundCenter) model.boundCenter = new Vector3;
|
|
|
+ model.boundingBox.getCenter(model.boundCenter).applyMatrix4(model.matrixWorld);
|
|
|
}
|
|
|
|
|
|
};
|
|
@@ -118097,16 +118242,16 @@ ENDSEC
|
|
|
location.setZ(0);//低于相机高度即可
|
|
|
this.direction = normal.clone();
|
|
|
}else {
|
|
|
- if(intersect.point){
|
|
|
+ /* if(intersect.point){
|
|
|
if(intersect.pointcloud){
|
|
|
- normal = new Vector3().fromArray(intersect.point.normal ).applyMatrix4( intersect.pointcloud.rotateMatrix );
|
|
|
- }else {//mesh
|
|
|
- normal = new Vector3().copy(intersect.point.normal).applyQuaternion(intersect.object.quaternion);
|
|
|
+ normal = new THREE.Vector3().fromArray(intersect.point.normal ).applyMatrix4( intersect.pointcloud.rotateMatrix );
|
|
|
+ }else{//mesh
|
|
|
+ normal = new THREE.Vector3().copy(intersect.point.normal).applyQuaternion(intersect.object.quaternion)
|
|
|
}
|
|
|
- }else {
|
|
|
- normal = intersect.normal; //when showPanos
|
|
|
- }
|
|
|
-
|
|
|
+ }else{
|
|
|
+ normal = intersect.normal //when showPanos
|
|
|
+ } */
|
|
|
+ normal = intersect.normal;
|
|
|
if(normal){
|
|
|
let ratio = /* Potree.settings.useDepthTex ? 1 : */ 0.2;
|
|
|
this.direction = this.direction.multiplyScalar(1-ratio);
|
|
@@ -121397,6 +121542,9 @@ ENDSEC
|
|
|
if(name == 'top') viewer.mainViewport.alignment = {rotate:true,translate:true};
|
|
|
if(name == 'right'){
|
|
|
viewer.mainViewport.alignment = {translate:true, rotateSide:true};
|
|
|
+ viewer.mainViewport.rotateSide = true;
|
|
|
+ }else {
|
|
|
+ viewer.mainViewport.rotateSide = false;
|
|
|
}
|
|
|
viewer.fpControls.lockKey = true;
|
|
|
|
|
@@ -129056,10 +129204,10 @@ ENDSEC
|
|
|
position.copy(cameraPos);
|
|
|
}else {
|
|
|
dis = bestDistance;
|
|
|
- let dir = o.direction ? o.direction.clone().negate() : this.mainViewport.view.direction.negate();//new THREE.Vector3().subVectors(camera.position, target).normalize()
|
|
|
-
|
|
|
+ let dir = o.direction ? o.direction.clone().negate() : this.mainViewport.view.direction.negate();// */new THREE.Vector3().subVectors(camera.position, target).normalize()
|
|
|
+ if(o.dontLookUp && dir.z<0) dir.z *= -1;
|
|
|
position.copy(target).add(dir.multiplyScalar(dis));
|
|
|
- }
|
|
|
+ }
|
|
|
/* if(o.checkIntersect){//识别被点云遮住的话
|
|
|
let ifShelter
|
|
|
|