|
|
@ -179,10 +179,10 @@ var QMUtil = function () { |
|
|
}; |
|
|
}; |
|
|
this.lightOptions = { |
|
|
this.lightOptions = { |
|
|
d_col: "#ffffff", |
|
|
d_col: "#ffffff", |
|
|
d_int: 0.2, |
|
|
|
|
|
|
|
|
d_int: 0.1, |
|
|
s_col: "#fffffa", |
|
|
s_col: "#fffffa", |
|
|
g_col: "#ffffff", |
|
|
g_col: "#ffffff", |
|
|
a_int: 0.85, |
|
|
|
|
|
|
|
|
a_int: 0.5, |
|
|
}; |
|
|
}; |
|
|
this.m_zoom = 1.2; //2D地图缩放大小
|
|
|
this.m_zoom = 1.2; //2D地图缩放大小
|
|
|
this._clock = new THREE.Clock(); |
|
|
this._clock = new THREE.Clock(); |
|
|
@ -1340,14 +1340,7 @@ var MainMap_QM = function (callBack, options) { |
|
|
this.selectShop; |
|
|
this.selectShop; |
|
|
this.selectEle = null; //当前使用的电梯
|
|
|
this.selectEle = null; //当前使用的电梯
|
|
|
this.overShop; //终点店铺
|
|
|
this.overShop; //终点店铺
|
|
|
this.shape = new THREE.Shape(); |
|
|
|
|
|
this.shape.moveTo(-10, -10); |
|
|
|
|
|
this.shape.lineTo(10, -10); |
|
|
|
|
|
this.shape.lineTo(10, 10); |
|
|
|
|
|
this.shape.lineTo(-10, 10); |
|
|
|
|
|
this.dtLineGroup = new THREE.Group(); |
|
|
|
|
|
this.dtLineGroup.name = "dtLine"; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
this.cost = -1; |
|
|
if (document.getElementById("moveFloorBG")) { |
|
|
if (document.getElementById("moveFloorBG")) { |
|
|
document.getElementById("moveFloorBG").style.zIndex = 500; |
|
|
document.getElementById("moveFloorBG").style.zIndex = 500; |
|
|
this.moveFloorbg = new THREE.CSS2DObject( |
|
|
this.moveFloorbg = new THREE.CSS2DObject( |
|
|
@ -1419,8 +1412,8 @@ MainMap_QM.prototype = { |
|
|
getPointByNode: function (str) { |
|
|
getPointByNode: function (str) { |
|
|
let nodes = str.split("_"); |
|
|
let nodes = str.split("_"); |
|
|
if (nodes.length > 2 && !isNaN(parseInt(nodes[2])) && parseInt(nodes[2])>=0) { |
|
|
if (nodes.length > 2 && !isNaN(parseInt(nodes[2])) && parseInt(nodes[2])>=0) { |
|
|
Map_QM.util.allMap[nodes[0]].buildArr[nodes[1]].mapData.path.nodes.sort(Map_QM.util.sortNode); |
|
|
|
|
|
return Map_QM.util.allMap[nodes[0]].buildArr[nodes[1]].mapData.path.nodes[nodes[2]]; |
|
|
|
|
|
|
|
|
Map_QM.util.allMap[parseInt(nodes[0])].buildArr[parseInt(nodes[1])].mapData.path.nodes.sort(Map_QM.util.sortNode); |
|
|
|
|
|
return Map_QM.util.allMap[parseInt(nodes[0])].buildArr[parseInt(nodes[1])].mapData.path.nodes[nodes[2]]; |
|
|
}else{ |
|
|
}else{ |
|
|
return {x:-5000,y:-5000,msg:"未打点"}; |
|
|
return {x:-5000,y:-5000,msg:"未打点"}; |
|
|
} |
|
|
} |
|
|
@ -1574,7 +1567,7 @@ MainMap_QM.prototype = { |
|
|
this.util.m_zoom = this.util.allMap[this.util.selectBuild].m_zoom; |
|
|
this.util.m_zoom = this.util.allMap[this.util.selectBuild].m_zoom; |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
let { playSpeed, collision, modelIcon, shopStyle, shadow, otherPath, navColor, iconUrl, iconName, inArea, pathColor, pathStyle} = options; |
|
|
|
|
|
|
|
|
let { playSpeed, collision, modelIcon, shopStyle, otherPath, navColor, iconUrl, iconName, inArea, pathColor, pathStyle} = options; |
|
|
|
|
|
|
|
|
this.util.options.playSpeed = playSpeed != undefined ? playSpeed : this.util.options.playSpeed; |
|
|
this.util.options.playSpeed = playSpeed != undefined ? playSpeed : this.util.options.playSpeed; |
|
|
this.util.options.collision = collision != undefined ? collision : this.util.options.collision; |
|
|
this.util.options.collision = collision != undefined ? collision : this.util.options.collision; |
|
|
@ -1731,7 +1724,7 @@ MainMap_QM.prototype = { |
|
|
for (let k = 0; k < collada2.animations.length; k++) { |
|
|
for (let k = 0; k < collada2.animations.length; k++) { |
|
|
let mixer = new THREE.AnimationMixer(collada2.scene); |
|
|
let mixer = new THREE.AnimationMixer(collada2.scene); |
|
|
mixer.clipAction(collada2.animations[k]).play(); |
|
|
mixer.clipAction(collada2.animations[k]).play(); |
|
|
Map_QM.mixers.push(mixer); |
|
|
|
|
|
|
|
|
_this.mixers.push(mixer); |
|
|
} |
|
|
} |
|
|
_this.endModel = collada2.scene; |
|
|
_this.endModel = collada2.scene; |
|
|
_this.scene.add(collada2.scene); |
|
|
_this.scene.add(collada2.scene); |
|
|
@ -1807,7 +1800,6 @@ MainMap_QM.prototype = { |
|
|
this.CSSObject.add(this.outObject); |
|
|
this.CSSObject.add(this.outObject); |
|
|
this.CSSObject.add(this.perObject); |
|
|
this.CSSObject.add(this.perObject); |
|
|
this.buildObj.add(this.CSSObject); |
|
|
this.buildObj.add(this.CSSObject); |
|
|
this.buildObj.add(this.dtLineGroup); |
|
|
|
|
|
this.initGuide(); |
|
|
this.initGuide(); |
|
|
if (!this.util.options.deviceAng) { |
|
|
if (!this.util.options.deviceAng) { |
|
|
this.cameraPerspective.position.set(this.util.sceneGap.cameraX, this.util.sceneGap.cameraY, this.util.sceneGap.cameraZ ); |
|
|
this.cameraPerspective.position.set(this.util.sceneGap.cameraX, this.util.sceneGap.cameraY, this.util.sceneGap.cameraZ ); |
|
|
@ -1853,6 +1845,7 @@ MainMap_QM.prototype = { |
|
|
try { |
|
|
try { |
|
|
for (let j = 0; j < this.util.pathStateObj.facAllArr.length; j++) { |
|
|
for (let j = 0; j < this.util.pathStateObj.facAllArr.length; j++) { |
|
|
for (let k = 0; k < this.util.pathStateObj.facAllArr[j].length; k++) { |
|
|
for (let k = 0; k < this.util.pathStateObj.facAllArr[j].length; k++) { |
|
|
|
|
|
if(!this.util.pathStateObj.facAllArr[j][k].hasOwnProperty("toState") || this.util.pathStateObj.facAllArr[j][k].toState){ //增加扶梯停靠状态
|
|
|
let facP =this.util.pathStateObj.facAllArr[j][k].buildOrder +"_" + this.util.pathStateObj.facAllArr[j][k].floorOrder +"_" +this.util.pathStateObj.facAllArr[j][k].navCode; |
|
|
let facP =this.util.pathStateObj.facAllArr[j][k].buildOrder +"_" + this.util.pathStateObj.facAllArr[j][k].floorOrder +"_" +this.util.pathStateObj.facAllArr[j][k].navCode; |
|
|
for (let h = 0; h < this.util.pathStateObj.facAllArr[j].length; h++) { |
|
|
for (let h = 0; h < this.util.pathStateObj.facAllArr[j].length; h++) { |
|
|
if (h != k && this.util.pathStateObj.facAllArr[j][k].buildOrder ==this.util.pathStateObj.facAllArr[j][h].buildOrder) { |
|
|
if (h != k && this.util.pathStateObj.facAllArr[j][k].buildOrder ==this.util.pathStateObj.facAllArr[j][h].buildOrder) { |
|
|
@ -1866,9 +1859,7 @@ MainMap_QM.prototype = { |
|
|
} |
|
|
} |
|
|
dtPathObj[facP][nP] = 5000 +800 *Math.abs(parseInt(this.util.pathStateObj.facAllArr[j][h].floorOrder)-parseInt(this.util.pathStateObj.facAllArr[j][k].floorOrder)); |
|
|
dtPathObj[facP][nP] = 5000 +800 *Math.abs(parseInt(this.util.pathStateObj.facAllArr[j][h].floorOrder)-parseInt(this.util.pathStateObj.facAllArr[j][k].floorOrder)); |
|
|
basePathObj[facP][nP] = 600 +200 * Math.abs(parseInt(this.util.pathStateObj.facAllArr[j][h].floorOrder) - parseInt(this.util.pathStateObj.facAllArr[j][k].floorOrder )); |
|
|
basePathObj[facP][nP] = 600 +200 * Math.abs(parseInt(this.util.pathStateObj.facAllArr[j][h].floorOrder) - parseInt(this.util.pathStateObj.facAllArr[j][k].floorOrder )); |
|
|
} else if ( |
|
|
|
|
|
this.util.pathStateObj.facAllArr[j][h].facCode == "td" |
|
|
|
|
|
) { |
|
|
|
|
|
|
|
|
} else if (this.util.pathStateObj.facAllArr[j][h].facCode == "td") { |
|
|
graphPathObj[facP][nP] =4000 +800 * Math.abs( parseInt( this.util.pathStateObj.facAllArr[j][h].floorOrder) - parseInt(this.util.pathStateObj.facAllArr[j][k].floorOrder)); |
|
|
graphPathObj[facP][nP] =4000 +800 * Math.abs( parseInt( this.util.pathStateObj.facAllArr[j][h].floorOrder) - parseInt(this.util.pathStateObj.facAllArr[j][k].floorOrder)); |
|
|
ftPathObj[facP][nP] = 4000 +800 * Math.abs(parseInt(this.util.pathStateObj.facAllArr[j][h].floorOrder) -parseInt(this.util.pathStateObj.facAllArr[j][k].floorOrder )); |
|
|
ftPathObj[facP][nP] = 4000 +800 * Math.abs(parseInt(this.util.pathStateObj.facAllArr[j][h].floorOrder) -parseInt(this.util.pathStateObj.facAllArr[j][k].floorOrder )); |
|
|
dtPathObj[facP][nP] = 4000 + 800 * Math.abs(parseInt(this.util.pathStateObj.facAllArr[j][h].floorOrder) - parseInt(this.util.pathStateObj.facAllArr[j][k].floorOrder)); |
|
|
dtPathObj[facP][nP] = 4000 + 800 * Math.abs(parseInt(this.util.pathStateObj.facAllArr[j][h].floorOrder) - parseInt(this.util.pathStateObj.facAllArr[j][k].floorOrder)); |
|
|
@ -1887,6 +1878,7 @@ MainMap_QM.prototype = { |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
|
|
|
} |
|
|
} catch (e) { |
|
|
} catch (e) { |
|
|
window.captureException && window.captureException(e); |
|
|
window.captureException && window.captureException(e); |
|
|
console.log("交通设施点位问题: " + e); |
|
|
console.log("交通设施点位问题: " + e); |
|
|
@ -1898,38 +1890,39 @@ MainMap_QM.prototype = { |
|
|
this.util.pathStateObj.basePath = basePathObj; |
|
|
this.util.pathStateObj.basePath = basePathObj; |
|
|
var fIndex = 0, bIndex = 0; |
|
|
var fIndex = 0, bIndex = 0; |
|
|
this.mapArr[bIndex] = []; |
|
|
this.mapArr[bIndex] = []; |
|
|
|
|
|
var _this = this; |
|
|
intTimer = setInterval(() => { |
|
|
intTimer = setInterval(() => { |
|
|
if (!Map_QM.util.allMap[bIndex].buildArr[fIndex]) { |
|
|
|
|
|
|
|
|
if (!_this.util.allMap[bIndex].buildArr[fIndex]) { |
|
|
clearInterval(intTimer); |
|
|
clearInterval(intTimer); |
|
|
this.initFloor(); |
|
|
|
|
|
|
|
|
_this.initFloor(); |
|
|
return; |
|
|
return; |
|
|
} |
|
|
} |
|
|
let floor = new FloorMap_QM(bIndex, fIndex, Map_QM.util.allMap[bIndex].buildArr[fIndex].name ); |
|
|
|
|
|
floor.floorName = Map_QM.util.allMap[bIndex].buildArr[fIndex].name; |
|
|
|
|
|
|
|
|
let floor = new FloorMap_QM(bIndex, fIndex, this.util.allMap[bIndex].buildArr[fIndex].name ); |
|
|
|
|
|
floor.floorName = this.util.allMap[bIndex].buildArr[fIndex].name; |
|
|
floor.initDraw(); |
|
|
floor.initDraw(); |
|
|
floor.allObj.position.set(bIndex * Map_QM.util.options.bSpace, 0, 0); |
|
|
|
|
|
if (fIndex != parseInt(Map_QM.util.deviceObj.floor)) { |
|
|
|
|
|
|
|
|
floor.allObj.position.set(bIndex * this.util.options.bSpace, 0, 0); |
|
|
|
|
|
if (fIndex != parseInt(this.util.deviceObj.floor)) { |
|
|
floor.allObj.visible = false; |
|
|
floor.allObj.visible = false; |
|
|
} |
|
|
} |
|
|
this.buildObj.add(floor.allObj); |
|
|
this.buildObj.add(floor.allObj); |
|
|
this.mapArr[bIndex].push(floor); |
|
|
this.mapArr[bIndex].push(floor); |
|
|
fIndex++; |
|
|
fIndex++; |
|
|
if (fIndex >= Map_QM.util.allMap[bIndex].buildArr.length) { |
|
|
|
|
|
if (bIndex == Map_QM.util.allMap.length - 1) { |
|
|
|
|
|
|
|
|
if (fIndex >= this.util.allMap[bIndex].buildArr.length) { |
|
|
|
|
|
if (bIndex == this.util.allMap.length - 1) { |
|
|
clearInterval(intTimer); |
|
|
clearInterval(intTimer); |
|
|
let pathData = Map_QM.util.allMap[parseInt(Map_QM.util.deviceObj.build)].buildArr[parseInt(Map_QM.util.deviceObj.floor)].mapData.path; |
|
|
|
|
|
if (Map_QM.util.deviceObj.xaxis) { |
|
|
|
|
|
Map_QM.mapArr[parseInt(Map_QM.util.deviceObj.build)][parseInt(Map_QM.util.deviceObj.floor)].setStartSite(Map_QM.util.deviceObj.xaxis,Map_QM.util.deviceObj.yaxis, parseInt(Map_QM.util.shopHeight) + 20); |
|
|
|
|
|
|
|
|
let pathData = this.util.allMap[parseInt(this.util.deviceObj.build)].buildArr[parseInt(this.util.deviceObj.floor)].mapData.path; |
|
|
|
|
|
if (this.util.deviceObj.xaxis) { |
|
|
|
|
|
this.mapArr[parseInt(this.util.deviceObj.build)][parseInt(this.util.deviceObj.floor)].setStartSite(this.util.deviceObj.xaxis,this.util.deviceObj.yaxis, parseInt(this.util.shopHeight) + 20); |
|
|
} else { |
|
|
} else { |
|
|
if (parseInt(Map_QM.util.deviceObj.node) != -1) { |
|
|
|
|
|
pathData && pathData.nodes.sort(Map_QM.util.sortNode); |
|
|
|
|
|
if (pathData &&!Map_QM.util.deviceObj.xaxis && pathData.nodes.length > parseInt(Map_QM.util.deviceObj.node) && parseInt(Map_QM.util.deviceObj.node) >= 0) { |
|
|
|
|
|
Map_QM.util.deviceObj.xaxis = pathData.nodes[parseInt(Map_QM.util.deviceObj.node)].x; |
|
|
|
|
|
Map_QM.util.deviceObj.yaxis = pathData.nodes[parseInt(Map_QM.util.deviceObj.node)].y; |
|
|
|
|
|
|
|
|
if (parseInt(this.util.deviceObj.node) != -1) { |
|
|
|
|
|
pathData && pathData.nodes.sort(this.util.sortNode); |
|
|
|
|
|
if (pathData &&!this.util.deviceObj.xaxis && pathData.nodes.length > parseInt(this.util.deviceObj.node) && parseInt(this.util.deviceObj.node) >= 0) { |
|
|
|
|
|
this.util.deviceObj.xaxis = pathData.nodes[parseInt(this.util.deviceObj.node)].x; |
|
|
|
|
|
this.util.deviceObj.yaxis = pathData.nodes[parseInt(this.util.deviceObj.node)].y; |
|
|
} else { |
|
|
} else { |
|
|
console.warn("初始化点位失败"); |
|
|
console.warn("初始化点位失败"); |
|
|
} |
|
|
} |
|
|
Map_QM.mapArr[parseInt(Map_QM.util.deviceObj.build)][parseInt(Map_QM.util.deviceObj.floor)].setStartSite(Map_QM.util.deviceObj.xaxis,Map_QM.util.deviceObj.yaxis,parseInt(Map_QM.util.shopHeight) + 20); |
|
|
|
|
|
|
|
|
this.mapArr[parseInt(this.util.deviceObj.build)][parseInt(this.util.deviceObj.floor)].setStartSite(this.util.deviceObj.xaxis,this.util.deviceObj.yaxis,parseInt(this.util.shopHeight) + 20); |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
this.initFloor(); |
|
|
this.initFloor(); |
|
|
@ -1996,7 +1989,7 @@ MainMap_QM.prototype = { |
|
|
for (let i = 0; i < Map_QM.mapArr[t].length; i++) { |
|
|
for (let i = 0; i < Map_QM.mapArr[t].length; i++) { |
|
|
Map_QM.mapArr[t][i].labelObj.traverse((obj) => { |
|
|
Map_QM.mapArr[t][i].labelObj.traverse((obj) => { |
|
|
if (obj.element) { |
|
|
if (obj.element) { |
|
|
obj.element.innerText = lang == "en"? obj.element.dataset.nameEn : obj.element.dataset.name; |
|
|
|
|
|
|
|
|
obj.element.innerText = lang == "en"? (obj.element.dataset.nameEn || obj.element.dataset.name) : obj.element.dataset.name; |
|
|
} |
|
|
} |
|
|
}); |
|
|
}); |
|
|
Map_QM.mapArr[t][i].showTagObj.traverse((obj) => { |
|
|
Map_QM.mapArr[t][i].showTagObj.traverse((obj) => { |
|
|
@ -2048,11 +2041,7 @@ MainMap_QM.prototype = { |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
}); |
|
|
}); |
|
|
object.scene.children[0].scale.set( |
|
|
|
|
|
sopce.util.modelStr[sopce.index].size.x, |
|
|
|
|
|
sopce.util.modelStr[sopce.index].size.y, |
|
|
|
|
|
sopce.util.modelStr[sopce.index].size.z |
|
|
|
|
|
); |
|
|
|
|
|
|
|
|
object.scene.children[0].scale.set(sopce.util.modelStr[sopce.index].size.x, sopce.util.modelStr[sopce.index].size.y, sopce.util.modelStr[sopce.index].size.z); |
|
|
sopce.util.fbxModels.push({key: sopce.util.modelStr[sopce.index].key,obj: object, operation: sopce.util.modelStr[sopce.index],}); |
|
|
sopce.util.fbxModels.push({key: sopce.util.modelStr[sopce.index].key,obj: object, operation: sopce.util.modelStr[sopce.index],}); |
|
|
if (sopce.index < sopce.util.modelStr.length - 1) { |
|
|
if (sopce.index < sopce.util.modelStr.length - 1) { |
|
|
sopce.index++; |
|
|
sopce.index++; |
|
|
@ -2255,14 +2244,9 @@ MainMap_QM.prototype = { |
|
|
noHas = true; |
|
|
noHas = true; |
|
|
for (let k = 0; k < this.util.pathStateObj.facAllArr.length; k++) { |
|
|
for (let k = 0; k < this.util.pathStateObj.facAllArr.length; k++) { |
|
|
//Map_QM.util.pathStateObj.facAllArr 记录遍历结果
|
|
|
//Map_QM.util.pathStateObj.facAllArr 记录遍历结果
|
|
|
if (this.util.pathStateObj.facAllArr[k][0].no != "" && |
|
|
|
|
|
this.util.pathStateObj.facAllArr[k][0].navCode != "" && |
|
|
|
|
|
parseInt(this.util.pathStateObj.facAllArr[k][0].navCode) > 0 && |
|
|
|
|
|
this.util.pathStateObj.facAllArr[k][0].no == mapDataA.stairs[j].no |
|
|
|
|
|
) { |
|
|
|
|
|
if (this.util.pathStateObj.facAllArr[k][0].facCode == mapDataA.stairs[j].facCode || |
|
|
|
|
|
(this.util.pathStateObj.facAllArr[k][0].facCode.search("ft") != -1 && mapDataA.stairs[j].facCode.search("ft") != -1) |
|
|
|
|
|
) { |
|
|
|
|
|
|
|
|
if (this.util.pathStateObj.facAllArr[k][0].no != "" && this.util.pathStateObj.facAllArr[k][0].navCode != "" && |
|
|
|
|
|
parseInt(this.util.pathStateObj.facAllArr[k][0].navCode) > 0 && this.util.pathStateObj.facAllArr[k][0].no == mapDataA.stairs[j].no ) { |
|
|
|
|
|
if (this.util.pathStateObj.facAllArr[k][0].facCode == mapDataA.stairs[j].facCode || (this.util.pathStateObj.facAllArr[k][0].facCode.search("ft") != -1 && mapDataA.stairs[j].facCode.search("ft") != -1)) { |
|
|
noHas = false; |
|
|
noHas = false; |
|
|
mapDataA.stairs[j].floorOrder = floorOrder; |
|
|
mapDataA.stairs[j].floorOrder = floorOrder; |
|
|
mapDataA.stairs[j].buildOrder = buildOrder; |
|
|
mapDataA.stairs[j].buildOrder = buildOrder; |
|
|
@ -2316,6 +2300,9 @@ MainMap_QM.prototype = { |
|
|
changeIconState: function (state, fIndex = -1) { |
|
|
changeIconState: function (state, fIndex = -1) { |
|
|
iconState = state; |
|
|
iconState = state; |
|
|
fIndex = fIndex === -1 ? Map_QM.util.selectFloor : fIndex; |
|
|
fIndex = fIndex === -1 ? Map_QM.util.selectFloor : fIndex; |
|
|
|
|
|
if(!Map_QM.mapArr || !Map_QM.mapArr[Map_QM.util.selectBuild]){ |
|
|
|
|
|
return; |
|
|
|
|
|
} |
|
|
try{ |
|
|
try{ |
|
|
for (let i = 0; i < Map_QM.mapArr[Map_QM.util.selectBuild].length; i++) { |
|
|
for (let i = 0; i < Map_QM.mapArr[Map_QM.util.selectBuild].length; i++) { |
|
|
if (i == fIndex && Map_QM.buildObj.visible) { |
|
|
if (i == fIndex && Map_QM.buildObj.visible) { |
|
|
@ -2326,7 +2313,7 @@ MainMap_QM.prototype = { |
|
|
obj.element && (obj.element.style.display = "none"); |
|
|
obj.element && (obj.element.style.display = "none"); |
|
|
} else { |
|
|
} else { |
|
|
obj.visible = true; |
|
|
obj.visible = true; |
|
|
obj.element && (obj.element.style.display = ""); |
|
|
|
|
|
|
|
|
obj.element && (obj.element.style.display = "block"); |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
}); |
|
|
}); |
|
|
@ -2372,8 +2359,8 @@ MainMap_QM.prototype = { |
|
|
}, |
|
|
}, |
|
|
|
|
|
|
|
|
changeBuildInner: function (build = -1, fIndex = -1) { |
|
|
changeBuildInner: function (build = -1, fIndex = -1) { |
|
|
fIndex = fIndex == -1 ? parseInt(Map_QM.util.deviceObj.floor) : fIndex; |
|
|
|
|
|
build = build == -1 ? parseInt(Map_QM.util.deviceObj.build) : build; |
|
|
|
|
|
|
|
|
fIndex = fIndex == -1 ? 0 : fIndex; |
|
|
|
|
|
build = build == -1 ? parseInt(Map_QM.util.selectBuild) : build; |
|
|
Map_QM.util.selectBuild = build; |
|
|
Map_QM.util.selectBuild = build; |
|
|
Map_QM.buildObj.position.x = -1 * build * Map_QM.util.options.bSpace; |
|
|
Map_QM.buildObj.position.x = -1 * build * Map_QM.util.options.bSpace; |
|
|
Map_QM.changeFloorInner(build, fIndex); //结束后切换楼层
|
|
|
Map_QM.changeFloorInner(build, fIndex); //结束后切换楼层
|
|
|
@ -2562,7 +2549,7 @@ MainMap_QM.prototype = { |
|
|
}, |
|
|
}, |
|
|
changeFloorInner: function (build = -1,fIndex = -1,callBack = undefined) { |
|
|
changeFloorInner: function (build = -1,fIndex = -1,callBack = undefined) { |
|
|
fIndex = fIndex != -1 ? fIndex : Map_QM.util.deviceObj.floor; |
|
|
fIndex = fIndex != -1 ? fIndex : Map_QM.util.deviceObj.floor; |
|
|
build = build != -1 ? build : Map_QM.util.deviceObj.build; |
|
|
|
|
|
|
|
|
build = build != -1 ? build : Map_QM.util.selectBuild; |
|
|
for (let t = 0; t < Map_QM.mapArr.length; t++) { |
|
|
for (let t = 0; t < Map_QM.mapArr.length; t++) { |
|
|
for (let i = 0; i < Map_QM.mapArr[t].length; i++) { |
|
|
for (let i = 0; i < Map_QM.mapArr[t].length; i++) { |
|
|
Map_QM.mapArr[t][i].allObj.visible = t == build ? true : false; |
|
|
Map_QM.mapArr[t][i].allObj.visible = t == build ? true : false; |
|
|
@ -2580,7 +2567,7 @@ MainMap_QM.prototype = { |
|
|
if (i == fIndex) { |
|
|
if (i == fIndex) { |
|
|
Map_QM.mapArr[build][i].allObj.visible = true; |
|
|
Map_QM.mapArr[build][i].allObj.visible = true; |
|
|
Map_QM.mapArr[build][i].CSSObj.traverse((obj) => { |
|
|
Map_QM.mapArr[build][i].CSSObj.traverse((obj) => { |
|
|
obj.element && obj.userData.isShow && obj.userData.type == "icon" && (obj.element.style.display = ""); |
|
|
|
|
|
|
|
|
obj.element && obj.userData.isShow && obj.userData.type == "icon" && (obj.element.style.display = "block"); |
|
|
}); |
|
|
}); |
|
|
Map_QM.changeIconState(iconState, fIndex); |
|
|
Map_QM.changeIconState(iconState, fIndex); |
|
|
} else { |
|
|
} else { |
|
|
@ -2614,11 +2601,10 @@ MainMap_QM.prototype = { |
|
|
* |
|
|
* |
|
|
*/ |
|
|
*/ |
|
|
onShowMeDir: function () { |
|
|
onShowMeDir: function () { |
|
|
if (Map_QM.util.pathStateObj.isPathState) { |
|
|
|
|
|
Map_QM.changePathDir("2D"); |
|
|
|
|
|
}else{ |
|
|
|
|
|
this.onInnerMeDir(); |
|
|
|
|
|
|
|
|
if (this.util.selectBuild != this.util.deviceObj.build || this.util.selectFloor != this.util.deviceObj.floor) { |
|
|
|
|
|
this.changeFloorInner(this.util.deviceObj.build, this.util.deviceObj.floor); |
|
|
} |
|
|
} |
|
|
|
|
|
this.onInnerMeDir(); |
|
|
}, |
|
|
}, |
|
|
onInnerMeDir: function () { |
|
|
onInnerMeDir: function () { |
|
|
if (this.util.selectBuild != this.util.deviceObj.build || this.util.selectFloor != this.util.deviceObj.floor) { |
|
|
if (this.util.selectBuild != this.util.deviceObj.build || this.util.selectFloor != this.util.deviceObj.floor) { |
|
|
@ -2869,8 +2855,8 @@ MainMap_QM.prototype = { |
|
|
if (obj.userData && obj.userData.type == "2d_IP") { |
|
|
if (obj.userData && obj.userData.type == "2d_IP") { |
|
|
if (obj.element) { |
|
|
if (obj.element) { |
|
|
if (isShow) { |
|
|
if (isShow) { |
|
|
obj.element.style.visibility = |
|
|
|
|
|
obj.userData.show == language ? "visible" : "hidden"; |
|
|
|
|
|
|
|
|
obj.element.style.visibility = obj.userData.show == language ? "visible" : "hidden"; |
|
|
|
|
|
obj.element.style.display = obj.userData.show == language ? "block" : "none"; |
|
|
} else { |
|
|
} else { |
|
|
obj.element.style.visibility = "hidden"; |
|
|
obj.element.style.visibility = "hidden"; |
|
|
} |
|
|
} |
|
|
@ -2924,13 +2910,16 @@ MainMap_QM.prototype = { |
|
|
* |
|
|
* |
|
|
*/ |
|
|
*/ |
|
|
mapToPoint: function (mapX, mapY, mapZ) { |
|
|
mapToPoint: function (mapX, mapY, mapZ) { |
|
|
let tag0 = Map_QM.controls.target; |
|
|
|
|
|
let pos0 = Map_QM.controls.object.position; |
|
|
|
|
|
|
|
|
let tag0 = Map_QM.controls.target.clone(); |
|
|
|
|
|
let pos0 = Map_QM.controls.object.position.clone(); |
|
|
let vct = new THREE.Vector3(mapX, -1 * mapY, mapZ); |
|
|
let vct = new THREE.Vector3(mapX, -1 * mapY, mapZ); |
|
|
vct.applyMatrix4(Map_QM.mapArr[Map_QM.util.selectBuild][Map_QM.util.selectFloor].allObj.matrix); |
|
|
vct.applyMatrix4(Map_QM.mapArr[Map_QM.util.selectBuild][Map_QM.util.selectFloor].allObj.matrix); |
|
|
|
|
|
vct.applyMatrix4(Map_QM.buildObj.matrix); |
|
|
vct.applyMatrix4(Map_QM.sceneGap.matrix); |
|
|
vct.applyMatrix4(Map_QM.sceneGap.matrix); |
|
|
Map_QM.controls.target = new THREE.Vector3(vct.x, vct.y, vct.z); |
|
|
Map_QM.controls.target = new THREE.Vector3(vct.x, vct.y, vct.z); |
|
|
Map_QM.controls.object.position.set(pos0.x + (vct.x - tag0.x), pos0.y + (vct.y - tag0.y), pos0.z + (vct.z - tag0.z)); |
|
|
Map_QM.controls.object.position.set(pos0.x + (vct.x - tag0.x), pos0.y + (vct.y - tag0.y), pos0.z + (vct.z - tag0.z)); |
|
|
|
|
|
Map_QM.controls.object.lookAt(vct); |
|
|
|
|
|
Map_QM.controls.update(); |
|
|
return vct; |
|
|
return vct; |
|
|
}, |
|
|
}, |
|
|
/** |
|
|
/** |
|
|
@ -3004,7 +2993,7 @@ MainMap_QM.prototype = { |
|
|
reSetGuide: function () { |
|
|
reSetGuide: function () { |
|
|
if (pathCameraState == "2D") { |
|
|
if (pathCameraState == "2D") { |
|
|
//2D导航
|
|
|
//2D导航
|
|
|
Map_QM.onInnerMeDir(); |
|
|
|
|
|
|
|
|
Map_QM.onShowMeDir(); |
|
|
Map_QM.guide.visible = false; |
|
|
Map_QM.guide.visible = false; |
|
|
let pos = Map_QM.guide.position; |
|
|
let pos = Map_QM.guide.position; |
|
|
Map_QM.guide = Map_QM.man_2d; |
|
|
Map_QM.guide = Map_QM.man_2d; |
|
|
@ -3463,7 +3452,7 @@ MainMap_QM.prototype = { |
|
|
let labObj = Map_QM.mapArr[Map_QM.util.selectBuild][Map_QM.util.selectFloor].labelObj.children; |
|
|
let labObj = Map_QM.mapArr[Map_QM.util.selectBuild][Map_QM.util.selectFloor].labelObj.children; |
|
|
for (let i = 0; i < shopNums.length; i++) { |
|
|
for (let i = 0; i < shopNums.length; i++) { |
|
|
for (let j = 0; j < labObj.length; j++) { |
|
|
for (let j = 0; j < labObj.length; j++) { |
|
|
if (labObj[j].name == shopNums[i]) { |
|
|
|
|
|
|
|
|
if (labObj[j].name == shopNums[i] && labObj[j].element) { |
|
|
labObj[j].element.innerHTML = elements[i]; |
|
|
labObj[j].element.innerHTML = elements[i]; |
|
|
break; |
|
|
break; |
|
|
} |
|
|
} |
|
|
@ -3733,9 +3722,10 @@ MainMap_QM.prototype = { |
|
|
Map_QM.controls.update(); |
|
|
Map_QM.controls.update(); |
|
|
Map_QM.renderer.render(Map_QM.scene, Map_QM.camera); |
|
|
Map_QM.renderer.render(Map_QM.scene, Map_QM.camera); |
|
|
Map_QM.labelRenderer.render(Map_QM.scene, Map_QM.camera); |
|
|
Map_QM.labelRenderer.render(Map_QM.scene, Map_QM.camera); |
|
|
|
|
|
|
|
|
Map_QM.labelRenderer.renderObject(Map_QM.mapArr[Map_QM.util.selectBuild][Map_QM.util.selectFloor].CSSObj, Map_QM.scene, Map_QM.camera); |
|
|
|
|
|
|
|
|
if(Map_QM.mapArr && Map_QM.mapArr[Map_QM.util.selectBuild] && Map_QM.mapArr[Map_QM.util.selectBuild][Map_QM.util.selectFloor]){ |
|
|
|
|
|
Map_QM.labelRenderer.renderObject(Map_QM.mapArr[Map_QM.util.selectBuild][Map_QM.util.selectFloor].CSSObj, Map_QM.scene,Map_QM.camera); |
|
|
Map_QM.labelRenderer.zOrder(Map_QM.mapArr[Map_QM.util.selectBuild][Map_QM.util.selectFloor].labelObj); |
|
|
Map_QM.labelRenderer.zOrder(Map_QM.mapArr[Map_QM.util.selectBuild][Map_QM.util.selectFloor].labelObj); |
|
|
|
|
|
} |
|
|
}, |
|
|
}, |
|
|
/** |
|
|
/** |
|
|
* 初始化后调用 |
|
|
* 初始化后调用 |
|
|
@ -3880,7 +3870,12 @@ MainMap_QM.prototype = { |
|
|
} |
|
|
} |
|
|
}, |
|
|
}, |
|
|
getlocaleToScreen:function(object,vect){ |
|
|
getlocaleToScreen:function(object,vect){ |
|
|
let standardVec = object.localToWorld(vect).project(Map_QM.camera); |
|
|
|
|
|
|
|
|
let standardVec; |
|
|
|
|
|
if(vect){ |
|
|
|
|
|
standardVec = object.localToWorld(vect).project(Map_QM.camera); |
|
|
|
|
|
}else{ |
|
|
|
|
|
standardVec = object.localToWorld(new THREE.Vector3()).project(Map_QM.camera); |
|
|
|
|
|
} |
|
|
const screenX = Math.round(Map_QM.w/2 * standardVec.x + Map_QM.w/2); |
|
|
const screenX = Math.round(Map_QM.w/2 * standardVec.x + Map_QM.w/2); |
|
|
const screenY = Math.round(Map_QM.h/-2 * standardVec.y + Map_QM.h/2); |
|
|
const screenY = Math.round(Map_QM.h/-2 * standardVec.y + Map_QM.h/2); |
|
|
return {x:screenX, y:screenY}; |
|
|
return {x:screenX, y:screenY}; |
|
|
@ -3896,14 +3891,14 @@ MainMap_QM.prototype = { |
|
|
continue; |
|
|
continue; |
|
|
} |
|
|
} |
|
|
if (!Map_QM.util.options.collision) { |
|
|
if (!Map_QM.util.options.collision) { |
|
|
childs[i].element.style.display = ""; |
|
|
|
|
|
|
|
|
childs[i].element.style.display = "block"; |
|
|
continue; |
|
|
continue; |
|
|
} |
|
|
} |
|
|
let obj = childs[i].element; |
|
|
let obj = childs[i].element; |
|
|
obj.style.display = ""; |
|
|
|
|
|
|
|
|
obj.style.display = "block"; |
|
|
let labP = obj.getBoundingClientRect(); |
|
|
let labP = obj.getBoundingClientRect(); |
|
|
for (let j = 0; j < i; j++) { |
|
|
for (let j = 0; j < i; j++) { |
|
|
if (childs[j].element.style.display == "") { |
|
|
|
|
|
|
|
|
if (childs[j].element.style.display == "block") { |
|
|
let pb = childs[j].element.getBoundingClientRect(); |
|
|
let pb = childs[j].element.getBoundingClientRect(); |
|
|
let isCol = Map_QM.util.isCollision(labP, pb); |
|
|
let isCol = Map_QM.util.isCollision(labP, pb); |
|
|
if (isCol) { |
|
|
if (isCol) { |
|
|
@ -4396,6 +4391,79 @@ MainMap_QM.prototype = { |
|
|
return "leftFront"; |
|
|
return "leftFront"; |
|
|
} |
|
|
} |
|
|
}, |
|
|
}, |
|
|
|
|
|
|
|
|
|
|
|
//获取目标物角度和距离 deviceObj
|
|
|
|
|
|
getObjectAngle:function(objArr){ |
|
|
|
|
|
if(parseInt(Map_QM.util.startObj.node) || parseInt(Map_QM.util.startObj.node) == 0){ |
|
|
|
|
|
let pathData =Map_QM.util.allMap[parseInt(Map_QM.util.startObj.build)].buildArr[parseInt(Map_QM.util.startObj.floor)].mapData.path; |
|
|
|
|
|
pathData.nodes.sort(Map_QM.util.sortNode); |
|
|
|
|
|
Map_QM.util.startObj.xaxis = pathData.nodes[parseInt(Map_QM.util.startObj.node)].x; |
|
|
|
|
|
Map_QM.util.startObj.yaxis = pathData.nodes[parseInt(Map_QM.util.startObj.node)].y; |
|
|
|
|
|
|
|
|
|
|
|
let startNade = Map_QM.util.startObj.build +"_" +Map_QM.util.startObj.floor +"_" +Map_QM.util.startObj.node; |
|
|
|
|
|
const costAll = dijkstra.single_source_shortest_paths( Map_QM.util.pathStateObj.basePath,startNade,startNade).costs; |
|
|
|
|
|
for(let i=0;i<objArr.length; i++){ |
|
|
|
|
|
if(parseInt(objArr[i].type) == 1){ //店铺
|
|
|
|
|
|
for (let h = 0; h < Map_QM.util.allMap[Map_QM.util.startObj.build].buildArr.length; h++) { |
|
|
|
|
|
let mapData = Map_QM.util.allMap[Map_QM.util.startObj.build].buildArr[h].mapData; |
|
|
|
|
|
let angle = 0; |
|
|
|
|
|
for(let g=0; g<mapData.shopArea.length; g++){ |
|
|
|
|
|
if (objArr[i].typeAbbreviation == mapData.shopArea[g].name) { |
|
|
|
|
|
let toNade = Map_QM.util.startObj.build +"_" +h +"_" +mapData.shopArea[g].shopNav; |
|
|
|
|
|
if(Map_QM.util.startObj.floor == h){ // 同楼层
|
|
|
|
|
|
let x0 = (mapData.shopArea[g].xaxis-Map_QM.util.startObj.xaxis); |
|
|
|
|
|
let y0 = -1*(mapData.shopArea[g].yaxis-Map_QM.util.startObj.yaxis); |
|
|
|
|
|
angle = (360+parseInt(Math.atan2(x0,y0)*180/Math.PI))%360; |
|
|
|
|
|
angle = Math.abs(angle - parseInt(Map_QM.util.deviceObj.angle)); |
|
|
|
|
|
}else{ // 不同楼层
|
|
|
|
|
|
let pathNodes = dijkstra.find_path(Map_QM.util.pathStateObj.graphPath, startNade, toNade); |
|
|
|
|
|
for(let u=0; u<pathNodes.nodes.length; u++){ |
|
|
|
|
|
if(Map_QM.util.startObj.floor != pathNodes.nodes[u].split("_")[1]){ |
|
|
|
|
|
let fac = Map_QM.getFacilIcon(pathNodes.nodes[u].split("_")); |
|
|
|
|
|
let x0 = fac.position.x - Map_QM.util.startObj.xaxis; |
|
|
|
|
|
let y0 = fac.position.y + Map_QM.util.startObj.yaxis; |
|
|
|
|
|
angle = (360+parseInt(Math.atan2(x0,y0)*180/Math.PI))%360; |
|
|
|
|
|
angle = Math.abs(angle - parseInt(Map_QM.util.deviceObj.angle)); |
|
|
|
|
|
break; |
|
|
|
|
|
} |
|
|
|
|
|
} |
|
|
|
|
|
} |
|
|
|
|
|
objArr[i].angle = angle; |
|
|
|
|
|
objArr[i].cost = parseInt(costAll[toNade] / Map_QM.util.options.mapScale); |
|
|
|
|
|
} |
|
|
|
|
|
} |
|
|
|
|
|
} |
|
|
|
|
|
}else{ // 设施
|
|
|
|
|
|
let item = Map_QM.pathIcon({type: objArr[i].typeAbbreviation}); |
|
|
|
|
|
let toNade = item.build + "_" + item.floor + "_" + item.node; |
|
|
|
|
|
let angle = 0; |
|
|
|
|
|
if(item.floor == Map_QM.util.startObj.floor){ |
|
|
|
|
|
let x0 = item.site.x-Map_QM.util.startObj.xaxis; |
|
|
|
|
|
let y0 = item.site.y+Map_QM.util.startObj.yaxis; |
|
|
|
|
|
angle = (360+parseInt(Math.atan2(x0,y0)*180/Math.PI))%360; |
|
|
|
|
|
angle = Math.abs(angle - parseInt(Map_QM.util.deviceObj.angle)); |
|
|
|
|
|
}else{ |
|
|
|
|
|
let pathNodes = dijkstra.find_path(Map_QM.util.pathStateObj.graphPath, startNade, toNade); |
|
|
|
|
|
for(let u=0; u<pathNodes.nodes.length; u++){ |
|
|
|
|
|
if(Map_QM.util.startObj.floor != pathNodes.nodes[u].split("_")[1]){ |
|
|
|
|
|
let fac = Map_QM.getFacilIcon(pathNodes.nodes[u].split("_")); |
|
|
|
|
|
|
|
|
|
|
|
let x0 = fac.position.x - Map_QM.util.startObj.xaxis; |
|
|
|
|
|
let y0 = fac.position.y + Map_QM.util.startObj.yaxis; |
|
|
|
|
|
angle = (360+parseInt(Math.atan2(x0,y0)*180/Math.PI))%360; |
|
|
|
|
|
angle = Math.abs(angle - parseInt(Map_QM.util.deviceObj.angle)); |
|
|
|
|
|
break; |
|
|
|
|
|
} |
|
|
|
|
|
} |
|
|
|
|
|
} |
|
|
|
|
|
objArr[i].angle = angle; |
|
|
|
|
|
objArr[i].cost = parseInt(costAll[toNade] / Map_QM.util.options.mapScale); |
|
|
|
|
|
} |
|
|
|
|
|
} |
|
|
|
|
|
} |
|
|
|
|
|
return objArr; |
|
|
|
|
|
}, |
|
|
|
|
|
|
|
|
/** |
|
|
/** |
|
|
* @api {方法} pathIcon({type:"xsj"}) 获取最近设施 |
|
|
* @api {方法} pathIcon({type:"xsj"}) 获取最近设施 |
|
|
* @apiGroup 地图导航 |
|
|
* @apiGroup 地图导航 |
|
|
@ -4553,7 +4621,7 @@ MainMap_QM.prototype = { |
|
|
*/ |
|
|
*/ |
|
|
changeStartPoint: function (toObj) { |
|
|
changeStartPoint: function (toObj) { |
|
|
this.clearFloor(); |
|
|
this.clearFloor(); |
|
|
if (this.mapArr) { |
|
|
|
|
|
|
|
|
if (this.mapArr && this.mapArr.length>0) { |
|
|
for (let i = 0;i < this.mapArr[parseInt(this.util.startObj.build)].length;i++) { |
|
|
for (let i = 0;i < this.mapArr[parseInt(this.util.startObj.build)].length;i++) { |
|
|
for (let len =this.mapArr[parseInt(this.util.startObj.build)][i].allObj.children.length - 1;len >= 0;len--) { |
|
|
for (let len =this.mapArr[parseInt(this.util.startObj.build)][i].allObj.children.length - 1;len >= 0;len--) { |
|
|
let obj =this.mapArr[parseInt(this.util.startObj.build)][i].allObj.children[len]; |
|
|
let obj =this.mapArr[parseInt(this.util.startObj.build)][i].allObj.children[len]; |
|
|
@ -4562,6 +4630,8 @@ MainMap_QM.prototype = { |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
|
|
|
}else{ |
|
|
|
|
|
return; |
|
|
} |
|
|
} |
|
|
this.util.startObj = {}; |
|
|
this.util.startObj = {}; |
|
|
if (toObj && toObj.node) { |
|
|
if (toObj && toObj.node) { |
|
|
@ -4690,6 +4760,7 @@ MainMap_QM.prototype = { |
|
|
*/ |
|
|
*/ |
|
|
pathNode: function (toObj, callBackFun) { |
|
|
pathNode: function (toObj, callBackFun) { |
|
|
Map_QM.util.isMorePath = false; |
|
|
Map_QM.util.isMorePath = false; |
|
|
|
|
|
Map_QM.cost=-1; |
|
|
if (!toObj) { |
|
|
if (!toObj) { |
|
|
return { direction: "", wayList: [] }; |
|
|
return { direction: "", wayList: [] }; |
|
|
} |
|
|
} |
|
|
@ -4699,11 +4770,7 @@ MainMap_QM.prototype = { |
|
|
Map_QM.selectShop = null; |
|
|
Map_QM.selectShop = null; |
|
|
Map_QM.util.pathStateObj.isPathState = true; |
|
|
Map_QM.util.pathStateObj.isPathState = true; |
|
|
Map_QM.elementDestroy("all"); |
|
|
Map_QM.elementDestroy("all"); |
|
|
if ( |
|
|
|
|
|
Map_QM.util.initModelArr && |
|
|
|
|
|
Map_QM.util.initModelArr.length > 0 && |
|
|
|
|
|
Map_QM.util.changeDist.inner > Map_QM.util.options.minDis |
|
|
|
|
|
) { |
|
|
|
|
|
|
|
|
if (Map_QM.util.initModelArr && Map_QM.util.initModelArr.length > 0 && Map_QM.util.changeDist.inner > Map_QM.util.options.minDis) { |
|
|
Map_QM.controls.maxDistance = Map_QM.util.changeDist.inner; |
|
|
Map_QM.controls.maxDistance = Map_QM.util.changeDist.inner; |
|
|
} |
|
|
} |
|
|
if (!Map_QM.util.startObj.xaxis && !Map_QM.util.startObj.yaxis) { |
|
|
if (!Map_QM.util.startObj.xaxis && !Map_QM.util.startObj.yaxis) { |
|
|
@ -4722,9 +4789,7 @@ MainMap_QM.prototype = { |
|
|
this.onFindPathModel(); |
|
|
this.onFindPathModel(); |
|
|
if (callBackFun) { |
|
|
if (callBackFun) { |
|
|
Map_QM.parseForShopArr(); |
|
|
Map_QM.parseForShopArr(); |
|
|
const data = JSON.parse( |
|
|
|
|
|
JSON.stringify(Map_QM.util.pathStateObj.forShopArr) |
|
|
|
|
|
); |
|
|
|
|
|
|
|
|
const data = JSON.parse(JSON.stringify(Map_QM.util.pathStateObj.forShopArr)); |
|
|
callBackFun(data); |
|
|
callBackFun(data); |
|
|
} |
|
|
} |
|
|
Map_QM.startRender(); |
|
|
Map_QM.startRender(); |
|
|
@ -4761,10 +4826,7 @@ MainMap_QM.prototype = { |
|
|
for (let i = 0; i < Map_QM.mapArr[h].length; i++) { |
|
|
for (let i = 0; i < Map_QM.mapArr[h].length; i++) { |
|
|
let shopArr = Map_QM.mapArr[h][i].shopObj.children; |
|
|
let shopArr = Map_QM.mapArr[h][i].shopObj.children; |
|
|
for (let k = 0; k < shopArr.length; k++) { |
|
|
for (let k = 0; k < shopArr.length; k++) { |
|
|
if ( |
|
|
|
|
|
shopArr[k].name == houseNumber && |
|
|
|
|
|
parseInt(shopArr[k].node) >= 0 |
|
|
|
|
|
) { |
|
|
|
|
|
|
|
|
if (shopArr[k].name == houseNumber && parseInt(shopArr[k].node) >= 0) { |
|
|
return { |
|
|
return { |
|
|
build: h, |
|
|
build: h, |
|
|
floor: i, |
|
|
floor: i, |
|
|
@ -5006,7 +5068,23 @@ MainMap_QM.prototype = { |
|
|
}, |
|
|
}, |
|
|
|
|
|
|
|
|
parseForShopArr: function () { |
|
|
parseForShopArr: function () { |
|
|
Map_QM.util.pathStateObj.forShopArr = { direction: "", wayList: [] }; |
|
|
|
|
|
|
|
|
Map_QM.util.pathStateObj.forShopArr = { direction: "", angle:0, cost:0, wayList: [] }; |
|
|
|
|
|
if(Map_QM.cost>0){ |
|
|
|
|
|
Map_QM.cost -= (3500 +800*Math.abs(Map_QM.util.overObj.floor-Map_QM.util.deviceObj.floor)); |
|
|
|
|
|
Map_QM.util.pathStateObj.forShopArr.cost = parseInt(Map_QM.cost / Map_QM.util.options.mapScale); |
|
|
|
|
|
}else{ |
|
|
|
|
|
let obj = Map_QM.getGapByPathNode({build: Map_QM.util.overObj.build, floor: Map_QM.util.overObj.floor, node: Map_QM.util.overObj.node}); |
|
|
|
|
|
Map_QM.util.pathStateObj.forShopArr.angle = obj.angle; |
|
|
|
|
|
Map_QM.util.pathStateObj.forShopArr.cost = obj.dis; |
|
|
|
|
|
} |
|
|
|
|
|
if(Map_QM.forShopArr[0].Facilities){ |
|
|
|
|
|
Map_QM.forShopArr[0].Facilities.position.x; |
|
|
|
|
|
let x0 = Map_QM.forShopArr[0].Facilities.position.x - Map_QM.util.startObj.xaxis; |
|
|
|
|
|
let y0 = Map_QM.forShopArr[0].Facilities.position.y + Map_QM.util.startObj.yaxis; |
|
|
|
|
|
angle = (360+parseInt(Math.atan2(x0,y0)*180/Math.PI))%360; |
|
|
|
|
|
Map_QM.util.pathStateObj.forShopArr.angle = Math.abs(angle - parseInt(Map_QM.util.deviceObj.angle)); |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
Map_QM.forShopArr.forEach((item, index) => { |
|
|
Map_QM.forShopArr.forEach((item, index) => { |
|
|
if (item.hasOwnProperty("Direction")) { |
|
|
if (item.hasOwnProperty("Direction")) { |
|
|
Map_QM.util.pathStateObj.forShopArr.direction = item.Direction; |
|
|
Map_QM.util.pathStateObj.forShopArr.direction = item.Direction; |
|
|
@ -5050,7 +5128,7 @@ MainMap_QM.prototype = { |
|
|
* |
|
|
* |
|
|
* @apiParamExample 请求示例 |
|
|
* @apiParamExample 请求示例 |
|
|
* |
|
|
* |
|
|
* Map_QM.getGapByPathNode({floor:2,node:"53"}); |
|
|
|
|
|
|
|
|
* Map_QM.getGapByPathNode({build:0, floor:2, node:"53"}); |
|
|
* |
|
|
* |
|
|
* @apiSuccessExample {Object} dist 距离米数 time 步行时间 |
|
|
* @apiSuccessExample {Object} dist 距离米数 time 步行时间 |
|
|
* { |
|
|
* { |
|
|
@ -5060,10 +5138,24 @@ MainMap_QM.prototype = { |
|
|
getGapByPathNode: function (toObj) { |
|
|
getGapByPathNode: function (toObj) { |
|
|
let startNade = Map_QM.util.deviceObj.build +"_" + Map_QM.util.deviceObj.floor + "_" + Map_QM.util.deviceObj.node; |
|
|
let startNade = Map_QM.util.deviceObj.build +"_" + Map_QM.util.deviceObj.floor + "_" + Map_QM.util.deviceObj.node; |
|
|
let toNade = toObj.build + "_" + toObj.floor + "_" + toObj.node; |
|
|
let toNade = toObj.build + "_" + toObj.floor + "_" + toObj.node; |
|
|
let path = { cost: -1 }, |
|
|
|
|
|
|
|
|
let pathData0 =Map_QM.util.allMap[parseInt(Map_QM.util.deviceObj.build)].buildArr[parseInt(Map_QM.util.deviceObj.floor)].mapData.path; |
|
|
|
|
|
pathData0.nodes.sort(Map_QM.util.sortNode); |
|
|
|
|
|
let stX = pathData0.nodes[parseInt(Map_QM.util.deviceObj.node)].x; |
|
|
|
|
|
let stY = pathData0.nodes[parseInt(Map_QM.util.deviceObj.node)].y; |
|
|
|
|
|
|
|
|
|
|
|
let pathData =Map_QM.util.allMap[parseInt(toObj.build)].buildArr[parseInt(toObj.floor)].mapData.path; |
|
|
|
|
|
pathData.nodes.sort(Map_QM.util.sortNode); |
|
|
|
|
|
let toX = pathData.nodes[parseInt(toObj.node)].x; |
|
|
|
|
|
let toY = pathData.nodes[parseInt(toObj.node)].y; |
|
|
|
|
|
|
|
|
|
|
|
let path = { cost: -1 }, angle=0, |
|
|
minTime = 1; |
|
|
minTime = 1; |
|
|
try { |
|
|
try { |
|
|
path = dijkstra.find_path( Map_QM.util.pathStateObj.basePath,startNade,toNade); |
|
|
path = dijkstra.find_path( Map_QM.util.pathStateObj.basePath,startNade,toNade); |
|
|
|
|
|
let x0 = (toX - stX); |
|
|
|
|
|
let y0 = -1*(toY - stY); |
|
|
|
|
|
angle = (360+parseInt(Math.atan2(x0,y0)*180/Math.PI))%360; |
|
|
|
|
|
angle = Math.abs(angle - parseInt(Map_QM.util.deviceObj.angle)); |
|
|
minTime = parseInt(path.cost / Map_QM.util.options.mapScale / 50) < 0.5? 0.5 : parseInt(path.cost / Map_QM.util.options.mapScale / 50); |
|
|
minTime = parseInt(path.cost / Map_QM.util.options.mapScale / 50) < 0.5? 0.5 : parseInt(path.cost / Map_QM.util.options.mapScale / 50); |
|
|
console.log(`距离目的地 ${parseInt(path.cost / Map_QM.util.options.mapScale)} 米,预计${minTime} 分钟`); // 21 是比例尺
|
|
|
console.log(`距离目的地 ${parseInt(path.cost / Map_QM.util.options.mapScale)} 米,预计${minTime} 分钟`); // 21 是比例尺
|
|
|
} catch (e) { |
|
|
} catch (e) { |
|
|
@ -5071,6 +5163,7 @@ MainMap_QM.prototype = { |
|
|
console.log(e); |
|
|
console.log(e); |
|
|
} |
|
|
} |
|
|
return { |
|
|
return { |
|
|
|
|
|
angle: angle, |
|
|
dis: parseInt(path.cost / Map_QM.util.options.mapScale), |
|
|
dis: parseInt(path.cost / Map_QM.util.options.mapScale), |
|
|
time: minTime, |
|
|
time: minTime, |
|
|
}; |
|
|
}; |
|
|
@ -5171,7 +5264,7 @@ MainMap_QM.prototype = { |
|
|
} |
|
|
} |
|
|
Map_QM.mapArr[h][i].labelObj.traverse((obj) => { |
|
|
Map_QM.mapArr[h][i].labelObj.traverse((obj) => { |
|
|
if (obj.element && obj.userData.formatCode == formatCode) { |
|
|
if (obj.element && obj.userData.formatCode == formatCode) { |
|
|
obj.element.style.display = isShow ? "" : "none"; |
|
|
|
|
|
|
|
|
obj.element.style.display = isShow ? "block" : "none"; |
|
|
obj.userData.isShow = isShow; |
|
|
obj.userData.isShow = isShow; |
|
|
} |
|
|
} |
|
|
}); |
|
|
}); |
|
|
@ -5206,7 +5299,7 @@ MainMap_QM.prototype = { |
|
|
} |
|
|
} |
|
|
Map_QM.mapArr[h][i].labelObj.traverse((obj) => { |
|
|
Map_QM.mapArr[h][i].labelObj.traverse((obj) => { |
|
|
if (obj.name == houseNumber) { |
|
|
if (obj.name == houseNumber) { |
|
|
obj.element.style.display = isShow ? "" : "none"; |
|
|
|
|
|
|
|
|
obj.element.style.display = isShow ? "block" : "none"; |
|
|
obj.userData.isShow = isShow; |
|
|
obj.userData.isShow = isShow; |
|
|
} |
|
|
} |
|
|
}); |
|
|
}); |
|
|
@ -5269,6 +5362,7 @@ MainMap_QM.prototype = { |
|
|
* 模拟导航获取路线 |
|
|
* 模拟导航获取路线 |
|
|
*/ |
|
|
*/ |
|
|
onFindPathModel: function (usePath = null) { |
|
|
onFindPathModel: function (usePath = null) { |
|
|
|
|
|
Map_QM.cost = -1; |
|
|
Map_QM.forShopArr.length = 0; |
|
|
Map_QM.forShopArr.length = 0; |
|
|
Map_QM.util._indexPathFloor = 0; |
|
|
Map_QM.util._indexPathFloor = 0; |
|
|
Map_QM.util.pathStateObj.isPathPlay = true; |
|
|
Map_QM.util.pathStateObj.isPathPlay = true; |
|
|
@ -5291,10 +5385,10 @@ MainMap_QM.prototype = { |
|
|
Map_QM.util.overObj.node = Map_QM.getMinCostByArray( Map_QM.util.overObj.floor,inArray, costall); |
|
|
Map_QM.util.overObj.node = Map_QM.getMinCostByArray( Map_QM.util.overObj.floor,inArray, costall); |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
let startNade = |
|
|
|
|
|
Map_QM.util.startObj.build + "_" + Map_QM.util.startObj.floor + "_" + Map_QM.util.startObj.node; |
|
|
|
|
|
|
|
|
let startNade = Map_QM.util.startObj.build + "_" + Map_QM.util.startObj.floor + "_" + Map_QM.util.startObj.node; |
|
|
let toNade = Map_QM.util.overObj.build + "_" + Map_QM.util.overObj.floor + "_" + Map_QM.util.overObj.node; |
|
|
let toNade = Map_QM.util.overObj.build + "_" + Map_QM.util.overObj.floor + "_" + Map_QM.util.overObj.node; |
|
|
let path = dijkstra.find_path(usePath, startNade, toNade); |
|
|
let path = dijkstra.find_path(usePath, startNade, toNade); |
|
|
|
|
|
Map_QM.cost = path.cost; |
|
|
Map_QM.forShopPath(path.nodes); |
|
|
Map_QM.forShopPath(path.nodes); |
|
|
} catch (e) { |
|
|
} catch (e) { |
|
|
window.captureException && window.captureException(e); |
|
|
window.captureException && window.captureException(e); |
|
|
@ -5776,8 +5870,9 @@ MainMap_QM.prototype = { |
|
|
/** |
|
|
/** |
|
|
* 楼层状态清理 |
|
|
* 楼层状态清理 |
|
|
*/ |
|
|
*/ |
|
|
clearFloor: function (fIndex = -1, reSet = true) { |
|
|
|
|
|
|
|
|
clearFloor: function (fIndex = -1) { |
|
|
isJUZ = false; |
|
|
isJUZ = false; |
|
|
|
|
|
clearTimeout(shopTime); |
|
|
if (fIndex == -1) { |
|
|
if (fIndex == -1) { |
|
|
fIndex = Map_QM.util.deviceObj.floor; |
|
|
fIndex = Map_QM.util.deviceObj.floor; |
|
|
} |
|
|
} |
|
|
@ -5793,8 +5888,6 @@ MainMap_QM.prototype = { |
|
|
if (Map_QM.moveFloorbg) { |
|
|
if (Map_QM.moveFloorbg) { |
|
|
Map_QM.moveFloorbg.element.style.display = "none"; |
|
|
Map_QM.moveFloorbg.element.style.display = "none"; |
|
|
} |
|
|
} |
|
|
if (reSet) { |
|
|
|
|
|
//叠层不处理
|
|
|
|
|
|
if (Map_QM.mapArr[Map_QM.util.selectBuild] && Map_QM.mapArr[Map_QM.util.selectBuild].length > 0) { |
|
|
if (Map_QM.mapArr[Map_QM.util.selectBuild] && Map_QM.mapArr[Map_QM.util.selectBuild].length > 0) { |
|
|
for (let i = 0; i < Map_QM.mapArr[Map_QM.util.selectBuild].length; i++) { |
|
|
for (let i = 0; i < Map_QM.mapArr[Map_QM.util.selectBuild].length; i++) { |
|
|
let child = Map_QM.mapArr[Map_QM.util.selectBuild][i].allObj; |
|
|
let child = Map_QM.mapArr[Map_QM.util.selectBuild][i].allObj; |
|
|
@ -5806,8 +5899,7 @@ MainMap_QM.prototype = { |
|
|
Map_QM.mapArr[Map_QM.util.selectBuild][i].findPath.clearPath(); |
|
|
Map_QM.mapArr[Map_QM.util.selectBuild][i].findPath.clearPath(); |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
Map_QM.remove_child(Map_QM.dtLineGroup); |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
TweenMax.killAll(true); |
|
|
TweenMax.killAll(true); |
|
|
}, |
|
|
}, |
|
|
|
|
|
|
|
|
@ -5882,6 +5974,7 @@ MainMap_QM.prototype = { |
|
|
if (!Map_QM.util.overObj.node) { |
|
|
if (!Map_QM.util.overObj.node) { |
|
|
return; |
|
|
return; |
|
|
} |
|
|
} |
|
|
|
|
|
if (Map_QM.util.pathStateObj.isPathState) { |
|
|
Map_QM.util.timeObj.pathTime = setTimeout(() => { |
|
|
Map_QM.util.timeObj.pathTime = setTimeout(() => { |
|
|
clearTimeout(Map_QM.util.timeObj.pathTime); |
|
|
clearTimeout(Map_QM.util.timeObj.pathTime); |
|
|
Map_QM.controls.reset(); |
|
|
Map_QM.controls.reset(); |
|
|
@ -5891,7 +5984,7 @@ MainMap_QM.prototype = { |
|
|
Map_QM.onFindPathToObj(); |
|
|
Map_QM.onFindPathToObj(); |
|
|
} |
|
|
} |
|
|
}, 100); |
|
|
}, 100); |
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
}, |
|
|
}, |
|
|
|
|
|
|
|
|
/** |
|
|
/** |
|
|
@ -6311,7 +6404,7 @@ FloorMap_QM.prototype = { |
|
|
initFloor: function () { |
|
|
initFloor: function () { |
|
|
let floor; |
|
|
let floor; |
|
|
let mapData = Map_QM.util.allMap[this.buildOrder].buildArr[this.floorOrder].mapData; |
|
|
let mapData = Map_QM.util.allMap[this.buildOrder].buildArr[this.floorOrder].mapData; |
|
|
let entColor, borderColor; |
|
|
|
|
|
|
|
|
let entColor, borderColor,floorH=1,buildH=1; |
|
|
if (mapData.floorArea) { |
|
|
if (mapData.floorArea) { |
|
|
floor = Map_QM.util.changeAreaToString(mapData.floorArea); |
|
|
floor = Map_QM.util.changeAreaToString(mapData.floorArea); |
|
|
} |
|
|
} |
|
|
@ -7431,7 +7524,7 @@ var Facilities_QM = function () { |
|
|
shopDiv.src = url; |
|
|
shopDiv.src = url; |
|
|
shopDiv.style.zIndex = 100; |
|
|
shopDiv.style.zIndex = 100; |
|
|
shopDiv.style.width = "1.2vw"; |
|
|
shopDiv.style.width = "1.2vw"; |
|
|
shopDiv.style.display = isShow ? "" : "none"; |
|
|
|
|
|
|
|
|
shopDiv.style.display = isShow ? "block" : "none"; |
|
|
shopDiv.dataset.name = name; |
|
|
shopDiv.dataset.name = name; |
|
|
shopDiv.dataset.src = url; |
|
|
shopDiv.dataset.src = url; |
|
|
shopDiv.dataset.nameEn = nameEn; |
|
|
shopDiv.dataset.nameEn = nameEn; |
|
|
|