| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833 |
- import axios from 'axios'
- import {_longLatTransform} from './mercatorToLngLat'
- import { mapConfig } from '../config/mapConfig.js';
- let cancelRequest;
- var cancelToken = new axios.CancelToken(function executor(c) {
- cancelRequest = c
- console.log(c)
- // 这个参数 c 就是CancelToken构造函数里面自带的取消请求的函数,这里把该函数当参数用
- });
- var totCap = '';
- var totCapWidthZoom = [
- {
- zoom:0,
- totCap:750,
- },{
- zoom:1,
- totCap:750,
- },{
- zoom:2,
- totCap:750,
- },{
- zoom:3,
- totCap:750,
- },{
- zoom:4,
- totCap:750,
- },{
- zoom:5,
- totCap:750,
- },{
- zoom:6,
- totCap:750,
- },{
- zoom:7,
- totCap:300,
- },{
- zoom:8,
- totCap:100,
- },{
- zoom:9,
- totCap:'',
- },{
- zoom:10,
- totCap:'',
- },{
- zoom:11,
- totCap:'',
- },{
- zoom:12,
- totCap:'',
- },{
- zoom:13,
- totCap:'',
- },{
- zoom:14,
- totCap:'',
- },{
- zoom:15,
- totCap:'',
- },{
- zoom:16,
- totCap:'',
- },{
- zoom:17,
- totCap:'',
- },{
- zoom:18,
- totCap:'',
- }
- ]
- import {getSkList,getXgxdBaseList,getPblmByDcType} from '../../../api/zhxxAPI.js'
- import {removeLayerById,getShowOrFalse} from './removeLayerById.js'
- import {getShgcListForMap} from "../../../api/zhxxAPI";
- export function initXgxdBaseData(_self){
- var ol = _self.$ol;
- removeLayerById(_self,'xgxdBaseGraphicLayer');
- totCapWidthZoom.forEach((item)=>{
- if(item.zoom == _self.mapObject.getView().getZoom()){
- totCap = item.totCap;
- }
- });
- var maxLgtd = _self.mapObject.getView().calculateExtent()[2];
- var maxLttd = _self.mapObject.getView().calculateExtent()[3];
- var minLgtd = _self.mapObject.getView().calculateExtent()[0];
- var minLttd = _self.mapObject.getView().calculateExtent()[1];
- var bottomLeft = _longLatTransform({
- x:minLgtd,
- y:minLttd
- })
- var topRight = _longLatTransform({
- x:maxLgtd,
- y:maxLttd
- })
- var maxLgtd1 = topRight.x;
- var maxLttd1 = topRight.y;
- var minLgtd1 = bottomLeft.x;
- var minLttd1 = bottomLeft.y;
- var obj = {
- "persGuid":_self.userId,
- "adCode": _self.currentAdCode,
- "count": true,
- "engScal": "",
- "fields": "",
- "maxLgtd": maxLgtd1,
- "maxLttd": maxLttd1,
- "minLgtd": minLgtd1,
- "minLttd": minLttd1,
- "offset": "",
- "orderBy": "",
- "pageNum": 0,
- "pageSize": 0,
- "rsName": "",
- "status": "",
- "objType":"291",
- // "totCap": totCap
- "displayLevel":_self.mapObject.getView().getZoom()-3
- };
- cancelRequest;
- var symbol = new ol.style.Style({
- image: new ol.style.Icon(({
- anchor: [0.5, 0.5],
- scale:0.4,
- src: '/src/views/zongHeXinXiOl/assets/shuiku_All.png'
- }))
- });
- getXgxdBaseList(obj.persGuid,obj.adCode,obj.objType).then((res)=>{
- res.data.list = res.data;
- if(res.data && res.data.length>0){
- res.data.list.forEach((item,index) =>{
- item.longitude = item.centerX;
- item.latitude = item.centerY;
- });
- addFeaturesToMap(res,_self,'险工险段基础信息','xgxdBaseGraphicLayer',symbol,true)
- }
- })
- }
- export function initXgxdDcData(_self){
- var ol = _self.$ol;
- removeLayerById(_self,'xgxdDcGraphicLayer');
- totCapWidthZoom.forEach((item)=>{
- if(item.zoom == _self.mapObject.getView().getZoom()){
- totCap = item.totCap;
- }
- });
- var maxLgtd = _self.mapObject.getView().calculateExtent()[2];
- var maxLttd = _self.mapObject.getView().calculateExtent()[3];
- var minLgtd = _self.mapObject.getView().calculateExtent()[0];
- var minLttd = _self.mapObject.getView().calculateExtent()[1];
- var bottomLeft = _longLatTransform({
- x:minLgtd,
- y:minLttd
- })
- var topRight = _longLatTransform({
- x:maxLgtd,
- y:maxLttd
- })
- var maxLgtd1 = topRight.x;
- var maxLttd1 = topRight.y;
- var minLgtd1 = bottomLeft.x;
- var minLttd1 = bottomLeft.y;
- var obj = {
- "persGuid":_self.userId,
- "adCode": _self.currentAdCode,
- "count": true,
- "engScal": "",
- "fields": "",
- "maxLgtd": maxLgtd1,
- "maxLttd": maxLttd1,
- "minLgtd": minLgtd1,
- "minLttd": minLttd1,
- "offset": "",
- "orderBy": "",
- "pageNum": 0,
- "pageSize": 0,
- "rsName": "",
- "status": "",
- "objType":"292",
- // "totCap": totCap
- "displayLevel":_self.mapObject.getView().getZoom()-3
- };
- cancelRequest;
- var symbol = new ol.style.Style({
- image: new ol.style.Icon(({
- anchor: [0.5, 0.5],
- scale:0.4,
- src: '/src/views/zongHeXinXiOl/assets/shuiku_All.png'
- }))
- });
- getXgxdBaseList(obj.persGuid,obj.adCode,obj.objType).then((res)=>{
- res.data.list = res.data;
- if(res.data && res.data.length>0){
- res.data.list.forEach((item,index) =>{
- item.longitude = item.centerX;
- item.latitude = item.centerY;
- });
- addFeaturesToMap(res,_self,'险工险段督查信息','xgxdDcGraphicLayer',symbol,true)
- }
- })
- }
- export function initAllSkData(_self,type){
- var ol = _self.$ol;
- var show0 = true;
- var show1 = true;
- var show2 = true;
- if(type==1){
- show0 = getShowOrFalse(_self,"allSkGraphicLayer0");
- show1 = getShowOrFalse(_self,"allSkGraphicLayer1");
- show2 = getShowOrFalse(_self,"allSkGraphicLayer2");
- }
- removeLayerById(_self,'allSkGraphicLayer0');
- removeLayerById(_self,'allSkGraphicLayer1');
- removeLayerById(_self,'allSkGraphicLayer2');
- totCapWidthZoom.forEach((item)=>{
- if(item.zoom == _self.mapObject.getView().getZoom()){
- totCap = item.totCap;
- }
- });
- var maxLgtd = _self.mapObject.getView().calculateExtent()[2];
- var maxLttd = _self.mapObject.getView().calculateExtent()[3];
- var minLgtd = _self.mapObject.getView().calculateExtent()[0];
- var minLttd = _self.mapObject.getView().calculateExtent()[1];
- var bottomLeft = _longLatTransform({
- x:minLgtd,
- y:minLttd
- })
- var topRight = _longLatTransform({
- x:maxLgtd,
- y:maxLttd
- })
- var maxLgtd1 = topRight.x;
- var maxLttd1 = topRight.y;
- var minLgtd1 = bottomLeft.x;
- var minLttd1 = bottomLeft.y;
- var obj = {
- "persGuid":_self.userId,
- "adCode": _self.currentAdCode,
- "count": true,
- "engScal": "",
- "fields": "",
- "maxLgtd": maxLgtd1,
- "maxLttd": maxLttd1,
- "minLgtd": minLgtd1,
- "minLttd": minLttd1,
- "offset": "",
- "orderBy": "",
- "pageNum": 0,
- "pageSize": 0,
- "rsName": "",
- "status": "",
- // "totCap": totCap
- "displayLevel":_self.mapObject.getView().getZoom()-3
- };
- cancelRequest;
- // var symbol = new ol.style.Style({
- // image: new ol.style.Icon(({
- // anchor: [0.5, 0.5],
- // scale:0.4,
- // src: '/src/views/zongHeXinXiOl/assets/shuiku_All.png'
- // }))
- // });
- var src = "/src/views/zongHeXinXiOl/assets/shuiku_All.png"
- var propertyNm = "rsName";
- getSkList(obj).then((res)=>{
- addFeaturesToMap(res,_self,'水库','allSkGraphicLayer',src,true,propertyNm,show0,show1,show2)
- })
- }
- export function init2018SkData(_self){//2018水库
- var ol = _self.$ol;
- removeLayerById(_self,'skGraphicLayer2018');
- totCapWidthZoom.forEach((item)=>{
- if(item.zoom == _self.mapObject.getView().getZoom()){
- totCap = item.totCap;
- }
- });
- var maxLgtd = _self.mapObject.getView().calculateExtent()[2];
- var maxLttd = _self.mapObject.getView().calculateExtent()[3];
- var minLgtd = _self.mapObject.getView().calculateExtent()[0];
- var minLttd = _self.mapObject.getView().calculateExtent()[1];
- var bottomLeft = _longLatTransform({
- x:minLgtd,
- y:minLttd
- })
- var topRight = _longLatTransform({
- x:maxLgtd,
- y:maxLttd
- })
- var maxLgtd1 = topRight.x;
- var maxLttd1 = topRight.y;
- var minLgtd1 = bottomLeft.x;
- var minLttd1 = bottomLeft.y;
- var obj = {
- "persGuid":_self.userId,
- "adCode": _self.currentAdCode,
- "count": true,
- "engScal": "",
- "fields": "",
- "maxLgtd": maxLgtd1,
- "maxLttd": maxLttd1,
- "minLgtd": minLgtd1,
- "minLttd": minLttd1,
- "offset": "",
- "orderBy": "",
- "pageNum": 0,
- "pageSize": 0,
- "rsName": "",
- "status": "1",
- "totCap": totCap,
- // "displayLevel":_self.mapObject.getView().getZoom()-3
- };
- // var symbol = new ol.style.Style({
- // image: new ol.style.Icon(({
- // anchor: [0.5, 0.5],
- // scale:0.4,
- // src: '/src/views/zongHeXinXiOl/assets/shuiku_2018.png'
- // }))
- // });
- var src = "/src/views/zongHeXinXiOl/assets/shuiku_2018.png"
- var propertyNm = "rsName"
- getSkList(obj).then((res)=>{
- addFeaturesToMap(res,_self,'2018督查水库','skGraphicLayer2018',src,true,propertyNm)
- })
- }
- export function init2019SkData(_self){//2019年
- var ol = _self.$ol;
- removeLayerById(_self,'skGraphicLayer20190');
- removeLayerById(_self,'skGraphicLayer20191');
- removeLayerById(_self,'skGraphicLayer20192');
- var maxLgtd = _self.mapObject.getView().calculateExtent()[2];
- var maxLttd = _self.mapObject.getView().calculateExtent()[3];
- var minLgtd = _self.mapObject.getView().calculateExtent()[0];
- var minLttd = _self.mapObject.getView().calculateExtent()[1];
- var bottomLeft = _longLatTransform({
- x:minLgtd,
- y:minLttd
- })
- var topRight = _longLatTransform({
- x:maxLgtd,
- y:maxLttd
- })
- var maxLgtd1 = topRight.x;
- var maxLttd1 = topRight.y;
- var minLgtd1 = bottomLeft.x;
- var minLttd1 = bottomLeft.y;
- var obj = {
- "persGuid":_self.userId,
- "adCode": _self.currentAdCode,
- "count": true,
- "engScal": "",
- "fields": "",
- "maxLgtd": '',
- "maxLttd": '',
- "minLgtd": '',
- "minLttd": '',
- "offset": "",
- "orderBy": "",
- "pageNum": 0,
- "pageSize": 0,
- "rsName": "",
- "status": "2",
- "totCap": 0
- };
- // var symbol0 = new ol.style.Style({//已督查
- // image: new ol.style.Icon(({
- // anchor: [0.5, 0.5],
- // scale:0.4,
- // src: '/src/views/zongHeXinXiOl/assets/shuiku0.png'
- // }))
- // });
- // var symbol1 = new ol.style.Style({//督查中
- // image: new ol.style.Icon(({
- // anchor: [0.5, 0.5],
- // scale:0.4,
- // src: '/src/views/zongHeXinXiOl/assets/shuiku1.png'
- // }))
- // });
- // var symbol2 = new ol.style.Style({//未督查
- // image: new ol.style.Icon(({
- // anchor: [0.5, 0.5],
- // scale:0.4,
- // src: '/src/views/zongHeXinXiOl/assets/shuiku2.png'
- // }))
- // });
- var src0 = "/src/views/zongHeXinXiOl/assets/shuiku0.png"
- var src1 = "/src/views/zongHeXinXiOl/assets/shuiku1.png"
- var src2 = "/src/views/zongHeXinXiOl/assets/shuiku2.png"
- var propertyNm = "rsName"
- getSkList(obj).then((res)=>{
- addFeaturesToMap0(res,_self,'2019督查水库','skGraphicLayer2019',src0,src1,src2,true,propertyNm);
- })
- }
- export function initFcSkData(_self){
- var ol = _self.$ol;
- removeLayerById(_self,'fcskGraphicLayer0');
- removeLayerById(_self,'fcskGraphicLayer1');
- removeLayerById(_self,'fcskGraphicLayer2');
- var obj = {
- "persGuid":_self.userId,
- "adCode": _self.currentAdCode,
- "count": true,
- "engScal": "",
- "fields": "",
- "maxLgtd": '',
- "maxLttd": '',
- "minLgtd": '',
- "minLttd": '',
- "offset": "",
- "orderBy": "",
- "pageNum": 0,
- "pageSize": 0,
- "rsName": "",
- "status": "3",
- "totCap": 0
- };
- // var symbol0 = new ol.style.Style({//已督查
- // image: new ol.style.Icon(({
- // anchor: [0.5, 0.5],
- // scale:0.4,
- // src: '/src/views/zongHeXinXiOl/assets/shuiku0.png'
- // }))
- // });
- // var symbol1 = new ol.style.Style({//督查中
- // image: new ol.style.Icon(({
- // anchor: [0.5, 0.5],
- // scale:0.4,
- // src: '/src/views/zongHeXinXiOl/assets/shuiku1.png'
- // }))
- // });
- // var symbol2 = new ol.style.Style({//未督查
- // image: new ol.style.Icon(({
- // anchor: [0.5, 0.5],
- // scale:0.4,
- // src: '/src/views/zongHeXinXiOl/assets/shuiku2.png'
- // }))
- // });
- var src0 = "/src/views/zongHeXinXiOl/assets/shuiku0.png"
- var src1 = "/src/views/zongHeXinXiOl/assets/shuiku1.png"
- var src2 = "/src/views/zongHeXinXiOl/assets/shuiku2.png"
- var propertyNm = "rsName";
- getSkList(obj).then((res)=>{
- addFeaturesToMap0(res,_self,'复查水库','fcskGraphicLayer',src0,src1,src2,true,propertyNm);
- })
- }
- export function initJhwSkData(_self){
- var ol = _self.$ol;
- removeLayerById(_self,'jhwskGraphicLayer');
- totCapWidthZoom.forEach((item)=>{
- if(item.zoom == _self.mapObject.getView().getZoom()){
- totCap = item.totCap;
- }
- });
- var maxLgtd = _self.mapObject.getView().calculateExtent()[2];
- var maxLttd = _self.mapObject.getView().calculateExtent()[3];
- var minLgtd = _self.mapObject.getView().calculateExtent()[0];
- var minLttd = _self.mapObject.getView().calculateExtent()[1];
- var bottomLeft = _longLatTransform({
- x:minLgtd,
- y:minLttd
- })
- var topRight = _longLatTransform({
- x:maxLgtd,
- y:maxLttd
- })
- var maxLgtd1 = topRight.x;
- var maxLttd1 = topRight.y;
- var minLgtd1 = bottomLeft.x;
- var minLttd1 = bottomLeft.y;
- var obj = {
- "persGuid":_self.userId,
- "adCode": _self.currentAdCode,
- "count": true,
- "engScal": "",
- "fields": "",
- "maxLgtd": maxLgtd1,
- "maxLttd": maxLttd1,
- "minLgtd": minLgtd1,
- "minLttd": minLttd1,
- "offset": "",
- "orderBy": "",
- "pageNum": 0,
- "pageSize": 0,
- "rsName": "",
- "status": "4",
- // "totCap": totCap
- "displayLevel":_self.mapObject.getView().getZoom()-3
- };
- // var symbol = new ol.style.Style({
- // image: new ol.style.Icon(({
- // anchor: [0.5, 0.5],
- // scale:0.4,
- // src: '/src/views/zongHeXinXiOl/assets/shuiku_jhw.png'
- // }))
- // });
- var src = "/src/views/zongHeXinXiOl/assets/shuiku_jhw.png"
- var propertyNm = "rsName"
- getSkList(obj).then((res)=>{
- addFeaturesToMap(res,_self,'督查计划外水库','jhwskGraphicLayer',src,true,propertyNm)
- })
- }
- export function initPblmDcData(_self,data) {
- //debugger
- var ol = _self.$ol;
- removeLayerById(_self,data.id);
- var iconFeature,vectorSource,vectorLayer;
- var features = [];
- getPblmByDcType(parseInt(data.code),data.startTime,data.endTime).then((res)=>{
- if(res.data && res.data.length>0){
- res.data.forEach((item)=>{
- if(item.pblmLong && item.pblmLat){
- // var pt = ol.proj.transform([item.lgtdPc, item.lttdPc], "EPSG:4326", "EPSG:3857")
- var pt = _self.projTransform(new ol.geom.Point([Number(item.pblmLong), Number(item.pblmLat)]),mapConfig.wkid)
- iconFeature = new ol.Feature({
- geometry: pt
- });
- item['layerId'] = data.id;
- iconFeature.setProperties(item);
- var symbol = new ol.style.Style({
- image: new ol.style.Icon({
- anchor: [0.5, 0.5],
- scale:0.4,
- src: '/src/views/zongHeXinXiOl/assets/pblm.png'
- }),
- text: new ol.style.Text({
- font: 'normal 12px 黑体',
- fontWeight:'bold',
- // // 对其方式
- textAlign: 'center',
- // 基准线
- textBaseline: 'middle',
- offsetY: -20,
- offsetX: 0,
- fill: new ol.style.Fill({
- color: 'black'
- }),
- stroke: new ol.style.Stroke({
- color: 'white',
- width: 2
- }),
- text: item.objName
- })
- });
- iconFeature.setStyle(symbol);
- features.push(iconFeature)
- }
- });
- vectorSource = new ol.source.Vector({
- features: features
- });
- vectorLayer = new ol.layer.Vector({
- source: vectorSource,
- id:data.id,
- visible:true
- });
- _self.mapObject.addLayer(vectorLayer)
- }
- })
- }
- function addFeaturesToMap(res,_self,name,id,src,visible,propertyNm,show0,show1,show2){
- var ol = _self.$ol;
- var iconFeature,vectorSource,vectorLayer,vectorSource1,vectorLayer1,vectorSource2,vectorLayer2;
- var features = [];
- var features1 = [];
- var features2 = [];
- cancelRequest;
- if(res.data.list){
- res.data.list.forEach((item)=>{
- if(item.latitude && item.longitude){
- // var pt = ol.proj.transform([item.longitude, item.latitude], "EPSG:4326", "EPSG:3857")
- var pt = _self.projTransform(new ol.geom.Point([Number(item.longitude), Number(item.latitude)]),mapConfig.wkid)
- iconFeature = new ol.Feature({
- geometry: pt,
- name: name
- });
- item['layerId'] = id;
- iconFeature.setProperties(item);
- if(id=="xgxdBaseGraphicLayer" || id=="xgxdDcGraphicLayer"){
- iconFeature.setStyle(new ol.style.Style({
- text: new ol.style.Text({
- font: '14px Microsoft YaHei',
- text: item[propertyNm],
- textAlign: "left",
- textBaseline: "middle",
- offsetX: 0,
- offsetY: -10,//调整相对位置
- fill: new ol.style.Fill({
- color: '#fff'
- }),
- stroke: new ol.style.Stroke({
- color: '#000000',
- width: 3
- })
- }),
- image: new ol.style.Circle({
- radius: 6,
- snapToPixel: false,
- fill: new ol.style.Fill({
- color:id=="xgxdBaseGraphicLayer"?'#f29b0d':'#CE0000'
- }),
- stroke: new ol.style.Stroke({
- color: id=="xgxdBaseGraphicLayer"?'#f2cb23':'#ce5957',
- width: 2
- })
- })
- }))
- features.push(iconFeature)
- }else{
- if(!item.status || item.status.indexOf('未')>-1 || item.status.indexOf('外')>-1){
- src = "/src/views/zongHeXinXiOl/assets/shuiku_jhw.png";
- item['layerId'] = 'allSkGraphicLayer0';
- }
- if(item.status.indexOf('中')>-1){
- src = "/src/views/zongHeXinXiOl/assets/shuiku2.png";
- item['layerId'] = 'allSkGraphicLayer1';
- }
- if(item.status.indexOf('已')>-1){
- src = "/src/views/zongHeXinXiOl/assets/shuiku_All.png";
- item['layerId'] = 'allSkGraphicLayer2';
- }
- var symbol1 = new ol.style.Style({
- image: new ol.style.Icon({
- anchor: [0.5, 0.5],
- scale:0.4,
- src: src
- }),
- text: new ol.style.Text({
- font: 'normal 14px 黑体',
- // // 对其方式
- textAlign: 'center',
- // 基准线
- textBaseline: 'middle',
- offsetY: -15,
- offsetX: 0,
- fill: new ol.style.Fill({
- color: 'white'
- }),
- stroke: new ol.style.Stroke({
- color: 'black',
- lineCap: 'butt',
- width: 4
- }),
- padding: [5, 5, 5, 5],
- text: item[propertyNm],
- })
- });
- iconFeature.setStyle(symbol1);
- iconFeature.setProperties(item);
- if(!item.rgstrStatus || item.rgstrStatus=="0"){
- features.push(iconFeature)
- }
- if(item.rgstrStatus=="1"){
- features1.push(iconFeature)
- }
- if(item.rgstrStatus=="2"){
- features2.push(iconFeature)
- }
- }
- }
- });
- vectorSource = new ol.source.Vector({
- features: features
- });
- vectorLayer = new ol.layer.Vector({
- source: vectorSource,
- id:"allSkGraphicLayer0",
- visible:show0
- });
- vectorSource1 = new ol.source.Vector({
- features: features1
- });
- vectorLayer1 = new ol.layer.Vector({
- source: vectorSource1,
- id:"allSkGraphicLayer1",
- visible:show1
- });
- vectorSource2 = new ol.source.Vector({
- features: features2
- });
- vectorLayer2 = new ol.layer.Vector({
- source: vectorSource2,
- id:"allSkGraphicLayer2",
- visible:show2
- });
- _self.mapObject.addLayer(vectorLayer)
- _self.mapObject.addLayer(vectorLayer1)
- _self.mapObject.addLayer(vectorLayer2)
- }
- }
- function addFeaturesToMap0(res,_self,name,id,src0,src1,src2,visible,propertyNm){
- var ol = _self.$ol;
- var symbol,iconFeature;
- var features0 = [];
- var features1 = [];
- var features2 = [];
- cancelRequest;
- if(res.data.list){
- res.data.list.forEach((item)=>{
- if(item.latitude && item.longitude){
- // var pt = ol.proj.transform([item.longitude, item.latitude], "EPSG:4326", "EPSG:3857")
- var pt = _self.projTransform(new ol.geom.Point([Number(item.longitude), Number(item.latitude)]),mapConfig.wkid)
- iconFeature = new ol.Feature({
- geometry: pt,
- name: name
- });
- if(item.rgstrStatus == '1'){//督查中
- item['layerId'] = id+'1';
- iconFeature.setProperties(item);
- symbol = new ol.style.Style({
- image: new ol.style.Icon({
- anchor: [0.5, 0.5],
- scale:0.4,
- src: src1
- }),
- text: new ol.style.Text({
- font: 'normal 14px 黑体',
- // // 对其方式
- textAlign: 'center',
- // 基准线
- textBaseline: 'middle',
- offsetY: -15,
- offsetX: 0,
- fill: new ol.style.Fill({
- color: 'white'
- }),
- stroke: new ol.style.Stroke({
- color: 'black',
- lineCap: 'butt',
- width: 4
- }),
- padding: [5, 5, 5, 5],
- text: item[propertyNm]
- })
- });
- iconFeature.setStyle(symbol);
- features1.push(iconFeature)
- }else if(item.rgstrStatus == '2'){//已督查
- item['layerId'] = id+'2';
- iconFeature.setProperties(item);
- symbol = new ol.style.Style({
- image: new ol.style.Icon({
- anchor: [0.5, 0.5],
- scale:0.4,
- src: src0
- }),
- text: new ol.style.Text({
- font: 'normal 14px 黑体',
- // // 对其方式
- textAlign: 'center',
- // 基准线
- textBaseline: 'middle',
- offsetY: -15,
- offsetX: 0,
- fill: new ol.style.Fill({
- color: 'white'
- }),
- stroke: new ol.style.Stroke({
- color: 'black',
- lineCap: 'butt',
- width: 4
- }),
- padding: [5, 5, 5, 5],
- text: item[propertyNm]
- })
- });
- iconFeature.setStyle(symbol);
- features2.push(iconFeature)
- }else{//未督查
- item['layerId'] = id+'0';
- iconFeature.setProperties(item);
- symbol = new ol.style.Style({
- image: new ol.style.Icon({
- anchor: [0.5, 0.5],
- scale:0.4,
- src: src2
- }),
- text: new ol.style.Text({
- font: 'normal 14px 黑体',
- // // 对其方式
- textAlign: 'center',
- // 基准线
- textBaseline: 'middle',
- offsetY: -15,
- offsetX: 0,
- fill: new ol.style.Fill({
- color: 'white'
- }),
- stroke: new ol.style.Stroke({
- color: 'black',
- lineCap: 'butt',
- width: 4
- }),
- padding: [5, 5, 5, 5],
- text: item[propertyNm]
- })
- });
- iconFeature.setStyle(symbol);
- features0.push(iconFeature)
- }
- }
- });
- var vectorSource0 = new ol.source.Vector({
- features: features0
- });
- var vectorLayer0 = new ol.layer.Vector({
- source: vectorSource0,
- id:id+'0',
- visible:visible
- });
- var vectorSource1 = new ol.source.Vector({
- features: features1
- });
- var vectorLayer1 = new ol.layer.Vector({
- source: vectorSource1,
- id:id+'1',
- visible:visible
- });
- var vectorSource2 = new ol.source.Vector({
- features: features2
- });
- var vectorLayer2 = new ol.layer.Vector({
- source: vectorSource2,
- id:id+'2',
- visible:visible
- });
- _self.mapObject.addLayer(vectorLayer0)
- _self.mapObject.addLayer(vectorLayer1)
- _self.mapObject.addLayer(vectorLayer2)
- }
- }
|