|
@@ -69,7 +69,6 @@ export const enter = ({ dom, mapDom, isLocal, lonlat, scenes, laserRoot, laserOS
|
|
|
Potree.settings.webSite = 'datav1'
|
|
|
}
|
|
|
if(window.offline){//离线版
|
|
|
-
|
|
|
Potree.settings.urls.templates = {
|
|
|
depthTex : 'swss/{sceneCode}/www/{sceneCode}/wwwroot/{sceneCode}/data/{sceneCode}/depthmap',
|
|
|
vision : '/swkk/{sceneCode}/wwwroot/scene_view_data/{sceneCode}/images/vision.txt'
|
|
@@ -136,7 +135,7 @@ export const enter = ({ dom, mapDom, isLocal, lonlat, scenes, laserRoot, laserOS
|
|
|
}
|
|
|
|
|
|
let { THREE } = Potree.mergeEditStart(dom, mapDom)
|
|
|
- let MergeEditor = viewer.modules.MergeEditor
|
|
|
+ let {MergeEditor, AnimationEditor} = viewer.modules
|
|
|
Potree.settings.unableNavigate = true
|
|
|
Potree.setLonlat(lonlat[0], lonlat[1])
|
|
|
|
|
@@ -176,13 +175,22 @@ export const enter = ({ dom, mapDom, isLocal, lonlat, scenes, laserRoot, laserOS
|
|
|
updateCamNear()
|
|
|
}, 1000)
|
|
|
updateCamFar()
|
|
|
+ if(e.changeInfo.positionChanged){
|
|
|
+ viewer.objs.children.forEach(model=>{
|
|
|
+ model.result_.updateVisiByRange && model.result_.updateVisiByRange()
|
|
|
+ })
|
|
|
+ }
|
|
|
}
|
|
|
if (e.viewport.name == 'MainView' || e.viewport.name == 'top' ) {
|
|
|
updateMap()
|
|
|
}
|
|
|
})
|
|
|
-
|
|
|
-
|
|
|
+ viewer.addEventListener('shelterComputed', (e)=>{
|
|
|
+ //console.log('shelterComputed')
|
|
|
+ var camera = viewer.mainViewport.camera
|
|
|
+ var pos = camera.position
|
|
|
+ sceneBus.emit('cameraChange', { x: pos.x, y: pos.y, z: pos.z, rotate: camera.rotation })
|
|
|
+ })
|
|
|
//-------------------------------------
|
|
|
let modelAinB = (A,B)=>{ //B的expand(5m) bound完全包含A
|
|
|
let boundB = B.boundingBox.clone().expandByVector(new THREE.Vector3(5,5,5)).applyMatrix4(B.matrixWorld)
|
|
@@ -459,7 +467,7 @@ export const enter = ({ dom, mapDom, isLocal, lonlat, scenes, laserRoot, laserOS
|
|
|
fly() {
|
|
|
if(measure.type == 'Path') Potree.settings.displayMode = 'showPointCloud'
|
|
|
|
|
|
- let result = viewer.focusOnObject(measure, 'measure', 1200, {dontLookUp:measure.type == 'Path'})
|
|
|
+ let result = viewer.focusOnObject(measure, 'measure', 1200, {dontLookUp:measure.type == 'Path', maxDis: measure.fadeFar && measure.fadeFar*1.5})
|
|
|
|
|
|
return result.msg ? result.msg : result.promise
|
|
|
//返回值 1 deferred 表示即将位移 2 'posNoChange' 表示已在最佳位置 3 'tooFar' 表示距离最佳位置太远
|
|
@@ -478,7 +486,7 @@ export const enter = ({ dom, mapDom, isLocal, lonlat, scenes, laserRoot, laserOS
|
|
|
|
|
|
|
|
|
|
|
|
- let sdk = {
|
|
|
+ let sdk = Potree.sdk = {
|
|
|
sceneBus, mapBus,
|
|
|
|
|
|
|
|
@@ -888,9 +896,9 @@ export const enter = ({ dom, mapDom, isLocal, lonlat, scenes, laserRoot, laserOS
|
|
|
let bus = props.bus = mitt()
|
|
|
//console.log('--addModel',props)
|
|
|
props.isFirstLoad = isLocal ? props.bottom == void 0 : (props.isDynamicAdded || props.mode == 'single') // 在编辑时用户添加的 或 展示单个模型 (props.mode='single'模型展示页, props.mode='many'融合页)
|
|
|
- if (props.opacity == void 0) props.opacity = 1
|
|
|
+ if (props.opacity == void 0) props.opacity = 100
|
|
|
//if (props.type == 'obj') props.type = 'glb'
|
|
|
- props.scale /= 100
|
|
|
+ props.scale && (props.scale /= 100)
|
|
|
|
|
|
let getBaseRotation = () => {
|
|
|
if(ModelTypes[props.fromType]?.rot90 && props.type != 'obj'){
|
|
@@ -966,7 +974,7 @@ export const enter = ({ dom, mapDom, isLocal, lonlat, scenes, laserRoot, laserOS
|
|
|
})
|
|
|
let lastState = {}
|
|
|
model.addEventListener('transformChanged', (e) => {
|
|
|
- let msg = {}
|
|
|
+ let msg = {byControl:!!e.byControl} //byControl代表是手动用控制轴修改 动画文件要改帧
|
|
|
if (!lastState.position || !model.position.equals(lastState.position)) {
|
|
|
lastState.position = msg.position = model.position.clone()
|
|
|
//console.log('change pos', model.name, model.position.toArray())
|
|
@@ -1000,10 +1008,10 @@ export const enter = ({ dom, mapDom, isLocal, lonlat, scenes, laserRoot, laserOS
|
|
|
}
|
|
|
if(ModelTypes[props.fromType].panos4dkk){
|
|
|
Potree.load4dkkPanos(props.raw.num, model, getBaseRotation(), () => {
|
|
|
- bus.emit('loadDone')
|
|
|
+ bus.emit('loadDone',model)
|
|
|
}, props.fromType == 0 ? '2k' : '4k' ) //看看场景是2k
|
|
|
} else {
|
|
|
- bus.emit('loadDone')
|
|
|
+ bus.emit('loadDone',model)
|
|
|
}
|
|
|
|
|
|
|
|
@@ -1474,7 +1482,7 @@ export const enter = ({ dom, mapDom, isLocal, lonlat, scenes, laserRoot, laserOS
|
|
|
|
|
|
|
|
|
let path
|
|
|
- let info = {type : 'Path', minMarkers : 2, title:props.name}
|
|
|
+ let info = {type : 'Path', minMarkers : 2, title:props.name, lineHeight : props.line.altitudeAboveGround }
|
|
|
|
|
|
|
|
|
if(props.points.length == 0){
|
|
@@ -1547,7 +1555,7 @@ export const enter = ({ dom, mapDom, isLocal, lonlat, scenes, laserRoot, laserOS
|
|
|
}
|
|
|
let functions = Object.assign(funs,{
|
|
|
bus,
|
|
|
-
|
|
|
+ path,
|
|
|
changeEditMode(state){//进入编辑
|
|
|
if(!state){
|
|
|
viewer.dispatchEvent({ type: 'cancel_insertions', dontRemove: true, measure:path })
|
|
@@ -1593,8 +1601,8 @@ export const enter = ({ dom, mapDom, isLocal, lonlat, scenes, laserRoot, laserOS
|
|
|
},
|
|
|
changeLine({width,color,altitudeAboveGround}){
|
|
|
path.setPathWidth(width)
|
|
|
-
|
|
|
- path.setPathColor(color)
|
|
|
+ path.setColor(color)
|
|
|
+ path.setLineHeight(altitudeAboveGround)
|
|
|
},
|
|
|
changeVisibilityRange(far){//设置消失距离
|
|
|
path.setFadeFar(far== -1 ? 0 : far)
|
|
@@ -1612,7 +1620,7 @@ export const enter = ({ dom, mapDom, isLocal, lonlat, scenes, laserRoot, laserOS
|
|
|
},
|
|
|
createAni(tension){
|
|
|
let distance = path.totalLength
|
|
|
- let pathPoints = path.points.map(e=>e.clone().add(new THREE.Vector3(0,0,2))) //在地面之上一定高度
|
|
|
+ let pathPoints = path.points.map(e=>e.clone().add(new THREE.Vector3(0,0,1.5))) //在地面之上一定高度
|
|
|
if(path.reverse) pathPoints.reverse()
|
|
|
|
|
|
|
|
@@ -1835,8 +1843,11 @@ export const enter = ({ dom, mapDom, isLocal, lonlat, scenes, laserRoot, laserOS
|
|
|
},
|
|
|
|
|
|
getImageCenter(){ //热点在模型的本地坐标
|
|
|
- return tag.onMesh ? tag.position : new THREE.Vector3().addVectors(tag.position, tag.titleLabel.parent.position)
|
|
|
-
|
|
|
+ if(!tag.parent)return new THREE.Vector3
|
|
|
+ tag.titleLabel.sprite.update()
|
|
|
+ let pos = tag.onMesh ? tag.position : tag.titleLabel.parent.position.clone().applyMatrix4(tag.matrixWorld).applyMatrix4(tag.root.matrixWorld.clone().invert())
|
|
|
+ //console.log(props.title, 'getImageCenter', pos.toArray(), tag.lineLength)
|
|
|
+ return pos
|
|
|
},
|
|
|
|
|
|
getCameraDisSquared(){//距离intersect的位置
|