/******/ (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__, {
  "FilterDetailViewModel": function() { return /* reexport */ FilterDetailViewModel; },
  "default": function() { return /* reexport */ FilterDetail; }
});

;// 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: external "xe-utils"
var external_xe_utils_namespaceObject = require("xe-utils");
var external_xe_utils_default = /*#__PURE__*/__webpack_require__.n(external_xe_utils_namespaceObject);
;// CONCATENATED MODULE: external "@zpc_npm/vue-iclient-common/_utils/util"
var util_namespaceObject = require("@zpc_npm/vue-iclient-common/_utils/util");
;// 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/gis-utils"
var gis_utils_namespaceObject = require("@zpc_npm/vue-iclient-common/_utils/gis-utils");
;// CONCATENATED MODULE: ./src/leaflet/filterdetail/FilterDetailViewModel.js


/**
 * Author: 朱鹏超
 * Date: 2022-11-23
 * Description: 2d滤镜逻辑层
 */

/**
 * @class FilterDetailViewModel
 * @classdesc 滤镜
 * @param {string} mapTarget - 绑定的当前mapview
 */

class FilterDetailViewModel extends L.Evented {
  constructor(mapTarget) {
    super();

    _defineProperty(this, "_props", null);

    _defineProperty(this, "_webMap", null);

    this._props = {
      mapTarget
    }; // 事件绑定this;

    this._loadedAsync = this._loadedAsync.bind(this);
    this._loadedSync = this._loadedSync.bind(this);
    this._updateLayerData = this._updateLayerData.bind(this);
    this.setLayerData = this.setLayerData.bind(this);

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


  _registerEvents() {
    // 监听地图初始化完成事件
    // 异步
    gis_utils_namespaceObject.mapViewUtils.bindViewEvents("mounted", this._loadedAsync, this._props.mapTarget);
    gis_utils_namespaceObject.mapViewUtils.bindViewEvents("resetLayerDatas", this._updateLayerData, this._props.mapTarget); // 同步

    gis_utils_namespaceObject.utils.getWebMap(this._props.mapTarget, this._loadedSync);
  }
  /**
   * @description 同步加载
   * @private
   */


  _loadedAsync(e) {
    // 如果图层变化事件是自己触发的 则不继续执行 避免死循环
    if (e.eventTarget && e.eventTarget === this) {
      return;
    }

    this._webMap = e.target;
    this.setLayerData();
  }
  /**
   * @description 异步加载
   * @private
   */


  _loadedSync(e) {
    this._webMap = e;
    this.setLayerData();
  }
  /**
   * @description 设置图层树
   */


  setLayerData() {
    let maplayers = gis_utils_namespaceObject.mapLayerUtils.getLayerCheckedList(this._props.mapTarget);

    if (maplayers && maplayers.length > 0) {
      this.fire("setData", {
        maplayers
      });
      return {
        maplayers
      };
    }
  }
  /**
   * @description 更新图层树
   * @private
   */


  _updateLayerData() {
    let maplayers = gis_utils_namespaceObject.mapLayerUtils.getLayerCheckedList(this._props.mapTarget);
    this.fire("updateData", {
      maplayers
    });
  }
  /**
   * @description 销毁方法
   */


  destroy() {
    this.off();
  }

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





const __default__ = {
  name: "Kq2dFilterDetail"
};
/* harmony default export */ var FilterDetailvue_type_script_setup_true_lang_js = (/*#__PURE__*/Object.assign(__default__, {
  props: {
    // 每个地图相关组件的必须参数 非必传 指定组件绑定的map对象的div的id
    mapTarget: String,
    // 是否显示阴影
    showShadow: {
      type: Boolean,
      default: false
    },

    /**
     * 例："center","topLeft","topRight","bottomLeft","bottomRight", "topCenter", "bottomCenter" {top:'16px',left:'16px'}, {top:16,left:16}
     */
    position: [String, Object],
    // 放大镜的半径，以像素为单位
    radius: {
      type: Number,
      default: 100
    },
    // 主地图缩放和放大镜之间的缩放级别偏移
    zoomOffset: {
      type: Number,
      default: 3
    },
    // 如果不同于-1，则定义始终在放大镜中使用的固定缩放级别，忽略主地图缩放和zoomOffet值。
    fixedZoom: {
      type: Number,
      default: -1
    },
    // 如果true，放大镜将停留在地图上的同一位置，而不是跟随鼠标光标。
    fixedPosition: {
      type: Boolean,
      default: false
    },
    latLng: {
      type: Array,
      default: null
    }
  },

  setup(__props, {
    expose
  }) {
    const props = __props; //  图层数据源

    let layers = (0,external_root_Vue_commonjs_vue_commonjs2_vue_amd_vue_namespaceObject.reactive)({
      data: []
    }); // 默认值

    let defaultSelected = (0,external_root_Vue_commonjs_vue_commonjs2_vue_amd_vue_namespaceObject.ref)(""); // 逻辑类

    let viewModel = null; // 组件容器

    let box_ref = (0,external_root_Vue_commonjs_vue_commonjs2_vue_amd_vue_namespaceObject.ref)(null); // 选择的图层

    let selectedLayer = null; // 生成的滤镜图层

    let magnifyingGlassLayer = null;
    (0,external_root_Vue_commonjs_vue_commonjs2_vue_amd_vue_namespaceObject.onMounted)(() => {
      (0,util_namespaceObject.updatePosition)(box_ref.value, props);
      viewModel = new FilterDetailViewModel(props.mapTarget); // 获取图层树数据

      const maplayersData = viewModel.setLayerData();

      if (maplayersData && maplayersData.maplayers && maplayersData.maplayers.length) {
        setLayer(maplayersData.maplayers);
      } else {
        viewModel.on("setData", _data => {
          setLayer(_data.maplayers);
        });
      } // 更新图层数据


      viewModel.on("updateData", _data => {
        layers.data = _data.maplayers;

        if (selectedLayer) {
          let result = external_xe_utils_default().find(layers.data, item => item.guid === selectedLayer.guid);

          if (!result) {
            resetFilterLayer();
            selectedLayer = null;
            defaultSelected.value = null;
          }
        }
      });
    });
    (0,external_root_Vue_commonjs_vue_commonjs2_vue_amd_vue_namespaceObject.onBeforeUnmount)(() => {
      clear();
      viewModel = null;
    });

    const onChangeSelect = val => {
      selectedLayer = external_xe_utils_default().find(layers.data, item => item.guid === val);
      filter(selectedLayer);
    };
    /**
     * 设置图层
     */


    const setLayer = maplayers => {
      layers.data = maplayers;

      if (maplayers.length === 0) {
        defaultSelected.value = "";
        return;
      }
    };
    /**
     * 开始滤镜操作
     */


    const start = layer => {
      if (!layer) {
        if (!selectedLayer) {
          layer = layers.data[0];
        } else {
          layer = selectedLayer;
        }
      }

      defaultSelected.value = layer.guid;
      selectedLayer = layer;
      filter(selectedLayer);
    };
    /**
     * 清除滤镜
     */


    const clear = () => {
      resetFilterLayer();
      viewModel.destroy();
      selectedLayer = null;
      defaultSelected.value = null;
    };
    /**
     * 生成滤镜
     */


    const filter = layer => {
      resetFilterLayer();
      const {
        radius,
        zoomOffset,
        fixedZoom,
        fixedPosition,
        latLng
      } = props;
      let config = {
        layers: [layer],
        radius,
        zoomOffset,
        fixedZoom,
        fixedPosition,
        latLng: latLng ? latLng : null
      };
      !config.latLng ? delete config.latLng : null;

      const result = viewModel._webMap.mapControl.createFilter(config);

      magnifyingGlassLayer = result.magnifyingGlassLayer;
    };
    /**
     * 重置滤镜图层
     */


    const resetFilterLayer = () => {
      if (magnifyingGlassLayer) {
        viewModel._webMap.mapControl.clearFilter(magnifyingGlassLayer);

        magnifyingGlassLayer = null;
      }
    };

    expose({
      start,
      clear
    });
    return (_ctx, _cache) => {
      const _component_kq_option = (0,external_root_Vue_commonjs_vue_commonjs2_vue_amd_vue_namespaceObject.resolveComponent)("kq-option");

      const _component_kq_select = (0,external_root_Vue_commonjs_vue_commonjs2_vue_amd_vue_namespaceObject.resolveComponent)("kq-select");

      const _component_kq_form_item = (0,external_root_Vue_commonjs_vue_commonjs2_vue_amd_vue_namespaceObject.resolveComponent)("kq-form-item");

      const _component_kq_form = (0,external_root_Vue_commonjs_vue_commonjs2_vue_amd_vue_namespaceObject.resolveComponent)("kq-form");

      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)("section", {
        class: (0,external_root_Vue_commonjs_vue_commonjs2_vue_amd_vue_namespaceObject.normalizeClass)(["kq-2d-filter-detail", __props.showShadow ? 'shadow' : null]),
        ref_key: "box_ref",
        ref: box_ref
      }, [(0,external_root_Vue_commonjs_vue_commonjs2_vue_amd_vue_namespaceObject.createVNode)(_component_kq_form, {
        "label-width": "84px",
        "label-position": "left"
      }, {
        default: (0,external_root_Vue_commonjs_vue_commonjs2_vue_amd_vue_namespaceObject.withCtx)(() => [(0,external_root_Vue_commonjs_vue_commonjs2_vue_amd_vue_namespaceObject.createVNode)(_component_kq_form_item, {
          label: "请选择图层"
        }, {
          default: (0,external_root_Vue_commonjs_vue_commonjs2_vue_amd_vue_namespaceObject.withCtx)(() => [(0,external_root_Vue_commonjs_vue_commonjs2_vue_amd_vue_namespaceObject.createVNode)(_component_kq_select, {
            modelValue: (0,external_root_Vue_commonjs_vue_commonjs2_vue_amd_vue_namespaceObject.unref)(defaultSelected),
            "onUpdate:modelValue": _cache[0] || (_cache[0] = $event => (0,external_root_Vue_commonjs_vue_commonjs2_vue_amd_vue_namespaceObject.isRef)(defaultSelected) ? defaultSelected.value = $event : defaultSelected = $event),
            onChange: onChangeSelect,
            placeholder: "请选择..."
          }, {
            default: (0,external_root_Vue_commonjs_vue_commonjs2_vue_amd_vue_namespaceObject.withCtx)(() => [((0,external_root_Vue_commonjs_vue_commonjs2_vue_amd_vue_namespaceObject.openBlock)(true), (0,external_root_Vue_commonjs_vue_commonjs2_vue_amd_vue_namespaceObject.createElementBlock)(external_root_Vue_commonjs_vue_commonjs2_vue_amd_vue_namespaceObject.Fragment, null, (0,external_root_Vue_commonjs_vue_commonjs2_vue_amd_vue_namespaceObject.renderList)((0,external_root_Vue_commonjs_vue_commonjs2_vue_amd_vue_namespaceObject.unref)(layers).data, item => {
              return (0,external_root_Vue_commonjs_vue_commonjs2_vue_amd_vue_namespaceObject.openBlock)(), (0,external_root_Vue_commonjs_vue_commonjs2_vue_amd_vue_namespaceObject.createBlock)(_component_kq_option, {
                label: item.name,
                value: item.guid,
                key: item.guid
              }, null, 8
              /* PROPS */
              , ["label", "value"]);
            }), 128
            /* KEYED_FRAGMENT */
            ))]),
            _: 1
            /* STABLE */

          }, 8
          /* PROPS */
          , ["modelValue"])]),
          _: 1
          /* STABLE */

        })]),
        _: 1
        /* STABLE */

      })], 2
      /* CLASS */
      );
    };
  }

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



const __exports__ = FilterDetailvue_type_script_setup_true_lang_js;

/* harmony default export */ var FilterDetail = (__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/filterdetail/index.js




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


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