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.radar({ action: "add", callback: callback }) } ONEMAP.C.publisher.publish({ modName: 'tool3DRadar' }, '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.radar({ action: "remove" }) $('#toolRadarPanel').remove(); if ($(".tools-radar").hasClass('cur')) { $(".tools-radar").removeClass('cur'); } } /** * 雷达 加载/移除 注册事件 */ function remove(options) { if (options.modName != 'tool3DRadar') { if (options.modName == 'cleanMap') { clear(); } removeAndClear(); $(".tools-radar").removeClass('cur'); } else { if ($(".tools-radar").hasClass('cur')) { $(".tools-radar").removeClass('cur'); removeAndClear(); } else { $(".tools-radar").addClass('cur'); addPopup(); } } } /** * 移除 雷达 */ function removeAndClear() { map3DViewer.radar({ action: "stop" }) $('#toolRadarPanel').remove(); }; /** * 清除绘制 雷达 */ function clear() { map3DViewer.radar({ action: "remove" }) } /** * 雷达分析后的回调 */ function callback() { // 退出 ONEMAP.C.publisher.publish({ modName: 'tool3DRadar' }, 'tools:active'); } // 添加 弹窗 function addPopup() { var html = '