<commit_before><template>
  <div class="map-container" ref="mapContent">
    <div :id="elId" class="map-box">
      <!-- 工具栏 -->
      <div class="toolbar-wrapper" ref="toolbar">
        <slot name="toolbar"></slot>
        <!-- 工具栏面板 -->
        <div class="barboard-wrapper">
          <keep-alive>
            <component :is="$options.components[curVmName]" :barVm="toolObject[curVmName]" v-if="!((curVmName + 'position' in toolObject)&&toolObject[curVmName + 'position']==='center')">
            </component>
          </keep-alive>
        </div>
      </div>
      <component :is="$options.components[curVmName]" :barVm="toolObject[curVmName]" v-if="(curVmName + 'position' in toolObject)&&toolObject[curVmName + 'position']==='center'">
      </component>
      <!-- 地图类型 -->
      <div class="maptype-wrapper" ref="maptype">
        <slot name="mapType"></slot>
      </div>
      <!-- 地图图例-->
      <div class="legend-wrapper" ref="legend">
        <slot name="mapLegend"></slot>
      </div>
      <!-- 鹰眼 -->
      <div class="overview-wrapper" ref="overview">
        <slot name="overviewMap"></slot>
      </div>
      <!-- 其他分发内容 -->
      <slot></slot>
    </div>
  </div>
</template>

<script>
import * as esriLoader from 'esri-loader';

export default {
  name: 'EsriMap',
  data() {
    return {
      esriLoader: esriLoader,
      map: null,
      isloaded: false,
      curVmName: '',
      toolObject: {},
      mapClickEvent: null
    };
  },
  props: {
    elId: {
      type: String,
      default: 'page-map',
      required: true
    },
    isAddBaseMap: {
      type: Boolean,
      default: true
    },
    extention: {
      type: Object
    }
  },
  computed: {
    mapToolConfig: function () {
      return this.mapConfig;
    },
    configData: function () {
      return {
        map: this.map,
        esriLoader: this.esriLoader
      };
    }
  },
  created: function () {
    let _self = this;
    this.$events.$on('barItemBoardInited', (name, comp, vm, position) => {
      _self.$options.components[name] = comp;
      _self.$set(_self.toolObject, name, vm);
      _self.$set(_self.toolObject, name + 'position', position);
    });
  },
  mounted: function () {
    // if (this.$slots.mapLegend) {
    //   this.$refs.legend.style.display = 'block';
    // }
    this.loadEsriAPI();
    let _self = this;
    this.$events.$on('barItemClick', (barConfig) => {
      // 这里判断是否为i键查询功能
      if (barConfig.vmName === 'ISearch') {
        if (!this.mapClickEvent) {
          // 控制激活的样式
          this.toolObject['ISearch'].active = true;
          // 如果是i键查询功能，则通过控制curVmName的值来控制i键查询的结果展示面板
          _self.curVmName = '';
          this.mapClickEvent = this.activeMapClick();
        } else {
          // 控制激活的样式
          this.toolObject['ISearch'].active = false;
          this.mapClickEvent.remove();
          this.mapClickEvent = null;
        }
        return;
      }
      if (!_self.curVmName || _self.curVmName === '') {
        _self.curVmName = barConfig.vmName;
      } else if (_self.curVmName !== barConfig.vmName) {
        _self.curVmName = barConfig.vmName;
      } else if (_self.curVmName === barConfig.vmName) {
        _self.curVmName = '';
      }
    });
  },
  methods: {
    // 地图点击之后，获取到查询结果，并进行展示
    isearchResultShow(result) {
      this.toolObject['ISearch'].getLayers();
      this.toolObject['ISearch'].resultData = result;
      this.curVmName = 'ISearch';
    },
    // 地图点击事件激活
    activeMapClick() {
      var _self = this;
      let handle = this.map.on('click', function (e) {
        var currentInfo = _self.toolObject['ISearch'].currentInfo;
        _self.$emit('mapClikc', e, currentInfo.currentUrl);
      }); // _self.toolObject['ISearch'].activeMapClick;
      return handle;
    },
    loadEsriAPI: function () {
      if (!esriLoader.isLoaded()) {
        esriLoader.bootstrap((err) => {
          if (err) {
            console.error(err);
          }
          this.initMap();
        }, {
            // 'https://js.arcgis.com/3.19/'
            url: 'http://' + window.systemIp + '/arcgis_js_api/library/3.19/3.19/init.js'
          });
      } else {
        // ArcGIS API is already loaded, just create the map
        this.initMap();
      }
    },
    initMap: function () {
      this.esriLoader.dojoRequire(['esri/map', 'esri/geometry/Extent', 'tdlib/TianDiTuLayer', 'esri/tasks/query', 'esri/tasks/QueryTask'], (Map, Extent, TianDiTuLayer, Query, QueryTask) => {
        this.map = new Map(this.elId, { // 主map
          extent: new Extent(this.extention),
          logo: false,
          slider: false
        });
        // 给map赋值初始范围属性，全图工具使用该属性。
        this.map.initExtent = this.map.extent;
        if (this.isAddBaseMap) {
          let baseMapLayer = new TianDiTuLayer('矢量底图', {
            id: 'baseMap'
          });
          this.map.addLayer(baseMapLayer);
          let baseLabelLayer = new TianDiTuLayer('矢量标注', {
            id: 'baseLabel'<commit_msg>添加代理参数的传递<commit_after><template>
  <div class="map-container" ref="mapContent">
    <div :id="elId" class="map-box">
      <!-- 工具栏 -->
      <div class="toolbar-wrapper" ref="toolbar">
        <slot name="toolbar"></slot>
        <!-- 工具栏面板 -->
        <div class="barboard-wrapper">
          <keep-alive>
            <component :is="$options.components[curVmName]" :barVm="toolObject[curVmName]" v-if="!((curVmName + 'position' in toolObject)&&toolObject[curVmName + 'position']==='center')">
            </component>
          </keep-alive>
        </div>
      </div>
      <component :is="$options.components[curVmName]" :barVm="toolObject[curVmName]" v-if="(curVmName + 'position' in toolObject)&&toolObject[curVmName + 'position']==='center'">
      </component>
      <!-- 地图类型 -->
      <div class="maptype-wrapper" ref="maptype">
        <slot name="mapType"></slot>
      </div>
      <!-- 地图图例-->
      <div class="legend-wrapper" ref="legend">
        <slot name="mapLegend"></slot>
      </div>
      <!-- 鹰眼 -->
      <div class="overview-wrapper" ref="overview">
        <slot name="overviewMap"></slot>
      </div>
      <!-- 其他分发内容 -->
      <slot></slot>
    </div>
  </div>
</template>

<script>
import * as esriLoader from 'esri-loader';

export default {
  name: 'EsriMap',
  data() {
    return {
      esriLoader: esriLoader,
      map: null,
      isloaded: false,
      curVmName: '',
      toolObject: {},
      mapClickEvent: null
    };
  },
  props: {
    elId: {
      type: String,
      default: 'page-map',
      required: true
    },
    isAddBaseMap: {
      type: Boolean,
      default: true
    },
    extention: {
      type: Object
    },
    proxyUrl: {
      type: String,
      default: ''
    }
  },
  computed: {
    mapToolConfig: function () {
      return this.mapConfig;
    },
    configData: function () {
      return {
        map: this.map,
        esriLoader: this.esriLoader
      };
    }
  },
  created: function () {
    let _self = this;
    this.$events.$on('barItemBoardInited', (name, comp, vm, position) => {
      _self.$options.components[name] = comp;
      _self.$set(_self.toolObject, name, vm);
      _self.$set(_self.toolObject, name + 'position', position);
    });
  },
  mounted: function () {
    // if (this.$slots.mapLegend) {
    //   this.$refs.legend.style.display = 'block';
    // }
    this.loadEsriAPI();
    let _self = this;
    this.$events.$on('barItemClick', (barConfig) => {
      // 这里判断是否为i键查询功能
      if (barConfig.vmName === 'ISearch') {
        if (!this.mapClickEvent) {
          // 控制激活的样式
          this.toolObject['ISearch'].active = true;
          // 如果是i键查询功能，则通过控制curVmName的值来控制i键查询的结果展示面板
          _self.curVmName = '';
          this.mapClickEvent = this.activeMapClick();
        } else {
          // 控制激活的样式
          this.toolObject['ISearch'].active = false;
          this.mapClickEvent.remove();
          this.mapClickEvent = null;
        }
        return;
      }
      if (!_self.curVmName || _self.curVmName === '') {
        _self.curVmName = barConfig.vmName;
      } else if (_self.curVmName !== barConfig.vmName) {
        _self.curVmName = barConfig.vmName;
      } else if (_self.curVmName === barConfig.vmName) {
        _self.curVmName = '';
      }
    });
  },
  methods: {
    // 地图点击之后，获取到查询结果，并进行展示
    isearchResultShow(result) {
      this.toolObject['ISearch'].getLayers();
      this.toolObject['ISearch'].resultData = result;
      this.curVmName = 'ISearch';
    },
    // 地图点击事件激活
    activeMapClick() {
      var _self = this;
      let handle = this.map.on('click', function (e) {
        var currentInfo = _self.toolObject['ISearch'].currentInfo;
        _self.$emit('mapClikc', e, currentInfo.currentUrl);
      }); // _self.toolObject['ISearch'].activeMapClick;
      return handle;
    },
    loadEsriAPI: function () {
      if (!esriLoader.isLoaded()) {
        esriLoader.bootstrap((err) => {
          if (err) {
            console.error(err);
          }
          this.initMap();
        }, {
            // 'https://js.arcgis.com/3.19/'
            url: 'http://' + window.systemIp + '/arcgis_js_api/library/3.19/3.19/init.js'
          });
      } else {
        // ArcGIS API is already loaded, just create the map
        this.initMap();
      }
    },
    initMap: function () {
      this.esriLoader.dojoRequire(['esri/map', 'esri/geometry/Extent', 'tdlib/TianDiTuLayer', 'esri/tasks/query', 'esri/tasks/QueryTask'], (Map, Extent, TianDiTuLayer, Query, QueryTask) => {
        if (this.proxyUrl) {
          esriConfig.defaults.io.proxyUrl = this.proxyUrl;
        }
        this.map = new Map(this.elId, { // 主map
          extent: new Extent(this.extention),
          logo: false,
          slider: false
        });
        // 给map赋值初始范围属性，全图工具使用该属性。
        this.map.initExtent = this.map.extent;
        if (this.isAddBaseMap) {
          let baseMapLayer = new TianDiTuLayer('矢量底图', {
            id: 'baseMap'
          });
          this.map.addLayer(baseMapLayer);
          let baseLabelLayer = new TianDiTuLayer('矢量标注', {
            id: 'baseLabel'
{'fraction_non_alphanumeric': 0.1643048260826479, 'fraction_numerical': 0.00178376771380438, 'mean_word_length': 2.0976058931860035, 'pattern_counts': {'":': 0, '<': 81, '<?xml version=': 0, '>': 89, 'https://': 2, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '7564685', 'n_tokens_mistral': 3538, 'n_tokens_neox': 3582, 'n_words': 557}