diff --git a/public/static/img/model/flower1.glb b/public/static/img/model/flower1.glb new file mode 100644 index 0000000..c411ad0 Binary files /dev/null and b/public/static/img/model/flower1.glb differ diff --git a/public/static/img/model/flower2.glb b/public/static/img/model/flower2.glb new file mode 100644 index 0000000..2b04a44 Binary files /dev/null and b/public/static/img/model/flower2.glb differ diff --git a/public/static/img/model/grass.glb b/public/static/img/model/grass.glb new file mode 100644 index 0000000..4f1680b Binary files /dev/null and b/public/static/img/model/grass.glb differ diff --git a/public/static/img/model/officeTV.glb b/public/static/img/model/officeTV.glb new file mode 100644 index 0000000..451431d Binary files /dev/null and b/public/static/img/model/officeTV.glb differ diff --git a/public/static/img/model/table.glb b/public/static/img/model/table.glb new file mode 100644 index 0000000..4d2cdf5 Binary files /dev/null and b/public/static/img/model/table.glb differ diff --git a/public/static/img/model/tree3.glb b/public/static/img/model/tree3.glb new file mode 100644 index 0000000..542561f Binary files /dev/null and b/public/static/img/model/tree3.glb differ diff --git a/public/static/qm/MainMap_QM_go.js b/public/static/qm/MainMap_QM_go.js index 57c32c4..e443b56 100644 --- a/public/static/qm/MainMap_QM_go.js +++ b/public/static/qm/MainMap_QM_go.js @@ -1,143 +1,158 @@ var Map_QM, renderFrame = -1, - renderCount=0, + renderCount = 0, pathCameraState, - stats, + mapState = "mall", + iconState = "3d", + heatmapInstance, + isShowElement = true, isJUZ = false, + allJU = true, + hasLine = false, + startRotate = false, + intTimer, shopTime, - debug = false -//basePath 基础路径 graphPath最佳路径 ftPath 扶梯路径 dtPath 电梯路径 + allTime, + language = "zh"; + + //basePath 基础路径 graphPath最佳路径 ftPath 扶梯路径 dtPath 电梯路径 var css_LR = - 'color:#000000;height: 16px;font-size: 14px; z-index: 90; text-shadow: 1px -1px 0 #fff, 1px -1px 0 #fff, -1px 1px 0 #fff, 1px 1px 0 #fff; pointer-events:none;' - + 'color:#000000;font-size: 14px; z-index: 90; text-shadow: 1px -1px 0 #fff, 1px -1px 0 #fff, -1px 1px 0 #fff, 1px 1px 0 #fff; pointer-events:none;' + var typeObj = [ - { ft: 0, type: 0, code: 'ft', name: '扶梯' }, - { upft: 1, type: 1, code: 'upft', name: '上扶梯' }, - { downft: 2, type: 2, code: 'downft', name: '下扶梯' }, - { mys: 3, type: 3, code: 'mys', name: '母婴室' }, - { xsj: 4, type: 4, code: 'xsj', name: '洗手间' }, - { dt: 5, type: 5, code: 'dt', name: '直梯' }, - { hxkj: 6, type: 6, code: 'hxkj', name: '焕醒空间' }, - { fwt: 7, type: 7, code: 'fwt', name: '服务台' }, - { tcc: 8, type: 8, code: 'tcc', name: '停车场' }, - { hhkj: 9, type: 9, code: 'hhkj', name: '焕活空间' }, - { cjr: 10, type: 10, code: 'cjr', name: '无障碍洗手间' }, - { xys: 11, type: 11, code: 'xys', name: '吸烟室' }, - { upft: 12, type: 12, code: 'upft', name: '上扶梯' }, - { downft: 13, type: 13, code: 'downft', name: '下扶梯' }, - { dkbc: 14, type: 14, code: 'dkbc', name: '代客泊车' }, - { tczj: 15, type: 15, code: 'tczj', name: '童车租借' }, - { ysc: 16, type: 16, code: 'ysc', name: '饮水处' }, - { ztg: 17, type: 17, code: 'ztg', name: 'L1自提柜' }, - { thg: 18, type: 18, code: 'thg', name: 'B1自提柜' }, - { cwysd: 19, type: 19, code: 'cwysd', name: '宠物饮水点' }, - { td: 20, type: 20, code: 'td', name: '人行通道' }, - { dit: 21, type: 21, code: 'dit', name: '地铁' }, - { czc: 22, type: 22, code: 'czc', name: '出租车' }, - { atm: 23, type: 23, code: 'atm', name: 'ATM' }, - { jcfw: 24, type: 24, code: 'jcfw', name: '寄存服务' }, - { sjcd: 25, type: 25, code: 'sjcd', name: '手机充电' }, - { bc: 26, type: 26, code: 'bc', name: '泊车' }, - { cjc: 27, type: 27, code: 'cjc', name: '裁剪处' }, - { jtn: 28, type: 28, code: 'jtn', name: '家庭洗手间(男)' }, - { jtv: 29, type: 29, code: 'jtv', name: '家庭洗手间(女)' }, - { ksgj: 30, type: 30, code: 'ksgj', name: '公交' }, - { sjxsn: 31, type: 31, code: 'sjxsn', name: '无障碍洗手间男' }, - { sjxsv: 32, type: 32, code: 'sjxsv', name: '无障碍洗手间女' }, - { tcjf: 33, type: 33, code: 'tcjf', name: '停车缴费' }, - { vip: 34, type: 34, code: 'vip', name: 'VIP' }, - { xsjn: 35, type: 35, code: 'xsjn', name: '男洗手间' }, - { xsjv: 36, type: 36, code: 'xsjv', name: '女洗手间' }, - { yszj: 37, type: 37, code: 'yszj', name: '雨伞租借' }, - { dyj: 38, type: 38, code: 'dyj', name: '打印机' }, - { door: 39, type: 39, code: 'door', name: '出入口' }, - { pq: 40, type: 40, code: 'pq', name: '喷泉' }, - { d1k: 41, type: 41, code: 'd1k', name: '1号出入口' }, - { d2k: 42, type: 42, code: 'd2k', name: '2号出入口' }, - { d3k: 43, type: 43, code: 'd3k', name: '3号出入口' }, - { d4k: 44, type: 44, code: 'd4k', name: '4号出入口' }, - { mjzyf: 45, type: 45, code: 'mjzyf', name: '门急诊药房' }, - { cryc: 46, type: 46, code: 'cryc', name: '出入院处' }, - { rggh: 47, type: 47, code: 'rggh', name: '人工挂号收费处' }, - { zzyl: 48, type: 48, code: 'zzyl', name: '自动饮料贩卖机' }, - { gxly: 49, type: 49, code: 'gxly', name: '共享轮椅' }, - { ysp: 50, type: 50, code: 'ysp', name: '艺术品' }, - { B1up: 51, type: 51, code: 'B1up', name: '' }, - { B1down: 52, type: 52, code: 'B1down', name: '' }, - { B2up: 53, type: 53, code: 'B2up', name: '' }, - { B2down: 54, type: 54, code: 'B2down', name: '' }, - { B3up: 55, type: 55, code: 'B3up', name: '' }, - { B3down: 56, type: 56, code: 'B3down', name: '' }, - { xcgc: 57, type: 57, code: 'xcgc', name: '下沉广场' }, - { tthy: 58, type: 58, code: 'tthy', name: '天台花园' }, - { ybck: 59, type: 59, code: 'ybck', name: '医保窗口' }, - { zzfw: 60, type: 60, code: 'zzfw', name: '自助服务' }, - { gjj: 61, type: 61, code: 'gjj', name: '工具间' }, - { syt1: 62, type: 62, code: 'syt1', name: 'mall收银台' }, - { gwc: 63, type: 63, code: 'gwc', name: '购物车' }, - { ht: 64, type: 64, code: 'ht', name: '花坛' }, - { jrc: 65, type: 65, code: 'jrc', name: '自助加热' }, - { qbc: 66, type: 66, code: 'qbc', name: '自助取冰' }, - { zxc: 67, type: 67, code: 'zxc', name: '自行车停放' }, - { jws: 68, type: 68, code: 'jws', name: '警务室' }, - { etxsj: 69, type: 69, code: 'etxsj', name: '儿童洗手间' }, - { vip_xxq: 70, type: 70, code: 'vip_xxq', name: 'vip休息区' }, - { ab: 71, type: 71, code: 'ab', name: '安保' }, - { abjks: 72, type: 72, code: 'abjks', name: '安保监控室' }, - { bys: 73, type: 73, code: 'bys', name: '播音室' }, - { cpgys: 74, type: 74, code: 'cpgys', name: '裁判更衣室' }, - { gzyld: 75, type: 75, code: 'gzyld', name: '观众医疗点' }, - { hqgys: 76, type: 76, code: 'hqgys', name: '后勤更衣室' }, - { jjs: 77, type: 77, code: 'jjs', name: '急救室' }, - { jw: 78, type: 78, code: 'jw', name: '警卫' }, - { ksj: 79, type: 79, code: 'ksj', name: '开水间' }, - { kt: 80, type: 80, code: 'kt', name: '看台' }, - { qzgysn: 81, type: 81, code: 'qzgysn', name: '亲自更衣(男)' }, - { rsggys: 82, type: 82, code: 'rsggys', name: '热身馆更衣室' }, - { swzl: 83, type: 83, code: 'swzl', name: '失物招领' }, - { tsgbs1: 84, type: 84, code: 'tsgbs1', name: '特殊贵宾室1' }, - { tsgbs2: 85, type: 85, code: 'tsgbs2', name: '特殊贵宾室2' }, - { tsgbs3: 86, type: 86, code: 'tsgbs3', name: '特殊贵宾室3' }, - { wxc: 87, type: 87, code: 'wxc', name: '闻讯处' }, - { lt: 88, type: 88, code: 'lt', name: '楼梯' }, - { yhs: 89, type: 89, code: 'yhs', name: '医护室' }, - { yls: 90, type: 90, code: 'yls', name: '医疗室' }, - { ylz: 91, type: 91, code: 'ylz', name: '医疗站' }, - { ydygys: 92, type: 92, code: 'ydygys', name: '运动员更衣室' }, - { ydygysn: 93, type: 93, code: 'ydygysn', name: '运动员男更衣室' }, - { ydygysv: 94, type: 94, code: 'ydygysv', name: '运动员女更衣室' }, - { zls: 95, type: 95, code: 'zls', name: '诊疗室' }, - { zys: 96, type: 96, code: 'zys', name: '直饮水' }, - { zas: 97, type: 97, code: 'zas', name: '治安室' }, - { xxq: 98, type: 98, code: 'xxq', name: '休息区' }, - { jtxsj: 99, type: 99, code: 'jtxsj', name: '家庭洗手间' }, - { hzs: 100, type: 100, code: 'hzs', name: '化妆室' }, - { brs: 101, type: 101, code: 'brs', name: '哺乳室' }, - { mtl: 102, type: 102, code: 'mtl', name: '摩天轮' }, - { dgnxsj: 103, type: 103, code: 'dgnxsj', name: '多功能洗手间' }, - { wxbxsj: 104, type: 104, code: 'wxbxsj', name: '无性别洗手间' }, - { sjzx: 105, type: 105, code: 'sjzx', name: '设计中心' }, - { dxp: 106, type: 106, code: 'dxp', name: '导向牌' }, - { gydh: 107, type: 107, code: 'gydh', name: '公用电话' }, - { sgq: 108, type: 108, code: 'sgq', name: '石拱桥' }, - { wxw: 109, type: 109, code: 'wxw', name: '无线网' }, - { xmb: 110, type: 110, code: 'xmb', name: '小卖部' }, - { zyzfwz: 111, type: 111, code: 'zyzfwz', name: '志愿者服务站' }, - { ykzx: 112, type: 112, code: 'ykzx', name: '服务中心' }, - { zjyy: 113, type: 113, code: 'zjyy', name: '专家预约处' }, - { yjt: 114, type: 114, code: 'yjt', name: '预检台' }, - { mzjd: 115, type: 115, code: 'mzjd', name: '门诊综合接待室' }, - { hd: 116, type: 116, code: 'hd', name: '活动点' }, - { bsl: 117, type: 117, code: 'bsl', name: '白石龙' } -] - -QMUtil = function () { - this.shopServerInfo = 'static/offline/JSON/getMapInfo.json' - this.mapServerInfo = 'static/offline/JSON/getMap.json' - this.beforPath = './' + { ft: 0, type: 0, code: "ft", name: "扶梯" }, + { upft: 1, type: 1, code: "upft", name: "上扶梯" }, + { downft: 2, type: 2, code: "downft", name: "下扶梯" }, + { mys: 3, type: 3, code: "mys", name: "母婴室" }, + { xsj: 4, type: 4, code: "xsj", name: "洗手间" }, + { dt: 5, type: 5, code: "dt", name: "直梯" }, + { hxkj: 6, type: 6, code: "hxkj", name: "焕醒空间" }, + { fwt: 7, type: 7, code: "fwt", name: "服务台" }, + { tcc: 8, type: 8, code: "tcc", name: "停车场" }, + { hhkj: 9, type: 9, code: "hhkj", name: "焕活空间" }, + { cjr: 10, type: 10, code: "cjr", name: "无障碍洗手间" }, + { xys: 11, type: 11, code: "xys", name: "吸烟室" }, + { upft: 12, type: 12, code: "upft", name: "上扶梯" }, + { downft: 13, type: 13, code: "downft", name: "下扶梯" }, + { dkbc: 14, type: 14, code: "dkbc", name: "代客泊车" }, + { tczj: 15, type: 15, code: "tczj", name: "童车租借" }, + { ysc: 16, type: 16, code: "ysc", name: "饮水处" }, + { ztg: 17, type: 17, code: "ztg", name: "L1自提柜" }, + { thg: 18, type: 18, code: "thg", name: "B1自提柜" }, + { cwysd: 19, type: 19, code: "cwysd", name: "宠物饮水点" }, + { td: 20, type: 20, code: "td", name: "人行通道" }, + { dit: 21, type: 21, code: "dit", name: "地铁" }, + { czc: 22, type: 22, code: "czc", name: "出租车" }, + { atm: 23, type: 23, code: "atm", name: "ATM" }, + { jcfw: 24, type: 24, code: "jcfw", name: "寄存服务" }, + { sjcd: 25, type: 25, code: "sjcd", name: "手机充电" }, + { bc: 26, type: 26, code: "bc", name: "泊车" }, + { cjc: 27, type: 27, code: "cjc", name: "裁剪处" }, + { jtn: 28, type: 28, code: "jtn", name: "家庭洗手间(男)" }, + { jtv: 29, type: 29, code: "jtv", name: "家庭洗手间(女)" }, + { ksgj: 30, type: 30, code: "ksgj", name: "公交" }, + { sjxsn: 31, type: 31, code: "sjxsn", name: "无障碍洗手间男" }, + { sjxsv: 32, type: 32, code: "sjxsv", name: "无障碍洗手间女" }, + { tcjf: 33, type: 33, code: "tcjf", name: "停车缴费" }, + { vip: 34, type: 34, code: "vip", name: "VIP" }, + { xsjn: 35, type: 35, code: "xsjn", name: "男洗手间" }, + { xsjv: 36, type: 36, code: "xsjv", name: "女洗手间" }, + { yszj: 37, type: 37, code: "yszj", name: "雨伞租借" }, + { dyj: 38, type: 38, code: "dyj", name: "打印机" }, + { door: 39, type: 39, code: "door", name: "出入口" }, + { pq: 40, type: 40, code: "pq", name: "喷泉" }, + { d1k: 41, type: 41, code: "d1k", name: "1号出入口" }, + { d2k: 42, type: 42, code: "d2k", name: "2号出入口" }, + { d3k: 43, type: 43, code: "d3k", name: "3号出入口" }, + { d4k: 44, type: 44, code: "d4k", name: "4号出入口" }, + { mjzyf: 45, type: 45, code: "mjzyf", name: "门急诊药房" }, + { cryc: 46, type: 46, code: "cryc", name: "出入院处" }, + { rggh: 47, type: 47, code: "rggh", name: "人工挂号收费处" }, + { zzyl: 48, type: 48, code: "zzyl", name: "自动饮料贩卖机" }, + { gxly: 49, type: 49, code: "gxly", name: "共享轮椅" }, + { ysp: 50, type: 50, code: "ysp", name: "艺术品" }, + { B1up: 51, type: 51, code: "B1up", name: "" }, + { B1down: 52, type: 52, code: "B1down", name: "" }, + { B2up: 53, type: 53, code: "B2up", name: "" }, + { B2down: 54, type: 54, code: "B2down", name: "" }, + { B3up: 55, type: 55, code: "B3up", name: "" }, + { B3down: 56, type: 56, code: "B3down", name: "" }, + { xcgc: 57, type: 57, code: "xcgc", name: "下沉广场" }, + { tthy: 58, type: 58, code: "tthy", name: "天台花园" }, + { ybck: 59, type: 59, code: "ybck", name: "医保窗口" }, + { zzfw: 60, type: 60, code: "zzfw", name: "自助服务" }, + { gjj: 61, type: 61, code: "gjj", name: "工具间" }, + { syt1: 62, type: 62, code: "syt1", name: "mall收银台" }, + { gwc: 63, type: 63, code: "gwc", name: "购物车" }, + { ht: 64, type: 64, code: "ht", name: "花坛" }, + { jrc: 65, type: 65, code: "jrc", name: "自助加热" }, + { qbc: 66, type: 66, code: "qbc", name: "自助取冰" }, + { zxc: 67, type: 67, code: "zxc", name: "自行车停放" }, + { jws: 68, type: 68, code: "jws", name: "警务室" }, + { etxsj: 69, type: 69, code: "etxsj", name: "儿童洗手间" }, + { vip_xxq: 70, type: 70, code: "vip_xxq", name: "vip休息区" }, + { ab: 71, type: 71, code: "ab", name: "安保" }, + { abjks: 72, type: 72, code: "abjks", name: "安保监控室" }, + { bys: 73, type: 73, code: "bys", name: "播音室" }, + { cpgys: 74, type: 74, code: "cpgys", name: "裁判更衣室" }, + { gzyld: 75, type: 75, code: "gzyld", name: "观众医疗点" }, + { hqgys: 76, type: 76, code: "hqgys", name: "后勤更衣室" }, + { jjs: 77, type: 77, code: "jjs", name: "急救室" }, + { jw: 78, type: 78, code: "jw", name: "警卫" }, + { ksj: 79, type: 79, code: "ksj", name: "开水间" }, + { kt: 80, type: 80, code: "kt", name: "看台" }, + { qzgysn: 81, type: 81, code: "qzgysn", name: "亲自更衣(男)" }, + { rsggys: 82, type: 82, code: "rsggys", name: "热身馆更衣室" }, + { swzl: 83, type: 83, code: "swzl", name: "失物招领" }, + { tsgbs1: 84, type: 84, code: "tsgbs1", name: "特殊贵宾室1" }, + { tsgbs2: 85, type: 85, code: "tsgbs2", name: "特殊贵宾室2" }, + { tsgbs3: 86, type: 86, code: "tsgbs3", name: "特殊贵宾室3" }, + { wxc: 87, type: 87, code: "wxc", name: "闻讯处" }, + { lt: 88, type: 88, code: "lt", name: "楼梯" }, + { yhs: 89, type: 89, code: "yhs", name: "医护室" }, + { yls: 90, type: 90, code: "yls", name: "医疗室" }, + { ylz: 91, type: 91, code: "ylz", name: "医疗站" }, + { ydygys: 92, type: 92, code: "ydygys", name: "运动员更衣室" }, + { ydygysn: 93, type: 93, code: "ydygysn", name: "运动员男更衣室" }, + { ydygysv: 94, type: 94, code: "ydygysv", name: "运动员女更衣室" }, + { zls: 95, type: 95, code: "zls", name: "诊疗室" }, + { zys: 96, type: 96, code: "zys", name: "直饮水" }, + { zas: 97, type: 97, code: "zas", name: "治安室" }, + { xxq: 98, type: 98, code: "xxq", name: "休息区" }, + { jtxsj: 99, type: 99, code: "jtxsj", name: "家庭洗手间" }, + { hzs: 100, type: 100, code: "hzs", name: "化妆室" }, + { brs: 101, type: 101, code: "brs", name: "哺乳室" }, + { mtl: 102, type: 102, code: "mtl", name: "摩天轮" }, + { dgnxsj: 103, type: 103, code: "dgnxsj", name: "多功能洗手间" }, + { wxbxsj: 104, type: 104, code: "wxbxsj", name: "无性别洗手间" }, + { sjzx: 105, type: 105, code: "sjzx", name: "设计中心" }, + { dxp: 106, type: 106, code: "dxp", name: "导向牌" }, + { gydh: 107, type: 107, code: "gydh", name: "公用电话" }, + { sgq: 108, type: 108, code: "sgq", name: "石拱桥" }, + { wxw: 109, type: 109, code: "wxw", name: "无线网" }, + { xmb: 110, type: 110, code: "xmb", name: "小卖部" }, + { zyzfwz: 111, type: 111, code: "zyzfwz", name: "志愿者服务站" }, + { ykzx: 112, type: 112, code: "ykzx", name: "服务中心" }, + { zjyy: 113, type: 113, code: "zjyy", name: "专家预约处" }, + { yjt: 114, type: 114, code: "yjt", name: "预检台" }, + { mzjd: 115, type: 115, code: "mzjd", name: "门诊综合接待室" }, + { hd: 116, type: 116, code: "hd", name: "活动点" }, + { bsl: 117, type: 117, code: "bsl", name: "白石龙" }, + { xzl: 118, type: 118, code: "xzl", name: "写字楼" }, + { axzj: 119, type: 119, code: "axzj", name: "爱心租借" }, + { cdz: 120, type: 120, code: "cdz", name: "充电桩" }, + { hjcq: 121, type: 121, code: "hjcq", name: "黑金车区" }, + { yjjj: 122, type: 122, code: "yjjj", name: "宜家家居" }, +]; + +var QMUtil = function () { + this.shopServerInfo = "static/offline/JSON/QueryShopList.json"; + this.mapServerInfo = "static/offline/JSON/GetMapInfo.json"; + this.beforPath = "./"; //https://qianmu-iot.1000my.com/QMAPSDK/ this.tomUrl = "https://qianmu-iot.1000my.com"; this.options = { - playSpeed: 6, //动画播放速度 + playSpeed: 8, //动画播放速度 + speedMult: 1, //动画播放倍数 collision: true, //是否支持名称的碰撞检测 modelIcon: true, //是否使用模型 true 模型 false 图标 otherPath: [], //人为干预的路线 [{f:"0_5_10",s:"1_5_47",d:500},{f:"1_5_47",s:"0_5_10",d:500}]; @@ -145,524 +160,589 @@ QMUtil = function () { fSpace: 500, //双叠层状态下楼层的间距 maxDis: 1000, minDis: 60, + shadow: true, //是否显示阴影 navColor: 0xee6a50, //途径店铺颜色 aRadius: 2, //圆角半径 大于2 则店铺box显示圆角 iconName: false, //图标名称是否显示 mapScale: 18, //地图比例尺 - pathColor: "#6e95fe", // - pathColor2: "#6e7dfe", - pathStyle: '3D', - shopStyle: 'shopName', //设置box显示名称shopName或编号shopNum + pathColor: "#6e95fe", // + pathColor2: "#6e7dfe", //'rgb(110,125,254)' + pathBgColor: "#a9b5d3", //'rgb(169,181,211)' + pathBgColor2: "#bdc0cb", //'rgb(189, 192, 203)', + pathStyle: "3D", + shopStyle: "shopName", //设置box显示名称shopName或编号shopNum inArea: false, //点击后是否聚焦到店铺 - camZoom: 3, //设置我的方向状态地图放大倍数 boxShop: [], //设置box上显示的文字(过滤指),可点击触发onlyShop deviceAng: false, //地图初始化方向是否使用设备角度 - facSize: 20 //设施大小 - } + northShow: false, //指南针显示 + facSize: 20, //设施大小 + }; this.lightOptions = { - d_col: '#ffffff', + d_col: "#ffffff", d_int: 0.2, - s_col: '#fffffa', - g_col: '#ffffff', - a_int: 0.85 - } - this.m_zoom = 1.2 - this._clock = new THREE.Clock() - this._indexPathFloor = 0 // 遍历途径数据 - this.changeDist = { inner: 310, outner: 900 } //室内外切换的极限值, 如果 inner小于minDis 则不支持缩放切换 + s_col: "#fffffa", + g_col: "#ffffff", + a_int: 0.85, + }; + this.m_zoom = 1.2; //2D地图缩放大小 + this._clock = new THREE.Clock(); + this._indexPathFloor = 0; // 遍历途径数据 + this.changeDist = { inner: 300, outner: 900 }; /** * isPathState 寻路状态 */ this.pathStateObj = { isPathState: false, isPathPlay: true, - basePath: '', - graphPath: '', - ftPath: '', - dtPath: '', + basePath: "", + graphPath: "", + ftPath: "", + dtPath: "", facAllArr: [], forShopArr: {}, elevator: null, straight: null, elevatorDown: null, - seldtFacNo: '', - seldownftFacNo: '', - selupftFacNo: '' - } - this.timeObj = { timeS: 0, collTime: -1, pathTime: -1 } - - this.sceneGap = { cameraX: 0, cameraY: 220, cameraZ: 220, x: -10, y: 0, z: 0, scale: 0.08 } //改变地图位置,大小 - this.selectBuild = 0 - this.selectFloor = 0 - this.deviceObj = {} //angle --- 设备旋转角度 node ---- 设备导航点位 floor --- 设备楼层 - this.startObj = {} // 导航起点; - this.overObj = {} //导航结束点 - this.buildHeight = 5 - this.shopHeight = 30 //店铺高度 控制店铺相关的其它第三方组件高度 - //服务icon 英文配置 - this.iconEn = { 洗手间: 'Toilets', 停车场: 'Parking', 电梯: 'Lift', 扶梯: 'Escalator', 母婴室: 'Baby care room', 服务台: 'service desk' } + seldtFacNo: { type: "", no: "" }, + }; + this.timeObj = { collTime: -1, pathTime: -1 }; + this.sceneGap = { cameraX: 0, cameraY: 220, cameraZ: 220, x: 0, y: 0, z: 0, scale: 0.08 }; //改变地图位置,大小 + this.isMorePath = false; //多节点寻路模式 + this.selectBuild = 0; + this.selectFloor = 0; + this.deviceObj = {}; //angle --- 设备旋转角度 node ---- 设备导航点位 floor --- 设备楼层 + this.startObj = {}; // 导航起点; + this.overObj = {}; //导航结束点 + this.buildHeight = 5; + this.shopHeight = 30; //店铺高度 控制店铺相关的其它第三方组件高度 //添加平铺logo {floor:5, logoUrl:"./static/img/ss.png", imgW:395, imgH:376, xaxis:1550, yaxis:-860, site:30} - this.logos = [] + this.logos = []; /** * 外立面 - * Map_QM.util.initModelArr=[{url:"./static/model/jianfa.gltf",type:"out", scale:0.038, rot:{x:0,y:30,z:0}, site:{x:-20,y:-100,z:20}, colorModel:"gama" }]; + * Map_QM.util.initModelArr=[{url:"./static/img/out/yong.glb",type:"out", scale:1, rot:{x:0,y:0,z:0}, site:{x:0,y:0,z:0}, colorModel:"gama" }]; */ - this.initModelArr = [] // + this.initModelArr = []; // /** * 一直显示不隐藏, 在楼层内显示 + * {floor:6, url:"static/img/out/skp.glb", list:[{size:{x:12.5,y:12.5,z:12.5}, rot:{x:1.5708,y:0,z:0}, site:{x:0,y:0,z:0}}]} */ - this.modelArr = [] + this.modelArr = []; 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 }, 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': 'park_paly', 'url': 'static/img/model/park_paly.glb', 'colorModel': 'gama', 'rot': { 'x': 1.5708, 'y': 0, 'z': 0 }, 'size': { 'x': 80, 'y': 80, 'z': 80 }, '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 = [] //精灵模型 + {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: "tree3", url: "static/img/model/tree3.glb", colorModel: "gama", rot: { x: 1.5708, y: 0, z: 0 }, size: { x: 20, y: 20, z: 20 }, load: false }, + {key: "grass", url: "static/img/model/grass.glb", colorModel: "gama", rot: { x: 1.5708, y: 0, z: 0 }, size: { x: 20, y: 20, z: 20 }, load: false }, + {key: "flower1", url: "static/img/model/flower1.glb", colorModel: "gama", rot: { x: 1.5708, y: 0, z: 0 }, size: { x: 20, y: 20, z: 20 },load: false}, + {key: "flower2", url: "static/img/model/flower2.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: "park_paly", url: "static/img/model/park_paly.glb", colorModel: "gama", rot: { x: 1.5708, y: 0, z: 0 }, size: { x: 80, y: 80, z: 80 }, 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: "officeTV", url: "static/img/model/officeTV.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: "table", url: "static/img/model/table.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 = []; //精灵模型 /** * 模型弹窗 - * { htmlUrl: "
进入商场
", x: 55, y: 12, z: 3, click: true, type: "out" } + * { htmlUrl: "进入商场
", x: 55, y: 12, z: 3, show:"zh", type: "out" } */ - this.tipArr = [] //模型标签 periphery + this.tipArr = []; //模型标签 periphery /** * 室内地图标签 * Map_QM.util.labelIconArr([{floor:0,title:'肯德基
']) + */ + changeShowShopName: function (shopNums, elements) { + if (shopNums.length === elements.length) { + 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 j = 0; j < labObj.length; j++) { + if (labObj[j].name == shopNums[i]) { + labObj[j].element.innerHTML = elements[i]; + break; + } + } + } + } + }, + + /** + * @api {方法} showAreaAnimate() 区域定位 + * @apiGroup 地图显示 + * @apiDescription 通过区域名称凸显区域 + * @apiVersion 4.0.0 + * @apiParam {String} aName 区域名称,不传则复位 + * @apiSampleRequest off + * + * @apiParamExample {String} 请求示例 + * Map_QM.showAreaAnimate("A"); + */ + showAreaAnimate: function (aName = "") { + //在我的方向状态,恢复 + Map_QM.changeMapModel("3D"); + Map_QM.resetFloorState(); + Map_QM.controls.reset(); + Map_QM.util.options.deviceAng && Map_QM.rotationAngle(Map_QM.util.deviceObj.angle); + TweenMax.killAll(true); + if (!aName) { + isJUZ = false; + allJU = true; + return; + } + Map_QM.mapArr[Map_QM.util.selectBuild][Map_QM.util.selectFloor].allObj.traverse((obj) => { + if (obj.userData && obj.userData.type == "build") { + if (obj.name == aName) { + Map_QM.onShowLocalSite({ x: obj.userData.xaxis, y: obj.userData.yaxis }, false); + } + } + }); + }, + + /** + * @api {方法} unionShop() 店铺合并 + * @apiGroup 地图显示 + * @apiDescription 通过店铺编号合并店铺 合铺 + * @apiVersion 4.0.0 + * @apiParam {Array} shops 店铺编号数组 + * @apiParam {Object} data 新的店铺数据(默认 空数据) + * @apiSampleRequest off + * + * @apiParamExample {String} 请求示例 + * Map_QM.unionShop(["L105","L106","L107","L108"],{name:"新店",houseNumber:"L104-L108",color:"#F4A460"}) + */ + unionShop: function ( + shops, + data = { name: "", houseNumber: "shop", color: "#F4A460" } + ) { + let shopObj = [], + xAll = 0, + yAll = 0; + if (Array.isArray(shops) && shops.length > 1) { + //删除店铺box + let shopArea = + Map_QM.mapArr[Map_QM.util.selectBuild][Map_QM.util.selectFloor].shopObj + .children; + for (let i = 0; i < shops.length; i++) { + for (let k = 0; k < shopArea.length; k++) { + if (shopArea[k].name == shops[i]) { + xAll += shopArea[k].xaxis; + yAll += shopArea[k].yaxis; + shopObj.push(shopArea[k]); + Map_QM.mapArr[Map_QM.util.selectBuild][ + Map_QM.util.selectFloor + ].shopObj.remove(shopArea[k]); + break; + } + } + } + //删除文本标签 + let labObj = Map_QM.mapArr[Map_QM.util.selectBuild][Map_QM.util.selectFloor].labelObj.children; + for (let i = 0; i < shops.length; i++) { + for (let j = 0; j < labObj.length; j++) { + if (labObj[j].name == shops[i]) { + if (labObj[j].element && labObj[j].element.parentNode) { + labObj[j].element.parentNode.removeChild(labObj[j].element); + } + Map_QM.mapArr[Map_QM.util.selectBuild][Map_QM.util.selectFloor].labelObj.remove(labObj[j]); + break; + } + } + } + let point = { + x: xAll / shopObj.length, + y: yAll / shopObj.length, + }; + let baseShop; + for (let l = 0; l < shopObj.length; l++) { + if (l == 0) { + baseShop = new ThreeBSP(shopObj[0]); + } else { + baseShop = baseShop.union(new ThreeBSP(shopObj[l])); + } + } + //ThreeBSP对象转化为网格模型对象 + let mesh = baseShop.toMesh(); + mesh.userData = data; + mesh.userData.shopData = { formatColor: data.color }; + mesh.userData.xaxis = point.x >> 0; + mesh.userData.yaxis = point.y >> 0; + mesh.userData.houseNumber = data.houseNumber; + mesh.userData.entColor = data.color; + mesh.userData.type = "shop"; + if (data.name) { + mesh.name = data.name; + let shopDiv = document.createElement("div"); + shopDiv.style.cssText = css_LR; + if (window.innerWidth > 2000) { + shopDiv.style.fontSize = "18px"; + } + shopDiv.innerHTML = data.name; + shopDiv.dataset.name = data.name; + shopDiv.dataset.nameEn = data.nameEn || data.name; + let shopLabel = new THREE.CSS2DObject(shopDiv); + shopLabel.position.set(point.x >> 0, (-1 * point.y) >> 0, 30); + shopLabel.name = data.houseNumber || ""; + shopLabel.userData.mapShow = true; //是否永久显示 + shopLabel.userData.isShow = true; + Map_QM.mapArr[Map_QM.util.selectBuild][Map_QM.util.selectFloor].labelObj.add(shopLabel); + } + mesh.material = new THREE.MeshPhongMaterial({ + color: data.color || 0xf4a460, + transparent: true, + opacity: 0.9, + side: THREE.DoubleSide, + depthTest: true, + }); + Map_QM.mapArr[Map_QM.util.selectBuild][ + Map_QM.util.selectFloor + ].allObj.add(mesh); + } + renderCount = 0; + }, + + //////////////////////////////////////////////////////////////////////////////// /** * @param {Object} e * 地图BOX点击 */ onMouseClickBox: function (event) { - - let mouse = new THREE.Vector2() - mouse.x = (event.offsetX / Map_QM.w) * 2 - 1 - mouse.y = -(event.offsetY / Map_QM.h) * 2 + 1 - Map_QM.onCallTouchORMouse(mouse) - + startRotate = false; + let mouse = new THREE.Vector2(); + mouse.x = (event.offsetX / Map_QM.w) * 2 - 1; + mouse.y = -(event.offsetY / Map_QM.h) * 2 + 1; + Map_QM.onCallTouchORMouse(mouse); }, onCallTouchORMouse: function (mouse) { - if (!Map_QM.mapArr[Map_QM.util.selectBuild] && !Map_QM.mapArr[Map_QM.util.selectBuild][Map_QM.util.selectFloor]) { - return - } - let raycaster = new THREE.Raycaster() - raycaster.setFromCamera(mouse, Map_QM.camera) - let intersects = raycaster.intersectObjects(Map_QM.mapArr[Map_QM.util.selectBuild][Map_QM.util.selectFloor].allObj.children, true) - let clickShop = false - //图标点击 + if ((!Map_QM.mapArr[Map_QM.util.selectBuild] &&!Map_QM.mapArr[Map_QM.util.selectBuild][Map_QM.util.selectFloor]) || !Map_QM.buildObj.visible) { + return; + } + let raycaster = new THREE.Raycaster(); + raycaster.setFromCamera(mouse, Map_QM.camera); + let intersects = raycaster.intersectObjects(Map_QM.mapArr[Map_QM.util.selectBuild][Map_QM.util.selectFloor].allObj.children, true); + let clickShop = false, + clickOnly = false, + onlyData = null; for (let i = 0; i < intersects.length; i++) { - //图标点击 - if ( - intersects[i].object.userData && - (intersects[i].object.userData.type == 'icon' || - intersects[i].object.parent.userData.type == 'icon' || - intersects[i].object.parent.parent.userData.type == 'icon') - ) { - if (Map_QM.endModel && Map_QM.endModel.visible) { - Map_QM.endModel.visible = false + //店铺BOX点击 + if (intersects[i].object.userData && intersects[i].object.userData.type == "shop") { + if (intersects[i].object.name != "") { + if (Map_QM.endModel && Map_QM.endModel.visible) { + Map_QM.endModel.visible = false; + } + clickShop = true; + Map_QM.mapArr[Map_QM.util.selectBuild][Map_QM.util.selectFloor].findPath.clearPath(); + Map_QM.setSelectShopMat(intersects[i].object); + break; + } else { + //空店铺有编号 + if (intersects[i].object.userData.houseNumber && intersects[i].object.userData.houseNumber != "shop") { + clickOnly = true; + onlyData = intersects[i].object.userData; + } } - Map_QM.mapArr[Map_QM.util.selectBuild][Map_QM.util.selectFloor].findPath.clearPath() - let buildOrder = - intersects[i].object.userData.buildOrder || intersects[i].object.parent.userData.buildOrder || intersects[i].object.parent.parent.userData.buildOrder || 0 - let floorOrder = - intersects[i].object.userData.floorOrder || intersects[i].object.parent.userData.floorOrder || intersects[i].object.parent.parent.userData.floorOrder || 0 - let navCode = intersects[i].object.userData.navCode || intersects[i].object.parent.userData.navCode || intersects[i].object.parent.parent.userData.navCode - let src = intersects[i].object.userData.src || intersects[i].object.parent.userData.src || intersects[i].object.parent.parent.userData.src - let facCode = intersects[i].object.userData.facCode || intersects[i].object.parent.userData.facCode || intersects[i].object.parent.parent.userData.facCode - let title = intersects[i].object.userData.title || intersects[i].object.parent.userData.title || intersects[i].object.parent.parent.userData.title - /** - * @api {事件} icon 点击设施图标 - * @apiGroup 地图事件 - * @apiDescription 用户点击设施图标后触发自定义事件 - * @apiVersion 2.0.0 - * @apiSampleRequest off - * - * @apiParamExample 请求示例 - * Map_QM.addEventListener("icon",onClickIcon,false); - */ - Map_QM.dispatchEvent({ - type: 'icon', - data: { buildOrder: buildOrder, floorOrder: floorOrder, node: navCode, src: src, facCode: facCode, title: title } - }) - console.log('触发 icon 事件 ', { - type: 'icon', - data: { buildOrder: buildOrder, floorOrder: floorOrder, node: navCode, src: src, facCode: facCode, title: title } - }) - return } } - for (let i = 0; i < intersects.length; i++) { - //店铺BOX点击 - if (intersects[i].object.userData && intersects[i].object.userData.type == "shop") { - if(intersects[i].object.name != ""){ - if (Map_QM.endModel && Map_QM.endModel.visible) { - Map_QM.endModel.visible = false; - } - clickShop = true; - Map_QM.mapArr[Map_QM.util.selectBuild][Map_QM.util.selectFloor].findPath.clearPath(); - Map_QM.setSelectShopMat(intersects[i].object); - break; - }else{ //空店铺有编号 - if(intersects[i].object.userData.houseNumber && intersects[i].object.userData.houseNumber != "shop"){ - clickOnly = true; - onlyData = intersects[i].object.userData; - } - } - } - } /** * @api {事件} shop 点击已绑定品牌的店铺 * @apiGroup 地图事件 * @apiDescription 用户点击店铺后触发自定义事件 - * @apiVersion 2.0.0 + * @apiVersion 4.0.0 * @apiSampleRequest off * * @apiParamExample 请求示例 * Map_QM.addEventListener("shop",onClickShop,false); */ if (clickShop && Map_QM.selectShop && Map_QM.selectShop.userData) { - if (Map_QM.selectShop.userData.shopData.hasOwnProperty('houseNumber')) { + if (Map_QM.selectShop.userData.shopData.hasOwnProperty("houseNumber")) { Map_QM.dispatchEvent({ - type: 'shop', - data: Map_QM.selectShop.userData - }) + type: "shop", + data: Map_QM.selectShop.userData, + }); } else { /** * @api {事件} onlyShop 点击未绑定品牌的店铺 * @apiGroup 地图事件 * @apiDescription 用户点击空店铺后触发自定义事件 - * @apiVersion 2.0.0 + * @apiVersion 4.0.0 * @apiSampleRequest off * * @apiParamExample 请求示例 * Map_QM.addEventListener("onlyShop",onClickShop,false); */ Map_QM.dispatchEvent({ - type: 'onlyShop', - data: Map_QM.selectShop.userData - }) + type: "onlyShop", + data: Map_QM.selectShop.userData, + }); } } else { - if(clickOnly){ - Map_QM.dispatchEvent({ - type: "onlyShop", - data: onlyData - }) - }else{ - Map_QM.dispatchEvent({ - type: "shop", - data: null - }) - } + if (clickOnly) { + Map_QM.dispatchEvent({ + type: "onlyShop", + data: onlyData, + }); + } else { + Map_QM.dispatchEvent({ + type: "shop", + data: null, + }); + } } }, /** - * @api {方法} setSelectShopMatByName(shopNum) 设置box 选中 + * @api {方法} setSelectShopMatByName(houseNumber) 设置box 选中 * @apiGroup 地图交互 * @apiDescription 地图box 选中 - * @apiVersion 2.0.0 - * @apiParam {String} shopNum POI编号 + * @apiVersion 4.0.0 + * @apiParam {String} houseNumber POI编号 * * @apiSampleRequest off * @@ -2869,211 +3705,689 @@ MainMap_QM.prototype = { */ setSelectShopMatByName: function (ipName) { for (let i = 0; i < Map_QM.mapArr[Map_QM.util.selectBuild].length; i++) { - let shopArr = Map_QM.mapArr[Map_QM.util.selectBuild][i].shopObj.children + let shopArr = Map_QM.mapArr[Map_QM.util.selectBuild][i].shopObj.children; for (let k = 0; k < shopArr.length; k++) { if (shopArr[k].name == ipName) { - Map_QM.setSelectShopMat(shopArr[k]) - break + Map_QM.setSelectShopMat(shopArr[k]); + break; } } } }, //改变选中店铺box setSelectShopMat: function (selObject) { - TweenMax.killAll(true) + TweenMax.killAll(true); if (Map_QM.selectShop) { - Map_QM.selectShop.scale.z = 1 - } - Map_QM.parseSelectShop(selObject) - }, - updateRender:function(){ - Map_QM.controls.update(); - Map_QM.renderer.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.camera ); - Map_QM.labelRenderer.zOrder( Map_QM.mapArr[Map_QM.util.selectBuild][Map_QM.util.selectFloor].labelObj ); - }, + Map_QM.selectShop.scale.z = 1; + } + Map_QM.parseSelectShop(selObject); + }, + updateRender: function () { + Map_QM.controls.update(); + Map_QM.renderer.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); + Map_QM.labelRenderer.zOrder(Map_QM.mapArr[Map_QM.util.selectBuild][Map_QM.util.selectFloor].labelObj); + }, /** * 初始化后调用 */ timeOutInit: function () { Map_QM.updateRender(); - Map_QM.collLabel(); - renderCount=0 + Map_QM.collLabel(); + renderCount = 0; if (Map_QM.callBackLoadOver) { - let floorData = [] + let floorData = []; for (let i = 0; i < Map_QM.util.allMap.length; i++) { - let build = [] + let build = []; for (let j = 0; j < Map_QM.util.allMap[i].buildArr.length; j++) { if (Map_QM.util.allMap[i].buildArr[j]) { - build.push({ order: Map_QM.util.allMap[i].buildArr[j].order, name: Map_QM.util.allMap[i].buildArr[j].name }) + build.push({ + order: Map_QM.util.allMap[i].buildArr[j].order, + name: Map_QM.util.allMap[i].buildArr[j].name, + }); } } - floorData.push(build) + floorData.push(build); } if (Map_QM.backObj) { - Map_QM.controls.enabled = true - Map_QM.backObj.data = floorData + Map_QM.controls.enabled = true; + Map_QM.backObj.data = floorData; } - Map_QM.callBackLoadOver(Map_QM.backObj) //初始化完成后回调 - Map_QM.callBackLoadOver = null - Map_QM.backObj = null + Map_QM.callBackLoadOver(Map_QM.backObj); //初始化完成后回调 + Map_QM.callBackLoadOver = null; + Map_QM.backObj = null; } Map_QM.dispatchEvent({ - type: 'changeFloorOver', - data: Map_QM.selectFloor - }) + type: "changeFloorOver", + data: Map_QM.selectFloor, + }); }, autoChangeEleAngle: function () { if (Map_QM.mapArr[Map_QM.util.selectBuild]) { - 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) { - let svgChilds = Map_QM.mapArr[Map_QM.util.selectBuild][m].svgObj.children; - let rat = Map_QM.controls.getRotateHorizontal(); - svgChilds.forEach((item) => { - if (Math.abs(item.rotation.x) < 0.5) { - if ((rat - item.userData.rot) > 1.7 || (rat - item.userData.rot) < -1.7) { - item.rotation.z = item.userData.rot < 0 ? item.userData.rot + 3.1415926 : item.userData.rot - 3.1415926; - } else { - item.rotation.z = item.userData.rot; - } - } - }); - let logoChilds = Map_QM.mapArr[Map_QM.util.selectBuild][m].shopObj.children; - logoChilds.forEach((item) => { - if (item.children.length>0) { - item.children.forEach((obj) => { - if (obj.userData.type == "logo") { - if ((rat - obj.userData.rot) > 1.7 || (rat - obj.userData.rot) < -1.7) { - obj.rotation.z = obj.userData.rot < 0 ? obj.userData.rot + 3.1415926 : obj.userData.rot - 3.1415926; - } else { - obj.rotation.z = obj.userData.rot; - } - } - }) - } - }); - } - } - } + 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) { + let svgChilds = Map_QM.mapArr[Map_QM.util.selectBuild][m].svgObj.children; + let rat = Map_QM.controls.getRotateHorizontal(); + svgChilds.forEach((item) => { + if (Math.abs(item.rotation.x) < 0.5) { + if ( + rat - item.userData.rot > 1.7 || + rat - item.userData.rot < -1.7 + ) { + item.rotation.z = + item.userData.rot < 0 + ? item.userData.rot + 3.1415926 + : item.userData.rot - 3.1415926; + } else { + item.rotation.z = item.userData.rot; + } + } + }); + let logoChilds = Map_QM.mapArr[Map_QM.util.selectBuild][m].shopObj.children; + logoChilds.forEach((item) => { + if (item.children.length > 0) { + item.children.forEach((obj) => { + if (obj.userData.type == "logo") { + if ( + rat - obj.userData.rot > 1.7 || + rat - obj.userData.rot < -1.7 + ) { + obj.rotation.z = + obj.userData.rot < 0 + ? obj.userData.rot + 3.1415926 + : obj.userData.rot - 3.1415926; + } else { + obj.rotation.z = obj.userData.rot; + } + } + }); + } + }); + } + } + } + }, + disPlayEvent: function () { + renderCount = 0; + let distance = Map_QM.controls.getDistance(); + if (distance > Map_QM.util.changeDist.outner + 20 && mapState != "periphery") { + Map_QM.toPeripheryInner(); + } else if (distance > Map_QM.util.changeDist.inner + 20 && distance < Map_QM.util.changeDist.outner - 20 && mapState != "out") { + Map_QM.toOutModelInner(); + } else if (distance < Map_QM.util.changeDist.inner - 20 && mapState != "mall") { + Map_QM.toMallInner(); + } }, - disPlayEvent: function (e) { - renderCount=0; - Map_QM.collLabel(); - }, /** * 碰撞检测 * @param {Object} 传入检测楼层下标 */ controlsChock: function () { - Map_QM.autoChangeEleAngle() - renderCount=0; + Map_QM.autoChangeEleAngle(); + renderCount = 0; /** * @api {事件} MapAngleChange 地图的方向改变 * @apiGroup 地图事件 * @apiDescription 用户操作地图时触发 - * @apiVersion 2.0.0 + * @apiVersion 4.0.0 * @apiSampleRequest off * * @apiParamExample 请求示例 * Map_QM.addEventListener("MapAngleChange",onMapAngleChange,false); */ Map_QM.dispatchEvent({ - type: 'MapAngleChange', - data: { hAngle: Map_QM.controls.getRotateHorizontal(), vAngle: Map_QM.controls.getRotate() } - }) - - if (Map_QM.util.options.inArea && isJUZ) { - clearTimeout(shopTime); - shopTime = setTimeout(() => { - clearTimeout(shopTime); - isJUZ = false; - Map_QM.controls.setZoom(1) - Map_QM.controls.reset() - Map_QM.util.options.deviceAng && Map_QM.rotationAngle(Map_QM.util.deviceObj.angle) - }, 6000); - } + type: "MapAngleChange", + data: { + hAngle: Map_QM.controls.getRotateHorizontal(), + vAngle: Map_QM.controls.getRotate(), + }, + }); + + if (Map_QM.util.options.inArea && isJUZ && allJU) { + clearTimeout(shopTime); + shopTime = setTimeout(() => { + clearTimeout(shopTime); + isJUZ = false; + Map_QM.controls.reset(); + Map_QM.util.options.deviceAng && Map_QM.rotationAngle(Map_QM.util.deviceObj.angle); + }, 10000); + } }, //内部碰撞检测 collLabel: function () { - if (!Map_QM) { - return; - } - if (Map_QM.mapArr[Map_QM.util.selectBuild] && Map_QM.buildObj.visible && Map_QM.mapArr[Map_QM.util.selectBuild][Map_QM.util.selectFloor]) { - if (Map_QM.mapArr[Map_QM.util.selectBuild][Map_QM.util.selectFloor].allObj.visible && (!Map_QM.buildObj.userData.hasOwnProperty("visible") || Map_QM.buildObj.userData.visible)) { - let childs = Map_QM.mapArr[Map_QM.util.selectBuild][Map_QM.util.selectFloor].labelObj.children; - let len = childs.length - for (let i = 0; i < len; i++) { - if(!childs[i].userData.isShow){ //是否可见 - continue; - } - let obj = childs[i].element; - if(Map_QM.util.options.collision){ - if (obj.style.transform) { - obj.style.display = "" - let labP = obj.getBoundingClientRect() - for (let j = 0; j < i; j++) { - if (childs[j].element.style.display == "") { - let pb = childs[j].element.getBoundingClientRect() - let isCol = Map_QM.util.isCollision(labP, pb) - if (isCol) { - if (!childs[i].userData.mapShow) { - obj.style.display = "none" - break; - } else if (!childs[j].userData.mapShow) { - childs[j].element.style.display = "none" - } - } - } - } - } - }else{ - obj.style.display = "" - } - } - } - } - - }, + if (!Map_QM || !isShowElement) { + return; + } + if(window.requestIdleCallback){ + requestIdleCallback(Map_QM.runTaskQueue, { timeout: 300 }); + }else{ + clearTimeout(allTime); + allTime = setTimeout(() => { + clearTimeout(allTime); + Map_QM.runTaskQueue(); + }, 300); + } + }, + runTaskQueue: function (){ + if (Map_QM.mapArr[Map_QM.util.selectBuild] && Map_QM.buildObj.visible && Map_QM.mapArr[Map_QM.util.selectBuild][Map_QM.util.selectFloor]) { + if (Map_QM.mapArr[Map_QM.util.selectBuild][Map_QM.util.selectFloor].allObj.visible && (!Map_QM.buildObj.userData.hasOwnProperty("visible") || Map_QM.buildObj.userData.visible)) { + let childs = Map_QM.mapArr[Map_QM.util.selectBuild][Map_QM.util.selectFloor].labelObj.children; + let len = childs.length; + for (let i = 0; i < len; i++) { + if (!childs[i].userData.isShow) { + //是否可见 + continue; + } + if (!Map_QM.util.options.collision) { + childs[i].element.style.display = ""; + continue; + } + let obj = childs[i].element; + obj.style.display = ""; + let labP = obj.getBoundingClientRect(); + for (let j = 0; j < i; j++) { + if (childs[j].element.style.display == "") { + let pb = childs[j].element.getBoundingClientRect(); + let isCol = Map_QM.util.isCollision(labP, pb); + if (isCol) { + if (!childs[i].userData.mapShow) { + childs[i].element.style.display = "none"; + break; + } else if (!childs[j].userData.mapShow) { + childs[j].element.style.display = "none"; + } + } + } + } + } + } + } + }, /** * 寻路---------------------------------------------------------------------------------------------------------------------------------------- */ /** - * @api {方法} bounceIcon({type:"xsj"}) 图标弹跳 + * @api {方法} bounceIcon("xsj") 图标弹跳 * @apiGroup 地图导航 * @apiDescription 地图图标弹跳效果 - * @apiVersion 2.0.0 + * @apiVersion 4.0.0 * @apiParam {String} iconType 设施缩写 * * @apiSampleRequest off * * @apiParamExample {String} 请求示例 * - * Map_QM.bounceIcon({type:"xsj"}); + * Map_QM.bounceIcon("xsj"); * */ bounceIcon: function (iconType) { - let toFloor = parseInt(Map_QM.util.selectFloor) - let facs = Map_QM.mapArr[Map_QM.util.selectBuild][toFloor].serObj.children //交通图标 + TweenMax.killAll(true); + let facs = + Map_QM.mapArr[Map_QM.util.selectBuild][parseInt(Map_QM.util.selectFloor)] + .serObj.children; //交通图标 for (let i = 0; i < facs.length; i++) { - if (facs[i].type == 'Object3D') { - facs[i].reSetSite() - if (facs[i].facCode == iconType) { - facs[i].jumpIcon() + if (facs[i].type == "Object3D") { + if (facs[i].userData.facCode == iconType) { + facs[i].element.style.zIndex = 200; + let oldZ = facs[i].userData.site + 5; + TweenMax.fromTo( + facs[i].position, + 0.5, + { z: oldZ }, + { + z: oldZ + 80, + repeat: 1, + onUpdate: function () { + Map_QM.labelRenderer.renderObject( + Map_QM.mapArr[Map_QM.util.selectBuild][Map_QM.util.selectFloor].CSSObj, Map_QM.scene, Map_QM.camera); + }, + onComplete: function () { + TweenMax.to(facs[i].position, 0.2, { + z: oldZ, + onUpdate: function () { + Map_QM.labelRenderer.renderObject(Map_QM.mapArr[Map_QM.util.selectBuild][Map_QM.util.selectFloor].CSSObj, Map_QM.scene, Map_QM.camera); + }, + }); + }, + } + ); + } else { + facs[i].element.style.zIndex = 100; + } + } + } + }, + /** + * @api {方法} countPath() 方向算法 + * @apiGroup 地图导航 + * @apiDescription 计算设施、店铺的导航方向, toObj,pathType 不能同时为空 + * @apiVersion 4.0.0 + * @apiParam {Object} toObj {build,floor,node} //终点 设施寻路可以为空 + * @apiParam {String} pathType 公共设施名称或编号(点位寻路此参数为空字符串) + * @apiParam {String} countType 8--八方向(默认) 12--十二方向 + * + * @apiSampleRequest off + * + * @apiParamExample {String} 请求示例 + * + * Map_QM.countPath({build:0,floor:0,node:0},"xsj","8"); + * + */ + countPath: function (toObj, pathType = "", _countType = "8") { + direction = { code: 500, dir: "", cost: 0, gap: 0 }; + countType = _countType; + Map_QM.util.overObj = null; + if (pathType == "") { + //传入终点导航点 + Map_QM.util.overObj = toObj; + if ( + Map_QM.util.startObj.node != "" && + Map_QM.util.startObj.node != "-1" && + Map_QM.util.overObj.node != "" + ) { + this.forShopArr.length = 0; + return this.forDirPath(); + } else { + direction.code = "404"; + return direction; + } + } else { + // + let iconPath = this.pathIcon({ type: pathType }); + Map_QM.util.overObj = iconPath; + if ( + Map_QM.util.startObj.node != "" && + Map_QM.util.startObj.node != "-1" && + Map_QM.util.overObj.node != "" + ) { + this.forShopArr.length = 0; + return this.forDirPath(); + } + } + return (direction = { code: 404, dir: "", cost: 0, gap: 0 }); + }, + forDirPath: function () { + 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 PathPoint; + direction = { code: 500, dir: "", cost: 0, gap: 0 }; + try { + let obj = dijkstra.find_path(Map_QM.util.pathStateObj.graphPath,startNade,toNade); + PathPoint = obj.nodes; + direction.cost = Math.floor((obj.cost / Map_QM.util.options.mapScale) * 0.9); + direction.gap = parseInt(obj.cost / Map_QM.util.options.mapScale); + } catch (e) { + window.captureException && window.captureException(e); + console.log(e); + direction.code = 404; + return direction; + } + let index = 0; + this.forShopArr = []; + if (PathPoint.length > 1) { + this.forShopArr.push({build: Map_QM.util.startObj.build,floor: Map_QM.util.startObj.floor,PathPoint: [],}); + let pathData; + for (let j = 0; j < PathPoint.length; j++) { + let array = PathPoint[j].split("_"); + pathData = Map_QM.util.allMap[parseInt(array[0])].buildArr[parseInt(array[1])].mapData.path; + pathData.nodes.sort(Map_QM.util.sortNumber); + if (parseInt(array[1]) == this.forShopArr[index].floor) { + //同层 + this.forShopArr[index].PathPoint.push(pathData.nodes[parseInt(array[2])]); + } else { + this.forShopArr.push({ + build: parseInt(array[0]), + floor: parseInt(array[1]), + PathPoint: [], + }); + index++; + this.forShopArr[index].PathPoint.push(pathData.nodes[parseInt(array[2])]); + } + } + } else { + this.forShopArr.length = 0; + } + if (this.forShopArr.length > 0) { + //--------------------------计算方向 + direction.code = 200; + if (countType == "12") { + //16方向 + Map_QM.countSixteenArrow(); + } else { + Map_QM.countStartAndEndDire(); + } + } + console.log(this.forShopArr); + if (this.forShopArr.length > 1) { + let facType; + if (this.forShopArr[0].floor > this.forShopArr[1].floor) { + //下 + if ( + Math.abs( + parseInt(this.forShopArr[0].floor) - + parseInt(this.forShopArr[1].floor) + ) < 3 + ) { + //扶梯 + facType = Map_QM.util.getFacType("downft"); + } else { + facType = Map_QM.util.getFacType("dt"); + } + } else { + if ( + Math.abs( + parseInt(this.forShopArr[0].floor) - + parseInt(this.forShopArr[1].floor) + ) < 3 + ) { + //扶梯 + facType = Map_QM.util.getFacType("upft"); + } else { + facType = Map_QM.util.getFacType("dt"); + } + } + facType = facType + ""; + if (facType.length === 1) { + direction.dir = "600" + facType; + } else if (facType.length === 2) { + direction.dir = "60" + facType; + } else if (facType.length === 3) { + direction.dir = "6" + facType; + } + } + return direction; + }, + /** + * 计算十六方向箭头 + */ + countSixteenArrow: function () { + if (this.forShopArr[0].PathPoint.length > 1) { + let keyPoints = [], + ishas = false, + allCount = 0; + for (let i = 1; i < this.forShopArr[0].PathPoint.length; i++) { + let s = Math.sqrt(Math.pow(this.forShopArr[0].PathPoint[i].x - this.forShopArr[0].PathPoint[i - 1].x,2) + + Math.pow(this.forShopArr[0].PathPoint[i].y -this.forShopArr[0].PathPoint[i - 1].y,2)); + if (s < 20) { + continue; + } + ishas = false; + let dirObj = { + angleName: Map_QM.getPathAngle(this.forShopArr[0].PathPoint[i - 1],this.forShopArr[0].PathPoint[i]), + count: s, + }; + allCount += s; + if (keyPoints.length > 0 &&keyPoints[keyPoints.length - 1].angleName == dirObj.angleName) { + keyPoints[keyPoints.length - 1].count += s; + ishas = true; + } + if (!ishas) { + keyPoints.push(dirObj); + } + } + if (allCount < 150) { + //总长度< 150 按8方向 + Map_QM.countStartAndEndDire(); + return; + } + if (keyPoints.length == 1) { + direction.dir = Map_QM.getDirByName(keyPoints[0].angleName); + return; + } + if (keyPoints.length == 0) { + //没有路径,按方向计算 + direction.code = 404; + return; + } + let upCount = 0, + rightFrontCount = 0, + rightCount = 0, + leftFrontCount = 0; + for (let item of keyPoints) { + if (item.angleName == "up") { + upCount += item.count; + } else if (item.angleName == "down") { + upCount -= item.count; + } else if (item.angleName == "right") { + rightCount += item.count; + } else if (item.angleName == "left") { + rightCount -= item.count; + } else if (item.angleName == "rightFront") { + rightFrontCount += item.count; + } else if (item.angleName == "rightRear") { + leftFrontCount -= item.count; + } else if (item.angleName == "leftFront") { + leftFrontCount += item.count; + } else if (item.angleName == "leftRear") { + rightFrontCount -= item.count; + } + } + console.log(keyPoints); + //斜方向忽略 + let dir1 = ""; + let bjCount = Math.max(150, allCount / 10); + let onlyDir = ""; + for (let item of keyPoints) { + if ( + item.angleName != "rightFront" && + item.angleName != "leftFront" && + item.angleName != "rightRear" && + item.angleName != "leftRear" + ) { + onlyDir = + dir1.length > 0 + ? dir1.substring(dir1.length - 1, dir1.length) + : dir1; + if ( + item.angleName == "down" && + (item.count > bjCount || upCount < -1 * bjCount) + ) { + if (onlyDir != "D") { + dir1 += "D"; + } + } else if ( + item.angleName == "up" && + (item.count > bjCount || upCount > bjCount) + ) { + if (onlyDir != "T") { + dir1 += "T"; + } + } else if ( + item.angleName == "right" && + (item.count > bjCount || rightCount > bjCount) + ) { + if (onlyDir != "R") { + dir1 += "R"; + } + } else if ( + item.angleName == "left" && + (item.count > bjCount || rightCount < -1 * bjCount) + ) { + if (onlyDir != "L") { + dir1 += "L"; + } + } } } + //console.log(dir1) + if (dir1.length > 2) dir1 = dir1.substring(0, 2); //两个以上方向 + direction.dir = Map_QM.getDirByName(dir1); + if (!direction.dir) Map_QM.countStartAndEndDire(); + } else { + //没有路径,按方向计算 + direction.code = 404; + } + }, + + getDirByName: function (dir) { + switch (dir) { + default: + return ""; + case "T": + return "1201"; + case "R": + return "1202"; + case "D": + return "1203"; + case "L": + return "1204"; + case "TL": + return "1205"; + case "TR": + return "1206"; + case "RT": + return "1207"; + case "RD": + return "1208"; + case "DL": + return "1209"; + case "DR": + return "1210"; + case "LT": + return "1211"; + case "LD": + return "1212"; + case "up": + return "1201"; + case "rightFront": + return "8002"; + case "right": + return "1202"; + case "rightRear": + return "8004"; + case "down": + return "1203"; + case "leftRear": + return "8006"; + case "left": + return "1204"; + case "leftFront": + return "8008"; + } + }, + + /** + * 计算八方向坐标 + */ + countStartAndEndDire: function () { + let sPoint = new Map_QM.util.Point( + this.forShopArr[0].PathPoint[0].x, + this.forShopArr[0].PathPoint[0].y + ); //本层起始点坐标 + let ePoint = new Map_QM.util.Point( + this.forShopArr[0].PathPoint[this.forShopArr[0].PathPoint.length - 1].x, + this.forShopArr[0].PathPoint[this.forShopArr[0].PathPoint.length - 1].y + ); //本层结束点坐标 + switch (Map_QM.getPathAngle(sPoint, ePoint)) { + default: + direction.dir = "8001"; + case "up": + direction.dir = "8001"; + break; + case "rightFront": + direction.dir = "8002"; + break; + case "right": + direction.dir = "8003"; + break; + case "rightRear": + direction.dir = "8004"; + break; + case "down": + direction.dir = "8005"; + break; + case "leftRear": + direction.dir = "8006"; + break; + case "left": + direction.dir = "8007"; + break; + case "leftFront": + direction.dir = "8008"; + break; + } + }, + + getPathAngle: function (sPoint, ePoint) { + let x = Math.abs(sPoint.x - ePoint.x); + let y = Math.abs(sPoint.y - ePoint.y); + let tan = x / y; + let radina = Math.atan(tan); //用反三角函数求弧度 + let angle = Math.floor(180 / (Math.PI / radina)) || 0; //将弧度转换成角度 + + if (ePoint.x > sPoint.x && ePoint.y > sPoint.y) { + // 右下方 + angle = 180 - angle; + } + if (ePoint.x == sPoint.x && ePoint.y > sPoint.y) { + // 正下方 + angle = 180; + } + if (ePoint.x < sPoint.x && ePoint.y > sPoint.y) { + //左下方 + angle = angle - 180; + } + if (ePoint.x < sPoint.x && ePoint.y == sPoint.y) { + //左方 + angle = -90; + } + if (ePoint.x < sPoint.x && ePoint.y < sPoint.y) { + // 左上方 + angle = -1 * angle; + } + if (ePoint.x == sPoint.x && ePoint.y < sPoint.y) { + //上方 + angle = 0; + } + if (ePoint.x > sPoint.x && ePoint.y < sPoint.y) { + //右上方 + angle = angle; + } + if (ePoint.x > sPoint.x && ePoint.y == sPoint.y) { + //point在x轴正方向上 + angle = 90; + } + angle -= Map_QM.util.deviceObj.angle; + angle = angle > 180 ? angle - 360 : angle; + angle = angle < -180 ? angle + 360 : angle; + + if (angle > -22 && angle <= 22) { + //前 + return "up"; + } else if (angle > 22 && angle <= 67) { + //右前 + return "rightFront"; + } else if (angle > 67 && angle <= 112) { + //右 + return "right"; + } else if (angle > 112 && angle <= 158) { + //右后 + return "rightRear"; + } else if (angle > 158 || angle <= -158) { + //后 + return "down"; + } else if (angle > -158 && angle <= -112) { + //左后 + return "leftRear"; + } else if (angle > -112 && angle <= -67) { + //左 + return "left"; + } else { + //左前 + return "leftFront"; } }, /** * @api {方法} pathIcon({type:"xsj"}) 获取最近设施 * @apiGroup 地图导航 * @apiDescription 获取离当前楼层最近的设施 - * @apiVersion 2.0.0 + * @apiVersion 4.0.0 * @apiParam {JSON} type 设施缩写 * * @apiSampleRequest off @@ -3088,84 +4402,103 @@ MainMap_QM.prototype = { * } * */ - pathIcon: function (iconType) { - let selIcon; // - let minS = -1; - if (!Map_QM.util.startObj.build && parseInt(Map_QM.util.startObj.build) != 0) { - Map_QM.util.startObj.build = parseInt(Map_QM.util.deviceObj.build); - } - try{ - 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.graphPath, startNade, startNade).costs; - if (costAll) { - for (let i = 0; i < Map_QM.mapArr[parseInt(Map_QM.util.deviceObj.build)].length; i++) { - let sers = Map_QM.mapArr[parseInt(Map_QM.util.deviceObj.build)][i].serObj.children; //服务图标 - for (let n = 0; n < sers.length; n++) { - if (sers[n].userData.facCode == iconType.type || ((iconType.type=="xsjn" || iconType.type=="xsjv") && sers[n].userData.facCode=="xsj")) { - let toNade = sers[n].userData.buildOrder+ "_" + sers[n].userData.floorOrder + "_" + sers[n].userData.navCode; - if (!selIcon) { - minS = costAll[toNade]; - if (minS) { - selIcon = sers[n]; - } - } else { - let s1 = costAll[toNade]; - if (s1 && s1 < minS) { - minS = s1; - selIcon = sers[n]; - } - } - } - } - } - - if (selIcon) { - return { "build": parseInt(Map_QM.util.deviceObj.build), "floor": selIcon.userData.floorOrder, "site": { x: selIcon.position.x, y: selIcon.position.y }, "node": selIcon.userData.navCode, "no": selIcon.userData.no, "typeCode": Map_QM.util.getFacType(iconType.type) }; - } else { // 当前楼栋没有 - for (let b = 0; b < Map_QM.mapArr.length; b++) { - if (b != parseInt(Map_QM.util.deviceObj.build)) { - for (let i = 0; i < Map_QM.mapArr[b].length; i++) { - let sers = Map_QM.mapArr[b][i].serObj.children; //服务图标 - for (let n = 0; n < sers.length; n++) { - if (sers[n].userData.facCode == iconType.type) { - let toNade = b + "_" + sers[n].userData.floorOrder + "_" + sers[n].userData.navCode; - if (!selIcon) { - minS = costAll[toNade]; - if (minS) { - selIcon = sers[n]; - selIcon.build = b; - } - } else { - let s1 = costAll[toNade]; - if (s1 && s1 < minS) { - minS = s1; - selIcon = sers[n]; - selIcon.build = b; - } - } - } - } - } - } - } - if (selIcon) { - return { "build": selIcon.userData.buildOrder, "floor": selIcon.userData.floorOrder, "node": selIcon.userData.navCode, "site": { x: selIcon.position.x, y: selIcon.position.y }, "no": selIcon.userData.no, "typeCode": Map_QM.util.getFacType(iconType.type) }; - } - } - } - }catch(e){ - console.log(e) - } - }, + pathIcon: function (iconType) { + let selIcon; // + let minS = -1; + if ( + !Map_QM.util.startObj.build && + parseInt(Map_QM.util.startObj.build) != 0 + ) { + Map_QM.util.startObj.build = parseInt(Map_QM.util.deviceObj.build); + } + try { + 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; + if (costAll) { + for (let i = 0;i < Map_QM.mapArr[parseInt(Map_QM.util.deviceObj.build)].length;i++) { + let sers =Map_QM.mapArr[parseInt(Map_QM.util.deviceObj.build)][i].serObj.children; //服务图标 + for (let n = 0; n < sers.length; n++) { + if (sers[n].userData.facCode == iconType.type ||((iconType.type == "xsjn" || iconType.type == "xsjv") && sers[n].userData.facCode == "xsj")) { + let toNade =sers[n].userData.buildOrder +"_" +sers[n].userData.floorOrder +"_" +sers[n].userData.navCode; + if (!selIcon) { + minS = costAll[toNade]; + if (minS) { + selIcon = sers[n]; + } + } else { + let s1 = costAll[toNade]; + if (s1 && s1 < minS) { + minS = s1; + selIcon = sers[n]; + } + } + } + } + } + + if (selIcon) { + return { + build: parseInt(Map_QM.util.deviceObj.build), + floor: selIcon.userData.floorOrder, + site: { x: selIcon.position.x, y: selIcon.position.y }, + node: selIcon.userData.navCode, + no: selIcon.userData.no, + typeCode: Map_QM.util.getFacType(iconType.type), + }; + } else { + // 当前楼栋没有 + for (let b = 0; b < Map_QM.mapArr.length; b++) { + if (b != parseInt(Map_QM.util.deviceObj.build)) { + for (let i = 0; i < Map_QM.mapArr[b].length; i++) { + let sers = Map_QM.mapArr[b][i].serObj.children; //服务图标 + for (let n = 0; n < sers.length; n++) { + if (sers[n].userData.facCode == iconType.type) { + let toNade =b +"_" +sers[n].userData.floorOrder +"_" +sers[n].userData.navCode; + if (!selIcon) { + minS = costAll[toNade]; + if (minS) { + selIcon = sers[n]; + selIcon.build = b; + } + } else { + let s1 = costAll[toNade]; + if (s1 && s1 < minS) { + minS = s1; + selIcon = sers[n]; + selIcon.build = b; + } + } + } + } + } + } + } + if (selIcon) { + return { + build: selIcon.userData.buildOrder, + floor: selIcon.userData.floorOrder, + node: selIcon.userData.navCode, + site: { x: selIcon.position.x, y: selIcon.position.y }, + no: selIcon.userData.no, + typeCode: Map_QM.util.getFacType(iconType.type), + }; + } + } + } + } catch (e) { + window.captureException && window.captureException(e); + console.log(e); + } + }, /** * @api {方法} pathByStartAndOver(startObj,toObj,callBackFun) 地图路径规划 * @apiGroup 地图导航 * @apiDescription 根据传入的起、终点;直接导航 - * @apiVersion 2.0.0 - * @apiParam {String} startObj.shopNum 店铺编号/车位编号 + * @apiVersion 4.0.0 + * @apiParam {String} startObj.houseNumber 店铺编号/车位编号 * @apiParam {String} startObj.type "shop"/"park" * - * @apiParam {String} toObj.shopNum 店铺编号/车位编号 + * @apiParam {String} toObj.houseNumber 店铺编号/车位编号 * @apiParam {String} toObj.type "shop"/"park" * * @apiParam {Function} callBackFun 回调函数 @@ -3174,16 +4507,17 @@ MainMap_QM.prototype = { * * @apiParamExample {String} 请求示例 * - * Map_QM.pathByStartAndOver({"shopNum":"L102","type":"shop"},{"shopNum":"L204","type":"shop"}); + * Map_QM.pathByStartAndOver({"houseNumber":"L102","type":"shop"},{"houseNumber":"L204","type":"shop"}); * */ pathByStartAndOver: function (startObj, toObj, callBackFun) { try { - Map_QM.util.startObj = this.shopNumToNavPoint(startObj, startObj.type) - let overObj = this.shopNumToNavPoint(toObj, toObj.type) - this.pathNode(overObj, callBackFun) + Map_QM.util.startObj = this.shopNumToNavPoint(startObj, startObj.type); + let overObj = this.shopNumToNavPoint(toObj, toObj.type); + this.pathNode(overObj, callBackFun); } catch (e) { - return '传入点位无法导航' + window.captureException && window.captureException(e); + return "传入点位无法导航"; } }, @@ -3191,7 +4525,7 @@ MainMap_QM.prototype = { * @api {方法} changeStartPoint() 设置起始点位 * @apiGroup 地图导航 * @apiDescription 设置起始点位 - * @apiVersion 2.0.0 + * @apiVersion 4.0.0 * @apiParam {int} build 起点楼栋编号 * @apiParam {int} floor 起点楼层编号 * @apiParam {String} node 起点编号 @@ -3205,42 +4539,48 @@ MainMap_QM.prototype = { * */ changeStartPoint: function (toObj) { - this.clearFloor() - 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--) { - let obj = this.mapArr[parseInt(this.util.startObj.build)][i].allObj.children[len] - if (obj.userData.type == 'start') { - this.mapArr[parseInt(this.util.startObj.build)][i].allObj.remove(obj) + this.clearFloor(); + if (this.mapArr) { + 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--) { + let obj =this.mapArr[parseInt(this.util.startObj.build)][i].allObj.children[len]; + if (obj.userData.type == "start") { + this.mapArr[parseInt(this.util.startObj.build)][i].allObj.remove(obj); + } } } } + this.util.startObj = {}; if (toObj && toObj.node) { - let pathData = this.util.allMap[parseInt(toObj.build)].buildArr[parseInt(toObj.floor)].mapData.path - this.util.startObj.xaxis = pathData.nodes[parseInt(toObj.node)].x - this.util.startObj.yaxis = pathData.nodes[parseInt(toObj.node)].y - this.util.startObj.build = parseInt(toObj.build); - this.util.startObj.floor = parseInt(toObj.floor); - this.util.startObj.node = toObj.node; - this.util.startObj.angle = toObj.angle || 0; + let pathData =this.util.allMap[parseInt(toObj.build)].buildArr[parseInt(toObj.floor)].mapData.path; + this.util.startObj.xaxis = pathData.nodes[parseInt(toObj.node)].x; + this.util.startObj.yaxis = pathData.nodes[parseInt(toObj.node)].y; + this.util.startObj.build = parseInt(toObj.build); + this.util.startObj.floor = parseInt(toObj.floor); + this.util.startObj.node = toObj.node; + this.util.startObj.angle = toObj.angle || 0; } else { - let pathData = this.util.allMap[parseInt(this.util.deviceObj.build)].buildArr[parseInt(this.util.deviceObj.floor)].mapData.path - pathData.nodes.sort(this.util.sortNode) - this.util.deviceObj.xaxis = pathData.nodes[parseInt(this.util.deviceObj.node)].x - this.util.deviceObj.yaxis = pathData.nodes[parseInt(this.util.deviceObj.node)].y - this.util.startObj = this.util.deviceObj + this.util.startObj.xaxis = this.util.deviceObj.xaxis; + this.util.startObj.yaxis = this.util.deviceObj.yaxis; + this.util.startObj.build = parseInt(this.util.deviceObj.build); + this.util.startObj.floor = parseInt(this.util.deviceObj.floor); + this.util.startObj.node = this.util.deviceObj.node; + this.util.startObj.angle = this.util.deviceObj.angle; + this.util.startObj.xaxis = this.util.deviceObj.xaxis; + this.util.startObj.yaxis = this.util.deviceObj.yaxis; } this.mapArr[parseInt(this.util.startObj.build)][parseInt(this.util.startObj.floor)].setStartSite( this.util.startObj.xaxis, this.util.startObj.yaxis, - parseInt(this.util.shopHeight)+20 - ) + parseInt(this.util.shopHeight) + 20 + ); }, /** * @api {方法} changeMapIPState(ipName,color) 改变POI颜色 * @apiGroup 地图交互 * @apiDescription 改变POI 颜色 - * @apiVersion 2.0.0 + * @apiVersion 4.0.0 * @apiParam {string} ipName POI名称 * @apiParam {string} color 颜色字符串 * @@ -3251,48 +4591,50 @@ MainMap_QM.prototype = { * Map_QM.changeMapIPState("L1001","#ffff00"); * */ - changeMapIPState: function (ipName, color) { // #775544 #AD8164 - for (let i = 0; i < this.mapArr[this.util.selectBuild].length; i++) { - let shopArr = this.mapArr[this.util.selectBuild][i].shopObj.children - for (let k = 0; k < shopArr.length; k++) { - if (shopArr[k].name == ipName || (shopArr[k].userData && shopArr[k].userData.houseNumber == ipName)) { - shopArr[k].userData.initMaterial = shopArr[k].material - shopArr[k].material = this.util.getMeshMaterial(color || 0xeab16e) - break - } - } - } - }, - /** - * @api {方法} resetMapIPState(ipName) 恢复POI颜色 - * @apiGroup 地图交互 - * @apiDescription 恢复POI初始颜色 - * @apiVersion 4.0.0 - * @apiParam {string} ipName POI名称 - * - * @apiSampleRequest off - * - * @apiParamExample 请求示例 - * - * Map_QM.resetMapIPState("L101"); - * - */ - resetMapIPState: function (ipName) { - for (let i = 0; i < this.mapArr[this.util.selectBuild].length; i++) { - let shopArr = this.mapArr[this.util.selectBuild][i].shopObj.children - for (let k = 0; k < shopArr.length; k++) { - if (shopArr[k].name == ipName) { - shopArr[k].material = shopArr[k].userData.initMaterial - break - } - } - } - }, + changeMapIPState: function (ipName, color) { + // #775544 #AD8164 + for (let i = 0; i < this.mapArr[this.util.selectBuild].length; i++) { + let shopArr = this.mapArr[this.util.selectBuild][i].shopObj.children; + for (let k = 0; k < shopArr.length; k++) { + if (shopArr[k].name == ipName ||(shopArr[k].userData && shopArr[k].userData.houseNumber == ipName)) { + shopArr[k].userData.initMaterial = shopArr[k].material; + shopArr[k].material = this.util.getMeshMaterial(color || 0xeab16e); + break; + } + } + } + }, + /** + * @api {方法} resetMapIPState(ipName) 恢复POI颜色 + * @apiGroup 地图交互 + * @apiDescription 恢复POI初始颜色 + * @apiVersion 4.0.0 + * @apiParam {string} ipName POI名称 + * + * @apiSampleRequest off + * + * @apiParamExample 请求示例 + * + * Map_QM.resetMapIPState("L101"); + * + */ + resetMapIPState: function (ipName) { + for (let i = 0; i < this.mapArr[this.util.selectBuild].length; i++) { + let shopArr = this.mapArr[this.util.selectBuild][i].shopObj.children; + for (let k = 0; k < shopArr.length; k++) { + if (shopArr[k].name == ipName) { + shopArr[k].material = shopArr[k].userData.initMaterial; + break; + } + } + } + }, + /** * @api {方法} getMapIPData(ipName) 获取POI 基础数据 * @apiGroup 地图交互 * @apiDescription 获取POI 基础数据 - * @apiVersion 2.0.0 + * @apiVersion 4.0.0 * @apiParam {string} ipName POI名称 * * @apiSampleRequest off @@ -3303,15 +4645,15 @@ MainMap_QM.prototype = { * * @apiSuccessExample 返回示例 * { - * shopNum:店铺编号, shopName:店铺名 node:导航点, floor:楼层编号, xaxis:中心点X坐标, yaxis:中心点Y坐标, borderColor:边框色, entColor:填充色 + * houseNumber:店铺编号, shopName:店铺名 node:导航点, floor:楼层编号, xaxis:中心点X坐标, yaxis:中心点Y坐标, borderColor:边框色, entColor:填充色 * } */ getMapIPData: function (ipName) { for (let i = 0; i < Map_QM.mapArr[Map_QM.util.selectBuild].length; i++) { - let shopArr = Map_QM.mapArr[Map_QM.util.selectBuild][i].shopObj.children + let shopArr = Map_QM.mapArr[Map_QM.util.selectBuild][i].shopObj.children; for (let k = 0; k < shopArr.length; k++) { - if (shopArr[k].name == ipName || (shopArr[k].userData && shopArr[k].userData.houseNumber == ipName)) { - return shopArr[k].userData + if (shopArr[k].name == ipName ||(shopArr[k].userData && shopArr[k].userData.houseNumber == ipName)) { + return shopArr[k].userData; } } } @@ -3321,7 +4663,7 @@ MainMap_QM.prototype = { * @api {方法} pathNode() 地图模拟导航 * @apiGroup 地图导航 * @apiDescription 地图路径模拟导航 - * @apiVersion 2.0.0 + * @apiVersion 4.0.0 * @apiParam {int} floor 楼层编号 * @apiParam {string} node 路径点位编号 * @apiParam {function} callBackFun 回调方法 @@ -3334,69 +4676,360 @@ MainMap_QM.prototype = { * */ pathNode: function (toObj, callBackFun) { + Map_QM.util.isMorePath = false; if (!toObj) { - return { direction: '', wayList: [] } + return { direction: "", wayList: [] }; } - pathCameraState = Map_QM.util.options.pathStyle + pathCameraState = Map_QM.util.options.pathStyle; Map_QM.reSetGuide(); - Map_QM.onShowDeviceSite() - Map_QM.selectShop = null - Map_QM.util.pathStateObj.isPathState = true + Map_QM.onShowDeviceSite(); + Map_QM.selectShop = null; + Map_QM.util.pathStateObj.isPathState = true; 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 + ) { + Map_QM.controls.maxDistance = Map_QM.util.changeDist.inner; + } if (!Map_QM.util.startObj.xaxis && !Map_QM.util.startObj.yaxis) { - Map_QM.changeStartPoint(null) + Map_QM.changeStartPoint(null); } - Map_QM.util.overObj = null - Map_QM.util.overObj = { build: toObj.build || 0, floor: toObj.floor, node: toObj.node, shopNum: toObj.shopNum } - if (Map_QM.util.overObj.node != '') { - Map_QM.cancelRender() - this.onFindPathModel() + Map_QM.util.overObj = null; + Map_QM.util.overObj = { + build: toObj.build || 0, + floor: toObj.floor, + node: toObj.node, + houseNumber: toObj.houseNumber, + comeIn: toObj.comeIn || "", + }; + if (Map_QM.util.overObj.node != "") { + Map_QM.cancelRender(); + this.onFindPathModel(); if (callBackFun) { - Map_QM.parseForShopArr() - const data = JSON.parse(JSON.stringify(Map_QM.util.pathStateObj.forShopArr)) - callBackFun(data) + Map_QM.parseForShopArr(); + const data = JSON.parse( + JSON.stringify(Map_QM.util.pathStateObj.forShopArr) + ); + callBackFun(data); + } + Map_QM.startRender(); + } + }, + + /** + * @api {方法} pathShopList() 指定路径导航 + * @apiGroup 地图导航 + * @apiDescription 根据传入的店铺编号列表绘制导航路径 + * @apiVersion 4.0.0 + * @apiParam {Array} shopList 路径的店铺编号数组 + * @apiParam {Function} callBackFun 回调函数 + * + * @apiSampleRequest off + * + * @apiParamExample 请求示例 + * + * Map_QM.pathShopList(["L1-1","L1-5","L1-8","L1-10","LA-13"],()=>{}); + * + */ + pathShopList: function (shopList, callBackFun) { + if (!shopList || shopList.length < 2) { + return { direction: "", wayList: [] }; + } + let pathList = shopList.map(Map_QM.getPathNodeByHousenumber); + Map_QM.pathList(pathList, callBackFun); + }, + /** + * 获取导航点 + */ + getPathNodeByHousenumber: function (houseNumber) { + for (let h = 0; h < Map_QM.mapArr.length; h++) { + for (let i = 0; i < Map_QM.mapArr[h].length; i++) { + let shopArr = Map_QM.mapArr[h][i].shopObj.children; + for (let k = 0; k < shopArr.length; k++) { + if ( + shopArr[k].name == houseNumber && + parseInt(shopArr[k].node) >= 0 + ) { + return { + build: h, + floor: i, + path: h + "_" + i + "_" + shopArr[k].node, + node: shopArr[k].node, + }; + } + } + } + } + }, + getPathNodeByNode: function (nodeObj) { + let build = nodeObj.buildOrder || 0; + let floor = nodeObj.floorOrder || 0; + let node = parseInt(nodeObj.node); + if (isNaN(node)) { + return null; + } else { + return { + build: build, + floor: floor, + path: build + "_" + floor + "_" + node, + node: node, + }; + } + }, + /** + * @api {方法} pathShopList() 指定路径导航 + * @apiGroup 地图导航 + * @apiDescription 根据传入的店铺编号列表绘制导航路径 + * @apiVersion 4.0.0 + * @apiParam {Array} shopList 路径的店铺编号数组 + * @apiParam {Function} callBackFun 回调函数 + * + * @apiSampleRequest off + * + * @apiParamExample 请求示例 + * [{buildOrder:0,floorOrder:0,node:8},{buildOrder:0,floorOrder:0,node:13},{buildOrder:0,floorOrder:0,node:16},{buildOrder:0,floorOrder:0,node:20}],()=>{} + */ + pathNodeList: function (nodeList, callBackFun, isShowNo = true) { + Map_QM.elementDestroy("map_no", true); + if (!nodeList || nodeList.length < 2) { + return { direction: "", wayList: [] }; + } + Map_QM.selectShop = null; + Map_QM.util.pathStateObj.isPathState = true; + let pathList = nodeList.map(Map_QM.getPathNodeByNode); + Map_QM.pathList(pathList, callBackFun, isShowNo); + }, + pathList: function (pathList, callBackFun, isShowNo = false) { + Map_QM.util.isMorePath = true; + Map_QM.clearFloor(Map_QM.util.selectFloor || -1); + pathCameraState = Map_QM.util.options.pathStyle; + Map_QM.selectShop = null; + Map_QM.util.pathStateObj.isPathState = true; + Map_QM.cancelRender(); + let startNode, + endNode, + isFrist = true, + PathPoint = []; + try { + let index = 0, + findIndex = 0, + pathNodes = []; + pathList.forEach((item, inx) => { + if (isShowNo) { + //显示序号 + let pathN =Map_QM.util.allMap[parseInt(item.build)].buildArr[parseInt(item.floor)].mapData.path.nodes; + pathN.sort(Map_QM.util.sortNode); + let labelDiv = document.createElement("div"); + labelDiv.className = "map_no"; + labelDiv.innerText = inx + 1; + let img = document.createElement("img"); + img.src = "../static/img/arrowBlack.svg"; + labelDiv.appendChild(img); + let shopLabel = new THREE.CSS2DObject(labelDiv); + shopLabel.position.set(pathN[parseInt(item.node)].x,-1 * pathN[parseInt(item.node)].y,30); + shopLabel.applyMatrix4(Map_QM.mapArr[parseInt(item.build)][parseInt(item.floor)].allObj.matrix); + shopLabel.userData.type = "map_no"; + shopLabel.userData.index = inx; + shopLabel.userData.mapShow = true; + shopLabel.userData.isShow = false; //切换楼层默认不显示,且不参与碰撞检测 + Map_QM.CSSObject.add(shopLabel); + } + + if (startNode && startNode.path) { + endNode = item; + if (endNode && endNode.path) { + let iNodes = + Map_QM.util.allMap[parseInt(endNode.build)].buildArr[parseInt(endNode.floor)].mapData.path.nodes; + iNodes.sort(Map_QM.util.sortNode); + Map_QM.util.overObj.build = endNode.build; + Map_QM.util.overObj.floor = endNode.floor; + Map_QM.util.overObj.node = endNode.node; + Map_QM.util.overObj.xaxis = iNodes[parseInt(endNode.node)].x; + Map_QM.util.overObj.yaxis = iNodes[parseInt(endNode.node)].y; + Map_QM.util.overObj.angle = 0; + let pathNode = dijkstra.find_path(Map_QM.util.pathStateObj.graphPath,startNode.path,endNode.path).nodes; + if (pathNode.length > 1) { + let pathData; + for (let j = 0; j < pathNode.length; j++) { + let array = pathNode[j].split("_"); + if (j == 0 && isFrist) { + pathNodes.push({build: parseInt(array[0]),floor: parseInt(array[1]),pathNode: []}); + } + pathData = Map_QM.util.allMap[parseInt(array[0])].buildArr[parseInt(array[1])].mapData.path; + pathData.nodes.sort(Map_QM.util.sortNode); + if (array[0] == pathNodes[index].build) { + if (array[1] == pathNodes[index].floor) { + if (!pathNodes[index].pathNode[findIndex]) { + pathNodes[index].pathNode[findIndex] = []; + } + pathNodes[index].pathNode[findIndex].push(pathData.nodes[parseInt(array[2])]); + } else { + if (j > 0) { + pathNodes[index].Facilities = this.getFacilIcon(pathNode[j - 1].split("_"),parseInt(array[0])); + } else { + pathNodes[index].Facilities = null; + } + pathNodes.push({build: parseInt(array[0]),floor: parseInt(array[1]),pathNode: [],}); + index++; + findIndex = 0; + if (!pathNodes[index].pathNode[findIndex]) { + pathNodes[index].pathNode[findIndex] = []; + } + pathNodes[index].pathNode[findIndex].push(pathData.nodes[parseInt(array[2])]); + } + } else { + pathNodes.push({ build: parseInt(array[0]),floor: parseInt(array[1]),pathNode: []}); + index++; + findIndex = 0; + if (!pathNodes[index].pathNode[findIndex]) { + pathNodes[index].pathNode[findIndex] = []; + } + pathNodes[index].pathNode[findIndex].push( + pathData.nodes[parseInt(array[2])] + ); + } + } + } + if (isFrist) { + isFrist = false; + } else { + pathNode.shift(); + } + PathPoint.push(...pathNode); + startNode = endNode; + findIndex++; + } + } else { + startNode = item; + Map_QM.changeStartPoint({ + build: startNode.build, + floor: startNode.floor, + node: startNode.node, + angle: 0, + }); + } + }); + } catch (e) { + window.captureException && window.captureException(e); + console.log(e); + return; + } + Map_QM.forShopArr.length = 0; + Map_QM.util._indexPathFloor = 0; + Map_QM.util.pathStateObj.isPathPlay = true; + Map_QM.forShopListPath(PathPoint); //传入所有导航点 + if (callBackFun) { + Map_QM.parseForShopArr(); + const data = JSON.parse( + JSON.stringify(Map_QM.util.pathStateObj.forShopArr) + ); + callBackFun(data); + } + Map_QM.startRender(); + pathNodeList = null; + }, + + forShopListPath: function (PathPoint) { + let index = 0; + this.forShopArr = []; + if (PathPoint.length > 1) { + let pathData; + for (let j = 0; j < PathPoint.length; j++) { + let array = PathPoint[j].split("_"); + if (j == 0) { + this.forShopArr.push({ + build: parseInt(array[0]), + floor: parseInt(array[1]), + PathPoint: [], + }); + } + pathData = Map_QM.util.allMap[parseInt(array[0])].buildArr[parseInt(array[1])].mapData.path; + pathData.nodes.sort(Map_QM.util.sortNode); + if (array[0] == this.forShopArr[index].build) { + if (array[1] == this.forShopArr[index].floor) { + this.forShopArr[index].PathPoint.push(pathData.nodes[parseInt(array[2])]); + } else { + if (j > 0) { + this.forShopArr[index].Facilities = this.getFacilIcon(PathPoint[j - 1].split("_"),parseInt(array[0])); + } else { + this.forShopArr[index].Facilities = null; + } + this.forShopArr.push({build: parseInt(array[0]),floor: parseInt(array[1]),PathPoint: []}); + index++; + this.forShopArr[index].PathPoint.push(pathData.nodes[parseInt(array[2])]); + } + } else { + this.forShopArr.push({ build: parseInt(array[0]), floor: parseInt(array[1]), PathPoint: []}); + index++; + this.forShopArr[index].PathPoint.push(pathData.nodes[parseInt(array[2])]); + } + } + if (Map_QM.forShopArr.length > 0) { + // "floor" PathPoint Direction (Facilities) + for (let m = 0; m < Map_QM.forShopArr.length; m++) { + //查找经过店铺 + Map_QM.forShopArr[m].wayShop = Map_QM.foreignShop( + Map_QM.forShopArr[m].PathPoint, + Map_QM.forShopArr[m].build, + Map_QM.forShopArr[m].floor, + m + ); + if (Map_QM.util.overObj.build == Map_QM.forShopArr[m].build &&Map_QM.util.overObj.floor == Map_QM.forShopArr[m].floor) { + let len = Map_QM.forShopArr[m].wayShop.length; + if (Map_QM.forShopArr[m].wayShop[len - 1] && Map_QM.forShopArr[m].wayShop[len - 1].shop.yaxis == Map_QM.util.overObj.node) { + Map_QM.forShopArr[m].wayShop.pop(); + } + } + } + } else { + console.error("无可行路径"); + return; } - Map_QM.startRender() + this.onFindPathToObj(); } + pathNodeList = null; }, + parseForShopArr: function () { - Map_QM.util.pathStateObj.forShopArr = { direction: '', wayList: [] } + Map_QM.util.pathStateObj.forShopArr = { direction: "", wayList: [] }; Map_QM.forShopArr.forEach((item, index) => { - if (item.hasOwnProperty('Direction')) { - Map_QM.util.pathStateObj.forShopArr.direction = item.Direction - Map_QM.util.pathStateObj.forShopArr.directionEn = item.DirectionEn + if (item.hasOwnProperty("Direction")) { + Map_QM.util.pathStateObj.forShopArr.direction = item.Direction; + Map_QM.util.pathStateObj.forShopArr.directionEn = item.DirectionEn; } - if (item.hasOwnProperty('wayShop') && item.wayShop) { + if (item.hasOwnProperty("wayShop") && item.wayShop) { for (let i = 0; i < item.wayShop.length; i++) { - let enTlite = item.wayShop[i].shop.nameEn == '' ? item.wayShop[i].shop.name : item.wayShop[i].shop.nameEn + let enTlite = item.wayShop[i].shop.shopNameEn == "" ? item.wayShop[i].shop.shopName : item.wayShop[i].shop.shopNameEn; Map_QM.util.pathStateObj.forShopArr.wayList.push({ isAddPrefix: false, - name: '经过 ' + item.wayShop[i].shop.name, - nameEn: 'PASS ' + enTlite, - logoPath: item.wayShop[i].shop.logoPath, - code: item.wayShop[i].shop.code, - shopNum: item.wayShop[i].shop.houseNumber - }) + shopName: "经过 " + item.wayShop[i].shop.shopName || item.wayShop[i].shop.name, + shopNameEn: "PASS " + enTlite, + logoPath: item.wayShop[i].shop.logoPath || item.wayShop[i].shop.logoUrl, + shopCode: item.wayShop[i].shop.shopCode, + houseNumber: item.wayShop[i].shop.houseNumber, + }); } } - if (item.hasOwnProperty('Facilities') && item.Facilities) { + if (item.hasOwnProperty("Facilities") && item.Facilities) { //设施 Map_QM.util.pathStateObj.forShopArr.wayList.push({ isAddPrefix: true, - name: '乘坐 ' + item.Facilities.userData.title + '到 ' + Map_QM.mapArr[Map_QM.util.selectBuild][parseInt(Map_QM.forShopArr[index + 1].floor)].floorName, - nameEn: 'BY ' + item.Facilities.userData.title + 'TO ' + Map_QM.mapArr[Map_QM.util.selectBuild][parseInt(Map_QM.forShopArr[index + 1].floor)].floorName, + shopName: "乘坐 " + item.Facilities.userData.title +"到 " + Map_QM.mapArr[parseInt(Map_QM.forShopArr[index + 1].build)][parseInt(Map_QM.forShopArr[index + 1].floor)].floorName, + shopNameEn:"BY " +item.Facilities.userData.title +"TO " + Map_QM.mapArr[parseInt(Map_QM.forShopArr[index + 1].build)][parseInt(Map_QM.forShopArr[index + 1].floor)].floorName, logoPath: item.Facilities.imgUrl, - code: ((Math.random() * 0x1234567) | 0).toString(16).substring(0), - shopNum: item.Facilities.userData.facCode + item.Facilities.userData.no - }) + shopCode: ((Math.random() * 0x1234567) | 0).toString(16).substring(0), + houseNumber:item.Facilities.userData.facCode + item.Facilities.userData.no, + }); } - }) + }); }, /** * @api {方法} getGapByPathNode() 获取实际距离 * @apiGroup 地图导航 * @apiDescription 通过点位获取距离 - * @apiVersion 2.0.0 + * @apiVersion 4.0.0 * @apiParam {int} floor 楼层编号 * @apiParam {string} node 路径点位编号 * @@ -3412,109 +5045,50 @@ MainMap_QM.prototype = { * } */ getGapByPathNode: function (toObj) { - 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 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 path = { cost: -1 }, - minTime = 1 + minTime = 1; try { - path = dijkstra.find_path(Map_QM.util.pathStateObj.graphPath, startNade, toNade) - 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)} 米,预计${mint} 分钟`) // 21 是比例尺 + path = dijkstra.find_path( Map_QM.util.pathStateObj.basePath,startNade,toNade); + 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 是比例尺 } catch (e) { - console.log(e) - } - return { dis: parseInt(path.cost / Map_QM.util.options.mapScale), time: minTime } - }, - /** - * @api {方法} getAllIcon() 获取所有Icon - * @apiGroup 地图数据 - * @apiDescription 获取所有Icon - * @apiVersion 2.0.0 - * @apiParam {int} floorOrder 楼层编号(默认 所有) - * - * @apiSampleRequest off - * - */ - getAllIcon: function (floorOrder = -1, buildOrder = -1) { - let icons = [] - if (floorOrder != -1) { - let bd = buildOrder == -1 ? Map_QM.util.selectBuild : buildOrder - let sers = Map_QM.mapArr[bd][floorOrder].serObj.children //服务图标 - for (let n = 0; n < sers.length; n++) { - if (sers[n].type == 'Object3D'&& sers[n].userData.type == "icon") { - let title = sers[n].userData.title || Map_QM.util.getFacName(sers[n].userData.facCode) - let titleEn = Map_QM.util.iconEn[title] - let type = sers[n].userData.facCode - let imgUrl = sers[n].userData.src - if (sers[n].userData.facCode == 'upft' || sers[n].userData.facCode == 'downft' || sers[n].userData.facCode == 'ft') { - if (title == '上扶梯' || title == '下扶梯') { - title = '扶梯' - } - titleEn = Map_QM.util.iconEn[title] - type = 'ft' - } - let icon = { type: type, floor: floorOrder, imgUrl: imgUrl, poid: sers[n].userData.poid, title: title, titleEn: titleEn } - icons.push(icon) - } - } - return icons - } - - for (let j = 0; j < Map_QM.mapArr.length; j++) { - let iconBuild = [] - for (let i = 0; i < Map_QM.mapArr[j].length; i++) { - let iconArr = [] - if (Map_QM.mapArr[j][i].serObj) { - let sers = Map_QM.mapArr[j][i].serObj.children //服务图标 - for (let n = 0; n < sers.length; n++) { - if (sers[n].type == 'Object3D' && sers[n].userData.type == "icon") { - let title = sers[n].userData.title || Map_QM.util.getFacName(sers[n].userData.facCode) - let titleEn = Map_QM.util.iconEn[title] - let type = sers[n].userData.facCode - let imgUrl = sers[n].userData.src - if (sers[n].userData.facCode == 'upft' || sers[n].userData.facCode == 'downft' || sers[n].userData.facCode == 'ft') { - title = '扶梯' - titleEn = Map_QM.util.iconEn[title] - type = 'ft' - } - let icon = { type: type, floor: i, imgUrl: imgUrl, poid: sers[n].userData.poid, title: title, titleEn: titleEn } - iconArr.push(icon) - } - } - } - iconBuild.push(iconArr) - } - icons.push(iconBuild) + window.captureException && window.captureException(e); + console.log(e); } - return icons + return { + dis: parseInt(path.cost / Map_QM.util.options.mapScale), + time: minTime, + }; }, /** * @api {方法} pathPark() 获取车位点位 * @apiGroup 地图数据 * @apiDescription 获取车位导航点 - * @apiVersion 2.0.0 - * @apiParam {String} shopNum 车位编号 + * @apiVersion 4.0.0 + * @apiParam {String} houseNumber 车位编号 * * @apiSampleRequest off * * @apiParamExample 请求示例 * - * Map_QM.pathPark({shopNum:"B1002"}); + * Map_QM.pathPark({houseNumber:"B1002"}); * * @apiSuccessExample 返回示例 * { - * shopNum: 车位编号, node: 导航点, floor: 楼层编号, xaxis: 中心点X坐标, yaxis: 中心点Y坐标 + * houseNumber: 车位编号, node: 导航点, floor: 楼层编号, xaxis: 中心点X坐标, yaxis: 中心点Y坐标 * } */ pathPark: function (toObj) { - return this.shopNumToNavPoint(toObj, 'park') + return this.shopNumToNavPoint(toObj, "park"); }, /** * @api {方法} pathShopByName() 获取店铺点位 * @apiGroup 地图数据 * @apiDescription 通过店铺名称获取点位 - * @apiVersion 2.0.0 + * @apiVersion 4.0.0 * @apiParam {String} shopName 店铺名称 * * @apiSampleRequest off @@ -3525,74 +5099,154 @@ MainMap_QM.prototype = { * * @apiSuccessExample 返回示例 * { - * shopNum: 店铺编号, node: 导航点, floor: 楼层编号, xaxis: 中心点X坐标, yaxis: 中心点Y坐标, comeIn:店铺多门点 + * houseNumber: 店铺编号, node: 导航点, floor: 楼层编号, xaxis: 中心点X坐标, yaxis: 中心点Y坐标, comeIn:店铺多门点 * } */ pathShopByName: function (shopName) { for (let item of Map_QM.util.shopData) { if (item.name === shopName) { - let toObj = { shopNum: item.houseNumber, node: item.yaxis } + let toObj = { houseNumber: item.houseNumber, node: item.yaxis }; for (let h = 0; h < Map_QM.util.allMap.length; h++) { - let sArr = Map_QM.util.allMap[h].buildArr + let sArr = Map_QM.util.allMap[h].buildArr; for (let i = 0; i < sArr.length; i++) { - let shops = Map_QM.util.allMap[h].buildArr[i].mapData.shopArea + let shops = Map_QM.util.allMap[h].buildArr[i].mapData.shopArea; for (let k = 0; k < shops.length; k++) { - if (shops[k].name == toObj.shopNum) { - toObj.floor = i - toObj.build = h - toObj.node = shops[k].shopNav - toObj.xaxis = shops[k].xaxis - toObj.yaxis = shops[k].yaxis + if (shops[k].name == toObj.houseNumber) { + toObj.floor = i; + toObj.build = h; + toObj.node = shops[k].shopNav; + toObj.xaxis = shops[k].xaxis; + toObj.yaxis = shops[k].yaxis; if (shops[k].comeIn) { - toObj.comeIn = shops[k].comeIn + toObj.comeIn = shops[k].comeIn; } - return toObj + return toObj; } } } } - return toObj + return toObj; + } + } + }, + /** + * @api {方法} changeBoxStateByFormat() 切换box显示状态 + * @apiGroup 地图交互 + * @apiDescription 根据业态切换box显示状态 + * @apiVersion 4.0.0 + * @apiParam {String} formatCode 业态Id + * @apiParam {Boolean} isShow 是否显示 + * + * @apiSampleRequest off + * + * @apiParamExample {Object} 请求示例 + * + * Map_QM.changeBoxStateByFormat("X8f1sfGl0gfa_QwVcMy86",false); + * + */ + changeBoxStateByFormat: function (formatCode, isShow) { + for (let h = 0; h < Map_QM.mapArr.length; h++) { + for (let i = 0; i < Map_QM.mapArr[h].length; i++) { + let shopArr = Map_QM.mapArr[h][i].shopObj.children; + for (let k = 0; k < shopArr.length; k++) { + if ( + shopArr[k].userData && + shopArr[k].userData.formatCode == formatCode + ) { + shopArr[k].visible = isShow; + } + } + Map_QM.mapArr[h][i].labelObj.traverse((obj) => { + if (obj.element && obj.userData.formatCode == formatCode) { + obj.element.style.display = isShow ? "" : "none"; + obj.userData.isShow = isShow; + } + }); + } + } + Map_QM.updateRender(); + Map_QM.collLabel(); + }, + /** + * @api {方法} changeBoxStateByName() 切换box显示状态 + * @apiGroup 地图交互 + * @apiDescription 根据名称切换box显示状态 + * @apiVersion 4.0.0 + * @apiParam {String} houseNumber box名称 + * @apiParam {Boolean} isShow 是否显示 + * + * @apiSampleRequest off + * + * @apiParamExample {Object} 请求示例 + * + * Map_QM.changeBoxStateByName("L101", true); + * + */ + changeBoxStateByName: function (houseNumber, isShow) { + for (let h = 0; h < Map_QM.mapArr.length; h++) { + for (let i = 0; i < Map_QM.mapArr[h].length; i++) { + let shopArr = Map_QM.mapArr[h][i].shopObj.children; + for (let k = 0; k < shopArr.length; k++) { + if (shopArr[k].name == houseNumber) { + shopArr[k].visible = isShow; + } + } + Map_QM.mapArr[h][i].labelObj.traverse((obj) => { + if (obj.name == houseNumber) { + obj.element.style.display = isShow ? "" : "none"; + obj.userData.isShow = isShow; + } + }); } } + Map_QM.updateRender(); + Map_QM.collLabel(); }, /** * @api {方法} shopNumToNavPoint() 获取导航点位 * @apiGroup 地图导航 * @apiDescription 通过店铺编号或车位获取导航点位 - * @apiVersion 2.0.0 - * @apiParam {Object} object build,floor,shopNum 楼栋编号,楼层编号,店铺或车位编号 + * @apiVersion 4.0.0 + * @apiParam {Object} object build,floor,houseNumber 楼栋编号,楼层编号,店铺或车位编号 * @apiParam {String} type 店铺或车位标识 "shop" "park" * * @apiSampleRequest off * * @apiSuccessExample 返回示例 * { - * shopNum: 店铺编号, node: 导航点, floor: 楼层编号, xaxis: 中心点X坐标, yaxis: 中心点Y坐标, comeIn:店铺多门点 + * houseNumber: 店铺编号, node: 导航点, floor: 楼层编号, xaxis: 中心点X坐标, yaxis: 中心点Y坐标, comeIn:店铺多门点 * } */ shopNumToNavPoint: function (obj, type) { - let shopArr - let reObj = { build: Map_QM.util.selectBuild, node: '', xaxis: '', yaxis: '', floor: '', comeIn: '' } + let shopArr; + let reObj = { + build: Map_QM.util.selectBuild, + node: "", + xaxis: "", + yaxis: "", + floor: "", + comeIn: "", + }; for (let h = 0; h < Map_QM.util.allMap.length; h++) { - let sArr = Map_QM.util.allMap[h].buildArr + let sArr = Map_QM.util.allMap[h].buildArr; for (let i = 0; i < sArr.length; i++) { - if (type == 'shop') { - shopArr = sArr[i].mapData.shopArea - } else if (type == 'park') { - shopArr = sArr[i].mapData.parkArea + if (type == "shop") { + shopArr = sArr[i].mapData.shopArea; + } else if (type == "park") { + shopArr = sArr[i].mapData.parkArea; } for (let k = 0; k < shopArr.length; k++) { - if (shopArr[k].name == obj.shopNum) { - reObj.floor = i - reObj.build = h - reObj.xaxis = shopArr[k].xaxis - reObj.yaxis = shopArr[k].yaxis - reObj.node = shopArr[k].shopNav - reObj.shopNum = obj.shopNum + if (shopArr[k].name == obj.houseNumber) { + reObj.floor = i; + reObj.build = h; + reObj.xaxis = shopArr[k].xaxis; + reObj.yaxis = shopArr[k].yaxis; + reObj.node = shopArr[k].shopNav; + reObj.houseNumber = obj.houseNumber; if (shopArr[k].comeIn) { - reObj.comeIn = shopArr[k].comeIn + reObj.comeIn = shopArr[k].comeIn; } - return reObj + return reObj; } } } @@ -3602,108 +5256,131 @@ MainMap_QM.prototype = { * 模拟导航获取路线 */ onFindPathModel: function (usePath = null) { - Map_QM.forShopArr.length = 0 - Map_QM.util._indexPathFloor = 0 - Map_QM.util.pathStateObj.isPathPlay = true - if (isNaN(parseInt(Map_QM.util.startObj.node)) || parseInt(Map_QM.util.startObj.node) == -1) { - return + Map_QM.forShopArr.length = 0; + Map_QM.util._indexPathFloor = 0; + Map_QM.util.pathStateObj.isPathPlay = true; + if (isNaN(parseInt(Map_QM.util.startObj.node)) ||parseInt(Map_QM.util.startObj.node) == -1) { + return; } - if (!Map_QM.util.startObj.xaxis) { - let pathData = Map_QM.util.allMap[parseInt(Map_QM.util.startObj.build)].buildArr[parseInt(Map_QM.util.startObj.floor)].mapData.path - 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 - } - if (!usePath) { - 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) + try { + if (!Map_QM.util.startObj.xaxis) { + let pathData = Map_QM.util.allMap[parseInt(Map_QM.util.startObj.build)].buildArr[parseInt(Map_QM.util.startObj.floor)].mapData.path; + 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; + } + if (!usePath) { + 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); + } + } + 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 path = dijkstra.find_path(usePath, startNade, toNade); + Map_QM.forShopPath(path.nodes); + } catch (e) { + window.captureException && window.captureException(e); + console.log(e); + return; } - 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 path = dijkstra.find_path(usePath, startNade, toNade); - Map_QM.forShopPath(path.nodes); }, forShopPath: function (PathPoint) { - let Dir = '向前出发', - index = 0 - let DirEn = 'to forward' - this.forShopArr = [] + let Dir = "向前出发", + index = 0; + let DirEn = "to forward"; + this.forShopArr = []; if (PathPoint.length > 1) { - this.forShopArr.push({ build: Map_QM.util.startObj.build, floor: Map_QM.util.startObj.floor, PathPoint: [] }) - let pathData + this.forShopArr.push({ + build: Map_QM.util.startObj.build, + floor: Map_QM.util.startObj.floor, + PathPoint: [], + }); + let pathData; for (let j = 0; j < PathPoint.length; j++) { - let array = PathPoint[j].split('_') - pathData = Map_QM.util.allMap[parseInt(array[0])].buildArr[parseInt(array[1])].mapData.path + let array = PathPoint[j].split("_"); + pathData = Map_QM.util.allMap[parseInt(array[0])].buildArr[parseInt(array[1])].mapData.path; if (array[0] == this.forShopArr[index].build) { if (array[1] == this.forShopArr[index].floor) { - this.forShopArr[index].PathPoint.push(pathData.nodes[parseInt(array[2])]) + this.forShopArr[index].PathPoint.push(pathData.nodes[parseInt(array[2])]); } else { if (j > 0) { - this.forShopArr[index].Facilities = this.getFacilIcon(PathPoint[j - 1].split('_'), parseInt(array[0])) + this.forShopArr[index].Facilities = this.getFacilIcon( PathPoint[j - 1].split("_"),parseInt(array[0])); } else { - this.forShopArr[index].Facilities = null + this.forShopArr[index].Facilities = null; } - this.forShopArr.push({ build: parseInt(array[0]), floor: parseInt(array[1]), PathPoint: [] }) - index++ - this.forShopArr[index].PathPoint.push(pathData.nodes[parseInt(array[2])]) + this.forShopArr.push({ + build: parseInt(array[0]), + floor: parseInt(array[1]), + PathPoint: [] + }); + index++; + this.forShopArr[index].PathPoint.push(pathData.nodes[parseInt(array[2])]); } } else { - this.forShopArr.push({ build: parseInt(array[0]), floor: parseInt(array[1]), PathPoint: [] }) - index++ - this.forShopArr[index].PathPoint.push(pathData.nodes[parseInt(array[2])]) + this.forShopArr.push({ + build: parseInt(array[0]), + floor: parseInt(array[1]), + PathPoint: [] + }); + index++; + this.forShopArr[index].PathPoint.push(pathData.nodes[parseInt(array[2])]); } } let dy = 0, dx = 0, - ang = 0 + ang = 0; if (this.forShopArr[0].PathPoint.length > 1) { if (this.forShopArr[0].PathPoint.length == 2) { - dy = this.forShopArr[0].PathPoint[1].y - this.forShopArr[0].PathPoint[0].y - dx = this.forShopArr[0].PathPoint[1].x - this.forShopArr[0].PathPoint[0].x + dy = this.forShopArr[0].PathPoint[1].y - this.forShopArr[0].PathPoint[0].y; + dx = this.forShopArr[0].PathPoint[1].x - this.forShopArr[0].PathPoint[0].x; } else { - dy = this.forShopArr[0].PathPoint[2].y - this.forShopArr[0].PathPoint[1].y - dx = this.forShopArr[0].PathPoint[2].x - this.forShopArr[0].PathPoint[1].x + dy = this.forShopArr[0].PathPoint[2].y - this.forShopArr[0].PathPoint[1].y; + dx = this.forShopArr[0].PathPoint[2].x -this.forShopArr[0].PathPoint[1].x; } - ang = (Math.atan2(dy, dx) * 180) / Math.PI - Map_QM.util.deviceObj.angle - - ang = ang > 180 ? ang - 360 : ang - ang = ang < -180 ? ang + 360 : ang + ang = (Math.atan2(dy, dx) * 180) / Math.PI - Map_QM.util.deviceObj.angle; + ang = ang > 180 ? ang - 360 : ang; + ang = ang < -180 ? ang + 360 : ang; if (ang < -50 && ang >= -130) { - Dir = '向前出发' - DirEn = 'to forward' + Dir = "向前出发"; + DirEn = "to forward"; } else if (ang >= -50 && ang < 50) { - Dir = '向右出发' - DirEn = 'to right' + Dir = "向右出发"; + DirEn = "to right"; } else if (ang >= 50 && ang < 130) { - Dir = '向后出发' - DirEn = 'to back' + Dir = "向后出发"; + DirEn = "to back"; } else { - Dir = '向左出发' - DirEn = 'to left' + Dir = "向左出发"; + DirEn = "to left"; } } - let pLen = Map_QM.forShopArr[Map_QM.forShopArr.length - 1].PathPoint.length - Map_QM.util.overObj.xaxis = Map_QM.forShopArr[Map_QM.forShopArr.length - 1].PathPoint[pLen - 1].x - Map_QM.util.overObj.yaxis = Map_QM.forShopArr[Map_QM.forShopArr.length - 1].PathPoint[pLen - 1].y + let pLen = Map_QM.forShopArr[Map_QM.forShopArr.length - 1].PathPoint.length; + Map_QM.util.overObj.xaxis = Map_QM.forShopArr[Map_QM.forShopArr.length - 1].PathPoint[pLen - 1].x; + Map_QM.util.overObj.yaxis = Map_QM.forShopArr[Map_QM.forShopArr.length - 1].PathPoint[pLen - 1].y; if (Map_QM.forShopArr.length > 0) { // "floor" PathPoint Direction (Facilities) - Map_QM.forShopArr[0].Direction = Dir - Map_QM.forShopArr[0].DirectionEn = DirEn + Map_QM.forShopArr[0].Direction = Dir; + Map_QM.forShopArr[0].DirectionEn = DirEn; for (let m = 0; m < Map_QM.forShopArr.length; m++) { //查找经过店铺 - Map_QM.forShopArr[m].wayShop = Map_QM.foreignShop(Map_QM.forShopArr[m].PathPoint, Map_QM.forShopArr[m].build, Map_QM.forShopArr[m].floor, m) - if (Map_QM.util.overObj.build == Map_QM.forShopArr[m].build && Map_QM.util.overObj.floor == Map_QM.forShopArr[m].floor) { - let len = Map_QM.forShopArr[m].wayShop.length - if (Map_QM.forShopArr[m].wayShop[len - 1] && Map_QM.forShopArr[m].wayShop[len - 1].shop.yaxis == Map_QM.util.overObj.node) { - Map_QM.forShopArr[m].wayShop.pop() + Map_QM.forShopArr[m].wayShop = Map_QM.foreignShop( + Map_QM.forShopArr[m].PathPoint, + Map_QM.forShopArr[m].build, + Map_QM.forShopArr[m].floor, + m + ); + if (Map_QM.util.overObj.build == Map_QM.forShopArr[m].build && Map_QM.util.overObj.floor == Map_QM.forShopArr[m].floor ) { + let len = Map_QM.forShopArr[m].wayShop.length; + if (Map_QM.forShopArr[m].wayShop[len - 1] &&Map_QM.forShopArr[m].wayShop[len - 1].shop.yaxis == Map_QM.util.overObj.node) { + Map_QM.forShopArr[m].wayShop.pop(); } } } @@ -3711,102 +5388,111 @@ MainMap_QM.prototype = { * @api {事件} InitPathOver 地图导航状态完成 * @apiGroup 地图事件 * @apiDescription 地图开始导航时触发 - * @apiVersion 2.0.0 + * @apiVersion 4.0.0 * @apiSampleRequest off * * @apiParamExample 请求示例 * Map_QM.addEventListener("InitPathOver",onInitPathOver,false); */ Map_QM.dispatchEvent({ - type: 'InitPathOver', - data: Map_QM.forShopArr - }) + type: "InitPathOver", + data: Map_QM.forShopArr, + }); } else { - console.error('无可行路径,请检查起、终点位') - return + console.error("无可行路径,请检查起、终点位"); + return; } - this.onFindPathToObj() + this.onFindPathToObj(); } }, getMinCostByArray: function (floor, array, costall) { - if (!Map_QM.util.startObj) { - Map_QM.changeStartPoint(); - } - if (!Map_QM.util.numBuild) { - Map_QM.util.numBuild = 0; - } - let mis = -1, nodeP; - for (let i = 0; i < array.length; i++) { - let toNade = Map_QM.util.numBuild + "_" + floor + "_" + array[i]; - let PathPoint = costall[toNade]; - if (mis == -1) { - mis = PathPoint; - nodeP = array[i]; - } else { - if (mis > PathPoint) { - mis = PathPoint; - nodeP = array[i]; - } - } - } - return nodeP; - }, + if (!Map_QM.util.startObj) { + Map_QM.changeStartPoint(); + } + if (!Map_QM.util.numBuild) { + Map_QM.util.numBuild = 0; + } + let mis = -1, + nodeP; + for (let i = 0; i < array.length; i++) { + let toNade = Map_QM.util.numBuild + "_" + floor + "_" + array[i]; + let PathPoint = costall[toNade]; + if (mis == -1) { + mis = PathPoint; + nodeP = array[i]; + } else { + if (mis > PathPoint) { + mis = PathPoint; + nodeP = array[i]; + } + } + } + return nodeP; + }, /** * 途径店铺 */ foreignShop: function (pathArr, build, cFloor, m) { - let shopList = [] - let shops = Map_QM.mapArr[parseInt(build)][parseInt(cFloor)].shopObj.children + let shopList = []; + let shops = + Map_QM.mapArr[parseInt(build)][parseInt(cFloor)].shopObj.children; for (let n = 0; n < pathArr.length; n++) { for (let i = 0; i < shops.length; i++) { - if (shops[i].userData && shops[i].userData.type == 'shop' && shops[i].userData.navRecommend) { - if (shops[i].userData.node == pathArr[n].id && shops[i].userData.shopData) { - let data = { pathArrIn: m, pathIndex: n, shop: shops[i].userData.shopData } - shopList.push(data) - break + if (shops[i].userData && shops[i].userData.type == "shop" && shops[i].userData.navRecommend) { + if (shops[i].userData.node == pathArr[n].id &&shops[i].userData.shopData) { + let data = { + pathArrIn: m, + pathIndex: n, + shop: shops[i].userData.shopData + }; + shopList.push(data); + break; } } } } - return shopList + return shopList; }, getFacilIcon: function (fromFArr, build = -1) { if (build === -1) { - build = Map_QM.util.selectBuild + build = Map_QM.util.selectBuild; } - let childs = this.mapArr[build][fromFArr[1]].serObj.children - let selectEle + let childs = this.mapArr[build][fromFArr[1]].serObj.children; + let selectEle; for (let i = 0; i < childs.length; i++) { - if (childs[i].type == "Object3D" && childs[i].userData.navCode == fromFArr[2] && ("dt,ft,upft,lt,downft".search(childs[i].userData.facCode) != -1)) { - selectEle = { imgUrl: childs[i].userData.src, userData: childs[i].userData, position: { x: childs[i].position.x, y: childs[i].position.y } } - break - } + if (childs[i].type == "Object3D" &&childs[i].userData.navCode == fromFArr[2] &&"dt,ft,upft,lt,downft".search(childs[i].userData.facCode) != -1 ) { + selectEle = { + imgUrl: childs[i].userData.src, + userData: childs[i].userData, + position: { x: childs[i].position.x, y: childs[i].position.y } + }; + break; + } } - return selectEle + return selectEle; }, /** * 寻路动画方法 */ onFindPathToObj: function () { - outTime = -1 - Map_QM.util._indexPathFloor = 0 - Map_QM.callBackLoadOver = Map_QM.callBackForPathShop //楼层初始化完成后回调 - if (pathCameraState == '2D') { - Map_QM.onInnerMeDir() - Map_QM.controls.enabled = false - Map_QM.guide = Map_QM.man_2d - } - Map_QM.changeBuildInner(Map_QM.forShopArr[Map_QM.util._indexPathFloor].build, Map_QM.forShopArr[Map_QM.util._indexPathFloor].floor) + Map_QM.util._indexPathFloor = 0; + Map_QM.callBackLoadOver = Map_QM.callBackForPathShop; //楼层初始化完成后回调 + if (pathCameraState == "2D") { + Map_QM.onInnerMeDir(); + Map_QM.controls.enabled = false; + Map_QM.guide = Map_QM.man_2d; + } + Map_QM.changeBuildInner( Map_QM.forShopArr[Map_QM.util._indexPathFloor].build,Map_QM.forShopArr[Map_QM.util._indexPathFloor].floor); }, /** * 播放楼层动画完成后 */ callBackForPathShop: function () { - Map_QM.callBackLoadOver = null + Map_QM.callBackLoadOver = null; if (Map_QM.util.pathStateObj.isPathState) { //如果是寻路状态,继续导航 - Map_QM.onFindPath() + Map_QM.onFindPath(); } }, /** @@ -3815,66 +5501,61 @@ MainMap_QM.prototype = { * @param {Object} endN */ onFindPath: function () { - TweenMax.killAll(true) - + TweenMax.killAll(true); if (Map_QM.util.overObj.floor == Map_QM.util.selectFloor && Map_QM.util.overObj.xaxis) { - Map_QM.mapArr[Map_QM.util.overObj.build][Map_QM.util.overObj.floor].setOverSite( - Map_QM.util.overObj.xaxis, - Map_QM.util.overObj.yaxis, - parseInt(Map_QM.util.shopHeight) - ) - }else{ - Map_QM.endModel && (Map_QM.endModel.visible = false); - Map_QM.endIcon && (Map_QM.endIcon.visible = false); - } - + Map_QM.mapArr[Map_QM.util.overObj.build][Map_QM.util.overObj.floor].setOverSite(Map_QM.util.overObj.xaxis, Map_QM.util.overObj.yaxis,parseInt(Map_QM.util.shopHeight)); + } else { + Map_QM.endModel && (Map_QM.endModel.visible = false); + Map_QM.endIcon && (Map_QM.endIcon.visible = false); + } if (Map_QM.forShopArr.length > 0) { - document.addEventListener('pathOver', Map_QM.onFindPathFloor, true) - Map_QM.mapArr[Map_QM.forShopArr[Map_QM.util._indexPathFloor].build][Map_QM.forShopArr[Map_QM.util._indexPathFloor].floor].findPath.clearPath() - Map_QM.mapArr[Map_QM.forShopArr[Map_QM.util._indexPathFloor].build][Map_QM.forShopArr[Map_QM.util._indexPathFloor].floor].findPath.onFindPathAnimation( - Map_QM.forShopArr[Map_QM.util._indexPathFloor].PathPoint - ) //传入数组 - Map_QM.mapArr[Map_QM.forShopArr[Map_QM.util._indexPathFloor].build][Map_QM.forShopArr[Map_QM.util._indexPathFloor].floor].findPath.guidePathPlay( - Map_QM.forShopArr[Map_QM.util._indexPathFloor] - ) - Map_QM.controlsChock() + document.addEventListener("pathOver", Map_QM.onFindPathFloor, true); + if (Map_QM.util.isMorePath) { + Map_QM.mapArr[Map_QM.forShopArr[Map_QM.util._indexPathFloor].build][Map_QM.forShopArr[Map_QM.util._indexPathFloor].floor].findPath.onFindPathAnimation(pathNodes[Map_QM.util._indexPathFloor].pathNode, Map_QM.util.isMorePath,pathNodes[Map_QM.util._indexPathFloor].floor); //传入数组 + } else { + Map_QM.mapArr[Map_QM.forShopArr[Map_QM.util._indexPathFloor].build][Map_QM.forShopArr[Map_QM.util._indexPathFloor].floor].findPath.clearPath(); + Map_QM.mapArr[Map_QM.forShopArr[Map_QM.util._indexPathFloor].build][Map_QM.forShopArr[Map_QM.util._indexPathFloor].floor].findPath.onFindPathAnimation(Map_QM.forShopArr[Map_QM.util._indexPathFloor].PathPoint,false ); //传入数组 + } + Map_QM.mapArr[Map_QM.forShopArr[Map_QM.util._indexPathFloor].build][Map_QM.forShopArr[Map_QM.util._indexPathFloor].floor].findPath.guidePathPlay(Map_QM.forShopArr[Map_QM.util._indexPathFloor]); + Map_QM.controlsChock(); } }, + /** * 显示楼层 */ showNavFloor: function (fromFloor, toFloor, build) { - let floorArr = [] - let min = Math.min(fromFloor, toFloor) - let max = Math.max(fromFloor, toFloor) + let floorArr = []; + let min = Math.min(fromFloor, toFloor); + let max = Math.max(fromFloor, toFloor); for (let i = min; i <= max; i++) { - floorArr.push(Map_QM.mapArr[build][i].floorName) + floorArr.push(Map_QM.mapArr[build][i].floorName); } if (floorArr.length > 5) { - floorArr.splice(2, floorArr.length - 3) - floorArr[1] = '...' + floorArr.splice(2, floorArr.length - 3); + floorArr[1] = "..."; } - return floorArr + return floorArr; }, //导航完成事件 onFindPathFloor: function (event) { - document.removeEventListener('pathOver', Map_QM.onFindPathFloor) + document.removeEventListener("pathOver", Map_QM.onFindPathFloor); if (Map_QM.forShopArr.length <= Map_QM.util._indexPathFloor) { - return + return; } if (Map_QM.util._indexPathFloor < Map_QM.forShopArr.length - 1) { //楼层切换 if (Map_QM.forShopArr[Map_QM.util._indexPathFloor].Facilities) { - let pathFloor = Map_QM.forShopArr[Map_QM.util._indexPathFloor].floor - let x0 = Map_QM.forShopArr[Map_QM.util._indexPathFloor].Facilities.position.x + 64 - let y0 = Map_QM.forShopArr[Map_QM.util._indexPathFloor].Facilities.position.y - let model = Map_QM.forShopArr[Map_QM.util._indexPathFloor].Facilities.userData.model + let pathFloor = Map_QM.forShopArr[Map_QM.util._indexPathFloor].floor; + let x0 =Map_QM.forShopArr[Map_QM.util._indexPathFloor].Facilities.position.x +64; + let y0 = Map_QM.forShopArr[Map_QM.util._indexPathFloor].Facilities.position.y; + let model = Map_QM.forShopArr[Map_QM.util._indexPathFloor].Facilities.userData.model; /** * @api {事件} PathPlaying 地图导航的实时状态 * @apiGroup 地图事件 * @apiDescription 地图导航过程中实时触发 - * @apiVersion 2.0.0 + * @apiVersion 4.0.0 * @apiSampleRequest off * * @apiParamExample 请求示例 @@ -3882,140 +5563,146 @@ MainMap_QM.prototype = { */ Map_QM.dispatchEvent({ //寻路中返回小人当前所在点位 - type: 'PathPlaying', + type: "PathPlaying", data: { - shopNum: Map_QM.forShopArr[Map_QM.util._indexPathFloor].Facilities.userData.facCode + Map_QM.forShopArr[Map_QM.util._indexPathFloor].Facilities.userData.no - } - }) - let box - if (model && model.userData.name == 'dt') { + houseNumber:Map_QM.forShopArr[Map_QM.util._indexPathFloor].Facilities.userData.facCode + Map_QM.forShopArr[Map_QM.util._indexPathFloor].Facilities.userData.no, + }, + }); + let box; + if (model && model.userData.name == "dt") { model.traverse(function (child) { - if (child.isMesh && child.name == 'zhitibox') { - box = child + if (child.isMesh && child.name == "zhitibox") { + box = child; } - if (child.isMesh && (child.name == 'zhitijiegou' || child.name == 'zhitiboli')) { - child.scale.y = 7.5 + if (child.isMesh && (child.name == "zhitijiegou" || child.name == "zhitiboli")) { + child.scale.y = 3; } - }) + }); } let zo = 2, tz = 2, boxT = 0, - boxZ = 0 - let add = window.innerWidth>2000 ? 80 : 40; - let lft = window.innerWidth>2000 ? 8 : 4; - Map_QM.util._indexPathFloor++ - let toFloor = parseInt(Map_QM.forShopArr[Map_QM.util._indexPathFloor].floor) - Map_QM.util.selectFloor = toFloor - let floorArr = Map_QM.showNavFloor(pathFloor, toFloor, parseInt(Map_QM.forShopArr[Map_QM.util._indexPathFloor].build)) //电梯旁显示的楼层名称 + boxZ = 0; + let add = window.innerWidth > 2000 ? 80 : 40; + let lft = window.innerWidth > 2000 ? 8 : 4; + Map_QM.util._indexPathFloor++; + let toFloor = parseInt( + Map_QM.forShopArr[Map_QM.util._indexPathFloor].floor + ); + Map_QM.util.selectFloor = toFloor; + let floorArr = Map_QM.showNavFloor( + pathFloor, + toFloor, + parseInt(Map_QM.forShopArr[Map_QM.util._indexPathFloor].build) + ); //电梯旁显示的楼层名称 if (pathFloor < toFloor) { - tz = (floorArr.length - 1) * add - boxT = 27 + tz = (floorArr.length - 1) * add; + boxT = 12; } else { - zo = (floorArr.length - 1) * add - boxZ = 27 + zo = (floorArr.length - 1) * add; + boxZ = 12; } - document.getElementById('moveFloor').style.bottom = zo + 'px' - document.getElementById('moveFloor').style.width = add + 'px' - document.getElementById('moveFloor').style.height = add + 'px' - Map_QM.moveFloorbg.element.style.width = (add+lft) + 'px' - Map_QM.moveFloorbg.element.style.height = floorArr.length * add + 'px' - Map_QM.moveFloorbg.position.set(x0, y0, (floorArr.length * add)/-1) - Map_QM.moveFloorbg.applyMatrix4(Map_QM.mapArr[parseInt(Map_QM.forShopArr[Map_QM.util._indexPathFloor].build)][pathFloor].allObj.matrix) - - let floorBox = document.getElementById('floorBox') + document.getElementById("moveFloor").style.bottom = zo + "px"; + document.getElementById("moveFloor").style.width = add + "px"; + document.getElementById("moveFloor").style.height = add + "px"; + + Map_QM.moveFloorbg.element.style.width = add + lft + "px"; + Map_QM.moveFloorbg.element.style.height = floorArr.length * add + "px"; + Map_QM.moveFloorbg.position.set(x0, y0, (floorArr.length * add) / -1); + Map_QM.moveFloorbg.applyMatrix4( + Map_QM.mapArr[ + parseInt(Map_QM.forShopArr[Map_QM.util._indexPathFloor].build) + ][pathFloor].allObj.matrix + ); + let floorBox = document.getElementById("floorBox"); while (floorBox.hasChildNodes()) { - floorBox.removeChild(floorBox.firstChild) + floorBox.removeChild(floorBox.firstChild); } for (let i = floorArr.length - 1; i >= 0; i--) { - let span2 = document.createElement('span') - span2.style.cssText = 'display: block;color: #000000; text-align: center;' - span2.style.fontSize = '16px' - if ( window.innerWidth>2000) { - span2.style.fontSize = '24px' - } - span2.style.width = (add+lft) + 'px' - span2.style.height = add + 'px' - span2.style.lineHeight = add + 'px' - span2.innerText = floorArr[i] - floorBox.appendChild(span2) + let span2 = document.createElement("span"); + span2.style.cssText = "display: block;color: #000000; text-align: center;"; + span2.style.fontSize = "16px"; + if (window.innerWidth > 2000) { + span2.style.fontSize = "24px"; + } + span2.style.width = add + lft + "px"; + span2.style.height = add + "px"; + span2.style.lineHeight = add + "px"; + span2.innerText = floorArr[i]; + floorBox.appendChild(span2); } - TweenMax.fromTo( - '#moveFloor', - 1.5, - { bottom: zo }, + + TweenMax.fromTo("#moveFloor",1.5,{ bottom: zo }, { bottom: tz, delay: 0.1, onComplete: function () { Map_QM.moveFloorbg.element.style.display = "none"; - Map_QM.callBackLoadOver = Map_QM.callBackForPathShop //楼层初始化完成后回调 - Map_QM.changeFloorInner(Map_QM.forShopArr[Map_QM.util._indexPathFloor].build, Map_QM.forShopArr[Map_QM.util._indexPathFloor].floor) - } + Map_QM.callBackLoadOver = Map_QM.callBackForPathShop; //楼层初始化完成后回调 + Map_QM.changeFloorInner( + Map_QM.forShopArr[Map_QM.util._indexPathFloor].build, + Map_QM.forShopArr[Map_QM.util._indexPathFloor].floor + ); + }, } - ) - Map_QM.moveFloorbg.element.style.display = ""; + ); + Map_QM.moveFloorbg.element.style.display = "block"; if (box) { - TweenMax.fromTo( - box.position, - 1.2, - { y: boxZ }, - { - y: boxT, - delay: 0.2, + TweenMax.fromTo(box.position, 1.2, { y: boxZ }, + { y: boxT, delay: 0.2, onComplete: function () { - box.position.y = 0 + box.position.y = 0; model.traverse(function (child) { - if (child.isMesh && (child.name == 'zhitijiegou' || child.name == 'zhitiboli')) { - child.scale.y = 1 + if ( + child.isMesh && + (child.name == "zhitijiegou" || child.name == "zhitiboli") + ) { + child.scale.y = 1; } - }) - } + }); + }, } - ) + ); } - if (pathCameraState == '3D') { - let xt = Map_QM.guide.position.x + event.detail.dx * 10 - let yt = Map_QM.guide.position.y + event.detail.dy * 10 - if (model && model.userData.name == 'upft') { - Map_QM.guide.visible = true - TweenMax.to(Map_QM.guide.position, 1.3, { - x: xt, - y: yt, - z: 50, + if (pathCameraState == "3D") { + let xt = Map_QM.guide.position.x + event.detail.dx * 10; + let yt = Map_QM.guide.position.y + event.detail.dy * 10; + if (model && model.userData.name == "upft") { + Map_QM.guide.visible = true; + TweenMax.to(Map_QM.guide.position, 1.3, { x: xt, y: yt, z: 50, onComplete: function () { - Map_QM.guide.visible = false - } - }) + Map_QM.guide.visible = false; + }, + }); } - if (model && model.userData.name == 'downft') { - Map_QM.guide.visible = true - TweenMax.to(Map_QM.guide.position, 1.3, { - x: xt, - y: yt, - z: -50, + if (model && model.userData.name == "downft") { + Map_QM.guide.visible = true; + TweenMax.to(Map_QM.guide.position, 1.3, { x: xt, y: yt, z: -50, onComplete: function () { - Map_QM.guide.visible = false - } - }) + Map_QM.guide.visible = false; + }, + }); } } } else { //楼栋切换 - Map_QM.util._indexPathFloor++ - Map_QM.callBackLoadOver = Map_QM.callBackForPathShop - Map_QM.changeBuildInner(Map_QM.forShopArr[Map_QM.util._indexPathFloor].build, Map_QM.forShopArr[Map_QM.util._indexPathFloor].floor) + Map_QM.util._indexPathFloor++; + Map_QM.callBackLoadOver = Map_QM.callBackForPathShop; + Map_QM.changeBuildInner( + Map_QM.forShopArr[Map_QM.util._indexPathFloor].build, + Map_QM.forShopArr[Map_QM.util._indexPathFloor].floor + ); } } else { - Map_QM.util.startObj = Map_QM.util.deviceObj + Map_QM.util.startObj = Map_QM.util.deviceObj; /** * @api {事件} PathPlayOver 地图导航完成 * @apiGroup 地图事件 * @apiDescription 地图导航到达目标点时触发 - * @apiVersion 2.0.0 + * @apiVersion 4.0.0 * @apiSampleRequest off * * @apiParamExample 请求示例 @@ -4023,88 +5710,88 @@ MainMap_QM.prototype = { */ Map_QM.dispatchEvent({ //寻路完成 - type: 'PathPlayOver', - data: 'PathPlayOver' - }) + type: "PathPlayOver", + data: "PathPlayOver", + }); } }, /** * 楼层状态清理 */ clearFloor: function (fIndex = -1, reSet = true) { - isJUZ = false - Map_QM.controls.setZoom(1) + isJUZ = false; if (fIndex == -1) { - fIndex = Map_QM.util.deviceObj.floor + fIndex = Map_QM.util.deviceObj.floor; } if (Map_QM.selectShop) { - Map_QM.selectShop.scale.z = 1 + Map_QM.selectShop.scale.z = 1; } if (Map_QM.endModel && Map_QM.endModel.visible) { - Map_QM.endModel.visible = false + Map_QM.endModel.visible = false; } if (Map_QM.endIcon && Map_QM.endIcon.visible) { - Map_QM.endIcon.visible = false + Map_QM.endIcon.visible = false; } 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) { 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; for (let k = child.children.length - 1; k >= 0; k--) { - if (child.children[k].name == 'lineDash') { - Map_QM.mapArr[Map_QM.util.selectBuild][i].allObj.remove(child.children[k]) + if (child.children[k].name == "lineDash") { + Map_QM.mapArr[Map_QM.util.selectBuild][i].allObj.remove(child.children[k]); } } - 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) + Map_QM.remove_child(Map_QM.dtLineGroup); } - TweenMax.killAll(true) + TweenMax.killAll(true); }, remove_child: function (remObj) { if (!remObj) { - return + return; } - let child_elem = remObj.children + let child_elem = remObj.children; for (let i = child_elem.length - 1; i >= 0; i--) { if (child_elem[i].children.length > 0) { - Map_QM.remove_child(child_elem[i]) + Map_QM.remove_child(child_elem[i]); } else { if (child_elem[i] instanceof THREE.Mesh) { - child_elem[i].geometry.dispose() // 删除几何体 - if (child_elem[i].material !== undefined) Map_QM.removeMaterial(child_elem.material) // 删除材质 + child_elem[i].geometry.dispose(); // 删除几何体 + if (child_elem[i].material !== undefined) + Map_QM.removeMaterial(child_elem.material); // 删除材质 } } - if (child_elem[i].name != 'light' && child_elem[i].name != 'dtline') { - remObj.remove(child_elem[i]) + if (child_elem[i].name != "light" && child_elem[i].name != "dtline") { + remObj.remove(child_elem[i]); } } }, removeMaterial: function (material) { if (Array.isArray(material)) { for (var i = 0, l = material.length; i < l; i++) { - this.removeMaterialFromRefCounter(material[i]) + this.removeMaterialFromRefCounter(material[i]); } } else { - this.removeMaterialFromRefCounter(material) + this.removeMaterialFromRefCounter(material); } }, removeMaterialFromRefCounter: function (material) { - var materialsRefCounter = this.materialsRefCounter + var materialsRefCounter = this.materialsRefCounter; if (materialsRefCounter) { - var count = materialsRefCounter.get(material) - count-- + var count = materialsRefCounter.get(material); + count--; if (count === 0) { - materialsRefCounter.delete(material) - delete this.materials[material.uuid] + materialsRefCounter.delete(material); + delete this.materials[material.uuid]; } else { - materialsRefCounter.set(material, count) + materialsRefCounter.set(material, count); } } }, @@ -4113,46 +5800,47 @@ MainMap_QM.prototype = { * @api {方法} pathStop() 导航暂停/播放 * @apiGroup 地图导航 * @apiDescription 导航动画暂停/播放 - * @apiVersion 2.0.0 + * @apiVersion 4.0.0 * * @apiSampleRequest off * */ pathStop: function (isPlaying) { - Map_QM.util.pathStateObj.isPathPlay = isPlaying === undefined ? !Map_QM.util.pathStateObj.isPathPlay : isPlaying - Map_QM.mapArr[Map_QM.util.selectBuild][Map_QM.util.selectFloor].findPath.pathPlay.isPlay = Map_QM.util.pathStateObj.isPathPlay + Map_QM.util.pathStateObj.isPathPlay =isPlaying === undefined? !Map_QM.util.pathStateObj.isPathPlay : isPlaying; + Map_QM.mapArr[Map_QM.util.selectBuild][Map_QM.util.selectFloor].findPath.pathPlay.isPlay = Map_QM.util.pathStateObj.isPathPlay; }, /** * @api {方法} pathRePlay() 导航动画重播 * @apiGroup 地图导航 * @apiDescription 导航动画重播 - * @apiVersion 2.0.0 + * @apiVersion 4.0.0 * * @apiSampleRequest off * */ pathRePlay: function () { - clearTimeout(Map_QM.util.timeObj.pathTime) - TweenMax.killAll(true) - if(!Map_QM.util.overObj.node){ - return - } - Map_QM.util.timeObj.pathTime = setTimeout(() => { - clearTimeout(Map_QM.util.timeObj.pathTime) - Map_QM.controls.reset() - if (Map_QM.util.overObj && Map_QM.forShopArr[0]) { - Map_QM.util.pathStateObj.isPathPlay = true - Map_QM.clearFloor() - Map_QM.onFindPathToObj() - } - }, 100) + clearTimeout(Map_QM.util.timeObj.pathTime); + TweenMax.killAll(true); + if (!Map_QM.util.overObj.node) { + return; + } + Map_QM.util.timeObj.pathTime = setTimeout(() => { + clearTimeout(Map_QM.util.timeObj.pathTime); + Map_QM.controls.reset(); + if (Map_QM.util.overObj && Map_QM.forShopArr[0]) { + Map_QM.util.pathStateObj.isPathPlay = true; + Map_QM.clearFloor(); + Map_QM.onFindPathToObj(); + } + }, 100); + }, /** * @api {方法} ChangePathByFt() 切换扶梯模式 * @apiGroup 地图导航 * @apiDescription 导航切换扶梯模式 - * @apiVersion 2.0.0 + * @apiVersion 4.0.0 * * @apiParam {function} callBack 回调函数 * @@ -4164,30 +5852,30 @@ MainMap_QM.prototype = { * */ ChangePathByFt: function (callBack) { - clearTimeout(Map_QM.util.timeObj.pathTime) - TweenMax.killAll(true) - if(!Map_QM.util.overObj.node || Map_QM.util.isMorePath){ - return - } + clearTimeout(Map_QM.util.timeObj.pathTime); + TweenMax.killAll(true); + if (!Map_QM.util.overObj.node || Map_QM.util.isMorePath) { + return; + } Map_QM.util.timeObj.pathTime = setTimeout(() => { - clearTimeout(Map_QM.util.timeObj.pathTime) - Map_QM.controls.reset() + clearTimeout(Map_QM.util.timeObj.pathTime); + Map_QM.controls.reset(); if (Map_QM.util.overObj) { - Map_QM.clearFloor() - Map_QM.onFindPathModel(Map_QM.util.pathStateObj.ftPath) + Map_QM.clearFloor(); + Map_QM.onFindPathModel(Map_QM.util.pathStateObj.ftPath); if (callBack) { - Map_QM.parseForShopArr() - const data = JSON.parse(JSON.stringify(Map_QM.util.pathStateObj.forShopArr)) - callBack(data) + Map_QM.parseForShopArr(); + const data = JSON.parse(JSON.stringify(Map_QM.util.pathStateObj.forShopArr)); + callBack(data); } } - }, 100) + }, 100); }, /** * @api {方法} ChangePathByDt() 切换电梯模式 * @apiGroup 地图导航 * @apiDescription 导航切换电梯模式 - * @apiVersion 2.0.0 + * @apiVersion 4.0.0 * * @apiParam {function} callBack 回调函数 * @@ -4199,30 +5887,30 @@ MainMap_QM.prototype = { * */ ChangePathByDt: function (callBack) { - clearTimeout(Map_QM.util.timeObj.pathTime) - TweenMax.killAll(true) - if(!Map_QM.util.overObj.node || Map_QM.util.isMorePath){ - return - } + clearTimeout(Map_QM.util.timeObj.pathTime); + TweenMax.killAll(true); + if (!Map_QM.util.overObj.node || Map_QM.util.isMorePath) { + return; + } Map_QM.util.timeObj.pathTime = setTimeout(() => { - clearTimeout(Map_QM.util.timeObj.pathTime) - Map_QM.controls.reset() + clearTimeout(Map_QM.util.timeObj.pathTime); + Map_QM.controls.reset(); if (Map_QM.util.overObj) { - Map_QM.clearFloor() - Map_QM.onFindPathModel(Map_QM.util.pathStateObj.dtPath) + Map_QM.clearFloor(); + Map_QM.onFindPathModel(Map_QM.util.pathStateObj.dtPath); if (callBack) { - Map_QM.parseForShopArr() - const data = JSON.parse(JSON.stringify(Map_QM.util.pathStateObj.forShopArr)) - callBack(data) + Map_QM.parseForShopArr(); + const data = JSON.parse(JSON.stringify(Map_QM.util.pathStateObj.forShopArr)); + callBack(data); } } - }, 100) + }, 100); }, /** * @api {方法} ChangePathByGood() 切换最佳模式 * @apiGroup 地图导航 * @apiDescription 导航切换最佳模式 - * @apiVersion 2.0.0 + * @apiVersion 4.0.0 * * @apiParam {function} callBack 回调函数 * @@ -4234,37 +5922,37 @@ MainMap_QM.prototype = { * */ ChangePathByGood: function (callBack) { - clearTimeout(Map_QM.util.timeObj.pathTime) - TweenMax.killAll(true) - if(!Map_QM.util.overObj.node || Map_QM.util.isMorePath){ - return - } + clearTimeout(Map_QM.util.timeObj.pathTime); + TweenMax.killAll(true); + if (!Map_QM.util.overObj.node || Map_QM.util.isMorePath) { + return; + } Map_QM.util.timeObj.pathTime = setTimeout(() => { - clearTimeout(Map_QM.util.timeObj.pathTime) - Map_QM.controls.reset() + clearTimeout(Map_QM.util.timeObj.pathTime); + Map_QM.controls.reset(); if (Map_QM.util.overObj) { - Map_QM.clearFloor() - Map_QM.onFindPathModel(Map_QM.util.pathStateObj.graphPath) + Map_QM.clearFloor(); + Map_QM.onFindPathModel(Map_QM.util.pathStateObj.graphPath); if (callBack) { - Map_QM.parseForShopArr() - const data = JSON.parse(JSON.stringify(Map_QM.util.pathStateObj.forShopArr)) - callBack(data) + Map_QM.parseForShopArr(); + const data = JSON.parse(JSON.stringify(Map_QM.util.pathStateObj.forShopArr)); + callBack(data); } } - }, 100) + }, 100); }, /////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// changeDocmentResize: function (e) { - let w = parseInt(Map_QM.ele.clientWidth) || parseInt(window.getComputedStyle(Map_QM.ele, null).getPropertyValue('width')) - let h = parseInt(Map_QM.ele.clientHeight) || parseInt(window.getComputedStyle(Map_QM.ele, null).getPropertyValue('height')) - Map_QM.changeWindowResize(w, h) + let w = parseInt(Map_QM.ele.clientWidth) || parseInt(window.getComputedStyle(Map_QM.ele, null).getPropertyValue("width")); + let h = parseInt(Map_QM.ele.clientHeight) || parseInt( window.getComputedStyle(Map_QM.ele, null).getPropertyValue("height")); + Map_QM.changeWindowResize(w, h); }, /** * @api {方法} changeWindowResize() 窗口变化 * @apiGroup 地图交互 * @apiDescription 窗口变化 - * @apiVersion 2.0.0 + * @apiVersion 4.0.0 * * @apiParam {int} width 窗口宽 * @apiParam {int} height 窗口高 @@ -4276,27 +5964,33 @@ MainMap_QM.prototype = { * Map_QM.changeWindowResize(1280,1080); */ changeWindowResize: function (width, height) { - Map_QM.aspect = width / height - Map_QM.cameraPerspective.aspect = Map_QM.aspect - Map_QM.cameraPerspective.updateProjectionMatrix() + if(!width){ + width = parseInt(Map_QM.ele.clientWidth) || parseInt(window.getComputedStyle(Map_QM.ele, null).getPropertyValue("width")); + } + if(!height){ + height = parseInt(Map_QM.ele.clientHeight) || parseInt(window.getComputedStyle(Map_QM.ele, null).getPropertyValue("height")); + } + Map_QM.aspect = width / height; + Map_QM.cameraPerspective.aspect = Map_QM.aspect; + Map_QM.cameraPerspective.updateProjectionMatrix(); Map_QM.cameraOrtho.left = -150 * Map_QM.aspect Map_QM.cameraOrtho.right = 150 * Map_QM.aspect Map_QM.cameraOrtho.top = 150; Map_QM.cameraOrtho.bottom = -150; - Map_QM.cameraOrtho.updateProjectionMatrix() - Map_QM.renderer.setSize(width, height) - Map_QM.labelRenderer.setSize(width, height) + Map_QM.cameraOrtho.updateProjectionMatrix(); + Map_QM.renderer.setSize(width, height); + Map_QM.labelRenderer.setSize(width, height); Map_QM.updateRender(); - Map_QM.collLabel(); - Map_QM.w = width - Map_QM.h = height - } -} + Map_QM.collLabel(); + Map_QM.w = width; + Map_QM.h = height; + }, +}; /** * @api {方法} init(callBack,options) 地图初始化 * @apiGroup 地图数据 * @apiDescription 初始化地图赋值 Map_QM - * @apiVersion 2.0.0 + * @apiVersion 4.0.0 * * @apiParam {function} callBack 初始化成功后的回调函数 * @apiParam {object} options 初始化对象 @@ -4306,18 +6000,20 @@ MainMap_QM.prototype = { * @apiParam {int} options.angle 起点设备角度 默认值 0 * @apiParam {string} options.perc_H 弹窗的偏移量 默认值 "-50%"; * @apiParam {string} options.containerId 地图div容器Id 默认值 "mapContainer" - * @apiParam {string} options.playSpeed 动画播放速度 默认值6 + * @apiParam {string} options.playSpeed 动画播放速度 默认值8 * @apiParam {boolean} options.collision 是否支持名称的碰撞检测 默认值 true * @apiParam {boolean} options.modelIcon 交通设施是否使用模型 默认值 true * @apiParam {Array} options.otherPath 人为干预的路线 默认值 []; * @apiParam {int} options.fSpace 双叠层状态下楼层的间距 默认值 500 * @apiParam {uint} options.navColor 途径店铺颜色 默认值 0xEE6A50 + * @apiParam {boolean} options.shadow 是否显示阴影 默认值 false * @apiParam {boolean} options.iconName 图标名称是否显示 默认值false * @apiParam {uint} options.pathColor 导航路径颜色 默认值 0xb47834, * @apiParam {string} options.pathStyle 导航第一视角 默认值 "2D", - * @apiParam {string} options.shopStyle 店铺显示字段编号(shopNum)名称(shopName) 默认值 "shopName", - * @apiParam {int} options.camZoom 地图显示我的方向状态的放大倍数 默认值 3 + * @apiParam {string} options.shopStyle 店铺显示字段编号(houseNumber)名称(shopName) 默认值 "shopName", * @apiParam {boolean} options.inArea 地图点击后是否聚焦到当前位置 默认值 false + * @apiParam {string} options.mapData 地图数据 res.data.mapData + * @apiParam {string} options.shopData 店铺数据 res.data * @apiParam {Array} options.iconUrl 设施库图标 默认值 [] * * @apiSampleRequest off @@ -4326,209 +6022,228 @@ MainMap_QM.prototype = { * MainMap_QM.init(callBackLoadOver,{build : 0, floor : 3, navPoint : 7, angle : 0, perc_H : "-50%",containerId : "mapContainer"}); */ MainMap_QM.init = function (callBack, options) { - if(Map_QM){ - Map_QM.cancelRender() - Map_QM.beforeDestroy() - } - Map_QM = new MainMap_QM(callBack, options) - return Map_QM -} -Object.assign(MainMap_QM.prototype, THREE.EventDispatcher.prototype) + if (Map_QM) { + Map_QM.cancelRender(); + Map_QM.beforeDestroy(); + } + Map_QM = new MainMap_QM(callBack, options); + return Map_QM; +}; +Object.assign(MainMap_QM.prototype, THREE.EventDispatcher.prototype); //////////////////////////////////////-------------------------------FloorMap -FloorMap_QM = function (bIndex, fIndex, floorName) { - this.Model_QM = new MyModel_QM() - this.facUtil = new Facilities_QM() - this.findPath = new FindPath_QM() - this.logoUtil = new ShopLogo_QM() - this.allObj = new THREE.Group() - this.allObj.name = floorName - this.allObj.rotation.x = Math.PI / -2 - this.CSSObj = new THREE.Group() - - this.labelObj = new THREE.Group() - this.labelObj.renderOrder = 100 - this.floorOrder = fIndex - this.buildOrder = bIndex - this.floorName = floorName - - //存第三方 - this.otherObj = new THREE.Object3D() - this.allObj.add(this.otherObj) - - //存放设施图标 - this.serObj = new THREE.Object3D() - //存放车位box - this.parkObj = new THREE.Group() - //标签 - this.tagObj = new THREE.Group() - this.tagObj.renderOrder = 100 - //存放设施图标 - this.svgObj = new THREE.Group() - //店铺 - this.shopObj = new THREE.Group() - this.allObj.add(this.shopObj) - this.allObj.add(this.svgObj) - this.allObj.add(this.CSSObj) - - this.CSSObj.add(this.serObj) - this.CSSObj.add(this.labelObj) - this.CSSObj.add(this.tagObj) - //标签 - this.showTagObj = new THREE.Group() - this.showTagObj.renderOrder = 100 - this.CSSObj.add(this.showTagObj) - - //线条 - this.lineObj = new THREE.Group() - this.lineObj.renderOrder = 100 - this.allObj.add(this.lineObj) - - this.startIcon -} +var FloorMap_QM = function (bIndex, fIndex, floorName) { + this.Model_QM = new MyModel_QM(); + this.facUtil = new Facilities_QM(); + this.findPath = new FindPath_QM(); + this.logoUtil = new ShopLogo_QM(); + this.allObj = new THREE.Group(); + this.allObj.name = floorName; + this.allObj.rotation.x = Math.PI / -2; + this.CSSObj = new THREE.Group(); + this.labelObj = new THREE.Group(); + this.labelObj.renderOrder = 100; + this.floorOrder = fIndex; + this.buildOrder = bIndex; + this.floorName = floorName; + //存第三方 + this.otherObj = new THREE.Object3D(); + this.allObj.add(this.otherObj); + + //存放设施图标 + this.serObj = new THREE.Object3D(); + //存放车位box + this.parkObj = new THREE.Group(); + //标签 + this.tagObj = new THREE.Group(); + this.tagObj.renderOrder = 100; + //存放设施图标 + this.svgObj = new THREE.Group(); + //店铺 + this.shopObj = new THREE.Group(); + this.allObj.add(this.shopObj); + this.allObj.add(this.svgObj); + this.allObj.add(this.CSSObj); + + this.CSSObj.add(this.serObj); + this.CSSObj.add(this.labelObj); + this.CSSObj.add(this.tagObj); + //标签 + this.showTagObj = new THREE.Group(); + this.showTagObj.renderOrder = 100; + this.CSSObj.add(this.showTagObj); + + //线条 + this.lineObj = new THREE.Group(); + this.lineObj.renderOrder = 100; + this.allObj.add(this.lineObj); + + this.startIcon; +}; FloorMap_QM.prototype = { initDraw: function () { - this.initFloor() - this.initFacilitie() - this.initStairs() - this.initTextArea() - this.initWall() - this.initDecos() - this.initPark() - this.initModel() - this.initTree() //植树 - this.initLogos() //贴图 + this.initFloor(); + this.initFacilitie(); + this.initStairs(); + this.initTextArea(); + this.initWall(); + this.initDecos(); + this.initPark(); + this.initModel(); + this.initTree(); //植树 + this.initLogos(); //贴图 }, initLogos: function () { - let sopce = this + let sopce = this; if (Map_QM.util.logos) { - Map_QM.util.logos.map(item => { + Map_QM.util.logos.map((item) => { if (item.build == sopce.buildOrder && item.floor == sopce.floorOrder) { - sopce.logoUtil.renderIcon(item, sopce, item.site || 0) + sopce.logoUtil.renderIcon(item, sopce, item.site || 0); } - }) + }); } }, initModel: function () { - let sopce = this + let sopce = this; if (Map_QM.util.modelArr) { for (let i = 0; i < Map_QM.util.modelArr.length; i++) { if (Map_QM.util.modelArr[i].build == this.buildOrder && Map_QM.util.modelArr[i].floor == this.floorOrder) { - new THREE.GLTFLoader().load(Map_QM.util.beforPath + Map_QM.util.modelArr[i].url, function (object) { - //加载路径fbx文件 - let mod = object.scene - mod.traverse(function (child) { - if (child.isMesh) { - child.receiveShadow = false - child.castShadow = false - child.userData.opacity = child.material.opacity - if (child.material.map) { - child.material.map.encoding = THREE.LinearEncoding //贴图需要转换成 线性编码 + new THREE.GLTFLoader().load( + Map_QM.util.beforPath + Map_QM.util.modelArr[i].url, + function (object) { + //加载路径fbx文件 + let mod = object.scene; + mod.traverse(function (child) { + if (child.isMesh) { + child.receiveShadow = Map_QM.util.options.shadow; + child.castShadow = Map_QM.util.options.shadow; + child.userData.opacity = child.material.opacity; + if (child.material.map) { + child.material.map.encoding = THREE.LinearEncoding; //贴图需要转换成 线性编码 + } + child.material.color.convertGammaToLinear(0.7); } - child.material.color.convertGammaToLinear(0.7) + }); + for (let t = 0; t < Map_QM.util.modelArr[i].list.length; t++) { + let obj = mod.clone(); + obj.position.set( + Map_QM.util.modelArr[i].list[t].site.x, + -1 * Map_QM.util.modelArr[i].list[t].site.y, + Map_QM.util.modelArr[i].list[t].site.z + ); + obj.scale.set( + Map_QM.util.modelArr[i].list[t].size.x, + Map_QM.util.modelArr[i].list[t].size.y, + Map_QM.util.modelArr[i].list[t].size.z + ); + obj.rotateX((Map_QM.util.modelArr[i].list[t].rot.x * Math.PI) / 180); + obj.rotateY((Map_QM.util.modelArr[i].list[t].rot.y * Math.PI) / 180); + obj.rotateZ((Map_QM.util.modelArr[i].list[t].rot.z * Math.PI) / 180); + sopce.allObj.add(obj); } - }) - for (let t = 0; t < Map_QM.util.modelArr[i].list.length; t++) { - let obj = mod.clone() - obj.position.set(Map_QM.util.modelArr[i].list[t].site.x, -1 * Map_QM.util.modelArr[i].list[t].site.y, Map_QM.util.modelArr[i].list[t].site.z) - obj.scale.set(Map_QM.util.modelArr[i].list[t].size.x, Map_QM.util.modelArr[i].list[t].size.y, Map_QM.util.modelArr[i].list[t].size.z) - obj.rotateX(Map_QM.util.modelArr[i].list[t].rot.x * Math.PI / 180) - obj.rotateY(Map_QM.util.modelArr[i].list[t].rot.y * Math.PI / 180) - obj.rotateZ(Map_QM.util.modelArr[i].list[t].rot.z * Math.PI / 180) - sopce.allObj.add(obj) } - }) + ); } } } if (Map_QM.util.labelIconArr) { for (let i = 0; i < Map_QM.util.labelIconArr.length; i++) { if (Map_QM.util.labelIconArr[i].build == this.buildOrder && Map_QM.util.labelIconArr[i].floor == this.floorOrder) { - let SpriteDiv = document.createElement('div') - SpriteDiv.className = Map_QM.util.labelIconArr[i].className - SpriteDiv.innerHTML = Map_QM.util.labelIconArr[i].title - SpriteDiv.dataset.id = Map_QM.util.labelIconArr[i].data.id - SpriteDiv.dataset.x = Map_QM.util.labelIconArr[i].site.x - SpriteDiv.dataset.y = Map_QM.util.labelIconArr[i].site.y - SpriteDiv.dataset.z = Map_QM.util.labelIconArr[i].site.z - let pointLabel = new THREE.CSS2DObject(SpriteDiv) - pointLabel.position.set(Map_QM.util.labelIconArr[i].site.x, -1 * Map_QM.util.labelIconArr[i].site.y, Map_QM.util.labelIconArr[i].site.z) - pointLabel.name = Map_QM.util.labelIconArr[i].title - pointLabel.userData = Map_QM.util.labelIconArr[i].data - pointLabel.userData.site = Map_QM.util.labelIconArr[i].site - pointLabel.userData.mapShow = true - pointLabel.userData.isShow = true - pointLabel.userData.type = "icon" + let SpriteDiv = document.createElement("div"); + SpriteDiv.className = Map_QM.util.labelIconArr[i].className; + SpriteDiv.innerHTML = Map_QM.util.labelIconArr[i].title; + SpriteDiv.dataset.id = Map_QM.util.labelIconArr[i].data.id; + SpriteDiv.dataset.x = Map_QM.util.labelIconArr[i].site.x; + SpriteDiv.dataset.y = Map_QM.util.labelIconArr[i].site.y; + SpriteDiv.dataset.z = Map_QM.util.labelIconArr[i].site.z; + let pointLabel = new THREE.CSS2DObject(SpriteDiv); + pointLabel.position.set( + Map_QM.util.labelIconArr[i].site.x, + -1 * Map_QM.util.labelIconArr[i].site.y, + Map_QM.util.labelIconArr[i].site.z + ); + pointLabel.name = Map_QM.util.labelIconArr[i].title; + pointLabel.userData = Map_QM.util.labelIconArr[i].data; + pointLabel.userData.site = Map_QM.util.labelIconArr[i].site; + pointLabel.userData.mapShow = true; + pointLabel.userData.isShow = true; + pointLabel.userData.type = "icon"; if (Map_QM.util.labelIconArr[i].click) { //可点击 - SpriteDiv.addEventListener( - 'click', - event => { + SpriteDiv.addEventListener("click", (event) => { Map_QM.dispatchEvent({ - type: 'labelIcon', - data: event.target.dataset - }) + type: "labelIcon", + data: event.target.dataset, + }); }, false - ) + ); } else { - pointLabel.element.style.pointerEvents = 'none' + pointLabel.element.style.pointerEvents = "none"; } - pointLabel.userData.floor = Map_QM.util.labelIconArr[i].floor - sopce.showTagObj.add(pointLabel) + pointLabel.userData.floor = Map_QM.util.labelIconArr[i].floor; + sopce.showTagObj.add(pointLabel); } } } }, initTree: function () { - let mapData = Map_QM.util.allMap[this.buildOrder].buildArr[this.floorOrder].mapData + let mapData = + Map_QM.util.allMap[this.buildOrder].buildArr[this.floorOrder].mapData; if (mapData.models) { for (let t = 0; t < mapData.models.length; t++) { for (let i = 0; i < Map_QM.util.fbxModels.length; i++) { if (mapData.models[t].type == Map_QM.util.fbxModels[i].key) { - let obj = Map_QM.util.fbxModels[i].obj.scene.clone() - obj.position.set(mapData.models[t].x, -1 * mapData.models[t].y, mapData.models[t].site) - obj.scale.set(mapData.models[t].scale, mapData.models[t].scale, mapData.models[t].scale) - obj.rotateX(Map_QM.util.fbxModels[i].operation.rot.x) - obj.rotateY(-1 * mapData.models[t].angle * Math.PI / 180) - obj.renderOrder = 100 - for (let k = 0; k < Map_QM.util.fbxModels[i].obj.animations.length; k++) { - let mixer = new THREE.AnimationMixer(obj) - mixer.clipAction(Map_QM.util.fbxModels[i].obj.animations[k]).play() - Map_QM.mixers.push(mixer) - } - //加载编辑器动画 - obj.name = mapData.models[t].name - if (mapData.animations) { - mapData.animations.forEach((item)=>{ - if(mapData.models[t].name == item.name){ - let posArr = [], rotArr = [], scaleArr = [], keyArr = [], proArr = [], clip - item.frames.forEach((it)=>{ - keyArr.push(it.time) - posArr.push(it.pos.x, -1*it.pos.y, it.pos.z) - rotArr.push(it.rot/-180*Math.PI) - scaleArr.push(it.size,it.size,it.size) - proArr.push(it.pro) - }); - if(item.isType){ //特殊模型动画 - let rotKF = new THREE.KeyframeTrack(item.sonName, keyArr, proArr) - clip = new THREE.AnimationClip(item.name, keyArr[keyArr.length-1], [rotKF]) - }else{ - let posKF = new THREE.KeyframeTrack(item.name+'.position', keyArr, posArr) - let rotKF = new THREE.KeyframeTrack(item.name+'.rotation[y]', keyArr, rotArr) - let scalKF = new THREE.KeyframeTrack(item.name+'.scale', keyArr, scaleArr) - clip = new THREE.AnimationClip(item.name, keyArr[keyArr.length-1], [posKF, rotKF, scalKF]) - } - if(clip){ - let mixer = new THREE.AnimationMixer(obj) - mixer.clipAction(clip).play() - Map_QM.mixers.push(mixer) - } - } - }) - } - this.allObj.add(obj) + let obj = Map_QM.util.fbxModels[i].obj.scene.clone(); + obj.position.set(mapData.models[t].x, -1 * mapData.models[t].y, mapData.models[t].site); + obj.scale.set(mapData.models[t].scale,mapData.models[t].scale,mapData.models[t].scale); + obj.rotateX(Map_QM.util.fbxModels[i].operation.rot.x); + obj.rotateY((-1 * mapData.models[t].angle * Math.PI) / 180); + obj.renderOrder = 100; + for (let k = 0;k < Map_QM.util.fbxModels[i].obj.animations.length; k++ ) { + let mixer = new THREE.AnimationMixer(obj); + mixer.clipAction(Map_QM.util.fbxModels[i].obj.animations[k]).play(); + Map_QM.mixers.push(mixer); + } + //加载编辑器动画 + obj.name = mapData.models[t].name; + if (mapData.animations) { + mapData.animations.forEach((item) => { + if (mapData.models[t].name == item.name) { + obj.rotateY(mapData.models[t].angle * Math.PI / 180); + let posArr = [], + rotArr = [], + scaleArr = [], + keyArr = [], + proArr = [], + clip; + item.frames.forEach((it) => { + keyArr.push(it.time); + posArr.push(it.pos.x, -1 * it.pos.y, it.pos.z); + rotArr.push((it.rot / -180) * Math.PI); + scaleArr.push(it.size, it.size, it.size); + proArr.push(it.pro); + }); + if (item.isType) { + //特殊模型动画 + let rotKF = new THREE.KeyframeTrack(item.sonName, keyArr, proArr); + clip = new THREE.AnimationClip(item.name, keyArr[keyArr.length - 1], [rotKF]); + } else { + let posKF = new THREE.KeyframeTrack(item.name + ".position",keyArr,posArr); + let rotKF = new THREE.KeyframeTrack(item.name + ".rotation[y]", keyArr,rotArr); + let scalKF = new THREE.KeyframeTrack(item.name + ".scale",keyArr,scaleArr); + clip = new THREE.AnimationClip(item.name,keyArr[keyArr.length - 1],[posKF, rotKF, scalKF]); + } + if (clip) { + let mixer = new THREE.AnimationMixer(obj); + mixer.clipAction(clip).play(); + Map_QM.mixers.push(mixer); + } + } + }); + } + this.allObj.add(obj); } } } @@ -4536,124 +6251,131 @@ FloorMap_QM.prototype = { }, //初始化单楼层 initFloor: function () { - let floor - let mapData = Map_QM.util.allMap[this.buildOrder].buildArr[this.floorOrder].mapData - let entColor, borderColor + let floor; + let mapData = Map_QM.util.allMap[this.buildOrder].buildArr[this.floorOrder].mapData; + let entColor, borderColor; if (mapData.floorArea) { - floor = Map_QM.util.changeAreaToString(mapData.floorArea) + floor = Map_QM.util.changeAreaToString(mapData.floorArea); } - let bLen = mapData.buildArea.length - let hLen = mapData.hollowArea.length - let hows_f = [] + let bLen = mapData.buildArea.length; + let hLen = mapData.hollowArea.length; + let hows_f = []; for (let m = 0; m < hLen; m++) { - let isIn = Map_QM.util.checkAreaInArea(mapData.hollowArea[m], mapData.floorArea); - if(isIn){ - hows_f.push(Map_QM.util.changeAreaToString(mapData.hollowArea[m])); - } + let isIn = Map_QM.util.checkAreaInArea(mapData.hollowArea[m],mapData.floorArea); + if (isIn) { + hows_f.push(Map_QM.util.changeAreaToString(mapData.hollowArea[m])); + } } if (floor) { - entColor = mapData.floorArea.entColor - borderColor = mapData.floorArea.borderColor - floorH = parseInt(mapData.floorArea.toHeight) - let mash = this.Model_QM.MyModelShape(floor, hows_f, mapData.floorArea, entColor, borderColor, 10 + 100 * this.floorOrder); - mash.receiveShadow = true - mash.castShadow = false + entColor = mapData.floorArea.entColor; + borderColor = mapData.floorArea.borderColor; + floorH = parseInt(mapData.floorArea.toHeight); + let mash = this.Model_QM.MyModelShape(floor,hows_f,mapData.floorArea,entColor,borderColor,10 + 100 * this.floorOrder); + mash.receiveShadow = true; + mash.castShadow = false; mash.userData = { - type: 'floor', - order: this.floorOrder - } - mash.userData.opacity = mapData.floorArea.alphaModle / 100 || 0 - mash.name = 'floor' - this.allObj.add(mash) + type: "floor", + order: this.floorOrder, + }; + mash.userData.opacity = mapData.floorArea.alphaModle / 100 || 0; + mash.name = "floor"; + this.allObj.add(mash); } /////////////////////初始化楼栋 for (let i = 0; i < bLen; i++) { - let build = Map_QM.util.changeAreaToString(mapData.buildArea[i]) - let hows = [] + let build = Map_QM.util.changeAreaToString(mapData.buildArea[i]); + let hows = []; for (let t = 0; t < hLen; t++) { - let isIn = Map_QM.util.checkAreaInArea(mapData.hollowArea[t], mapData.buildArea[i]) + let isIn = Map_QM.util.checkAreaInArea(mapData.hollowArea[t],mapData.buildArea[i]); if (isIn) { - hows.push(Map_QM.util.changeAreaToString(mapData.hollowArea[t])) + hows.push(Map_QM.util.changeAreaToString(mapData.hollowArea[t])); } } - entColor = mapData.buildArea[i].entColor - borderColor = mapData.buildArea[i].borderColor - buildH = parseInt(mapData.buildArea[i].toHeight) - let mash = this.Model_QM.MyPlaneShape(build, hows, mapData.buildArea[i], entColor, borderColor, 30 + 100 * this.floorOrder) - mash.receiveShadow = true - mash.castShadow = false + entColor = mapData.buildArea[i].entColor; + borderColor = mapData.buildArea[i].borderColor; + buildH = parseInt(mapData.buildArea[i].toHeight); + let mash = this.Model_QM.MyPlaneShape(build,hows,mapData.buildArea[i],entColor,borderColor,30 + 100 * this.floorOrder); + mash.receiveShadow = true; + mash.castShadow = false; mash.userData = { - type: 'build', + type: "build", order: this.floorOrder, - xaxis: mapData.buildArea[i].xaxis, - yaxis: mapData.buildArea[i].yaxis - } - mash.userData.opacity = mapData.buildArea[i].alphaModle / 100 || 0 + xaxis: mapData.buildArea[i].xaxis, + yaxis: mapData.buildArea[i].yaxis, + }; + mash.userData.opacity = mapData.buildArea[i].alphaModle / 100 || 0; mash.name = mapData.buildArea[i].name; - this.allObj.add(mash) + this.allObj.add(mash); } //店铺 - let sLen = mapData.shopArea.length - let show = (showE = '') - let showLeb = '' - let logo = '', + let sLen = mapData.shopArea.length; + let show = "", + showE = "", + showLeb = "", + formatCode = "", + mapShow = false; + let logo = "", navRecommend = false, - shopD = {}, - type = 'deco' - let shopData = Map_QM.util.shopData + shopD = {}; + let shopData = Map_QM.util.shopData; for (let i = 0; i < sLen; i++) { - if (Map_QM.util.changeAreaToString(mapData.shopArea[i]) != '') { - let arr = Map_QM.util.changeShopLinesToString(mapData.shopArea[i]) - entColor = mapData.shopArea[i].entColor || '#b79266' - borderColor = mapData.shopArea[i].borderColor || '#b79266' - show = showE = mapData.shopArea[i].name - logo = '' - showLeb = '' - navRecommend = false - mapShow = false - shopD = {} + if (Map_QM.util.changeAreaToString(mapData.shopArea[i]) != "") { + for (let t = 0; t < sLen; t++) { + let isIn = Map_QM.util.checkAreaInArea(mapData.shopArea[i], mapData.shopArea[t]); + isIn &&(mapData.shopArea[i].site = parseInt(mapData.shopArea[i].site) + 1); + } + let arr = Map_QM.util.changeShopLinesToString(mapData.shopArea[i]); + entColor = mapData.shopArea[i].entColor || "#b79266"; + borderColor = mapData.shopArea[i].borderColor || "#b79266"; + show = showE = mapData.shopArea[i].name; + logo = ""; + showLeb = ""; + navRecommend = false; + mapShow = false; + shopD = {}; if (shopData) { for (let h = 0; h < shopData.length; h++) { - let houseNum = shopData[h].houseNumber - if (houseNum == mapData.shopArea[i].name) { - show = shopData[h].shopName || shopData[h].name - showLeb = houseNum - 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 { - navRecommend = false - } - 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].activityList && shopData[h].activityList.length > 0) { + if (shopData[h].houseNumber === mapData.shopArea[i].name) { + showLeb = shopData[h].houseNumber; + show = shopData[h].shopName == undefined ? shopData[h].name : shopData[h].shopName; + showE = shopData[h].shopNameEn == undefined ? shopData[h].nameEn : shopData[h].shopNameEn; + logo = shopData[h].logoUrl; + mapShow = shopData[h].mapShow ?? false; //是否常显示 + formatCode = shopData[h].industryFatherCode; + if (shopData[h].isPass) { + navRecommend = shopData[h].isPass; + } else { + navRecommend = false; + } + shopD = shopData[h]; + if (shopData[h].isNewShop) { + //新店 + mapData.shopArea[i].type = "new-shop"; + this.addTagLabel(mapData.shopArea[i], {node: mapData.shopArea[i].shopNav, floor: this.floorOrder, build: this.buildOrder}); + } else { + if (shopData[h].activityList &&shopData[h].activityList.length > 0) { //促销 - mapData.shopArea[i].type = 'promotion' - this.addTagLabel(mapData.shopArea[i], { node: mapData.shopArea[i].shopNav, floor: this.floorOrder, build: this.buildOrder }) + mapData.shopArea[i].type = "promotion"; + this.addTagLabel(mapData.shopArea[i], {node: mapData.shopArea[i].shopNav, floor: this.floorOrder, build: this.buildOrder }); } - shopData[h].color&& (entColor = shopData[h].color) - shopData[h].formatColor&& (entColor = shopData[h].formatColor) - shopData[h].borderColor &&(borderColor = shopData[h].borderColor) - break } - + shopData[h].color && (entColor = shopData[h].color); + shopData[h].formatColor && (entColor = shopData[h].formatColor); + shopData[h].borderColor && (borderColor = shopData[h].borderColor); + break; + } } } - let hollShop = [] + let hollShop = []; if (mapData.shopArea[i].hollArea) { for (let k = 0; k < mapData.shopArea[i].hollArea.length; k++) { - hollShop.push(Map_QM.util.changeAreaToString(mapData.shopArea[i].hollArea[k])) + hollShop.push(Map_QM.util.changeAreaToString(mapData.shopArea[i].hollArea[k])); } } - let mahc = this.Model_QM.MyModelShape(arr, hollShop, mapData.shopArea[i], entColor, borderColor, 100) - mahc.node = mapData.shopArea[i].shopNav + let mahc = this.Model_QM.MyModelShape(arr,hollShop,mapData.shopArea[i],entColor,borderColor,60 + 100 * this.floorOrder); + mahc.node = mapData.shopArea[i].shopNav; mahc.userData = { + id: mapData.shopArea[i].id, shopData: shopD, xaxis: mapData.shopArea[i].xaxis >> 0, yaxis: mapData.shopArea[i].yaxis >> 0, @@ -4661,260 +6383,261 @@ FloorMap_QM.prototype = { floor: this.floorOrder, build: this.buildOrder, navRecommend: navRecommend, - type: 'shop', - entColor: entColor, - shopNum: mapData.shopArea[i].name, + type: "shop", + houseNumber: mapData.shopArea[i].name, shopName: show, + formatCode: formatCode, logo: logo, - borderColor: borderColor - } - mahc.userData.opacity = mapData.shopArea[i].alphaModle / 100 || 0 - mahc.name = showLeb - mahc.xaxis = mapData.shopArea[i].xaxis >> 0 - mahc.yaxis = mapData.shopArea[i].yaxis >> 0 - this.shopObj.add(mahc) + opacity: mapData.shopArea[i].alphaModle / 100 || 0, + }; + mahc.name = showLeb; + mahc.xaxis = mapData.shopArea[i].xaxis >> 0; + mahc.yaxis = mapData.shopArea[i].yaxis >> 0; + this.shopObj.add(mahc); 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) +1 ); } else { //添加文字 - 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) - }) + 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); + }); } - if (showLeb != '' || some) { - let shopDiv = document.createElement('div') - shopDiv.style.cssText = css_LR - if(window.innerWidth>2000){ - shopDiv.style.height = "20px" - shopDiv.style.fontSize = "18px" - } - shopDiv.innerHTML = Map_QM.util.options.shopStyle == "shopName" ? show : mapData.shopArea[i].name; - shopDiv.dataset.name = show - shopDiv.dataset.nameEn = showE - shopDiv.style.display = "none" - 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.name = mapData.shopArea[i].name - shopLabel.userData.mapShow = mapShow //是否永久显示 - shopLabel.userData.isShow = true - this.labelObj.add(shopLabel) + if (showLeb != "" || some) { + let shopDiv = document.createElement("div"); + shopDiv.style.cssText = css_LR; + if (window.innerWidth > 2000) { + shopDiv.style.fontSize = "18px"; + } + shopDiv.innerHTML =Map_QM.util.options.shopStyle == "shopName" ? show : mapData.shopArea[i].name; + shopDiv.dataset.name = show; + shopDiv.dataset.nameEn = showE; + shopDiv.style.display = "none"; + 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.name = mapData.shopArea[i].name; + shopLabel.userData.mapShow = mapShow; //是否永久显示 + shopLabel.userData.formatCode = formatCode; + shopLabel.userData.isShow = true; + this.labelObj.add(shopLabel); } } } } }, addTagLabel: function (obj, userData) { - let shopDiv = document.createElement('img') - shopDiv.src = Map_QM.util.beforPath + "static/img/" + obj.type + ".png" - shopDiv.style.zIndex = 200 - shopDiv.style.width = "3.125vw" - let shopLabel = new THREE.CSS2DObject(shopDiv) - shopLabel.userData = userData - shopLabel.userData.mapShow = true //是否永久显示 - shopLabel.userData.isShow = false - shopLabel.userData.type = obj.type - shopLabel.position.set(obj.xaxis >> 0, -1 * obj.yaxis >> 0, Map_QM.util.shopHeight+30) - this.tagObj.add(shopLabel) - }, + let shopDiv = document.createElement("img"); + shopDiv.src = Map_QM.util.beforPath + "static/img/" + obj.type + ".png"; + shopDiv.style.zIndex = 30; + shopDiv.style.width = "3.125vw"; + let shopLabel = new THREE.CSS2DObject(shopDiv); + shopLabel.userData = userData; + shopLabel.userData.mapShow = true; //是否永久显示 + shopLabel.userData.isShow = false; + shopLabel.userData.type = obj.type; + shopLabel.position.set(obj.xaxis >> 0, (-1 * obj.yaxis) >> 0, Map_QM.util.shopHeight + 30); + this.tagObj.add(shopLabel); + }, //初始化服务图标 initFacilitie: function () { - let serArr = Map_QM.util.allMap[this.buildOrder].buildArr[this.floorOrder].mapData.icons + let serArr = Map_QM.util.allMap[this.buildOrder].buildArr[this.floorOrder].mapData.icons; for (let i = 0; i < serArr.length; i++) { - if (serArr[i].hasOwnProperty('iShow')) { + if (serArr[i].hasOwnProperty("iShow")) { if (serArr[i].iShow) { - serArr[i].floorOrder = this.floorOrder - serArr[i].buildOrder = this.buildOrder - this.facUtil.renderIcon(serArr[i], this) + serArr[i].floorOrder = this.floorOrder; + serArr[i].buildOrder = this.buildOrder; + this.facUtil.renderIcon(serArr[i], this); } } else { - serArr[i].floorOrder = this.floorOrder - serArr[i].buildOrder = this.buildOrder - this.facUtil.renderIcon(serArr[i], this) + serArr[i].floorOrder = this.floorOrder; + serArr[i].buildOrder = this.buildOrder; + this.facUtil.renderIcon(serArr[i], this); } } }, //初始化电梯图标 initStairs: function () { - let facArr = Map_QM.util.allMap[this.buildOrder].buildArr[this.floorOrder].mapData.stairs + let facArr = Map_QM.util.allMap[this.buildOrder].buildArr[this.floorOrder].mapData.stairs; for (let i = 0; i < facArr.length; i++) { - if (facArr[i].facCode == 'ft') { - if (Map_QM.util.pathStateObj.elevatorDown && Map_QM.util.pathStateObj.elevator) { + if (facArr[i].facCode == "ft") { + if (Map_QM.util.pathStateObj.elevatorDown && Map_QM.util.pathStateObj.elevator && Map_QM.util.options.modelIcon) { if (facArr[i].downState) { //上扶梯 - let ex = Map_QM.util.pathStateObj.elevator.clone() - ex.position.set(facArr[i].x, -1 * facArr[i].y, facArr[i].site || 0) - ex.rotation.y = ((facArr[i].angle || 0) * Math.PI) / -180 - ex.userData.type = 'icon' - ex.userData.use = '3d' - ex.userData.name = 'upft' - ex.userData.buildOrder = facArr[i].buildOrder - ex.userData.floorOrder = facArr[i].floorOrder - ex.userData.navCode = facArr[i].navCode - ex.userData.src = 'static/img/ft.png' - ex.userData.facCode = facArr[i].facCode - ex.userData.title = facArr[i].title - this.serObj.add(ex) - facArr[i].facCode = 'ft' - this.facUtil.renderIcon(facArr[i], this, false, ex) + let ex = Map_QM.util.pathStateObj.elevator.clone(); + ex.position.set(facArr[i].x, -1 * facArr[i].y, facArr[i].site || 0); + ex.rotation.y = ((facArr[i].angle || 0) * Math.PI) / -180; + ex.userData.type = "icon"; + ex.userData.use = "3d"; + ex.userData.name = "upft"; + ex.userData.buildOrder = facArr[i].buildOrder; + ex.userData.floorOrder = facArr[i].floorOrder; + ex.userData.navCode = facArr[i].navCode; + ex.userData.src = "static/img/ft.png"; + ex.userData.facCode = facArr[i].facCode; + ex.userData.title = facArr[i].title; + this.serObj.add(ex); + facArr[i].facCode = "ft"; + this.facUtil.renderIcon(facArr[i], this, false, ex); } else if (facArr[i].upState) { //下扶梯 - let ex = Map_QM.util.pathStateObj.elevatorDown.clone() - ex.position.set(facArr[i].x, -1 * facArr[i].y, facArr[i].site || 0) - ex.rotation.y = ((facArr[i].angle || 0) * Math.PI) / -180 - ex.userData.type = 'icon' - ex.userData.use = '3d' - ex.userData.name = 'downft' - ex.userData.buildOrder = facArr[i].buildOrder - ex.userData.floorOrder = facArr[i].floorOrder - ex.userData.navCode = facArr[i].navCode - ex.userData.src = 'static/img/ft.png' - ex.userData.facCode = facArr[i].facCode - ex.userData.title = facArr[i].title - this.serObj.add(ex) - facArr[i].facCode = 'ft' - this.facUtil.renderIcon(facArr[i], this, false, ex) + let ex = Map_QM.util.pathStateObj.elevatorDown.clone(); + ex.position.set(facArr[i].x, -1 * facArr[i].y, facArr[i].site || 0); + ex.rotation.y = ((facArr[i].angle || 0) * Math.PI) / -180; + ex.userData.type = "icon"; + ex.userData.use = "3d"; + ex.userData.name = "downft"; + ex.userData.buildOrder = facArr[i].buildOrder; + ex.userData.floorOrder = facArr[i].floorOrder; + ex.userData.navCode = facArr[i].navCode; + ex.userData.src = "static/img/ft.png"; + ex.userData.facCode = facArr[i].facCode; + ex.userData.title = facArr[i].title; + this.serObj.add(ex); + facArr[i].facCode = "ft"; + this.facUtil.renderIcon(facArr[i], this, false, ex); } else { - this.facUtil.renderIcon(facArr[i], this, true) + this.facUtil.renderIcon(facArr[i], this, true); } } else { - this.facUtil.renderIcon(facArr[i], this, true) + this.facUtil.renderIcon(facArr[i], this, true); } - } else if (facArr[i].facCode == 'upft') { - if (Map_QM.util.pathStateObj.elevator) { - let ex = Map_QM.util.pathStateObj.elevator.clone() - ex.position.set(facArr[i].x, -1 * facArr[i].y, facArr[i].site || 0) - ex.rotation.y = ((facArr[i].angle || 0) * Math.PI) / -180 - ex.userData.type = 'icon' - ex.userData.use = '3d' - ex.userData.name = 'upft' - ex.userData.buildOrder = facArr[i].buildOrder - ex.userData.floorOrder = facArr[i].floorOrder - ex.userData.navCode = facArr[i].navCode - ex.userData.src = 'static/img/ft.png' - ex.userData.facCode = facArr[i].facCode - ex.userData.title = facArr[i].title - this.serObj.add(ex) - facArr[i].facCode = 'ft' - this.facUtil.renderIcon(facArr[i], this, false, ex) + } else if (facArr[i].facCode == "upft") { + if (Map_QM.util.pathStateObj.elevator && Map_QM.util.options.modelIcon) { + let ex = Map_QM.util.pathStateObj.elevator.clone(); + ex.position.set(facArr[i].x, -1 * facArr[i].y, facArr[i].site || 0); + ex.rotation.y = ((facArr[i].angle || 0) * Math.PI) / -180; + ex.userData.type = "icon"; + ex.userData.use = "3d"; + ex.userData.name = "upft"; + ex.userData.buildOrder = facArr[i].buildOrder; + ex.userData.floorOrder = facArr[i].floorOrder; + ex.userData.navCode = facArr[i].navCode; + ex.userData.src = "static/img/ft.png"; + ex.userData.facCode = facArr[i].facCode; + ex.userData.title = facArr[i].title; + this.serObj.add(ex); + facArr[i].facCode = "ft"; + this.facUtil.renderIcon(facArr[i], this, false, ex); } else { - facArr[i].facCode = 'ft' - this.facUtil.renderIcon(facArr[i], this, true) + facArr[i].facCode = "ft"; + this.facUtil.renderIcon(facArr[i], this, true); } - } else if (facArr[i].facCode == 'downft') { - if (Map_QM.util.pathStateObj.elevatorDown) { - let ex = Map_QM.util.pathStateObj.elevatorDown.clone() - ex.position.set(facArr[i].x, -1 * facArr[i].y, facArr[i].site || 0) - ex.rotation.y = ((facArr[i].angle || 0) * Math.PI) / -180 - ex.userData.type = 'icon' - ex.userData.use = '3d' - ex.userData.name = 'downft' - ex.userData.buildOrder = facArr[i].buildOrder - ex.userData.floorOrder = facArr[i].floorOrder - ex.userData.navCode = facArr[i].navCode - ex.userData.src = 'static/img/ft.png' - ex.userData.facCode = facArr[i].facCode - ex.userData.title = facArr[i].title - this.serObj.add(ex) - facArr[i].facCode = 'ft' - this.facUtil.renderIcon(facArr[i], this, false, ex) + } else if (facArr[i].facCode == "downft") { + if (Map_QM.util.pathStateObj.elevatorDown && Map_QM.util.options.modelIcon) { + let ex = Map_QM.util.pathStateObj.elevatorDown.clone(); + ex.position.set(facArr[i].x, -1 * facArr[i].y, facArr[i].site || 0); + ex.rotation.y = ((facArr[i].angle || 0) * Math.PI) / -180; + ex.userData.type = "icon"; + ex.userData.use = "3d"; + ex.userData.name = "downft"; + ex.userData.buildOrder = facArr[i].buildOrder; + ex.userData.floorOrder = facArr[i].floorOrder; + ex.userData.navCode = facArr[i].navCode; + ex.userData.src = "static/img/ft.png"; + ex.userData.facCode = facArr[i].facCode; + ex.userData.title = facArr[i].title; + this.serObj.add(ex); + facArr[i].facCode = "ft"; + this.facUtil.renderIcon(facArr[i], this, false, ex); } else { - facArr[i].facCode = 'ft' - this.facUtil.renderIcon(facArr[i], this, true) + facArr[i].facCode = "ft"; + this.facUtil.renderIcon(facArr[i], this, true); } - } else if (facArr[i].facCode == 'dt') { - if (Map_QM.util.pathStateObj.straight) { - let stra = Map_QM.util.pathStateObj.straight.clone() - stra.position.set(facArr[i].x, -1 * facArr[i].y, facArr[i].site || 0) - stra.rotation.y = ((facArr[i].angle || 0) * Math.PI) / -180 - stra.userData.type = 'icon' - stra.userData.use = '3d' - stra.userData.name = 'dt' - stra.userData.buildOrder = facArr[i].buildOrder - stra.userData.floorOrder = facArr[i].floorOrder - stra.userData.navCode = facArr[i].navCode - stra.userData.src = 'static/img/dt.png' - stra.userData.facCode = facArr[i].facCode - stra.userData.title = facArr[i].title - this.serObj.add(stra) - this.facUtil.renderIcon(facArr[i], this, false, stra) + } else if (facArr[i].facCode == "dt") { + if (Map_QM.util.pathStateObj.straight && Map_QM.util.options.modelIcon) { + let stra = Map_QM.util.pathStateObj.straight.clone(); + stra.position.set(facArr[i].x, -1 * facArr[i].y, facArr[i].site || 0); + stra.rotation.y = ((facArr[i].angle || 0) * Math.PI) / -180; + stra.userData.type = "icon"; + stra.userData.use = "3d"; + stra.userData.name = "dt"; + stra.userData.buildOrder = facArr[i].buildOrder; + stra.userData.floorOrder = facArr[i].floorOrder; + stra.userData.navCode = facArr[i].navCode; + stra.userData.src = "static/img/dt.png"; + stra.userData.facCode = facArr[i].facCode; + stra.userData.title = facArr[i].title; + this.serObj.add(stra); + this.facUtil.renderIcon(facArr[i], this, false, stra); } else { - this.facUtil.renderIcon(facArr[i], this, true) + this.facUtil.renderIcon(facArr[i], this, true); } } else { - this.facUtil.renderIcon(facArr[i], this, true) + this.facUtil.renderIcon(facArr[i], this, true); } } }, //初始化装饰图标 initDecos: function () { - let mapData = Map_QM.util.allMap[this.buildOrder].buildArr[this.floorOrder].mapData - let sLen = mapData.decos.length - let entColor, borderColor + let mapData = Map_QM.util.allMap[this.buildOrder].buildArr[this.floorOrder].mapData; + let sLen = mapData.decos.length; + let entColor, borderColor; + if (mapData.groupArea) { for (let k = 0; k < mapData.groupArea.length; k++) { - var gp = new THREE.Group() - gp.rotateX((mapData.groupArea[k].angleX * Math.PI) / 180) - gp.rotateY((mapData.groupArea[k].angleY * Math.PI) / 180) - gp.rotateZ((mapData.groupArea[k].angleZ * Math.PI) / 180) + var gp = new THREE.Group(); + gp.rotateX((mapData.groupArea[k].angleX * Math.PI) / 180); + gp.rotateY((mapData.groupArea[k].angleY * Math.PI) / 180); + gp.rotateZ((mapData.groupArea[k].angleZ * Math.PI) / 180); for (let i = 0; i < sLen; i++) { - if (mapData.decos[i].gid && mapData.decos[i].gid == mapData.groupArea[k]._name && Map_QM.util.changeAreaToString(mapData.decos[i]) != '') { - let arr = Map_QM.util.changeAreaToString(mapData.decos[i]) - entColor = mapData.decos[i].entColor - borderColor = mapData.decos[i].borderColor - let show = mapData.decos[i].name == 'deco' ? '' : mapData.decos[i].name - let hollShop = [] + let arr = Map_QM.util.changeAreaToString(mapData.decos[i]); + if (mapData.decos[i].gid && mapData.decos[i].gid == mapData.groupArea[k].name && arr.length > 0) { + entColor = mapData.decos[i].entColor; + borderColor = mapData.decos[i].borderColor; + let show = mapData.decos[i].name == "deco" ? "" : mapData.decos[i].name; + let hollShop = []; if (mapData.decos[i].hollArea) { for (let k = 0; k < mapData.decos[i].hollArea.length; k++) { - hollShop.push(Map_QM.util.changeAreaToString(mapData.decos[i].hollArea[k])) + hollShop.push(Map_QM.util.changeAreaToString(mapData.decos[i].hollArea[k])); } } - let mahc = this.Model_QM.MyModelShape(arr, hollShop, mapData.decos[i], entColor, borderColor, 240) - mahc.xaxis = mapData.decos[i].xaxis >> 0 - mahc.yaxis = mapData.decos[i].yaxis >> 0 - mahc.node = mapData.decos[i].shopNav + let mahc = this.Model_QM.MyModelShape(arr,hollShop,mapData.decos[i],entColor,borderColor,70 + 100 * this.floorOrder); + mahc.xaxis = mapData.decos[i].xaxis >> 0; + mahc.yaxis = mapData.decos[i].yaxis >> 0; + mahc.node = mapData.decos[i].shopNav; mahc.userData = { - type: 'deco', - name: show - } - mahc.userData.opacity = mapData.decos[i].alphaModle / 100 || 0 - gp.add(mahc) - mahc.position.x = -1 * mapData.groupArea[k].xaxis - mahc.position.y = mapData.groupArea[k].yaxis + type: "deco", + name: show, + }; + mahc.userData.opacity = mapData.decos[i].alphaModle / 100 || 0; + gp.add(mahc); + mahc.position.x = -1 * mapData.groupArea[k].xaxis; + mahc.position.y = mapData.groupArea[k].yaxis; } } - this.allObj.add(gp) - gp.position.x = mapData.groupArea[k].xaxis - gp.position.y = -1 * mapData.groupArea[k].yaxis - gp.position.z = mapData.groupArea[k].site || 0 - gp.scale.set(mapData.groupArea[k].scale, mapData.groupArea[k].scale, mapData.groupArea[k].scale) + this.allObj.add(gp); + gp.position.x = mapData.groupArea[k].xaxis; + gp.position.y = -1 * mapData.groupArea[k].yaxis; + gp.position.z = mapData.groupArea[k].site || 0; + gp.scale.set(mapData.groupArea[k].scale,mapData.groupArea[k].scale,mapData.groupArea[k].scale); } } for (let i = 0; i < sLen; i++) { - let arr = Map_QM.util.changeAreaToString(mapData.decos[i]) - if (!mapData.decos[i].gid && arr.length>0) { - entColor = mapData.decos[i].entColor - borderColor = mapData.decos[i].borderColor - let show = mapData.decos[i].name == 'deco' ? '' : mapData.decos[i].name - let hollShop = [] + let arr = Map_QM.util.changeAreaToString(mapData.decos[i]); + if (!mapData.decos[i].gid && arr.length > 0) { + entColor = mapData.decos[i].entColor; + borderColor = mapData.decos[i].borderColor; + let show = mapData.decos[i].name == "deco" ? "" : mapData.decos[i].name; + let hollShop = []; if (mapData.decos[i].hollArea) { for (let k = 0; k < mapData.decos[i].hollArea.length; k++) { - hollShop.push(Map_QM.util.changeAreaToString(mapData.decos[i].hollArea[k])) + hollShop.push(Map_QM.util.changeAreaToString(mapData.decos[i].hollArea[k])); } } - let mahc = this.Model_QM.MyModelShape(arr, hollShop, mapData.decos[i], entColor, borderColor, 70 + 100 * this.floorOrder); + let mahc; + mahc = this.Model_QM.MyModelShape(arr,hollShop,mapData.decos[i],entColor,borderColor,70 + 100 * this.floorOrder ); mahc.userData = { - "type": "deco", - "node": mapData.decos[i].shopNav, - "xaxis": mapData.decos[i].xaxis, - "yaxis": mapData.decos[i].yaxis, - "houseNumber": mahc.name, - "name": show - }; - this.allObj.add(mahc) + type: "deco", + node: mapData.decos[i].shopNav, + xaxis: mapData.decos[i].xaxis, + yaxis: mapData.decos[i].yaxis, + houseNumber: mahc.name, + name: show, + }; + this.allObj.add(mahc); } } }, @@ -4922,25 +6645,18 @@ FloorMap_QM.prototype = { * 渲染墙体 */ initWall: function () { - let mapData = Map_QM.util.allMap[this.buildOrder].buildArr[this.floorOrder].mapData + let mapData = Map_QM.util.allMap[this.buildOrder].buildArr[this.floorOrder].mapData; //渲染 if (mapData.wallArea) { - let sLen = mapData.wallArea.length + let sLen = mapData.wallArea.length; for (let i = 0; i < sLen; i++) { - let arr = Map_QM.util.changeWallToString(mapData.wallArea[i]) - let mahc = this.Model_QM.MyModelShape( - arr, - null, - mapData.wallArea[i], - mapData.wallArea[i].entColor || '#eaeaea', - mapData.wallArea[i].borderColor || '#eaeaea', - 300 - ) + let arr = Map_QM.util.changeWallToString(mapData.wallArea[i]); + let mahc = this.Model_QM.MyModelShape(arr, null, mapData.wallArea[i], mapData.wallArea[i].entColor || "#eaeaea", mapData.wallArea[i].borderColor || "#eaeaea", 300); mahc.userData = { - type: 'wall' - } - mahc.userData.opacity = mapData.wallArea[i].alphaModle / 100 || 0 - this.allObj.add(mahc) + type: "wall", + }; + mahc.userData.opacity = mapData.wallArea[i].alphaModle / 100 || 0; + this.allObj.add(mahc); } } }, @@ -4948,280 +6664,295 @@ FloorMap_QM.prototype = { * 渲染文本 */ initTextArea: function () { - let mapData = Map_QM.util.allMap[this.buildOrder].buildArr[this.floorOrder].mapData + let mapData = Map_QM.util.allMap[this.buildOrder].buildArr[this.floorOrder].mapData; //渲染 if (mapData.svgArea) { - let sLen = mapData.svgArea.length + let sLen = mapData.svgArea.length; for (let i = 0; i < sLen; i++) { - let mahc = this.Model_QM.MyModelText(mapData.svgArea[i]) + let mahc = this.Model_QM.MyModelText(mapData.svgArea[i]); mahc.userData = { - type: 'svg', + type: "svg", rot: mahc.rotation.z, - shopNum: mapData.svgArea[i].name - } - this.svgObj.add(mahc) + houseNumber: mapData.svgArea[i].name, + }; + this.svgObj.add(mahc); } } }, /** * 设置终点图标 */ - setOverSite: function (shopX, shopY, shopZ) { - if (Map_QM.endModel) { - Map_QM.endModel.visible = pathCameraState == "2D" ? false : true; - Map_QM.endModel.scale.x = Map_QM.endModel.scale.y = Map_QM.endModel.scale.z = 100; - Map_QM.endModel.position.set(shopX, shopZ, shopY); //x,z,y - Map_QM.endModel.applyMatrix4(Map_QM.sceneGap.matrix); - if (Map_QM.endIcon) { - Map_QM.endIcon.visible = pathCameraState == "2D" ? true : false; - Map_QM.endIcon.scale.x = 100; - Map_QM.endIcon.scale.y = 120; - Map_QM.endIcon.position.set(shopX, 100, shopY); //x,z,y - Map_QM.endIcon.applyMatrix4(Map_QM.sceneGap.matrix); - } - } else { - try { - Map_QM.scene.traverse(item => { - if (item.name == "Z-model") { - Map_QM.scene.remove(item); - } - }); - } catch (e) { - console.log("traverse") - } - - let loader2 = new THREE.GLTFLoader(); - loader2.load(Map_QM.util.beforPath + "static/img/zhong.glb", function (collada2) { - collada2.scene.scale.x = collada2.scene.scale.y = collada2.scene.scale.z = 100; - if (shopX != 0 && shopY != 0) { - collada2.scene.position.set(shopX, shopZ, shopY); //x,z,y - } - collada2.scene.applyMatrix4(Map_QM.sceneGap.matrix); - collada2.scene.renderOrder = 200; - collada2.scene.traverse(function (child) { - if (child.type === "Mesh") { - child.castShadow = Map_QM.util.options.shadow; - child.receiveShadow = Map_QM.util.options.shadow; - if (child.material.map) { - child.material.map.encoding = THREE.LinearEncoding; //贴图需要转换成 线性编码 - } - } - }); - for (let k = 0; k < collada2.animations.length; k++) { - let mixer = new THREE.AnimationMixer(collada2.scene) - mixer.clipAction(collada2.animations[k]).play() - Map_QM.mixers.push(mixer) - } - collada2.scene.name = "Z-model"; - Map_QM.endModel = collada2.scene; - Map_QM.scene.add(collada2.scene); - Map_QM.endModel.visible = pathCameraState == "2D" ? false : true; - }); - let spriteMap = new THREE.TextureLoader().load(Map_QM.util.beforPath + "static/img/Z.png"); - let spriteMaterial = new THREE.SpriteMaterial({ //sizeAttenuation: false 禁止跟随鼠标缩放 - map: spriteMap, - depthTest: true, - transparent: true, - alphaTest: 0.5 - }); - Map_QM.endIcon = new MySprite_QM(spriteMaterial); - Map_QM.endIcon.scale.set(100, 120, 1); - Map_QM.endIcon.center = new THREE.Vector2(0.5, 0); - Map_QM.endIcon.position.set(shopX, 100, shopY); - Map_QM.endIcon.applyMatrix4(Map_QM.sceneGap.matrix); - Map_QM.endIcon.renderOrder = 300; - Map_QM.endIcon.name = "Z-model"; - Map_QM.endIcon.visible = pathCameraState == "2D" ? true : false; - Map_QM.scene.add(Map_QM.endIcon); - } - }, + setOverSite: function (shopX, shopY, shopZ) { + if (Map_QM.endModel) { + Map_QM.endModel.visible = pathCameraState == "2D" ? false : true; + Map_QM.endModel.scale.x = Map_QM.endModel.scale.y = Map_QM.endModel.scale.z = 100; + Map_QM.endModel.position.set(shopX, shopZ, shopY); //x,z,y + Map_QM.endModel.applyMatrix4(Map_QM.sceneGap.matrix); + if (Map_QM.endIcon) { + Map_QM.endIcon.visible = pathCameraState == "2D" ? true : false; + Map_QM.endIcon.scale.x = 100; + Map_QM.endIcon.scale.y = 120; + Map_QM.endIcon.position.set(shopX, 100, shopY); //x,z,y + Map_QM.endIcon.applyMatrix4(Map_QM.sceneGap.matrix); + } + } else { + try { + Map_QM.scene.traverse((item) => { + if (item.name == "Z-model") { + Map_QM.scene.remove(item); + } + }); + } catch (e) { + window.captureException && window.captureException(e); + console.log("traverse"); + } + + let loader2 = new THREE.GLTFLoader(); + loader2.load( + Map_QM.util.beforPath + "static/img/zhong.glb", + function (collada2) { + collada2.scene.scale.x = collada2.scene.scale.y = collada2.scene.scale.z = 100; + if (shopX != 0 && shopY != 0) { + collada2.scene.position.set(shopX, shopZ, shopY); //x,z,y + } + collada2.scene.applyMatrix4(Map_QM.sceneGap.matrix); + collada2.scene.renderOrder = 200; + collada2.scene.traverse(function (child) { + if (child.type === "Mesh") { + child.castShadow = Map_QM.util.options.shadow; + child.receiveShadow = Map_QM.util.options.shadow; + if (child.material.map) { + child.material.map.encoding = THREE.LinearEncoding; //贴图需要转换成 线性编码 + } + } + }); + for (let k = 0; k < collada2.animations.length; k++) { + let mixer = new THREE.AnimationMixer(collada2.scene); + mixer.clipAction(collada2.animations[k]).play(); + Map_QM.mixers.push(mixer); + } + collada2.scene.name = "Z-model"; + Map_QM.endModel = collada2.scene; + Map_QM.scene.add(collada2.scene); + Map_QM.endModel.visible = pathCameraState == "2D" ? false : true; + } + ); + let spriteMap = new THREE.TextureLoader().load( + Map_QM.util.beforPath + "static/img/Z.png" + ); + let spriteMaterial = new THREE.SpriteMaterial({ + //sizeAttenuation: false 禁止跟随鼠标缩放 + map: spriteMap, + depthTest: true, + transparent: true, + alphaTest: 0.5, + }); + Map_QM.endIcon = new MySprite_QM(spriteMaterial); + Map_QM.endIcon.scale.set(100, 120, 1); + Map_QM.endIcon.center = new THREE.Vector2(0.5, 0); + Map_QM.endIcon.position.set(shopX, 100, shopY); + Map_QM.endIcon.applyMatrix4(Map_QM.sceneGap.matrix); + Map_QM.endIcon.renderOrder = 300; + Map_QM.endIcon.name = "Z-model"; + Map_QM.endIcon.visible = pathCameraState == "2D" ? true : false; + Map_QM.scene.add(Map_QM.endIcon); + } + }, /** * 设置起点图标 */ - setStartSite: function (shopX, shopY, shopZ) { - let _this = this; - if (Map_QM.devModel) { - Map_QM.devModel.position.set(shopX, -1 * shopY,50); - _this.allObj.add(Map_QM.devModel) - Map_QM.qiModel.position.set(shopX, -1 * shopY,10); - _this.allObj.add(Map_QM.qiModel) - Map_QM.qiIcon.position.set(shopX, -1 * shopY, shopZ); - _this.allObj.add(Map_QM.qiIcon) - } else { - new THREE.GLTFLoader().load(Map_QM.util.beforPath + "static/img/guide.glb", function (obj) { - obj.scene.scale.x = obj.scene.scale.y = obj.scene.scale.z = 100; - obj.scene.rotation.x = Math.PI / 2; - obj.scene.rotation.y = Map_QM.util.deviceObj.angle*Math.PI/-180; - obj.scene.traverse(function (child) { - if (child.type === "Mesh") { - child.castShadow = Map_QM.util.options.shadow; - child.receiveShadow = Map_QM.util.options.shadow; - if (child.material.map) { - child.material.map.encoding = THREE.LinearEncoding; //贴图需要转换成 线性编码 - } - } - }); - if (shopX != 0 && shopY != 0) { - obj.scene.position.set(shopX, -1 * shopY, 50); //x,z,y - } - for (let k = 0; k < obj.animations.length; k++) { - let mixer = new THREE.AnimationMixer(obj.scene) - mixer.clipAction(obj.animations[k]).play() - Map_QM.mixers.push(mixer) - } - Map_QM.devModel = obj.scene; - Map_QM.devModel.renderOrder = 160; - _this.allObj.add(Map_QM.devModel); - }); - - new THREE.GLTFLoader().load(Map_QM.util.beforPath + "static/img/qi.glb", function (collada) { - collada.scene.scale.x = collada.scene.scale.y = collada.scene.scale.z = 100; - collada.scene.rotateX(Math.PI / 2); - collada.scene.visible =false; - collada.scene.traverse(function (child) { - if (child.type === "Mesh") { - child.castShadow = Map_QM.util.options.shadow; - child.receiveShadow = Map_QM.util.options.shadow; - if (child.material.map) { - child.material.map.encoding = THREE.LinearEncoding; //贴图需要转换成 线性编码 - } - } - }); - if (shopX != 0 && shopY != 0) { - collada.scene.position.set(shopX, -1 * shopY, parseInt(Map_QM.util.buildHeight) + 5); //x,z,y - } - for (let k = 0; k < collada.animations.length; k++) { - let mixer = new THREE.AnimationMixer(collada.scene) - mixer.clipAction(collada.animations[k]).play() - Map_QM.mixers.push(mixer) - } - collada.scene.renderOrder = 200; - collada.scene.userData.type = "start"; - Map_QM.qiModel = collada.scene; - _this.allObj.add(collada.scene); - //-------------------------------------------------------------- - let spriteMap = new THREE.TextureLoader().load(Map_QM.util.beforPath + "static/img/Q.png"); - let spriteMaterial = new THREE.SpriteMaterial({ //sizeAttenuation: false 禁止跟随鼠标缩放 - map: spriteMap, - depthTest: true, - transparent: true, - alphaTest: 0.5 - }); - Map_QM.qiIcon = new MySprite_QM(spriteMaterial); - Map_QM.qiIcon.scale.set(100, 120, 1); - Map_QM.qiIcon.center = new THREE.Vector2(0.5, 0); - Map_QM.qiIcon.position.set(shopX, -1 * shopY, shopZ + 50); - Map_QM.qiIcon.renderOrder = 500; - Map_QM.qiIcon.visible = false; - Map_QM.qiIcon.userData.type = "start"; - _this.allObj.add(Map_QM.qiIcon); - - - }); - } - }, + setStartSite: function (shopX, shopY, shopZ) { + let _this = this; + if (Map_QM.qiModel) { + Map_QM.devModel.position.set(shopX, -1 * shopY, 20); + _this.allObj.add(Map_QM.devModel); + Map_QM.qiModel.position.set(shopX, -1 * shopY, 10); + _this.allObj.add(Map_QM.qiModel); + Map_QM.qiIcon.position.set(shopX, -1 * shopY, shopZ); + _this.allObj.add(Map_QM.qiIcon); + } else { + new THREE.GLTFLoader().load( + Map_QM.util.beforPath + "static/img/guide.glb", + function (obj) { + obj.scene.scale.x = obj.scene.scale.y = obj.scene.scale.z = 100; + obj.scene.rotation.x = Math.PI / 2; + obj.scene.rotation.y = (Map_QM.util.deviceObj.angle * Math.PI) / -180; + obj.scene.traverse(function (child) { + if (child.type === "Mesh") { + child.castShadow = Map_QM.util.options.shadow; + child.receiveShadow = Map_QM.util.options.shadow; + if (child.material.map) { + child.material.map.encoding = THREE.LinearEncoding; //贴图需要转换成 线性编码 + } + } + }); + if (shopX != 0 && shopY != 0) { + obj.scene.position.set(shopX, -1 * shopY, 50); //x,z,y + } + for (let k = 0; k < obj.animations.length; k++) { + let mixer = new THREE.AnimationMixer(obj.scene); + mixer.clipAction(obj.animations[k]).play(); + Map_QM.mixers.push(mixer); + } + Map_QM.devModel = obj.scene; + Map_QM.devModel.visible = false; + Map_QM.devModel.renderOrder = 160; + _this.allObj.add(Map_QM.devModel); + } + ); + new THREE.GLTFLoader().load( + Map_QM.util.beforPath + "static/img/qi.glb", + function (collada) { + collada.scene.scale.x = collada.scene.scale.y = collada.scene.scale.z = 100; + collada.scene.rotateX(Math.PI / 2); + collada.scene.traverse(function (child) { + if (child.type === "Mesh") { + child.castShadow = Map_QM.util.options.shadow; + child.receiveShadow = Map_QM.util.options.shadow; + if (child.material.map) { + child.material.map.encoding = THREE.LinearEncoding; //贴图需要转换成 线性编码 + } + } + }); + if (shopX != 0 && shopY != 0) { + collada.scene.position.set( shopX, -1 * shopY, parseInt(Map_QM.util.buildHeight) + 5); //x,z,y + } + for (let k = 0; k < collada.animations.length; k++) { + let mixer = new THREE.AnimationMixer(collada.scene); + mixer.clipAction(collada.animations[k]).play(); + Map_QM.mixers.push(mixer); + } + collada.scene.renderOrder = 200; + collada.scene.userData.type = "start"; + Map_QM.qiModel = collada.scene; + _this.allObj.add(collada.scene); + //-------------------------------------------------------------- + let spriteMap = new THREE.TextureLoader().load( + Map_QM.util.beforPath + "static/img/Q.png" + ); + let spriteMaterial = new THREE.SpriteMaterial({ + //sizeAttenuation: false 禁止跟随鼠标缩放 + map: spriteMap, + depthTest: true, + transparent: true, + alphaTest: 0.5, + }); + Map_QM.qiIcon = new MySprite_QM(spriteMaterial); + Map_QM.qiIcon.scale.set(100, 120, 1); + Map_QM.qiIcon.center = new THREE.Vector2(0.5, 0); + Map_QM.qiIcon.position.set(shopX, -1 * shopY, shopZ + 50); + Map_QM.qiIcon.renderOrder = 500; + Map_QM.qiIcon.visible = false; + Map_QM.qiIcon.userData.type = "start"; + _this.allObj.add(Map_QM.qiIcon); + } + ); + } + }, /** * 查找线 * @param {Object} startNode * @param {Object} endNode */ isNoFindLine: function (startNode, endNode) { - let no = false + let no = false; for (let i = 0; i < startNode.lineArr.length; i++) { - if (startNode.lineArr[i].nextNode.id == endNode.id || startNode.lineArr[i].selfNode.id == endNode.id) { - no = true - break + if (startNode.lineArr[i].nextNode.id == endNode.id ||startNode.lineArr[i].selfNode.id == endNode.id) { + no = true; + break; } } - return no + return no; }, //初始化停车位 - initPark: function () { - let mapData = Map_QM.util.allMap[this.buildOrder].buildArr[this.floorOrder].mapData; - //渲染车位 - if (mapData.parkArea) { - let sLen = mapData.parkArea.length; - if (sLen > 0) { - this.allObj.add(this.parkObj); - } - let shapeArr = [], materials = [], parkHeight = 1, borderColor = 0xaaaaaa; - for (let i = 0; i < sLen; i++) { - let arr = Map_QM.util.changeParkToString(mapData.parkArea[i]); - if (arr != "") { - parkHeight = Math.max(parseInt(mapData.parkArea[i].toHeight), parkHeight); - borderColor = mapData.parkArea[i].borderColor; - if (arr.length > 0) { - let shape = new THREE.Shape(); - shape.moveTo(arr[0][0], -1 * arr[0][1]); - for (let k = 1; k < arr.length; k++) { - shape.lineTo(arr[k][0], -1 * arr[k][1]); - } - shapeArr.push(shape); - let meshMaterial; - let color2 = new THREE.Color(mapData.parkArea[i].entColor); - for (let e = 0; e < Map_QM.util.parkMaterialArr.length; e++) { - if (Map_QM.util.parkMaterialArr[e].color.equals(color2)) { - meshMaterial = Map_QM.util.parkMaterialArr[e]; - } - } - if (!meshMaterial) { - meshMaterial = new THREE.MeshBasicMaterial({ - color: mapData.parkArea[i].entColor - }); - Map_QM.util.parkMaterialArr.push(meshMaterial); - } - materials.push(meshMaterial); - if (mapData.parkArea[i].childArea && mapData.parkArea[i].childArea.length > 0) { - for (let m = 0; m < mapData.parkArea[i].childArea.length; m++) { - let meshMaterial0; - if (mapData.parkArea[i].childArea[m].color && mapData.parkArea[i].childArea[m].color != "#FFffff") { - let color2 = new THREE.Color(mapData.parkArea[i].childArea[m].color); - for (let e = 0; e < Map_QM.util.parkMaterialArr.length; e++) { - if (Map_QM.util.parkMaterialArr[e].color.equals(color2)) { - meshMaterial0 = Map_QM.util.parkMaterialArr[e]; - } - } - if (!meshMaterial0) { - meshMaterial0 = new THREE.MeshBasicMaterial({ - color: mapData.parkArea[i].childArea[m].color - }); - Map_QM.util.parkMaterialArr.push(meshMaterial0); - } - } else { - meshMaterial0 = meshMaterial; - } - let ps = mapData.parkArea[i].childArea[m].points; - let shape0 = new THREE.Shape(); - // 设置开始点的位置 - shape0.moveTo(ps[0].x, -1 * ps[0].y); - for (let t = 0; t < ps.length; t++) { - shape0.lineTo(ps[t].x, -1 * ps[t].y); - } - shapeArr.push(shape0); - materials.push(meshMaterial0); - } - } - - } - //显示车位编号 - if (mapData.parkArea[i].parkNum != "NaN" && i % 10 == 0) { - let shopDiv = document.createElement('div'); - shopDiv.style.cssText = css_LR - shopDiv.style.display = "none"; - shopDiv.textContent = mapData.parkArea[i].parkNum; - let shopLabel = new THREE.CSS2DObject(shopDiv); - shopLabel.userData.mapShow = true; //是否永久显示 - shopLabel.name = mapData.parkArea[i].name; - shopLabel.position.set(mapData.parkArea[i].xaxis >> 0, -1 * mapData.parkArea[i].yaxis >> 0, parseInt(mapData.parkArea[i].toHeight) + 1); - this.labelObj.add(shopLabel); - } - } - } - let mahc = this.Model_QM.MyParkShape(shapeArr, materials, parkHeight); - this.parkObj.add(mahc); - } - } -} + initPark: function () { + let mapData = Map_QM.util.allMap[this.buildOrder].buildArr[this.floorOrder].mapData; + //渲染车位 + if (mapData.parkArea) { + let sLen = mapData.parkArea.length; + if (sLen > 0) { + this.allObj.add(this.parkObj); + } + let shapeArr = [], + materials = [], + parkHeight = 1, + borderColor = 0xaaaaaa; + for (let i = 0; i < sLen; i++) { + let arr = Map_QM.util.changeParkToString(mapData.parkArea[i]); + if (arr != "") { + parkHeight = Math.max(parseInt(mapData.parkArea[i].toHeight), parkHeight); + borderColor = mapData.parkArea[i].borderColor; + if (arr.length > 0) { + let shape = new THREE.Shape(); + shape.moveTo(arr[0][0], -1 * arr[0][1]); + for (let k = 1; k < arr.length; k++) { + shape.lineTo(arr[k][0], -1 * arr[k][1]); + } + shapeArr.push(shape); + let meshMaterial; + let color2 = new THREE.Color(mapData.parkArea[i].entColor); + for (let e = 0; e < Map_QM.util.parkMaterialArr.length; e++) { + if (Map_QM.util.parkMaterialArr[e].color.equals(color2)) { + meshMaterial = Map_QM.util.parkMaterialArr[e]; + } + } + if (!meshMaterial) { + meshMaterial = new THREE.MeshBasicMaterial({ + color: mapData.parkArea[i].entColor, + }); + Map_QM.util.parkMaterialArr.push(meshMaterial); + } + materials.push(meshMaterial); + if (mapData.parkArea[i].childArea && mapData.parkArea[i].childArea.length > 0) { + for (let m = 0; m < mapData.parkArea[i].childArea.length; m++) { + let meshMaterial0; + if (mapData.parkArea[i].childArea[m].color && mapData.parkArea[i].childArea[m].color != "#FFffff") { + let color2 = new THREE.Color(mapData.parkArea[i].childArea[m].color); + for (let e = 0; e < Map_QM.util.parkMaterialArr.length; e++) { + if (Map_QM.util.parkMaterialArr[e].color.equals(color2)) { + meshMaterial0 = Map_QM.util.parkMaterialArr[e]; + } + } + if (!meshMaterial0) { + meshMaterial0 = new THREE.MeshBasicMaterial({ + color: mapData.parkArea[i].childArea[m].color, + }); + Map_QM.util.parkMaterialArr.push(meshMaterial0); + } + } else { + meshMaterial0 = meshMaterial; + } + let ps = mapData.parkArea[i].childArea[m].points; + let shape0 = new THREE.Shape(); + // 设置开始点的位置 + shape0.moveTo(ps[0].x, -1 * ps[0].y); + for (let t = 0; t < ps.length; t++) { + shape0.lineTo(ps[t].x, -1 * ps[t].y); + } + shapeArr.push(shape0); + materials.push(meshMaterial0); + } + } + } + //显示车位编号 + if (mapData.parkArea[i].parkNum != "NaN" && i % 20 == 0) { + let shopDiv = document.createElement("div"); + shopDiv.style.cssText = css_LR + shopDiv.style.display = "none"; + shopDiv.textContent = mapData.parkArea[i].parkNum; + let shopLabel = new THREE.CSS2DObject(shopDiv); + shopLabel.userData.mapShow = true; //是否永久显示 + shopLabel.name = mapData.parkArea[i].name; + shopLabel.position.set(mapData.parkArea[i].xaxis >> 0,(-1 * mapData.parkArea[i].yaxis) >> 0,parseInt(mapData.parkArea[i].toHeight) + 1); + this.labelObj.add(shopLabel); + } + } + } + let mahc = this.Model_QM.MyParkShape(shapeArr, materials, parkHeight); + this.parkObj.add(mahc); + } + }, +}; /** * 渲染3D模型类 @@ -5230,667 +6961,735 @@ FloorMap_QM.prototype = { * 模型对象 options */ MyModel_QM = function () { - this.xaxis = 0 - this.yaxis = 0 - this.node = 0 -} + this.xaxis = 0; + this.yaxis = 0; + this.node = 0; +}; MyModel_QM.prototype.MyParkShape = function (shapes, materials, toHeight = 5) { - let scanGeometry = new THREE.ShapeBufferGeometry(shapes, 1); - let material = new THREE.LineBasicMaterial({ - color: "#aeaeae" - }); //材质对象lineColor - Map_QM.util.lineBasicMaterialArr.push(material); - - // 创建模型 - let mesh = new THREE.Mesh(scanGeometry, materials); - mesh.position.z = toHeight; - mesh.renderOrder = 300; - mesh.userData.type = "park"; - - let cubeEdges = new THREE.EdgesGeometry(scanGeometry, 60); - let cubeLine = new THREE.LineSegments(cubeEdges, material); - mesh.add(cubeLine); - return mesh; -} - -MyModel_QM.prototype.MyModelShape = function (areaArr, howllowArr, opObj, entityColor = 0xdadada, lineColor = 0xeeeeee, indexOrder = 1) { - let len = areaArr.length; - if (len == 0) { - return; - } - let alphaModle = opObj.alphaModle / 100 || 0; - // 实例化shape对象 - let shape = new THREE.Shape(); - // 设置开始点的位置 - shape.moveTo(areaArr[0][0], -1 * areaArr[0][1]); - for (let i = 0; i < areaArr.length; i++) { - if (areaArr[i].length == 4) { - shape.lineTo(areaArr[i][2], -1 * areaArr[i][3]); - } else { - shape.bezierCurveTo(areaArr[i][2], -1 * areaArr[i][3], areaArr[i][4], -1 * areaArr[i][5], areaArr[i][6], -1 * areaArr[i][7]); - } - } - let material; - let matcolor = new THREE.Color(lineColor) - for (let k = 0; k < Map_QM.util.lineBasicMaterialArr.length; k++) { - if (Map_QM.util.lineBasicMaterialArr[k].color.equals(matcolor)) { - material = Map_QM.util.lineBasicMaterialArr[k]; - } - } - if (!material) { - material = new THREE.LineBasicMaterial({ - color: lineColor, - opacity: 0.8, - transparent: true - }); //材质对象lineColor - Map_QM.util.lineBasicMaterialArr.push(material); - } - if (howllowArr && howllowArr.length > 0) { - for (let n = 0; n < howllowArr.length; n++) { - let hole = new THREE.Path(); // 添加孔洞 - hole.moveTo(howllowArr[n][0][0], -1 * howllowArr[n][0][1]); - for (let k = 0; k < howllowArr[n].length; k++) { - if (howllowArr[n][k].length == 4) { - hole.lineTo(howllowArr[n][k][2], -1 * howllowArr[n][k][3]); - } else { - hole.bezierCurveTo(howllowArr[n][k][2], -1 * howllowArr[n][k][3], howllowArr[n][k][4], -1 * howllowArr[n][k][5], howllowArr[n][k][6], -1 * howllowArr[n][k][7]); - } - } - shape.holes.push(hole); - } - } - - let scanGeometry, meshMaterial, options = { - depth: parseInt(opObj.toHeight), - bevelEnabled: false, - curveSegments: 12, - bevelThickness: 0, - bevelSize: 0, - bevelSegments: 0, - material: 0, //frontMaterial = green - extrudeMaterial: 1, //sideMaterial = gray - }; + let scanGeometry = new THREE.ShapeBufferGeometry(shapes, 1); + let material = new THREE.LineBasicMaterial({ + color: "#aeaeae", + }); //材质对象lineColor + Map_QM.util.lineBasicMaterialArr.push(material); + + // 创建模型 + let mesh = new THREE.Mesh(scanGeometry, materials); + mesh.position.z = toHeight; + mesh.renderOrder = 300; + mesh.userData.type = "park"; + + let cubeEdges = new THREE.EdgesGeometry(scanGeometry, 60); + let cubeLine = new THREE.LineSegments(cubeEdges, material); + mesh.add(cubeLine); + return mesh; +}; + +MyModel_QM.prototype.MyModelShape = function (areaArr,howllowArr,opObj,entityColor = 0xdadada,lineColor = 0xeeeeee,indexOrder = 1) { + let len = areaArr.length; + if (len == 0) { + return; + } + let alphaModle = opObj.alphaModle / 100 || 0; + // 实例化shape对象 + let shape = new THREE.Shape(); + // 设置开始点的位置 + shape.moveTo(areaArr[0][0], -1 * areaArr[0][1]); + for (let i = 0; i < areaArr.length; i++) { + if (areaArr[i].length == 4) { + shape.lineTo(areaArr[i][2], -1 * areaArr[i][3]); + } else { + shape.bezierCurveTo(areaArr[i][2], -1 * areaArr[i][3], areaArr[i][4], -1 * areaArr[i][5], areaArr[i][6], -1 * areaArr[i][7]); + } + } + let material; + let matcolor = new THREE.Color(lineColor); + for (let k = 0; k < Map_QM.util.lineBasicMaterialArr.length; k++) { + if (Map_QM.util.lineBasicMaterialArr[k].color.equals(matcolor)) { + material = Map_QM.util.lineBasicMaterialArr[k]; + } + } + if (!material) { + material = new THREE.LineBasicMaterial({ + color: lineColor, + opacity: 0.8, + transparent: true, + }); //材质对象lineColor + Map_QM.util.lineBasicMaterialArr.push(material); + } + if (howllowArr && howllowArr.length > 0) { + for (let n = 0; n < howllowArr.length; n++) { + let hole = new THREE.Path(); // 添加孔洞 + hole.moveTo(howllowArr[n][0][0], -1 * howllowArr[n][0][1]); + for (let k = 0; k < howllowArr[n].length; k++) { + if (howllowArr[n][k].length == 4) { + hole.lineTo(howllowArr[n][k][2], -1 * howllowArr[n][k][3]); + } else { + hole.bezierCurveTo(howllowArr[n][k][2],-1 * howllowArr[n][k][3],howllowArr[n][k][4],-1 * howllowArr[n][k][5],howllowArr[n][k][6],-1 * howllowArr[n][k][7]); + } + } + shape.holes.push(hole); + } + } - scanGeometry = new THREE.ExtrudeGeometry(shape, options); - let meshColor = new THREE.Color(entityColor); - for (let e = 0; e < Map_QM.util.meshMaterialArr.length; e++) { - if (Map_QM.util.meshMaterialArr[e].color && Map_QM.util.meshMaterialArr[e].color.equals(meshColor) && Map_QM.util.meshMaterialArr[e].opacity == alphaModle && !Map_QM.util.meshMaterialArr[e].userData.map) { - meshMaterial = Map_QM.util.meshMaterialArr[e]; - } - } - if (!meshMaterial) { - meshMaterial = new THREE.MeshPhongMaterial({ //MeshStandardMaterial MeshPhongMaterial MeshBasicMaterial - color: entityColor, - transparent: true, - opacity: alphaModle, - side: THREE.DoubleSide, - depthTest: true - }); - Map_QM.util.meshMaterialArr.push(meshMaterial); - } - if (opObj.angleY || opObj.angleZ) { - Map_QM.util.rotateYZ(scanGeometry, opObj.angleY * Math.PI / 180, opObj.angleZ * Math.PI / 180); - } - // 创建模型 - let mesh; - if(opObj.map == "home"){ - Map_QM.util.assignUVs(scanGeometry); - let mapMaterial,ceMaterial; - for (let e = 0; e < Map_QM.util.meshMaterialArr.length; e++) { - if (Map_QM.util.meshMaterialArr[e].userData.map == "front" && Map_QM.util.meshMaterialArr[e].opacity == alphaModle) { - mapMaterial = Map_QM.util.meshMaterialArr[e]; - } - if (Map_QM.util.meshMaterialArr[e].userData.map == "c50" && Map_QM.util.meshMaterialArr[e].opacity == alphaModle) { - ceMaterial = Map_QM.util.meshMaterialArr[e]; - } - } - if(!mapMaterial){ - let texture = new THREE.TextureLoader().load(Map_QM.util.beforPath + "static/img/map/front.png"); - texture.wrapS = THREE.ClampToEdgeWrapping; - texture.wrapT = THREE.RepeatWrapping; - mapMaterial = new THREE.MeshPhongMaterial({ - color: entityColor, - map: texture, - transparent: true, - opacity: alphaModle, - side: THREE.DoubleSide, - depthTest: true - }); - mapMaterial.userData.map = "front"; - Map_QM.util.meshMaterialArr.push(mapMaterial); - } - if(!ceMaterial){ - let texture2 = new THREE.TextureLoader().load(Map_QM.util.beforPath + "static/img/map/c50.png"); - texture2.wrapS = THREE.RepeatWrapping; - texture2.wrapT = THREE.ClampToEdgeWrapping; - ceMaterial = new THREE.MeshPhongMaterial({ - color: entityColor, - map: texture2, - transparent: true, - opacity: alphaModle, - side: THREE.DoubleSide, - depthTest: true - }); - ceMaterial.userData.map = "c50"; - Map_QM.util.meshMaterialArr.push(ceMaterial); - } - mesh = new THREE.Mesh(scanGeometry, [meshMaterial,ceMaterial,mapMaterial]); - } else if(opObj.map){ - Map_QM.util.packUv(scanGeometry); - let ceMaterial; - for (let e = 0; e < Map_QM.util.meshMaterialArr.length; e++) { - if (Map_QM.util.meshMaterialArr[e].userData.map == opObj.map && Map_QM.util.meshMaterialArr[e].opacity == alphaModle) { - ceMaterial = Map_QM.util.meshMaterialArr[e]; - } - } - if(!ceMaterial){ - let texture2 = new THREE.TextureLoader().load(Map_QM.util.beforPath + "static/img/map/"+opObj.map+".png"); - texture2.wrapS = THREE.RepeatWrapping; - texture2.wrapT = THREE.ClampToEdgeWrapping; - ceMaterial = new THREE.MeshPhongMaterial({ - color: entityColor, - map: texture2, - transparent: true, - opacity: alphaModle, - side: THREE.DoubleSide, - depthTest: true - }); - ceMaterial.userData.map = opObj.map; - Map_QM.util.meshMaterialArr.push(ceMaterial); - } - mesh = new THREE.Mesh(scanGeometry, [meshMaterial,ceMaterial]); - }else{ - mesh = new THREE.Mesh(scanGeometry, meshMaterial); - } - - if (opObj.type != "wall") { - let cubeEdges = new THREE.EdgesGeometry(scanGeometry, 60); - let cubeLine = new THREE.LineSegments(cubeEdges, material); - cubeLine.renderOrder = indexOrder - 5; - mesh.add(cubeLine); - } - if (opObj.name != "floor") { - mesh.position.z = opObj.site || 0; - } else { - mesh.position.z = -1 * parseInt(opObj.toHeight) - 1; - } - mesh.castShadow = true; - mesh.renderOrder = indexOrder; - mesh.name = opObj.name || ""; - return mesh; -} + let scanGeometry, + meshMaterial, + options = { + depth: parseInt(opObj.toHeight), + bevelEnabled: false, + curveSegments: 12, + bevelThickness: 0, + bevelSize: 0, + bevelSegments: 0, + material: 0, //frontMaterial = green + extrudeMaterial: 1, //sideMaterial = gray + }; + + scanGeometry = new THREE.ExtrudeGeometry(shape, options); + let meshColor = new THREE.Color(entityColor); + for (let e = 0; e < Map_QM.util.meshMaterialArr.length; e++) { + if (Map_QM.util.meshMaterialArr[e].color && + Map_QM.util.meshMaterialArr[e].color.equals(meshColor) && + Map_QM.util.meshMaterialArr[e].opacity == alphaModle && + !Map_QM.util.meshMaterialArr[e].userData.map + ) { + meshMaterial = Map_QM.util.meshMaterialArr[e]; + } + } + if (!meshMaterial) { + meshMaterial = new THREE.MeshPhongMaterial({ + //MeshStandardMaterial MeshPhongMaterial MeshBasicMaterial + color: entityColor, + transparent: true, + opacity: alphaModle, + side: THREE.DoubleSide, + depthTest: true, + }); + Map_QM.util.meshMaterialArr.push(meshMaterial); + } + if (opObj.angleY || opObj.angleZ) { + Map_QM.util.rotateYZ(scanGeometry,(opObj.angleY * Math.PI) / 180,(opObj.angleZ * Math.PI) / 180); + } + // 创建模型 + let mesh; + if (opObj.map == "home") { + Map_QM.util.assignUVs(scanGeometry); + let mapMaterial, ceMaterial; + for (let e = 0; e < Map_QM.util.meshMaterialArr.length; e++) { + if (Map_QM.util.meshMaterialArr[e].userData.map == "front" && Map_QM.util.meshMaterialArr[e].opacity == alphaModle) { + mapMaterial = Map_QM.util.meshMaterialArr[e]; + } + if (Map_QM.util.meshMaterialArr[e].userData.map == "c50" && Map_QM.util.meshMaterialArr[e].opacity == alphaModle) { + ceMaterial = Map_QM.util.meshMaterialArr[e]; + } + } + if (!mapMaterial) { + let texture = new THREE.TextureLoader().load(Map_QM.util.beforPath + "static/img/map/front.png"); + texture.wrapS = THREE.ClampToEdgeWrapping; + texture.wrapT = THREE.RepeatWrapping; + mapMaterial = new THREE.MeshPhongMaterial({ + color: entityColor, + map: texture, + transparent: true, + opacity: alphaModle, + side: THREE.DoubleSide, + depthTest: true, + }); + mapMaterial.userData.map = "front"; + Map_QM.util.meshMaterialArr.push(mapMaterial); + } + if (!ceMaterial) { + let texture2 = new THREE.TextureLoader().load(Map_QM.util.beforPath + "static/img/map/c50.png"); + texture2.wrapS = THREE.RepeatWrapping; + texture2.wrapT = THREE.ClampToEdgeWrapping; + ceMaterial = new THREE.MeshPhongMaterial({ + color: entityColor, + map: texture2, + transparent: true, + opacity: alphaModle, + side: THREE.DoubleSide, + depthTest: true, + }); + ceMaterial.userData.map = "c50"; + Map_QM.util.meshMaterialArr.push(ceMaterial); + } + mesh = new THREE.Mesh(scanGeometry, [meshMaterial, ceMaterial, mapMaterial,]); + } else if (opObj.map) { + Map_QM.util.packUv(scanGeometry); + let ceMaterial; + for (let e = 0; e < Map_QM.util.meshMaterialArr.length; e++) { + if (Map_QM.util.meshMaterialArr[e].userData.map == opObj.map && Map_QM.util.meshMaterialArr[e].opacity == alphaModle) { + ceMaterial = Map_QM.util.meshMaterialArr[e]; + } + } + if (!ceMaterial) { + let texture2 = new THREE.TextureLoader().load(Map_QM.util.beforPath + "static/img/map/" + opObj.map + ".png"); + texture2.wrapS = THREE.RepeatWrapping; + texture2.wrapT = THREE.ClampToEdgeWrapping; + ceMaterial = new THREE.MeshPhongMaterial({ + color: entityColor, + map: texture2, + transparent: true, + opacity: alphaModle, + side: THREE.DoubleSide, + depthTest: true, + }); + ceMaterial.userData.map = opObj.map; + Map_QM.util.meshMaterialArr.push(ceMaterial); + } + mesh = new THREE.Mesh(scanGeometry, [meshMaterial, ceMaterial]); + } else { + mesh = new THREE.Mesh(scanGeometry, meshMaterial); + } + + if (opObj.type != "wall") { + let cubeEdges = new THREE.EdgesGeometry(scanGeometry, 60); + let cubeLine = new THREE.LineSegments(cubeEdges, material); + cubeLine.renderOrder = indexOrder - 5; + mesh.add(cubeLine); + } + if (opObj.name != "floor") { + mesh.position.z = opObj.site || 0; + } else { + mesh.position.z = -1 * parseInt(opObj.toHeight) - 1; + } + mesh.castShadow = true; + mesh.renderOrder = indexOrder; + mesh.name = opObj.name || ""; + return mesh; +}; //绘制平面 -MyModel_QM.prototype.MyPlaneShape = function (areaArr, howllowArr, opObj, entityColor = "#dadada", lineColor = "#eeeeee", indexOrder = 1) { - let len = areaArr.length; - if (len == 0) { - return; - } - let alphaModle = opObj.alphaModle / 100 || 0; - // 实例化shape对象 - let shape = new THREE.Shape(); - // 设置开始点的位置 - shape.moveTo(areaArr[0][0], -1 * areaArr[0][1]); - for (let i = 0; i < areaArr.length; i++) { - if (areaArr[i].length == 4) { - shape.lineTo(areaArr[i][2], -1 * areaArr[i][3]); - } else { - shape.bezierCurveTo(areaArr[i][2], -1 * areaArr[i][3], areaArr[i][4], -1 * areaArr[i][5], areaArr[i][6], -1 * areaArr[i][7]); - } - } - let material; - for (let k = 0; k < Map_QM.util.lineBasicMaterialArr.length; k++) { - let color2 = new THREE.Color(lineColor) - if (Map_QM.util.lineBasicMaterialArr[k].color.equals(color2)) { - material = Map_QM.util.lineBasicMaterialArr[k]; - } - } - if (!material) { - material = new THREE.LineBasicMaterial({ - color: lineColor, - opacity: 0.8, - transparent: true - }); //材质对象lineColor - Map_QM.util.lineBasicMaterialArr.push(material); - } - if (howllowArr && howllowArr.length > 0) { - for (let n = 0; n < howllowArr.length; n++) { - let hole = new THREE.Path(); // 添加孔洞 - hole.moveTo(howllowArr[n][0][0], -1 * howllowArr[n][0][1]); - for (let k = 0; k < howllowArr[n].length; k++) { - if (howllowArr[n][k].length == 4) { - hole.lineTo(howllowArr[n][k][2], -1 * howllowArr[n][k][3]); - } else { - hole.bezierCurveTo(howllowArr[n][k][2], -1 * howllowArr[n][k][3], howllowArr[n][k][4], -1 * howllowArr[n][k][5], howllowArr[n][k][6], -1 * howllowArr[n][k][7]); - } - } - shape.holes.push(hole); - } - } - let scanGeometry, meshMaterial; - scanGeometry = new THREE.ShapeGeometry(shape, 8); - Map_QM.util.assignUVs(scanGeometry); - if(opObj.map){ - let texture = new THREE.TextureLoader().load(Map_QM.util.beforPath + "static/img/map/" + opObj.map + ".png"); - meshMaterial = new THREE.MeshPhongMaterial({ //MeshStandardMaterial MeshPhongMaterial olor: entityColor, - color: entityColor, - map: texture, - transparent: true, - opacity: alphaModle, - side: THREE.DoubleSide, - depthTest: true - }); - meshMaterial.userData.map = opObj.map; - Map_QM.util.meshMaterialArr.push(meshMaterial); - }else{ - for (let e = 0; e < Map_QM.util.meshMaterialArr.length; e++) { - let color2 = new THREE.Color(entityColor); - if (Map_QM.util.meshMaterialArr[e].color && Map_QM.util.meshMaterialArr[e].color.equals(color2) && Map_QM.util.meshMaterialArr[e].opacity == alphaModle && !Map_QM.util.meshMaterialArr[e].userData.map) { - meshMaterial = Map_QM.util.meshMaterialArr[e]; - } - } - if (!meshMaterial) { - meshMaterial = new THREE.MeshPhongMaterial({ - color: entityColor, - transparent: true, - opacity: alphaModle, - side: THREE.DoubleSide, - depthTest: true - }); - Map_QM.util.meshMaterialArr.push(meshMaterial); - } - if (opObj.angleY || opObj.angleZ) { - Map_QM.util.rotateYZ(scanGeometry, opObj.angleY * Math.PI / 180, opObj.angleZ * Math.PI / 180); - } - } - // 创建模型 - let mesh = new THREE.Mesh(scanGeometry, meshMaterial); - - let cubeEdges = new THREE.EdgesGeometry(scanGeometry, 60); - let cubeLine = new THREE.LineSegments(cubeEdges, material); - cubeLine.renderOrder = indexOrder - 5; - mesh.add(cubeLine); - - if (opObj.name != "floor") { - mesh.position.z = parseInt(opObj.toHeight) || 0; - } - mesh.castShadow = true; - mesh.renderOrder = indexOrder; - mesh.name = opObj.name || ""; - return mesh; -} +MyModel_QM.prototype.MyPlaneShape = function (areaArr,howllowArr,opObj,entityColor = "#dadada",lineColor = "#eeeeee",indexOrder = 1) { + let len = areaArr.length; + if (len == 0) { + return; + } + let alphaModle = opObj.alphaModle / 100 || 0; + // 实例化shape对象 + let shape = new THREE.Shape(); + // 设置开始点的位置 + shape.moveTo(areaArr[0][0], -1 * areaArr[0][1]); + for (let i = 0; i < areaArr.length; i++) { + if (areaArr[i].length == 4) { + shape.lineTo(areaArr[i][2], -1*areaArr[i][3]); + } else { + shape.bezierCurveTo(areaArr[i][2], -1*areaArr[i][3], areaArr[i][4], -1*areaArr[i][5], areaArr[i][6], -1*areaArr[i][7]); + } + } + let material; + for (let k = 0; k < Map_QM.util.lineBasicMaterialArr.length; k++) { + let color2 = new THREE.Color(lineColor); + if (Map_QM.util.lineBasicMaterialArr[k].color.equals(color2)) { + material = Map_QM.util.lineBasicMaterialArr[k]; + } + } + if (!material) { + material = new THREE.LineBasicMaterial({ + color: lineColor, + opacity: 0.8, + transparent: true, + }); //材质对象lineColor + Map_QM.util.lineBasicMaterialArr.push(material); + } + if (howllowArr && howllowArr.length > 0) { + for (let n = 0; n < howllowArr.length; n++) { + let hole = new THREE.Path(); // 添加孔洞 + hole.moveTo(howllowArr[n][0][0], -1 * howllowArr[n][0][1]); + for (let k = 0; k < howllowArr[n].length; k++) { + if (howllowArr[n][k].length == 4) { + hole.lineTo(howllowArr[n][k][2], -1 * howllowArr[n][k][3]); + } else { + hole.bezierCurveTo(howllowArr[n][k][2], -1*howllowArr[n][k][3], howllowArr[n][k][4], -1*howllowArr[n][k][5], howllowArr[n][k][6], -1*howllowArr[n][k][7]); + } + } + shape.holes.push(hole); + } + } + let scanGeometry, meshMaterial; + scanGeometry = new THREE.ShapeGeometry(shape, 8); + Map_QM.util.assignUVs(scanGeometry); + if (opObj.map) { + let texture = new THREE.TextureLoader().load( + Map_QM.util.beforPath + "static/img/map/" + opObj.map + ".png" + ); + meshMaterial = new THREE.MeshPhongMaterial({ + //MeshStandardMaterial MeshPhongMaterial olor: entityColor, + color: entityColor, + map: texture, + transparent: true, + opacity: alphaModle, + side: THREE.DoubleSide, + depthTest: true, + }); + meshMaterial.userData.map = opObj.map; + Map_QM.util.meshMaterialArr.push(meshMaterial); + } else { + for (let e = 0; e < Map_QM.util.meshMaterialArr.length; e++) { + let color2 = new THREE.Color(entityColor); + if ( + Map_QM.util.meshMaterialArr[e].color && + Map_QM.util.meshMaterialArr[e].color.equals(color2) && + Map_QM.util.meshMaterialArr[e].opacity == alphaModle && + !Map_QM.util.meshMaterialArr[e].userData.map + ) { + meshMaterial = Map_QM.util.meshMaterialArr[e]; + } + } + if (!meshMaterial) { + meshMaterial = new THREE.MeshPhongMaterial({ + color: entityColor, + transparent: true, + opacity: alphaModle, + side: THREE.DoubleSide, + depthTest: true, + }); + Map_QM.util.meshMaterialArr.push(meshMaterial); + } + if (opObj.angleY || opObj.angleZ) { + Map_QM.util.rotateYZ( + scanGeometry, + (opObj.angleY * Math.PI) / 180, + (opObj.angleZ * Math.PI) / 180 + ); + } + } + // 创建模型 + let mesh = new THREE.Mesh(scanGeometry, meshMaterial); + + let cubeEdges = new THREE.EdgesGeometry(scanGeometry, 60); + let cubeLine = new THREE.LineSegments(cubeEdges, material); + cubeLine.renderOrder = indexOrder - 5; + mesh.add(cubeLine); + + if (opObj.name != "floor") { + mesh.position.z = parseInt(opObj.toHeight) || 0; + } + mesh.castShadow = true; + mesh.renderOrder = indexOrder; + mesh.name = opObj.name || ""; + return mesh; +}; MyModel_QM.prototype.MyModelText = function (svgArea) { + let text = svgArea.data; + const paths = new THREE.SVGLoader().parse(text).paths; + const group = new THREE.Group(); + + group.position.x = parseInt(svgArea.xaxis); + group.position.y = -1 * parseInt(svgArea.yaxis); + group.position.z = parseInt(svgArea.site || 0); + group.rotateX((parseInt(svgArea.angleZ) * Math.PI) / 180); + group.rotateY((parseInt(svgArea.angleY) * Math.PI) / 180); + group.rotateZ((parseInt(svgArea.angle) * Math.PI) / 180); + group.scale.multiplyScalar(svgArea.scale); + group.scale.y *= -1; + + let meshMaterial; + for (let e = 0; e < Map_QM.util.meshMaterialArr.length; e++) { + let color2 = new THREE.Color().setHex(svgArea.entColor); + if (Map_QM.util.meshMaterialArr[e].color && + Map_QM.util.meshMaterialArr[e].color.equals(color2) && + Map_QM.util.meshMaterialArr[e].opacity == svgArea.alphaModle + ) { + meshMaterial = Map_QM.util.meshMaterialArr[e]; + } + } + if (!meshMaterial) { + meshMaterial = new THREE.MeshStandardMaterial({ + color: svgArea.entColor, + opacity: parseInt(svgArea.alphaModle) / 100, + }); + Map_QM.util.meshMaterialArr.push(meshMaterial); + } - let text = svgArea.data; - const paths = new THREE.SVGLoader().parse(text).paths; - const group = new THREE.Group(); - - group.position.x = parseInt(svgArea.xaxis); - group.position.y = -1 * parseInt(svgArea.yaxis); - group.position.z = parseInt(svgArea.site || 0); - group.rotateX(parseInt(svgArea.angleZ) * Math.PI / 180); - group.rotateY(parseInt(svgArea.angleY) * Math.PI / 180); - group.rotateZ(parseInt(svgArea.angle) * Math.PI / 180); - group.scale.multiplyScalar(svgArea.scale); - group.scale.y *= -1; - - let meshMaterial; - for (let e = 0; e < Map_QM.util.meshMaterialArr.length; e++) { - let color2 = new THREE.Color().setHex(svgArea.entColor); - if (Map_QM.util.meshMaterialArr[e].color && Map_QM.util.meshMaterialArr[e].color.equals(color2) && Map_QM.util.meshMaterialArr[e].opacity == svgArea.alphaModle) { - meshMaterial = Map_QM.util.meshMaterialArr[e]; - } - } - if (!meshMaterial) { - meshMaterial = new THREE.MeshStandardMaterial({ - color: svgArea.entColor, - opacity: parseInt(svgArea.alphaModle) / 100 - }); - Map_QM.util.meshMaterialArr.push(meshMaterial); - } - - for (let i = 0; i < paths.length; i++) { - const path = paths[i]; - let shapes = path.toShapes(true); - const geometry = new THREE.ShapeGeometry(shapes, 12); - const mesh = new THREE.Mesh(geometry, meshMaterial); - mesh.renderOrder = 50; - mesh.name = svgArea.name || ""; - mesh.position.set(svgArea.width / -2, svgArea.height / -2, parseInt(svgArea.toHeight)+1); - group.add(mesh); - } - return group; -} + for (let i = 0; i < paths.length; i++) { + const path = paths[i]; + let shapes = path.toShapes(true); + const geometry = new THREE.ShapeGeometry(shapes, 36); + const mesh = new THREE.Mesh(geometry, meshMaterial); + mesh.renderOrder = 50; + mesh.name = svgArea.name || ""; + mesh.position.set( svgArea.width / -2, svgArea.height / -2, parseInt(svgArea.toHeight) + 1); + group.add(mesh); + } + return group; +}; /** * 公共设施 */ -MySprite_QM = function (spriteMaterial, obj = null) { - THREE.Sprite.call(this) +var MySprite_QM = function (spriteMaterial, obj = null) { + THREE.Sprite.call(this); if (obj) { - this.navCode = obj.navCode - this.no = obj.no - this.facCode = obj.facCode - this.floor = obj.floorOrder - this.build = obj.buildOrder - this.site = parseInt(obj.site) || Map_QM.util.shopHeight + 32 + this.navCode = obj.navCode; + this.no = obj.no; + this.facCode = obj.facCode; + this.floor = obj.floorOrder; + this.build = obj.buildOrder; + this.site = parseInt(obj.site) || Map_QM.util.shopHeight + 32; } - this.imgUrl - this.material = spriteMaterial !== undefined ? spriteMaterial : new SpriteMaterial() + this.imgUrl; + this.material = spriteMaterial !== undefined ? spriteMaterial : new SpriteMaterial(); //图标跳动 this.jumpIcon = function () { - let oldZ = this.site - let self = this - TweenMax.fromTo( - self.position, - 0.5, - { z: oldZ }, - { - z: oldZ + 20, - repeat: 1, + let oldZ = this.site; + let self = this; + TweenMax.fromTo(self.position, 0.5, { z: oldZ }, {z: oldZ + 20, repeat: 1, onComplete: function () { - TweenMax.to(self.position, 0.2, { z: oldZ }) - } + TweenMax.to(self.position, 0.2, { z: oldZ }); + }, } - ) - } + ); + }; this.reSetSite = function () { //重置位置 - this.position.z = this.site - } -} + this.position.z = this.site; + }; +}; -MySprite_QM.prototype = Object.create(THREE.Sprite.prototype) -MySprite_QM.prototype.constructor = MySprite_QM +MySprite_QM.prototype = Object.create(THREE.Sprite.prototype); +MySprite_QM.prototype.constructor = MySprite_QM; /** * 渲染公共设施 */ - Facilities_QM = function () { - this.renderIcon = function (obj, _this, isShow = true, ele = null) { - if (obj) { - let url = Map_QM.util.beforPath + "static/img/" + obj.facCode + ".png"; - let name = obj.title; - let nameEn = obj.title; - if (Map_QM.util.iconUrl.length > 0) { //使用设施库 - for (let i = 0; i < Map_QM.util.iconUrl.length; i++) { - if (Map_QM.util.iconUrl[i].abbreviation == obj.facCode) { - url = Map_QM.util.iconUrl[i].navFilePath - name = Map_QM.util.iconUrl[i].name; - nameEn = Map_QM.util.iconUrl[i].nameEn; - } - } - } - let shopDiv = document.createElement('img'); - shopDiv.src = url; - shopDiv.style.zIndex = 200; - shopDiv.style.width = "1.2vw"; - shopDiv.style.display = isShow?"":"none"; - let shopLabel = new THREE.CSS2DObject(shopDiv); - shopLabel.userData.mapShow = true; //是否永久显示 - shopLabel.userData = obj; - shopLabel.userData.type = "icon"; - shopLabel.userData.use = ele ? "2d" : "all"; - shopLabel.userData.model = ele; - shopLabel.userData.src = url; - shopLabel.userData.isShow = true; - - shopLabel.position.set(obj.x, -1 * obj.y, Math.max(30, parseInt(obj.site) || 0)); - _this.serObj.add(shopLabel); - - if (Map_QM.util.options.iconName) { - let shopDiv = document.createElement('div'); - shopDiv.style.cssText = css_LR - if(window.innerWidth>2000){ - shopDiv.style.height = "20px"; - shopDiv.style.fontSize = "18px"; - } - shopDiv.innerText = obj.title; - shopDiv.dataset.name = name; - shopDiv.dataset.nameEn = nameEn; - let shopLabel = new THREE.CSS2DObject(shopDiv); - shopLabel.position.set(obj.x, -1 * obj.y, 30); - shopLabel.userData.mapShow = true; - _this.labelObj.add(shopLabel); - } - } - } -} +var Facilities_QM = function () { + this.renderIcon = function (obj, _this, isShow = true, ele = null) { + if (obj) { + let url = Map_QM.util.beforPath + "static/img/" + obj.facCode + ".png"; + let name = obj.title; + let nameEn = obj.title; + if (Map_QM.util.iconUrl.length > 0) { + //使用设施库 + for (let i = 0; i < Map_QM.util.iconUrl.length; i++) { + if (Map_QM.util.iconUrl[i].abbreviation == obj.facCode) { + url = Map_QM.util.beforPath+"static/offline/"+Map_QM.util.iconUrl[i].filePath; + name = Map_QM.util.iconUrl[i].name; + nameEn = Map_QM.util.iconUrl[i].nameEn; + } + } + } + let shopDiv = document.createElement("img"); + shopDiv.src = url; + shopDiv.style.zIndex = 100; + shopDiv.style.width = "1.2vw"; + shopDiv.style.display = isShow ? "" : "none"; + shopDiv.dataset.name = name; + shopDiv.dataset.src = url; + shopDiv.dataset.nameEn = nameEn; + shopDiv.dataset.buildOrder = obj.buildOrder; + shopDiv.dataset.floorOrder = obj.floorOrder; + shopDiv.dataset.facCode = obj.facCode; + shopDiv.dataset.node = obj.navCode; + + shopDiv.addEventListener("click", (event) => { + /** + * @api {事件} icon 点击设施图标 + * @apiGroup 地图事件 + * @apiDescription 用户点击设施图标后触发自定义事件 + * @apiVersion 4.0.0 + * @apiSampleRequest off + * + * @apiParamExample 请求示例 + * Map_QM.addEventListener("icon",onClickIcon,false); + */ + Map_QM.dispatchEvent({ + type: "icon", + data: { + buildOrder: event.target.dataset.buildOrder, + floorOrder: event.target.dataset.floorOrder, + node: event.target.dataset.node, + src: event.target.dataset.src, + facCode: event.target.dataset.facCode, + title: event.target.dataset.name, + }, + }); + }); + let shopLabel = new THREE.CSS2DObject(shopDiv); + shopLabel.userData.mapShow = true; //是否永久显示 + shopLabel.userData = obj; + shopLabel.userData.type = "icon"; + shopLabel.userData.use = ele ? "2d" : "all"; + shopLabel.userData.model = ele; + shopLabel.userData.src = url; + shopLabel.userData.isShow = true; + shopLabel.position.set(obj.x, -1*obj.y, Math.max(30, parseInt(obj.site) || 0)); + _this.serObj.add(shopLabel); + + if (Map_QM.util.options.iconName) { + let titleDiv = document.createElement("div"); + titleDiv.style.cssText = css_LR; + if (window.innerWidth > 2000) { + titleDiv.style.fontSize = "18px"; + } + titleDiv.innerText = obj.title; + titleDiv.dataset.name = name; + titleDiv.dataset.nameEn = nameEn; + titleDiv.style.zIndex = 480; + let shopLabel = new THREE.CSS2DObject(titleDiv); + shopLabel.position.set(obj.x, -1 * obj.y, parseInt(obj.site) + 85); + shopLabel.userData.mapShow = true; + shopLabel.userData.isShow = true; + _this.labelObj.add(shopLabel); + } + } + }; +}; /** * 店铺LOGO地图展示类 */ -ShopLogo_QM = function () { +var ShopLogo_QM = function () { this.renderIcon = function (obj, _this, z) { if (obj) { - let x = obj.xaxis >> 0 - let y = (-1 * obj.yaxis) >> 0 - let imgW = obj.imgW >> 0 - let imgH = obj.imgH >> 0 + let x = obj.xaxis >> 0; + let y = (-1 * obj.yaxis) >> 0; + let imgW = obj.imgW >> 0; + let imgH = obj.imgH >> 0; - new THREE.TextureLoader().load(obj.logoUrl, textu => { + new THREE.TextureLoader().load(obj.logoUrl, (textu) => { let planeMaterial = new THREE.MeshPhongMaterial({ map: textu, depthTest: true, transparent: true, - alphaTest:0.01 - }) - let planeGeometry = new THREE.PlaneGeometry(imgW, imgH) - let plane = new THREE.Mesh(planeGeometry, planeMaterial) - plane.center = new THREE.Vector2(0, 0) - plane.position.set(x, y, obj.site || z) - plane.userData.rot = 0 - plane.userData.type = 'logo' - plane.renderOrder = 70 - _this.add(plane) - }) + alphaTest: 0.01, + }); + let planeGeometry = new THREE.PlaneGeometry(imgW, imgH); + let plane = new THREE.Mesh(planeGeometry, planeMaterial); + plane.center = new THREE.Vector2(0, 0); + plane.position.set(x, y, obj.site || z); + plane.userData.rot = 0; + plane.userData.type = "logo"; + plane.renderOrder = 70; + _this.add(plane); + }); } - } -} - -var _selfFindPath -FindPath_QM = function () { - this.pathArr = [] - this.lineDashed_old + }; +}; + +var _selfFindPath; +var FindPath_QM = function () { + this.pathArr = []; + this.lineDashed; + this.lineDashed_old; //路线指引箭头皮肤 - this.planeGeometry = new THREE.PlaneGeometry(128, 128) - this.stop = null - this._index = 0 //寻路用 - this.pathState = 'init' + this.planeGeometry = new THREE.PlaneGeometry(128, 128); + this.morePath = false; + this.stop = null; + this._index = 0; //寻路用 + this.pathState = "init"; this.pathPlay = { _isPlay: false, get isPlay() { - return this._isPlay + return this._isPlay; }, set isPlay(val) { - this._isPlay = val + this._isPlay = val; if (_selfFindPath && _selfFindPath.stop) { - window.cancelAnimationFrame(_selfFindPath.stop) - _selfFindPath.stop = null + window.cancelAnimationFrame(_selfFindPath.stop); + _selfFindPath.stop = null; } - if (_selfFindPath && _selfFindPath.pathState == 'isPlay' && _selfFindPath._index < _selfFindPath.pathArr.length) { - _selfFindPath.playMoveGuide() + if (_selfFindPath && _selfFindPath.pathState == "isPlay" && _selfFindPath._index < _selfFindPath.pathArr.length) { + _selfFindPath.playMoveGuide(); } - } - } -} + }, + }; +}; FindPath_QM.prototype.clearPath = function () { - this.pathArr = [] + this.pathArr = []; + if (this.lineDashed) { + if (Map_QM.mapArr[Map_QM.util.selectBuild][Map_QM.util.selectFloor]) { + Map_QM.mapArr[Map_QM.util.selectBuild][Map_QM.util.selectFloor].allObj.remove(this.lineDashed); + } + this.lineDashed.destroy(); + this.lineDashed = null; + } if (this.lineDashed_old) { if (Map_QM.mapArr[Map_QM.util.selectBuild][Map_QM.util.selectFloor]) { - Map_QM.mapArr[Map_QM.util.selectBuild][Map_QM.util.selectFloor].allObj.remove(this.lineDashed_old) + Map_QM.mapArr[Map_QM.util.selectBuild][Map_QM.util.selectFloor].allObj.remove(this.lineDashed_old); } - this.lineDashed_old.destroy() - this.lineDashed_old = null + this.lineDashed_old.destroy(); + this.lineDashed_old = null; } if (Map_QM.guide) { - Map_QM.guide.visible = false + Map_QM.guide.visible = false; if (Map_QM.mapArr[Map_QM.util.selectBuild][Map_QM.util.selectFloor]) { - Map_QM.mapArr[Map_QM.util.selectBuild][Map_QM.util.selectFloor].allObj.remove(Map_QM.man_2d) - Map_QM.mapArr[Map_QM.util.selectBuild][Map_QM.util.selectFloor].allObj.remove(Map_QM.man_3d) + Map_QM.mapArr[Map_QM.util.selectBuild][Map_QM.util.selectFloor].allObj.remove(Map_QM.man_2d); + Map_QM.mapArr[Map_QM.util.selectBuild][Map_QM.util.selectFloor].allObj.remove(Map_QM.man_3d); } } if (_selfFindPath && _selfFindPath.stop) { - window.cancelAnimationFrame(_selfFindPath.stop) + window.cancelAnimationFrame(_selfFindPath.stop); } - this._index = 0 - this.pathState = 'init' -} + this._index = 0; + this.pathState = "init"; +}; /** * @param {Object} startNade * @param {Object} toNade * @param {Object} callBack 回调函数 */ -FindPath_QM.prototype.onFindPathAnimation = function (pathArray, floorOrder = -1) { +FindPath_QM.prototype.onFindPathAnimation = function (pathArray,morePath = false,floorOrder = -1) { + this.morePath = morePath; if (pathArray && pathArray.length > 0) { - this.pathArr = [] - for (let j = 0; j < pathArray.length; j++) { - this.pathArr.push(pathArray[j]) - } - this.pathState = 'isPlay' - this._index = 0 + this.pathState = "isPlay"; + this._index = 0; + this.pathArr = []; if (floorOrder === -1) { - floorOrder = Map_QM.util.selectFloor + floorOrder = Map_QM.util.selectFloor; + } + if (morePath) { + for (let j = 0; j < pathArray.length; j++) { + this.drawPath(floorOrder,pathArray[j], parseInt(Map_QM.util.buildHeight) + j); + } + } else { + for (let j = 0; j < pathArray.length; j++) { + this.pathArr.push(pathArray[j]); + } + this.drawPath(floorOrder); } - this.drawPath(floorOrder) } -} - -FindPath_QM.prototype.drawPath = function (floorOrder) { - let linePath = [] - for (let i = 0; i < this.pathArr.length; i++) { - if (i < this.pathArr.length) { - linePath.push([this.pathArr[i].x, -1 * this.pathArr[i].y]) +}; + +FindPath_QM.prototype.drawPath = function (floorOrder, pathArr = null, height = 1) { + let linePath = []; + if (!pathArr) { + for (let i = 0; i < this.pathArr.length; i++) { + if (i < this.pathArr.length) { + linePath.push([this.pathArr[i].x, -1 * this.pathArr[i].y]); + } + } + } else { + for (let i = 0; i < pathArr.length; i++) { + if (i < pathArr.length) { + linePath.push([pathArr[i].x, -1 * pathArr[i].y]); + } } } - this.lineDashed_old = new PathLine(12, linePath, parseInt(Map_QM.util.buildHeight) + 1, Map_QM.util.options.pathColor, Map_QM.util.options.pathColor2, true) - this.lineDashed_old.name = 'lineDash' - this.lineDashed_old.renderOrder = 128 - Map_QM.mapArr[Map_QM.util.selectBuild][floorOrder].allObj.add(this.lineDashed_old) - - //////////////////////////////////////////////////////// -} - - - + if (this.morePath) { + this.lineDashed_old = new PathLine(12,linePath,height,Map_QM.util.options.pathColor,Map_QM.util.options.pathColor2,true); + } else { + this.lineDashed_old = new PathLine(12,linePath,parseInt(Map_QM.util.buildHeight) + 1,Map_QM.util.options.pathColor,Map_QM.util.options.pathColor2,true); + } + this.lineDashed_old.name = "lineDash"; + this.lineDashed_old.renderOrder = 128; + Map_QM.mapArr[Map_QM.util.selectBuild][floorOrder].allObj.add(this.lineDashed_old); +}; FindPath_QM.prototype.guidePathPlay = function (paths) { if (Map_QM.guide) { - Map_QM.guide.renderOrder = 99 + Map_QM.guide.renderOrder = 99; if (paths.PathPoint) { - Map_QM.guide.position.x = paths.PathPoint[0].x - Map_QM.guide.position.y = -1 * paths.PathPoint[0].y - Map_QM.moveCameraBy2D(paths.PathPoint[0]) - Map_QM.man_2d.position.z = parseInt(Map_QM.util.buildHeight) + 120 - Map_QM.man_3d.position.z = parseInt(Map_QM.util.buildHeight) + 5 - Map_QM.guide.visible = true - Map_QM.mapArr[Map_QM.util.selectBuild][paths.floor].allObj.add(Map_QM.man_2d) - Map_QM.mapArr[Map_QM.util.selectBuild][paths.floor].allObj.add(Map_QM.man_3d) + Map_QM.guide.position.x = paths.PathPoint[0].x; + Map_QM.guide.position.y = -1 * paths.PathPoint[0].y; + Map_QM.moveCameraBy2D(paths.PathPoint[0]); + Map_QM.man_2d.position.z = parseInt(Map_QM.util.buildHeight) + 120; + Map_QM.man_3d.position.z = parseInt(Map_QM.util.buildHeight) + 5; + Map_QM.guide.visible = true; + Map_QM.mapArr[Map_QM.util.selectBuild][paths.floor].allObj.add(Map_QM.man_2d); + Map_QM.mapArr[Map_QM.util.selectBuild][paths.floor].allObj.add(Map_QM.man_3d); } } - this.pathArr = paths.PathPoint - _selfFindPath = this + this.pathArr = paths.PathPoint; + _selfFindPath = this; if (Map_QM.util.pathStateObj.isPathPlay) { - this.pathPlay.isPlay = true + this.pathPlay.isPlay = true; } -} +}; /** * 播放图标指引动画 */ FindPath_QM.prototype.playMoveGuide = function () { if (!Map_QM.guide) { - return + return; } - let px = Map_QM.guide.position.x - let py = Map_QM.guide.position.y - let targetX = _selfFindPath.pathArr[_selfFindPath._index].x - px - let targetY = -1 * _selfFindPath.pathArr[_selfFindPath._index].y - py - let dist = Math.sqrt(targetX * targetX + targetY * targetY) - let df = Math.ceil(dist / Map_QM.util.options.playSpeed) - let dx = (_selfFindPath.pathArr[_selfFindPath._index].x - px) / df - let dy = (-1 * _selfFindPath.pathArr[_selfFindPath._index].y - py) / df - let ang = 0 + let px = Map_QM.guide.position.x; + let py = Map_QM.guide.position.y; + let targetX = _selfFindPath.pathArr[_selfFindPath._index].x - px; + let targetY = -1 * _selfFindPath.pathArr[_selfFindPath._index].y - py; + let dist = Math.sqrt(targetX * targetX + targetY * targetY); + let df = Math.ceil(dist / (Map_QM.util.options.playSpeed * Map_QM.util.options.speedMult)); + let dx = (_selfFindPath.pathArr[_selfFindPath._index].x - px) / df; + let dy = (-1 * _selfFindPath.pathArr[_selfFindPath._index].y - py) / df; + let ang = 0; if (df < 2) { - Map_QM.guide.position.x = _selfFindPath.pathArr[_selfFindPath._index].x - Map_QM.guide.position.y = -1 * _selfFindPath.pathArr[_selfFindPath._index].y - Map_QM.moveCameraBy2D({ x: _selfFindPath.pathArr[_selfFindPath._index].x, y: _selfFindPath.pathArr[_selfFindPath._index].y }) - - _selfFindPath._index++ + Map_QM.guide.position.x = _selfFindPath.pathArr[_selfFindPath._index].x; + Map_QM.guide.position.y = -1 * _selfFindPath.pathArr[_selfFindPath._index].y; + Map_QM.moveCameraBy2D({x: _selfFindPath.pathArr[_selfFindPath._index].x, y: _selfFindPath.pathArr[_selfFindPath._index].y }); + _selfFindPath._index++; if (_selfFindPath._index > 0 && _selfFindPath._index < _selfFindPath.pathArr.length) { - Map_QM.man_3d.rotation.z = Map_QM.man_2d.rotation.z = 0 //180; + Map_QM.man_3d.rotation.z = Map_QM.man_2d.rotation.z = 0; //180; let s = Math.sqrt( (_selfFindPath.pathArr[_selfFindPath._index].x - _selfFindPath.pathArr[_selfFindPath._index - 1].x) * - (_selfFindPath.pathArr[_selfFindPath._index].x - _selfFindPath.pathArr[_selfFindPath._index - 1].x) + - (_selfFindPath.pathArr[_selfFindPath._index].y - _selfFindPath.pathArr[_selfFindPath._index - 1].y) * - (_selfFindPath.pathArr[_selfFindPath._index].y - _selfFindPath.pathArr[_selfFindPath._index - 1].y) - ) - ang = Math.acos((_selfFindPath.pathArr[_selfFindPath._index].y - _selfFindPath.pathArr[_selfFindPath._index - 1].y) / s) - if (_selfFindPath.pathArr[_selfFindPath._index].x < _selfFindPath.pathArr[_selfFindPath._index - 1].x) { - Map_QM.man_3d.rotation.z = Map_QM.man_2d.rotation.z = Math.PI - ang + (_selfFindPath.pathArr[_selfFindPath._index].x - _selfFindPath.pathArr[_selfFindPath._index - 1].x) + + (_selfFindPath.pathArr[_selfFindPath._index].y - _selfFindPath.pathArr[_selfFindPath._index - 1].y) * + (_selfFindPath.pathArr[_selfFindPath._index].y - _selfFindPath.pathArr[_selfFindPath._index - 1].y) + ); + ang = Math.acos((_selfFindPath.pathArr[_selfFindPath._index].y - _selfFindPath.pathArr[_selfFindPath._index - 1].y) /s); + if ( _selfFindPath.pathArr[_selfFindPath._index].x < _selfFindPath.pathArr[_selfFindPath._index - 1].x) { + Map_QM.man_3d.rotation.z = Map_QM.man_2d.rotation.z = Math.PI - ang; } else { - Map_QM.man_3d.rotation.z = Map_QM.man_2d.rotation.z = Math.PI + ang + Map_QM.man_3d.rotation.z = Map_QM.man_2d.rotation.z = Math.PI + ang; } } - let pathShop = '' + let pathShop = ""; for (let t = 0; t < Map_QM.forShopArr[Map_QM.util._indexPathFloor].wayShop.length; t++) { - if (Map_QM.forShopArr[Map_QM.util._indexPathFloor].wayShop[t].pathIndex == _selfFindPath._index) { - let shop_ = Map_QM.forShopArr[Map_QM.util._indexPathFloor].wayShop[t].shop - pathShop = shop_.houseNumber - let shops = Map_QM.mapArr[Map_QM.util.selectBuild][parseInt(Map_QM.forShopArr[Map_QM.util._indexPathFloor].wayShop[t].shop.floorOrder)].allObj.children + if (Map_QM.forShopArr[Map_QM.util._indexPathFloor].wayShop[t].pathIndex ==_selfFindPath._index) { + let shop_ = Map_QM.forShopArr[Map_QM.util._indexPathFloor].wayShop[t].shop; + pathShop = shop_.houseNumber; + let shops = Map_QM.mapArr[Map_QM.util.selectBuild][parseInt(Map_QM.forShopArr[Map_QM.util._indexPathFloor].wayShop[t].shop.floorOrder)].shopObj.children; for (let i = 0; i < shops.length; i++) { - let _shop = shops[i].userData.shopData - if (_shop && _shop.houseNumber === pathShop) { - let shopModel = shops[i] - let material = shopModel.material - shopModel.material = new THREE.MeshBasicMaterial({ color: Map_QM.util.options.navColor }) - TweenMax.to(shopModel.scale, 0.8, { - z: 3, - yoyo: true, - ease: Cubic.easeIn, + let _shop = shops[i].userData.shopData; + if (_shop && _shop.houseNumber == pathShop) { + let shopModel = shops[i]; + let material = shopModel.material; + shopModel.material = new THREE.MeshBasicMaterial({ + color: Map_QM.util.options.navColor, + }); + TweenMax.to(shopModel.scale, 0.8, { z: 3, yoyo: true, ease: Cubic.easeIn, onComplete: function () { if (shopModel) { - TweenMax.to(shopModel.scale, 0.5, { z: 1 }) - shopModel.material = material + TweenMax.to(shopModel.scale, 0.5, { z: 1 }); + shopModel.material = material; } - } - }) - break + }, + }); + break; } } - break + break; } } Map_QM.dispatchEvent({ //寻路中返回小人当前所在点位 - type: 'PathPlaying', - data: { shopNum: pathShop } - }) + type: "PathPlaying", + data: { houseNumber: pathShop }, + }); } else { - px += dx - py += dy - Map_QM.guide.position.x = px - Map_QM.guide.position.y = py - Map_QM.moveCameraBy2D({ x: px, y: -1 * py }) + px += dx; + py += dy; + Map_QM.guide.position.x = px; + Map_QM.guide.position.y = py; + Map_QM.moveCameraBy2D({ x: px, y: -1 * py }); } if (_selfFindPath.pathPlay.isPlay && Map_QM.guide) { if (_selfFindPath._index < _selfFindPath.pathArr.length) { - _selfFindPath.stop = requestAnimationFrame(_selfFindPath.playMoveGuide) + _selfFindPath.stop = requestAnimationFrame(_selfFindPath.playMoveGuide); } else { if (_selfFindPath && _selfFindPath.stop) { - window.cancelAnimationFrame(_selfFindPath.stop) - _selfFindPath.stop = null + window.cancelAnimationFrame(_selfFindPath.stop); + _selfFindPath.stop = null; } - _selfFindPath._index = 0 + _selfFindPath._index = 0; if (Map_QM.guide) { - Map_QM.guide.visible = false + Map_QM.guide.visible = false; } - let myEvent = new CustomEvent('pathOver', { - detail: { dx: dx, dy: dy } - }) - document.dispatchEvent(myEvent) //触发导航完成事件 - _selfFindPath.pathState = 'pathOver' + let myEvent = new CustomEvent("pathOver", { + detail: { dx: dx, dy: dy }, + }); + document.dispatchEvent(myEvent); //触发导航完成事件 + _selfFindPath.pathState = "pathOver"; } } -} +}; diff --git a/public/static/qm/three.js b/public/static/qm/three.js index e29f597..3828f85 100644 --- a/public/static/qm/three.js +++ b/public/static/qm/three.js @@ -31593,97 +31593,124 @@ */ THREE.CSS2DObject = function ( element ) { THREE.Object3D.call( this ); + this.isCSS2DObject = true; this.element = element; this.element.style.position = 'absolute'; + this.element.style.userSelect = 'none'; }; THREE.CSS2DObject.prototype = Object.create( THREE.Object3D.prototype ); THREE.CSS2DObject.prototype.constructor = THREE.CSS2DObject; + // THREE.CSS2DRenderer = function () { - //console.log( 'THREE.CSS2DRenderer', THREE.REVISION ); - var _width, _height; - var _widthHalf, _heightHalf; - var perc_H = "-50%"; //自定义横向和纵向移动百分比 - var vector = new THREE.Vector3(); - var viewMatrix = new THREE.Matrix4(); - var viewProjectionMatrix = new THREE.Matrix4(); - var cache = { - objects: new WeakMap() - }; - var domElement = document.createElement( 'div' ); - domElement.style.overflow = 'hidden'; - this.domElement = domElement; - this.getSize = function () { - return { - width: _width, - height: _height - }; - }; - this.setSize = function ( width, height,perc_h="-50%") { - _width = width; - _height = height; - perc_H = perc_h; - _widthHalf = _width / 2; - _heightHalf = _height / 2; - domElement.style.width = width + 'px'; - domElement.style.height = height + 'px'; - }; - this.renderObject = function ( object, camera ) { - if ( object instanceof THREE.CSS2DObject) { - vector.setFromMatrixPosition( object.matrixWorld ); - vector.applyMatrix4( viewProjectionMatrix ); - var element = object.element; - var style = 'translate('+perc_H+',-100%) translate(' + ( vector.x * _widthHalf + _widthHalf ) + 'px,' + ( - vector.y * _heightHalf + _heightHalf ) + 'px)'; - element.style.WebkitTransform = style; - element.style.MozTransform = style; - element.style.oTransform = style; - element.style.transform = style; - var objectData = { - distanceToCameraSquared: getDistanceToSquared( camera, object ) + const _vector = new THREE.Vector3(); + const _viewMatrix = new THREE.Matrix4(); + const _viewProjectionMatrix = new THREE.Matrix4(); + const _a = new THREE.Vector3(); + const _b = new THREE.Vector3(); + const _this = this; + let _width, _height; + let _widthHalf, _heightHalf; + let perc_H = "-50%"; //自定义横向和纵向移动百分比 + var cache = { + objects: new WeakMap() + }; + const domElement = document.createElement( 'div' ); + domElement.style.overflow = 'hidden'; + this.domElement = domElement; + this.getSize = function () { + return { + width: _width, + height: _height }; - cache.objects.set( object, objectData ); - if ( element.parentNode !== domElement ) { - domElement.appendChild( element ); + }; + this.setSize = function ( width, height,perc_h="-50%") { + _width = width; + _height = height; + perc_H = perc_h; + _widthHalf = _width / 2; + _heightHalf = _height / 2; + domElement.style.width = width + 'px'; + domElement.style.height = height + 'px'; + }; + + this.render = function ( scene, camera ) { + if ( scene.matrixWorldAutoUpdate === true ) scene.updateMatrixWorld(); + if ( camera.parent === null && camera.matrixWorldAutoUpdate === true ) camera.updateMatrixWorld(); + _viewMatrix.copy( camera.matrixWorldInverse ); + _viewProjectionMatrix.multiplyMatrices( camera.projectionMatrix, _viewMatrix ); + //renderObject( scene, scene, camera ); + //zOrder( scene ); + }; + + function hideObject( object ) { + if ( object.isCSS2DObject ) object.element.style.display = 'none'; + for ( let i = 0, l = object.children.length; i < l; i ++ ) { + hideObject( object.children[ i ] ); } } - for ( var i = 0, l = object.children.length; i < l; i ++ ) { - this.renderObject( object.children[ i ], camera ); + + this.renderObject = function( object, scene, camera ) { + if ( object.visible === false ) { + hideObject( object ); + return; + } + if ( object.isCSS2DObject ) { + _vector.setFromMatrixPosition( object.matrixWorld ); + _vector.applyMatrix4( _viewProjectionMatrix ); + const visible = ( _vector.z >= - 1 && _vector.z <= 1 ) ; + const element = object.element; + //element.style.display = visible === true ? '' : 'none'; + + if ( visible === true ) { + object.onBeforeRender( _this, scene, camera ); + let style = 'translate('+perc_H+',-100%) translate(' + ( _vector.x * _widthHalf + _widthHalf ) + 'px,' + ( - _vector.y * _heightHalf + _heightHalf ) + 'px)'; + element.style.transform = style; + if ( element.parentNode !== domElement ) { + domElement.appendChild( element ); + } + object.onAfterRender( _this, scene, camera ); + } + const objectData = { + distanceToCameraSquared: getDistanceToSquared( camera, object ) + }; + cache.objects.set( object, objectData ); + } + for ( let i = 0, l = object.children.length; i < l; i ++ ) { + this.renderObject( object.children[ i ], scene, camera ); + } } - }; - var getDistanceToSquared = function () { - var a = new THREE.Vector3(); - var b = new THREE.Vector3(); - return function ( object1, object2 ) { - a.setFromMatrixPosition( object1.matrixWorld ); - b.setFromMatrixPosition( object2.matrixWorld ); - return a.distanceToSquared( b ); - }; - }(); - var filterAndFlatten = function ( scene ) { - var result = []; - scene.traverse( function ( object ) { - if ( object instanceof THREE.CSS2DObject ) result.push( object ); - } ); - return result; - }; - this.zOrder = function ( scene ) { - var sorted = filterAndFlatten( scene ).sort( function ( a, b ) { - var distanceA = cache.objects.get( a ).distanceToCameraSquared; - var distanceB = cache.objects.get( b ).distanceToCameraSquared; - return distanceA - distanceB; - } ); - var zMax = sorted.length; - for ( var i = 0, l = sorted.length; i < l; i ++ ) { - sorted[ i ].element.style.zIndex = sorted[ i ].element.style.zIndex || zMax - i; + + function getDistanceToSquared( object1, object2 ) { + _a.setFromMatrixPosition( object1.matrixWorld ); + _b.setFromMatrixPosition( object2.matrixWorld ); + return _a.distanceToSquared( _b ); } - }; - this.render = function ( scene, camera ) { - scene.updateMatrixWorld(); - if ( camera.parent === null ) camera.updateMatrixWorld(); - viewMatrix.copy( camera.matrixWorldInverse ); - viewProjectionMatrix.multiplyMatrices( camera.projectionMatrix, viewMatrix ); - }; -}; + + function filterAndFlatten( scene ) { + const result = []; + scene.traverseVisible( function ( object ) { + if ( object.isCSS2DObject ) result.push( object ); + } ); + return result; + } + + this.zOrder = function ( scene ) { + const sorted = filterAndFlatten( scene ).sort( function ( a, b ) { + if ( a.renderOrder !== b.renderOrder ) { + return b.renderOrder - a.renderOrder; + } + const distanceA = cache.objects.get( a ).distanceToCameraSquared; + const distanceB = cache.objects.get( b ).distanceToCameraSquared; + return distanceA - distanceB; + } ); + const zMax = sorted.length; + for ( let i = 0, l = sorted.length; i < l; i ++ ) { + sorted[ i ].element.style.zIndex = zMax - i; + } + } + } + THREE.GLTFLoader = ( function () { function GLTFLoader( manager ) { THREE.Loader.call( this, manager ); @@ -35505,7 +35532,7 @@ THREE.OrbitControls = function(object, domElement) { // This option actually enables dollying in and out; left as "zoom" for backwards compatibility. // Set to false to disable zooming this.enableZoom = true; - this.zoomSpeed = 1.0; + this.zoomSpeed = 0.4; // Set to false to disable rotating this.enableRotate = true; @@ -35590,7 +35617,6 @@ THREE.OrbitControls = function(object, domElement) { scope.object.updateProjectionMatrix(); zoomChanged = true; } - this.getPolarAngle = function() { return spherical.phi; @@ -36014,20 +36040,6 @@ THREE.OrbitControls = function(object, domElement) { } else if (event.deltaY > 0) { dollyIn(getZoomScale()); } - - // let mX = (event.clientX / scope.domElement.clientWidth) * 2 - 1; - // let mY = -(event.clientY / scope.domElement.clientHeight) * 2 + 1; - // let vector = new THREE.Vector3(mX, mY, 0); - // vector.unproject(scope.object); - // vector.sub(scope.object.position).setLength(15); - // if (event.deltaY < 0) { - // scope.object.position.add(vector); - // scope.target.add(vector); - // }else { - // scope.object.position.sub(vector); - // scope.target.sub(vector); - // } - scope.update(); } @@ -36347,16 +36359,15 @@ THREE.OrbitControls = function(object, domElement) { document.removeEventListener("mouseup", onMouseUp, false); scope.dispatchEvent(endEvent); - + if(Map_QM){ + Map_QM.collLabel(); + Map_QM.disPlayEvent(); + } state = STATE.NONE; } function onMouseWheel(event) { - if ( - scope.enabled === false || - scope.enableZoom === false || - (state !== STATE.NONE && state !== STATE.ROTATE) - ) + if (scope.enabled === false || scope.enableZoom === false || (state !== STATE.NONE && state !== STATE.ROTATE)) return; event.preventDefault(); @@ -36367,6 +36378,10 @@ THREE.OrbitControls = function(object, domElement) { handleMouseWheel(event); scope.dispatchEvent(endEvent); + if(Map_QM){ + Map_QM.collLabel(); + Map_QM.disPlayEvent(); + } } function onKeyDown(event) { @@ -36494,6 +36509,9 @@ THREE.OrbitControls = function(object, domElement) { default: state = STATE.NONE; } + if(Map_QM){ + Map_QM.disPlayEvent(); + } } function onTouchEnd(event) { @@ -36502,7 +36520,10 @@ THREE.OrbitControls = function(object, domElement) { handleTouchEnd(event); scope.dispatchEvent(endEvent); - + if(Map_QM){ + Map_QM.collLabel(); + Map_QM.disPlayEvent(); + } state = STATE.NONE; } @@ -36515,7 +36536,6 @@ THREE.OrbitControls = function(object, domElement) { // scope.domElement.addEventListener("contextmenu", onContextMenu, false); - scope.domElement.addEventListener("mousedown", onMouseDown, false); scope.domElement.addEventListener("wheel", onMouseWheel, false); @@ -36530,13 +36550,11 @@ THREE.OrbitControls = function(object, domElement) { THREE.OrbitControls.prototype = Object.create(THREE.EventDispatcher.prototype); THREE.OrbitControls.prototype.constructor = THREE.OrbitControls; +//////////////////////////////// TweenMax ///////////////// var _gsScope="undefined"!=typeof module&&module.exports&&"undefined"!=typeof global?global:this||window;(_gsScope._gsQueue||(_gsScope._gsQueue=[])).push(function(){"use strict";_gsScope._gsDefine("TweenMax",["core.Animation","core.SimpleTimeline","TweenLite"],function(a,b,c){var d=function(a){var b,c=[],d=a.length;for(b=0;b!==d;c.push(a[b++]));return c},e=function(a,b,c){var d,e,f=a.cycle;for(d in f)e=f[d],a[d]="function"==typeof e?e(c,b[c],b):e[c%e.length];delete a.cycle},f=function(a){if("function"==typeof a)return a;var b="object"==typeof a?a:{each:a},c=b.ease,d=b.from||0,e=b.base||0,f={},g=isNaN(d),h=b.axis,i={center:.5,end:1}[d]||0;return function(a,j,k){var l,m,n,o,p,q,r,s,t,u=(k||b).length,v=f[u];if(!v){if(t="auto"===b.grid?0:(b.grid||[1/0])[0],!t){for(r=-(1/0);r<(r=k[t++].getBoundingClientRect().left)&&u>t;);t--}for(v=f[u]=[],l=g?Math.min(t,u)*i-.5:d%t,m=g?u*i/t-.5:d/t|0,r=0,s=1/0,q=0;u>q;q++)n=q%t-l,o=m-(q/t|0),v[q]=p=h?Math.abs("y"===h?o:n):Math.sqrt(n*n+o*o),p>r&&(r=p),s>p&&(s=p);v.max=r-s,v.min=s,v.v=u=b.amount||b.each*(t>u?u:h?"y"===h?u/t:t:Math.max(t,u/t))||0,v.b=0>u?e-u:e}return u=(v[a]-v.min)/v.max,v.b+(c?c.getRatio(u):u)*v.v}},g=function(a,b,d){c.call(this,a,b,d),this._cycle=0,this._yoyo=this.vars.yoyo===!0||!!this.vars.yoyoEase,this._repeat=this.vars.repeat||0,this._repeatDelay=this.vars.repeatDelay||0,this._repeat&&this._uncache(!0),this.render=g.prototype.render},h=1e-8,i=c._internals,j=i.isSelector,k=i.isArray,l=g.prototype=c.to({},.1,{}),m=[];g.version="2.1.2",l.constructor=g,l.kill()._gc=!1,g.killTweensOf=g.killDelayedCallsTo=c.killTweensOf,g.getTweensOf=c.getTweensOf,g.lagSmoothing=c.lagSmoothing,g.ticker=c.ticker,g.render=c.render,g.distribute=f,l.invalidate=function(){return this._yoyo=this.vars.yoyo===!0||!!this.vars.yoyoEase,this._repeat=this.vars.repeat||0,this._repeatDelay=this.vars.repeatDelay||0,this._yoyoEase=null,this._uncache(!0),c.prototype.invalidate.call(this)},l.updateTo=function(a,b){var d,e=this,f=e.ratio,g=e.vars.immediateRender||a.immediateRender;b&&e._startTime-1;){for(m=s[j],p[m]=i=[],n=0,l=a.length,k=0;l>k;k++)d=null==c?a[k][m]:"string"==typeof(o=a[k][m])&&"="===o.charAt(1)?c[m]+Number(o.charAt(0)+o.substr(2)):Number(o),r&&k>1&&l-1>k&&(i[n++]=(d+i[n-2])/2),i[n++]=d;for(l=n-q+1,n=0,k=0;l>k;k+=q)d=i[k],e=i[k+1],f=i[k+2],h=2===q?0:i[k+3],i[n++]=o=3===q?new g(d,e,f,h):new g(d,(2*e+d)/3,(2*e+f)/3,f);i.length=n}return p},n=function(a,b,c){for(var d,e,f,g,h,i,j,k,l,m,n,o=1/c,p=a.length;--p>-1;)for(m=a[p],f=m.a,g=m.d-f,h=m.c-f,i=m.b-f,d=e=0,k=1;c>=k;k++)j=o*k,l=1-j,d=e-(e=(j*j*g+3*l*(j*h+l*i))*j),n=p*c+k-1,b[n]=(b[n]||0)+d*d},o=function(a,b){b=b>>0||6;var c,d,e,f,g=[],h=[],i=0,j=0,k=b-1,l=[],m=[];for(c in a)n(a[c],g,b);for(e=g.length,d=0;e>d;d++)i+=Math.sqrt(g[d]),f=d%b,m[f]=i,f===k&&(j+=i,f=d/b>>0,l[f]=m,h[f]=j,i=0,m=[]);return{length:j,lengths:h,segments:l}},p=_gsScope._gsDefine.plugin({propName:"bezier",priority:-1,version:"1.3.8",API:2,global:!0,init:function(a,b,c){this._target=a,b instanceof Array&&(b={values:b}),this._func={},this._mod={},this._props=[],this._timeRes=null==b.timeResolution?6:parseInt(b.timeResolution,10);var d,e,f,g,h,i=b.values||[],j={},k=i[0],n=b.autoRotate||c.vars.orientToBezier;this._autoRotate=n?n instanceof Array?n:[["x","y","rotation",n===!0?0:Number(n)||0]]:null;for(d in k)this._props.push(d);for(f=this._props.length;--f>-1;)d=this._props[f],this._overwriteProps.push(d),e=this._func[d]="function"==typeof a[d],j[d]=e?a[d.indexOf("set")||"function"!=typeof a["get"+d.substr(3)]?d:"get"+d.substr(3)]():parseFloat(a[d]),h||j[d]!==i[0][d]&&(h=j);if(this._beziers="cubic"!==b.type&&"quadratic"!==b.type&&"soft"!==b.type?l(i,isNaN(b.curviness)?1:b.curviness,!1,"thruBasic"===b.type,b.correlate,h):m(i,b.type,j),this._segCount=this._beziers[d].length,this._timeRes){var p=o(this._beziers,this._timeRes);this._length=p.length,this._lengths=p.lengths,this._segments=p.segments,this._l1=this._li=this._s1=this._si=0,this._l2=this._lengths[0],this._curSeg=this._segments[0],this._s2=this._curSeg[0],this._prec=1/this._curSeg.length}if(n=this._autoRotate)for(this._initialRotations=[],n[0]instanceof Array||(this._autoRotate=n=[n]),f=n.length;--f>-1;){for(g=0;3>g;g++)d=n[f][g],this._func[d]="function"==typeof a[d]?a[d.indexOf("set")||"function"!=typeof a["get"+d.substr(3)]?d:"get"+d.substr(3)]:!1;d=n[f][2],this._initialRotations[f]=(this._func[d]?this._func[d].call(this._target):this._target[d])||0,this._overwriteProps.push(d)}return this._startRatio=c.vars.runBackwards?1:0,!0},set:function(b){var c,d,e,f,g,h,i,j,k,l,m=this._segCount,n=this._func,o=this._target,p=b!==this._startRatio;if(this._timeRes){if(k=this._lengths,l=this._curSeg,b*=this._length,e=this._li,b>this._l2&&m-1>e){for(j=m-1;j>e&&(this._l2=k[++e])<=b;);this._l1=k[e-1],this._li=e,this._curSeg=l=this._segments[e],this._s2=l[this._s1=this._si=0]}else if(b0){for(;e>0&&(this._l1=k[--e])>=b;);0===e&&b this._s2&&e e&&(this._s2=l[++e])<=b;);this._s1=l[e-1],this._si=e}else if(b 0){for(;e>0&&(this._s1=l[--e])>=b;);0===e&&b b?0:b>=1?m-1:m*b>>0,h=(b-c*(1/m))*m;for(d=1-h,e=this._props.length;--e>-1;)f=this._props[e],g=this._beziers[f][c],i=(h*h*g.da+3*d*(h*g.ca+d*g.ba))*h+g.a,this._mod[f]&&(i=this._mod[f](i,o)),n[f]?o[f](i):o[f]=i;if(this._autoRotate){var q,r,s,t,u,v,w,x=this._autoRotate;for(e=x.length;--e>-1;)f=x[e][2],v=x[e][3]||0,w=x[e][4]===!0?1:a,g=this._beziers[x[e][0]],q=this._beziers[x[e][1]],g&&q&&(g=g[c],q=q[c],r=g.a+(g.b-g.a)*h,t=g.b+(g.c-g.b)*h,r+=(t-r)*h,t+=(g.c+(g.d-g.c)*h-t)*h,s=q.a+(q.b-q.a)*h,u=q.b+(q.c-q.b)*h,s+=(u-s)*h,u+=(q.c+(q.d-q.c)*h-u)*h,i=p?Math.atan2(u-s,t-r)*w+v:this._initialRotations[e],this._mod[f]&&(i=this._mod[f](i,o)),n[f]?o[f](i):o[f]=i)}}}),q=p.prototype;p.bezierThrough=l,p.cubicToQuadratic=i,p._autoCSS=!0,p.quadraticToCubic=function(a,b,c){return new g(a,(2*b+a)/3,(2*b+c)/3,c)},p._cssRegister=function(){var a=f.CSSPlugin;if(a){var b=a._internals,c=b._parseToProxy,d=b._setPluginRatio,e=b.CSSPropTween;b._registerComplexSpecialProp("bezier",{parser:function(a,b,f,g,h,i){b instanceof Array&&(b={values:b}),i=new p;var j,k,l,m=b.values,n=m.length-1,o=[],q={};if(0>n)return h;for(j=0;n>=j;j++)l=c(a,m[j],g,h,i,n!==j),o[j]=l.end;for(k in b)q[k]=b[k];return q.values=o,h=new e(a,"bezier",0,0,l.pt,2),h.data=l,h.plugin=i,h.setRatio=d,0===q.autoRotate&&(q.autoRotate=!0),!q.autoRotate||q.autoRotate instanceof Array||(j=q.autoRotate===!0?0:Number(q.autoRotate),q.autoRotate=null!=l.end.left?[["left","top","rotation",j,!1]]:null!=l.end.x?[["x","y","rotation",j,!1]]:!1),q.autoRotate&&(g._transform||g._enableTransforms(!1),l.autoRotate=g._target._gsTransform,l.proxy.rotation=l.autoRotate.rotation||0,g._overwriteProps.push("rotation")),i._onInitTween(l.proxy,q,g._tween),h}})}},q._mod=function(a){for(var b,c=this._overwriteProps,d=c.length;--d>-1;)b=a[c[d]],b&&"function"==typeof b&&(this._mod[c[d]]=b)},q._kill=function(a){var b,c,d=this._props;for(b in this._beziers)if(b in a)for(delete this._beziers[b],delete this._func[b],c=d.length;--c>-1;)d[c]===b&&d.splice(c,1);if(d=this._autoRotate)for(c=d.length;--c>-1;)a[d[c][2]]&&d.splice(c,1);return this._super._kill.call(this,a)}}(),_gsScope._gsDefine("plugins.CSSPlugin",["plugins.TweenPlugin","TweenLite"],function(a,b){var c,d,e,f,g=function(){a.call(this,"css"),this._overwriteProps.length=0,this.setRatio=g.prototype.setRatio},h=_gsScope._gsDefine.globals,i={},j=g.prototype=new a("css");j.constructor=g,g.version="2.1.0",g.API=2,g.defaultTransformPerspective=0,g.defaultSkewType="compensated",g.defaultSmoothOrigin=!0,j="px",g.suffixMap={top:j,right:j,bottom:j,left:j,width:j,height:j,fontSize:j,padding:j,margin:j,perspective:j,lineHeight:""};var k,l,m,n,o,p,q,r,s=/(?:\-|\.|\b)(\d|\.|e\-)+/g,t=/(?:\d|\-\d|\.\d|\-\.\d|\+=\d|\-=\d|\+=.\d|\-=\.\d)+/g,u=/(?:\+=|\-=|\-|\b)[\d\-\.]+[a-zA-Z0-9]*(?:%|\b)/gi,v=/(?![+-]?\d*\.?\d+|[+-]|e[+-]\d+)[^0-9]/g,w=/(?:\d|\-|\+|=|#|\.)*/g,x=/opacity *= *([^)]*)/i,y=/opacity:([^;]*)/i,z=/alpha\(opacity *=.+?\)/i,A=/^(rgb|hsl)/,B=/([A-Z])/g,C=/-([a-z])/gi,D=/(^(?:url\(\"|url\())|(?:(\"\))$|\)$)/gi,E=function(a,b){return b.toUpperCase()},F=/(?:Left|Right|Width)/i,G=/(M11|M12|M21|M22)=[\d\-\.e]+/gi,H=/progid\:DXImageTransform\.Microsoft\.Matrix\(.+?\)/i,I=/,(?=[^\)]*(?:\(|$))/gi,J=/[\s,\(]/i,K=Math.PI/180,L=180/Math.PI,M={},N={style:{}},O=_gsScope.document||{createElement:function(){return N}},P=function(a,b){return b&&O.createElementNS?O.createElementNS(b,a):O.createElement(a)},Q=P("div"),R=P("img"),S=g._internals={_specialProps:i},T=(_gsScope.navigator||{}).userAgent||"",U=function(){var a=T.indexOf("Android"),b=P("a");return m=-1!==T.indexOf("Safari")&&-1===T.indexOf("Chrome")&&(-1===a||parseFloat(T.substr(a+8,2))>3),o=m&&parseFloat(T.substr(T.indexOf("Version/")+8,2))<6,n=-1!==T.indexOf("Firefox"),(/MSIE ([0-9]{1,}[\.0-9]{0,})/.exec(T)||/Trident\/.*rv:([0-9]{1,}[\.0-9]{0,})/.exec(T))&&(p=parseFloat(RegExp.$1)),b?(b.style.cssText="top:1px;opacity:.55;",/^0.55/.test(b.style.opacity)):!1}(),V=function(a){return x.test("string"==typeof a?a:(a.currentStyle?a.currentStyle.filter:a.style.filter)||"")?parseFloat(RegExp.$1)/100:1},W=function(a){_gsScope.console&&console.log(a)},X="",Y="",Z=function(a,b){b=b||Q;var c,d,e=b.style;if(void 0!==e[a])return a;for(a=a.charAt(0).toUpperCase()+a.substr(1),c=["O","Moz","ms","Ms","Webkit"],d=5;--d>-1&&void 0===e[c[d]+a];);return d>=0?(Y=3===d?"ms":c[d],X="-"+Y.toLowerCase()+"-",Y+a):null},$="undefined"!=typeof window?window:O.defaultView||{getComputedStyle:function(){}},_=function(a){return $.getComputedStyle(a)},aa=g.getStyle=function(a,b,c,d,e){var f;return U||"opacity"!==b?(!d&&a.style[b]?f=a.style[b]:(c=c||_(a))?f=c[b]||c.getPropertyValue(b)||c.getPropertyValue(b.replace(B,"-$1").toLowerCase()):a.currentStyle&&(f=a.currentStyle[b]),null==e||f&&"none"!==f&&"auto"!==f&&"auto auto"!==f?f:e):V(a)},ba=S.convertToPixels=function(a,c,d,e,f){if("px"===e||!e&&"lineHeight"!==c)return d;if("auto"===e||!d)return 0;var h,i,j,k=F.test(c),l=a,m=Q.style,n=0>d,o=1===d;if(n&&(d=-d),o&&(d*=100),"lineHeight"!==c||e)if("%"===e&&-1!==c.indexOf("border"))h=d/100*(k?a.clientWidth:a.clientHeight);else{if(m.cssText="border:0 solid red;position:"+aa(a,"position")+";line-height:0;","%"!==e&&l.appendChild&&"v"!==e.charAt(0)&&"rem"!==e)m[k?"borderLeftWidth":"borderTopWidth"]=d+e;else{if(l=a.parentNode||O.body,-1!==aa(l,"display").indexOf("flex")&&(m.position="absolute"),i=l._gsCache,j=b.ticker.frame,i&&k&&i.time===j)return i.width*d/100;m[k?"width":"height"]=d+e}l.appendChild(Q),h=parseFloat(Q[k?"offsetWidth":"offsetHeight"]),l.removeChild(Q),k&&"%"===e&&g.cacheWidths!==!1&&(i=l._gsCache=l._gsCache||{},i.time=j,i.width=h/d*100),0!==h||f||(h=ba(a,c,d,e,!0))}else i=_(a).lineHeight,a.style.lineHeight=d,h=parseFloat(_(a).lineHeight),a.style.lineHeight=i;return o&&(h/=100),n?-h:h},ca=S.calculateOffset=function(a,b,c){if("absolute"!==aa(a,"position",c))return 0;var d="left"===b?"Left":"Top",e=aa(a,"margin"+d,c);return a["offset"+d]-(ba(a,b,parseFloat(e),e.replace(w,""))||0)},da=function(a,b){var c,d,e,f={};if(b=b||_(a,null))if(c=b.length)for(;--c>-1;)e=b[c],(-1===e.indexOf("-transform")||Ea===e)&&(f[e.replace(C,E)]=b.getPropertyValue(e));else for(c in b)(-1===c.indexOf("Transform")||Da===c)&&(f[c]=b[c]);else if(b=a.currentStyle||a.style)for(c in b)"string"==typeof c&&void 0===f[c]&&(f[c.replace(C,E)]=b[c]);return U||(f.opacity=V(a)),d=Sa(a,b,!1),f.rotation=d.rotation,f.skewX=d.skewX,f.scaleX=d.scaleX,f.scaleY=d.scaleY,f.x=d.x,f.y=d.y,Ga&&(f.z=d.z,f.rotationX=d.rotationX,f.rotationY=d.rotationY,f.scaleZ=d.scaleZ),f.filters&&delete f.filters,f},ea=function(a,b,c,d,e){var f,g,h,i={},j=a.style;for(g in c)"cssText"!==g&&"length"!==g&&isNaN(g)&&(b[g]!==(f=c[g])||e&&e[g])&&-1===g.indexOf("Origin")&&("number"==typeof f||"string"==typeof f)&&(i[g]="auto"!==f||"left"!==g&&"top"!==g?""!==f&&"auto"!==f&&"none"!==f||"string"!=typeof b[g]||""===b[g].replace(v,"")?f:0:ca(a,g),void 0!==j[g]&&(h=new ta(j,g,j[g],h)));if(d)for(g in d)"className"!==g&&(i[g]=d[g]);return{difs:i,firstMPT:h}},fa={width:["Left","Right"],height:["Top","Bottom"]},ga=["marginLeft","marginRight","marginTop","marginBottom"],ha=function(a,b,c){if("svg"===(a.nodeName+"").toLowerCase())return(c||_(a))[b]||0;if(a.getCTM&&Pa(a))return a.getBBox()[b]||0;var d=parseFloat("width"===b?a.offsetWidth:a.offsetHeight),e=fa[b],f=e.length;for(c=c||_(a,null);--f>-1;)d-=parseFloat(aa(a,"padding"+e[f],c,!0))||0,d-=parseFloat(aa(a,"border"+e[f]+"Width",c,!0))||0;return d},ia=function(a,b){if("contain"===a||"auto"===a||"auto auto"===a)return a+" ";(null==a||""===a)&&(a="0 0");var c,d=a.split(" "),e=-1!==a.indexOf("left")?"0%":-1!==a.indexOf("right")?"100%":d[0],f=-1!==a.indexOf("top")?"0%":-1!==a.indexOf("bottom")?"100%":d[1];if(d.length>3&&!b){for(d=a.split(", ").join(",").split(","),a=[],c=0;c 2?" "+d[2]:""),b&&(b.oxp=-1!==e.indexOf("%"),b.oyp=-1!==f.indexOf("%"),b.oxr="="===e.charAt(1),b.oyr="="===f.charAt(1),b.ox=parseFloat(e.replace(v,"")),b.oy=parseFloat(f.replace(v,"")),b.v=a),b||a},ja=function(a,b){return"function"==typeof a&&(a=a(r,q)),"string"==typeof a&&"="===a.charAt(1)?parseInt(a.charAt(0)+"1",10)*parseFloat(a.substr(2)):parseFloat(a)-parseFloat(b)||0},ka=function(a,b){"function"==typeof a&&(a=a(r,q));var c="string"==typeof a&&"="===a.charAt(1);return"string"==typeof a&&"v"===a.charAt(a.length-2)&&(a=(c?a.substr(0,2):0)+window["inner"+("vh"===a.substr(-2)?"Height":"Width")]*(parseFloat(c?a.substr(2):a)/100)),null==a?b:c?parseInt(a.charAt(0)+"1",10)*parseFloat(a.substr(2))+b:parseFloat(a)||0},la=function(a,b,c,d){var e,f,g,h,i,j=1e-6;return"function"==typeof a&&(a=a(r,q)),null==a?h=b:"number"==typeof a?h=a:(e=360,f=a.split("_"),i="="===a.charAt(1),g=(i?parseInt(a.charAt(0)+"1",10)*parseFloat(f[0].substr(2)):parseFloat(f[0]))*(-1===a.indexOf("rad")?1:L)-(i?0:b),f.length&&(d&&(d[c]=b+g),-1!==a.indexOf("short")&&(g%=e,g!==g%(e/2)&&(g=0>g?g+e:g-e)),-1!==a.indexOf("_cw")&&0>g?g=(g+9999999999*e)%e-(g/e|0)*e:-1!==a.indexOf("ccw")&&g>0&&(g=(g-9999999999*e)%e-(g/e|0)*e)),h=b+g),j>h&&h>-j&&(h=0),h},ma={aqua:[0,255,255],lime:[0,255,0],silver:[192,192,192],black:[0,0,0],maroon:[128,0,0],teal:[0,128,128],blue:[0,0,255],navy:[0,0,128],white:[255,255,255],fuchsia:[255,0,255],olive:[128,128,0],yellow:[255,255,0],orange:[255,165,0],gray:[128,128,128],purple:[128,0,128],green:[0,128,0],red:[255,0,0],pink:[255,192,203],cyan:[0,255,255],transparent:[255,255,255,0]},na=function(a,b,c){return a=0>a?a+1:a>1?a-1:a,255*(1>6*a?b+(c-b)*a*6:.5>a?c:2>3*a?b+(c-b)*(2/3-a)*6:b)+.5|0},oa=g.parseColor=function(a,b){var c,d,e,f,g,h,i,j,k,l,m;if(a)if("number"==typeof a)c=[a>>16,a>>8&255,255&a];else{if(","===a.charAt(a.length-1)&&(a=a.substr(0,a.length-1)),ma[a])c=ma[a];else if("#"===a.charAt(0))4===a.length&&(d=a.charAt(1),e=a.charAt(2),f=a.charAt(3),a="#"+d+d+e+e+f+f),a=parseInt(a.substr(1),16),c=[a>>16,a>>8&255,255&a];else if("hsl"===a.substr(0,3))if(c=m=a.match(s),b){if(-1!==a.indexOf("="))return a.match(t)}else g=Number(c[0])%360/360,h=Number(c[1])/100,i=Number(c[2])/100,e=.5>=i?i*(h+1):i+h-i*h,d=2*i-e,c.length>3&&(c[3]=Number(c[3])),c[0]=na(g+1/3,d,e),c[1]=na(g,d,e),c[2]=na(g-1/3,d,e);else c=a.match(s)||ma.transparent;c[0]=Number(c[0]),c[1]=Number(c[1]),c[2]=Number(c[2]),c.length>3&&(c[3]=Number(c[3]))}else c=ma.black;return b&&!m&&(d=c[0]/255,e=c[1]/255,f=c[2]/255,j=Math.max(d,e,f),k=Math.min(d,e,f),i=(j+k)/2,j===k?g=h=0:(l=j-k,h=i>.5?l/(2-j-k):l/(j+k),g=j===d?(e-f)/l+(f>e?6:0):j===e?(f-d)/l+2:(d-e)/l+4,g*=60),c[0]=g+.5|0,c[1]=100*h+.5|0,c[2]=100*i+.5|0),c},pa=function(a,b){var c,d,e,f=a.match(qa)||[],g=0,h="";if(!f.length)return a;for(c=0;c 0?g[0].replace(s,""):"";return k?e=b?function(a){var b,m,n,o;if("number"==typeof a)a+=l;else if(d&&I.test(a)){for(o=a.replace(I,"|").split("|"),n=0;n n--)for(;++n m--)for(;++m i;i++)h[a[i]]=j[i]=j[i]||j[(i-1)/2>>0];return e.parse(b,h,f,g)}},ta=(S._setPluginRatio=function(a){this.plugin.setRatio(a);for(var b,c,d,e,f,g=this.data,h=g.proxy,i=g.firstMPT,j=1e-6;i;)b=h[i.v],i.r?b=i.r(b):j>b&&b>-j&&(b=0),i.t[i.p]=b,i=i._next;if(g.autoRotate&&(g.autoRotate.rotation=g.mod?g.mod.call(this._tween,h.rotation,this.t,this._tween):h.rotation),1===a||0===a)for(i=g.firstMPT,f=1===a?"e":"b";i;){if(c=i.t,c.type){if(1===c.type){for(e=c.xs0+c.s+c.xs1,d=1;d 0;)i="xn"+g,h=d.p+"_"+i,n[h]=d.data[i],m[h]=d[i],f||(j=new ta(d,i,h,j,d.rxp[i]));d=d._next}return{proxy:m,end:n,firstMPT:j,pt:k}},S.CSSPropTween=function(a,b,d,e,g,h,i,j,k,l,m){this.t=a,this.p=b,this.s=d,this.c=e,this.n=i||b,a instanceof ua||f.push(this.n),this.r=j?"function"==typeof j?j:Math.round:j,this.type=h||0,k&&(this.pr=k,c=!0),this.b=void 0===l?d:l,this.e=void 0===m?d+e:m,g&&(this._next=g,g._prev=this)}),va=function(a,b,c,d,e,f){var g=new ua(a,b,c,d-c,e,-1,f);return g.b=c,g.e=g.xs0=d,g},wa=g.parseComplex=function(a,b,c,d,e,f,h,i,j,l){c=c||f||"","function"==typeof d&&(d=d(r,q)),h=new ua(a,b,0,0,h,l?2:1,null,!1,i,c,d),d+="",e&&qa.test(d+c)&&(d=[c,d],g.colorStringFilter(d),c=d[0],d=d[1]);var m,n,o,p,u,v,w,x,y,z,A,B,C,D=c.split(", ").join(",").split(" "),E=d.split(", ").join(",").split(" "),F=D.length,G=k!==!1;for((-1!==d.indexOf(",")||-1!==c.indexOf(","))&&(-1!==(d+c).indexOf("rgb")||-1!==(d+c).indexOf("hsl")?(D=D.join(" ").replace(I,", ").split(" "),E=E.join(" ").replace(I,", ").split(" ")):(D=D.join(" ").split(",").join(", ").split(" "),E=E.join(" ").split(",").join(", ").split(" ")),F=D.length),F!==E.length&&(D=(f||"").split(" "),F=D.length),h.plugin=j,h.setRatio=l,qa.lastIndex=0,m=0;F>m;m++)if(p=D[m],u=E[m]+"",x=parseFloat(p),x||0===x)h.appendXtra("",x,ja(u,x),u.replace(t,""),G&&-1!==u.indexOf("px")?Math.round:!1,!0);else if(e&&qa.test(p))B=u.indexOf(")")+1,B=")"+(B?u.substr(B):""),C=-1!==u.indexOf("hsl")&&U,z=u,p=oa(p,C),u=oa(u,C),y=p.length+u.length>6,y&&!U&&0===u[3]?(h["xs"+h.l]+=h.l?" transparent":"transparent",h.e=h.e.split(E[m]).join("transparent")):(U||(y=!1),C?h.appendXtra(z.substr(0,z.indexOf("hsl"))+(y?"hsla(":"hsl("),p[0],ja(u[0],p[0]),",",!1,!0).appendXtra("",p[1],ja(u[1],p[1]),"%,",!1).appendXtra("",p[2],ja(u[2],p[2]),y?"%,":"%"+B,!1):h.appendXtra(z.substr(0,z.indexOf("rgb"))+(y?"rgba(":"rgb("),p[0],u[0]-p[0],",",Math.round,!0).appendXtra("",p[1],u[1]-p[1],",",Math.round).appendXtra("",p[2],u[2]-p[2],y?",":B,Math.round),y&&(p=p.length<4?1:p[3],h.appendXtra("",p,(u.length<4?1:u[3])-p,B,!1))),qa.lastIndex=0;else if(v=p.match(s)){if(w=u.match(t),!w||w.length!==v.length)return h;for(o=0,n=0;n 0;)j["xn"+xa]=0,j["xs"+xa]="";j.xs0="",j._next=j._prev=j.xfirst=j.data=j.plugin=j.setRatio=j.rxp=null,j.appendXtra=function(a,b,c,d,e,f){var g=this,h=g.l;return g["xs"+h]+=f&&(h||g["xs"+h])?" "+a:a||"",c||0===h||g.plugin?(g.l++,g.type=g.setRatio?2:1,g["xs"+g.l]=d||"",h>0?(g.data["xn"+h]=b+c,g.rxp["xn"+h]=e,g["xn"+h]=b,g.plugin||(g.xfirst=new ua(g,"xn"+h,b,c,g.xfirst||g,0,g.n,e,g.pr),g.xfirst.xs0=0),g):(g.data={s:b+c},g.rxp={},g.s=b,g.c=c,g.r=e,g)):(g["xs"+h]+=b+(d||""),g)};var ya=function(a,b){b=b||{},this.p=b.prefix?Z(a)||a:a,i[a]=i[this.p]=this,this.format=b.formatter||ra(b.defaultValue,b.color,b.collapsible,b.multi),b.parser&&(this.parse=b.parser),this.clrs=b.color,this.multi=b.multi,this.keyword=b.keyword,this.dflt=b.defaultValue,this.allowFunc=b.allowFunc,this.pr=b.priority||0},za=S._registerComplexSpecialProp=function(a,b,c){"object"!=typeof b&&(b={parser:c});var d,e,f=a.split(","),g=b.defaultValue;for(c=c||[g],d=0;d h.length?i.length:h.length,g=0;j>g;g++)b=h[g]=h[g]||this.dflt,c=i[g]=i[g]||this.dflt,m&&(k=b.indexOf(m),l=c.indexOf(m),k!==l&&(-1===l?h[g]=h[g].split(m).join(""):-1===k&&(h[g]+=" "+m)));b=h.join(", "),c=i.join(", ")}return wa(a,this.p,b,c,this.clrs,this.dflt,d,this.pr,e,f)},j.parse=function(a,b,c,d,f,g,h){return this.parseComplex(a.style,this.format(aa(a,this.p,e,!1,this.dflt)),this.format(b),f,g)},g.registerSpecialProp=function(a,b,c){za(a,{parser:function(a,d,e,f,g,h,i){var j=new ua(a,e,0,0,g,2,e,!1,c);return j.plugin=h,j.setRatio=b(a,d,f._tween,e),j},priority:c})},g.useSVGTransformAttr=!0;var Ba,Ca="scaleX,scaleY,scaleZ,x,y,z,skewX,skewY,rotation,rotationX,rotationY,perspective,xPercent,yPercent".split(","),Da=Z("transform"),Ea=X+"transform",Fa=Z("transformOrigin"),Ga=null!==Z("perspective"),Ha=S.Transform=function(){this.perspective=parseFloat(g.defaultTransformPerspective)||0,this.force3D=g.defaultForce3D!==!1&&Ga?g.defaultForce3D||"auto":!1},Ia=_gsScope.SVGElement,Ja=function(a,b,c){var d,e=O.createElementNS("http://www.w3.org/2000/svg",a),f=/([a-z])([A-Z])/g;for(d in c)e.setAttributeNS(null,d.replace(f,"$1-$2").toLowerCase(),c[d]);return b.appendChild(e),e},Ka=O.documentElement||{},La=function(){var a,b,c,d=p||/Android/i.test(T)&&!_gsScope.chrome;return O.createElementNS&&!d&&(a=Ja("svg",Ka),b=Ja("rect",a,{width:100,height:50,x:100}),c=b.getBoundingClientRect().width,b.style[Fa]="50% 50%",b.style[Da]="scaleX(0.5)",d=c===b.getBoundingClientRect().width&&!(n&&Ga),Ka.removeChild(a)),d}(),Ma=function(a,b,c,d,e,f){var h,i,j,k,l,m,n,o,p,q,r,s,t,u,v=a._gsTransform,w=Ra(a,!0);v&&(t=v.xOrigin,u=v.yOrigin),(!d||(h=d.split(" ")).length<2)&&(n=a.getBBox(),0===n.x&&0===n.y&&n.width+n.height===0&&(n={x:parseFloat(a.hasAttribute("x")?a.getAttribute("x"):a.hasAttribute("cx")?a.getAttribute("cx"):0)||0,y:parseFloat(a.hasAttribute("y")?a.getAttribute("y"):a.hasAttribute("cy")?a.getAttribute("cy"):0)||0,width:0,height:0}),b=ia(b).split(" "),h=[(-1!==b[0].indexOf("%")?parseFloat(b[0])/100*n.width:parseFloat(b[0]))+n.x,(-1!==b[1].indexOf("%")?parseFloat(b[1])/100*n.height:parseFloat(b[1]))+n.y]),c.xOrigin=k=parseFloat(h[0]),c.yOrigin=l=parseFloat(h[1]),d&&w!==Qa&&(m=w[0],n=w[1],o=w[2],p=w[3],q=w[4],r=w[5],s=m*p-n*o,s&&(i=k*(p/s)+l*(-o/s)+(o*r-p*q)/s,j=k*(-n/s)+l*(m/s)-(m*r-n*q)/s,k=c.xOrigin=h[0]=i,l=c.yOrigin=h[1]=j)),v&&(f&&(c.xOffset=v.xOffset,c.yOffset=v.yOffset,v=c),e||e!==!1&&g.defaultSmoothOrigin!==!1?(i=k-t,j=l-u,v.xOffset+=i*w[0]+j*w[2]-i,v.yOffset+=i*w[1]+j*w[3]-j):v.xOffset=v.yOffset=0),f||a.setAttribute("data-svg-origin",h.join(" "))},Na=function(a){var b,c=P("svg",this.ownerSVGElement&&this.ownerSVGElement.getAttribute("xmlns")||"http://www.w3.org/2000/svg"),d=this.parentNode,e=this.nextSibling,f=this.style.cssText;if(Ka.appendChild(c),c.appendChild(this),this.style.display="block",a)try{b=this.getBBox(),this._originalGetBBox=this.getBBox,this.getBBox=Na}catch(g){}else this._originalGetBBox&&(b=this._originalGetBBox());return e?d.insertBefore(this,e):d.appendChild(this),Ka.removeChild(c),this.style.cssText=f,b},Oa=function(a){try{return a.getBBox()}catch(b){return Na.call(a,!0)}},Pa=function(a){return!(!Ia||!a.getCTM||a.parentNode&&!a.ownerSVGElement||!Oa(a))},Qa=[1,0,0,1,0,0],Ra=function(a,b){var c,d,e,f,g,h,i,j=a._gsTransform||new Ha,k=1e5,l=a.style;if(Da?d=aa(a,Ea,null,!0):a.currentStyle&&(d=a.currentStyle.filter.match(G),d=d&&4===d.length?[d[0].substr(4),Number(d[2].substr(4)),Number(d[1].substr(4)),d[3].substr(4),j.x||0,j.y||0].join(","):""),c=!d||"none"===d||"matrix(1, 0, 0, 1, 0, 0)"===d,Da&&c&&!a.offsetParent&&(f=l.display,l.display="block",i=a.parentNode,i&&a.offsetParent||(g=1,h=a.nextSibling,Ka.appendChild(a)),d=aa(a,Ea,null,!0),c=!d||"none"===d||"matrix(1, 0, 0, 1, 0, 0)"===d,f?l.display=f:Wa(l,"display"),g&&(h?i.insertBefore(a,h):i?i.appendChild(a):Ka.removeChild(a))),(j.svg||a.getCTM&&Pa(a))&&(c&&-1!==(l[Da]+"").indexOf("matrix")&&(d=l[Da],c=0),e=a.getAttribute("transform"),c&&e&&(e=a.transform.baseVal.consolidate().matrix,d="matrix("+e.a+","+e.b+","+e.c+","+e.d+","+e.e+","+e.f+")",c=0)),c)return Qa;for(e=(d||"").match(s)||[],xa=e.length;--xa>-1;)f=Number(e[xa]),e[xa]=(g=f-(f|=0))?(g*k+(0>g?-.5:.5)|0)/k+f:f;return b&&e.length>6?[e[0],e[1],e[4],e[5],e[12],e[13]]:e},Sa=S.getTransform=function(a,c,d,e){if(a._gsTransform&&d&&!e)return a._gsTransform;var f,h,i,j,k,l,m=d?a._gsTransform||new Ha:new Ha,n=m.scaleX<0,o=2e-5,p=1e5,q=Ga?parseFloat(aa(a,Fa,c,!1,"0 0 0").split(" ")[2])||m.zOrigin||0:0,r=parseFloat(g.defaultTransformPerspective)||0;if(m.svg=!(!a.getCTM||!Pa(a)),m.svg&&(Ma(a,aa(a,Fa,c,!1,"50% 50%")+"",m,a.getAttribute("data-svg-origin")),Ba=g.useSVGTransformAttr||La),f=Ra(a),f!==Qa){if(16===f.length){var s,t,u,v,w,x=f[0],y=f[1],z=f[2],A=f[3],B=f[4],C=f[5],D=f[6],E=f[7],F=f[8],G=f[9],H=f[10],I=f[12],J=f[13],K=f[14],M=f[11],N=Math.atan2(D,H);m.zOrigin&&(K=-m.zOrigin,I=F*K-f[12],J=G*K-f[13],K=H*K+m.zOrigin-f[14]),m.rotationX=N*L,N&&(v=Math.cos(-N),w=Math.sin(-N),s=B*v+F*w,t=C*v+G*w,u=D*v+H*w,F=B*-w+F*v,G=C*-w+G*v,H=D*-w+H*v,M=E*-w+M*v,B=s,C=t,D=u),N=Math.atan2(-z,H),m.rotationY=N*L,N&&(v=Math.cos(-N),w=Math.sin(-N),s=x*v-F*w,t=y*v-G*w,u=z*v-H*w,G=y*w+G*v,H=z*w+H*v,M=A*w+M*v,x=s,y=t,z=u),N=Math.atan2(y,x),m.rotation=N*L,N&&(v=Math.cos(N),w=Math.sin(N),s=x*v+y*w,t=B*v+C*w,u=F*v+G*w,y=y*v-x*w,C=C*v-B*w,G=G*v-F*w,x=s,B=t,F=u),m.rotationX&&Math.abs(m.rotationX)+Math.abs(m.rotation)>359.9&&(m.rotationX=m.rotation=0,m.rotationY=180-m.rotationY),N=Math.atan2(B,C),m.scaleX=(Math.sqrt(x*x+y*y+z*z)*p+.5|0)/p,m.scaleY=(Math.sqrt(C*C+D*D)*p+.5|0)/p,m.scaleZ=(Math.sqrt(F*F+G*G+H*H)*p+.5|0)/p,x/=m.scaleX,B/=m.scaleY,y/=m.scaleX,C/=m.scaleY,Math.abs(N)>o?(m.skewX=N*L,B=0,"simple"!==m.skewType&&(m.scaleY*=1/Math.cos(N))):m.skewX=0,m.perspective=M?1/(0>M?-M:M):0,m.x=I,m.y=J,m.z=K,m.svg&&(m.x-=m.xOrigin-(m.xOrigin*x-m.yOrigin*B),m.y-=m.yOrigin-(m.yOrigin*y-m.xOrigin*C))}else if(!Ga||e||!f.length||m.x!==f[4]||m.y!==f[5]||!m.rotationX&&!m.rotationY){var O=f.length>=6,P=O?f[0]:1,Q=f[1]||0,R=f[2]||0,S=O?f[3]:1;m.x=f[4]||0,m.y=f[5]||0,i=Math.sqrt(P*P+Q*Q),j=Math.sqrt(S*S+R*R),k=P||Q?Math.atan2(Q,P)*L:m.rotation||0,l=R||S?Math.atan2(R,S)*L+k:m.skewX||0,m.scaleX=i,m.scaleY=j,m.rotation=k,m.skewX=l,Ga&&(m.rotationX=m.rotationY=m.z=0,m.perspective=r,m.scaleZ=1),m.svg&&(m.x-=m.xOrigin-(m.xOrigin*P+m.yOrigin*R),m.y-=m.yOrigin-(m.xOrigin*Q+m.yOrigin*S))}Math.abs(m.skewX)>90&&Math.abs(m.skewX)<270&&(n?(m.scaleX*=-1,m.skewX+=m.rotation<=0?180:-180,m.rotation+=m.rotation<=0?180:-180):(m.scaleY*=-1,m.skewX+=m.skewX<=0?180:-180)),m.zOrigin=q;for(h in m)m[h] -o&&(m[h]=0)}return d&&(a._gsTransform=m,m.svg&&(Ba&&a.style[Da]?b.delayedCall(.001,function(){Wa(a.style,Da)}):!Ba&&a.getAttribute("transform")&&b.delayedCall(.001,function(){a.removeAttribute("transform")}))),m},Ta=function(a){var b,c,d=this.data,e=-d.rotation*K,f=e+d.skewX*K,g=1e5,h=(Math.cos(e)*d.scaleX*g|0)/g,i=(Math.sin(e)*d.scaleX*g|0)/g,j=(Math.sin(f)*-d.scaleY*g|0)/g,k=(Math.cos(f)*d.scaleY*g|0)/g,l=this.t.style,m=this.t.currentStyle;if(m){c=i,i=-j,j=-c,b=m.filter,l.filter="";var n,o,q=this.t.offsetWidth,r=this.t.offsetHeight,s="absolute"!==m.position,t="progid:DXImageTransform.Microsoft.Matrix(M11="+h+", M12="+i+", M21="+j+", M22="+k,u=d.x+q*d.xPercent/100,v=d.y+r*d.yPercent/100;if(null!=d.ox&&(n=(d.oxp?q*d.ox*.01:d.ox)-q/2,o=(d.oyp?r*d.oy*.01:d.oy)-r/2,u+=n-(n*h+o*i),v+=o-(n*j+o*k)),s?(n=q/2,o=r/2,t+=", Dx="+(n-(n*h+o*i)+u)+", Dy="+(o-(n*j+o*k)+v)+")"):t+=", sizingMethod='auto expand')",-1!==b.indexOf("DXImageTransform.Microsoft.Matrix(")?l.filter=b.replace(H,t):l.filter=t+" "+b,(0===a||1===a)&&1===h&&0===i&&0===j&&1===k&&(s&&-1===t.indexOf("Dx=0, Dy=0")||x.test(b)&&100!==parseFloat(RegExp.$1)||-1===b.indexOf(b.indexOf("Alpha"))&&l.removeAttribute("filter")),!s){var y,z,A,B=8>p?1:-1;for(n=d.ieOffsetX||0,o=d.ieOffsetY||0,d.ieOffsetX=Math.round((q-((0>h?-h:h)*q+(0>i?-i:i)*r))/2+u),d.ieOffsetY=Math.round((r-((0>k?-k:k)*r+(0>j?-j:j)*q))/2+v),xa=0;4>xa;xa++)z=ga[xa],y=m[z],c=-1!==y.indexOf("px")?parseFloat(y):ba(this.t,z,parseFloat(y),y.replace(w,""))||0,A=c!==d[z]?2>xa?-d.ieOffsetX:-d.ieOffsetY:2>xa?n-d.ieOffsetX:o-d.ieOffsetY,l[z]=(d[z]=Math.round(c-A*(0===xa||2===xa?1:B)))+"px"}}},Ua=S.set3DTransformRatio=S.setTransformRatio=function(a){var b,c,d,e,f,g,h,i,j,k,l,m,o,p,q,r,s,t,u,v,w,x,y,z=this.data,A=this.t.style,B=z.rotation,C=z.rotationX,D=z.rotationY,E=z.scaleX,F=z.scaleY,G=z.scaleZ,H=z.x,I=z.y,J=z.z,L=z.svg,M=z.perspective,N=z.force3D,O=z.skewY,P=z.skewX;if(O&&(P+=O,B+=O),((1===a||0===a)&&"auto"===N&&(this.tween._totalTime===this.tween._totalDuration||!this.tween._totalTime)||!N)&&!J&&!M&&!D&&!C&&1===G||Ba&&L||!Ga)return void(B||P||L?(B*=K,x=P*K,y=1e5,c=Math.cos(B)*E,f=Math.sin(B)*E,d=Math.sin(B-x)*-F,g=Math.cos(B-x)*F,x&&"simple"===z.skewType&&(b=Math.tan(x-O*K),b=Math.sqrt(1+b*b),d*=b,g*=b,O&&(b=Math.tan(O*K),b=Math.sqrt(1+b*b),c*=b,f*=b)),L&&(H+=z.xOrigin-(z.xOrigin*c+z.yOrigin*d)+z.xOffset,I+=z.yOrigin-(z.xOrigin*f+z.yOrigin*g)+z.yOffset,Ba&&(z.xPercent||z.yPercent)&&(q=this.t.getBBox(),H+=.01*z.xPercent*q.width,I+=.01*z.yPercent*q.height),q=1e-6,q>H&&H>-q&&(H=0),q>I&&I>-q&&(I=0)),u=(c*y|0)/y+","+(f*y|0)/y+","+(d*y|0)/y+","+(g*y|0)/y+","+H+","+I+")",L&&Ba?this.t.setAttribute("transform","matrix("+u):A[Da]=(z.xPercent||z.yPercent?"translate("+z.xPercent+"%,"+z.yPercent+"%) matrix(":"matrix(")+u):A[Da]=(z.xPercent||z.yPercent?"translate("+z.xPercent+"%,"+z.yPercent+"%) matrix(":"matrix(")+E+",0,0,"+F+","+H+","+I+")");if(n&&(q=1e-4,q>E&&E>-q&&(E=G=2e-5),q>F&&F>-q&&(F=G=2e-5),!M||z.z||z.rotationX||z.rotationY||(M=0)),B||P)B*=K,r=c=Math.cos(B),s=f=Math.sin(B),P&&(B-=P*K,r=Math.cos(B),s=Math.sin(B),"simple"===z.skewType&&(b=Math.tan((P-O)*K),b=Math.sqrt(1+b*b),r*=b,s*=b,z.skewY&&(b=Math.tan(O*K),b=Math.sqrt(1+b*b),c*=b,f*=b))),d=-s,g=r;else{if(!(D||C||1!==G||M||L))return void(A[Da]=(z.xPercent||z.yPercent?"translate("+z.xPercent+"%,"+z.yPercent+"%) translate3d(":"translate3d(")+H+"px,"+I+"px,"+J+"px)"+(1!==E||1!==F?" scale("+E+","+F+")":""));c=g=1,d=f=0}k=1,e=h=i=j=l=m=0,o=M?-1/M:0,p=z.zOrigin,q=1e-6,v=",",w="0",B=D*K,B&&(r=Math.cos(B),s=Math.sin(B),i=-s,l=o*-s,e=c*s,h=f*s,k=r,o*=r,c*=r,f*=r),B=C*K,B&&(r=Math.cos(B),s=Math.sin(B),b=d*r+e*s,t=g*r+h*s,j=k*s,m=o*s,e=d*-s+e*r,h=g*-s+h*r,k*=r,o*=r,d=b,g=t),1!==G&&(e*=G,h*=G,k*=G,o*=G),1!==F&&(d*=F,g*=F,j*=F,m*=F),1!==E&&(c*=E,f*=E,i*=E,l*=E),(p||L)&&(p&&(H+=e*-p,I+=h*-p,J+=k*-p+p),L&&(H+=z.xOrigin-(z.xOrigin*c+z.yOrigin*d)+z.xOffset,I+=z.yOrigin-(z.xOrigin*f+z.yOrigin*g)+z.yOffset),q>H&&H>-q&&(H=w),q>I&&I>-q&&(I=w),q>J&&J>-q&&(J=0)),u=z.xPercent||z.yPercent?"translate("+z.xPercent+"%,"+z.yPercent+"%) matrix3d(":"matrix3d(",u+=(q>c&&c>-q?w:c)+v+(q>f&&f>-q?w:f)+v+(q>i&&i>-q?w:i),u+=v+(q>l&&l>-q?w:l)+v+(q>d&&d>-q?w:d)+v+(q>g&&g>-q?w:g),C||D||1!==G?(u+=v+(q>j&&j>-q?w:j)+v+(q>m&&m>-q?w:m)+v+(q>e&&e>-q?w:e),u+=v+(q>h&&h>-q?w:h)+v+(q>k&&k>-q?w:k)+v+(q>o&&o>-q?w:o)+v):u+=",0,0,0,0,1,0,",u+=H+v+I+v+J+v+(M?1+-J/M:1)+")",A[Da]=u};j=Ha.prototype,j.x=j.y=j.z=j.skewX=j.skewY=j.rotation=j.rotationX=j.rotationY=j.zOrigin=j.xPercent=j.yPercent=j.xOffset=j.yOffset=0, j.scaleX=j.scaleY=j.scaleZ=1,za("transform,scale,scaleX,scaleY,scaleZ,x,y,z,rotation,rotationX,rotationY,rotationZ,skewX,skewY,shortRotation,shortRotationX,shortRotationY,shortRotationZ,transformOrigin,svgOrigin,transformPerspective,directionalRotation,parseTransform,force3D,skewType,xPercent,yPercent,smoothOrigin",{parser:function(a,b,c,d,f,h,i){if(d._lastParsedTransform===i)return f;d._lastParsedTransform=i;var j=i.scale&&"function"==typeof i.scale?i.scale:0;j&&(i.scale=j(r,a));var k,l,m,n,o,p,s,t,u,v=a._gsTransform,w=a.style,x=1e-6,y=Ca.length,z=i,A={},B="transformOrigin",C=Sa(a,e,!0,z.parseTransform),D=z.transform&&("function"==typeof z.transform?z.transform(r,q):z.transform);if(C.skewType=z.skewType||C.skewType||g.defaultSkewType,d._transform=C,"rotationZ"in z&&(z.rotation=z.rotationZ),D&&"string"==typeof D&&Da)l=Q.style,l[Da]=D,l.display="block",l.position="absolute",-1!==D.indexOf("%")&&(l.width=aa(a,"width"),l.height=aa(a,"height")),O.body.appendChild(Q),k=Sa(Q,null,!1),"simple"===C.skewType&&(k.scaleY*=Math.cos(k.skewX*K)),C.svg&&(p=C.xOrigin,s=C.yOrigin,k.x-=C.xOffset,k.y-=C.yOffset,(z.transformOrigin||z.svgOrigin)&&(D={},Ma(a,ia(z.transformOrigin),D,z.svgOrigin,z.smoothOrigin,!0),p=D.xOrigin,s=D.yOrigin,k.x-=D.xOffset-C.xOffset,k.y-=D.yOffset-C.yOffset),(p||s)&&(t=Ra(Q,!0),k.x-=p-(p*t[0]+s*t[2]),k.y-=s-(p*t[1]+s*t[3]))),O.body.removeChild(Q),k.perspective||(k.perspective=C.perspective),null!=z.xPercent&&(k.xPercent=ka(z.xPercent,C.xPercent)),null!=z.yPercent&&(k.yPercent=ka(z.yPercent,C.yPercent));else if("object"==typeof z){if(k={scaleX:ka(null!=z.scaleX?z.scaleX:z.scale,C.scaleX),scaleY:ka(null!=z.scaleY?z.scaleY:z.scale,C.scaleY),scaleZ:ka(z.scaleZ,C.scaleZ),x:ka(z.x,C.x),y:ka(z.y,C.y),z:ka(z.z,C.z),xPercent:ka(z.xPercent,C.xPercent),yPercent:ka(z.yPercent,C.yPercent),perspective:ka(z.transformPerspective,C.perspective)},o=z.directionalRotation,null!=o)if("object"==typeof o)for(l in o)z[l]=o[l];else z.rotation=o;"string"==typeof z.x&&-1!==z.x.indexOf("%")&&(k.x=0,k.xPercent=ka(z.x,C.xPercent)),"string"==typeof z.y&&-1!==z.y.indexOf("%")&&(k.y=0,k.yPercent=ka(z.y,C.yPercent)),k.rotation=la("rotation"in z?z.rotation:"shortRotation"in z?z.shortRotation+"_short":C.rotation,C.rotation,"rotation",A),Ga&&(k.rotationX=la("rotationX"in z?z.rotationX:"shortRotationX"in z?z.shortRotationX+"_short":C.rotationX||0,C.rotationX,"rotationX",A),k.rotationY=la("rotationY"in z?z.rotationY:"shortRotationY"in z?z.shortRotationY+"_short":C.rotationY||0,C.rotationY,"rotationY",A)),k.skewX=la(z.skewX,C.skewX),k.skewY=la(z.skewY,C.skewY)}for(Ga&&null!=z.force3D&&(C.force3D=z.force3D,n=!0),m=C.force3D||C.z||C.rotationX||C.rotationY||k.z||k.rotationX||k.rotationY||k.perspective,m||null==z.scale||(k.scaleZ=1);--y>-1;)u=Ca[y],D=k[u]-C[u],(D>x||-x>D||null!=z[u]||null!=M[u])&&(n=!0,f=new ua(C,u,C[u],D,f),u in A&&(f.e=A[u]),f.xs0=0,f.plugin=h,d._overwriteProps.push(f.n));return D="function"==typeof z.transformOrigin?z.transformOrigin(r,q):z.transformOrigin,C.svg&&(D||z.svgOrigin)&&(p=C.xOffset,s=C.yOffset,Ma(a,ia(D),k,z.svgOrigin,z.smoothOrigin),f=va(C,"xOrigin",(v?C:k).xOrigin,k.xOrigin,f,B),f=va(C,"yOrigin",(v?C:k).yOrigin,k.yOrigin,f,B),(p!==C.xOffset||s!==C.yOffset)&&(f=va(C,"xOffset",v?p:C.xOffset,C.xOffset,f,B),f=va(C,"yOffset",v?s:C.yOffset,C.yOffset,f,B)),D="0px 0px"),(D||Ga&&m&&C.zOrigin)&&(Da?(n=!0,u=Fa,D||(D=(aa(a,u,e,!1,"50% 50%")+"").split(" "),D=D[0]+" "+D[1]+" "+C.zOrigin+"px"),D+="",f=new ua(w,u,0,0,f,-1,B),f.b=w[u],f.plugin=h,Ga?(l=C.zOrigin,D=D.split(" "),C.zOrigin=(D.length>2?parseFloat(D[2]):l)||0,f.xs0=f.e=D[0]+" "+(D[1]||"50%")+" 0px",f=new ua(C,"zOrigin",0,0,f,-1,f.n),f.b=l,f.xs0=f.e=C.zOrigin):f.xs0=f.e=D):ia(D+"",C)),n&&(d._transformType=C.svg&&Ba||!m&&3!==this._transformType?2:3),j&&(i.scale=j),f},allowFunc:!0,prefix:!0}),za("boxShadow",{defaultValue:"0px 0px 0px 0px #999",prefix:!0,color:!0,multi:!0,keyword:"inset"}),za("clipPath",{defaultValue:"inset(0px)",prefix:!0,multi:!0,formatter:ra("inset(0px 0px 0px 0px)",!1,!0)}),za("borderRadius",{defaultValue:"0px",parser:function(a,b,c,f,g,h){b=this.format(b);var i,j,k,l,m,n,o,p,q,r,s,t,u,v,w,x,y=["borderTopLeftRadius","borderTopRightRadius","borderBottomRightRadius","borderBottomLeftRadius"],z=a.style;for(q=parseFloat(a.offsetWidth),r=parseFloat(a.offsetHeight),i=b.split(" "),j=0;j p?1:0))||""):(p=parseFloat(n),s=n.substr((p+"").length)),""===s&&(s=d[c]||t),s!==t&&(v=ba(a,"borderLeft",o,t),w=ba(a,"borderTop",o,t),"%"===s?(m=v/q*100+"%",l=w/r*100+"%"):"em"===s?(x=ba(a,"borderLeft",1,"em"),m=v/x+"em",l=w/x+"em"):(m=v+"px",l=w+"px"),u&&(n=parseFloat(m)+p+s,k=parseFloat(l)+p+s)),g=wa(z,y[j],m+" "+l,n+" "+k,!1,"0px",g);return g},prefix:!0,formatter:ra("0px 0px 0px 0px",!1,!0)}),za("borderBottomLeftRadius,borderBottomRightRadius,borderTopLeftRadius,borderTopRightRadius",{defaultValue:"0px",parser:function(a,b,c,d,f,g){return wa(a.style,c,this.format(aa(a,c,e,!1,"0px 0px")),this.format(b),!1,"0px",f)},prefix:!0,formatter:ra("0px 0px",!1,!0)}),za("backgroundPosition",{defaultValue:"0 0",parser:function(a,b,c,d,f,g){var h,i,j,k,l,m,n="background-position",o=e||_(a,null),q=this.format((o?p?o.getPropertyValue(n+"-x")+" "+o.getPropertyValue(n+"-y"):o.getPropertyValue(n):a.currentStyle.backgroundPositionX+" "+a.currentStyle.backgroundPositionY)||"0 0"),r=this.format(b);if(-1!==q.indexOf("%")!=(-1!==r.indexOf("%"))&&r.split(",").length<2&&(m=aa(a,"backgroundImage").replace(D,""),m&&"none"!==m)){for(h=q.split(" "),i=r.split(" "),R.setAttribute("src",m),j=2;--j>-1;)q=h[j],k=-1!==q.indexOf("%"),k!==(-1!==i[j].indexOf("%"))&&(l=0===j?a.offsetWidth-R.width:a.offsetHeight-R.height,h[j]=k?parseFloat(q)/100*l+"px":parseFloat(q)/l*100+"%");q=h.join(" ")}return this.parseComplex(a.style,q,r,f,g)},formatter:ia}),za("backgroundSize",{defaultValue:"0 0",formatter:function(a){return a+="","co"===a.substr(0,2)?a:ia(-1===a.indexOf(" ")?a+" "+a:a)}}),za("perspective",{defaultValue:"0px",prefix:!0}),za("perspectiveOrigin",{defaultValue:"50% 50%",prefix:!0}),za("transformStyle",{prefix:!0}),za("backfaceVisibility",{prefix:!0}),za("userSelect",{prefix:!0}),za("margin",{parser:sa("marginTop,marginRight,marginBottom,marginLeft")}),za("padding",{parser:sa("paddingTop,paddingRight,paddingBottom,paddingLeft")}),za("clip",{defaultValue:"rect(0px,0px,0px,0px)",parser:function(a,b,c,d,f,g){var h,i,j;return 9>p?(i=a.currentStyle,j=8>p?" ":",",h="rect("+i.clipTop+j+i.clipRight+j+i.clipBottom+j+i.clipLeft+")",b=this.format(b).split(",").join(j)):(h=this.format(aa(a,this.p,e,!1,this.dflt)),b=this.format(b)),this.parseComplex(a.style,h,b,f,g)}}),za("textShadow",{defaultValue:"0px 0px 0px #999",color:!0,multi:!0}),za("autoRound,strictUnits",{parser:function(a,b,c,d,e){return e}}),za("border",{defaultValue:"0px solid #000",parser:function(a,b,c,d,f,g){var h=aa(a,"borderTopWidth",e,!1,"0px"),i=this.format(b).split(" "),j=i[0].replace(w,"");return"px"!==j&&(h=parseFloat(h)/ba(a,"borderTopWidth",1,j)+j),this.parseComplex(a.style,this.format(h+" "+aa(a,"borderTopStyle",e,!1,"solid")+" "+aa(a,"borderTopColor",e,!1,"#000")),i.join(" "),f,g)},color:!0,formatter:function(a){var b=a.split(" ");return b[0]+" "+(b[1]||"solid")+" "+(a.match(qa)||["#000"])[0]}}),za("borderWidth",{parser:sa("borderTopWidth,borderRightWidth,borderBottomWidth,borderLeftWidth")}),za("float,cssFloat,styleFloat",{parser:function(a,b,c,d,e,f){var g=a.style,h="cssFloat"in g?"cssFloat":"styleFloat";return new ua(g,h,0,0,e,-1,c,!1,0,g[h],b)}});var Va=function(a){var b,c=this.t,d=c.filter||aa(this.data,"filter")||"",e=this.s+this.c*a|0;100===e&&(-1===d.indexOf("atrix(")&&-1===d.indexOf("radient(")&&-1===d.indexOf("oader(")?(c.removeAttribute("filter"),b=!aa(this.data,"filter")):(c.filter=d.replace(z,""),b=!0)),b||(this.xn1&&(c.filter=d=d||"alpha(opacity="+e+")"),-1===d.indexOf("pacity")?0===e&&this.xn1||(c.filter=d+" alpha(opacity="+e+")"):c.filter=d.replace(x,"opacity="+e))};za("opacity,alpha,autoAlpha",{defaultValue:"1",parser:function(a,b,c,d,f,g){var h=parseFloat(aa(a,"opacity",e,!1,"1")),i=a.style,j="autoAlpha"===c;return"string"==typeof b&&"="===b.charAt(1)&&(b=("-"===b.charAt(0)?-1:1)*parseFloat(b.substr(2))+h),j&&1===h&&"hidden"===aa(a,"visibility",e)&&0!==b&&(h=0),U?f=new ua(i,"opacity",h,b-h,f):(f=new ua(i,"opacity",100*h,100*(b-h),f),f.xn1=j?1:0,i.zoom=1,f.type=2,f.b="alpha(opacity="+f.s+")",f.e="alpha(opacity="+(f.s+f.c)+")",f.data=a,f.plugin=g,f.setRatio=Va),j&&(f=new ua(i,"visibility",0,0,f,-1,null,!1,0,0!==h?"inherit":"hidden",0===b?"hidden":"inherit"),f.xs0="inherit",d._overwriteProps.push(f.n),d._overwriteProps.push(c)),f}});var Wa=function(a,b){b&&(a.removeProperty?(("ms"===b.substr(0,2)||"webkit"===b.substr(0,6))&&(b="-"+b),a.removeProperty(b.replace(B,"-$1").toLowerCase())):a.removeAttribute(b))},Xa=function(a){if(this.t._gsClassPT=this,1===a||0===a){this.t.setAttribute("class",0===a?this.b:this.e);for(var b=this.data,c=this.t.style;b;)b.v?c[b.p]=b.v:Wa(c,b.p),b=b._next;1===a&&this.t._gsClassPT===this&&(this.t._gsClassPT=null)}else this.t.getAttribute("class")!==this.e&&this.t.setAttribute("class",this.e)};za("className",{parser:function(a,b,d,f,g,h,i){var j,k,l,m,n,o=a.getAttribute("class")||"",p=a.style.cssText;if(g=f._classNamePT=new ua(a,d,0,0,g,2),g.setRatio=Xa,g.pr=-11,c=!0,g.b=o,k=da(a,e),l=a._gsClassPT){for(m={},n=l.data;n;)m[n.p]=1,n=n._next;l.setRatio(1)}return a._gsClassPT=g,g.e="="!==b.charAt(1)?b:o.replace(new RegExp("(?:\\s|^)"+b.substr(2)+"(?![\\w-])"),"")+("+"===b.charAt(0)?" "+b.substr(2):""),a.setAttribute("class",g.e),j=ea(a,k,da(a),i,m),a.setAttribute("class",o),g.data=j.firstMPT,a.style.cssText=p,g=g.xfirst=f.parse(a,j.difs,g,h)}});var Ya=function(a){if((1===a||0===a)&&this.data._totalTime===this.data._totalDuration&&"isFromStart"!==this.data.data){var b,c,d,e,f,g=this.t.style,h=i.transform.parse;if("all"===this.e)g.cssText="",e=!0;else for(b=this.e.split(" ").join("").split(","),d=b.length;--d>-1;)c=b[d],i[c]&&(i[c].parse===h?e=!0:c="transformOrigin"===c?Fa:i[c].p),Wa(g,c);e&&(Wa(g,Da),f=this.t._gsTransform,f&&(f.svg&&(this.t.removeAttribute("data-svg-origin"),this.t.removeAttribute("transform")),delete this.t._gsTransform))}};for(za("clearProps",{parser:function(a,b,d,e,f){return f=new ua(a,d,0,0,f,2),f.setRatio=Ya,f.e=b,f.pr=-10,f.data=e._tween,c=!0,f}}),j="bezier,throwProps,physicsProps,physics2D".split(","),xa=j.length;xa--;)Aa(j[xa]);j=g.prototype,j._firstPT=j._lastParsedTransform=j._transform=null,j._onInitTween=function(a,b,h,j){if(!a.nodeType)return!1;this._target=q=a,this._tween=h,this._vars=b,r=j,k=b.autoRound,c=!1,d=b.suffixMap||g.suffixMap,e=_(a,""),f=this._overwriteProps;var n,p,s,t,u,v,w,x,z,A=a.style;if(l&&""===A.zIndex&&(n=aa(a,"zIndex",e),("auto"===n||""===n)&&this._addLazySet(A,"zIndex",0)),"string"==typeof b&&(t=A.cssText,n=da(a,e),A.cssText=t+";"+b,n=ea(a,n,da(a)).difs,!U&&y.test(b)&&(n.opacity=parseFloat(RegExp.$1)),b=n,A.cssText=t),b.className?this._firstPT=p=i.className.parse(a,b.className,"className",this,null,null,b):this._firstPT=p=this.parse(a,b,null),this._transformType){for(z=3===this._transformType,Da?m&&(l=!0,""===A.zIndex&&(w=aa(a,"zIndex",e),("auto"===w||""===w)&&this._addLazySet(A,"zIndex",0)),o&&this._addLazySet(A,"WebkitBackfaceVisibility",this._vars.WebkitBackfaceVisibility||(z?"visible":"hidden"))):A.zoom=1,s=p;s&&s._next;)s=s._next;x=new ua(a,"transform",0,0,null,2),this._linkCSSP(x,null,s),x.setRatio=Da?Ua:Ta,x.data=this._transform||Sa(a,e,!0),x.tween=h,x.pr=-1,f.pop()}if(c){for(;p;){for(v=p._next,s=t;s&&s.pr>p.pr;)s=s._next;(p._prev=s?s._prev:u)?p._prev._next=p:t=p,(p._next=s)?s._prev=p:u=p,p=v}this._firstPT=t}return!0},j.parse=function(a,b,c,f){var g,h,j,l,m,n,o,p,s,t,u=a.style;for(g in b){if(n=b[g],h=i[g],"function"!=typeof n||h&&h.allowFunc||(n=n(r,q)),h)c=h.parse(a,n,g,this,c,f,b);else{if("--"===g.substr(0,2)){this._tween._propLookup[g]=this._addTween.call(this._tween,a.style,"setProperty",_(a).getPropertyValue(g)+"",n+"",g,!1,g);continue}m=aa(a,g,e)+"",s="string"==typeof n,"color"===g||"fill"===g||"stroke"===g||-1!==g.indexOf("Color")||s&&A.test(n)?(s||(n=oa(n),n=(n.length>3?"rgba(":"rgb(")+n.join(",")+")"),c=wa(u,g,m,n,!0,"transparent",c,0,f)):s&&J.test(n)?c=wa(u,g,m,n,!0,null,c,0,f):(j=parseFloat(m),o=j||0===j?m.substr((j+"").length):"",(""===m||"auto"===m)&&("width"===g||"height"===g?(j=ha(a,g,e),o="px"):"left"===g||"top"===g?(j=ca(a,g,e),o="px"):(j="opacity"!==g?0:1,o="")),t=s&&"="===n.charAt(1),t?(l=parseInt(n.charAt(0)+"1",10),n=n.substr(2),l*=parseFloat(n),p=n.replace(w,"")):(l=parseFloat(n),p=s?n.replace(w,""):""),""===p&&(p=g in d?d[g]:o),n=l||0===l?(t?l+j:l)+p:b[g],o!==p&&(""!==p||"lineHeight"===g)&&(l||0===l)&&j&&(j=ba(a,g,j,o),"%"===p?(j/=ba(a,g,100,"%")/100,b.strictUnits!==!0&&(m=j+"%")):"em"===p||"rem"===p||"vw"===p||"vh"===p?j/=ba(a,g,1,p):"px"!==p&&(l=ba(a,g,l,p),p="px"),t&&(l||0===l)&&(n=l+j+p)),t&&(l+=j),!j&&0!==j||!l&&0!==l?void 0!==u[g]&&(n||n+""!="NaN"&&null!=n)?(c=new ua(u,g,l||j||0,0,c,-1,g,!1,0,m,n),c.xs0="none"!==n||"display"!==g&&-1===g.indexOf("Style")?n:m):W("invalid "+g+" tween value: "+b[g]):(c=new ua(u,g,j,l-j,c,0,g,k!==!1&&("px"===p||"zIndex"===g),0,m,n),c.xs0=p))}f&&c&&!c.plugin&&(c.plugin=f)}return c},j.setRatio=function(a){var b,c,d,e=this._firstPT,f=1e-6;if(1!==a||this._tween._time!==this._tween._duration&&0!==this._tween._time)if(a||this._tween._time!==this._tween._duration&&0!==this._tween._time||this._tween._rawPrevTime===-1e-6)for(;e;){if(b=e.c*a+e.s,e.r?b=e.r(b):f>b&&b>-f&&(b=0),e.type)if(1===e.type)if(d=e.l,2===d)e.t[e.p]=e.xs0+b+e.xs1+e.xn1+e.xs2;else if(3===d)e.t[e.p]=e.xs0+b+e.xs1+e.xn1+e.xs2+e.xn2+e.xs3;else if(4===d)e.t[e.p]=e.xs0+b+e.xs1+e.xn1+e.xs2+e.xn2+e.xs3+e.xn3+e.xs4;else if(5===d)e.t[e.p]=e.xs0+b+e.xs1+e.xn1+e.xs2+e.xn2+e.xs3+e.xn3+e.xs4+e.xn4+e.xs5;else{for(c=e.xs0+b+e.xs1,d=1;d -1;)$a(a[e],b,c);else for(d=a.childNodes,e=d.length;--e>-1;)f=d[e],g=f.type,f.style&&(b.push(da(f)),c&&c.push(f)),1!==g&&9!==g&&11!==g||!f.childNodes.length||$a(f,b,c)};return g.cascadeTo=function(a,c,d){var e,f,g,h,i=b.to(a,c,d),j=[i],k=[],l=[],m=[],n=b._internals.reservedProps;for(a=i._targets||i.target,$a(a,k,m),i.render(c,!0,!0),$a(a,l),i.render(0,!0,!0),i._enabled(!0),e=m.length;--e>-1;)if(f=ea(m[e],k[e],l[e]),f.firstMPT){f=f.difs;for(g in d)n[g]&&(f[g]=d[g]);h={};for(g in f)h[g]=k[e][g];j.push(b.fromTo(m[e],c,h,f))}return j},a.activate([g]),g},!0),function(){var a=_gsScope._gsDefine.plugin({propName:"roundProps",version:"1.7.0",priority:-1,API:2,init:function(a,b,c){return this._tween=c,!0}}),b=function(a){var b=1>a?Math.pow(10,(a+"").length-2):1;return function(c){return(Math.round(c/a)*a*b|0)/b}},c=function(a,b){for(;a;)a.f||a.blob||(a.m=b||Math.round),a=a._next},d=a.prototype;d._onInitAllProps=function(){var a,d,e,f,g=this._tween,h=g.vars.roundProps,i={},j=g._propLookup.roundProps;if("object"!=typeof h||h.push)for("string"==typeof h&&(h=h.split(",")),e=h.length;--e>-1;)i[h[e]]=Math.round;else for(f in h)i[f]=b(h[f]);for(f in i)for(a=g._firstPT;a;)d=a._next,a.pg?a.t._mod(i):a.n===f&&(2===a.f&&a.t?c(a.t._firstPT,i[f]):(this._add(a.t,f,a.s,a.c,i[f]),d&&(d._prev=a._prev),a._prev?a._prev._next=d:g._firstPT===a&&(g._firstPT=d),a._next=a._prev=null,g._propLookup[f]=j)),a=d;return!1},d._add=function(a,b,c,d,e){this._addTween(a,b,c,c+d,b,e||Math.round),this._overwriteProps.push(b)}}(),function(){_gsScope._gsDefine.plugin({propName:"attr",API:2,version:"0.6.1",init:function(a,b,c,d){var e,f;if("function"!=typeof a.setAttribute)return!1;for(e in b)f=b[e],"function"==typeof f&&(f=f(d,a)),this._addTween(a,"setAttribute",a.getAttribute(e)+"",f+"",e,!1,e),this._overwriteProps.push(e);return!0}})}(),_gsScope._gsDefine.plugin({propName:"directionalRotation",version:"0.3.1",API:2,init:function(a,b,c,d){"object"!=typeof b&&(b={rotation:b}),this.finals={};var e,f,g,h,i,j,k=b.useRadians===!0?2*Math.PI:360,l=1e-6;for(e in b)"useRadians"!==e&&(h=b[e],"function"==typeof h&&(h=h(d,a)),j=(h+"").split("_"),f=j[0],g=parseFloat("function"!=typeof a[e]?a[e]:a[e.indexOf("set")||"function"!=typeof a["get"+e.substr(3)]?e:"get"+e.substr(3)]()),h=this.finals[e]="string"==typeof f&&"="===f.charAt(1)?g+parseInt(f.charAt(0)+"1",10)*Number(f.substr(2)):Number(f)||0,i=h-g,j.length&&(f=j.join("_"),-1!==f.indexOf("short")&&(i%=k,i!==i%(k/2)&&(i=0>i?i+k:i-k)),-1!==f.indexOf("_cw")&&0>i?i=(i+9999999999*k)%k-(i/k|0)*k:-1!==f.indexOf("ccw")&&i>0&&(i=(i-9999999999*k)%k-(i/k|0)*k)),(i>l||-l>i)&&(this._addTween(a,e,g,g+i,e),this._overwriteProps.push(e)));return!0},set:function(a){var b;if(1!==a)this._super.setRatio.call(this,a);else for(b=this._firstPT;b;)b.f?b.t[b.p](this.finals[b.p]):b.t[b.p]=this.finals[b.p],b=b._next}})._autoCSS=!0,_gsScope._gsDefine("easing.Back",["easing.Ease"],function(a){var b,c,d,e,f=_gsScope.GreenSockGlobals||_gsScope,g=f.com.greensock,h=2*Math.PI,i=Math.PI/2,j=g._class,k=function(b,c){var d=j("easing."+b,function(){},!0),e=d.prototype=new a;return e.constructor=d,e.getRatio=c,d},l=a.register||function(){},m=function(a,b,c,d,e){var f=j("easing."+a,{easeOut:new b,easeIn:new c,easeInOut:new d},!0);return l(f,a),f},n=function(a,b,c){this.t=a,this.v=b,c&&(this.next=c,c.prev=this,this.c=c.v-b,this.gap=c.t-a)},o=function(b,c){var d=j("easing."+b,function(a){this._p1=a||0===a?a:1.70158,this._p2=1.525*this._p1},!0),e=d.prototype=new a;return e.constructor=d,e.getRatio=c,e.config=function(a){return new d(a)},d},p=m("Back",o("BackOut",function(a){return(a-=1)*a*((this._p1+1)*a+this._p1)+1}),o("BackIn",function(a){return a*a*((this._p1+1)*a-this._p1)}),o("BackInOut",function(a){return(a*=2)<1?.5*a*a*((this._p2+1)*a-this._p2):.5*((a-=2)*a*((this._p2+1)*a+this._p2)+2)})),q=j("easing.SlowMo",function(a,b,c){b=b||0===b?b:.7,null==a?a=.7:a>1&&(a=1),this._p=1!==a?b:0,this._p1=(1-a)/2,this._p2=a,this._p3=this._p1+this._p2,this._calcEnd=c===!0},!0),r=q.prototype=new a;return r.constructor=q,r.getRatio=function(a){var b=a+(.5-a)*this._p;return a this._p3?this._calcEnd?1===a?0:1-(a=(a-this._p3)/this._p1)*a:b+(a-b)*(a=(a-this._p3)/this._p1)*a*a*a:this._calcEnd?1:b},q.ease=new q(.7,.7),r.config=q.config=function(a,b,c){return new q(a,b,c)},b=j("easing.SteppedEase",function(a,b){a=a||1,this._p1=1/a,this._p2=a+(b?0:1),this._p3=b?1:0},!0),r=b.prototype=new a,r.constructor=b,r.getRatio=function(a){return 0>a?a=0:a>=1&&(a=.999999999),((this._p2*a|0)+this._p3)*this._p1},r.config=b.config=function(a,c){return new b(a,c)},c=j("easing.ExpoScaleEase",function(a,b,c){this._p1=Math.log(b/a),this._p2=b-a,this._p3=a,this._ease=c},!0),r=c.prototype=new a,r.constructor=c,r.getRatio=function(a){return this._ease&&(a=this._ease.getRatio(a)),(this._p3*Math.exp(this._p1*a)-this._p3)/this._p2},r.config=c.config=function(a,b,d){return new c(a,b,d)},d=j("easing.RoughEase",function(b){b=b||{};for(var c,d,e,f,g,h,i=b.taper||"none",j=[],k=0,l=0|(b.points||20),m=l,o=b.randomize!==!1,p=b.clamp===!0,q=b.template instanceof a?b.template:null,r="number"==typeof b.strength?.4*b.strength:.4;--m>-1;)c=o?Math.random():1/l*m,d=q?q.getRatio(c):c,"none"===i?e=r:"out"===i?(f=1-c,e=f*f*r):"in"===i?e=c*c*r:.5>c?(f=2*c,e=f*f*.5*r):(f=2*(1-c),e=f*f*.5*r),o?d+=Math.random()*e-.5*e:m%2?d+=.5*e:d-=.5*e,p&&(d>1?d=1:0>d&&(d=0)),j[k++]={x:c,y:d};for(j.sort(function(a,b){return a.x-b.x}),h=new n(1,1,null),m=l;--m>-1;)g=j[m],h=new n(g.x,g.y,h);this._prev=new n(0,0,0!==h.t?h:h.next)},!0),r=d.prototype=new a,r.constructor=d,r.getRatio=function(a){var b=this._prev;if(a>b.t){for(;b.next&&a>=b.t;)b=b.next;b=b.prev}else for(;b.prev&&a<=b.t;)b=b.prev;return this._prev=b,b.v+(a-b.t)/b.gap*b.c},r.config=function(a){return new d(a)},d.ease=new d,m("Bounce",k("BounceOut",function(a){return 1/2.75>a?7.5625*a*a:2/2.75>a?7.5625*(a-=1.5/2.75)*a+.75:2.5/2.75>a?7.5625*(a-=2.25/2.75)*a+.9375:7.5625*(a-=2.625/2.75)*a+.984375}),k("BounceIn",function(a){return(a=1-a)<1/2.75?1-7.5625*a*a:2/2.75>a?1-(7.5625*(a-=1.5/2.75)*a+.75):2.5/2.75>a?1-(7.5625*(a-=2.25/2.75)*a+.9375):1-(7.5625*(a-=2.625/2.75)*a+.984375)}),k("BounceInOut",function(a){var b=.5>a;return a=b?1-2*a:2*a-1,a=1/2.75>a?7.5625*a*a:2/2.75>a?7.5625*(a-=1.5/2.75)*a+.75:2.5/2.75>a?7.5625*(a-=2.25/2.75)*a+.9375:7.5625*(a-=2.625/2.75)*a+.984375,b?.5*(1-a):.5*a+.5})),m("Circ",k("CircOut",function(a){return Math.sqrt(1-(a-=1)*a)}),k("CircIn",function(a){return-(Math.sqrt(1-a*a)-1)}),k("CircInOut",function(a){return(a*=2)<1?-.5*(Math.sqrt(1-a*a)-1):.5*(Math.sqrt(1-(a-=2)*a)+1)})),e=function(b,c,d){var e=j("easing."+b,function(a,b){this._p1=a>=1?a:1,this._p2=(b||d)/(1>a?a:1),this._p3=this._p2/h*(Math.asin(1/this._p1)||0),this._p2=h/this._p2},!0),f=e.prototype=new a;return f.constructor=e,f.getRatio=c,f.config=function(a,b){return new e(a,b)},e},m("Elastic",e("ElasticOut",function(a){return this._p1*Math.pow(2,-10*a)*Math.sin((a-this._p3)*this._p2)+1},.3),e("ElasticIn",function(a){return-(this._p1*Math.pow(2,10*(a-=1))*Math.sin((a-this._p3)*this._p2))},.3),e("ElasticInOut",function(a){return(a*=2)<1?-.5*(this._p1*Math.pow(2,10*(a-=1))*Math.sin((a-this._p3)*this._p2)):this._p1*Math.pow(2,-10*(a-=1))*Math.sin((a-this._p3)*this._p2)*.5+1},.45)),m("Expo",k("ExpoOut",function(a){return 1-Math.pow(2,-10*a)}),k("ExpoIn",function(a){return Math.pow(2,10*(a-1))-.001}),k("ExpoInOut",function(a){return(a*=2)<1?.5*Math.pow(2,10*(a-1)):.5*(2-Math.pow(2,-10*(a-1)))})),m("Sine",k("SineOut",function(a){return Math.sin(a*i)}),k("SineIn",function(a){return-Math.cos(a*i)+1}),k("SineInOut",function(a){return-.5*(Math.cos(Math.PI*a)-1)})),j("easing.EaseLookup",{find:function(b){return a.map[b]}},!0),l(f.SlowMo,"SlowMo","ease,"),l(d,"RoughEase","ease,"),l(b,"SteppedEase","ease,"),p},!0)}),_gsScope._gsDefine&&_gsScope._gsQueue.pop()(),function(a,b){"use strict";var c={},d=a.document,e=a.GreenSockGlobals=a.GreenSockGlobals||a,f=e[b];if(f)return"undefined"!=typeof module&&module.exports&&(module.exports=f),f;var g,h,i,j,k,l=function(a){var b,c=a.split("."),d=e;for(b=0;b -1;)(k=r[f[p]]||new s(f[p],[])).gsClass?(i[p]=k.gsClass,q--):j&&k.sc.push(this);if(0===q&&g){if(m=("com.greensock."+d).split("."),n=m.pop(),o=l(m.join("."))[n]=this.gsClass=g.apply(g,i),h)if(e[n]=c[n]=o,"undefined"!=typeof module&&module.exports)if(d===b){module.exports=c[b]=o;for(p in c)o[p]=c[p]}else c[b]&&(c[b][n]=o);else"function"==typeof define&&define.amd&&define((a.GreenSockAMDPath?a.GreenSockAMDPath+"/":"")+d.split(".").pop(),[],function(){return o});for(p=0;p -1;)for(f=i[j],e=d?u("easing."+f,null,!0):m.easing[f]||{},g=k.length;--g>-1;)h=k[g],x[f+"."+h]=x[h+f]=e[h]=a.getRatio?a:a[h]||new a};for(i=w.prototype,i._calcEnd=!1,i.getRatio=function(a){if(this._func)return this._params[0]=a,this._func.apply(null,this._params);var b=this._type,c=this._power,d=1===b?1-a:2===b?a:.5>a?2*a:2*(1-a);return 1===c?d*=d:2===c?d*=d*d:3===c?d*=d*d*d:4===c&&(d*=d*d*d*d),1===b?1-d:2===b?d:.5>a?d/2:1-d/2},g=["Linear","Quad","Cubic","Quart","Quint,Strong"],h=g.length;--h>-1;)i=g[h]+",Power"+h,y(new w(null,null,1,h),i,"easeOut",!0),y(new w(null,null,2,h),i,"easeIn"+(0===h?",easeNone":"")),y(new w(null,null,3,h),i,"easeInOut");x.linear=m.easing.Linear.easeIn,x.swing=m.easing.Quad.easeInOut;var z=u("events.EventDispatcher",function(a){this._listeners={},this._eventTarget=a||this});i=z.prototype,i.addEventListener=function(a,b,c,d,e){e=e||0;var f,g,h=this._listeners[a],i=0;for(this!==j||k||j.wake(),null==h&&(this._listeners[a]=h=[]),g=h.length;--g>-1;)f=h[g],f.c===b&&f.s===c?h.splice(g,1):0===i&&f.pr -1;)if(d[c].c===b)return void d.splice(c,1)},i.dispatchEvent=function(a){var b,c,d,e=this._listeners[a];if(e)for(b=e.length,b>1&&(e=e.slice(0)),c=this._eventTarget;--b>-1;)d=e[b],d&&(d.up?d.c.call(d.s||c,{type:a,target:c}):d.c.call(d.s||c))};var A=a.requestAnimationFrame,B=a.cancelAnimationFrame,C=Date.now||function(){return(new Date).getTime()},D=C();for(g=["ms","moz","webkit","o"],h=g.length;--h>-1&&!A;)A=a[g[h]+"RequestAnimationFrame"],B=a[g[h]+"CancelAnimationFrame"]||a[g[h]+"CancelRequestAnimationFrame"];u("Ticker",function(a,b){var c,e,f,g,h,i=this,l=C(),m=b!==!1&&A?"auto":!1,o=500,q=33,r="tick",s=function(a){var b,d,j=C()-D;j>o&&(l+=j-q),D+=j,i.time=(D-l)/1e3,b=i.time-h,(!c||b>0||a===!0)&&(i.frame++,h+=b+(b>=g?.004:g-b),d=!0),a!==!0&&(f=e(s)),d&&i.dispatchEvent(r)};z.call(i),i.time=i.frame=0,i.tick=function(){s(!0)},i.lagSmoothing=function(a,b){return arguments.length?(o=a||1/n,void(q=Math.min(b,o,0))):1/n>o},i.sleep=function(){null!=f&&(m&&B?B(f):clearTimeout(f),e=p,f=null,i===j&&(k=!1))},i.wake=function(a){null!==f?i.sleep():a?l+=-D+(D=C()):i.frame>10&&(D=C()-o+5),e=0===c?p:m&&A?A:function(a){return setTimeout(a,1e3*(h-i.time)+1|0)},i===j&&(k=!0),s(2)},i.fps=function(a){return arguments.length?(c=a,g=1/(c||60),h=this.time+g,void i.wake()):c},i.useRAF=function(a){return arguments.length?(i.sleep(),m=a,void i.fps(c)):m},i.fps(a),setTimeout(function(){"auto"===m&&i.frame<5&&"hidden"!==(d||{}).visibilityState&&i.useRAF(!1)},1500)}),i=m.Ticker.prototype=new m.events.EventDispatcher,i.constructor=m.Ticker;var E=u("core.Animation",function(a,b){if(this.vars=b=b||{},this._duration=this._totalDuration=a||0,this._delay=Number(b.delay)||0,this._timeScale=1,this._active=!!b.immediateRender,this.data=b.data,this._reversed=!!b.reversed,Z){k||j.wake();var c=this.vars.useFrames?Y:Z;c.add(this,c._time),this.vars.paused&&this.paused(!0)}});j=E.ticker=new m.Ticker,i=E.prototype,i._dirty=i._gc=i._initted=i._paused=!1,i._totalTime=i._time=0,i._rawPrevTime=-1,i._next=i._last=i._onUpdate=i._timeline=i.timeline=null,i._paused=!1;var F=function(){k&&C()-D>2e3&&("hidden"!==(d||{}).visibilityState||!j.lagSmoothing())&&j.wake();var a=setTimeout(F,2e3);a.unref&&a.unref()};F(),i.play=function(a,b){return null!=a&&this.seek(a,b),this.reversed(!1).paused(!1)},i.pause=function(a,b){return null!=a&&this.seek(a,b),this.paused(!0)},i.resume=function(a,b){return null!=a&&this.seek(a,b),this.paused(!1)},i.seek=function(a,b){return this.totalTime(Number(a),b!==!1)},i.restart=function(a,b){return this.reversed(!1).paused(!1).totalTime(a?-this._delay:0,b!==!1,!0)},i.reverse=function(a,b){return null!=a&&this.seek(a||this.totalDuration(),b),this.reversed(!0).paused(!1)},i.render=function(a,b,c){},i.invalidate=function(){return this._time=this._totalTime=0,this._initted=this._gc=!1,this._rawPrevTime=-1,(this._gc||!this.timeline)&&this._enabled(!0),this},i.isActive=function(){var a,b=this._timeline,c=this._startTime;return!b||!this._gc&&!this._paused&&b.isActive()&&(a=b.rawTime(!0))>=c&&a -1;)"{self}"===a[b]&&(c[b]=this);return c},i._callback=function(a){var b=this.vars,c=b[a],d=b[a+"Params"],e=b[a+"Scope"]||b.callbackScope||this,f=d?d.length:0;switch(f){case 0:c.call(e);break;case 1:c.call(e,d[0]);break;case 2:c.call(e,d[0],d[1]);break;default:c.apply(e,d)}},i.eventCallback=function(a,b,c,d){if("on"===(a||"").substr(0,2)){var e=this.vars;if(1===arguments.length)return e[a];null==b?delete e[a]:(e[a]=b,e[a+"Params"]=q(c)&&-1!==c.join("").indexOf("{self}")?this._swapSelfInParams(c):c,e[a+"Scope"]=d),"onUpdate"===a&&(this._onUpdate=b)}return this},i.delay=function(a){return arguments.length?(this._timeline.smoothChildTiming&&this.startTime(this._startTime+a-this._delay),this._delay=a,this):this._delay},i.duration=function(a){return arguments.length?(this._duration=this._totalDuration=a,this._uncache(!0),this._timeline.smoothChildTiming&&this._time>0&&this._time this._duration?this._duration:a,b)):this._time},i.totalTime=function(a,b,c){if(k||j.wake(),!arguments.length)return this._totalTime;if(this._timeline){if(0>a&&!c&&(a+=this.totalDuration()),this._timeline.smoothChildTiming){this._dirty&&this.totalDuration();var d=this._totalDuration,e=this._timeline;if(a>d&&!c&&(a=d),this._startTime=(this._paused?this._pauseTime:e._time)-(this._reversed?d-a:a)/this._timeScale,e._dirty||this._uncache(!1),e._timeline)for(;e._timeline;)e._timeline._time!==(e._startTime+e._totalTime)/e._timeScale&&e.totalTime(e._totalTime,!0),e=e._timeline}this._gc&&this._enabled(!0,!1),(this._totalTime!==a||0===this._duration)&&(K.length&&_(),this.render(a,b,!1),K.length&&_())}return this},i.progress=i.totalProgress=function(a,b){var c=this.duration();return arguments.length?this.totalTime(c*a,b):c?this._time/c:this.ratio; },i.startTime=function(a){return arguments.length?(a!==this._startTime&&(this._startTime=a,this.timeline&&this.timeline._sortChildren&&this.timeline.add(this,a-this._delay)),this):this._startTime},i.endTime=function(a){return this._startTime+(0!=a?this.totalDuration():this.duration())/this._timeScale},i.timeScale=function(a){if(!arguments.length)return this._timeScale;var b,c;for(a=a||n,this._timeline&&this._timeline.smoothChildTiming&&(b=this._pauseTime,c=b||0===b?b:this._timeline.totalTime(),this._startTime=c-(c-this._startTime)*this._timeScale/a),this._timeScale=a,c=this.timeline;c&&c.timeline;)c._dirty=!0,c.totalDuration(),c=c.timeline;return this},i.reversed=function(a){return arguments.length?(a!=this._reversed&&(this._reversed=a,this.totalTime(this._timeline&&!this._timeline.smoothChildTiming?this.totalDuration()-this._totalTime:this._totalTime,!0)),this):this._reversed},i.paused=function(a){if(!arguments.length)return this._paused;var b,c,d=this._timeline;return a!=this._paused&&d&&(k||a||j.wake(),b=d.rawTime(),c=b-this._pauseTime,!a&&d.smoothChildTiming&&(this._startTime+=c,this._uncache(!1)),this._pauseTime=a?b:null,this._paused=a,this._active=this.isActive(),!a&&0!==c&&this._initted&&this.duration()&&(b=d.smoothChildTiming?this._totalTime:(b-this._startTime)/this._timeScale,this.render(b,b===this._totalTime,!0))),this._gc&&!a&&this._enabled(!0,!1),this};var G=u("core.SimpleTimeline",function(a){E.call(this,0,a),this.autoRemoveChildren=this.smoothChildTiming=!0});i=G.prototype=new E,i.constructor=G,i.kill()._gc=!1,i._first=i._last=i._recent=null,i._sortChildren=!1,i.add=i.insert=function(a,b,c,d){var e,f;if(a._startTime=Number(b||0)+a._delay,a._paused&&this!==a._timeline&&(a._pauseTime=this.rawTime()-(a._timeline.rawTime()-a._pauseTime)),a.timeline&&a.timeline._remove(a,!0),a.timeline=a._timeline=this,a._gc&&a._enabled(!0,!0),e=this._last,this._sortChildren)for(f=a._startTime;e&&e._startTime>f;)e=e._prev;return e?(a._next=e._next,e._next=a):(a._next=this._first,this._first=a),a._next?a._next._prev=a:this._last=a,a._prev=e,this._recent=a,this._timeline&&this._uncache(!0),this},i._remove=function(a,b){return a.timeline===this&&(b||a._enabled(!1,!0),a._prev?a._prev._next=a._next:this._first===a&&(this._first=a._next),a._next?a._next._prev=a._prev:this._last===a&&(this._last=a._prev),a._next=a._prev=a.timeline=null,a===this._recent&&(this._recent=this._last),this._timeline&&this._uncache(!0)),this},i.render=function(a,b,c){var d,e=this._first;for(this._totalTime=this._time=this._rawPrevTime=a;e;)d=e._next,(e._active||a>=e._startTime&&!e._paused&&!e._gc)&&(e._reversed?e.render((e._dirty?e.totalDuration():e._totalDuration)-(a-e._startTime)*e._timeScale,b,c):e.render((a-e._startTime)*e._timeScale,b,c)),e=d},i.rawTime=function(){return k||j.wake(),this._totalTime};var H=u("TweenLite",function(b,c,d){if(E.call(this,c,d),this.render=H.prototype.render,null==b)throw"Cannot tween a null target.";this.target=b="string"!=typeof b?b:H.selector(b)||b;var e,f,g,h=b.jquery||b.length&&b!==a&&b[0]&&(b[0]===a||b[0].nodeType&&b[0].style&&!b.nodeType),i=this.vars.overwrite;if(this._overwrite=i=null==i?X[H.defaultOverwrite]:"number"==typeof i?i>>0:X[i],(h||b instanceof Array||b.push&&q(b))&&"number"!=typeof b[0])for(this._targets=g=o(b),this._propLookup=[],this._siblings=[],e=0;e 1&&ca(f,this,null,1,this._siblings[e])):(f=g[e--]=H.selector(f),"string"==typeof f&&g.splice(e+1,1)):g.splice(e--,1);else this._propLookup={},this._siblings=aa(b,this,!1),1===i&&this._siblings.length>1&&ca(b,this,null,1,this._siblings);(this.vars.immediateRender||0===c&&0===this._delay&&this.vars.immediateRender!==!1)&&(this._time=-n,this.render(Math.min(0,-this._delay)))},!0),I=function(b){return b&&b.length&&b!==a&&b[0]&&(b[0]===a||b[0].nodeType&&b[0].style&&!b.nodeType)},J=function(a,b){var c,d={};for(c in a)W[c]||c in b&&"transform"!==c&&"x"!==c&&"y"!==c&&"width"!==c&&"height"!==c&&"className"!==c&&"border"!==c||!(!T[c]||T[c]&&T[c]._autoCSS)||(d[c]=a[c],delete a[c]);a.css=d};i=H.prototype=new E,i.constructor=H,i.kill()._gc=!1,i.ratio=0,i._firstPT=i._targets=i._overwrittenProps=i._startAt=null,i._notifyPluginsOfEnabled=i._lazy=!1,H.version="2.1.2",H.defaultEase=i._ease=new w(null,null,1,1),H.defaultOverwrite="auto",H.ticker=j,H.autoSleep=120,H.lagSmoothing=function(a,b){j.lagSmoothing(a,b)},H.selector=a.$||a.jQuery||function(b){var c=a.$||a.jQuery;return c?(H.selector=c,c(b)):(d||(d=a.document),d?d.querySelectorAll?d.querySelectorAll(b):d.getElementById("#"===b.charAt(0)?b.substr(1):b):b)};var K=[],L={},M=/(?:(-|-=|\+=)?\d*\.?\d*(?:e[\-+]?\d+)?)[0-9]/gi,N=/[\+-]=-?[\.\d]/,O=function(a){for(var b,c=this._firstPT,d=1e-6;c;)b=c.blob?1===a&&null!=this.end?this.end:a?this.join(""):this.start:c.c*a+c.s,c.m?b=c.m.call(this._tween,b,this._target||c.t,this._tween):d>b&&b>-d&&!c.blob&&(b=0),c.f?c.fp?c.t[c.p](c.fp,b):c.t[c.p](b):c.t[c.p]=b,c=c._next},P=function(a){return(1e3*a|0)/1e3+""},Q=function(a,b,c,d){var e,f,g,h,i,j,k,l=[],m=0,n="",o=0;for(l.start=a,l.end=b,a=l[0]=a+"",b=l[1]=b+"",c&&(c(l),a=l[0],b=l[1]),l.length=0,e=a.match(M)||[],f=b.match(M)||[],d&&(d._next=null,d.blob=1,l._firstPT=l._applyPT=d),i=f.length,h=0;i>h;h++)k=f[h],j=b.substr(m,b.indexOf(k,m)-m),n+=j||!h?j:",",m+=j.length,o?o=(o+1)%5:"rgba("===j.substr(-5)&&(o=1),k===e[h]||e.length<=h?n+=k:(n&&(l.push(n),n=""),g=parseFloat(e[h]),l.push(g),l._firstPT={_next:l._firstPT,t:l,p:l.length-1,s:g,c:("="===k.charAt(1)?parseInt(k.charAt(0)+"1",10)*parseFloat(k.substr(2)):parseFloat(k)-g)||0,f:0,m:o&&4>o?Math.round:P}),m+=k.length;return n+=b.substr(m),n&&l.push(n),l.setRatio=O,N.test(b)&&(l.end=null),l},R=function(a,b,c,d,e,f,g,h,i){"function"==typeof d&&(d=d(i||0,a));var j,k=typeof a[b],l="function"!==k?"":b.indexOf("set")||"function"!=typeof a["get"+b.substr(3)]?b:"get"+b.substr(3),m="get"!==c?c:l?g?a[l](g):a[l]():a[b],n="string"==typeof d&&"="===d.charAt(1),o={t:a,p:b,s:m,f:"function"===k,pg:0,n:e||b,m:f?"function"==typeof f?f:Math.round:0,pr:0,c:n?parseInt(d.charAt(0)+"1",10)*parseFloat(d.substr(2)):parseFloat(d)-m||0};return("number"!=typeof m||"number"!=typeof d&&!n)&&(g||isNaN(m)||!n&&isNaN(d)||"boolean"==typeof m||"boolean"==typeof d?(o.fp=g,j=Q(m,n?parseFloat(o.s)+o.c+(o.s+"").replace(/[0-9\-\.]/g,""):d,h||H.defaultStringFilter,o),o={t:j,p:"setRatio",s:0,c:1,f:2,pg:0,n:e||b,pr:0,m:0}):(o.s=parseFloat(m),n||(o.c=parseFloat(d)-o.s||0))),o.c?((o._next=this._firstPT)&&(o._next._prev=o),this._firstPT=o,o):void 0},S=H._internals={isArray:q,isSelector:I,lazyTweens:K,blobDif:Q},T=H._plugins={},U=S.tweenLookup={},V=0,W=S.reservedProps={ease:1,delay:1,overwrite:1,onComplete:1,onCompleteParams:1,onCompleteScope:1,useFrames:1,runBackwards:1,startAt:1,onUpdate:1,onUpdateParams:1,onUpdateScope:1,onStart:1,onStartParams:1,onStartScope:1,onReverseComplete:1,onReverseCompleteParams:1,onReverseCompleteScope:1,onRepeat:1,onRepeatParams:1,onRepeatScope:1,easeParams:1,yoyo:1,immediateRender:1,repeat:1,repeatDelay:1,data:1,paused:1,reversed:1,autoCSS:1,lazy:1,onOverwrite:1,callbackScope:1,stringFilter:1,id:1,yoyoEase:1,stagger:1},X={none:0,all:1,auto:2,concurrent:3,allOnStart:4,preexisting:5,"true":1,"false":0},Y=E._rootFramesTimeline=new G,Z=E._rootTimeline=new G,$=30,_=S.lazyRender=function(){var a,b,c=K.length;for(L={},a=0;c>a;a++)b=K[a],b&&b._lazy!==!1&&(b.render(b._lazy[0],b._lazy[1],!0),b._lazy=!1);K.length=0};Z._startTime=j.time,Y._startTime=j.frame,Z._active=Y._active=!0,setTimeout(_,1),E._updateRoot=H.render=function(){var a,b,c;if(K.length&&_(),Z.render((j.time-Z._startTime)*Z._timeScale,!1,!1),Y.render((j.frame-Y._startTime)*Y._timeScale,!1,!1),K.length&&_(),j.frame>=$){$=j.frame+(parseInt(H.autoSleep,10)||120);for(c in U){for(b=U[c].tweens,a=b.length;--a>-1;)b[a]._gc&&b.splice(a,1);0===b.length&&delete U[c]}if(c=Z._first,(!c||c._paused)&&H.autoSleep&&!Y._first&&1===j._listeners.tick.length){for(;c&&c._paused;)c=c._next;c||j.sleep()}}},j.addEventListener("tick",E._updateRoot);var aa=function(a,b,c){var d,e,f=a._gsTweenID;if(U[f||(a._gsTweenID=f="t"+V++)]||(U[f]={target:a,tweens:[]}),b&&(d=U[f].tweens,d[e=d.length]=b,c))for(;--e>-1;)d[e]===b&&d.splice(e,1);return U[f].tweens},ba=function(a,b,c,d){var e,f,g=a.vars.onOverwrite;return g&&(e=g(a,b,c,d)),g=H.onOverwrite,g&&(f=g(a,b,c,d)),e!==!1&&f!==!1},ca=function(a,b,c,d,e){var f,g,h,i;if(1===d||d>=4){for(i=e.length,f=0;i>f;f++)if((h=e[f])!==b)h._gc||h._kill(null,a,b)&&(g=!0);else if(5===d)break;return g}var j,k=b._startTime+n,l=[],m=0,o=0===b._duration;for(f=e.length;--f>-1;)(h=e[f])===b||h._gc||h._paused||(h._timeline!==b._timeline?(j=j||da(b,0,o),0===da(h,j,o)&&(l[m++]=h)):h._startTime<=k&&h._startTime+h.totalDuration()/h._timeScale>k&&((o||!h._initted)&&k-h._startTime<=2*n||(l[m++]=h)));for(f=m;--f>-1;)if(h=l[f],i=h._firstPT,2===d&&h._kill(c,a,b)&&(g=!0),2!==d||!h._firstPT&&h._initted&&i){if(2!==d&&!ba(h,b))continue;h._enabled(!1,!1)&&(g=!0)}return g},da=function(a,b,c){for(var d=a._timeline,e=d._timeScale,f=a._startTime;d._timeline;){if(f+=d._startTime,e*=d._timeScale,d._paused)return-100;d=d._timeline}return f/=e,f>b?f-b:c&&f===b||!a._initted&&2*n>f-b?n:(f+=a.totalDuration()/a._timeScale/e)>b+n?0:f-b-n};i._init=function(){var a,b,c,d,e,f,g=this.vars,h=this._overwrittenProps,i=this._duration,j=!!g.immediateRender,k=g.ease,l=this._startAt;if(g.startAt){l&&(l.render(-1,!0),l.kill()),e={};for(d in g.startAt)e[d]=g.startAt[d];if(e.data="isStart",e.overwrite=!1,e.immediateRender=!0,e.lazy=j&&g.lazy!==!1,e.startAt=e.delay=null,e.onUpdate=g.onUpdate,e.onUpdateParams=g.onUpdateParams,e.onUpdateScope=g.onUpdateScope||g.callbackScope||this,this._startAt=H.to(this.target||{},0,e),j)if(this._time>0)this._startAt=null;else if(0!==i)return}else if(g.runBackwards&&0!==i)if(l)l.render(-1,!0),l.kill(),this._startAt=null;else{0!==this._time&&(j=!1),c={};for(d in g)W[d]&&"autoCSS"!==d||(c[d]=g[d]);if(c.overwrite=0,c.data="isFromStart",c.lazy=j&&g.lazy!==!1,c.immediateRender=j,this._startAt=H.to(this.target,0,c),j){if(0===this._time)return}else this._startAt._init(),this._startAt._enabled(!1),this.vars.immediateRender&&(this._startAt=null)}if(this._ease=k=k?k instanceof w?k:"function"==typeof k?new w(k,g.easeParams):x[k]||H.defaultEase:H.defaultEase,g.easeParams instanceof Array&&k.config&&(this._ease=k.config.apply(k,g.easeParams)),this._easeType=this._ease._type,this._easePower=this._ease._power,this._firstPT=null,this._targets)for(f=this._targets.length,a=0;f>a;a++)this._initProps(this._targets[a],this._propLookup[a]={},this._siblings[a],h?h[a]:null,a)&&(b=!0);else b=this._initProps(this.target,this._propLookup,this._siblings,h,0);if(b&&H._onPluginEvent("_onInitAllProps",this),h&&(this._firstPT||"function"!=typeof this.target&&this._enabled(!1,!1)),g.runBackwards)for(c=this._firstPT;c;)c.s+=c.c,c.c=-c.c,c=c._next;this._onUpdate=g.onUpdate,this._initted=!0},i._initProps=function(b,c,d,e,f){var g,h,i,j,k,l;if(null==b)return!1;L[b._gsTweenID]&&_(),this.vars.css||b.style&&b!==a&&b.nodeType&&T.css&&this.vars.autoCSS!==!1&&J(this.vars,b);for(g in this.vars)if(l=this.vars[g],W[g])l&&(l instanceof Array||l.push&&q(l))&&-1!==l.join("").indexOf("{self}")&&(this.vars[g]=l=this._swapSelfInParams(l,this));else if(T[g]&&(j=new T[g])._onInitTween(b,this.vars[g],this,f)){for(this._firstPT=k={_next:this._firstPT,t:j,p:"setRatio",s:0,c:1,f:1,n:g,pg:1,pr:j._priority,m:0},h=j._overwriteProps.length;--h>-1;)c[j._overwriteProps[h]]=this._firstPT;(j._priority||j._onInitAllProps)&&(i=!0),(j._onDisable||j._onEnable)&&(this._notifyPluginsOfEnabled=!0),k._next&&(k._next._prev=k)}else c[g]=R.call(this,b,g,"get",l,g,0,null,this.vars.stringFilter,f);return e&&this._kill(e,b)?this._initProps(b,c,d,e,f):this._overwrite>1&&this._firstPT&&d.length>1&&ca(b,this,c,this._overwrite,d)?(this._kill(c,b),this._initProps(b,c,d,e,f)):(this._firstPT&&(this.vars.lazy!==!1&&this._duration||this.vars.lazy&&!this._duration)&&(L[b._gsTweenID]=!0),i)},i.render=function(a,b,c){var d,e,f,g,h=this,i=h._time,j=h._duration,k=h._rawPrevTime;if(a>=j-n&&a>=0)h._totalTime=h._time=j,h.ratio=h._ease._calcEnd?h._ease.getRatio(1):1,h._reversed||(d=!0,e="onComplete",c=c||h._timeline.autoRemoveChildren),0===j&&(h._initted||!h.vars.lazy||c)&&(h._startTime===h._timeline._duration&&(a=0),(0>k||0>=a&&a>=-n||k===n&&"isPause"!==h.data)&&k!==a&&(c=!0,k>n&&(e="onReverseComplete")),h._rawPrevTime=g=!b||a||k===a?a:n);else if(n>a)h._totalTime=h._time=0,h.ratio=h._ease._calcEnd?h._ease.getRatio(0):0,(0!==i||0===j&&k>0)&&(e="onReverseComplete",d=h._reversed),a>-n?a=0:0>a&&(h._active=!1,0===j&&(h._initted||!h.vars.lazy||c)&&(k>=0&&(k!==n||"isPause"!==h.data)&&(c=!0),h._rawPrevTime=g=!b||a||k===a?a:n)),(!h._initted||h._startAt&&h._startAt.progress())&&(c=!0);else if(h._totalTime=h._time=a,h._easeType){var l=a/j,m=h._easeType,o=h._easePower;(1===m||3===m&&l>=.5)&&(l=1-l),3===m&&(l*=2),1===o?l*=l:2===o?l*=l*l:3===o?l*=l*l*l:4===o&&(l*=l*l*l*l),h.ratio=1===m?1-l:2===m?l:.5>a/j?l/2:1-l/2}else h.ratio=h._ease.getRatio(a/j);if(h._time!==i||c){if(!h._initted){if(h._init(),!h._initted||h._gc)return;if(!c&&h._firstPT&&(h.vars.lazy!==!1&&h._duration||h.vars.lazy&&!h._duration))return h._time=h._totalTime=i,h._rawPrevTime=k,K.push(h),void(h._lazy=[a,b]);h._time&&!d?h.ratio=h._ease.getRatio(h._time/j):d&&h._ease._calcEnd&&(h.ratio=h._ease.getRatio(0===h._time?0:1))}for(h._lazy!==!1&&(h._lazy=!1),h._active||!h._paused&&h._time!==i&&a>=0&&(h._active=!0),0===i&&(h._startAt&&(a>=0?h._startAt.render(a,!0,c):e||(e="_dummyGS")),h.vars.onStart&&(0!==h._time||0===j)&&(b||h._callback("onStart"))),f=h._firstPT;f;)f.f?f.t[f.p](f.c*h.ratio+f.s):f.t[f.p]=f.c*h.ratio+f.s,f=f._next;h._onUpdate&&(0>a&&h._startAt&&a!==-1e-4&&h._startAt.render(a,!0,c),b||(h._time!==i||d||c)&&h._callback("onUpdate")),e&&(!h._gc||c)&&(0>a&&h._startAt&&!h._onUpdate&&a!==-1e-4&&h._startAt.render(a,!0,c),d&&(h._timeline.autoRemoveChildren&&h._enabled(!1,!1),h._active=!1),!b&&h.vars[e]&&h._callback(e),0===j&&h._rawPrevTime===n&&g!==n&&(h._rawPrevTime=0))}},i._kill=function(a,b,c){if("all"===a&&(a=null),null==a&&(null==b||b===this.target))return this._lazy=!1,this._enabled(!1,!1);b="string"!=typeof b?b||this._targets||this.target:H.selector(b)||b;var d,e,f,g,h,i,j,k,l,m=c&&this._time&&c._startTime===this._startTime&&this._timeline===c._timeline,n=this._firstPT;if((q(b)||I(b))&&"number"!=typeof b[0])for(d=b.length;--d>-1;)this._kill(a,b[d],c)&&(i=!0);else{if(this._targets){for(d=this._targets.length;--d>-1;)if(b===this._targets[d]){h=this._propLookup[d]||{},this._overwrittenProps=this._overwrittenProps||[],e=this._overwrittenProps[d]=a?this._overwrittenProps[d]||{}:"all";break}}else{if(b!==this.target)return!1;h=this._propLookup,e=this._overwrittenProps=a?this._overwrittenProps||{}:"all"}if(h){if(j=a||h,k=a!==e&&"all"!==e&&a!==h&&("object"!=typeof a||!a._tempKill),c&&(H.onOverwrite||this.vars.onOverwrite)){for(f in j)h[f]&&(l||(l=[]),l.push(f));if((l||!a)&&!ba(this,c,b,l))return!1}for(f in j)(g=h[f])&&(m&&(g.f?g.t[g.p](g.s):g.t[g.p]=g.s,i=!0),g.pg&&g.t._kill(j)&&(i=!0),g.pg&&0!==g.t._overwriteProps.length||(g._prev?g._prev._next=g._next:g===this._firstPT&&(this._firstPT=g._next),g._next&&(g._next._prev=g._prev),g._next=g._prev=null),delete h[f]),k&&(e[f]=1);!this._firstPT&&this._initted&&n&&this._enabled(!1,!1)}}return i},i.invalidate=function(){this._notifyPluginsOfEnabled&&H._onPluginEvent("_onDisable",this);var a=this._time;return this._firstPT=this._overwrittenProps=this._startAt=this._onUpdate=null,this._notifyPluginsOfEnabled=this._active=this._lazy=!1,this._propLookup=this._targets?{}:[],E.prototype.invalidate.call(this),this.vars.immediateRender&&(this._time=-n,this.render(a,!1,this.vars.lazy!==!1)),this},i._enabled=function(a,b){if(k||j.wake(),a&&this._gc){var c,d=this._targets;if(d)for(c=d.length;--c>-1;)this._siblings[c]=aa(d[c],this,!0);else this._siblings=aa(this.target,this,!0)}return E.prototype._enabled.call(this,a,b),this._notifyPluginsOfEnabled&&this._firstPT?H._onPluginEvent(a?"_onEnable":"_onDisable",this):!1},H.to=function(a,b,c){return new H(a,b,c)},H.from=function(a,b,c){return c.runBackwards=!0,c.immediateRender=0!=c.immediateRender,new H(a,b,c)},H.fromTo=function(a,b,c,d){return d.startAt=c,d.immediateRender=0!=d.immediateRender&&0!=c.immediateRender,new H(a,b,d)},H.delayedCall=function(a,b,c,d,e){return new H(b,0,{delay:a,onComplete:b,onCompleteParams:c,callbackScope:d,onReverseComplete:b,onReverseCompleteParams:c,immediateRender:!1,lazy:!1,useFrames:e,overwrite:0})},H.set=function(a,b){return new H(a,0,b)},H.getTweensOf=function(a,b){if(null==a)return[];a="string"!=typeof a?a:H.selector(a)||a;var c,d,e,f;if((q(a)||I(a))&&"number"!=typeof a[0]){for(c=a.length,d=[];--c>-1;)d=d.concat(H.getTweensOf(a[c],b));for(c=d.length;--c>-1;)for(f=d[c],e=c;--e>-1;)f===d[e]&&d.splice(c,1)}else if(a._gsTweenID)for(d=aa(a).concat(),c=d.length;--c>-1;)(d[c]._gc||b&&!d[c].isActive())&&d.splice(c,1);return d||[]},H.killTweensOf=H.killDelayedCallsTo=function(a,b,c){"object"==typeof b&&(c=b,b=!1);for(var d=H.getTweensOf(a,b),e=d.length;--e>-1;)d[e]._kill(c,a)};var ea=u("plugins.TweenPlugin",function(a,b){this._overwriteProps=(a||"").split(","),this._propName=this._overwriteProps[0],this._priority=b||0,this._super=ea.prototype},!0);if(i=ea.prototype,ea.version="1.19.0",ea.API=2,i._firstPT=null,i._addTween=R,i.setRatio=O,i._kill=function(a){var b,c=this._overwriteProps,d=this._firstPT;if(null!=a[this._propName])this._overwriteProps=[];else for(b=c.length;--b>-1;)null!=a[c[b]]&&c.splice(b,1);for(;d;)null!=a[d.n]&&(d._next&&(d._next._prev=d._prev),d._prev?(d._prev._next=d._next,d._prev=null):this._firstPT===d&&(this._firstPT=d._next)),d=d._next;return!1},i._mod=i._roundProps=function(a){for(var b,c=this._firstPT;c;)b=a[this._propName]||null!=c.n&&a[c.n.split(this._propName+"_").join("")],b&&"function"==typeof b&&(2===c.f?c.t._applyPT.m=b:c.m=b),c=c._next},H._onPluginEvent=function(a,b){var c,d,e,f,g,h=b._firstPT;if("_onInitAllProps"===a){for(;h;){for(g=h._next,d=e;d&&d.pr>h.pr;)d=d._next;(h._prev=d?d._prev:f)?h._prev._next=h:e=h,(h._next=d)?d._prev=h:f=h,h=g}h=b._firstPT=e}for(;h;)h.pg&&"function"==typeof h.t[a]&&h.t[a]()&&(c=!0),h=h._next;return c},ea.activate=function(a){for(var b=a.length;--b>-1;)a[b].API===ea.API&&(T[(new a[b])._propName]=a[b]);return!0},t.plugin=function(a){if(!(a&&a.propName&&a.init&&a.API))throw"illegal plugin definition.";var b,c=a.propName,d=a.priority||0,e=a.overwriteProps,f={init:"_onInitTween",set:"setRatio",kill:"_kill",round:"_mod",mod:"_mod",initAll:"_onInitAllProps"},g=u("plugins."+c.charAt(0).toUpperCase()+c.substr(1)+"Plugin",function(){ea.call(this,c,d),this._overwriteProps=e||[]},a.global===!0),h=g.prototype=new ea(c);h.constructor=g,g.API=a.API;for(b in f)"function"==typeof a[b]&&(h[f[b]]=a[b]);return g.version=a.version,ea.activate([g]),g},g=a._gsQueue){for(h=0;h e+1E3&&(r.update(1E3*a/(c-e),100),e=c,a=0,t)){var d=performance.memory;t.update(d.usedJSHeapSize/1048576,d.jsHeapSizeLimit/1048576)}return c},update:function(){g=this.end()},domElement:c,setMode:k}}; -Stats.Panel=function(h,k,l){var c=Infinity,g=0,e=Math.round,a=e(window.devicePixelRatio||1),r=80*a,f=48*a,t=3*a,u=2*a,d=3*a,m=15*a,n=74*a,p=30*a,q=document.createElement("canvas");q.width=r;q.height=f;q.style.cssText="width:80px;height:48px";var b=q.getContext("2d");b.font="bold "+9*a+"px Helvetica,Arial,sans-serif";b.textBaseline="top";b.fillStyle=l;b.fillRect(0,0,r,f);b.fillStyle=k;b.fillText(h,t,u);b.fillRect(d,m,n,p);b.fillStyle=l;b.globalAlpha=.9;b.fillRect(d,m,n,p);return{dom:q,update:function(f,v){c=Math.min(c,f);g=Math.max(g,f);b.fillStyle=l;b.globalAlpha=1;b.fillRect(0,0,r,m);b.fillStyle=k;b.fillText(e(f)+" "+h+" ("+e(c)+"-"+e(g)+")",t,u);b.drawImage(q,d+a,m,n-a,p,d,m,n-a,p);b.fillRect(d+n-a,m,a,p);b.fillStyle=l;b.globalAlpha=.9;b.fillRect(d+n-a,m,a,e((1-f/v)*p))}}};"object"===typeof module&&(module.exports=Stats); /////////////////////////////////////////////////////-------------- my line-------------- var getProportionPoint2 = (point, segment, length, dx, dy) => { let factor = segment / length @@ -37066,3 +37084,1569 @@ var dijkstra = { } } }; +////////////////////////-------LineSegmentsGeometry---------------------- + THREE.LineSegmentsGeometry = function () { + THREE.InstancedBufferGeometry.call( this ); + this.type = 'LineSegmentsGeometry'; + var plane = new THREE.BufferGeometry(); + var positions = [ - 1, 2, 0, 1, 2, 0, - 1, 1, 0, 1, 1, 0, - 1, 0, 0, 1, 0, 0, - 1, - 1, 0, 1, - 1, 0 ]; + var uvs = [ - 1, 2, 1, 2, - 1, 1, 1, 1, - 1, - 1, 1, - 1, - 1, - 2, 1, - 2 ]; + var index = [ 0, 2, 1, 2, 3, 1, 2, 4, 3, 4, 5, 3, 4, 6, 5, 6, 7, 5 ]; + this.setIndex( index ); + this.addAttribute( 'position', new THREE.Float32BufferAttribute( positions, 3 ) ); + this.addAttribute( 'uv', new THREE.Float32BufferAttribute( uvs, 2 ) ); +}; +THREE.LineSegmentsGeometry.prototype = Object.assign( Object.create( THREE.InstancedBufferGeometry.prototype ), { + constructor: THREE.LineSegmentsGeometry, + isLineSegmentsGeometry: true, + applyMatrix: function ( matrix ) { + var start = this.attributes.instanceStart; + var end = this.attributes.instanceEnd; + if ( start !== undefined ) { + matrix.applyToBufferAttribute( start ); + matrix.applyToBufferAttribute( end ); + start.data.needsUpdate = true; + } + if ( this.boundingBox !== null ) { + this.computeBoundingBox(); + } + if ( this.boundingSphere !== null ) { + this.computeBoundingSphere(); + } + return this; + }, + setPositions: function ( array ) { + var lineSegments; + if ( array instanceof Float32Array ) { + lineSegments = array; + } else if ( Array.isArray( array ) ) { + lineSegments = new Float32Array( array ); + } + var instanceBuffer = new THREE.InstancedInterleavedBuffer( lineSegments, 6, 1 ); // xyz, xyz + this.addAttribute( 'instanceStart', new THREE.InterleavedBufferAttribute( instanceBuffer, 3, 0 ) ); // xyz + this.addAttribute( 'instanceEnd', new THREE.InterleavedBufferAttribute( instanceBuffer, 3, 3 ) ); // xyz + // + this.computeBoundingBox(); + this.computeBoundingSphere(); + return this; + }, + setColors: function ( array ) { + var colors; + if ( array instanceof Float32Array ) { + colors = array; + } else if ( Array.isArray( array ) ) { + colors = new Float32Array( array ); + } + var instanceColorBuffer = new THREE.InstancedInterleavedBuffer( colors, 6, 1 ); // rgb, rgb + this.addAttribute( 'instanceColorStart', new THREE.InterleavedBufferAttribute( instanceColorBuffer, 3, 0 ) ); // rgb + this.addAttribute( 'instanceColorEnd', new THREE.InterleavedBufferAttribute( instanceColorBuffer, 3, 3 ) ); // rgb + return this; + }, + fromWireframeGeometry: function ( geometry ) { + this.setPositions( geometry.attributes.position.array ); + return this; + }, + fromEdgesGeometry: function ( geometry ) { + this.setPositions( geometry.attributes.position.array ); + return this; + }, + fromMesh: function ( mesh ) { + this.fromWireframeGeometry( new THREE.WireframeGeometry( mesh.geometry ) ); + // set colors, maybe + return this; + }, + fromLineSegements: function ( lineSegments ) { + var geometry = lineSegments.geometry; + if ( geometry.isGeometry ) { + this.setPositions( geometry.vertices ); + } else if ( geometry.isBufferGeometry ) { + this.setPositions( geometry.position.array ); // assumes non-indexed + } + // set colors, maybe + return this; + }, + computeBoundingBox: function () { + var box = new THREE.Box3(); + return function computeBoundingBox() { + if ( this.boundingBox === null ) { + this.boundingBox = new THREE.Box3(); + } + var start = this.attributes.instanceStart; + var end = this.attributes.instanceEnd; + if ( start !== undefined && end !== undefined ) { + this.boundingBox.setFromBufferAttribute( start ); + box.setFromBufferAttribute( end ); + this.boundingBox.union( box ); + } + }; + }(), + computeBoundingSphere: function () { + var vector = new THREE.Vector3(); + return function computeBoundingSphere() { + if ( this.boundingSphere === null ) { + this.boundingSphere = new THREE.Sphere(); + } + if ( this.boundingBox === null ) { + this.computeBoundingBox(); + } + var start = this.attributes.instanceStart; + var end = this.attributes.instanceEnd; + if ( start !== undefined && end !== undefined ) { + var center = this.boundingSphere.center; + this.boundingBox.getCenter( center ); + var maxRadiusSq = 0; + for ( var i = 0, il = start.count; i < il; i ++ ) { + vector.fromBufferAttribute( start, i ); + maxRadiusSq = Math.max( maxRadiusSq, center.distanceToSquared( vector ) ); + vector.fromBufferAttribute( end, i ); + maxRadiusSq = Math.max( maxRadiusSq, center.distanceToSquared( vector ) ); + } + this.boundingSphere.radius = Math.sqrt( maxRadiusSq ); + + } + }; + }(), + toJSON: function () { + // todo + }, + clone: function () { + // todo + }, + copy: function ( source ) { + // todo + return this; + } +} ); +//////////////////////////////--------------虚线 -LineMaterial----------- + THREE.UniformsLib.line = { + linewidth: { value: 1 }, + resolution: { value: new THREE.Vector2( 1, 1 ) }, + dashScale: { value: 1 }, + dashSize: { value: 1 }, + gapSize: { value: 1 } // todo FIX - maybe change to totalSize +}; +THREE.ShaderLib[ 'line' ] = { + uniforms: THREE.UniformsUtils.merge( [ + THREE.UniformsLib.common, + THREE.UniformsLib.fog, + THREE.UniformsLib.line + ] ), + vertexShader: + ` + #include + #include + #include + #include + #include + uniform float linewidth; + uniform vec2 resolution; + attribute vec3 instanceStart; + attribute vec3 instanceEnd; + attribute vec3 instanceColorStart; + attribute vec3 instanceColorEnd; + varying vec2 vUv; + #ifdef USE_DASH + uniform float dashScale; + attribute float instanceDistanceStart; + attribute float instanceDistanceEnd; + varying float vLineDistance; + #endif + void trimSegment( const in vec4 start, inout vec4 end ) { + // trim end segment so it terminates between the camera plane and the near plane + // conservative estimate of the near plane + float a = projectionMatrix[ 2 ][ 2 ]; // 3nd entry in 3th column + float b = projectionMatrix[ 3 ][ 2 ]; // 3nd entry in 4th column + float nearEstimate = - 0.5 * b / a; + float alpha = ( nearEstimate - start.z ) / ( end.z - start.z ); + end.xyz = mix( start.xyz, end.xyz, alpha ); + } + void main() { + #ifdef USE_COLOR + vColor.xyz = ( position.y < 0.5 ) ? instanceColorStart : instanceColorEnd; + #endif + #ifdef USE_DASH + vLineDistance = ( position.y < 0.5 ) ? dashScale * instanceDistanceStart : dashScale * instanceDistanceEnd; + #endif + float aspect = resolution.x / resolution.y; + vUv = uv; + // camera space + vec4 start = modelViewMatrix * vec4( instanceStart, 1.0 ); + vec4 end = modelViewMatrix * vec4( instanceEnd, 1.0 ); + // special case for perspective projection, and segments that terminate either in, or behind, the camera plane + // clearly the gpu firmware has a way of addressing this issue when projecting into ndc space + // but we need to perform ndc-space calculations in the shader, so we must address this issue directly + // perhaps there is a more elegant solution -- WestLangley + bool perspective = ( projectionMatrix[ 2 ][ 3 ] == - 1.0 ); // 4th entry in the 3rd column + if ( perspective ) { + if ( start.z < 0.0 && end.z >= 0.0 ) { + trimSegment( start, end ); + } else if ( end.z < 0.0 && start.z >= 0.0 ) { + trimSegment( end, start ); + } + } + // clip space + vec4 clipStart = projectionMatrix * start; + vec4 clipEnd = projectionMatrix * end; + // ndc space + vec2 ndcStart = clipStart.xy / clipStart.w; + vec2 ndcEnd = clipEnd.xy / clipEnd.w; + // direction + vec2 dir = ndcEnd - ndcStart; + // account for clip-space aspect ratio + dir.x *= aspect; + dir = normalize( dir ); + // perpendicular to dir + vec2 offset = vec2( dir.y, - dir.x ); + // undo aspect ratio adjustment + dir.x /= aspect; + offset.x /= aspect; + // sign flip + if ( position.x < 0.0 ) offset *= - 1.0; + // endcaps + if ( position.y < 0.0 ) { + offset += - dir; + } else if ( position.y > 1.0 ) { + offset += dir; + } + // adjust for linewidth + offset *= linewidth; + // adjust for clip-space to screen-space conversion // maybe resolution should be based on viewport ... + offset /= resolution.y; + // select end + vec4 clip = ( position.y < 0.5 ) ? clipStart : clipEnd; + // back to clip space + offset *= clip.w; + clip.xy += offset; + gl_Position = clip; + vec4 mvPosition = ( position.y < 0.5 ) ? start : end; // this is an approximation + #include + #include + #include + } + `, + fragmentShader: + ` + uniform vec3 diffuse; + uniform float opacity; + #ifdef USE_DASH + uniform float dashSize; + uniform float gapSize; + #endif + varying float vLineDistance; + #include + #include + #include + #include + #include + varying vec2 vUv; + void main() { + #include + #ifdef USE_DASH + if ( vUv.y < - 1.0 || vUv.y > 1.0 ) discard; // discard endcaps + if ( mod( vLineDistance, dashSize + gapSize ) > dashSize ) discard; // todo - FIX + #endif + if ( abs( vUv.y ) > 1.0 ) { + float a = vUv.x; + float b = ( vUv.y > 0.0 ) ? vUv.y - 1.0 : vUv.y + 1.0; + float len2 = a * a + b * b; + if ( len2 > 1.0 ) discard; + } + vec4 diffuseColor = vec4( diffuse, opacity ); + #include + #include + gl_FragColor = vec4( diffuseColor.rgb, diffuseColor.a ); + #include + #include + #include + #include + } ` +}; +THREE.LineMaterial = function ( parameters ) { + THREE.ShaderMaterial.call( this, { + type: 'LineMaterial', + uniforms: THREE.UniformsUtils.clone( THREE.ShaderLib[ 'line' ].uniforms ), + vertexShader: THREE.ShaderLib[ 'line' ].vertexShader, + fragmentShader: THREE.ShaderLib[ 'line' ].fragmentShader + } ); + this.dashed = false; + Object.defineProperties( this, { + color: { + enumerable: true, + get: function () { + return this.uniforms.diffuse.value; + }, + set: function ( value ) { + this.uniforms.diffuse.value = value; + } + }, + linewidth: { + enumerable: true, + get: function () { + return this.uniforms.linewidth.value; + }, + set: function ( value ) { + this.uniforms.linewidth.value = value; + } + }, + dashScale: { + enumerable: true, + get: function () { + return this.uniforms.dashScale.value; + }, + set: function ( value ) { + this.uniforms.dashScale.value = value; + } + }, + dashSize: { + enumerable: true, + get: function () { + return this.uniforms.dashSize.value; + }, + set: function ( value ) { + this.uniforms.dashSize.value = value; + } + }, + gapSize: { + enumerable: true, + get: function () { + return this.uniforms.gapSize.value; + }, + set: function ( value ) { + this.uniforms.gapSize.value = value; + } + }, + resolution: { + enumerable: true, + get: function () { + return this.uniforms.resolution.value; + }, + set: function ( value ) { + this.uniforms.resolution.value.copy( value ); + } + } + } ); + this.setValues( parameters ); +}; +THREE.LineMaterial.prototype = Object.create( THREE.ShaderMaterial.prototype ); +THREE.LineMaterial.prototype.constructor = THREE.LineMaterial; +THREE.LineMaterial.prototype.isLineMaterial = true; +THREE.LineMaterial.prototype.copy = function ( source ) { + THREE.ShaderMaterial.prototype.copy.call( this, source ); + this.color.copy( source.color ); + this.linewidth = source.linewidth; + this.resolution = source.resolution; + // todo + return this; +}; +// Generated by CoffeeScript 1.6.3 +(function() { + var BACK, COPLANAR, EPSILON, FRONT, SPANNING, returning, + __bind = function(fn, me){ return function(){ return fn.apply(me, arguments); }; }, + __slice = [].slice, + __hasProp = {}.hasOwnProperty, + __extends = function(child, parent) { for (var key in parent) { if (__hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; }; + EPSILON = 1e-5; + COPLANAR = 0; + FRONT = 1; + BACK = 2; + SPANNING = 3; + returning = function(value, fn) { + fn(); + return value; + }; + window.ThreeBSP = (function() { + function ThreeBSP(treeIsh, matrix) { + this.matrix = matrix; + this.intersect = __bind(this.intersect, this); + this.union = __bind(this.union, this); + this.subtract = __bind(this.subtract, this); + this.toGeometry = __bind(this.toGeometry, this); + this.toMesh = __bind(this.toMesh, this); + this.toTree = __bind(this.toTree, this); + if (this.matrix == null) { + this.matrix = new THREE.Matrix4(); + } + this.tree = this.toTree(treeIsh); + } + ThreeBSP.prototype.toTree = function(treeIsh) { + var face, geometry, i, polygons, _fn, _i, _len, _ref, + _this = this; + if (treeIsh instanceof ThreeBSP.Node) { + return treeIsh; + } + polygons = []; + geometry = treeIsh instanceof THREE.Geometry ? treeIsh : treeIsh instanceof THREE.Mesh ? (treeIsh.updateMatrix(), this.matrix = treeIsh.matrix.clone(), treeIsh.geometry) : void 0; + _ref = geometry.faces; + _fn = function(face, i) { + var faceVertexUvs, idx, polygon, vIndex, vName, vertex, _j, _len1, _ref1, _ref2; + faceVertexUvs = (_ref1 = geometry.faceVertexUvs) != null ? _ref1[0][i] : void 0; + if (faceVertexUvs == null) { + faceVertexUvs = [new THREE.Vector2(), new THREE.Vector2(), new THREE.Vector2(), new THREE.Vector2()]; + } + polygon = new ThreeBSP.Polygon(); + _ref2 = ['a', 'b', 'c', 'd']; + for (vIndex = _j = 0, _len1 = _ref2.length; _j < _len1; vIndex = ++_j) { + vName = _ref2[vIndex]; + if ((idx = face[vName]) != null) { + vertex = geometry.vertices[idx]; + vertex = new ThreeBSP.Vertex(vertex.x, vertex.y, vertex.z, face.vertexNormals[0], new THREE.Vector2(faceVertexUvs[vIndex].x, faceVertexUvs[vIndex].y)); + vertex.applyMatrix4(_this.matrix); + polygon.vertices.push(vertex); + } + } + return polygons.push(polygon.calculateProperties()); + }; + for (i = _i = 0, _len = _ref.length; _i < _len; i = ++_i) { + face = _ref[i]; + _fn(face, i); + } + return new ThreeBSP.Node(polygons); + }; + ThreeBSP.prototype.toMesh = function(material) { + var geometry, mesh, + _this = this; + if (material == null) { + material = new THREE.MeshNormalMaterial(); + } + geometry = this.toGeometry(); + return returning((mesh = new THREE.Mesh(geometry, material)), function() { + mesh.position.getPositionFromMatrix(_this.matrix); + return mesh.rotation.setFromRotationMatrix(_this.matrix); + }); + }; + ThreeBSP.prototype.toGeometry = function() { + var geometry, matrix, + _this = this; + matrix = new THREE.Matrix4().getInverse(this.matrix); + return returning((geometry = new THREE.Geometry()), function() { + var face, idx, polyVerts, polygon, v, vertUvs, verts, _i, _len, _ref, _results; + _ref = _this.tree.allPolygons(); + _results = []; + for (_i = 0, _len = _ref.length; _i < _len; _i++) { + polygon = _ref[_i]; + polyVerts = (function() { + var _j, _len1, _ref1, _results1; + _ref1 = polygon.vertices; + _results1 = []; + for (_j = 0, _len1 = _ref1.length; _j < _len1; _j++) { + v = _ref1[_j]; + _results1.push(v.clone().applyMatrix4(matrix)); + } + return _results1; + })(); + _results.push((function() { + var _j, _ref1, _results1; + _results1 = []; + for (idx = _j = 2, _ref1 = polyVerts.length; 2 <= _ref1 ? _j < _ref1 : _j > _ref1; idx = 2 <= _ref1 ? ++_j : --_j) { + verts = [polyVerts[0], polyVerts[idx - 1], polyVerts[idx]]; + vertUvs = (function() { + var _k, _len1, _ref2, _ref3, _results2; + _results2 = []; + for (_k = 0, _len1 = verts.length; _k < _len1; _k++) { + v = verts[_k]; + _results2.push(new THREE.Vector2((_ref2 = v.uv) != null ? _ref2.x : void 0, (_ref3 = v.uv) != null ? _ref3.y : void 0)); + } + return _results2; + })(); + face = (function(func, args, ctor) { + ctor.prototype = func.prototype; + var child = new ctor, result = func.apply(child, args); + return Object(result) === result ? result : child; + })(THREE.Face3, __slice.call((function() { + var _k, _len1, _results2; + _results2 = []; + for (_k = 0, _len1 = verts.length; _k < _len1; _k++) { + v = verts[_k]; + _results2.push(geometry.vertices.push(v) - 1); + } + return _results2; + })()).concat([polygon.normal.clone()]), function(){}); + geometry.faces.push(face); + _results1.push(geometry.faceVertexUvs[0].push(vertUvs)); + } + return _results1; + })()); + } + return _results; + }); + }; + ThreeBSP.prototype.subtract = function(other) { + var them, us, _ref; + _ref = [this.tree.clone(), other.tree.clone()], us = _ref[0], them = _ref[1]; + us.invert().clipTo(them); + them.clipTo(us).invert().clipTo(us).invert(); + return new ThreeBSP(us.build(them.allPolygons()).invert(), this.matrix); + }; + ThreeBSP.prototype.union = function(other) { + var them, us, _ref; + _ref = [this.tree.clone(), other.tree.clone()], us = _ref[0], them = _ref[1]; + us.clipTo(them); + them.clipTo(us).invert().clipTo(us).invert(); + return new ThreeBSP(us.build(them.allPolygons()), this.matrix); + }; + ThreeBSP.prototype.intersect = function(other) { + var them, us, _ref; + _ref = [this.tree.clone(), other.tree.clone()], us = _ref[0], them = _ref[1]; + them.clipTo(us.invert()).invert().clipTo(us.clipTo(them)); + return new ThreeBSP(us.build(them.allPolygons()).invert(), this.matrix); + }; + return ThreeBSP; + })(); + ThreeBSP.Vertex = (function(_super) { + __extends(Vertex, _super); + function Vertex(x, y, z, normal, uv) { + this.normal = normal != null ? normal : new THREE.Vector3(); + this.uv = uv != null ? uv : new THREE.Vector2(); + this.interpolate = __bind(this.interpolate, this); + this.lerp = __bind(this.lerp, this); + Vertex.__super__.constructor.call(this, x, y, z); + } + Vertex.prototype.clone = function() { + return new ThreeBSP.Vertex(this.x, this.y, this.z, this.normal.clone(), this.uv.clone()); + }; + Vertex.prototype.lerp = function(v, alpha) { + var _this = this; + return returning(Vertex.__super__.lerp.apply(this, arguments), function() { + _this.uv.add(v.uv.clone().sub(_this.uv).multiplyScalar(alpha)); + return _this.normal.lerp(v, alpha); + }); + }; + Vertex.prototype.interpolate = function() { + var args, _ref; + args = 1 <= arguments.length ? __slice.call(arguments, 0) : []; + return (_ref = this.clone()).lerp.apply(_ref, args); + }; + return Vertex; + })(THREE.Vector3); + ThreeBSP.Polygon = (function() { + function Polygon(vertices, normal, w) { + this.vertices = vertices != null ? vertices : []; + this.normal = normal; + this.w = w; + this.subdivide = __bind(this.subdivide, this); + this.tessellate = __bind(this.tessellate, this); + this.classifySide = __bind(this.classifySide, this); + this.classifyVertex = __bind(this.classifyVertex, this); + this.invert = __bind(this.invert, this); + this.clone = __bind(this.clone, this); + this.calculateProperties = __bind(this.calculateProperties, this); + if (this.vertices.length) { + this.calculateProperties(); + } + } + Polygon.prototype.calculateProperties = function() { + var _this = this; + return returning(this, function() { + var a, b, c, _ref; + _ref = _this.vertices, a = _ref[0], b = _ref[1], c = _ref[2]; + _this.normal = b.clone().sub(a).cross(c.clone().sub(a)).normalize(); + return _this.w = _this.normal.clone().dot(a); + }); + }; + Polygon.prototype.clone = function() { + var v; + return new ThreeBSP.Polygon((function() { + var _i, _len, _ref, _results; + _ref = this.vertices; + _results = []; + for (_i = 0, _len = _ref.length; _i < _len; _i++) { + v = _ref[_i]; + _results.push(v.clone()); + } + return _results; + }).call(this), this.normal.clone(), this.w); + }; + Polygon.prototype.invert = function() { + var _this = this; + return returning(this, function() { + _this.normal.multiplyScalar(-1); + _this.w *= -1; + return _this.vertices.reverse(); + }); + }; + Polygon.prototype.classifyVertex = function(vertex) { + var side; + side = this.normal.dot(vertex) - this.w; + switch (false) { + case !(side < -EPSILON): + return BACK; + case !(side > EPSILON): + return FRONT; + default: + return COPLANAR; + } + }; + Polygon.prototype.classifySide = function(polygon) { + var back, front, tally, v, _i, _len, _ref, _ref1, + _this = this; + _ref = [0, 0], front = _ref[0], back = _ref[1]; + tally = function(v) { + switch (_this.classifyVertex(v)) { + case FRONT: + return front += 1; + case BACK: + return back += 1; + } + }; + _ref1 = polygon.vertices; + for (_i = 0, _len = _ref1.length; _i < _len; _i++) { + v = _ref1[_i]; + tally(v); + } + if (front > 0 && back === 0) { + return FRONT; + } + if (front === 0 && back > 0) { + return BACK; + } + if ((front === back && back === 0)) { + return COPLANAR; + } + return SPANNING; + }; + Polygon.prototype.tessellate = function(poly) { + var b, count, f, i, j, polys, t, ti, tj, v, vi, vj, _i, _len, _ref, _ref1, _ref2, + _this = this; + _ref = { + f: [], + b: [], + count: poly.vertices.length + }, f = _ref.f, b = _ref.b, count = _ref.count; + if (this.classifySide(poly) !== SPANNING) { + return [poly]; + } + _ref1 = poly.vertices; + for (i = _i = 0, _len = _ref1.length; _i < _len; i = ++_i) { + vi = _ref1[i]; + vj = poly.vertices[(j = (i + 1) % count)]; + _ref2 = (function() { + var _j, _len1, _ref2, _results; + _ref2 = [vi, vj]; + _results = []; + for (_j = 0, _len1 = _ref2.length; _j < _len1; _j++) { + v = _ref2[_j]; + _results.push(this.classifyVertex(v)); + } + return _results; + }).call(this), ti = _ref2[0], tj = _ref2[1]; + if (ti !== BACK) { + f.push(vi); + } + if (ti !== FRONT) { + b.push(vi); + } + if ((ti | tj) === SPANNING) { + t = (this.w - this.normal.dot(vi)) / this.normal.dot(vj.clone().sub(vi)); + v = vi.interpolate(vj, t); + f.push(v); + b.push(v); + } + } + return returning((polys = []), function() { + if (f.length >= 3) { + polys.push(new ThreeBSP.Polygon(f)); + } + if (b.length >= 3) { + return polys.push(new ThreeBSP.Polygon(b)); + } + }); + }; + Polygon.prototype.subdivide = function(polygon, coplanar_front, coplanar_back, front, back) { + var poly, side, _i, _len, _ref, _results; + _ref = this.tessellate(polygon); + _results = []; + for (_i = 0, _len = _ref.length; _i < _len; _i++) { + poly = _ref[_i]; + side = this.classifySide(poly); + switch (side) { + case FRONT: + _results.push(front.push(poly)); + break; + case BACK: + _results.push(back.push(poly)); + break; + case COPLANAR: + if (this.normal.dot(poly.normal) > 0) { + _results.push(coplanar_front.push(poly)); + } else { + _results.push(coplanar_back.push(poly)); + } + break; + default: + throw new Error("BUG: Polygon of classification " + side + " in subdivision"); + } + } + return _results; + }; + return Polygon; + })(); + ThreeBSP.Node = (function() { + Node.prototype.clone = function() { + var node, + _this = this; + return returning((node = new ThreeBSP.Node()), function() { + var p, _ref, _ref1, _ref2; + node.divider = (_ref = _this.divider) != null ? _ref.clone() : void 0; + node.polygons = (function() { + var _i, _len, _ref1, _results; + _ref1 = this.polygons; + _results = []; + for (_i = 0, _len = _ref1.length; _i < _len; _i++) { + p = _ref1[_i]; + _results.push(p.clone()); + } + return _results; + }).call(_this); + node.front = (_ref1 = _this.front) != null ? _ref1.clone() : void 0; + return node.back = (_ref2 = _this.back) != null ? _ref2.clone() : void 0; + }); + }; + function Node(polygons) { + this.clipTo = __bind(this.clipTo, this); + this.clipPolygons = __bind(this.clipPolygons, this); + this.invert = __bind(this.invert, this); + this.allPolygons = __bind(this.allPolygons, this); + this.isConvex = __bind(this.isConvex, this); + this.build = __bind(this.build, this); + this.clone = __bind(this.clone, this); + this.polygons = []; + if ((polygons != null) && polygons.length) { + this.build(polygons); + } + } + Node.prototype.build = function(polygons) { + var _this = this; + return returning(this, function() { + var poly, polys, side, sides, _i, _len, _results; + sides = { + front: [], + back: [] + }; + if (_this.divider == null) { + _this.divider = polygons[0].clone(); + } + for (_i = 0, _len = polygons.length; _i < _len; _i++) { + poly = polygons[_i]; + _this.divider.subdivide(poly, _this.polygons, _this.polygons, sides.front, sides.back); + } + _results = []; + for (side in sides) { + if (!__hasProp.call(sides, side)) continue; + polys = sides[side]; + if (polys.length) { + if (_this[side] == null) { + _this[side] = new ThreeBSP.Node(); + } + _results.push(_this[side].build(polys)); + } else { + _results.push(void 0); + } + } + return _results; + }); + }; + Node.prototype.isConvex = function(polys) { + var inner, outer, _i, _j, _len, _len1; + for (_i = 0, _len = polys.length; _i < _len; _i++) { + inner = polys[_i]; + for (_j = 0, _len1 = polys.length; _j < _len1; _j++) { + outer = polys[_j]; + if (inner !== outer && outer.classifySide(inner) !== BACK) { + return false; + } + } + } + return true; + }; + Node.prototype.allPolygons = function() { + var _ref, _ref1; + return this.polygons.slice().concat(((_ref1 = this.front) != null ? _ref1.allPolygons() : void 0) || []).concat(((_ref = this.back) != null ? _ref.allPolygons() : void 0) || []); + }; + Node.prototype.invert = function() { + var _this = this; + return returning(this, function() { + var flipper, poly, _i, _j, _len, _len1, _ref, _ref1, _ref2; + _ref = _this.polygons; + for (_i = 0, _len = _ref.length; _i < _len; _i++) { + poly = _ref[_i]; + poly.invert(); + } + _ref1 = [_this.divider, _this.front, _this.back]; + for (_j = 0, _len1 = _ref1.length; _j < _len1; _j++) { + flipper = _ref1[_j]; + if (flipper != null) { + flipper.invert(); + } + } + return _ref2 = [_this.back, _this.front], _this.front = _ref2[0], _this.back = _ref2[1], _ref2; + }); + }; + Node.prototype.clipPolygons = function(polygons) { + var back, front, poly, _i, _len; + if (!this.divider) { + return polygons.slice(); + } + front = []; + back = []; + for (_i = 0, _len = polygons.length; _i < _len; _i++) { + poly = polygons[_i]; + this.divider.subdivide(poly, front, back, front, back); + } + if (this.front) { + front = this.front.clipPolygons(front); + } + if (this.back) { + back = this.back.clipPolygons(back); + } + return front.concat(this.back ? back : []); + }; + Node.prototype.clipTo = function(node) { + var _this = this; + return returning(this, function() { + var _ref, _ref1; + _this.polygons = node.clipPolygons(_this.polygons); + if ((_ref = _this.front) != null) { + _ref.clipTo(node); + } + return (_ref1 = _this.back) != null ? _ref1.clipTo(node) : void 0; + }); + }; + return Node; + })(); +}).call(this); +/////////////////////----------------- 流光线 ------------------ +var uniforms = { + u_time: { value: 0.0 } + }; +// 着色器设置 +const vertexShader = ` + varying vec2 vUv; + attribute float percent; + uniform float u_time; + uniform float number; + uniform float speed; + uniform float length; + varying float opacity; + uniform float size; + void main() + { + vUv = uv; + vec4 mvPosition = modelViewMatrix * vec4( position, 1.0 ); + float l = clamp(1.0-length,0.0,1.0); + gl_PointSize = clamp(fract(percent*number + l - u_time*number*speed)-l ,0.0,1.) * size * (1./length); + opacity = gl_PointSize/size; + gl_Position = projectionMatrix * mvPosition; + } + ` +const fragmentShader = ` + #ifdef GL_ES + precision mediump float; + #endif + varying float opacity; + uniform vec3 color; + void main(){ + if(opacity <=0.2){ + discard; + } + gl_FragColor = vec4(color,1); + } + ` +function createFlyCurve(points, color, closed) { + var curve = new THREE.CatmullRomCurve3(points, closed); + // 流光的颜色,三个数字分别代表rgb的值,不过注意,需要除以255 + var color = color || new THREE.Vector3( 0.2235, 0.412, 1 ); + var flyLine = initFlyLine( curve, { + speed: 0.5, + color: color, + number: 5, //同时跑动的流光数量 + length: 0.3, //流光线条长度 + size: 8 //粗细 + }, 3000 ); + return flyLine; +} +function initFlyLine( curve, matSetting, pointsNumber ) { + var points = curve.getPoints( pointsNumber ); + var geometry = new THREE.BufferGeometry().setFromPoints( points ); + const length = points.length; + var percents = new Float32Array( length ); + for (let i = 0; i < points.length; i += 1) { + percents[i] = ( i / length ); + } + geometry.setAttribute( 'percent', new THREE.BufferAttribute( percents, 1 ) ); + const lineMaterial = initLineMaterial( matSetting ); + var flyLine = new THREE.Points( geometry, lineMaterial ); + return flyLine; + } + + function initLineMaterial( setting ) { + const number = setting ? ( Number( setting.number ) || 1.0 ) : 1.0; + const speed = setting ? ( Number( setting.speed ) || 1.0 ) : 1.0; + const length = setting ? ( Number( setting.length ) || 0.5 ) : 0.5; + const size = setting ? ( Number( setting.size ) || 3.0 ) : 3.0; + const color = setting ? setting.color || new THREE.Vector3( 0, 1, 1 ) : new THREE.Vector3( 0, 1, 1 ); + const singleUniforms = { + u_time: uniforms.u_time, + number: { type: 'f', value: number }, + speed: { type: 'f', value: speed }, + length: { type: 'f', value: length }, + size: { type: 'f', value: size }, + color: { type: 'v3', value: color } + }; + const lineMaterial = new THREE.ShaderMaterial( { + uniforms: singleUniforms, + vertexShader: vertexShader, + fragmentShader: fragmentShader, + transparent: true + } ); + return lineMaterial; + } +////////////////////////////////---- -------------- aes -------------------- +!function (t, n) { + "object" == typeof exports ? module.exports = exports = n() : "function" == typeof define && define.amd ? define([], n) : t.CryptoJS = n() +}(this, function () { + var t = t || function (t, n) { + var i = Object.create || function () { + function t() {} + return function (n) { + var i; + return t.prototype = n, i = new t, t.prototype = null, i + } + }(), + e = {}, + r = e.lib = {}, + o = r.Base = function () { + return { + extend: function (t) { + var n = i(this); + return t && n.mixIn(t), n.hasOwnProperty("init") && this.init !== n.init || (n.init = function () { + n.$super.init.apply(this, arguments) + }), n.init.prototype = n, n.$super = this, n + }, + create: function () { + var t = this.extend(); + return t.init.apply(t, arguments), t + }, + init: function () {}, + mixIn: function (t) { + for (var n in t) t.hasOwnProperty(n) && (this[n] = t[n]); + t.hasOwnProperty("toString") && (this.toString = t.toString) + }, + clone: function () { + return this.init.prototype.extend(this) + } + } + }(), + s = r.WordArray = o.extend({ + init: function (t, i) { + t = this.words = t || [], i != n ? this.sigBytes = i : this.sigBytes = 4 * t.length + }, + toString: function (t) { + return (t || c).stringify(this) + }, + concat: function (t) { + var n = this.words, + i = t.words, + e = this.sigBytes, + r = t.sigBytes; + if (this.clamp(), e % 4) + for (var o = 0; o < r; o++) { + var s = i[o >>> 2] >>> 24 - o % 4 * 8 & 255; + n[e + o >>> 2] |= s << 24 - (e + o) % 4 * 8 + } else + for (var o = 0; o < r; o += 4) n[e + o >>> 2] = i[o >>> 2]; + return this.sigBytes += r, this + }, + clamp: function () { + var n = this.words, + i = this.sigBytes; + n[i >>> 2] &= 4294967295 << 32 - i % 4 * 8, n.length = t.ceil(i / 4) + }, + clone: function () { + var t = o.clone.call(this); + return t.words = this.words.slice(0), t + }, + random: function (n) { + for (var i, e = [], r = function (n) { + var n = n, + i = 987654321, + e = 4294967295; + return function () { + i = 36969 * (65535 & i) + (i >> 16) & e, n = 18e3 * (65535 & n) + (n >> 16) & e; + var r = (i << 16) + n & e; + return r /= 4294967296, r += .5, r * (t.random() > .5 ? 1 : -1) + } + }, o = 0; o < n; o += 4) { + var a = r(4294967296 * (i || t.random())); + i = 987654071 * a(), e.push(4294967296 * a() | 0) + } + return new s.init(e, n) + } + }), + a = e.enc = {}, + c = a.Hex = { + stringify: function (t) { + for (var n = t.words, i = t.sigBytes, e = [], r = 0; r < i; r++) { + var o = n[r >>> 2] >>> 24 - r % 4 * 8 & 255; + e.push((o >>> 4).toString(16)), e.push((15 & o).toString(16)) + } + return e.join("") + }, + parse: function (t) { + for (var n = t.length, i = [], e = 0; e < n; e += 2) i[e >>> 3] |= parseInt(t.substr(e, 2), 16) << 24 - e % 8 * 4; + return new s.init(i, n / 2) + } + }, + u = a.Latin1 = { + stringify: function (t) { + for (var n = t.words, i = t.sigBytes, e = [], r = 0; r < i; r++) { + var o = n[r >>> 2] >>> 24 - r % 4 * 8 & 255; + e.push(String.fromCharCode(o)) + } + return e.join("") + }, + parse: function (t) { + for (var n = t.length, i = [], e = 0; e < n; e++) i[e >>> 2] |= (255 & t.charCodeAt(e)) << 24 - e % 4 * 8; + return new s.init(i, n) + } + }, + f = a.Utf8 = { + stringify: function (t) { + try { + return decodeURIComponent(escape(u.stringify(t))) + } catch (t) { + throw new Error("Malformed UTF-8 data") + } + }, + parse: function (t) { + return u.parse(unescape(encodeURIComponent(t))) + } + }, + h = r.BufferedBlockAlgorithm = o.extend({ + reset: function () { + this._data = new s.init, this._nDataBytes = 0 + }, + _append: function (t) { + "string" == typeof t && (t = f.parse(t)), this._data.concat(t), this._nDataBytes += t.sigBytes + }, + _process: function (n) { + var i = this._data, + e = i.words, + r = i.sigBytes, + o = this.blockSize, + a = 4 * o, + c = r / a; + c = n ? t.ceil(c) : t.max((0 | c) - this._minBufferSize, 0); + var u = c * o, + f = t.min(4 * u, r); + if (u) { + for (var h = 0; h < u; h += o) this._doProcessBlock(e, h); + var p = e.splice(0, u); + i.sigBytes -= f + } + return new s.init(p, f) + }, + clone: function () { + var t = o.clone.call(this); + return t._data = this._data.clone(), t + }, + _minBufferSize: 0 + }), + p = (r.Hasher = h.extend({ + cfg: o.extend(), + init: function (t) { + this.cfg = this.cfg.extend(t), this.reset() + }, + reset: function () { + h.reset.call(this), this._doReset() + }, + update: function (t) { + return this._append(t), this._process(), this + }, + finalize: function (t) { + t && this._append(t); + var n = this._doFinalize(); + return n + }, + blockSize: 16, + _createHelper: function (t) { + return function (n, i) { + return new t.init(i).finalize(n) + } + }, + _createHmacHelper: function (t) { + return function (n, i) { + return new p.HMAC.init(t, i).finalize(n) + } + } + }), e.algo = {}); + return e + }(Math); + return t +}); +! function (e, t, i) { + "object" == typeof exports ? module.exports = exports = t(require("./core.min"), require("./sha1.min"), require("./hmac.min")) : "function" == typeof define && define.amd ? define(["./core.min", "./sha1.min", "./hmac.min"], t) : t(e.CryptoJS) +}(this, function (e) { + return function () { + var t = e, + i = t.lib, + r = i.Base, + n = i.WordArray, + o = t.algo, + a = o.MD5, + c = o.EvpKDF = r.extend({ + cfg: r.extend({ + keySize: 4, + hasher: a, + iterations: 1 + }), + init: function (e) { + this.cfg = this.cfg.extend(e) + }, + compute: function (e, t) { + for (var i = this.cfg, r = i.hasher.create(), o = n.create(), a = o.words, c = i.keySize, f = i.iterations; a.length < c;) { + s && r.update(s); + var s = r.update(e).finalize(t); + r.reset(); + for (var u = 1; u < f; u++) s = r.finalize(s), r.reset(); + o.concat(s) + } + return o.sigBytes = 4 * c, o + } + }); + t.EvpKDF = function (e, t, i) { + return c.create(i).compute(e, t) + } + }(), e.EvpKDF +}); +! function (r, e) { + "object" == typeof exports ? module.exports = exports = e(require("./core.min")) : "function" == typeof define && define.amd ? define(["./core.min"], e) : e(r.CryptoJS) +}(this, function (r) { + return function () { + function e(r, e, t) { + for (var n = [], i = 0, o = 0; o < e; o++) + if (o % 4) { + var f = t[r.charCodeAt(o - 1)] << o % 4 * 2, + c = t[r.charCodeAt(o)] >>> 6 - o % 4 * 2; + n[i >>> 2] |= (f | c) << 24 - i % 4 * 8, i++ + } return a.create(n, i) + } + var t = r, + n = t.lib, + a = n.WordArray, + i = t.enc; + i.Base64 = { + stringify: function (r) { + var e = r.words, + t = r.sigBytes, + n = this._map; + r.clamp(); + for (var a = [], i = 0; i < t; i += 3) + for (var o = e[i >>> 2] >>> 24 - i % 4 * 8 & 255, f = e[i + 1 >>> 2] >>> 24 - (i + 1) % 4 * 8 & 255, c = e[i + 2 >>> 2] >>> 24 - (i + 2) % 4 * 8 & 255, s = o << 16 | f << 8 | c, h = 0; h < 4 && i + .75 * h < t; h++) a.push(n.charAt(s >>> 6 * (3 - h) & 63)); + var p = n.charAt(64); + if (p) + for (; a.length % 4;) a.push(p); + return a.join("") + }, + parse: function (r) { + var t = r.length, + n = this._map, + a = this._reverseMap; + if (!a) { + a = this._reverseMap = []; + for (var i = 0; i < n.length; i++) a[n.charCodeAt(i)] = i + } + var o = n.charAt(64); + if (o) { + var f = r.indexOf(o); + f !== -1 && (t = f) + } + return e(r, t, a) + }, + _map: "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=" + } + }(), r.enc.Base64 +}); +! function (e, t, r) { + "object" == typeof exports ? module.exports = exports = t(require("./core.min"), require("./evpkdf.min")) : "function" == typeof define && define.amd ? define(["./core.min", "./evpkdf.min"], t) : t(e.CryptoJS) +}(this, function (e) { + e.lib.Cipher || function (t) { + var r = e, + i = r.lib, + n = i.Base, + c = i.WordArray, + o = i.BufferedBlockAlgorithm, + s = r.enc, + a = (s.Utf8, s.Base64), + f = r.algo, + p = f.EvpKDF, + d = i.Cipher = o.extend({ + cfg: n.extend(), + createEncryptor: function (e, t) { + return this.create(this._ENC_XFORM_MODE, e, t) + }, + createDecryptor: function (e, t) { + return this.create(this._DEC_XFORM_MODE, e, t) + }, + init: function (e, t, r) { + this.cfg = this.cfg.extend(r), this._xformMode = e, this._key = t, this.reset() + }, + reset: function () { + o.reset.call(this), this._doReset() + }, + process: function (e) { + return this._append(e), this._process() + }, + finalize: function (e) { + e && this._append(e); + var t = this._doFinalize(); + return t + }, + keySize: 4, + ivSize: 4, + _ENC_XFORM_MODE: 1, + _DEC_XFORM_MODE: 2, + _createHelper: function () { + function e(e) { + return "string" == typeof e ? B : x + } + return function (t) { + return { + encrypt: function (r, i, n) { + return e(i).encrypt(t, r, i, n) + }, + decrypt: function (r, i, n) { + return e(i).decrypt(t, r, i, n) + } + } + } + }() + }), + h = (i.StreamCipher = d.extend({ + _doFinalize: function () { + var e = this._process(!0); + return e + }, + blockSize: 1 + }), r.mode = {}), + u = i.BlockCipherMode = n.extend({ + createEncryptor: function (e, t) { + return this.Encryptor.create(e, t) + }, + createDecryptor: function (e, t) { + return this.Decryptor.create(e, t) + }, + init: function (e, t) { + this._cipher = e, this._iv = t + } + }), + l = h.CBC = function () { + function e(e, r, i) { + var n = this._iv; + if (n) { + var c = n; + this._iv = t + } else var c = this._prevBlock; + for (var o = 0; o < i; o++) e[r + o] ^= c[o] + } + var r = u.extend(); + return r.Encryptor = r.extend({ + processBlock: function (t, r) { + var i = this._cipher, + n = i.blockSize; + e.call(this, t, r, n), i.encryptBlock(t, r), this._prevBlock = t.slice(r, r + n) + } + }), r.Decryptor = r.extend({ + processBlock: function (t, r) { + var i = this._cipher, + n = i.blockSize, + c = t.slice(r, r + n); + i.decryptBlock(t, r), e.call(this, t, r, n), this._prevBlock = c + } + }), r + }(), + _ = r.pad = {}, + v = _.Pkcs7 = { + pad: function (e, t) { + for (var r = 4 * t, i = r - e.sigBytes % r, n = i << 24 | i << 16 | i << 8 | i, o = [], s = 0; s < i; s += 4) o.push(n); + var a = c.create(o, i); + e.concat(a) + }, + unpad: function (e) { + var t = 255 & e.words[e.sigBytes - 1 >>> 2]; + e.sigBytes -= t + } + }, + y = (i.BlockCipher = d.extend({ + cfg: d.cfg.extend({ + mode: l, + padding: v + }), + reset: function () { + d.reset.call(this); + var e = this.cfg, + t = e.iv, + r = e.mode; + if (this._xformMode == this._ENC_XFORM_MODE) var i = r.createEncryptor; + else { + var i = r.createDecryptor; + this._minBufferSize = 1 + } + this._mode && this._mode.__creator == i ? this._mode.init(this, t && t.words) : (this._mode = i.call(r, this, t && t.words), this._mode.__creator = i) + }, + _doProcessBlock: function (e, t) { + this._mode.processBlock(e, t) + }, + _doFinalize: function () { + var e = this.cfg.padding; + if (this._xformMode == this._ENC_XFORM_MODE) { + e.pad(this._data, this.blockSize); + var t = this._process(!0) + } else { + var t = this._process(!0); + e.unpad(t) + } + return t + }, + blockSize: 4 + }), i.CipherParams = n.extend({ + init: function (e) { + this.mixIn(e) + }, + toString: function (e) { + return (e || this.formatter).stringify(this) + } + })), + m = r.format = {}, + k = m.OpenSSL = { + stringify: function (e) { + var t = e.ciphertext, + r = e.salt; + if (r) var i = c.create([1398893684, 1701076831]).concat(r).concat(t); + else var i = t; + return i.toString(a) + }, + parse: function (e) { + var t = a.parse(e), + r = t.words; + if (1398893684 == r[0] && 1701076831 == r[1]) { + var i = c.create(r.slice(2, 4)); + r.splice(0, 4), t.sigBytes -= 16 + } + return y.create({ + ciphertext: t, + salt: i + }) + } + }, + x = i.SerializableCipher = n.extend({ + cfg: n.extend({ + format: k + }), + encrypt: function (e, t, r, i) { + i = this.cfg.extend(i); + var n = e.createEncryptor(r, i), + c = n.finalize(t), + o = n.cfg; + return y.create({ + ciphertext: c, + key: r, + iv: o.iv, + algorithm: e, + mode: o.mode, + padding: o.padding, + blockSize: e.blockSize, + formatter: i.format + }) + }, + decrypt: function (e, t, r, i) { + i = this.cfg.extend(i), t = this._parse(t, i.format); + var n = e.createDecryptor(r, i).finalize(t.ciphertext); + return n + }, + _parse: function (e, t) { + return "string" == typeof e ? t.parse(e, this) : e + } + }), + g = r.kdf = {}, + S = g.OpenSSL = { + execute: function (e, t, r, i) { + i || (i = c.random(8)); + var n = p.create({ + keySize: t + r + }).compute(e, i), + o = c.create(n.words.slice(t), 4 * r); + return n.sigBytes = 4 * t, y.create({ + key: n, + iv: o, + salt: i + }) + } + }, + B = i.PasswordBasedCipher = x.extend({ + cfg: x.cfg.extend({ + kdf: S + }), + encrypt: function (e, t, r, i) { + i = this.cfg.extend(i); + var n = i.kdf.execute(r, e.keySize, e.ivSize); + i.iv = n.iv; + var c = x.encrypt.call(this, e, t, n.key, i); + return c.mixIn(n), c + }, + decrypt: function (e, t, r, i) { + i = this.cfg.extend(i), t = this._parse(t, i.format); + var n = i.kdf.execute(r, e.keySize, e.ivSize, t.salt); + i.iv = n.iv; + var c = x.decrypt.call(this, e, t, n.key, i); + return c + } + }) + }() +}); +! function (e, i) { + "object" == typeof exports ? module.exports = exports = i(require("./core.min")) : "function" == typeof define && define.amd ? define(["./core.min"], i) : i(e.CryptoJS) +}(this, function (e) { + ! function () { + var i = e, + t = i.lib, + n = t.Base, + s = i.enc, + r = s.Utf8, + o = i.algo; + o.HMAC = n.extend({ + init: function (e, i) { + e = this._hasher = new e.init, "string" == typeof i && (i = r.parse(i)); + var t = e.blockSize, + n = 4 * t; + i.sigBytes > n && (i = e.finalize(i)), i.clamp(); + for (var s = this._oKey = i.clone(), o = this._iKey = i.clone(), a = s.words, f = o.words, c = 0; c < t; c++) a[c] ^= 1549556828, f[c] ^= 909522486; + s.sigBytes = o.sigBytes = n, this.reset() + }, + reset: function () { + var e = this._hasher; + e.reset(), e.update(this._iKey) + }, + update: function (e) { + return this._hasher.update(e), this + }, + finalize: function (e) { + var i = this._hasher, + t = i.finalize(e); + i.reset(); + var n = i.finalize(this._oKey.clone().concat(t)); + return n + } + }) + }() +}); +! function (e, o, r) { + "object" == typeof exports ? module.exports = exports = o(require("./core.min"), require("./cipher-core.min")) : "function" == typeof define && define.amd ? define(["./core.min", "./cipher-core.min"], o) : o(e.CryptoJS) +}(this, function (e) { + return e.mode.ECB = function () { + var o = e.lib.BlockCipherMode.extend(); + return o.Encryptor = o.extend({ + processBlock: function (e, o) { + this._cipher.encryptBlock(e, o) + } + }), o.Decryptor = o.extend({ + processBlock: function (e, o) { + this._cipher.decryptBlock(e, o) + } + }), o + }(), e.mode.ECB +}); +! function (e, r, i) { + "object" == typeof exports ? module.exports = exports = r(require("./core.min"), require("./cipher-core.min")) : "function" == typeof define && define.amd ? define(["./core.min", "./cipher-core.min"], r) : r(e.CryptoJS) +}(this, function (e) { + return e.pad.Pkcs7 +}); +! function (e, r, i) { + "object" == typeof exports ? module.exports = exports = r(require("./core.min"), require("./enc-base64.min"), require("./md5.min"), require("./evpkdf.min"), require("./cipher-core.min")) : "function" == typeof define && define.amd ? define(["./core.min", "./enc-base64.min", "./md5.min", "./evpkdf.min", "./cipher-core.min"], r) : r(e.CryptoJS) +}(this, function (e) { + return function () { + var r = e, + i = r.lib, + n = i.BlockCipher, + o = r.algo, + t = [], + c = [], + s = [], + f = [], + a = [], + d = [], + u = [], + v = [], + h = [], + y = []; + ! function () { + for (var e = [], r = 0; r < 256; r++) r < 128 ? e[r] = r << 1 : e[r] = r << 1 ^ 283; + for (var i = 0, n = 0, r = 0; r < 256; r++) { + var o = n ^ n << 1 ^ n << 2 ^ n << 3 ^ n << 4; + o = o >>> 8 ^ 255 & o ^ 99, t[i] = o, c[o] = i; + var p = e[i], + l = e[p], + _ = e[l], + k = 257 * e[o] ^ 16843008 * o; + s[i] = k << 24 | k >>> 8, f[i] = k << 16 | k >>> 16, a[i] = k << 8 | k >>> 24, d[i] = k; + var k = 16843009 * _ ^ 65537 * l ^ 257 * p ^ 16843008 * i; + u[o] = k << 24 | k >>> 8, v[o] = k << 16 | k >>> 16, h[o] = k << 8 | k >>> 24, y[o] = k, i ? (i = p ^ e[e[e[_ ^ p]]], n ^= e[e[n]]) : i = n = 1 + } + }(); + var p = [0, 1, 2, 4, 8, 16, 32, 64, 128, 27, 54], + l = o.AES = n.extend({ + _doReset: function () { + if (!this._nRounds || this._keyPriorReset !== this._key) { + for (var e = this._keyPriorReset = this._key, r = e.words, i = e.sigBytes / 4, n = this._nRounds = i + 6, o = 4 * (n + 1), c = this._keySchedule = [], s = 0; s < o; s++) + if (s < i) c[s] = r[s]; + else { + var f = c[s - 1]; + s % i ? i > 6 && s % i == 4 && (f = t[f >>> 24] << 24 | t[f >>> 16 & 255] << 16 | t[f >>> 8 & 255] << 8 | t[255 & f]) : (f = f << 8 | f >>> 24, f = t[f >>> 24] << 24 | t[f >>> 16 & 255] << 16 | t[f >>> 8 & 255] << 8 | t[255 & f], f ^= p[s / i | 0] << 24), c[s] = c[s - i] ^ f + } for (var a = this._invKeySchedule = [], d = 0; d < o; d++) { + var s = o - d; + if (d % 4) var f = c[s]; + else var f = c[s - 4]; + d < 4 || s <= 4 ? a[d] = f : a[d] = u[t[f >>> 24]] ^ v[t[f >>> 16 & 255]] ^ h[t[f >>> 8 & 255]] ^ y[t[255 & f]] + } + } + }, + encryptBlock: function (e, r) { + this._doCryptBlock(e, r, this._keySchedule, s, f, a, d, t) + }, + decryptBlock: function (e, r) { + var i = e[r + 1]; + e[r + 1] = e[r + 3], e[r + 3] = i, this._doCryptBlock(e, r, this._invKeySchedule, u, v, h, y, c); + var i = e[r + 1]; + e[r + 1] = e[r + 3], e[r + 3] = i + }, + _doCryptBlock: function (e, r, i, n, o, t, c, s) { + for (var f = this._nRounds, a = e[r] ^ i[0], d = e[r + 1] ^ i[1], u = e[r + 2] ^ i[2], v = e[r + 3] ^ i[3], h = 4, y = 1; y < f; y++) { + var p = n[a >>> 24] ^ o[d >>> 16 & 255] ^ t[u >>> 8 & 255] ^ c[255 & v] ^ i[h++], + l = n[d >>> 24] ^ o[u >>> 16 & 255] ^ t[v >>> 8 & 255] ^ c[255 & a] ^ i[h++], + _ = n[u >>> 24] ^ o[v >>> 16 & 255] ^ t[a >>> 8 & 255] ^ c[255 & d] ^ i[h++], + k = n[v >>> 24] ^ o[a >>> 16 & 255] ^ t[d >>> 8 & 255] ^ c[255 & u] ^ i[h++]; + a = p, d = l, u = _, v = k + } + var p = (s[a >>> 24] << 24 | s[d >>> 16 & 255] << 16 | s[u >>> 8 & 255] << 8 | s[255 & v]) ^ i[h++], + l = (s[d >>> 24] << 24 | s[u >>> 16 & 255] << 16 | s[v >>> 8 & 255] << 8 | s[255 & a]) ^ i[h++], + _ = (s[u >>> 24] << 24 | s[v >>> 16 & 255] << 16 | s[a >>> 8 & 255] << 8 | s[255 & d]) ^ i[h++], + k = (s[v >>> 24] << 24 | s[a >>> 16 & 255] << 16 | s[d >>> 8 & 255] << 8 | s[255 & u]) ^ i[h++]; + e[r] = p, e[r + 1] = l, e[r + 2] = _, e[r + 3] = k + }, + keySize: 8 + }); + r.AES = n._createHelper(l) + }(), e.AES +}); +! function (e, n) { + "object" == typeof exports ? module.exports = exports = n(require("./core.min")) : "function" == typeof define && define.amd ? define(["./core.min"], n) : n(e.CryptoJS) +}(this, function (e) { + return e.enc.Utf8 +}); +/* + * 热力图 heatmap.js v2.0.2 + */ +(function(a,b,c){if(typeof module!=="undefined"&&module.exports){module.exports=c()}else if(typeof define==="function"&&define.amd){define(c)}else{b[a]=c()}})("h337",this,function(){var a={defaultRadius:40,defaultRenderer:"canvas2d",defaultGradient:{.25:"rgb(0,0,255)",.55:"rgb(0,255,0)",.85:"yellow",1:"rgb(255,0,0)"},defaultMaxOpacity:1,defaultMinOpacity:0,defaultBlur:.85,defaultXField:"x",defaultYField:"y",defaultValueField:"value",plugins:{}};var b=function h(){var b=function d(a){this._coordinator={};this._data=[];this._radi=[];this._min=0;this._max=1;this._xField=a["xField"]||a.defaultXField;this._yField=a["yField"]||a.defaultYField;this._valueField=a["valueField"]||a.defaultValueField;if(a["radius"]){this._cfgRadius=a["radius"]}};var c=a.defaultRadius;b.prototype={_organiseData:function(a,b){var d=a[this._xField];var e=a[this._yField];var f=this._radi;var g=this._data;var h=this._max;var i=this._min;var j=a[this._valueField]||1;var k=a.radius||this._cfgRadius||c;if(!g[d]){g[d]=[];f[d]=[]}if(!g[d][e]){g[d][e]=j;f[d][e]=k}else{g[d][e]+=j}if(g[d][e]>h){if(!b){this._max=g[d][e]}else{this.setDataMax(g[d][e])}return false}else{return{x:d,y:e,value:j,radius:k,min:i,max:h}}},_unOrganizeData:function(){var a=[];var b=this._data;var c=this._radi;for(var d in b){for(var e in b[d]){a.push({x:d,y:e,radius:c[d][e],value:b[d][e]})}}return{min:this._min,max:this._max,data:a}},_onExtremaChange:function(){this._coordinator.emit("extremachange",{min:this._min,max:this._max})},addData:function(){if(arguments[0].length>0){var a=arguments[0];var b=a.length;while(b--){this.addData.call(this,a[b])}}else{var c=this._organiseData(arguments[0],true);if(c){this._coordinator.emit("renderpartial",{min:this._min,max:this._max,data:[c]})}}return this},setData:function(a){var b=a.data;var c=b.length;this._data=[];this._radi=[];for(var d=0;d 0){this._drawAlpha(a);this._colorize()}},renderAll:function(a){this._clear();if(a.data.length>0){this._drawAlpha(c(a));this._colorize()}},_updateGradient:function(b){this._palette=a(b)},updateConfig:function(a){if(a["gradient"]){this._updateGradient(a)}this._setStyles(a)},setDimensions:function(a,b){this._width=a;this._height=b;this.canvas.width=this.shadowCanvas.width=a;this.canvas.height=this.shadowCanvas.height=b},_clear:function(){this.shadowCtx.clearRect(0,0,this._width,this._height);this.ctx.clearRect(0,0,this._width,this._height)},_setStyles:function(a){this._blur=a.blur==0?0:a.blur||a.defaultBlur;if(a.backgroundColor){this.canvas.style.backgroundColor=a.backgroundColor}this._width=this.canvas.width=this.shadowCanvas.width=a.width||this._width;this._height=this.canvas.height=this.shadowCanvas.height=a.height||this._height;this._opacity=(a.opacity||0)*255;this._maxOpacity=(a.maxOpacity||a.defaultMaxOpacity)*255;this._minOpacity=(a.minOpacity||a.defaultMinOpacity)*255;this._useGradientOpacity=!!a.useGradientOpacity},_drawAlpha:function(a){var c=this._min=a.min;var d=this._max=a.max;var a=a.data||[];var e=a.length;var f=1-this._blur;while(e--){var g=a[e];var h=g.x;var i=g.y;var j=g.radius;var k=Math.min(g.value,d);var l=h-j;var m=i-j;var n=this.shadowCtx;var o;if(!this._templates[j]){this._templates[j]=o=b(j,f)}else{o=this._templates[j]}var p=(k-c)/(d-c);n.globalAlpha=p<.01?.01:p;n.drawImage(o,l,m);if(l this._renderBoundaries[2]){this._renderBoundaries[2]=l+2*j}if(m+2*j>this._renderBoundaries[3]){this._renderBoundaries[3]=m+2*j}}},_colorize:function(){var a=this._renderBoundaries[0];var b=this._renderBoundaries[1];var c=this._renderBoundaries[2]-a;var d=this._renderBoundaries[3]-b;var e=this._width;var f=this._height;var g=this._opacity;var h=this._maxOpacity;var i=this._minOpacity;var j=this._useGradientOpacity;if(a<0){a=0}if(b<0){b=0}if(a+c>e){c=e-a}if(b+d>f){d=f-b}var k=this.shadowCtx.getImageData(a,b,c,d);var l=k.data;var m=l.length;var n=this._palette;for(var o=3;o 0){r=g}else{if(p >0;return b},getDataURL:function(){return this.canvas.toDataURL()}};return d}();var d=function j(){var b=false;if(a["defaultRenderer"]==="canvas2d"){b=c}return b}();var e={merge:function(){var a={};var b=arguments.length;for(var c=0;ct.length)&&(e=t.length);for(var r=0,i=new Array(e);r 0&&void 0!==arguments[0]?arguments[0]:"",r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:10,i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"rgba(255, 255, 255, 1)";return function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,f),(t=u.call(this,new c.SpriteMaterial))._text="".concat(e),t._textHeight=r,t._color=i,t._backgroundColor=!1,t._padding=0,t._borderWidth=0,t._borderRadius=0,t._borderColor="white",t._strokeWidth=0,t._strokeColor="white",t._fontFace="system-ui",t._fontSize=90,t._fontWeight="normal",t._canvas=document.createElement("canvas"),t._genCanvas(),t}return r=f,(n=[{key:"text",get:function(){return this._text},set:function(t){this._text=t,this._genCanvas()}},{key:"textHeight",get:function(){return this._textHeight},set:function(t){this._textHeight=t,this._genCanvas()}},{key:"color",get:function(){return this._color},set:function(t){this._color=t,this._genCanvas()}},{key:"backgroundColor",get:function(){return this._backgroundColor},set:function(t){this._backgroundColor=t,this._genCanvas()}},{key:"padding",get:function(){return this._padding},set:function(t){this._padding=t,this._genCanvas()}},{key:"borderWidth",get:function(){return this._borderWidth},set:function(t){this._borderWidth=t,this._genCanvas()}},{key:"borderRadius",get:function(){return this._borderRadius},set:function(t){this._borderRadius=t,this._genCanvas()}},{key:"borderColor",get:function(){return this._borderColor},set:function(t){this._borderColor=t,this._genCanvas()}},{key:"fontFace",get:function(){return this._fontFace},set:function(t){this._fontFace=t,this._genCanvas()}},{key:"fontSize",get:function(){return this._fontSize},set:function(t){this._fontSize=t,this._genCanvas()}},{key:"fontWeight",get:function(){return this._fontWeight},set:function(t){this._fontWeight=t,this._genCanvas()}},{key:"strokeWidth",get:function(){return this._strokeWidth},set:function(t){this._strokeWidth=t,this._genCanvas()}},{key:"strokeColor",get:function(){return this._strokeColor},set:function(t){this._strokeColor=t,this._genCanvas()}},{key:"_genCanvas",value:function(){var t=this,e=this._canvas,r=e.getContext("2d"),i=Array.isArray(this.borderWidth)?this.borderWidth:[this.borderWidth,this.borderWidth],n=i.map((function(e){return e*t.fontSize*.1})),o=(Array.isArray(this.borderRadius)?this.borderRadius:[this.borderRadius,this.borderRadius,this.borderRadius,this.borderRadius]).map((function(e){return e*t.fontSize*.1})),s=Array.isArray(this.padding)?this.padding:[this.padding,this.padding],u=s.map((function(e){return e*t.fontSize*.1})),f=this.text.split("\n"),l="".concat(this.fontWeight," ").concat(this.fontSize,"px ").concat(this.fontFace);r.font=l;var d=Math.max.apply(Math,h(f.map((function(t){return r.measureText(t).width})))),p=this.fontSize*f.length;if(e.width=d+2*n[0]+2*u[0],e.height=p+2*n[1]+2*u[1],this.borderWidth){if(r.strokeStyle=this.borderColor,n[0]){var g=n[0]/2;r.lineWidth=n[0],r.beginPath(),r.moveTo(g,o[0]),r.lineTo(g,e.height-o[3]),r.moveTo(e.width-g,o[1]),r.lineTo(e.width-g,e.height-o[2]),r.stroke()}if(n[1]){var y=n[1]/2;r.lineWidth=n[1],r.beginPath(),r.moveTo(Math.max(n[0],o[0]),y),r.lineTo(e.width-Math.max(n[0],o[1]),y),r.moveTo(Math.max(n[0],o[3]),e.height-y),r.lineTo(e.width-Math.max(n[0],o[2]),e.height-y),r.stroke()}if(this.borderRadius){var b=Math.max.apply(Math,h(n)),v=b/2;r.lineWidth=b,r.beginPath(),[!!o[0]&&[o[0],v,v,o[0]],!!o[1]&&[e.width-o[1],e.width-v,v,o[1]],!!o[2]&&[e.width-o[2],e.width-v,e.height-v,e.height-o[2]],!!o[3]&&[o[3],v,e.height-v,e.height-o[3]]].filter((function(t){return t})).forEach((function(t){var e=a(t,4),i=e[0],n=e[1],o=e[2],h=e[3];r.moveTo(i,o),r.quadraticCurveTo(n,o,n,h)})),r.stroke()}}this.backgroundColor&&(r.fillStyle=this.backgroundColor,this.borderRadius?(r.beginPath(),r.moveTo(n[0],o[0]),[[n[0],o[0],e.width-o[1],n[1],n[1],n[1]],[e.width-n[0],e.width-n[0],e.width-n[0],n[1],o[1],e.height-o[2]],[e.width-n[0],e.width-o[2],o[3],e.height-n[1],e.height-n[1],e.height-n[1]],[n[0],n[0],n[0],e.height-n[1],e.height-o[3],o[0]]].forEach((function(t){var e=a(t,6),i=e[0],n=e[1],o=e[2],h=e[3],s=e[4],u=e[5];r.quadraticCurveTo(i,h,n,s),r.lineTo(o,u)})),r.closePath(),r.fill()):r.fillRect(n[0],n[1],e.width-2*n[0],e.height-2*n[1])),r.translate.apply(r,h(n)),r.translate.apply(r,h(u)),r.font=l,r.fillStyle=this.color,r.textBaseline="bottom";var _=this.strokeWidth>0;_&&(r.lineWidth=this.strokeWidth*this.fontSize/10,r.strokeStyle=this.strokeColor),f.forEach((function(e,i){var n=(d-r.measureText(e).width)/2,o=(i+1)*t.fontSize;_&&r.strokeText(e,n,o),r.fillText(e,n,o)})),this.material.map&&this.material.map.dispose();var m=this.material.map=new c.Texture(e);m.minFilter=c.LinearFilter,m.colorSpace=c.SRGBColorSpace,m.needsUpdate=!0;var w=spriteScale;this.scale.set(w*e.width/e.height,w,1);this.userData.width=e.width*0.25;this.userData.height=e.height*0.25;}},{key:"clone",value:function(){return new this.constructor(this.text,this.textHeight,this.color).copy(this)}},{key:"copy",value:function(t){return c.Sprite.prototype.copy.call(this,t),this.color=t.color,this.backgroundColor=t.backgroundColor,this.padding=t.padding,this.borderWidth=t.borderWidth,this.borderColor=t.borderColor,this.fontFace=t.fontFace,this.fontSize=t.fontSize,this.fontWeight=t.fontWeight,this.strokeWidth=t.strokeWidth,this.strokeColor=t.strokeColor,this}}])&&e(r.prototype,n),s&&e(r,s),Object.defineProperty(r,"prototype",{writable:!1}),f}(c.Sprite);return f}));