tangzy
2022-02-11 3ccde2f5805e902b2d3eef764778e7418906a857
轨迹线
1 files modified
46 ■■■■■ changed files
public/map/widgets/task/task.js 46 ●●●●● patch | view | raw | blame | history
public/map/widgets/task/task.js
@@ -131,6 +131,7 @@
    // 保留添加实体图层的变量
    addEntitys: null,
    addEntitystra: null,
    entitysData: [],
@@ -159,6 +160,9 @@
      this.addEntitys = new GraphicsLayer({
        id: 'addEntitys'
      });
      this.addEntitystra = new GraphicsLayer({
        id: 'addEntitystra'
      });
      // 添加点面线的图层
      this.addPolygonEntitys = new GraphicsLayer({
@@ -171,6 +175,7 @@
      this._map.addLayer(this.addEntitys);
      this._map.addLayer(this.addEntitystra);
      this._map.addLayer(this.addPolygonEntitys);
@@ -189,7 +194,27 @@
      return (document.location.search.match(new RegExp("(?:^\\?|&)" + key + "=(.*?)(?=&|$)")) || ['', null])[1];
    },
    location: function (ces) {
      console.log(ces)
      var that = this;
      that.addEntitystra.clear();
      $.ajax({
        url: "/api/trar/selectLists?rid=" + ces.rwid + "&uid=" + ces.id,
        type: 'get',
        success: function (res) {
          var baid = res;
          var entityData = '';
          var entityArr = [];
          entityData = baid.match(/\(([^)]*)\)/);
          if (entityData && entityData != '') {
            entityData = entityData[1].split(',');
            for (var j = 0; j < entityData.length; j++) {
              entityArr.push([Number(entityData[j].split(' ')[0]), Number(entityData[j].split(' ')[1])]);
            }
          }
          that.addPolygonAlltra(that.addEntitystra, entityArr);
          that._map.centerAndZoom(new esri.geometry.Point(entityArr[Math.ceil(entityArr.length / 2)][0], entityArr[Math.ceil(entityArr.length / 2)][1], new esri.SpatialReference({wkid: 4326})), 14);
        }
      })
    },
    open: function () {
      var that = this;
@@ -198,17 +223,17 @@
      var entityData = '';
      var entityArr = [];
      entityData = baid.match(/\(([^)]*)\)/);
      // 此时result=["(dsfasjfj3124123)", "dsfasjfj3124123"];
      if (entityData && entityData != '') {
        entityData = entityData[1].split(',');
        console.log(entityData, 1)
        for (var j = 0; j < entityData.length; j++) {
          entityArr.push([Number(entityData[j].split(' ')[0]), Number(entityData[j].split(' ')[1])]);
          // entityArr.push([Number(b[0]), Number(b[1])]);
        }
      }
      console.log(entityArr, 2)
      that.addPolygonAll(that.addEntitys, entityArr);
      that._map.centerAndZoom(new esri.geometry.Point(entityArr[Math.ceil(entityArr.length / 2)][0], entityArr[Math.ceil(entityArr.length / 2)][1], new esri.SpatialReference({wkid: 4326})), 14);
@@ -216,6 +241,21 @@
    close: function () {
    },
    addPolygonAlltra: function (entitys, rings) {
      // entitys.clear();
      var graphic = null;
      var polylineSymbol = new SimpleLineSymbol();
      polylineSymbol.color = "#990707";
      polylineSymbol.width = 4;
      var polyline = new Polyline({
        "paths": [rings],
        "spatialReference": {
          "wkid": 4326
        }
      });
      graphic = new Graphic(polyline, polylineSymbol)
      entitys.add(graphic);
    },
    addPolygonAll: function (entitys, rings) {
      // entitys.clear();
      var graphic = null;