|
@@ -11,6 +11,8 @@ import "./potree.shim.js"
|
|
|
window.THREE = THREE
|
|
window.THREE = THREE
|
|
|
|
|
|
|
|
let baseZ = 0 //所以数据集高度都要减去这个值。在laser场景里该值为初始数据集的高程
|
|
let baseZ = 0 //所以数据集高度都要减去这个值。在laser场景里该值为初始数据集的高程
|
|
|
|
|
+Potree.datasetData = []
|
|
|
|
|
+
|
|
|
|
|
|
|
|
var transformPointcloud = (pointcloud, dataset)=>{
|
|
var transformPointcloud = (pointcloud, dataset)=>{
|
|
|
|
|
|
|
@@ -719,8 +721,132 @@ export function panoEditStart(dom, number, EditCloudsArgs){
|
|
|
EditCloudsArgs && Potree.loadPanosCloudStart(EditCloudsArgs)
|
|
EditCloudsArgs && Potree.loadPanosCloudStart(EditCloudsArgs)
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
+///////////////////////////////////////////////////////-------------------------
|
|
|
|
|
+///////////////////////////////////////////////////////-------------------------
|
|
|
|
|
+///////////////////////////////////////////////////////-------------------------
|
|
|
|
|
+export function realTimePanosStart(dom, number){//边拍边传,和点位编辑一样每个点位一个电源
|
|
|
|
|
+
|
|
|
|
|
+
|
|
|
|
|
+ Potree.settings.editType = 'singlePanoToCloud'
|
|
|
|
|
|
|
|
-
|
|
|
|
|
|
|
+ Potree.settings.isLocal = Potree.settings.tileOriginUrl = true;
|
|
|
|
|
+ Potree.settings.intersectOnObjs = true
|
|
|
|
|
+ Potree.settings.boundAddObjs = true
|
|
|
|
|
+ Potree.settings.UserPointDensity = 'high'//'middle'
|
|
|
|
|
+
|
|
|
|
|
+
|
|
|
|
|
+
|
|
|
|
|
+ let viewer = new Potree.Viewer(dom, null, {noMap:true});
|
|
|
|
|
+ let Alignment = viewer.modules.Alignment
|
|
|
|
|
+ viewer.setEDLEnabled(false);
|
|
|
|
|
+ viewer.setFOV(Potree.config.view.fov);
|
|
|
|
|
+
|
|
|
|
|
+ Potree.settings.urls.templates.panoTile = 'laser-data/testdata/{sceneCode}/data/preview/{id}/'
|
|
|
|
|
+ const rotQua = new THREE.Quaternion().setFromAxisAngle(new THREE.Vector3(1,0,0), -Math.PI / 2 )
|
|
|
|
|
+ //new THREE.Quaternion().setFromAxisAngle(new THREE.Vector3(0,0,1), -Math.PI )
|
|
|
|
|
+
|
|
|
|
|
+ viewer.scene.add360Images(viewer.images360);
|
|
|
|
|
+ const datasetId = 1
|
|
|
|
|
+
|
|
|
|
|
+
|
|
|
|
|
+ Potree.loadPanos = function(panoData, callback){
|
|
|
|
|
+
|
|
|
|
|
+ panoData = panoData.filter(e=> !viewer.images360.panos.some(p=>p.uuid == e.uuid))
|
|
|
|
|
+
|
|
|
|
|
+
|
|
|
|
|
+ let panoCount = panoData.length
|
|
|
|
|
+ let pointcloudLoaded = 0
|
|
|
|
|
+ if(!panoCount){
|
|
|
|
|
+ return callback()
|
|
|
|
|
+ }
|
|
|
|
|
+ panoData.forEach((d,index)=>{
|
|
|
|
|
+ let timeStamp = 0
|
|
|
|
|
+ let cloudPath = `laser-data/testdata/${number}/data/preview/${d.uuid}/webcloud/cloud.js`
|
|
|
|
|
+
|
|
|
|
|
+
|
|
|
|
|
+ //pano.index = index //注意:index不等于uuid,因为有的uuid缺失。但是visibles中存的是下标!
|
|
|
|
|
+
|
|
|
|
|
+ Potree.loadPointCloud(cloudPath, d.uuid , number, timeStamp, e => { //开始加载点云
|
|
|
|
|
+
|
|
|
|
|
+ let pointcloud = e.pointcloud;
|
|
|
|
|
+ let config = Potree.config.material
|
|
|
|
|
+ let material = pointcloud.material;
|
|
|
|
|
+ material.minSize = config.minSize
|
|
|
|
|
+ material.maxSize = config.maxSize
|
|
|
|
|
+ material.pointSizeType = /* 'ADAPTIVE'// */config.pointSizeType //Potree.PointSizeType[config.pointSizeType]//Potree.PointSizeType.ADAPTIVE;//FIXED
|
|
|
|
|
+ pointcloud.changePointSize( 0.1 /* config.realPointSize */ ) //material.size = config.pointSize;
|
|
|
|
|
+ pointcloud.changePointOpacity(1)
|
|
|
|
|
+ material.shape = Potree.PointShape.SQUARE;
|
|
|
|
|
+ pointcloud.color = config.pointColor
|
|
|
|
|
+ pointcloud.dataset_id = datasetId; //多个点云指向一个datasetId
|
|
|
|
|
+ pointcloud.panoUuid = d.uuid ///!!
|
|
|
|
|
+ pointcloud.timeStamp = timeStamp
|
|
|
|
|
+
|
|
|
|
|
+ /* if(datasetData){//非4dkk
|
|
|
|
|
+ pointcloud.datasetData = datasetData
|
|
|
|
|
+ pointcloud.hasDepthTex = Potree.settings.useDepthTex && !!datasetData.has_depth
|
|
|
|
|
+ } */
|
|
|
|
|
+
|
|
|
|
|
+ viewer.scene.addPointCloud(pointcloud);
|
|
|
|
|
+ pointcloudLoaded ++;
|
|
|
|
|
+
|
|
|
|
|
+ if(pointcloudLoaded == panoCount ){
|
|
|
|
|
+
|
|
|
|
|
+ let datas = panoData.map(p=>{
|
|
|
|
|
+ let newData = Object.assign(p,{
|
|
|
|
|
+ single:true
|
|
|
|
|
+ })
|
|
|
|
|
+ return newData
|
|
|
|
|
+ })
|
|
|
|
|
+ viewer.images360.addPanoData(datas )
|
|
|
|
|
+
|
|
|
|
|
+ panoData.forEach(ee => {
|
|
|
|
|
+ let pano = viewer.images360.panos.find(e=>e.uuid == ee.uuid)
|
|
|
|
|
+
|
|
|
|
|
+ let data = pano.panoData
|
|
|
|
|
+ let dataPosition = new THREE.Vector3().fromArray(data.pose3d.position)
|
|
|
|
|
+ let qua = data.pose3d.rotation
|
|
|
|
|
+ qua = [qua[1], qua[2], qua[3], qua[0]]
|
|
|
|
|
+
|
|
|
|
|
+ let dataQuaternion = new THREE.Quaternion().fromArray(qua)
|
|
|
|
|
+
|
|
|
|
|
+ pano.pointcloud.orientationUser = math.convertQuaternion.YupToZup(dataQuaternion)//new THREE.Quaternion().multiplyQuaternions(dataQuaternion, rotQua) //math.convertQuaternion.YupToZup(dataQuaternion) //new THREE.Quaternion().multiplyQuaternions(dataQuaternion,rotQua2)
|
|
|
|
|
+
|
|
|
|
|
+
|
|
|
|
|
+ console.log('dataQuaternion', new THREE.Euler().setFromQuaternion(pano.pointcloud.orientationUser))
|
|
|
|
|
+
|
|
|
|
|
+ pano.pointcloud.translateUser.copy(math.convertVector.YupToZup(dataPosition))
|
|
|
|
|
+ Alignment.setMatrix(pano.pointcloud);
|
|
|
|
|
+ })
|
|
|
|
|
+ viewer.images360.loadDone()
|
|
|
|
|
+
|
|
|
|
|
+
|
|
|
|
|
+ callback()
|
|
|
|
|
+
|
|
|
|
|
+ /*
|
|
|
|
|
+ let {boundSize, center} = viewer.bound
|
|
|
|
|
+
|
|
|
|
|
+ Potree.Log(`中心点: ${math.toPrecision(center.toArray(),2)}, boundSize: ${math.toPrecision(boundSize.toArray(),2)} ` )
|
|
|
|
|
+
|
|
|
|
|
+ viewer.scene.view.setView({
|
|
|
|
|
+ position: center.clone().add(new THREE.Vector3(10,5,10)),
|
|
|
|
|
+ target: center
|
|
|
|
|
+ }) */
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ })
|
|
|
|
|
+
|
|
|
|
|
+
|
|
|
|
|
+ })
|
|
|
|
|
+
|
|
|
|
|
+
|
|
|
|
|
+
|
|
|
|
|
+
|
|
|
|
|
+
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+}
|
|
|
|
|
+///////////////////////////////////////////////////////////////-----------------------
|
|
|
|
|
|
|
|
|
|
|
|
|
export function mergeEditStart(dom, mapDom){
|
|
export function mergeEditStart(dom, mapDom){
|