|
@@ -66,7 +66,12 @@ EditTools.prototype.loadDone = function(name, data){
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+
|
|
EditTools.prototype.init = function() {
|
|
EditTools.prototype.init = function() {
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+ this.ifLogin();
|
|
|
|
+
|
|
this.hotpoint.init(/* this.n */);
|
|
this.hotpoint.init(/* this.n */);
|
|
var that = this;
|
|
var that = this;
|
|
this.initSaveAll();
|
|
this.initSaveAll();
|
|
@@ -74,8 +79,10 @@ EditTools.prototype.init = function() {
|
|
|
|
|
|
if(player.mode != 'panorama'){
|
|
if(player.mode != 'panorama'){
|
|
$(".toolLeft li[data-name=panoVisible]").addClass('unable')
|
|
$(".toolLeft li[data-name=panoVisible]").addClass('unable')
|
|
- player.once("pano.chosen",()=>{
|
|
|
|
|
|
+ $(".toolLeft li[data-name=routeArrow]").addClass('unable')
|
|
|
|
+ player.once("pano.chosen",()=>{//playerAndModelReady
|
|
$(".toolLeft li[data-name=panoVisible]").removeClass('unable')
|
|
$(".toolLeft li[data-name=panoVisible]").removeClass('unable')
|
|
|
|
+ $(".toolLeft li[data-name=routeArrow]").removeClass('unable')
|
|
})
|
|
})
|
|
}
|
|
}
|
|
|
|
|
|
@@ -184,7 +191,7 @@ EditTools.prototype.init = function() {
|
|
EditTools.prototype.active = function() {
|
|
EditTools.prototype.active = function() {
|
|
var that = this;
|
|
var that = this;
|
|
|
|
|
|
- $('.toolBottom .toolLeft li').click(function() {
|
|
|
|
|
|
+ $('.toolBottom .toolLeft li').click(async function() {
|
|
var name = $(this).data("name");
|
|
var name = $(this).data("name");
|
|
$('.toolLeft li[data-name=' + name + ']').addClass("active").siblings().removeClass("active");
|
|
$('.toolLeft li[data-name=' + name + ']').addClass("active").siblings().removeClass("active");
|
|
$('.toolRight .' + name).removeClass("hide").siblings().addClass("hide");
|
|
$('.toolRight .' + name).removeClass("hide").siblings().addClass("hide");
|
|
@@ -195,11 +202,16 @@ EditTools.prototype.active = function() {
|
|
switch (that.atPanel) {
|
|
switch (that.atPanel) {
|
|
//退出
|
|
//退出
|
|
case "panoVisible":
|
|
case "panoVisible":
|
|
|
|
+ await VisiSet.unsaveWarn()
|
|
|
|
+
|
|
VisiSet.finishSetPanoVisible()
|
|
VisiSet.finishSetPanoVisible()
|
|
break;
|
|
break;
|
|
case "panoLog":
|
|
case "panoLog":
|
|
VisiSet.finishSetPanoLog()
|
|
VisiSet.finishSetPanoLog()
|
|
break;
|
|
break;
|
|
|
|
+ case "routeArrow":
|
|
|
|
+ VisiSet.finishSetRoute()
|
|
|
|
+ break;
|
|
case "screen":
|
|
case "screen":
|
|
confirmSnap.addClass("hide").removeClass("unable");
|
|
confirmSnap.addClass("hide").removeClass("unable");
|
|
snapshotGui.hide();
|
|
snapshotGui.hide();
|
|
@@ -207,7 +219,8 @@ EditTools.prototype.active = function() {
|
|
/* case "overlay":
|
|
/* case "overlay":
|
|
EditOverlay.leave()
|
|
EditOverlay.leave()
|
|
break; */
|
|
break; */
|
|
- case "hotpoint":
|
|
|
|
|
|
+ case "hotpoint":
|
|
|
|
+ await that.hotpoint.unsaveWarn()
|
|
$("#hotpointDetail").hasClass("atRight") || $("#hotpointDetail a.close").click();
|
|
$("#hotpointDetail").hasClass("atRight") || $("#hotpointDetail a.close").click();
|
|
VisiSet.finishSetTagVisible()
|
|
VisiSet.finishSetTagVisible()
|
|
that.hotpoint.wireframeModel.visible = false
|
|
that.hotpoint.wireframeModel.visible = false
|
|
@@ -234,7 +247,10 @@ EditTools.prototype.active = function() {
|
|
$(".toolLeft").addClass("unable")
|
|
$(".toolLeft").addClass("unable")
|
|
VisiSet.enterSet(VisiSet.beginSetPanoLog.bind(VisiSet))
|
|
VisiSet.enterSet(VisiSet.beginSetPanoLog.bind(VisiSet))
|
|
|
|
|
|
- break;
|
|
|
|
|
|
+ break;
|
|
|
|
+ case 'routeArrow':
|
|
|
|
+ VisiSet.enterSet(VisiSet.beginSetRoute.bind(VisiSet))
|
|
|
|
+ break;
|
|
case "screen":
|
|
case "screen":
|
|
confirmSnap.removeClass("hide");
|
|
confirmSnap.removeClass("hide");
|
|
$('#camera-start').text("点此设置为初始画面")
|
|
$('#camera-start').text("点此设置为初始画面")
|
|
@@ -357,7 +373,7 @@ EditTools.prototype.initSaveAll = function() {
|
|
cadBorderWidth: $('#cad-size').val(),
|
|
cadBorderWidth: $('#cad-size').val(),
|
|
showCad: $('input[name="show-cad"]').is(':checked'),
|
|
showCad: $('input[name="show-cad"]').is(':checked'),
|
|
/**********/
|
|
/**********/
|
|
-
|
|
|
|
|
|
+ route: VisiSet.saveRoute(),
|
|
floorPlanAngle: _settings.floorPlanAngle || 0 //俯视图旋转角
|
|
floorPlanAngle: _settings.floorPlanAngle || 0 //俯视图旋转角
|
|
}
|
|
}
|
|
|
|
|
|
@@ -402,7 +418,36 @@ EditTools.prototype.initSaveAll = function() {
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
+EditTools.prototype.ifLogin = function() {//先登录
|
|
|
|
+ if(window.location.href.includes('&localTest'))return //本地 不登录
|
|
|
|
|
|
|
|
+ let url = cmp ? ('/api/scene/roamViable/' + cmp) : '/manage/scene/roamViable'
|
|
|
|
+ //借用漫游可行保存来判断
|
|
|
|
+ $.ajax({
|
|
|
|
+ method: 'POST',
|
|
|
|
+ url: ceshi + url,
|
|
|
|
+ headers: {
|
|
|
|
+ 'Content-Type': 'application/json',
|
|
|
|
+ token: token
|
|
|
|
+ },
|
|
|
|
+ contentType: 'application/json',
|
|
|
|
+ data: JSON.stringify({
|
|
|
|
+ data: '[]',
|
|
|
|
+ sceneCode: window.number
|
|
|
|
+ }),
|
|
|
|
+ success: (data)=>{
|
|
|
|
+ if (data.code === 5001) {
|
|
|
|
+ alert('请重新登录')
|
|
|
|
+ localStorage.dcj_token = ''
|
|
|
|
+ location.reload()
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ ,
|
|
|
|
+ fail: function() {
|
|
|
|
+ console.log('ifLogin failed')
|
|
|
|
+ }
|
|
|
|
+ })
|
|
|
|
+}
|
|
|
|
|
|
|
|
|
|
class EditLabel{
|
|
class EditLabel{
|
|
@@ -516,7 +561,11 @@ class EditLabel{
|
|
|
|
|
|
if(state){
|
|
if(state){
|
|
if(this.editingLabel){
|
|
if(this.editingLabel){
|
|
|
|
+ let old = this.editingLabel
|
|
this.setEditLabel(false, this.editingLabel)
|
|
this.setEditLabel(false, this.editingLabel)
|
|
|
|
+ if(old == label){
|
|
|
|
+ return //点击已打开的就关闭
|
|
|
|
+ }
|
|
}
|
|
}
|
|
label.elem.addClass('selected')
|
|
label.elem.addClass('selected')
|
|
pannel.removeClass('hide')
|
|
pannel.removeClass('hide')
|
|
@@ -1552,10 +1601,10 @@ Hotpoint.prototype.init = function() {
|
|
if(this._scale[this.editSpot.texType]){//恢复大小
|
|
if(this._scale[this.editSpot.texType]){//恢复大小
|
|
this.editSpot.scale.copy(this._scale[this.editSpot.texType]);
|
|
this.editSpot.scale.copy(this._scale[this.editSpot.texType]);
|
|
this.editSpot.info.scale.copy(this._scale[this.editSpot.texType]);
|
|
this.editSpot.info.scale.copy(this._scale[this.editSpot.texType]);
|
|
- }
|
|
|
|
|
|
+ }
|
|
}else{
|
|
}else{
|
|
this.modelList.options.selectFun()
|
|
this.modelList.options.selectFun()
|
|
- this._scale[this.editSpot.texType] = this.editSpot.scale.clone()
|
|
|
|
|
|
+ //this._scale[this.editSpot.texType] = this.editSpot.scale.clone()
|
|
}
|
|
}
|
|
|
|
|
|
}
|
|
}
|
|
@@ -1672,9 +1721,8 @@ Hotpoint.prototype.editHot = function(hot, $li) {
|
|
|
|
|
|
transformControls.transformMenuOptions.updateChoseAtUI({name:'translate'}) //$(".MenuOptions[name='transform'] li[index='translate']").click()//transformControls.transCtlChangeMode("translate")
|
|
transformControls.transformMenuOptions.updateChoseAtUI({name:'translate'}) //$(".MenuOptions[name='transform'] li[index='translate']").click()//transformControls.transCtlChangeMode("translate")
|
|
|
|
|
|
- this.getTempInfo(hot)
|
|
|
|
- hot.visible = true
|
|
|
|
-
|
|
|
|
|
|
+ this.getTempInfo(hot)
|
|
|
|
+ convertTool.updateVisible(hot,'visi',true)
|
|
|
|
|
|
|
|
|
|
this.updatePano()
|
|
this.updatePano()
|
|
@@ -1870,9 +1918,24 @@ Hotpoint.prototype.updatePano = function(){
|
|
this.panoTransformCheckBox.updateChoseAtUI(!!this.editSpot.info.transformAtPanos[getTransformSid()])
|
|
this.panoTransformCheckBox.updateChoseAtUI(!!this.editSpot.info.transformAtPanos[getTransformSid()])
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+Hotpoint.prototype.unsaveWarn = async function(done){//如果在编辑某个热点时触发了结束编辑,询问是否保存
|
|
|
|
+ if(this.editSpot){
|
|
|
|
+ var sure = confirm("是否保存当前热点?")
|
|
|
|
+ if(sure){
|
|
|
|
+ await this.saveHot()
|
|
|
|
+ }
|
|
|
|
+ done && done()
|
|
|
|
+ }else if(VisiSet.setTagVisible && (VisiSet.tagVsetting && VisiSet.saveLastTagVi({getIfChange:true}) || Object.keys(VisiSet.tagVTemp).length)){//修改过
|
|
|
|
+ var sure = confirm("是否保存已编辑的热点可视?")
|
|
|
|
+ if(sure){
|
|
|
|
+ VisiSet.saveTagVisibles()
|
|
|
|
+ }
|
|
|
|
+ done && done()
|
|
|
|
+ }
|
|
|
|
+}
|
|
|
|
+
|
|
|
|
+
|
|
|
|
|
|
-
|
|
|
|
-
|
|
|
|
|
|
|
|
|
|
|
|
var ifSameTex = function(imgs0, imgs1){//是否是相同的图 (两个都是空的不算相同)
|
|
var ifSameTex = function(imgs0, imgs1){//是否是相同的图 (两个都是空的不算相同)
|
|
@@ -2746,15 +2809,20 @@ Hotpoint.prototype.initListSelect = function(){//热点样式图列表
|
|
|
|
|
|
Hotpoint.prototype.switchModel = function(o={}){
|
|
Hotpoint.prototype.switchModel = function(o={}){
|
|
if(o.add){
|
|
if(o.add){
|
|
|
|
+
|
|
|
|
+ if(!$("#remainModelScale")[0].checked || o.spot.plane){//恢复成等大比例,方便用户看清原始比例,否则可能拉伸严重. 但有时换obj后不想重新设置大小可以勾选保持大小。
|
|
|
|
+ var s = 1; //从热点转过来一定恢复比例
|
|
|
|
+ o.spot.scale.set(s,s,s)
|
|
|
|
+ o.spot.info.scale.set(s,s,s)
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+
|
|
var model = o.add.clone();
|
|
var model = o.add.clone();
|
|
o.spot.info.objSrc = o.add.src
|
|
o.spot.info.objSrc = o.add.src
|
|
o.spot.info.objName = o.add.name
|
|
o.spot.info.objName = o.add.name
|
|
o.spot.info.modelBound = o.add.modelBound;
|
|
o.spot.info.modelBound = o.add.modelBound;
|
|
o.spot.addModel(model)
|
|
o.spot.addModel(model)
|
|
- /* var s = 1;//暂时
|
|
|
|
- o.spot.scale.set(s,s,s)//恢复成等大比例,方便用户看清原始比例. 但是换obj后要重新设置大小所以取消
|
|
|
|
- o.spot.info.scale.set(s,s,s) */
|
|
|
|
- //this.updateTransform('scale')
|
|
|
|
|
|
+
|
|
if(o.spot == this.editSpot){
|
|
if(o.spot == this.editSpot){
|
|
transformControls.enableScaleZ()
|
|
transformControls.enableScaleZ()
|
|
}
|
|
}
|
|
@@ -3427,7 +3495,7 @@ Hotpoint.prototype.editDone = function(){
|
|
|
|
|
|
|
|
|
|
// 保存热点信息
|
|
// 保存热点信息
|
|
-Hotpoint.prototype.saveHot = function() {
|
|
|
|
|
|
+Hotpoint.prototype.saveHot = async function() {
|
|
var $layout = $(".edit-loading");
|
|
var $layout = $(".edit-loading");
|
|
var hotpointDetail = this.hotpointDetail;
|
|
var hotpointDetail = this.hotpointDetail;
|
|
|
|
|
|
@@ -3478,8 +3546,7 @@ Hotpoint.prototype.saveHot = function() {
|
|
//获取视频路径
|
|
//获取视频路径
|
|
return new Promise(function(resolve, reject) {
|
|
return new Promise(function(resolve, reject) {
|
|
upload($videos, 'videos', resolve)
|
|
upload($videos, 'videos', resolve)
|
|
- }
|
|
|
|
- )
|
|
|
|
|
|
+ } )
|
|
}).then(function(videoUrls) {
|
|
}).then(function(videoUrls) {
|
|
$layout.removeClass('hide');
|
|
$layout.removeClass('hide');
|
|
args.video = videoUrls
|
|
args.video = videoUrls
|
|
@@ -3622,8 +3689,6 @@ Hotpoint.prototype.saveHot = function() {
|
|
args.position = hot.position.clone()
|
|
args.position = hot.position.clone()
|
|
//hot.position.copy(hot.mesh.position) */
|
|
//hot.position.copy(hot.mesh.position) */
|
|
|
|
|
|
- return args
|
|
|
|
- }).then(function(args) {
|
|
|
|
|
|
|
|
hot.info.texType = hot.texType
|
|
hot.info.texType = hot.texType
|
|
|
|
|
|
@@ -3657,6 +3722,10 @@ Hotpoint.prototype.saveHot = function() {
|
|
that.editDone()
|
|
that.editDone()
|
|
|
|
|
|
that._scale[hot.texType] = hot.scale.clone()
|
|
that._scale[hot.texType] = hot.scale.clone()
|
|
|
|
+
|
|
|
|
+ return new Promise(function(resolve, reject) {
|
|
|
|
+ resolve()
|
|
|
|
+ })
|
|
})
|
|
})
|
|
|
|
|
|
return promise
|
|
return promise
|
|
@@ -5361,13 +5430,13 @@ var VisiSet = {
|
|
})
|
|
})
|
|
|
|
|
|
|
|
|
|
- player.on("mode.changing",(from,to)=>{
|
|
|
|
|
|
+ /* player.on("mode.changing",(from,to)=>{
|
|
if(to == "panorama" && (VisiSet.setPanoVisible || VisiSet.setTagVisible || VisiSet.setPanoLog)){
|
|
if(to == "panorama" && (VisiSet.setPanoVisible || VisiSet.setTagVisible || VisiSet.setPanoLog)){
|
|
VisiSet.finishSetPanoVisible()
|
|
VisiSet.finishSetPanoVisible()
|
|
VisiSet.finishSetTagVisible()
|
|
VisiSet.finishSetTagVisible()
|
|
VisiSet.finishSetPanoLog()
|
|
VisiSet.finishSetPanoLog()
|
|
}
|
|
}
|
|
- })
|
|
|
|
|
|
+ }) */
|
|
|
|
|
|
player.model.on("floor.changed",(toFloor)=>{
|
|
player.model.on("floor.changed",(toFloor)=>{
|
|
if (VisiSet.setPanoVisible || VisiSet.setTagVisible || VisiSet.setPanoLog ){
|
|
if (VisiSet.setPanoVisible || VisiSet.setTagVisible || VisiSet.setPanoLog ){
|
|
@@ -5376,7 +5445,7 @@ var VisiSet = {
|
|
})
|
|
})
|
|
|
|
|
|
player.on("view.changed",(e)=>{
|
|
player.on("view.changed",(e)=>{
|
|
- if(e.cameraChanged && (VisiSet.setPanoVisible || VisiSet.setTagVisible || VisiSet.setPanoLog)){
|
|
|
|
|
|
+ if(e.cameraChanged && (VisiSet.setPanoVisible || VisiSet.setTagVisible || VisiSet.setPanoLog || VisiSet.setRoute)){
|
|
VisiSet.updateFootIconSize();
|
|
VisiSet.updateFootIconSize();
|
|
}
|
|
}
|
|
})
|
|
})
|
|
@@ -5442,7 +5511,39 @@ var VisiSet = {
|
|
}
|
|
}
|
|
})
|
|
})
|
|
|
|
|
|
-
|
|
|
|
|
|
+ //----route-------
|
|
|
|
+
|
|
|
|
+ if(!window.DATA.route) window.DATA.route = {}
|
|
|
|
+ $('#routeShowSwitch input')[0].checked = !window.DATA.route.hide //默认是否展示。 若隐藏也可以通过函数展示
|
|
|
|
+ $("#routeGradual")[0].checked = !!DATA.route.gradualShow
|
|
|
|
+ $("#routeOpaShine")[0].checked = !!DATA.route.opacityShine
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+ this.routeOptions = new MenuOptions({
|
|
|
|
+ dom: $(".toolRight .routeArrow .MenuOptions[name=routeLinkTool] "),
|
|
|
|
+ uiCallBack : (o)=>{
|
|
|
|
+ $(".toolRight .routeArrow .remark[name=ctrl]").text(o.$li.attr("index") == 'link' ?
|
|
|
|
+ '按顺序依次点击点位绘制箭头路线,右键结束绘制。' :
|
|
|
|
+ '点击蓝线以删除路线')
|
|
|
|
+ },
|
|
|
|
+ callbackWhenChose:(o)=>{
|
|
|
|
+ this.routeInfo.operation = o.$li.attr("index") == 'link' ? 'addLink' : 'removeLink'
|
|
|
|
+ }
|
|
|
|
+ })
|
|
|
|
+ this.routeOptions.uiCallBack({$li:this.routeOptions.dom.find('.chosen')})
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+ $(".toolRight .routeArrow button.delete").on("click", ()=>{//清空
|
|
|
|
+ var choice = confirm(`确定删除全部路线吗`);
|
|
|
|
+ if(choice){
|
|
|
|
+ for(let id1 in this.routeInfo.lines){
|
|
|
|
+ for(let id2 in this.routeInfo.lines[id1]){
|
|
|
|
+ this.routeInfo.removeLink(id1,id2)
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ })
|
|
|
|
+
|
|
|
|
|
|
|
|
|
|
},
|
|
},
|
|
@@ -5455,7 +5556,9 @@ var VisiSet = {
|
|
player.flyToMode("floorplan", fun);
|
|
player.flyToMode("floorplan", fun);
|
|
}
|
|
}
|
|
|
|
|
|
- permitTranMode(['dollhouse','floorplan'])
|
|
|
|
|
|
+ permitTranMode(['dollhouse','floorplan','inside'])
|
|
|
|
+ player.cameraControls.controls.panorama.insideLookLimitDown = -60
|
|
|
|
+
|
|
if ( player.modeTran == void 0) {
|
|
if ( player.modeTran == void 0) {
|
|
player.afterCModeFuc = ()=>{
|
|
player.afterCModeFuc = ()=>{
|
|
enter()
|
|
enter()
|
|
@@ -5471,9 +5574,9 @@ var VisiSet = {
|
|
return;
|
|
return;
|
|
this.setPanoLog = true
|
|
this.setPanoLog = true
|
|
this.panosSelect = []
|
|
this.panosSelect = []
|
|
- this.updateFootIconSize()
|
|
|
|
- this.showFootIcons(null, true);
|
|
|
|
|
|
|
|
|
|
+ this.showFootIcons(null, true);
|
|
|
|
+ this.updateFootIconSize()
|
|
|
|
|
|
for(let i in player.model.hots){
|
|
for(let i in player.model.hots){
|
|
player.model.hots[i].visi_ = player.model.hots[i].mesh.visible;
|
|
player.model.hots[i].visi_ = player.model.hots[i].mesh.visible;
|
|
@@ -5482,7 +5585,214 @@ var VisiSet = {
|
|
|
|
|
|
this.changePanoVisi(true)
|
|
this.changePanoVisi(true)
|
|
},
|
|
},
|
|
|
|
+
|
|
|
|
+ beginSetRoute: function(){
|
|
|
|
+ if(this.setRoute)return
|
|
|
|
+ this.setRoute = true
|
|
|
|
+ this.showFootIcons(null, true);
|
|
|
|
+ this.updateFootIconSize()
|
|
|
|
+
|
|
|
|
+ for(let i in player.model.hots){
|
|
|
|
+ player.model.hots[i].visi_ = player.model.hots[i].mesh.visible;
|
|
|
|
+ player.model.hots[i].mesh.visible = false
|
|
|
|
+ }
|
|
|
|
+ this.changePanoVisi(true)
|
|
|
|
+ //permitTranMode(['inside','dollhouse','floorplan'])
|
|
|
|
+ if(!this.routeInfo){
|
|
|
|
+
|
|
|
|
+ let color = '#409eff'
|
|
|
|
+ let lineMat = new THREE.LineBasicMaterial({color,depthTest:false})
|
|
|
|
+ /* let arrow = new THREE.Mesh(new THREE.PlaneGeometry(0.3,0.3,1,1), new THREE.MeshBasicMaterial({
|
|
|
|
+ map: Texture.load("images/introduce_open.png"),//style_jump
|
|
|
|
+ transparent:true,
|
|
|
|
+ depthTest:false,
|
|
|
|
+ color,
|
|
|
|
+ side: 2
|
|
|
|
+ }))
|
|
|
|
+ arrow.rotation.x = Math.PI / 2 //朝上 */
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+ let moveLine = (line,p1,p2)=>{
|
|
|
|
+ LineDraw.moveLine(line, [p1,p2] )
|
|
|
|
+ //arrow:
|
|
|
|
+ line.children[0].position.copy(new THREE.Vector3().addVectors(p1,p2).multiplyScalar(.5))
|
|
|
|
+ //this.lineAdding.children[0].rotateOnAxis()
|
|
|
|
+ //line.children[0].rotation.y = -new THREE.Vector2(p1.x - p2.x, p1.z - p2.z).angle() + Math.PI/2
|
|
|
|
+ line.children[0].lookAt(p1)
|
|
|
|
+ line.children[1].position.copy(line.children[0].position)
|
|
|
|
+ line.children[1].rotation.copy(line.children[0].rotation)
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ this.routeInfo = {
|
|
|
|
+ lines : {},
|
|
|
|
+ panoStart : null,
|
|
|
|
+ plane : new THREE.Plane(),
|
|
|
|
+ lineAdding : null,//用于连接的线
|
|
|
|
+ lineMat,
|
|
|
|
+ operation : 'addLink',//or removeLink
|
|
|
|
+ events : {
|
|
|
|
+ viewChange: (e)=>{
|
|
|
|
+ if(e.cameraChanged && this.routeInfo.panoStart){
|
|
|
|
+ this.routeInfo.updatePlane()
|
|
|
|
+ }
|
|
|
|
+ },
|
|
|
|
+ pointerMove: ()=>{
|
|
|
|
+ if(!this.routeInfo.panoStart)return
|
|
|
|
+ let endPos = player.intersect ? player.intersect.point : player.raycaster.ray.intersectPlane(this.routeInfo.plane)
|
|
|
|
+ moveLine(this.lineAdding, this.routeInfo.panoStart.floorPosition, endPos)
|
|
|
|
+
|
|
|
|
+ },
|
|
|
|
+ click: (e)=>{//右键取消 (但拖拽后也会取消,因为右键mousedown不会触发事件,不好写算了)
|
|
|
|
+ e.button == 2 && /*player.mouseCouldBeClickToMove && */ this.routeInfo.cancel()
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ },
|
|
|
|
+ updatePlane: ()=>{
|
|
|
|
+ let nor = player.getDirection()
|
|
|
|
+ this.routeInfo.plane.setFromNormalAndCoplanarPoint(nor, this.routeInfo.panoStart.floorPosition)
|
|
|
|
+ },
|
|
|
|
+ cancel: ()=>{
|
|
|
|
+ if(this.lineAdding){
|
|
|
|
+ this.lineAdding.parent.remove(this.lineAdding)
|
|
|
|
+ this.lineAdding = null
|
|
|
|
+ this.routeInfo.panoStart = null;
|
|
|
|
+ }
|
|
|
|
+ },
|
|
|
|
+ addLink: (id1,id2,line)=>{
|
|
|
|
+ this.routeInfo.lines[id1] || (this.routeInfo.lines[id1] = {})
|
|
|
|
+ this.routeInfo.lines[id1][id2] = line
|
|
|
|
+ line.name = 'routeLine:'+ id1 + '->' +id2
|
|
|
|
+ moveLine(line, player.model.panos.index[id1].floorPosition, player.model.panos.index[id2].floorPosition)
|
|
|
|
+ },
|
|
|
|
+ addLine: (startPos=new THREE.Vector3)=>{
|
|
|
|
+ let line = LineDraw.createLine([startPos,startPos], {mat: this.routeInfo.lineMat})
|
|
|
|
+ //let arrow = this.routeInfo.arrow.clone()
|
|
|
|
+ let s = 0.15
|
|
|
|
+ let arrowLeft = LineDraw.createLine([new THREE.Vector3, new THREE.Vector3(-s,0,s)], {mat: lineMat})
|
|
|
|
+ let arrowRight = LineDraw.createLine([new THREE.Vector3, new THREE.Vector3(s,0,s)], {mat: lineMat})
|
|
|
|
+ line.add(arrowLeft), line.add(arrowRight)
|
|
|
|
+ arrowLeft.position.copy(startPos), arrowRight.position.copy(startPos)
|
|
|
|
+ arrowLeft.renderOrder = arrowRight.renderOrder = 7
|
|
|
|
+ this.meshGroup.add(line)
|
|
|
|
+ return line
|
|
|
|
+ },
|
|
|
|
+ removeLink: (id1,id2)=>{
|
|
|
|
+ this.routeInfo.lines[id1][id2].parent.remove(this.routeInfo.lines[id1][id2])
|
|
|
|
+ delete this.routeInfo.lines[id1][id2]
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+ //初始化绘制
|
|
|
|
+ /* for(let id1 in player.model.panos.routeNextMap){
|
|
|
|
+ for(let pano2 of player.model.panos.routeNextMap[id1]){
|
|
|
|
+ let line = this.routeInfo.addLine()
|
|
|
|
+ this.routeInfo.addLink(id1,pano2.id,line)
|
|
|
|
+ }
|
|
|
|
+ } */
|
|
|
|
+
|
|
|
|
+ if(window.DATA.route){
|
|
|
|
+ for(let id1 in window.DATA.route.data){
|
|
|
|
+ for(let id2 of window.DATA.route.data[id1]){
|
|
|
|
+ let line = this.routeInfo.addLine()
|
|
|
|
+ this.routeInfo.addLink(id1,id2,line)
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ }else{
|
|
|
|
+ for(let id1 in this.routeInfo.lines){
|
|
|
|
+ for(let id2 in this.routeInfo.lines[id1]){
|
|
|
|
+ let line = this.routeInfo.lines[id1][id2]
|
|
|
|
+ line.visible = true
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ player.on("view.changed",this.routeInfo.events.viewChange)
|
|
|
|
+ player.domElement.addEventListener("pointermove",this.routeInfo.events.pointerMove)
|
|
|
|
+ player.domElement.addEventListener("pointerup",this.routeInfo.events.click)
|
|
|
|
+ },
|
|
|
|
+
|
|
|
|
+ dealRouteClick: function(object){
|
|
|
|
+
|
|
|
|
+ if(this.routeInfo.operation == 'addLink'){
|
|
|
|
+ var id = object.name == '' ? object.parent.name : object.name
|
|
|
|
+ var panos = player.model.panos;
|
|
|
|
+ if(panos.index[id]){
|
|
|
|
+ if(this.routeInfo.panoStart){
|
|
|
|
+ if(this.routeInfo.panoStart == panos.index[id])return
|
|
|
|
+
|
|
|
|
+ this.routeInfo.addLink(this.routeInfo.panoStart.id, id, this.lineAdding)
|
|
|
|
+ //this.lineAdding = null
|
|
|
|
+ //this.routeInfo.panoStart = null;
|
|
|
|
+ }
|
|
|
|
+ //}else{
|
|
|
|
+ this.routeInfo.panoStart = panos.index[id]
|
|
|
|
+ this.lineAdding = this.routeInfo.addLine(this.routeInfo.panoStart.floorPosition)
|
|
|
|
+ this.routeInfo.updatePlane()
|
|
|
|
+
|
|
|
|
+ //}
|
|
|
|
+ }
|
|
|
|
+ }else if(this.routeInfo.operation == 'removeLink'){
|
|
|
|
+ let name = object.name || object.parent.name
|
|
|
|
+ if(name.slice(0,10) == 'routeLine:'){
|
|
|
|
+ let id = name.slice(10).split('->');
|
|
|
|
+ this.routeInfo.removeLink(id[0], id[1])
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ }
|
|
|
|
+ },
|
|
|
|
+
|
|
|
|
+ finishSetRoute: function(){
|
|
|
|
+
|
|
|
|
+ this.setRoute = false
|
|
|
|
+ player.removeListener("view.changed",this.routeInfo.events.viewChange)
|
|
|
|
+ player.domElement.removeEventListener("pointermove",this.routeInfo.events.pointerMove)
|
|
|
|
+ this.changePanoVisi(false)
|
|
|
|
+ permitTranMode(true)
|
|
|
|
+ player.cameraControls.controls.panorama.insideLookLimitDown = null
|
|
|
|
+ for(let i in player.model.hots){
|
|
|
|
+ player.model.hots[i].mesh.visible = player.model.hots[i].visi_
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ for(let id1 in this.routeInfo.lines){
|
|
|
|
+ for(let id2 in this.routeInfo.lines[id1]){
|
|
|
|
+ let line = this.routeInfo.lines[id1][id2]
|
|
|
|
+ //line.parent.removeChild(line)
|
|
|
|
+ line.visible = false
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ this.routeInfo.cancel()
|
|
|
|
+ },
|
|
|
|
+ saveRoute : function(){
|
|
|
|
+
|
|
|
|
+ let data = {}
|
|
|
|
+ if(this.routeInfo){
|
|
|
|
+ for(let id1 in this.routeInfo.lines){
|
|
|
|
+ let ids = Object.keys(this.routeInfo.lines[id1])
|
|
|
|
+ if(ids.length > 0) data[id1] = Object.keys(this.routeInfo.lines[id1])
|
|
|
|
+ }
|
|
|
|
+ }else{
|
|
|
|
+ return window.DATA.route
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ return {
|
|
|
|
+ data,
|
|
|
|
+ hide: $('#routeShowSwitch input').prop('checked') ? 0:1,
|
|
|
|
+ gradualShow: $("#routeGradual").is(':checked') ? 1:0,
|
|
|
|
+ opacityShine: $("#routeOpaShine").is(':checked') ? 1:0,
|
|
|
|
+ }
|
|
|
|
+ //点击总保存按钮后才会保存,然后直接刷新
|
|
|
|
+ },
|
|
|
|
|
|
|
|
+
|
|
changePanoVisi:function(state, toFloor){
|
|
changePanoVisi:function(state, toFloor){
|
|
var floor = player.model.allFloorsVisible ? 'all' : (toFloor || player.model.currentFloor)
|
|
var floor = player.model.allFloorsVisible ? 'all' : (toFloor || player.model.currentFloor)
|
|
if(this.setPanoVisible){
|
|
if(this.setPanoVisible){
|
|
@@ -5518,7 +5828,7 @@ var VisiSet = {
|
|
player.flyoutType = null
|
|
player.flyoutType = null
|
|
|
|
|
|
permitTranMode(true)
|
|
permitTranMode(true)
|
|
-
|
|
|
|
|
|
+ player.cameraControls.controls.panorama.insideLookLimitDown = null
|
|
|
|
|
|
for(let i in player.model.hots){
|
|
for(let i in player.model.hots){
|
|
player.model.hots[i].mesh.visible = player.model.hots[i].visi_
|
|
player.model.hots[i].mesh.visible = player.model.hots[i].visi_
|
|
@@ -5571,7 +5881,7 @@ var VisiSet = {
|
|
//objects.tagManager.hideAllTags();
|
|
//objects.tagManager.hideAllTags();
|
|
|
|
|
|
this.setDisplay(true)
|
|
this.setDisplay(true)
|
|
-
|
|
|
|
|
|
+ this.changePanoVisi(true)
|
|
|
|
|
|
this.updateFootIconSize()
|
|
this.updateFootIconSize()
|
|
//更新一下大小,尤其是上次换了中心点然后退出又进入但是镜头没有变化的话
|
|
//更新一下大小,尤其是上次换了中心点然后退出又进入但是镜头没有变化的话
|
|
@@ -5627,7 +5937,9 @@ var VisiSet = {
|
|
}
|
|
}
|
|
/* } */
|
|
/* } */
|
|
|
|
|
|
-
|
|
|
|
|
|
+ if(o.onlyGetData){
|
|
|
|
+ return change
|
|
|
|
+ }
|
|
|
|
|
|
if (change.length) {
|
|
if (change.length) {
|
|
//添加双向的neighbour:
|
|
//添加双向的neighbour:
|
|
@@ -5720,8 +6032,9 @@ var VisiSet = {
|
|
player.flyoutType = null
|
|
player.flyoutType = null
|
|
this.$confirmSnap.addClass("hide")
|
|
this.$confirmSnap.addClass("hide")
|
|
permitTranMode(true)
|
|
permitTranMode(true)
|
|
|
|
+ player.cameraControls.controls.panorama.insideLookLimitDown = null
|
|
this.setDisplay(false)
|
|
this.setDisplay(false)
|
|
-
|
|
|
|
|
|
+ this.changePanoVisi(false)
|
|
for(let i in player.model.hots){
|
|
for(let i in player.model.hots){
|
|
player.model.hots[i].mesh.visible = player.model.hots[i].visi_
|
|
player.model.hots[i].mesh.visible = player.model.hots[i].visi_
|
|
}
|
|
}
|
|
@@ -5780,7 +6093,7 @@ var VisiSet = {
|
|
},
|
|
},
|
|
|
|
|
|
//最佳推荐操作顺序: 先设置pano可见性 再创建热点 这样热点的visible正确些,否则之后再设置热点可见性会改更多
|
|
//最佳推荐操作顺序: 先设置pano可见性 再创建热点 这样热点的visible正确些,否则之后再设置热点可见性会改更多
|
|
- savePanoVisibles: function() {
|
|
|
|
|
|
+ savePanoVisibles: async function() {
|
|
//保存
|
|
//保存
|
|
|
|
|
|
if (this.panoVsetting)
|
|
if (this.panoVsetting)
|
|
@@ -5808,37 +6121,39 @@ var VisiSet = {
|
|
console.log(JSON.stringify(PanoData)) */
|
|
console.log(JSON.stringify(PanoData)) */
|
|
|
|
|
|
let url = cmp ? ('/api/scene/roamViable/' + cmp) : '/manage/scene/roamViable'
|
|
let url = cmp ? ('/api/scene/roamViable/' + cmp) : '/manage/scene/roamViable'
|
|
-
|
|
|
|
- $.ajax({
|
|
|
|
- method: 'POST',
|
|
|
|
- url: ceshi + url,
|
|
|
|
- headers: {
|
|
|
|
- 'Content-Type': 'application/json',
|
|
|
|
- token: token
|
|
|
|
- },
|
|
|
|
- contentType: 'application/json',
|
|
|
|
- data: JSON.stringify({
|
|
|
|
- data: JSON.stringify(PanoData),
|
|
|
|
- sceneCode: window.number
|
|
|
|
- }),
|
|
|
|
- success: (data)=>{
|
|
|
|
- if (data.code === 0) {
|
|
|
|
- this.afterSavePanoVisibles()
|
|
|
|
- alert("保存漫游可行成功")
|
|
|
|
- } else
|
|
|
|
|
|
+ return new Promise((resolve,reject)=>{
|
|
|
|
+ $.ajax({
|
|
|
|
+ method: 'POST',
|
|
|
|
+ url: ceshi + url,
|
|
|
|
+ headers: {
|
|
|
|
+ 'Content-Type': 'application/json',
|
|
|
|
+ token: token
|
|
|
|
+ },
|
|
|
|
+ contentType: 'application/json',
|
|
|
|
+ data: JSON.stringify({
|
|
|
|
+ data: JSON.stringify(PanoData),
|
|
|
|
+ sceneCode: window.number
|
|
|
|
+ }),
|
|
|
|
+ success: (data)=>{
|
|
|
|
+ if (data.code === 0) {
|
|
|
|
+ this.afterSavePanoVisibles()
|
|
|
|
+ alert("保存漫游可行成功")
|
|
|
|
+ } else
|
|
|
|
+ alert("保存漫游可行失败")
|
|
|
|
+ if (data.code === 5001) {
|
|
|
|
+ alert('请重新登录')
|
|
|
|
+ localStorage.dcj_token = ''
|
|
|
|
+ location.reload()
|
|
|
|
+ }
|
|
|
|
+ resolve()
|
|
|
|
+ }
|
|
|
|
+ ,
|
|
|
|
+ fail: function() {
|
|
alert("保存漫游可行失败")
|
|
alert("保存漫游可行失败")
|
|
- if (data.code === 5001) {
|
|
|
|
- alert('请重新登录')
|
|
|
|
- localStorage.dcj_token = ''
|
|
|
|
- location.reload()
|
|
|
|
|
|
+ reject()
|
|
}
|
|
}
|
|
- }
|
|
|
|
- ,
|
|
|
|
- fail: function() {
|
|
|
|
- alert("保存漫游可行失败")
|
|
|
|
- }
|
|
|
|
|
|
+ })
|
|
})
|
|
})
|
|
-
|
|
|
|
},
|
|
},
|
|
|
|
|
|
searchNeib: function(panoId) {
|
|
searchNeib: function(panoId) {
|
|
@@ -5881,7 +6196,7 @@ var VisiSet = {
|
|
|
|
|
|
player.path.currentPanoMarker.mesh.visible = !state;
|
|
player.path.currentPanoMarker.mesh.visible = !state;
|
|
player.reticule.visible = !state;
|
|
player.reticule.visible = !state;
|
|
- this.changePanoVisi(state)
|
|
|
|
|
|
+
|
|
},
|
|
},
|
|
|
|
|
|
delVisibleLines: function() {
|
|
delVisibleLines: function() {
|
|
@@ -6236,19 +6551,15 @@ var VisiSet = {
|
|
//this.tagVsetting.setElemType(this.tagVsetting.style, this.tagVsetting.styleImageURL);
|
|
//this.tagVsetting.setElemType(this.tagVsetting.style, this.tagVsetting.styleImageURL);
|
|
}
|
|
}
|
|
|
|
|
|
- this.tagVsetting = tag;
|
|
|
|
- //记录正在修改的
|
|
|
|
- this.delVisibleLines();
|
|
|
|
- //删除线
|
|
|
|
- this.showFootIcons(player.currentPano);
|
|
|
|
|
|
+ this.tagVsetting = tag; //记录正在修改的
|
|
|
|
+ this.delVisibleLines(); //删除线
|
|
|
|
+ this.showFootIcons(player.currentPano);//显示、修改pano颜色
|
|
this.changePanoVisi(true)
|
|
this.changePanoVisi(true)
|
|
- this.createTagVisiLines(tag);
|
|
|
|
- //创线
|
|
|
|
|
|
+ this.createTagVisiLines(tag); //创线
|
|
|
|
|
|
- this.updateFootIconSize()
|
|
|
|
- //更新一下大小,尤其是上次换了中心点然后退出又进入但是镜头没有变化的话
|
|
|
|
|
|
+ this.updateFootIconSize() //更新一下大小,尤其是上次换了中心点然后退出又进入但是镜头没有变化的话
|
|
},
|
|
},
|
|
- saveLastTagVi: function() {
|
|
|
|
|
|
+ saveLastTagVi: function(o={}) {
|
|
//保存刚设置过的tag
|
|
//保存刚设置过的tag
|
|
var change = false;
|
|
var change = false;
|
|
var newVPs = this.tagVTemp[this.tagVsetting.sid] || this.tagVsetting.info.visiblePanos.slice(0);
|
|
var newVPs = this.tagVTemp[this.tagVsetting.sid] || this.tagVsetting.info.visiblePanos.slice(0);
|
|
@@ -6271,6 +6582,9 @@ var VisiSet = {
|
|
//console.log("sub: "+r)
|
|
//console.log("sub: "+r)
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
+ if(o.getIfChange){
|
|
|
|
+ return change
|
|
|
|
+ }
|
|
if (change) {
|
|
if (change) {
|
|
this.tagVTemp[this.tagVsetting.sid] = newVPs;
|
|
this.tagVTemp[this.tagVsetting.sid] = newVPs;
|
|
}
|
|
}
|
|
@@ -6298,6 +6612,7 @@ var VisiSet = {
|
|
this.setDisplay(false)
|
|
this.setDisplay(false)
|
|
this.$confirmSnap.addClass("hide")
|
|
this.$confirmSnap.addClass("hide")
|
|
permitTranMode(true)
|
|
permitTranMode(true)
|
|
|
|
+ player.cameraControls.controls.panorama.insideLookLimitDown = null
|
|
/* for (var r in objects.tagManager.tags) {
|
|
/* for (var r in objects.tagManager.tags) {
|
|
if(objects.tagManager.tags[r].state == "videoPanoFlag")continue;
|
|
if(objects.tagManager.tags[r].state == "videoPanoFlag")continue;
|
|
objects.tagManager.tags[r].disc.visible = false;
|
|
objects.tagManager.tags[r].disc.visible = false;
|
|
@@ -6370,7 +6685,15 @@ var VisiSet = {
|
|
}
|
|
}
|
|
},
|
|
},
|
|
//------------
|
|
//------------
|
|
-
|
|
|
|
|
|
+ unsaveWarn:async function(done){
|
|
|
|
+ if(VisiSet.setPanoVisible && (VisiSet.panoVsetting && VisiSet.saveLastPanoVi({onlyGetData:true}).length || Object.keys(VisiSet.panoVTemp).length)){//修改过
|
|
|
|
+ var sure = confirm("是否保存已编辑的漫游可视?")
|
|
|
|
+ if(sure){
|
|
|
|
+ await VisiSet.savePanoVisibles()
|
|
|
|
+ }
|
|
|
|
+ done && done()
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
|
|
|
|
|
|
|
|
|