define(function () { /** * 状态值 * @type {Boolean} * @default false * @private */ var status = { initialized: false, //是否初始化 }; /** * 模块数据 用于数据存储和外部调用 * @type {Object} * 数据存放 */ var modValue = { title: "环视分析", }; /** * 3D 环视初始化 */ function init() { if (!status.initialized) { subscribe(); status.initialized = true; map3DViewer.lookAroundAnalysis({ action: "add", callback: callback }) } ONEMAP.C.publisher.publish({ modName: 'tool3DLookAroundAnalysis' }, 'tools:active'); }; /** * 注册监听事件 */ function subscribe() { ONEMAP.C.publisher.subscribe(remove, 'tools:active'); ONEMAP.C.publisher.subscribe(clear, 'cleanMap'); ONEMAP.C.publisher.subscribe(removeEvent, 'change23D'); }; // 23D转换 function removeEvent() { map3DViewer.lookAroundAnalysis({ action: "remove" }) $('#toolLookAroundAnalysisPanel').remove(); if ($(".tools-lookAroundAnalysis").hasClass('cur')) { $(".tools-lookAroundAnalysis").removeClass('cur'); } } /** * 3D环视 加载/移除 注册事件 */ function remove(options) { if (options.modName != 'tool3DLookAroundAnalysis') { if (options.modName == 'cleanMap') { clear(); } removeAndClear(); $(".tools-lookAroundAnalysis").removeClass('cur'); } else { if ($(".tools-lookAroundAnalysis").hasClass('cur')) { $(".tools-lookAroundAnalysis").removeClass('cur'); removeAndClear(); } else { $(".tools-lookAroundAnalysis").addClass('cur'); addPopup(); } } } /** * 移除 3D环视 */ function removeAndClear() { map3DViewer.lookAroundAnalysis({ action: "stop" }) $('#toolLookAroundAnalysisPanel').remove(); }; /** * 清除绘制 3D环视 */ function clear(params) { map3DViewer.lookAroundAnalysis({ action: "remove" }) } /** * 3D环视分析后的回调 */ function callback() { // 退出 ONEMAP.C.publisher.publish({ modName: 'tool3DLookAroundAnalysis' }, 'tools:active'); } // 添加 弹窗 function addPopup() { var html = '