gis.script.gisLayerinfo={}; gis.script.gisidTo={}; gis.script.featuresBySQLServiceprocessAsync=true; gis.script.locationLayerRunRemoveAllFeatures=true; gis.script.gis_gk_key="GK_BASIC_JSJY_GK_GK"; gis.script.popSize={GK_BASIC_JSJY_GK_GK:{width:320,height:320}};//gh:12874 /* * 用于树节点定位,根据配置信息读取空间数据信息, */ gis.script.loadgisService = function(treeNode,objdata){ //alert(treeNode.treeNodeType+"--"+objdata.id); var dataServices=gisConfigBean.dataconfig; if(dataServices){ gis.script.consolelog('dataServices',dataServices); for(var n in dataServices){ var data=gisConfigBean.dataconfig[n]; if(data.gisLayerinfoKey&&treeNode.treeNodeType&&treeNode.treeNodeType==data.gisLayerinfoKey){ //alert(treeNode.treeNodeType+"--"+objdata.id); var originaldata = gisConfigBean.dataconfig[n]; var data=jQuery.extend(true, {}, originaldata); if(data.Model&&data.Model[gis.script.modelid]){ var model=data.Model[gis.script.modelid]; data.datasetNames=data.datasetNames.split(","); data.fields=data.fields.split(","); data.cachedata=model.cachedata||data.cachedata; data.zoom=model.zoom||data.zoom; data.attributeFilter=data.gisLayerinfoAttrKey+"="+objdata.id; data.treelocationHighlight=model.treelocationHighlight||"false"; data.selectOpenPopfun=model.onSelectOpenPopkey; data.url=data.url||defdataUrl; //alert(data.attributeFilter); //console.log("data",data); gis.script.loadServicetreelocation(data,objdata); } break; } /* if(data.Model&&data.Model[gis.script.modelid]){ var model=data.Model[gis.script.modelid]; data.datasetNames=data.datasetNames.split(","); data.fields=data.fields.split(","); data.cachedata=model.cachedata||data.cachedata; data.zoom=model.zoom||data.zoom; gis.script.loadLayerFeaturesBySqls(data); } */ } } } /* * 根据空间数据信息定位 */ gis.script.loadServicetreelocation = function(o,objdata){ var featureParam = new SuperMap.REST.FilterParameter({ //name: o.name, fields:o.fields, attributeFilter:o.attributeFilter }); var featuresBySQLParams=new SuperMap.REST.GetFeaturesBySQLParameters({ //toIndex:65536, toIndex:-1, queryParameter:featureParam, datasetNames:o.datasetNames }); var featuresBySQLService = new SuperMap.REST.GetFeaturesBySQLService(o.url, { eventListeners: { "processCompleted":function(e){ var result=e.result; //console.log('result>>',result); var features=result.features; if(features&&features.length){ //alert(features.length); var feature = features[0]; var centerLonLat = feature.geometry.getBounds().getCenterLonLat(); if(modifyvectorLayer){ try{ gis.script.clearAllDeactivate(); nowModifyFeature=feature.clone(); nowModifyFeature.attributes=nowModifyFeature.attributes||{} nowModifyFeature.attributes.gisEditLayerinfoKey=o.gisLayerinfoKey; nowModifyFeature.attributes.featureidval=feature.fid; nowModifyFeature.attributes.editinfoobj={lon:centerLonLat.lon,lat:centerLonLat.lat,zoom:o.zoom||6}; //console.log("1.nowModifyFeature.attributes.editinfoobj",nowModifyFeature.attributes.editinfoobj); modifyvectorLayer.removeAllFeatures(); modifyvectorLayer.addFeatures(nowModifyFeature); //console.log('o>>',o); }catch(e){ } } if(locationLayer){ locationLayer.removeAllFeatures(); if(o.treelocationHighlight&&o.treelocationHighlight=="true"){ var fillColor="#a4a5a7";//"#ffff00" var fillOpacity=0.5; /* if(o.gisLayerinfoKey&&(o.gisLayerinfoKey=="GK_BASIC_JSJY_JYR_MT"||o.gisLayerinfoKey=="GK_BASIC_JSJY_JYR_BW")){ fillColor="#000000"; fillOpacity=0.8; //alert(fillOpacity); } */ feature.style = { fill:true, stroke:true, strokeColor: "#ffff00", strokeWidth: 3, //pointerEvents: "visiblePainted", //fillColor: "#a4a5a7", strokeDashstyle:"solid", fillColor: fillColor, fillOpacity: fillOpacity }; //bwvectorLayer.addFeatures(feature); locationLayer.addFeatures(feature); try{ labelLayer.removeAllFeatures(); if(!o.gisLayerinfoKey||o.gisLayerinfoKey!="GK_BASIC_JSJY_JYR"){ if(o.labelfield&&feature.attributes[o.labelfield]){ var geoText = new SuperMap.Geometry.GeoText(centerLonLat.lon, centerLonLat.lat,feature.attributes[o.labelfield]); var geotextFeature = new SuperMap.Feature.Vector(geoText); labelLayer.addFeatures([geotextFeature]); } } }catch(e){ } try{ if(objdata&&objdata.showPop&&objdata.showPop=='true'){ //console.log('o>>',o); if(o&&o.selectOpenPopfun&&gis.script[o.selectOpenPopfun]){ feature.attributes.onSelectOpenPopkey=o.onSelectOpenPopkey; feature.attributes.gisLayerinfoAttr=feature.attributes[o.gisLayerinfoAttrKey]; feature.attributes.infokey=o.gisLayerinfoKey+"_"+feature.attributes.gisLayerinfoAttr; gis.script[o.selectOpenPopfun](feature); } } }catch(e){ } } } //gis.script.locationLayerRunRemoveAllFeatures=false; map.setCenter(new SuperMap.LonLat(centerLonLat.lon, centerLonLat.lat),o.zoom||6); } }, "processFailed": gis.script.sqlProcessFailed } }); featuresBySQLService.processAsync(featuresBySQLParams); //featuresBySQLService.processAsync(featuresBySQLParams); } /* * 根据配置信息读取空间数据信息,在相关图层绘制相应图层信息,包括港口、港区、经营人、码头、泊位、船舶 */ gis.script.loadLayerdata = function() { var dataServices=gisConfigBean.dataconfig; if(dataServices){ gis.script.consolelog('dataServices',dataServices); for(var n in dataServices){ var originaldata = gisConfigBean.dataconfig[n]; var data=jQuery.extend(true, {}, originaldata); if(data.Model&&data.Model[gis.script.modelid]){ var model=data.Model[gis.script.modelid]; data.datasetNames=data.datasetNames.split(","); data.fields=data.fields.split(","); data.cachedata=model.cachedata||data.cachedata; data.zoom=model.zoom||data.zoom; data.processCompleted=model.processCompleted; data.onSelectOpenPopkey=model.onSelectOpenPopkey; //alert(data.processCompleted+"--"+data.onSelectOpenPopkey); data.modelObj=model; //defdataUrl data.url=data.url||defdataUrl; //alert(data.label+"---"+data.url); gis.script.loadLayerFeaturesBySqls(data); } } } } /* * 读取空间数据信息,在相关图层绘制相应图层信息 */ gis.script.loadLayerFeaturesBySqls = function(o){ var featureParam = new SuperMap.REST.FilterParameter({ //name: o.name, fields:o.fields, attributeFilter:o.attributeFilter }); var featuresBySQLParams=new SuperMap.REST.GetFeaturesBySQLParameters({ //toIndex:65536, toIndex:-1, queryParameter:featureParam, datasetNames:o.datasetNames }); var featuresBySQLService = new SuperMap.REST.GetFeaturesBySQLService(o.url, { eventListeners: { "processCompleted":function(data){ gis.script.sqlProcessCompleted(data,o); }, "processFailed": gis.script.sqlProcessFailed } }); featuresBySQLService.processAsync(featuresBySQLParams); } /* * processCompleted回调函数,读取空间数据信息,在相关图层绘制相应图层信息 */ gis.script.sqlProcessCompleted=function(e,o){ var result=e.result; gis.script.consolelog('result::',result); gis.script.consolelog('o::',o); var features=result.features; //console.log("features",features); if(features&&features.length){ gis.script.gisLayerinfo[o.gisLayerinfoKey]={}; for(var k=0;kcount){ for(var i=0;i0&&result.recordsets.length==list.length){ for(var i=0;i0){ var recordset=result.recordsets[0]; gis.script.gisLayerinfo[o.gisLayerinfoKey]={}; for(var k=0;k>',feature); //alert(feature.attributes.gisLayerinfoAttr); if(feature.attributes&&feature.attributes.gisLayerinfoAttr){ gis.script.jsonAjax({url:contextPath+"/zygl/queryZYQbyZYID.html",async:true,data:{id:feature.attributes.gisLayerinfoAttr}}, function(data){ if(data&&data.success&&data.message){ var popup = gis.anchored.popupHtml(feature.geometry.getBounds().getCenterLonLat(),{width:460,height:210},data.message,e); gis.anchored.addPopup(map,popup,feature); } }); } } gis.script.openPopNull=function(feature){ //var popup = gis.anchored.popup(feature.geometry.getBounds().getCenterLonLat(),{}); var popup = gis.anchored.popupHtml(feature.geometry.getBounds().getCenterLonLat(),{width:220,height:60},"
信息
无关联数据
"); gis.anchored.addPopup(map,popup); } gis.script.initLoadGisidTo = function(){ gis.script.jsonAjax({url:contextPath+"/zygl/gisidTo.html",contentType:'application/json;charset=utf-8',async:false,data:JSON.stringify({})}, function(data){ //alert(JSON.stringify(data)); gis.script.gisidTo=data; }); } /* * 封装的ajax调用 */ gis.script.jsonAjax= function(obj,exeJson){ var ajaxInfo={ type : 'post', datatype : 'json', //contentType : 'application/json;charset=utf-8', //timeout : 10000, //超时时间设置,单位毫秒 cache : false,// 不从缓存中去数据 async : true, //url : obj.url, //data : JSON.stringify(jsondate), //headers:headinfo, success : function(data) { if(exeJson){ exeJson(data); } }, error : function(jqXHR, textStatus, errorThrown) { //alert(jqXHR.responseText); } }; ajaxInfo.url=obj.url; ajaxInfo.data=obj.data||{}; if(typeof(obj.async)!="undefined"){ ajaxInfo.async=obj.async } if(typeof(obj.contentType)!="undefined"){ //alert(obj.contentType); ajaxInfo.contentType=obj.contentType; } //alert(ajaxInfo); $.ajax(ajaxInfo); } gis.script.isNum=function(value){ if(typeof(value)!='undefined'){ var result = true; var pattern = /^\d*(\.\d*)?$/; if (!pattern.test(value)) result = false; var num = parseFloat(value); if (isNaN(num)) result = false; return result; } return false; } gis.script.isBlank=function(value){ if(value){ value=value+""; for(var i=0; i>',result); var features=result.features; if(features&&features.length){ } }, "processFailed": gis.script.sqlProcessFailed } }); featuresBySQLService.processAsync(featuresBySQLParams); } $(document).ready(function() { //预先加载 //gis.script.initLoadGisidTo(); //$.growlUI('提示', '删除成功!'); });