| | |
| | | |
| | | // 保留添加实体图层的变量 |
| | | addEntitys: null, |
| | | addEntitystra: null, |
| | | entitysData: [], |
| | | |
| | | |
| | |
| | | this.addEntitys = new GraphicsLayer({ |
| | | id: 'addEntitys' |
| | | }); |
| | | this.addEntitystra = new GraphicsLayer({ |
| | | id: 'addEntitystra' |
| | | }); |
| | | |
| | | // 添加点面线的图层 |
| | | this.addPolygonEntitys = new GraphicsLayer({ |
| | |
| | | |
| | | |
| | | this._map.addLayer(this.addEntitys); |
| | | this._map.addLayer(this.addEntitystra); |
| | | |
| | | |
| | | this._map.addLayer(this.addPolygonEntitys); |
| | |
| | | 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; |
| | |
| | | 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); |
| | | |
| | |
| | | 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; |