123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293 |
- 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
- }
- })
|