|
@@ -24803,54 +24803,68 @@
|
|
|
//设置下默认经纬度位置,当点击恢复默认时要恢复到此位置
|
|
|
|
|
|
if (!model.isPointcloud) {
|
|
|
- var _prop$raw, _prop$raw2;
|
|
|
+ var _prop$raw;
|
|
|
//有经纬度 3dtiles
|
|
|
prop.baseRotation && model.rotation.copy(prop.baseRotation); //有的需要翻转90度
|
|
|
- var lonlat = ((_prop$raw = prop.raw) === null || _prop$raw === void 0 ? void 0 : _prop$raw.wgs84) || ((_prop$raw2 = prop.raw) === null || _prop$raw2 === void 0 ? void 0 : _prop$raw2.rtkLocation); //前者为素材库的osgb的
|
|
|
- if (lonlat) {
|
|
|
- var locationLonLat = lonlat.split(',').map(e => parseFloat(e));
|
|
|
- var location = new Vector3().fromArray(viewer.transform.lonlatToLocal.forward(locationLonLat));
|
|
|
+
|
|
|
+ if ((_prop$raw = prop.raw) !== null && _prop$raw !== void 0 && _prop$raw.convertType) {
|
|
|
+ //带坐标的osgb,原本给cesium用的,把在球面的转为平面的坐标
|
|
|
+
|
|
|
+ var center = new Vector3().fromArray(model.runtime.getTileset().tileset.root.transform.slice(12, 15));
|
|
|
+ var pos = math.fromCes(center);
|
|
|
+ model.position.copy(pos);
|
|
|
+ //viewer.modules.MergeEditor.moveBoundCenterTo( model, new THREE.Vector3().fromArray(pos) )
|
|
|
+ //因为bound中心在原点所以上面两句都可以
|
|
|
+
|
|
|
model.hasLonLat = true;
|
|
|
- if (model.fileType == '3dTiles' && prop.is4dkkModel) {
|
|
|
- //深时深光mesh
|
|
|
- model.position.fromArray(model.runtime.getTileset().tileset.root.boundingVolume.box.slice(0, 3)); //必须要平移一段才能重合
|
|
|
- model.position.copy(Potree.math.convertVector.ZupToYup(model.position));
|
|
|
-
|
|
|
- //绕原点旋转 类似Alignment.setMatrix 和点云一样处理
|
|
|
- if (prop.raw.orientation) {
|
|
|
- model.updateMatrixWorld(); //此时和点云没有旋转平移时一样。
|
|
|
- var rotMatrix = new Matrix4().makeRotationAxis(new Vector3(0, 0, 1), parseFloat(prop.raw.orientation));
|
|
|
- var pos2Matrix = new Matrix4().setPosition(location); //最后是平移
|
|
|
- var matrix = new Matrix4().multiplyMatrices(pos2Matrix, rotMatrix);
|
|
|
- model.matrix.premultiply(matrix);
|
|
|
- model.matrix.decompose(model.position, model.quaternion, model.scale);
|
|
|
+ } else {
|
|
|
+ var _prop$raw2;
|
|
|
+ var lonlat = /* prop.raw?.wgs84 || */(_prop$raw2 = prop.raw) === null || _prop$raw2 === void 0 ? void 0 : _prop$raw2.rtkLocation; //前者为素材库的osgb的
|
|
|
+ if (lonlat) {
|
|
|
+ var locationLonLat = lonlat.split(',').map(e => parseFloat(e));
|
|
|
+ var location = new Vector3().fromArray(viewer.transform.lonlatToLocal.forward(locationLonLat));
|
|
|
+ model.hasLonLat = true;
|
|
|
+ if (model.fileType == '3dTiles' && prop.is4dkkModel) {
|
|
|
+ //深时深光mesh
|
|
|
+ model.position.fromArray(model.runtime.getTileset().tileset.root.boundingVolume.box.slice(0, 3)); //必须要平移一段才能重合
|
|
|
+ model.position.copy(Potree.math.convertVector.ZupToYup(model.position));
|
|
|
+
|
|
|
+ //绕原点旋转 类似Alignment.setMatrix 和点云一样处理
|
|
|
+ if (prop.raw.orientation) {
|
|
|
+ model.updateMatrixWorld(); //此时和点云没有旋转平移时一样。
|
|
|
+ var rotMatrix = new Matrix4().makeRotationAxis(new Vector3(0, 0, 1), parseFloat(prop.raw.orientation));
|
|
|
+ var pos2Matrix = new Matrix4().setPosition(location); //最后是平移
|
|
|
+ var matrix = new Matrix4().multiplyMatrices(pos2Matrix, rotMatrix);
|
|
|
+ model.matrix.premultiply(matrix);
|
|
|
+ model.matrix.decompose(model.position, model.quaternion, model.scale);
|
|
|
+ } else {
|
|
|
+ model.position.add(location);
|
|
|
+ }
|
|
|
} else {
|
|
|
- model.position.add(location);
|
|
|
- }
|
|
|
- } else {
|
|
|
- var _prop$raw3;
|
|
|
- MergeEditor.moveBoundCenterTo(model, location);
|
|
|
- if ((_prop$raw3 = prop.raw) !== null && _prop$raw3 !== void 0 && _prop$raw3.orientation) {
|
|
|
- model.rotation.y = parseFloat(prop.raw.orientation);
|
|
|
- }
|
|
|
- if (prop.is4dkkModel) {
|
|
|
- console.warn('遇到is4dkkModel的且有经纬度的mesh,但不是3dtiles!看看位置准不准', model);
|
|
|
- //4dkk应该是可以对的上的。但如果是3dtiles非4dkk的,目前没办法对准,cesium是可以
|
|
|
-
|
|
|
- //看见的场景说是市场不会带rtk的。所以我们这边标品也没存rtk的坐标信息。和产品聊了,不处理。意思就是,只有激光场景开启了rtk的rtkLocation才有值
|
|
|
- /* if(model.panos?.length){//只能通过漫游点经纬度来校准
|
|
|
- //但这时候panos还没加载。。。。
|
|
|
- let sceneCode = ...从url中解析
|
|
|
- Potree.loadDatasets((data)=>{ //获取datasetId
|
|
|
- let originDataset = data.find(e=>e.sceneCode == sceneCode);//只加载初始数据集
|
|
|
- Potree.loadPanos(originDataset.datasetId,()=>{
|
|
|
- shouldPos = 获取坐标 data[0].location经纬度
|
|
|
- model.position.add(new THREE.Vector3().subVectors(shouldPos, model.panos[0].position))
|
|
|
- })
|
|
|
- }, sceneCode, (e)=>{
|
|
|
- console.log(e)
|
|
|
- } , prop.prefix)
|
|
|
- } */
|
|
|
+ var _prop$raw3;
|
|
|
+ MergeEditor.moveBoundCenterTo(model, location);
|
|
|
+ if ((_prop$raw3 = prop.raw) !== null && _prop$raw3 !== void 0 && _prop$raw3.orientation) {
|
|
|
+ model.rotation.y = parseFloat(prop.raw.orientation);
|
|
|
+ }
|
|
|
+ if (prop.is4dkkModel) {
|
|
|
+ console.warn('遇到is4dkkModel的且有经纬度的mesh,但不是3dtiles!看看位置准不准', model);
|
|
|
+ //4dkk应该是可以对的上的。但如果是3dtiles非4dkk的,目前没办法对准,cesium是可以
|
|
|
+
|
|
|
+ //看见的场景说是市场不会带rtk的。所以我们这边标品也没存rtk的坐标信息。和产品聊了,不处理。意思就是,只有激光场景开启了rtk的rtkLocation才有值
|
|
|
+ /* if(model.panos?.length){//只能通过漫游点经纬度来校准
|
|
|
+ //但这时候panos还没加载。。。。
|
|
|
+ let sceneCode = ...从url中解析
|
|
|
+ Potree.loadDatasets((data)=>{ //获取datasetId
|
|
|
+ let originDataset = data.find(e=>e.sceneCode == sceneCode);//只加载初始数据集
|
|
|
+ Potree.loadPanos(originDataset.datasetId,()=>{
|
|
|
+ shouldPos = 获取坐标 data[0].location经纬度
|
|
|
+ model.position.add(new THREE.Vector3().subVectors(shouldPos, model.panos[0].position))
|
|
|
+ })
|
|
|
+ }, sceneCode, (e)=>{
|
|
|
+ console.log(e)
|
|
|
+ } , prop.prefix)
|
|
|
+ } */
|
|
|
+ }
|
|
|
}
|
|
|
}
|
|
|
}
|
|
@@ -26024,6 +26038,7 @@
|
|
|
removeMap(t) {
|
|
|
var e = this.maps.indexOf(t);
|
|
|
if (e >= 0) {
|
|
|
+ t.cacheAutoClear('all');
|
|
|
t.removeFromSceneGroup(this.sceneGroup);
|
|
|
this.maps.splice(e, 1);
|
|
|
}
|
|
@@ -26098,11 +26113,11 @@
|
|
|
this.cache = []; //缓存。要删除的tile不立刻dispose,以便迅速再显示。每次都从第一个删除。
|
|
|
this.maxTotalCount = maxTotalCount;
|
|
|
}
|
|
|
- cacheAutoClear() {
|
|
|
+ cacheAutoClear(type) {
|
|
|
//清除超出数量的缓存 add
|
|
|
var len = this.cache.length,
|
|
|
cacheCopy = this.cache.slice();
|
|
|
- var overCount = this.objectGroup.children.length + len - this.maxTotalCount;
|
|
|
+ var overCount = this.objectGroup.children.length + len - (type == 'all' ? 0 : this.maxTotalCount);
|
|
|
if (overCount > 0) {
|
|
|
var i = 0,
|
|
|
delCount = Math.min(len, overCount);
|
|
@@ -26736,6 +26751,7 @@
|
|
|
this.style = style;
|
|
|
this.setEnable(false);
|
|
|
this.setEnable(true);
|
|
|
+ this.cacheAutoClear('all');
|
|
|
viewer.dispatchEvent('content_changed');
|
|
|
}
|
|
|
}
|
|
@@ -62056,7 +62072,8 @@
|
|
|
transparent: true,
|
|
|
opacity: 0.1,
|
|
|
side: DoubleSide,
|
|
|
- depthTest: false
|
|
|
+ depthTest: false,
|
|
|
+ visible: !!data.showScope
|
|
|
});
|
|
|
|
|
|
// 监控视频材质
|
|
@@ -62065,7 +62082,6 @@
|
|
|
side: DoubleSide,
|
|
|
depthTest: false,
|
|
|
transparent: true
|
|
|
- // opacity: 0.5,
|
|
|
});
|
|
|
// 摄像头
|
|
|
if (!cameraModel) {
|
|
@@ -62218,9 +62234,10 @@
|
|
|
position: camera.position.clone(),
|
|
|
quaternion: camera.quaternion.clone()
|
|
|
};
|
|
|
- this.showVideo(true);
|
|
|
+ this.data.showScope && this.showVideo(true);
|
|
|
this.video.pause(); //先显示出画面
|
|
|
setTimeout(() => {
|
|
|
+ this.data.showScope || this.showVideo(true);
|
|
|
viewer.mainViewport.cameraLayers = ['monitor']; //hide others
|
|
|
viewer.scene.monitors.forEach(e => Potree.Utils.updateVisible(e, 'watch', e == this));
|
|
|
}, 800);
|
|
@@ -62251,6 +62268,7 @@
|
|
|
viewer.mainViewport.view.cancelFlying();
|
|
|
viewer.mainViewport.cameraLayers = null;
|
|
|
viewer.scene.monitors.forEach(e => Potree.Utils.updateVisible(e, 'watch', true));
|
|
|
+ this.data.showScope || this.showVideo(false);
|
|
|
this.video.pause();
|
|
|
viewer.mainViewport.view.setView({
|
|
|
position: this.oldState.position,
|
|
@@ -62261,7 +62279,7 @@
|
|
|
},
|
|
|
callback: () => {
|
|
|
viewer.renderArea.style['pointer-events'] = '';
|
|
|
- this.showVideo(false);
|
|
|
+ this.data.showScope && this.showVideo(false);
|
|
|
viewer.mainViewport.view.setRotMode('standard');
|
|
|
},
|
|
|
duration: 1000
|
|
@@ -62355,46 +62373,48 @@
|
|
|
}
|
|
|
}
|
|
|
updateMesh() {
|
|
|
- console.log('updateMesh');
|
|
|
var nearHeight, nearWidth, farHeight, farWidth;
|
|
|
nearHeight = Math.tan(MathUtils.degToRad(this.fov / 2)) * this.cylinderNear;
|
|
|
nearWidth = nearHeight * this.aspect; //根据canvas比例调整视频面的比例,保持和canvas一致。
|
|
|
farHeight = Math.tan(MathUtils.degToRad(this.fov / 2)) * this.cylinderFar;
|
|
|
farWidth = farHeight * this.aspect;
|
|
|
-
|
|
|
- // 投射体(底面以外)
|
|
|
- var vertices = [],
|
|
|
- bottomVertices = [];
|
|
|
- vertices.push(-nearWidth, nearHeight, -this.cylinderNear);
|
|
|
- vertices.push(nearWidth, nearHeight, -this.cylinderNear);
|
|
|
- vertices.push(nearWidth, -nearHeight, -this.cylinderNear);
|
|
|
- vertices.push(-nearWidth, -nearHeight, -this.cylinderNear);
|
|
|
- bottomVertices.push(-farWidth, farHeight, -this.cylinderFar);
|
|
|
- bottomVertices.push(farWidth, farHeight, -this.cylinderFar);
|
|
|
- bottomVertices.push(farWidth, -farHeight, -this.cylinderFar);
|
|
|
- bottomVertices.push(-farWidth, -farHeight, -this.cylinderFar);
|
|
|
- vertices = vertices.concat(bottomVertices);
|
|
|
var firstBuild = !this.cylinder;
|
|
|
- if (firstBuild) {
|
|
|
- var uvs = [];
|
|
|
- uvs.push(0, 1, 1, 1, 1, 0, 0, 0);
|
|
|
- uvs.push(0, 1, 1, 1, 1, 0, 0, 0);
|
|
|
- var indexs = [];
|
|
|
- indexs.push(0, 1, 3, 2, 3, 1);
|
|
|
- indexs.push(0, 1, 4, 5, 4, 1);
|
|
|
- indexs.push(1, 2, 5, 6, 5, 2);
|
|
|
- indexs.push(2, 3, 6, 7, 6, 3);
|
|
|
- indexs.push(3, 0, 7, 4, 7, 0);
|
|
|
- // indexs.push(4, 7, 5, 6, 5, 7)
|
|
|
- var cylinderGeo = new BufferGeometry();
|
|
|
- cylinderGeo.setAttribute('uv', new BufferAttribute(new Float32Array(uvs), 2));
|
|
|
- cylinderGeo.setIndex(new BufferAttribute(new Uint16Array(indexs), 1));
|
|
|
- this.cylinder = new Mesh(cylinderGeo, this.normalMat);
|
|
|
- //if (this.control.player.$app.config.mobile) this.cylinder.rotateZ(-Math.PI / 2) //用户自己旋转屏幕吧
|
|
|
+ if (this.data.showScope) {
|
|
|
+ // 投射体(底面以外)
|
|
|
+ var vertices = [],
|
|
|
+ bottomVertices = [];
|
|
|
+ vertices.push(-nearWidth, nearHeight, -this.cylinderNear);
|
|
|
+ vertices.push(nearWidth, nearHeight, -this.cylinderNear);
|
|
|
+ vertices.push(nearWidth, -nearHeight, -this.cylinderNear);
|
|
|
+ vertices.push(-nearWidth, -nearHeight, -this.cylinderNear);
|
|
|
+ bottomVertices.push(-farWidth, farHeight, -this.cylinderFar);
|
|
|
+ bottomVertices.push(farWidth, farHeight, -this.cylinderFar);
|
|
|
+ bottomVertices.push(farWidth, -farHeight, -this.cylinderFar);
|
|
|
+ bottomVertices.push(-farWidth, -farHeight, -this.cylinderFar);
|
|
|
+ vertices = vertices.concat(bottomVertices);
|
|
|
+ if (firstBuild) {
|
|
|
+ var uvs = [];
|
|
|
+ uvs.push(0, 1, 1, 1, 1, 0, 0, 0);
|
|
|
+ uvs.push(0, 1, 1, 1, 1, 0, 0, 0);
|
|
|
+ var indexs = [];
|
|
|
+ indexs.push(0, 1, 3, 2, 3, 1);
|
|
|
+ indexs.push(0, 1, 4, 5, 4, 1);
|
|
|
+ indexs.push(1, 2, 5, 6, 5, 2);
|
|
|
+ indexs.push(2, 3, 6, 7, 6, 3);
|
|
|
+ indexs.push(3, 0, 7, 4, 7, 0);
|
|
|
+ // indexs.push(4, 7, 5, 6, 5, 7)
|
|
|
+ var cylinderGeo = new BufferGeometry();
|
|
|
+ cylinderGeo.setAttribute('uv', new BufferAttribute(new Float32Array(uvs), 2));
|
|
|
+ cylinderGeo.setIndex(new BufferAttribute(new Uint16Array(indexs), 1));
|
|
|
+ this.cylinder = new Mesh(cylinderGeo, this.normalMat);
|
|
|
+ //if (this.control.player.$app.config.mobile) this.cylinder.rotateZ(-Math.PI / 2) //用户自己旋转屏幕吧
|
|
|
+ this.obj3d.add(this.cylinder);
|
|
|
+ }
|
|
|
+ this.cylinder.geometry.setAttribute('position', new BufferAttribute(new Float32Array(vertices), 3));
|
|
|
+ } else if (!this.cylinder) {
|
|
|
+ this.cylinder = new Group();
|
|
|
this.obj3d.add(this.cylinder);
|
|
|
}
|
|
|
- this.cylinder.geometry.setAttribute('position', new BufferAttribute(new Float32Array(vertices), 3));
|
|
|
-
|
|
|
// 投射体底面 (视频)
|
|
|
var bottomGeo = new PlaneGeometry(farWidth * 2, farHeight * 2);
|
|
|
if (firstBuild) {
|
|
@@ -62405,18 +62425,19 @@
|
|
|
this.cylinder.bottom.geometry = bottomGeo;
|
|
|
}
|
|
|
this.cylinder.bottom.position.set(0, 0, this.cylinderNear - this.cylinderFar);
|
|
|
-
|
|
|
- // 投射体线框
|
|
|
- if (firstBuild) {
|
|
|
- this.cylinder.line = new LineSegments(new EdgesGeometry(this.cylinder.geometry), new LineBasicMaterial({
|
|
|
- color: 0xffffff,
|
|
|
- opacity: 0.6,
|
|
|
- transparent: true
|
|
|
- }));
|
|
|
- this.cylinder.add(this.cylinder.line);
|
|
|
- } else {
|
|
|
- this.cylinder.line.geometry.dispose();
|
|
|
- this.cylinder.line.geometry = new EdgesGeometry(this.cylinder.geometry);
|
|
|
+ if (this.data.showScope) {
|
|
|
+ // 投射体线框
|
|
|
+ if (firstBuild) {
|
|
|
+ this.cylinder.line = new LineSegments(new EdgesGeometry(this.cylinder.geometry), new LineBasicMaterial({
|
|
|
+ color: 0xffffff,
|
|
|
+ opacity: 0.6,
|
|
|
+ transparent: true
|
|
|
+ }));
|
|
|
+ this.cylinder.add(this.cylinder.line);
|
|
|
+ } else {
|
|
|
+ this.cylinder.line.geometry.dispose();
|
|
|
+ this.cylinder.line.geometry = new EdgesGeometry(this.cylinder.geometry);
|
|
|
+ }
|
|
|
}
|
|
|
}
|
|
|
set pitch(pitch) {
|
|
@@ -75525,7 +75546,7 @@
|
|
|
}
|
|
|
var object = ((_e$intersect = e.intersect) === null || _e$intersect === void 0 ? void 0 : _e$intersect.object) || ((_e$intersect2 = e.intersect) === null || _e$intersect2 === void 0 ? void 0 : _e$intersect2.pointcloud);
|
|
|
var objects = this.getAllObjects();
|
|
|
- if (!objects.includes(object) || Potree.settings.displayMode == 'showPanos' && object.is4dkkModel) object = null; //不是可选的
|
|
|
+ if (!objects.includes(object) || Potree.settings.displayMode == 'showPanos' && object.panos.length) object = null; //不是可选的
|
|
|
if (object) {
|
|
|
var posInModel = Potree.Utils.datasetPosTransform({
|
|
|
toDataset: true,
|