/******/ (function() { // webpackBootstrap
/******/ 	"use strict";
/******/ 	// The require scope
/******/ 	var __webpack_require__ = {};
/******/ 	
/************************************************************************/
/******/ 	/* webpack/runtime/compat get default export */
/******/ 	!function() {
/******/ 		// getDefaultExport function for compatibility with non-harmony modules
/******/ 		__webpack_require__.n = function(module) {
/******/ 			var getter = module && module.__esModule ?
/******/ 				function() { return module['default']; } :
/******/ 				function() { return module; };
/******/ 			__webpack_require__.d(getter, { a: getter });
/******/ 			return getter;
/******/ 		};
/******/ 	}();
/******/ 	
/******/ 	/* webpack/runtime/define property getters */
/******/ 	!function() {
/******/ 		// define getter functions for harmony exports
/******/ 		__webpack_require__.d = function(exports, definition) {
/******/ 			for(var key in definition) {
/******/ 				if(__webpack_require__.o(definition, key) && !__webpack_require__.o(exports, key)) {
/******/ 					Object.defineProperty(exports, key, { enumerable: true, get: definition[key] });
/******/ 				}
/******/ 			}
/******/ 		};
/******/ 	}();
/******/ 	
/******/ 	/* webpack/runtime/hasOwnProperty shorthand */
/******/ 	!function() {
/******/ 		__webpack_require__.o = function(obj, prop) { return Object.prototype.hasOwnProperty.call(obj, prop); }
/******/ 	}();
/******/ 	
/******/ 	/* webpack/runtime/make namespace object */
/******/ 	!function() {
/******/ 		// define __esModule on exports
/******/ 		__webpack_require__.r = function(exports) {
/******/ 			if(typeof Symbol !== 'undefined' && Symbol.toStringTag) {
/******/ 				Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
/******/ 			}
/******/ 			Object.defineProperty(exports, '__esModule', { value: true });
/******/ 		};
/******/ 	}();
/******/ 	
/************************************************************************/
var __webpack_exports__ = {};
// ESM COMPAT FLAG
__webpack_require__.r(__webpack_exports__);

// EXPORTS
__webpack_require__.d(__webpack_exports__, {
  "StatusBarViewModel": function() { return /* reexport */ StatusBarViewModel; },
  "default": function() { return /* reexport */ StatusBar; }
});

;// CONCATENATED MODULE: external {"root":"Vue","commonjs":"vue","commonjs2":"vue","amd":"vue"}
var external_root_Vue_commonjs_vue_commonjs2_vue_amd_vue_namespaceObject = require("vue");
;// CONCATENATED MODULE: ./node_modules/@babel/runtime/helpers/esm/defineProperty.js
function _defineProperty(obj, key, value) {
  if (key in obj) {
    Object.defineProperty(obj, key, {
      value: value,
      enumerable: true,
      configurable: true,
      writable: true
    });
  } else {
    obj[key] = value;
  }

  return obj;
}
;// CONCATENATED MODULE: external "@zpc_npm/vue-iclient-common/_utils/util"
var util_namespaceObject = require("@zpc_npm/vue-iclient-common/_utils/util");
;// CONCATENATED MODULE: external "@zpc_npm/vue-iclient-common/_utils/gis-utils"
var gis_utils_namespaceObject = require("@zpc_npm/vue-iclient-common/_utils/gis-utils");
;// CONCATENATED MODULE: ./src/leaflet/statusbar/StatusBarViewModel.js



class StatusBarViewModel extends window.L.Evented {
  constructor(options) {
    super();

    _defineProperty(this, "_webMap", null);

    this._props = options.props;
    this._loaded = this._loaded.bind(this);
    this._onMousemove = this._onMousemove.bind(this);
    this._onZoomend = this._onZoomend.bind(this);

    this._registerEvents();
  }
  /**
   * 注册事件
   */


  _registerEvents() {
    gis_utils_namespaceObject.utils.getWebMap(this._mapTarget, this._loaded);
  }

  _loaded(webmap) {
    this._webMap = webmap;

    this._setDefaultData();
  }

  _setDefaultData() {
    if (!this._webMap.map) return;

    this._webMap.map.on("mousemove", this._onMousemove); // 鼠标移动事件


    this._webMap.map.on("zoomend", this._onZoomend); // 鼠标缩放事件


    let center = this._webMap.map.getCenter();

    this._setXY(center);

    this._setLevel();
  }

  _onMousemove(e) {
    this._setXY(e.latlng);
  }

  _setXY(point) {
    let latFixed, lngFixed, lngName, latName;
    let epsg = this._webMap.webMapInfo.spatialReference.epsg;

    if (!(epsg === 4490 || epsg === 4326)) {
      let firstProjection = new proj4.Proj("EPSG:4326");
      let secondProjection = new proj4.Proj("EPSG:" + epsg);
      let result = proj4.transform(firstProjection, secondProjection, [point.lng, point.lat]);
      latFixed = result.y.toFixed(2);
      lngFixed = result.x.toFixed(2);
      lngName = "经度：";
      latName = "纬度：";
    } else {
      latFixed = (0,util_namespaceObject.convertXY)(point.lat);
      lngFixed = (0,util_namespaceObject.convertXY)(point.lng);
      lngName = "X：";
      latName = "Y：";
    }

    this.fire("setXY", {
      lng: lngFixed,
      lat: latFixed,
      lngName,
      latName
    });
  }

  _onZoomend(e) {
    this._setLevel();
  }

  _setLevel() {
    let value = "";

    if (this._props.position && this._props.position === "bottom-center") {
      value += "丨";
    }

    value += "级别：" + this._webMap.map.getZoom();
    this.fire("setLevel", {
      level: value
    });
  }

  destroy() {
    // 删除所有事件监听
    this.off();

    this._webMap.map.off("mousemove", this._onMousemove);

    this._webMap.map.off("zoomend", this._onZoomend);
  }

}
;// CONCATENATED MODULE: ./node_modules/babel-loader/lib/index.js!./node_modules/vue-loader/dist/index.js??ruleSet[0]!./src/leaflet/statusbar/StatusBar.vue?vue&type=script&setup=true&lang=js

const _hoisted_1 = {
  class: "statusbar"
};
const _hoisted_2 = {
  class: "panelItem"
};
const _hoisted_3 = {
  class: "textPanel"
};
const _hoisted_4 = {
  class: "jd"
};
const _hoisted_5 = {
  class: "panelItem"
};
const _hoisted_6 = {
  class: "textPanel"
};
const _hoisted_7 = {
  class: "wd"
};
const _hoisted_8 = {
  class: "jb"
};


const __default__ = {
  name: "Kq2dStatusBar"
};
/* harmony default export */ var StatusBarvue_type_script_setup_true_lang_js = (/*#__PURE__*/Object.assign(__default__, {
  props: {
    // 每个地图相关组件的必须参数 非必传 指定组件绑定的map对象的div的id
    mapTarget: String,
    // bottom-center | bottom-left | bottom-right
    position: {
      type: String,
      default: "bottom-left"
    }
  },

  setup(__props) {
    const props = __props;
    let viewModel = null;
    let lngText = (0,external_root_Vue_commonjs_vue_commonjs2_vue_amd_vue_namespaceObject.ref)("");
    let latText = (0,external_root_Vue_commonjs_vue_commonjs2_vue_amd_vue_namespaceObject.ref)("");
    let lng = (0,external_root_Vue_commonjs_vue_commonjs2_vue_amd_vue_namespaceObject.ref)("");
    let lat = (0,external_root_Vue_commonjs_vue_commonjs2_vue_amd_vue_namespaceObject.ref)("");
    let level = (0,external_root_Vue_commonjs_vue_commonjs2_vue_amd_vue_namespaceObject.ref)("");
    let direction = (0,external_root_Vue_commonjs_vue_commonjs2_vue_amd_vue_namespaceObject.ref)("vertical");
    (0,external_root_Vue_commonjs_vue_commonjs2_vue_amd_vue_namespaceObject.onMounted)(() => {
      viewModel = new StatusBarViewModel({
        props
      }); // 逻辑类监听数据设置事件

      viewModel.on("setXY", _data => {
        lng.value = _data.lng;
        lat.value = _data.lat;
        lngText.value = _data.lngName;
        latText.value = _data.latName;
      });
      viewModel.on("setLevel", _data => {
        level.value = _data.level;
      });
      setPosition();
    });
    (0,external_root_Vue_commonjs_vue_commonjs2_vue_amd_vue_namespaceObject.onBeforeUnmount)(() => {
      viewModel.destroy();
      viewModel = null;
    });

    function setPosition() {
      // position的值只有居中时“bottom-center”，才是横排
      if (props.position && props.position === "bottom-center") {
        direction.value = "horizontal";
        document.querySelector(".statusbar").style.textAlign = "center";
        document.querySelector(".statusbar").style.width = "100%";
        document.querySelector(".statusbar").style.right = "unset";
      } else if (props.position && props.position === "bottom-right") {
        document.querySelector(".statusbar").style.left = "unset";
        document.querySelector(".statusbar").style.right = "20px";
        document.querySelector(".statusbar").style.textAlign = "unset";
      }
    }

    return (_ctx, _cache) => {
      const _component_kq_space = (0,external_root_Vue_commonjs_vue_commonjs2_vue_amd_vue_namespaceObject.resolveComponent)("kq-space");

      return (0,external_root_Vue_commonjs_vue_commonjs2_vue_amd_vue_namespaceObject.openBlock)(), (0,external_root_Vue_commonjs_vue_commonjs2_vue_amd_vue_namespaceObject.createElementBlock)("div", _hoisted_1, [(0,external_root_Vue_commonjs_vue_commonjs2_vue_amd_vue_namespaceObject.createVNode)(_component_kq_space, {
        direction: (0,external_root_Vue_commonjs_vue_commonjs2_vue_amd_vue_namespaceObject.unref)(direction),
        alignment: "start",
        size: 4
      }, {
        default: (0,external_root_Vue_commonjs_vue_commonjs2_vue_amd_vue_namespaceObject.withCtx)(() => [(0,external_root_Vue_commonjs_vue_commonjs2_vue_amd_vue_namespaceObject.createElementVNode)("div", _hoisted_2, [(0,external_root_Vue_commonjs_vue_commonjs2_vue_amd_vue_namespaceObject.createElementVNode)("span", _hoisted_3, (0,external_root_Vue_commonjs_vue_commonjs2_vue_amd_vue_namespaceObject.toDisplayString)((0,external_root_Vue_commonjs_vue_commonjs2_vue_amd_vue_namespaceObject.unref)(lngText)), 1
        /* TEXT */
        ), (0,external_root_Vue_commonjs_vue_commonjs2_vue_amd_vue_namespaceObject.createElementVNode)("span", _hoisted_4, (0,external_root_Vue_commonjs_vue_commonjs2_vue_amd_vue_namespaceObject.toDisplayString)((0,external_root_Vue_commonjs_vue_commonjs2_vue_amd_vue_namespaceObject.unref)(lng)), 1
        /* TEXT */
        )]), (0,external_root_Vue_commonjs_vue_commonjs2_vue_amd_vue_namespaceObject.createElementVNode)("div", _hoisted_5, [(0,external_root_Vue_commonjs_vue_commonjs2_vue_amd_vue_namespaceObject.createElementVNode)("span", _hoisted_6, (0,external_root_Vue_commonjs_vue_commonjs2_vue_amd_vue_namespaceObject.toDisplayString)((0,external_root_Vue_commonjs_vue_commonjs2_vue_amd_vue_namespaceObject.unref)(latText)), 1
        /* TEXT */
        ), (0,external_root_Vue_commonjs_vue_commonjs2_vue_amd_vue_namespaceObject.createElementVNode)("span", _hoisted_7, (0,external_root_Vue_commonjs_vue_commonjs2_vue_amd_vue_namespaceObject.toDisplayString)((0,external_root_Vue_commonjs_vue_commonjs2_vue_amd_vue_namespaceObject.unref)(lat)), 1
        /* TEXT */
        )]), (0,external_root_Vue_commonjs_vue_commonjs2_vue_amd_vue_namespaceObject.createElementVNode)("div", null, [(0,external_root_Vue_commonjs_vue_commonjs2_vue_amd_vue_namespaceObject.createElementVNode)("span", _hoisted_8, (0,external_root_Vue_commonjs_vue_commonjs2_vue_amd_vue_namespaceObject.toDisplayString)((0,external_root_Vue_commonjs_vue_commonjs2_vue_amd_vue_namespaceObject.unref)(level)), 1
        /* TEXT */
        )])]),
        _: 1
        /* STABLE */

      }, 8
      /* PROPS */
      , ["direction"])]);
    };
  }

}));
;// CONCATENATED MODULE: ./src/leaflet/statusbar/StatusBar.vue?vue&type=script&setup=true&lang=js
 
;// CONCATENATED MODULE: ./src/leaflet/statusbar/StatusBar.vue



const __exports__ = StatusBarvue_type_script_setup_true_lang_js;

/* harmony default export */ var StatusBar = (__exports__);
;// CONCATENATED MODULE: external "@zpc_npm/vue-iclient-common/init.js"
var init_js_namespaceObject = require("@zpc_npm/vue-iclient-common/init.js");
var init_js_default = /*#__PURE__*/__webpack_require__.n(init_js_namespaceObject);
;// CONCATENATED MODULE: ./src/leaflet/statusbar/index.js




StatusBar.install = (Vue, opts) => {
  init_js_default()(Vue, opts);
  Vue.component(StatusBar.name, StatusBar);
};


module.exports = __webpack_exports__;
/******/ })()
;