"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports["default"] = void 0;
var _react = _interopRequireDefault(require("react"));
var _style = require("ol/style");
var _ImageLayer = _interopRequireDefault(require("../../image-layer/ImageLayer"));
var _FeatureLayer = _interopRequireDefault(require("../../feature-layer/FeatureLayer"));
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
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(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
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); }
var geoserver = '/geoserver/zhsw/wms';
var _default = exports["default"] = {
  XZQH: function XZQH(_ref) {
    var map = _ref.map,
      params = _ref.params;
    var styleConfig = function styleConfig(feature) {
      var divisionObj = {
        涵江区: {
          fillColor: 'rgba(0, 177, 249, 0.1)'
        },
        荔城区: {
          fillColor: 'rgba(248, 128, 128, 0.1)'
        },
        城厢区: {
          fillColor: 'rgba(243, 127, 25, 0.1)'
        },
        秀屿区: {
          fillColor: 'rgba(102, 207, 82, 0.1)'
        },
        仙游县: {
          fillColor: 'rgba(29, 151, 244, 0.1)'
        }
      };
      return new _style.Style({
        fill: new _style.Fill({
          color: feature.values_ && feature.values_.name && divisionObj[feature.values_.name].fillColor || 'rgba(91,138,240,0.1)'
        }),
        stroke: new _style.Stroke({
          color: '#ccc',
          width: 1
        }),
        text: new _style.Text({
          textAlign: 'center',
          textBaseline: 'middle',
          text: feature.values_.name,
          fill: new _style.Fill({
            color: '#ffffff'
          }),
          stroke: new _style.Stroke({
            color: '#222222',
            width: 3
          }),
          offsetX: 10,
          offsetY: 10,
          placement: 'point',
          scale: 1.2,
          overflow: true
        })
      });
    };
    var layer = new _ImageLayer["default"]({
      url: geoserver,
      params: _objectSpread({
        layers: 'zhsw:putian_division'
      }, params),
      zIndex: 3,
      key: 'XZQH',
      name: '行政区划',
      style: styleConfig
    });
    map.addLayer(layer);
    return layer;
  },
  JCSS_GSGW: function JCSS_GSGW(_ref2) {
    var map = _ref2.map,
      params = _ref2.params;
    var layer = new _ImageLayer["default"]({
      url: geoserver,
      params: _objectSpread({
        layers: 'zhsw:zhsw_water_supply_line'
      }, params),
      zIndex: 4,
      key: 'JCSS_GSGW',
      name: '供水管网',
      labelField: 'code',
      template: function template(feature) {
        return /*#__PURE__*/_react["default"].createElement("div", null, "\u7F16\u7801\uFF1A", feature.values_.code);
      }
    });
    map.addLayer(layer);
    return layer;
  },
  JCSS_GSGD: function JCSS_GSGD(_ref3) {
    var map = _ref3.map,
      params = _ref3.params;
    var layer = new _ImageLayer["default"]({
      url: geoserver,
      params: _objectSpread({
        VERSION: '1.1.0',
        layers: 'zhsw:zhsw_water_supply_point',
        QUERY_LAYERS: 'zhsw:zhsw_water_supply_point'
      }, params),
      zIndex: 5,
      key: 'JCSS_GSGD',
      name: '供水管网',
      labelField: 'code',
      template: function template(feature) {
        return /*#__PURE__*/_react["default"].createElement("div", null, "\u7F16\u7801\uFF1A", feature.values_.code);
      }
    });
    map.addLayer(layer);
    return layer;
  },
  // 监测设备
  JCSB: function JCSB(_ref4) {
    var map = _ref4.map,
      params = _ref4.params,
      title = _ref4.title,
      key = _ref4.key,
      style = _ref4.style;
    var layer = new _FeatureLayer["default"]({
      url: '/cloud/zhsw-jcyj/api/basicDevice/list',
      params: _objectSpread({}, params),
      style: style || 'SB',
      zIndex: 6,
      key: key,
      name: title,
      labelField: 'name',
      template: function template(feature) {
        return /*#__PURE__*/_react["default"].createElement("div", null, "\u540D\u79F0\uFF1A", feature.values_.name);
      }
    });
    map.addLayer(layer);
    return layer;
  },
  // 静态数据
  JCSS_YLZ: function JCSS_YLZ(_ref5) {
    var map = _ref5.map;
    var layer = new _FeatureLayer["default"]({
      data: [{
        name: '雨量站1',
        geometryInfo: {
          type: 'point',
          lngLats: '118.90473,25.2641',
          coordType: 'wgs84'
        }
      }, {
        name: '雨量站2',
        geometryInfo: {
          type: 'point',
          lngLats: '118.92174,25.2676',
          coordType: 'wgs84'
        }
      }, {
        name: '雨量站3',
        geometryInfo: {
          type: 'point',
          lngLats: '118.60188,25.43366',
          coordType: 'wgs84'
        }
      }],
      style: 'YLZ',
      zIndex: 6,
      key: 'JCSS_YLZ',
      name: '雨量站',
      labelField: 'name',
      template: function template(feature) {
        return /*#__PURE__*/_react["default"].createElement("div", null, "\u540D\u79F0\uFF1A", feature.values_.name);
      }
    });
    map.addLayer(layer);
    return layer;
  }
};
//# sourceMappingURL=LayerService.js.map
