"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports["default"] = void 0;
var _analysisLayer = require("@vtx/ol-map/lib/analysis-layer");
var _utils = require("../utils");
function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
function _defineProperty(e, r, t) { return (r = _toPropertyKey(r)) in e ? Object.defineProperty(e, r, { value: t, enumerable: !0, configurable: !0, writable: !0 }) : e[r] = t, e; }
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : i + ""; }
function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != _typeof(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
/**
 * @description:
 * @param {*} map 地图
 * @param {*} layers 图层
 * @param {*} highLayerFn  高亮方法
 * @param {*} cqFilter  过滤条件
 * @return {*}
 */
var getWmsData = function getWmsData(_ref) {
  var map = _ref.map,
    layers = _ref.layers,
    highLayerFn = _ref.highLayerFn,
    cqFilter = _ref.cqFilter,
    filterBefore = _ref.filterBefore,
    coorStr = _ref.coorStr;
  return (0, _analysisLayer.getWFSFeatureInfoByLayers)(layers, cqFilter, filterBefore, coorStr).then(function (features) {
    var _features = [],
      data = [];
    if (features !== null && features !== void 0 && features.length) {
      _features = features;

      // 高亮
      if (highLayerFn) {
        highLayerFn(features);
      } else {
        (0, _utils.setHighlightLayer)(map, features);
      }
      features.forEach(function (item) {
        var listKeys = item.getKeys();
        var _dataJson = {};
        var dataJson = item.get('data_json');
        if (dataJson) _dataJson = JSON.parse(dataJson);
        var _data = {};
        listKeys.forEach(function (itemk) {
          if (item.get(itemk)) {
            _data[itemk] = item.get(itemk);
          }
        });
        data.push(_objectSpread(_objectSpread({}, _data), _dataJson));
      });
    } else {
      // message.info('暂无数据', 2);
    }
    return {
      data: data,
      features: _features
    };
  });
};
var _default = exports["default"] = getWmsData;
//# sourceMappingURL=ImageSelect.js.map
