Browse Source

feat: 更新地图SDK

ShangHai_LongXiang
jiannibang 3 years ago
parent
commit
bad56fba03
  1. 2
      public/index.html
  2. BIN
      public/static/img/model/honglvdeng.glb
  3. BIN
      public/static/img/model/jt_left.glb
  4. BIN
      public/static/img/model/jt_left_up.glb
  5. BIN
      public/static/img/model/jt_right.glb
  6. BIN
      public/static/img/model/jt_right_up.glb
  7. BIN
      public/static/img/model/jt_turn.glb
  8. BIN
      public/static/img/model/jt_up.glb
  9. BIN
      public/static/img/model/ludeng.glb
  10. BIN
      public/static/img/model/taiyangsan.glb
  11. 342
      public/static/qm/MainMap_QM_go.js

2
public/index.html

@ -7,7 +7,7 @@
<link rel="icon" href="<%= BASE_URL %>favicon.ico" /> <link rel="icon" href="<%= BASE_URL %>favicon.ico" />
<title><%= htmlWebpackPlugin.options.title %></title> <title><%= htmlWebpackPlugin.options.title %></title>
<script type="text/javascript" src="./static/qm/three.js"></script> <script type="text/javascript" src="./static/qm/three.js"></script>
<script type="text/javascript" src="./static/qm/MainMap_QM.js"></script>
<script type="text/javascript" src="./static/qm/MainMap_QM_go.js"></script>
</head> </head>
<body> <body>
<noscript> <noscript>

BIN
public/static/img/model/honglvdeng.glb

Binary file not shown.

BIN
public/static/img/model/jt_left.glb

Binary file not shown.

BIN
public/static/img/model/jt_left_up.glb

Binary file not shown.

BIN
public/static/img/model/jt_right.glb

Binary file not shown.

BIN
public/static/img/model/jt_right_up.glb

Binary file not shown.

BIN
public/static/img/model/jt_turn.glb

Binary file not shown.

BIN
public/static/img/model/jt_up.glb

Binary file not shown.

BIN
public/static/img/model/ludeng.glb

Binary file not shown.

BIN
public/static/img/model/taiyangsan.glb

Binary file not shown.

342
public/static/qm/MainMap_QM.js → public/static/qm/MainMap_QM_go.js

@ -27,8 +27,8 @@ var typeObj = [{ ft: 0, type: 0, code: 'ft', name: '扶梯' }, { upft: 1, type:
{ mzjd: 115, type: 115, code: 'mzjd', name: '门诊综合接待室' }, { hd: 116, type: 116, code: 'hd', name: '活动点' }, { bsl: 117, type: 117, code: 'bsl', name: '白石龙' }]; { mzjd: 115, type: 115, code: 'mzjd', name: '门诊综合接待室' }, { hd: 116, type: 116, code: 'hd', name: '活动点' }, { bsl: 117, type: 117, code: 'bsl', name: '白石龙' }];
QMUtil = function () { QMUtil = function () {
this.shopServerInfo = "static/offline/JSON/QueryShopList.json";
this.mapServerInfo = "static/offline/JSON/GetMapInfo.json";
this.shopServerInfo = "static/offline/JSON/getMapInfo.json";
this.mapServerInfo = "static/offline/JSON/getMap.json";
this.beforPath = "./"; this.beforPath = "./";
this.options = { this.options = {
playSpeed: 6, //动画播放速度 playSpeed: 6, //动画播放速度
@ -97,37 +97,47 @@ QMUtil = function () {
*/ */
this.modelArr = []; this.modelArr = [];
this.modelStr = [ //种树 this.modelStr = [ //种树
{ 'key': 'tree', 'url': 'static/img/model/tree.gltf', 'colorModel': 'line', 'rot': { 'x': 1.5708, 'y': 0, 'z': 0 }, 'size': { 'x': 1, 'y': 1, 'z': 1 } },
{ 'key': 'tree2', 'url': 'static/img/model/tree2.glb', 'colorModel': 'gama', 'rot': { 'x': 1.5708, 'y': 0, 'z': 0 }, 'size': { 'x': 20, 'y': 20, 'z': 20 } },
{ 'key': 'huatan1', 'url': 'static/img/model/huatan1.glb', 'colorModel': 'gama', 'rot': { 'x': 1.5708, 'y': 0, 'z': 0 }, 'size': { 'x': 20, 'y': 20, 'z': 20 } },
{ 'key': 'huatan2', 'url': 'static/img/model/huatan2.glb', 'colorModel': 'gama', 'rot': { 'x': 1.5708, 'y': 0, 'z': 0 }, 'size': { 'x': 20, 'y': 20, 'z': 20 } },
{ 'key': 'penquan2', 'url': 'static/img/model/penquan2.glb', 'colorModel': 'gama', 'rot': { 'x': 1.5708, 'y': 0, 'z': 0 }, 'size': { 'x': 20, 'y': 20, 'z': 20 } },
{ 'key': 'qiche1', 'url': 'static/img/model/qiche1.glb', 'colorModel': 'gama', 'rot': { 'x': 1.5708, 'y': 0, 'z': 0 }, 'size': { 'x': 20, 'y': 20, 'z': 20 } },
{ 'key': 'qiche2', 'url': 'static/img/model/qiche2.glb', 'colorModel': 'gama', 'rot': { 'x': 1.5708, 'y': 0, 'z': 0 }, 'size': { 'x': 20, 'y': 20, 'z': 20 } },
{ 'key': 'qiche3', 'url': 'static/img/model/qiche3.glb', 'colorModel': 'gama', 'rot': { 'x': 1.5708, 'y': 0, 'z': 0 }, 'size': { 'x': 20, 'y': 20, 'z': 20 } },
{ 'key': 'qiche4', 'url': 'static/img/model/qiche4.glb', 'colorModel': 'gama', 'rot': { 'x': 1.5708, 'y': 0, 'z': 0 }, 'size': { 'x': 20, 'y': 20, 'z': 20 } },
{ 'key': 'qiche5', 'url': 'static/img/model/qiche5.glb', 'colorModel': 'gama', 'rot': { 'x': 1.5708, 'y': 0, 'z': 0 }, 'size': { 'x': 20, 'y': 20, 'z': 20 } },
{ 'key': 'qiche6', 'url': 'static/img/model/qiche6.glb', 'colorModel': 'gama', 'rot': { 'x': 1.5708, 'y': 0, 'z': 0 }, 'size': { 'x': 20, 'y': 20, 'z': 20 } },
{ 'key': 'qiche7', 'url': 'static/img/model/qiche7.glb', 'colorModel': 'gama', 'rot': { 'x': 1.5708, 'y': 0, 'z': 0 }, 'size': { 'x': 20, 'y': 20, 'z': 20 } },
{ 'key': 'qiche8', 'url': 'static/img/model/qiche8.glb', 'colorModel': 'gama', 'rot': { 'x': 1.5708, 'y': 0, 'z': 0 }, 'size': { 'x': 20, 'y': 20, 'z': 20 } },
{ 'key': 'qiche9', 'url': 'static/img/model/qiche9.glb', 'colorModel': 'gama', 'rot': { 'x': 1.5708, 'y': 0, 'z': 0 }, 'size': { 'x': 20, 'y': 20, 'z': 20 } },
{ 'key': 'chongdianzhuang', 'url': 'static/img/model/chongdianzhuang.glb', 'colorModel': 'gama', 'rot': { 'x': 1.5708, 'y': 0, 'z': 0 }, 'size': { 'x': 20, 'y': 20, 'z': 20 } },
{ 'key': 'IDS_H', 'url': 'static/img/model/IDS_H.glb', 'colorModel': 'gama', 'rot': { 'x': 1.5708, 'y': 0, 'z': 0 }, 'size': { 'x': 20, 'y': 20, 'z': 20 } },
{ 'key': 'IDS_V', 'url': 'static/img/model/IDS_V.glb', 'colorModel': 'gama', 'rot': { 'x': 1.5708, 'y': 0, 'z': 0 }, 'size': { 'x': 20, 'y': 20, 'z': 20 } },
{ 'key': 'xiaofangshuan', 'url': 'static/img/model/xiaofangshuan.glb', 'colorModel': 'gama', 'rot': { 'x': 1.5708, 'y': 0, 'z': 0 }, 'size': { 'x': 20, 'y': 20, 'z': 20 } },
{ 'key': 'tingchechang', 'url': 'static/img/model/tingchechang.glb', 'colorModel': 'gama', 'rot': { 'x': 1.5708, 'y': 0, 'z': 0 }, 'size': { 'x': 20, 'y': 20, 'z': 20 } },
{ 'key': 'chechanglangan', 'url': 'static/img/model/chechanglangan.glb', 'colorModel': 'gama', 'rot': { 'x': 1.5708, 'y': 0, 'z': 0 }, 'size': { 'x': 20, 'y': 20, 'z': 20 } },
{ 'key': 'bangongyi', 'url': 'static/img/model/bangongyi.glb', 'colorModel': 'gama', 'rot': { 'x': 1.5708, 'y': 0, 'z': 0 }, 'size': { 'x': 20, 'y': 20, 'z': 20 } },
{ 'key': 'lvzhi', 'url': 'static/img/model/lvzhi.glb', 'colorModel': 'gama', 'rot': { 'x': 1.5708, 'y': 0, 'z': 0 }, 'size': { 'x': 20, 'y': 20, 'z': 20 } },
{ 'key': 'ren1', 'url': 'static/img/model/ren1.glb', 'colorModel': 'gama', 'rot': { 'x': 1.5708, 'y': 0, 'z': 0 }, 'size': { 'x': 20, 'y': 20, 'z': 20 } },
{ 'key': 'ren2', 'url': 'static/img/model/ren2.glb', 'colorModel': 'gama', 'rot': { 'x': 1.5708, 'y': 0, 'z': 0 }, 'size': { 'x': 20, 'y': 20, 'z': 20 } },
{ 'key': 'ren3', 'url': 'static/img/model/ren3.glb', 'colorModel': 'gama', 'rot': { 'x': 1.5708, 'y': 0, 'z': 0 }, 'size': { 'x': 20, 'y': 20, 'z': 20 } },
{ 'key': 'ren4', 'url': 'static/img/model/ren4.glb', 'colorModel': 'gama', 'rot': { 'x': 1.5708, 'y': 0, 'z': 0 }, 'size': { 'x': 20, 'y': 20, 'z': 20 } },
{ 'key': 'ren5', 'url': 'static/img/model/ren5.glb', 'colorModel': 'gama', 'rot': { 'x': 1.5708, 'y': 0, 'z': 0 }, 'size': { 'x': 20, 'y': 20, 'z': 20 } },
{ 'key': 'ren6', 'url': 'static/img/model/ren6.glb', 'colorModel': 'gama', 'rot': { 'x': 1.5708, 'y': 0, 'z': 0 }, 'size': { 'x': 20, 'y': 20, 'z': 20 } },
{ 'key': 'yizi1', 'url': 'static/img/model/yizi1.glb', 'colorModel': 'gama', 'rot': { 'x': 1.5708, 'y': 0, 'z': 0 }, 'size': { 'x': 20, 'y': 20, 'z': 20 } },
{ 'key': 'gjz1', 'url': 'static/img/model/gjz1.glb', 'colorModel': 'gama', 'rot': { 'x': 1.5708, 'y': 0, 'z': 0 }, 'size': { 'x': 20, 'y': 20, 'z': 20 } }
{ 'key': 'tree', 'url': 'static/img/model/tree.gltf', 'colorModel': 'line', 'rot': { 'x': 1.5708, 'y': 0, 'z': 0 }, 'size': { 'x': 1, 'y': 1, 'z': 1 }, 'load':false},
{ 'key': 'tree2', 'url': 'static/img/model/tree2.glb', 'colorModel': 'gama', 'rot': { 'x': 1.5708, 'y': 0, 'z': 0 }, 'size': { 'x': 20, 'y': 20, 'z': 20 }, 'load':false},
{ 'key': 'huatan1', 'url': 'static/img/model/huatan1.glb', 'colorModel': 'gama', 'rot': { 'x': 1.5708, 'y': 0, 'z': 0 }, 'size': { 'x': 20, 'y': 20, 'z': 20 }, 'load':false},
{ 'key': 'huatan2', 'url': 'static/img/model/huatan2.glb', 'colorModel': 'gama', 'rot': { 'x': 1.5708, 'y': 0, 'z': 0 }, 'size': { 'x': 20, 'y': 20, 'z': 20 }, 'load':false},
{ 'key': 'penquan2', 'url': 'static/img/model/penquan2.glb', 'colorModel': 'gama', 'rot': { 'x': 1.5708, 'y': 0, 'z': 0 }, 'size': { 'x': 20, 'y': 20, 'z': 20 }, 'load':false},
{ 'key': 'qiche1', 'url': 'static/img/model/qiche1.glb', 'colorModel': 'gama', 'rot': { 'x': 1.5708, 'y': 0, 'z': 0 }, 'size': { 'x': 20, 'y': 20, 'z': 20 }, 'load':false},
{ 'key': 'qiche2', 'url': 'static/img/model/qiche2.glb', 'colorModel': 'gama', 'rot': { 'x': 1.5708, 'y': 0, 'z': 0 }, 'size': { 'x': 20, 'y': 20, 'z': 20 }, 'load':false},
{ 'key': 'qiche3', 'url': 'static/img/model/qiche3.glb', 'colorModel': 'gama', 'rot': { 'x': 1.5708, 'y': 0, 'z': 0 }, 'size': { 'x': 20, 'y': 20, 'z': 20 }, 'load':false},
{ 'key': 'qiche4', 'url': 'static/img/model/qiche4.glb', 'colorModel': 'gama', 'rot': { 'x': 1.5708, 'y': 0, 'z': 0 }, 'size': { 'x': 20, 'y': 20, 'z': 20 }, 'load':false},
{ 'key': 'qiche5', 'url': 'static/img/model/qiche5.glb', 'colorModel': 'gama', 'rot': { 'x': 1.5708, 'y': 0, 'z': 0 }, 'size': { 'x': 20, 'y': 20, 'z': 20 }, 'load':false},
{ 'key': 'qiche6', 'url': 'static/img/model/qiche6.glb', 'colorModel': 'gama', 'rot': { 'x': 1.5708, 'y': 0, 'z': 0 }, 'size': { 'x': 20, 'y': 20, 'z': 20 }, 'load':false},
{ 'key': 'qiche7', 'url': 'static/img/model/qiche7.glb', 'colorModel': 'gama', 'rot': { 'x': 1.5708, 'y': 0, 'z': 0 }, 'size': { 'x': 20, 'y': 20, 'z': 20 }, 'load':false},
{ 'key': 'qiche8', 'url': 'static/img/model/qiche8.glb', 'colorModel': 'gama', 'rot': { 'x': 1.5708, 'y': 0, 'z': 0 }, 'size': { 'x': 20, 'y': 20, 'z': 20 }, 'load':false},
{ 'key': 'qiche9', 'url': 'static/img/model/qiche9.glb', 'colorModel': 'gama', 'rot': { 'x': 1.5708, 'y': 0, 'z': 0 }, 'size': { 'x': 20, 'y': 20, 'z': 20 }, 'load':false},
{ 'key': 'jt_up', 'url': 'static/img/model/jt_up.glb', 'colorModel': 'gama', 'rot': { 'x': 1.5708, 'y': 0, 'z': 0 }, 'size': { 'x': 20, 'y': 20, 'z': 20 }, 'load':false},
{ 'key': 'jt_left', 'url': 'static/img/model/jt_left.glb', 'colorModel': 'gama', 'rot': { 'x': 1.5708, 'y': 0, 'z': 0 }, 'size': { 'x': 20, 'y': 20, 'z': 20 }, 'load':false},
{ 'key': 'jt_left_up', 'url': 'static/img/model/jt_left_up.glb', 'colorModel': 'gama', 'rot': { 'x': 1.5708, 'y': 0, 'z': 0 }, 'size': { 'x': 20, 'y': 20, 'z': 20 }, 'load':false},
{ 'key': 'jt_right', 'url': 'static/img/model/jt_right.glb', 'colorModel': 'gama', 'rot': { 'x': 1.5708, 'y': 0, 'z': 0 }, 'size': { 'x': 20, 'y': 20, 'z': 20 }, 'load':false},
{ 'key': 'jt_right_up', 'url': 'static/img/model/jt_right_up.glb', 'colorModel': 'gama', 'rot': { 'x': 1.5708, 'y': 0, 'z': 0 }, 'size': { 'x': 20, 'y': 20, 'z': 20 }, 'load':false},
{ 'key': 'jt_turn', 'url': 'static/img/model/jt_turn.glb', 'colorModel': 'gama', 'rot': { 'x': 1.5708, 'y': 0, 'z': 0 }, 'size': { 'x': 20, 'y': 20, 'z': 20 }, 'load':false},
{ 'key': 'ludeng', 'url': 'static/img/model/ludeng.glb', 'colorModel': 'gama', 'rot': { 'x': 1.5708, 'y': 0, 'z': 0 }, 'size': { 'x': 20, 'y': 20, 'z': 20 }, 'load':false},
{ 'key': 'taiyangsan', 'url': 'static/img/model/taiyangsan.glb', 'colorModel': 'gama', 'rot': { 'x': 1.5708, 'y': 0, 'z': 0 }, 'size': { 'x': 20, 'y': 20, 'z': 20 }, 'load':false},
{ 'key': 'honglvdeng', 'url': 'static/img/model/honglvdeng.glb', 'colorModel': 'gama', 'rot': { 'x': 1.5708, 'y': 0, 'z': 0 }, 'size': { 'x': 20, 'y': 20, 'z': 20 }, 'load':false},
{ 'key': 'chongdianzhuang', 'url': 'static/img/model/chongdianzhuang.glb', 'colorModel': 'gama', 'rot': { 'x': 1.5708, 'y': 0, 'z': 0 }, 'size': { 'x': 20, 'y': 20, 'z': 20 }, 'load':false},
{ 'key': 'IDS_H', 'url': 'static/img/model/IDS_H.glb', 'colorModel': 'gama', 'rot': { 'x': 1.5708, 'y': 0, 'z': 0 }, 'size': { 'x': 20, 'y': 20, 'z': 20 }, 'load':false},
{ 'key': 'IDS_V', 'url': 'static/img/model/IDS_V.glb', 'colorModel': 'gama', 'rot': { 'x': 1.5708, 'y': 0, 'z': 0 }, 'size': { 'x': 20, 'y': 20, 'z': 20 }, 'load':false},
{ 'key': 'xiaofangshuan', 'url': 'static/img/model/xiaofangshuan.glb', 'colorModel': 'gama', 'rot': { 'x': 1.5708, 'y': 0, 'z': 0 }, 'size': { 'x': 20, 'y': 20, 'z': 20 }, 'load':false},
{ 'key': 'tingchechang', 'url': 'static/img/model/tingchechang.glb', 'colorModel': 'gama', 'rot': { 'x': 1.5708, 'y': 0, 'z': 0 }, 'size': { 'x': 20, 'y': 20, 'z': 20 }, 'load':false},
{ 'key': 'chechanglangan', 'url': 'static/img/model/chechanglangan.glb', 'colorModel': 'gama', 'rot': { 'x': 1.5708, 'y': 0, 'z': 0 }, 'size': { 'x': 20, 'y': 20, 'z': 20 }, 'load':false},
{ 'key': 'bangongyi', 'url': 'static/img/model/bangongyi.glb', 'colorModel': 'gama', 'rot': { 'x': 1.5708, 'y': 0, 'z': 0 }, 'size': { 'x': 20, 'y': 20, 'z': 20 }, 'load':false},
{ 'key': 'lvzhi', 'url': 'static/img/model/lvzhi.glb', 'colorModel': 'gama', 'rot': { 'x': 1.5708, 'y': 0, 'z': 0 }, 'size': { 'x': 20, 'y': 20, 'z': 20 }, 'load':false},
{ 'key': 'ren1', 'url': 'static/img/model/ren1.glb', 'colorModel': 'gama', 'rot': { 'x': 1.5708, 'y': 0, 'z': 0 }, 'size': { 'x': 20, 'y': 20, 'z': 20 }, 'load':false},
{ 'key': 'ren2', 'url': 'static/img/model/ren2.glb', 'colorModel': 'gama', 'rot': { 'x': 1.5708, 'y': 0, 'z': 0 }, 'size': { 'x': 20, 'y': 20, 'z': 20 }, 'load':false},
{ 'key': 'ren3', 'url': 'static/img/model/ren3.glb', 'colorModel': 'gama', 'rot': { 'x': 1.5708, 'y': 0, 'z': 0 }, 'size': { 'x': 20, 'y': 20, 'z': 20 }, 'load':false},
{ 'key': 'ren4', 'url': 'static/img/model/ren4.glb', 'colorModel': 'gama', 'rot': { 'x': 1.5708, 'y': 0, 'z': 0 }, 'size': { 'x': 20, 'y': 20, 'z': 20 }, 'load':false},
{ 'key': 'ren5', 'url': 'static/img/model/ren5.glb', 'colorModel': 'gama', 'rot': { 'x': 1.5708, 'y': 0, 'z': 0 }, 'size': { 'x': 20, 'y': 20, 'z': 20 }, 'load':false},
{ 'key': 'ren6', 'url': 'static/img/model/ren6.glb', 'colorModel': 'gama', 'rot': { 'x': 1.5708, 'y': 0, 'z': 0 }, 'size': { 'x': 20, 'y': 20, 'z': 20 }, 'load':false},
{ 'key': 'yizi1', 'url': 'static/img/model/yizi1.glb', 'colorModel': 'gama', 'rot': { 'x': 1.5708, 'y': 0, 'z': 0 }, 'size': { 'x': 20, 'y': 20, 'z': 20 }, 'load':false},
{ 'key': 'gjz1', 'url': 'static/img/model/gjz1.glb', 'colorModel': 'gama', 'rot': { 'x': 1.5708, 'y': 0, 'z': 0 }, 'size': { 'x': 20, 'y': 20, 'z': 20 }, 'load':false}
]; ];
this.fbxModels = []; //精灵模型 this.fbxModels = []; //精灵模型
/** /**
@ -194,7 +204,26 @@ QMUtil = function () {
this.leftPoint; //左侧平行线交点 this.leftPoint; //左侧平行线交点
this.rightPoint; //右侧平行线交点 this.rightPoint; //右侧平行线交点
} }
this.assignUVs = function (geometry) {
geometry.computeBoundingBox();
var max = geometry.boundingBox.max,
min = geometry.boundingBox.min;
var offset = new THREE.Vector2(0 - min.x, 0 - min.y);
var range = new THREE.Vector2(max.x - min.x, max.y - min.y);
var faces = geometry.faces;
geometry.faceVertexUvs[0] = [];
for (var i = 0; i < faces.length ; i++) {
var v1 = geometry.vertices[faces[i].a],
v2 = geometry.vertices[faces[i].b],
v3 = geometry.vertices[faces[i].c];
geometry.faceVertexUvs[0].push([
new THREE.Vector2((v1.x + offset.x) / range.x, (v1.y + offset.y) / range.y),
new THREE.Vector2((v2.x + offset.x) / range.x, (v2.y + offset.y) / range.y),
new THREE.Vector2((v3.x + offset.x) / range.x, (v3.y + offset.y) / range.y)
]);
}
geometry.uvsNeedUpdate = true;
}
/** /**
* 检测点是否在多边形区域内 * 检测点是否在多边形区域内
*/ */
@ -401,12 +430,13 @@ QMUtil = function () {
* 传入A中心点和A的宽 * 传入A中心点和A的宽
* B的中心点和B的宽 * B的中心点和B的宽
*/ */
this.isCollision = function (A, aW, aH, B, bW, bH) {
let noCol = false;
if (Math.abs(A.x - B.x) < (aW + bW) / 2 + 20 && Math.abs(A.y - B.y) < (aH + bH) / 2 + 10) {
noCol = true;
}
return noCol;
this.isCollision = function (A, B) {
return (
A.x < B.x + B.width &&
A.x + A.width > B.x &&
A.y < B.y + B.height &&
A.y + A.height > B.y
);
} }
this.changeParkToString = function (area) { this.changeParkToString = function (area) {
let areaArr = []; let areaArr = [];
@ -679,7 +709,7 @@ QMUtil = function () {
this.getPointArr = function (s1, s3, s4, s2, sp = 0.01) { this.getPointArr = function (s1, s3, s4, s2, sp = 0.01) {
let pArr = []; let pArr = [];
let sz = [s1, s3, s4, s2]; let sz = [s1, s3, s4, s2];
let p = Map_QM.util.P_BEZ(0, sz);
let p;
for (let j = 0; j < 1; j += sp) { for (let j = 0; j < 1; j += sp) {
p = Map_QM.util.P_BEZ(j, sz); p = Map_QM.util.P_BEZ(j, sz);
pArr.push(p); pArr.push(p);
@ -782,7 +812,6 @@ QMUtil = function () {
//////////////////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////////////////
this.getWallPoints = function (points, wallWidth) { this.getWallPoints = function (points, wallWidth) {
if (points.length < 2) { if (points.length < 2) {
//console.log("getWallPoints", "points size is letter than 2");
return new Array(); return new Array();
} }
//构建线段列表 //构建线段列表
@ -866,7 +895,7 @@ QMUtil = function () {
} else { } else {
//不是横线时 根据斜率计算点位 //不是横线时 根据斜率计算点位
x = point.x + 5; x = point.x + 5;
y = parseInt(gradient * (x - point.x) + point.y);
y = gradient * (x - point.x) + point.y;
} }
return Map_QM.util.pointXY(point, new Map_QM.util.Point(x, y), wallWidth / 2); return Map_QM.util.pointXY(point, new Map_QM.util.Point(x, y), wallWidth / 2);
@ -889,8 +918,8 @@ QMUtil = function () {
let x1 = (-B + Math.sqrt(Math.pow(B, 2) - 4 * A * C)) / (2 * A); let x1 = (-B + Math.sqrt(Math.pow(B, 2) - 4 * A * C)) / (2 * A);
let x2 = (-B - Math.sqrt(Math.pow(B, 2) - 4 * A * C)) / (2 * A); let x2 = (-B - Math.sqrt(Math.pow(B, 2) - 4 * A * C)) / (2 * A);
result.push(new Map_QM.util.Point(parseInt(x1), parseInt(k * x1 + b)));
result.push(new Map_QM.util.Point(parseInt(x2), parseInt(k * x2 + b)));
result.push(new Map_QM.util.Point(x1, k * x1 + b));
result.push(new Map_QM.util.Point(x2, k * x2 + b));
return result; return result;
} }
//计算两条直线的相交点 //计算两条直线的相交点
@ -1359,7 +1388,7 @@ MainMap_QM.prototype = {
_space.util.readTextFile(_space.util.beforPath + _space.util.shopServerInfo, function (res) { _space.util.readTextFile(_space.util.beforPath + _space.util.shopServerInfo, function (res) {
console.log(res) console.log(res)
_space.util.shopData = res.data;
_space.util.shopData = res.data.shopList;
let backObj = { "code": 200, msg: "加载成功", "data": [] }; let backObj = { "code": 200, msg: "加载成功", "data": [] };
if (_space.util.shopData && Array.isArray(_space.util.shopData)) { if (_space.util.shopData && Array.isArray(_space.util.shopData)) {
_space.util.shopData.sort(_space.util.sortShopByFloor); _space.util.shopData.sort(_space.util.sortShopByFloor);
@ -1461,7 +1490,6 @@ MainMap_QM.prototype = {
for (let i = 0; i < _this.util.initModelArr.length; i++) { for (let i = 0; i < _this.util.initModelArr.length; i++) {
let loader = new THREE.GLTFLoader(); let loader = new THREE.GLTFLoader();
loader.load(_this.util.beforPath + _this.util.initModelArr[i].url, function (collada) { loader.load(_this.util.beforPath + _this.util.initModelArr[i].url, function (collada) {
console.log();
collada.scene.scale.x = collada.scene.scale.y = collada.scene.scale.z = _this.util.initModelArr[i].scale; collada.scene.scale.x = collada.scene.scale.y = collada.scene.scale.z = _this.util.initModelArr[i].scale;
collada.scene.position.set(_this.util.initModelArr[i].site.x, _this.util.initModelArr[i].site.y, _this.util.initModelArr[i].site.z); collada.scene.position.set(_this.util.initModelArr[i].site.x, _this.util.initModelArr[i].site.y, _this.util.initModelArr[i].site.z);
collada.scene.rotation.set(_this.util.initModelArr[i].rot.x * Math.PI / 180, _this.util.initModelArr[i].rot.y * Math.PI / 180, _this.util.initModelArr[i].rot.z * Math.PI / 180); collada.scene.rotation.set(_this.util.initModelArr[i].rot.x * Math.PI / 180, _this.util.initModelArr[i].rot.y * Math.PI / 180, _this.util.initModelArr[i].rot.z * Math.PI / 180);
@ -1648,7 +1676,7 @@ MainMap_QM.prototype = {
this.initGuide(); this.initGuide();
this.controls.target.set(this.util.guiOptions.targatX, this.util.guiOptions.targatY, this.util.guiOptions.targatZ); this.controls.target.set(this.util.guiOptions.targatX, this.util.guiOptions.targatY, this.util.guiOptions.targatZ);
let pathData = this.util.allMap[parseInt(this.util.deviceObj.build)].buildArr[parseInt(this.util.deviceObj.floor)].mapData.path; let pathData = this.util.allMap[parseInt(this.util.deviceObj.build)].buildArr[parseInt(this.util.deviceObj.floor)].mapData.path;
pathData.nodes.sort(this.util.sortNode);
pathData && pathData.nodes.sort(this.util.sortNode);
if (parseInt(this.util.deviceObj.node) != -1) { if (parseInt(this.util.deviceObj.node) != -1) {
if (pathData && pathData.nodes.length > parseInt(this.util.deviceObj.node)) { if (pathData && pathData.nodes.length > parseInt(this.util.deviceObj.node)) {
this.util.deviceObj.xaxis = pathData.nodes[parseInt(this.util.deviceObj.node)].x; this.util.deviceObj.xaxis = pathData.nodes[parseInt(this.util.deviceObj.node)].x;
@ -1680,32 +1708,32 @@ MainMap_QM.prototype = {
let ftPathObj = JSON.parse(jcStr); let ftPathObj = JSON.parse(jcStr);
let dtPathObj = JSON.parse(jcStr); let dtPathObj = JSON.parse(jcStr);
try { try {
for (let j = 0; j < Map_QM.util.pathStateObj.facAllArr.length; j++) {
for (let k = 0; k < Map_QM.util.pathStateObj.facAllArr[j].length; k++) {
let facP = Map_QM.util.pathStateObj.facAllArr[j][k].buildOrder + "_" + Map_QM.util.pathStateObj.facAllArr[j][k].floorOrder + "_" + Map_QM.util.pathStateObj.facAllArr[j][k].navCode;
for (let h = 0; h < Map_QM.util.pathStateObj.facAllArr[j].length; h++) {
if (h != k && Map_QM.util.pathStateObj.facAllArr[j][k].buildOrder == Map_QM.util.pathStateObj.facAllArr[j][h].buildOrder) {
let nP = Map_QM.util.pathStateObj.facAllArr[j][h].buildOrder + "_" + Map_QM.util.pathStateObj.facAllArr[j][h].floorOrder + "_" + Map_QM.util.pathStateObj.facAllArr[j][h].navCode;
if (Map_QM.util.pathStateObj.facAllArr[j][h].facCode == "dt") {
ftPathObj[facP][nP] = 1000 + 600 * Math.abs(parseInt(Map_QM.util.pathStateObj.facAllArr[j][h].floorOrder) - parseInt(Map_QM.util.pathStateObj.facAllArr[j][k].floorOrder));;
if (Map_QM.util.pathStateObj.facAllArr[j][k].no == Map_QM.util.pathStateObj.seldtFacNo) {
graphPathObj[facP][nP] = 300 + 100 * Math.abs(parseInt(Map_QM.util.pathStateObj.facAllArr[j][h].floorOrder) - parseInt(Map_QM.util.pathStateObj.facAllArr[j][k].floorOrder));
for (let j = 0; j < this.util.pathStateObj.facAllArr.length; j++) {
for (let k = 0; k < this.util.pathStateObj.facAllArr[j].length; k++) {
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++) {
if (h != k && this.util.pathStateObj.facAllArr[j][k].buildOrder == this.util.pathStateObj.facAllArr[j][h].buildOrder) {
let nP = this.util.pathStateObj.facAllArr[j][h].buildOrder + "_" + this.util.pathStateObj.facAllArr[j][h].floorOrder + "_" + this.util.pathStateObj.facAllArr[j][h].navCode;
if (this.util.pathStateObj.facAllArr[j][h].facCode == "dt") {
ftPathObj[facP][nP] = 1000 + 600 * Math.abs(parseInt(this.util.pathStateObj.facAllArr[j][h].floorOrder) - parseInt(this.util.pathStateObj.facAllArr[j][k].floorOrder));;
if (this.util.pathStateObj.facAllArr[j][k].no == this.util.pathStateObj.seldtFacNo) {
graphPathObj[facP][nP] = 300 + 100 * Math.abs(parseInt(this.util.pathStateObj.facAllArr[j][h].floorOrder) - parseInt(this.util.pathStateObj.facAllArr[j][k].floorOrder));
} else { } else {
graphPathObj[facP][nP] = 800 + 100 * Math.abs(parseInt(Map_QM.util.pathStateObj.facAllArr[j][h].floorOrder) - parseInt(Map_QM.util.pathStateObj.facAllArr[j][k].floorOrder));
graphPathObj[facP][nP] = 800 + 100 * Math.abs(parseInt(this.util.pathStateObj.facAllArr[j][h].floorOrder) - parseInt(this.util.pathStateObj.facAllArr[j][k].floorOrder));
} }
dtPathObj[facP][nP] = 1000 + 100 * Math.abs(parseInt(Map_QM.util.pathStateObj.facAllArr[j][h].floorOrder) - parseInt(Map_QM.util.pathStateObj.facAllArr[j][k].floorOrder));
} else if (Map_QM.util.pathStateObj.facAllArr[j][h].facCode == "td") {
graphPathObj[facP][nP] = 800 + 300 * Math.abs(parseInt(Map_QM.util.pathStateObj.facAllArr[j][h].floorOrder) - parseInt(Map_QM.util.pathStateObj.facAllArr[j][k].floorOrder));
ftPathObj[facP][nP] = 800 + 300 * Math.abs(parseInt(Map_QM.util.pathStateObj.facAllArr[j][h].floorOrder) - parseInt(Map_QM.util.pathStateObj.facAllArr[j][k].floorOrder));
dtPathObj[facP][nP] = 800 + 300 * Math.abs(parseInt(Map_QM.util.pathStateObj.facAllArr[j][h].floorOrder) - parseInt(Map_QM.util.pathStateObj.facAllArr[j][k].floorOrder));
dtPathObj[facP][nP] = 1000 + 100 * 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") {
graphPathObj[facP][nP] = 800 + 300 * Math.abs(parseInt(this.util.pathStateObj.facAllArr[j][h].floorOrder) - parseInt(this.util.pathStateObj.facAllArr[j][k].floorOrder));
ftPathObj[facP][nP] = 800 + 300 * Math.abs(parseInt(this.util.pathStateObj.facAllArr[j][h].floorOrder) - parseInt(this.util.pathStateObj.facAllArr[j][k].floorOrder));
dtPathObj[facP][nP] = 800 + 300 * Math.abs(parseInt(this.util.pathStateObj.facAllArr[j][h].floorOrder) - parseInt(this.util.pathStateObj.facAllArr[j][k].floorOrder));
} else { } else {
dtPathObj[facP][nP] = 1000 + 600 * Math.abs(parseInt(Map_QM.util.pathStateObj.facAllArr[j][h].floorOrder) - parseInt(Map_QM.util.pathStateObj.facAllArr[j][k].floorOrder));
if (Map_QM.util.pathStateObj.facAllArr[j][k].no == Map_QM.util.pathStateObj.selupftFacNo || Map_QM.util.pathStateObj.facAllArr[j][k].no == Map_QM.util.pathStateObj.seldownftFacNo) {
graphPathObj[facP][nP] = 300 + 100 * Math.abs(parseInt(Map_QM.util.pathStateObj.facAllArr[j][h].floorOrder) - parseInt(Map_QM.util.pathStateObj.facAllArr[j][k].floorOrder));
dtPathObj[facP][nP] = 1000 + 600 * Math.abs(parseInt(this.util.pathStateObj.facAllArr[j][h].floorOrder) - parseInt(this.util.pathStateObj.facAllArr[j][k].floorOrder));
if (this.util.pathStateObj.facAllArr[j][k].no == this.util.pathStateObj.selupftFacNo || this.util.pathStateObj.facAllArr[j][k].no == this.util.pathStateObj.seldownftFacNo) {
graphPathObj[facP][nP] = 300 + 100 * Math.abs(parseInt(this.util.pathStateObj.facAllArr[j][h].floorOrder) - parseInt(this.util.pathStateObj.facAllArr[j][k].floorOrder));
} else { } else {
graphPathObj[facP][nP] = 800 + 100 * Math.abs(parseInt(Map_QM.util.pathStateObj.facAllArr[j][h].floorOrder) - parseInt(Map_QM.util.pathStateObj.facAllArr[j][k].floorOrder));
graphPathObj[facP][nP] = 800 + 100 * Math.abs(parseInt(this.util.pathStateObj.facAllArr[j][h].floorOrder) - parseInt(this.util.pathStateObj.facAllArr[j][k].floorOrder));
} }
ftPathObj[facP][nP] = 1000 + 100 * Math.abs(parseInt(Map_QM.util.pathStateObj.facAllArr[j][h].floorOrder) - parseInt(Map_QM.util.pathStateObj.facAllArr[j][k].floorOrder));
ftPathObj[facP][nP] = 1000 + 100 * Math.abs(parseInt(this.util.pathStateObj.facAllArr[j][h].floorOrder) - parseInt(this.util.pathStateObj.facAllArr[j][k].floorOrder));
} }
} }
} }
@ -1715,9 +1743,9 @@ MainMap_QM.prototype = {
console.log("交通设施点位问题: " + e); console.log("交通设施点位问题: " + e);
} }
Map_QM.util.pathStateObj.graphPath = graphPathObj;
Map_QM.util.pathStateObj.ftPath = ftPathObj;
Map_QM.util.pathStateObj.dtPath = dtPathObj;
this.util.pathStateObj.graphPath = graphPathObj;
this.util.pathStateObj.ftPath = ftPathObj;
this.util.pathStateObj.dtPath = dtPathObj;
var fIndex = 0, bIndex = 0; var fIndex = 0, bIndex = 0;
this.mapArr[bIndex] = []; this.mapArr[bIndex] = [];
intTimer = setInterval(() => { intTimer = setInterval(() => {
@ -1744,7 +1772,7 @@ MainMap_QM.prototype = {
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)); 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));
} else { } else {
if (parseInt(Map_QM.util.deviceObj.node) != -1) { if (parseInt(Map_QM.util.deviceObj.node) != -1) {
pathData.nodes.sort(Map_QM.util.sortNode);
pathData && pathData.nodes.sort(Map_QM.util.sortNode);
if (pathData && !Map_QM.util.deviceObj.xaxis && pathData.nodes.length > parseInt(Map_QM.util.deviceObj.node)) { if (pathData && !Map_QM.util.deviceObj.xaxis && pathData.nodes.length > parseInt(Map_QM.util.deviceObj.node)) {
Map_QM.util.deviceObj.xaxis = pathData.nodes[parseInt(Map_QM.util.deviceObj.node)].x; 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; Map_QM.util.deviceObj.yaxis = pathData.nodes[parseInt(Map_QM.util.deviceObj.node)].y;
@ -2024,7 +2052,7 @@ MainMap_QM.prototype = {
TweenMax.to(Map_QM.buildObj.position, 0.5, { TweenMax.to(Map_QM.buildObj.position, 0.5, {
x: build * Map_QM.util.options.bSpace * -1, x: build * Map_QM.util.options.bSpace * -1,
onComplete: function () { onComplete: function () {
Map_QM.changeFloorInner(-1, fIndex); //结束后切换楼层
Map_QM.changeFloorInner(build, fIndex); //结束后切换楼层
} }
}); });
}, },
@ -2095,17 +2123,13 @@ 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].allObj.visible = t == build ? true : false; Map_QM.mapArr[t][i].allObj.visible = t == build ? true : false;
Map_QM.mapArr[t][i].labelObj.traverse((obj) => { Map_QM.mapArr[t][i].labelObj.traverse((obj) => {
obj.visible = false;
});
Map_QM.mapArr[t][i].iconLabel.traverse((obj) => {
obj.visible = false;
obj.element && (obj.element.style.visibility = "hidden");
}); });
Map_QM.mapArr[t][i].tagObj.traverse((obj) => { Map_QM.mapArr[t][i].tagObj.traverse((obj) => {
obj.visible = false;
obj.element && (obj.element.style.visibility = "hidden");
}); });
Map_QM.mapArr[t][i].showTagObj.traverse((obj) => { Map_QM.mapArr[t][i].showTagObj.traverse((obj) => {
obj.visible = false;
obj.element && (obj.element.style.visibility = "hidden");
}); });
} }
} }
@ -2114,18 +2138,14 @@ MainMap_QM.prototype = {
} else { } else {
return; return;
} }
for (let i = 0; i < Map_QM.mapArr[build].length; i++) { for (let i = 0; i < Map_QM.mapArr[build].length; i++) {
if (i == fIndex || (i == midIndex && Map_QM.util.options.overlap) || (i == endIndex && Map_QM.util.options.overlap)) { if (i == fIndex || (i == midIndex && Map_QM.util.options.overlap) || (i == endIndex && Map_QM.util.options.overlap)) {
Map_QM.mapArr[build][i].allObj.visible = true; Map_QM.mapArr[build][i].allObj.visible = true;
Map_QM.mapArr[build][i].labelObj.traverse((obj) => { Map_QM.mapArr[build][i].labelObj.traverse((obj) => {
obj.visible = true;
});
Map_QM.mapArr[build][i].iconLabel.traverse((obj) => {
obj.visible = true;
obj.element && (obj.element.style.visibility = "visible")
}); });
Map_QM.mapArr[build][i].showTagObj.traverse((obj) => { Map_QM.mapArr[build][i].showTagObj.traverse((obj) => {
obj.visible = true;
obj.element && (obj.element.style.visibility = "visible");
}); });
} else { } else {
Map_QM.mapArr[build][i].allObj.visible = false; Map_QM.mapArr[build][i].allObj.visible = false;
@ -2138,6 +2158,7 @@ MainMap_QM.prototype = {
Map_QM.timeOutInit(); Map_QM.timeOutInit();
} else if (endIndex === -1) { //一层 } else if (endIndex === -1) { //一层
if (build == Map_QM.util.selectBuild && fIndex == Map_QM.util.selectFloor) { if (build == Map_QM.util.selectBuild && fIndex == Map_QM.util.selectFloor) {
Map_QM.mapArr[Map_QM.util.selectBuild][Map_QM.util.selectFloor].allObj.position.y = 0;
Map_QM.timeOutInit(); Map_QM.timeOutInit();
if (callBack) callBack(); if (callBack) callBack();
} else { } else {
@ -3315,7 +3336,7 @@ MainMap_QM.prototype = {
if (!Map_QM || !Map_QM.util.options.collision) { if (!Map_QM || !Map_QM.util.options.collision) {
return; return;
} }
clearTimeout(Map_QM.util.timeObj.collTime);
Map_QM.util.timeObj.collTime = setTimeout(() => { Map_QM.util.timeObj.collTime = setTimeout(() => {
clearTimeout(Map_QM.util.timeObj.collTime); clearTimeout(Map_QM.util.timeObj.collTime);
let checkList = []; let checkList = [];
@ -3328,59 +3349,38 @@ MainMap_QM.prototype = {
}); });
} }
} }
if (Map_QM.mapArr[Map_QM.util.selectBuild]) {
if (Map_QM.mapArr[Map_QM.util.selectBuild] && Map_QM.buildObj.visible) {
for (let m = 0; m < Map_QM.mapArr[Map_QM.util.selectBuild].length; m++) { for (let m = 0; m < Map_QM.mapArr[Map_QM.util.selectBuild].length; m++) {
if (Map_QM.mapArr[Map_QM.util.selectBuild][m].allObj.visible && (!Map_QM.buildObj.userData.hasOwnProperty("visible") || Map_QM.buildObj.userData.visible)) { if (Map_QM.mapArr[Map_QM.util.selectBuild][m].allObj.visible && (!Map_QM.buildObj.userData.hasOwnProperty("visible") || Map_QM.buildObj.userData.visible)) {
let IconChilds = Map_QM.mapArr[Map_QM.util.selectBuild][m].iconLabel.children;
IconChilds.forEach((item) => {
item.element.style.visibility = "visible";
});
let childs = Map_QM.mapArr[Map_QM.util.selectBuild][m].labelObj.children; let childs = Map_QM.mapArr[Map_QM.util.selectBuild][m].labelObj.children;
childs.forEach((item) => {
item.element.style.visibility = "hidden";
});
let len = childs.length; let len = childs.length;
for (let i = 0; i < len; i++) { for (let i = 0; i < len; i++) {
let obj = childs[i].element let obj = childs[i].element
if (obj.style.visibility == 'hidden' && obj.style.transform) {
obj.style.visibility = 'visible'
let labP = obj.style.transform.split('translate')[2].split(', ')
if (childs[i].userData.mapShow) {
obj.style.visibility = "visible";
} else {
obj.style.visibility = "hidden";
}
if (obj.style.transform) {
obj.style.visibility = "visible"
let labP = obj.getBoundingClientRect();
for (let j = 0; j < i; j++) { for (let j = 0; j < i; j++) {
if (childs[j].element.style.visibility == 'visible') {
let pb = childs[j].element.style.transform.split('translate')[2].split(', ')
let isCol = Map_QM.util.isCollision(
new Map_QM.util.Point(labP[0].substring(1, labP[0].length - 2), labP[1].substring(0, labP[1].length - 3)),
obj.clientWidth,
obj.clientHeight,
new Map_QM.util.Point(pb[0].substring(1, pb[0].length - 2), pb[1].substring(0, pb[1].length - 3)),
childs[j].element.clientWidth,
childs[j].element.clientHeight
)
if (childs[j].element.style.visibility == "visible") {
let pb = childs[j].element.getBoundingClientRect();
let isCol = Map_QM.util.isCollision(labP, pb);
if (isCol) { if (isCol) {
obj.style.visibility = 'hidden'
if (!childs[i].userData.mapShow) {
obj.style.visibility = "hidden"
break; break;
} else if (!childs[j].userData.mapShow) {
childs[j].element.style.visibility = "hidden"
} }
} }
} }
} }
} }
let iLen = IconChilds.length;
for (let ii = 0; ii < iLen; ii++) {
let objIcon = IconChilds[ii].element;
if (objIcon.style.visibility == "visible" && objIcon.style.transform) {
let labPIcon = objIcon.style.transform.split("translate")[2].split(", ");
for (let jj = ii + 1; jj < iLen; jj++) {
let pbe = IconChilds[jj].element.style.transform.split("translate")[2].split(", ");
let isCol2 = Map_QM.util.isCollision(new Map_QM.util.Point(labPIcon[0].substring(1, labPIcon[0].length - 2), labPIcon[1].substring(0,
labPIcon[1].length - 3)), objIcon.clientWidth, objIcon.clientHeight,
new Map_QM.util.Point(pbe[0].substring(1, pbe[0].length - 2), pbe[1].substring(0, pbe[1].length - 3)), IconChilds[jj].element
.clientWidth, IconChilds[jj].element.clientHeight);
if (isCol2) {
IconChilds[jj].element.style.visibility = "hidden";
}
}
}
} }
if (Map_QM.util.options.overlap) { if (Map_QM.util.options.overlap) {
let renChild = Map_QM.mapArr[Map_QM.util.selectBuild][m].showTagObj.children; let renChild = Map_QM.mapArr[Map_QM.util.selectBuild][m].showTagObj.children;
const { left, top } = Map_QM.renderer.domElement.getBoundingClientRect(); const { left, top } = Map_QM.renderer.domElement.getBoundingClientRect();
@ -3400,20 +3400,8 @@ MainMap_QM.prototype = {
} }
} }
}); });
IconChilds.forEach((item) => {
if (item.element.style.visibility == "visible") {
let check = Map_QM.util.blocked(item.element, checkList, m, top, left);
if (check) {
item.element.style.visibility = "hidden";
}
}
});
} }
} else { } else {
let IconChilds = Map_QM.mapArr[Map_QM.util.selectBuild][m].iconLabel.children;
IconChilds.forEach((item) => {
item.element.style.visibility = "hidden";
});
let childs = Map_QM.mapArr[Map_QM.util.selectBuild][m].labelObj.children; let childs = Map_QM.mapArr[Map_QM.util.selectBuild][m].labelObj.children;
childs.forEach((item) => { childs.forEach((item) => {
item.element.style.visibility = "hidden"; item.element.style.visibility = "hidden";
@ -3963,6 +3951,13 @@ MainMap_QM.prototype = {
if (!usePath) { if (!usePath) {
usePath = Map_QM.util.pathStateObj.graphPath; usePath = Map_QM.util.pathStateObj.graphPath;
} }
if (Map_QM.util.overObj.comeIn) {
const costall = dijkstra.single_source_shortest_paths(Map_QM.util.pathStateObj.graphPath, startNade, startNade).costs;
if (costall) {
let inArray = Map_QM.util.overObj.comeIn.split(",");
Map_QM.util.overObj.node = Map_QM.getMinCostByArray(Map_QM.util.overObj.floor, inArray, costall);
}
}
Map_QM.forShopPath(usePath); Map_QM.forShopPath(usePath);
}, },
forShopPath: function (usePath) { forShopPath: function (usePath) {
@ -4756,7 +4751,7 @@ FloorMap_QM.prototype = {
obj.rotateY(Map_QM.util.modelArr[i].list[t].rot.y); obj.rotateY(Map_QM.util.modelArr[i].list[t].rot.y);
obj.rotateZ(Map_QM.util.modelArr[i].list[t].rot.z); obj.rotateZ(Map_QM.util.modelArr[i].list[t].rot.z);
sopce.allObj.add(obj); sopce.allObj.add(obj);
} showTagObj
}
}); });
} }
} }
@ -4878,56 +4873,25 @@ FloorMap_QM.prototype = {
logo = ""; logo = "";
showLeb = ""; showLeb = "";
navRecommend = false; navRecommend = false;
mapShow = false;
shopD = {}; shopD = {};
if (shopData) { if (shopData) {
for (let h = 0; h < shopData.length; h++) { for (let h = 0; h < shopData.length; h++) {
let houseNum = iot ? shopData[h].houseNumber : shopData[h].houseNum; let houseNum = iot ? shopData[h].houseNumber : shopData[h].houseNum;
if (typeof (shopData[h].buildingOrder) == "undefined") {
if (shopData[h].floorOrder == this.floorOrder) {
if (houseNum == mapData.shopArea[i].name) {
show = iot ? shopData[h].shopName : shopData[h].name;
showLeb = houseNum;
showE = iot ? shopData[h].shopNameEn : shopData[h].nameEn;
logo = shopData[h].logoPath;
if (shopData[h].navRecommend == undefined) {
navRecommend = true;
} else {
navRecommend = shopData[h].navRecommend;
}
shopD = shopData[h];
if (shopData[h].isNewStore) { //新店
mapData.shopArea[i].type = "new-shop";
this.addTagLabel(mapData.shopArea[i], { "node": mapData.shopArea[i].shopNav, "floor": this.floorOrder, "build": this.buildOrder });
}
if ((shopData[h].shopActList && shopData[h].shopActList.length > 0)) { //促销
mapData.shopArea[i].type = "promotion";
this.addTagLabel(mapData.shopArea[i], { "node": mapData.shopArea[i].shopNav, "floor": this.floorOrder, "build": this.buildOrder });
}
if (shopData[h].formatColor) {
entColor = parseInt(shopData[h].formatColor.replace("#", "0x"), 16);
} else {
entColor = "#eab16e";
}
if (shopData[h].borderColor) {
borderColor = parseInt(shopData[h].borderColor.replace("#", "0x"), 16);
} else {
borderColor = "#eab16e";
}
break;
}
}
} else {
if (shopData[h].buildingOrder == this.buildOrder && shopData[h].floorOrder == this.floorOrder) { if (shopData[h].buildingOrder == this.buildOrder && shopData[h].floorOrder == this.floorOrder) {
if (houseNum == mapData.shopArea[i].name) { if (houseNum == mapData.shopArea[i].name) {
show = iot ? shopData[h].shopName : shopData[h].name;
if(houseNum == "FB130B"){
console.log(mapData.shopArea[i],shopData[h]);
}
show = shopData[h].shopName || shopData[h].name;
showLeb = houseNum; showLeb = houseNum;
showE = iot ? shopData[h].shopNameEn : shopData[h].nameEn;
logo = shopData[h].logoPath;
if (shopData[h].navRecommend == undefined) {
navRecommend = true;
showE = shopData[h].shopNameEn || shopData[h].nameEn;
logo = shopData[h].logoPath || shopData[h].logoUrl;
mapShow = shopData[h].mapShow ?? false;
if (shopData[h].navRecommend || shopData[h].isPass) {
navRecommend = shopData[h].navRecommend || shopData[h].isPass;
} else { } else {
navRecommend = shopData[h].navRecommend;
navRecommend = false;
} }
shopD = shopData[h]; shopD = shopData[h];
if (shopData[h].isNewStore) { //新店 if (shopData[h].isNewStore) { //新店
@ -4939,21 +4903,16 @@ FloorMap_QM.prototype = {
this.addTagLabel(mapData.shopArea[i], { "node": mapData.shopArea[i].shopNav, "floor": this.floorOrder, "build": this.buildOrder }); this.addTagLabel(mapData.shopArea[i], { "node": mapData.shopArea[i].shopNav, "floor": this.floorOrder, "build": this.buildOrder });
} }
if (shopData[h].formatColor) { if (shopData[h].formatColor) {
entColor = parseInt(shopData[h].formatColor.replace("#", "0x"), 16);
} else {
entColor = "#eab16e";
entColor = shopData[h].formatColor;
} }
if (shopData[h].borderColor) { if (shopData[h].borderColor) {
borderColor = parseInt(shopData[h].borderColor.replace("#", "0x"), 16);
} else {
borderColor = "#eab16e";
borderColor = shopData[h].borderColor;
} }
break; break;
} }
} }
} }
} }
}
let hollShop = []; let hollShop = [];
if (mapData.shopArea[i].hollArea) { if (mapData.shopArea[i].hollArea) {
for (let k = 0; k < mapData.shopArea[i].hollArea.length; k++) { for (let k = 0; k < mapData.shopArea[i].hollArea.length; k++) {
@ -4982,13 +4941,15 @@ FloorMap_QM.prototype = {
mahc.xaxis = mapData.shopArea[i].xaxis >> 0; mahc.xaxis = mapData.shopArea[i].xaxis >> 0;
mahc.yaxis = mapData.shopArea[i].yaxis >> 0; mahc.yaxis = mapData.shopArea[i].yaxis >> 0;
this.shopObj.add(mahc); this.shopObj.add(mahc);
if (mapData.shopArea[i].logoUrl && mapData.shopArea[i].isLabel == 0) { //添加logo if (mapData.shopArea[i].logoUrl && mapData.shopArea[i].isLabel == 0) { //添加logo
this.logoUtil.renderIcon(mapData.shopArea[i], mahc, parseInt(mapData.shopArea[i].toHeight) + parseInt(mapData.shopArea[i].site || 0) + 1); this.logoUtil.renderIcon(mapData.shopArea[i], mahc, parseInt(mapData.shopArea[i].toHeight) + parseInt(mapData.shopArea[i].site || 0) + 1);
} else { //添加文字 } else { //添加文字
let some = Map_QM.util.options.boxShop.some((item) => {
let some = false;
if (Map_QM.util.options.boxShop.length && Map_QM.util.options.boxShop[0] !== "") {
some = Map_QM.util.options.boxShop.some((item) => {
return mapData.shopArea[i].name.includes(item); return mapData.shopArea[i].name.includes(item);
}); });
}
if ((showLeb != "" || some )&&show != "shop") { if ((showLeb != "" || some )&&show != "shop") {
showLeb = mapData.shopArea[i].name; showLeb = mapData.shopArea[i].name;
let shopDiv = document.createElement('div'); let shopDiv = document.createElement('div');
@ -5000,6 +4961,7 @@ FloorMap_QM.prototype = {
let shopLabel = new THREE.CSS2DObject(shopDiv); let shopLabel = new THREE.CSS2DObject(shopDiv);
shopLabel.position.set(mapData.shopArea[i].xaxis >> 0, -1 * mapData.shopArea[i].yaxis >> 0, parseInt(mapData.shopArea[i].toHeight) + parseInt(mapData.shopArea[i].site || 0)); shopLabel.position.set(mapData.shopArea[i].xaxis >> 0, -1 * mapData.shopArea[i].yaxis >> 0, parseInt(mapData.shopArea[i].toHeight) + parseInt(mapData.shopArea[i].site || 0));
shopLabel.name = mapData.shopArea[i].name; shopLabel.name = mapData.shopArea[i].name;
shopLabel.userData.mapShow = mapShow;
this.labelObj.add(shopLabel); this.labelObj.add(shopLabel);
} }
} }
Loading…
Cancel
Save