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; } ONEMAP.C.publisher.publish({ modName: 'tool3DMeasureHeight' }, '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.measureHeight({ action: "remove" }) if ($(".tools-measuringHeight").hasClass('cur')) { $(".tools-measuringHeight").removeClass('cur'); } } /** * 3D通视 加载/移除 注册事件 */ function remove(options) { if (options.modName != 'tool3DMeasureHeight') { if (options.modName == 'cleanMap') { clear(); } removeAndClear(); $(".tools-measuringHeight").removeClass('cur'); } else { if ($(".tools-measuringHeight").hasClass('cur')) { $(".tools-measuringHeight").removeClass('cur'); removeAndClear(); } else { $(".tools-measuringHeight").addClass('cur'); map3DViewer.measureHeight({ action: "add", afterMeasureJudgeContinue: true }) } } } /** * 移除 3D测高 */ function removeAndClear() { map3DViewer.measureHeight({ action: "stop" }) }; /** * 清除绘制 3D测高 */ function clear() { map3DViewer.measureHeight({ action: "clear" }) } return ONEMAP.M.tool3DMeasureHeight = { init: init } })