123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985 |
- 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;k<features.length;k++){
- var feature = features[k];
- var centerLonLat = feature.geometry.getBounds().getCenterLonLat();
- //alert(JSON.stringify(feature.attributes));
- var idata={};
- idata.smid=feature.attributes.SMID||feature.attributes.smid;
- idata.lon=centerLonLat.lon;
- idata.lat=centerLonLat.lat;
- idata.zoom=o.zoom;
-
- if(feature.attributes){
- //feature.attributes.gisidToKey=o.gisLayerinfoKey+"_"+idata.smid;
- //feature.attributes.gisLayerinfoKey=o.gisLayerinfoKey;
- feature.attributes.onSelectOpenPopkey=o.onSelectOpenPopkey;
- feature.attributes.gisLayerinfoAttr=feature.attributes[o.gisLayerinfoAttrKey];
- feature.attributes.infokey=o.gisLayerinfoKey+"_"+feature.attributes.gisLayerinfoAttr;
- feature.attributes.gisEditLayerinfoKey=o.gisLayerinfoKey;
- feature.attributes.featureidval=feature.fid;
- feature.attributes.labelfieldid=o.labelfield;
-
- if(o.cachedata&&o.cachedata=='true'){
- gis.script.gisLayerinfo[o.gisLayerinfoKey][feature.attributes.gisLayerinfoAttr]=idata;
- }
-
-
- if(o.processCompleted&&gis.script[o.processCompleted]){
- gis.script[o.processCompleted](feature,o);
- }
- /*
- if(o.processCompleted){
- o.processCompleted(feature);
- }
- */
- }
- //alert(feature.attributes[o.gisLayerinfoAttrKey]);
- //gis.script.gisLayerinfo[o.gisLayerinfoKey][feature.attributes.SMID]=idata;
- //break;
- }
- //debugger;
- gis.script.consolelog('::gis.script.gisLayerinfo::',gis.script.gisLayerinfo);
- }
-
- }
- /*
- * 根据参数绘制Marker,包括港口、取水口...
- */
- gis.script.publiconSelectMark=function(feature,o){
- var centerLonLat = feature.geometry.getBounds().getCenterLonLat();
- var typename="";
- if(o.modelObj&&!gis.script.isBlank(o.modelObj.srcattr)){
- typename=feature.attributes[o.modelObj.srcattr];
- }
- if(gis.script.isBlank(o.modelObj.srcattr)){
- typename=o.modelObj.srcname;
- }
-
- var item={type:o.modelObj.marktypename+typename,functionName:o.onSelectOpenPopkey,
- lon:centerLonLat.lon,lat:centerLonLat.lat,w:o.modelObj.width||32,h:o.modelObj.height||32};
- item.feature=feature;
- item.marktypename=o.modelObj.marktypename;
- //item.src='../images/markerbig_select.png';
- item.src=o.modelObj.src;
- item.defshow=o.modelObj.defshow;
- item.showMinzoom=o.modelObj.showMinzoom;
- item.showMaxzoom=o.modelObj.showMaxzoom;
- if(!gis.script.isBlank(typename)){
- item.src=contextPath+'/theme/images/gis/'+typename+'.png';
- }
- //alert(item.src)
- gis.script.addMarker(item);
- }
- gis.script.gkonSelectMark=function(feature,o){
-
- //alert(o.onSelectOpenPopkey);
- var centerLonLat = feature.geometry.getBounds().getCenterLonLat();
- var srcpng=feature.attributes['类别'];
- var item={type:'gk'+srcpng,functionName:o.onSelectOpenPopkey,lon:centerLonLat.lon,lat:centerLonLat.lat,w:32,h:32};
- item.feature=feature;
- item.src='../images/markerbig_select.png';
-
- if(srcpng){
- item.src=contextPath+'/theme/images/gis/'+srcpng+'.png';
- }
- item.name=feature.attributes.name;
- gis.script.addMarker(item);
- }
- /*
- * 绘画港区feature
- */
- gis.script.gqonSelect=function(feature,o){
- /*
- feature.style = {
- strokeColor: "#304DBE",
- strokeWidth: 2,
- pointerEvents: "visiblePainted",
- fillColor: "#304DBE",
- fillOpacity: 0.5
- };
- */
- //gis.script.consolelog('pointFeature:',feature);
- gqvectorLayer.addFeatures(feature);
- }
- /*
- * 绘画作业区feature
- */
- gis.script.zyqonSelect=function(feature,o){
- zyqvectorLayer.addFeatures(feature);
- }
- /*
- * 绘画经营人feature,并且添加经营人名称
- */
- gis.script.jyronSelect=function(feature,o){
- /*
- var sid=feature.attributes.smid;
- if(sid==51){
- // 浅层复制(只复制顶层的非 object 元素)
- //var newObject = jQuery.extend({}, oldObject);
- // 深层复制(一层一层往下复制直到最底层)
- //var featureDv = $.extend(true, {}, feature);
- var feature2=feature.clone()
- feature2.style = {
- strokeColor: "#304DBE",
- strokeWidth: 2,
- pointerEvents: "visiblePainted",
- fillColor: "#ff0000",
- fillOpacity: 0.5
- };
- locationLayer.addFeatures(feature);
- //alert(feature.style);alert(featureDv.style);
- }
- */
- //gis.script.consolelog('pointFeature:',feature);
- //console.log('pointFeature:',feature);
- jyrvectorLayer.addFeatures(feature);
- try{
- if(feature.attributes&&o.labelfield){
- var centerLonLat = feature.geometry.getBounds().getCenterLonLat();
- var geoText = new SuperMap.Geometry.GeoText(centerLonLat.lon, centerLonLat.lat,gis.script.labelfontformat(feature.attributes[o.labelfield],5));
- var geotextFeature = new SuperMap.Feature.Vector(geoText);
- jyrlabelLayer.addFeatures([geotextFeature]);
- }
-
- }catch(e){
-
- }
- }
- /*
- * 格式化绘制名称
- */
- gis.script.labelfontformat=function(textval,count){
- if(gis.script.isNotBlank(textval)){
- if(count&&gis.script.isNum(count)){
- //console.log("textval",textval);
- var textarray=textval.split("");
- var newtextarray=[];
- if(textarray.length>count){
- for(var i=0;i<textarray.length;i++){
- newtextarray.push(textarray[i]);
- if((i+1)%count==0){
- newtextarray.push("\n");
- }
- }
- return newtextarray.join("");
- }
- //console.log("textarray",textarray);
- }
- return textval;
- }
- return "";
- }
- /*
- * 绘画码头feature
- */
- gis.script.mtonSelect=function(feature,o){
- mtvectorLayer.addFeatures(feature);
- }
- /*
- * 绘画泊位feature
- */
- gis.script.bwonSelect=function(feature,o){
- bwvectorLayer.addFeatures(feature);
- }
- gis.script.sqlProcessFailed=function(e){
- alert(e.error.errorMsg);
- }
- gis.script.loadLayerQueryBySqls = function(list){
- if(list&&list.length){
- var queryParams=[];
- for(var i=0;i<list.length;i++){
- var fileterParam = new SuperMap.REST.FilterParameter(list[i]);
- queryParams.push(fileterParam);
- }
- var queryBySQLParams=new SuperMap.REST.QueryBySQLParameters({
- queryParams:queryParams
- });
- var queryBySQLService = new SuperMap.REST.QueryBySQLService(gis.script.url, {eventListeners: {
- "processCompleted": function(e){
- var result=e.result;
- //gis.script.consolelog('result:',result);
- if(result&&result.totalCount>0&&result.recordsets.length==list.length){
- for(var i=0;i<result.recordsets.length;i++){
- var recordset=result.recordsets[i];
- var o=list[i];
- gis.script.gisLayerinfo[o.gisLayerinfoKey]={};
- for(var k=0;k<recordset.features.length;k++){
- var feature = recordset.features[k];
- var centerLonLat = feature.geometry.getBounds().getCenterLonLat();
- //gisidTo
- if(feature.attributes){
- //feature.attributes.gisidToKey=o.gisLayerinfoKey+"_"+feature.attributes.smid;
- //feature.attributes.gisLayerinfoKey=o.gisLayerinfoKey;
- feature.attributes.onSelectOpenPopkey=o.onSelectOpenPopkey;
- }
- var temp={};
- temp=feature.attributes;
- temp.lon=centerLonLat.lon;
- temp.lat=centerLonLat.lat;
-
-
- gis.script.gisLayerinfo[o.gisLayerinfoKey][feature.attributes.smid]=temp;
- //alert(JSON.stringify(gis.script.gisLayerinfo[o.gisLayerinfoKey]));
-
- if(gis.script.gis_gk_key==o.gisLayerinfoKey){
- gis.script.gkonSelect(feature);
-
- }
- //break;
- }
- }
- }
-
- },
- "processFailed": function(e){
- alert(e.error.errorMsg);
- }
- }
- });
- queryBySQLService.processAsync(queryBySQLParams);
-
- }
-
- }
- gis.script.loadLayerSql = function(o,fun){
- var fileterParam = new SuperMap.REST.FilterParameter(o);
- var queryBySQLParams=new SuperMap.REST.QueryBySQLParameters({
- queryParams:[fileterParam]
- });
- var queryBySQLService = new SuperMap.REST.QueryBySQLService(gis.script.url, {eventListeners: {
- "processCompleted": function(e){
- var result=e.result;
- if(result&&result.totalCount>0){
- var recordset=result.recordsets[0];
- gis.script.gisLayerinfo[o.gisLayerinfoKey]={};
- for(var k=0;k<recordset.features.length;k++){
- var feature = recordset.features[k];
- var centerLonLat = feature.geometry.getBounds().getCenterLonLat();
- //alert(JSON.stringify(feature.attributes));
- //alert(feature.geometry.getBounds().getCenterLonLat())
- if(feature.attributes.name==""){
- continue;
- }
- var temp={};
- temp=feature.attributes;
- temp.lon=centerLonLat.lon;
- temp.lat=centerLonLat.lat;
-
-
- gis.script.gisLayerinfo[o.gisLayerinfoKey][feature.attributes.smid]=temp;
- //alert(JSON.stringify(gis.script.gisLayerinfo[o.gisLayerinfoKey]));
-
- if(fun){
- fun(feature);
-
- }
- //break;
- }
-
-
- }
-
- },
- "processFailed": function(e){
- alert(e.error.errorMsg);
- }
- }
- });
- queryBySQLService.processAsync(queryBySQLParams);
-
- }
- gis.script.gkonSelect = function(feature){
- /*
- var centerLonLat=feature.geometry.getBounds().getCenterLonLat();
- var item={type:"1",functionName:"showMarkerInfo",lon:centerLonLat.lon,lat:centerLonLat.lat,w:21,h:25};
- item.src='../images/markerbig_select.png';
- item.name=feature.attributes.name;
- gis.script.addMarker(item);
- */
-
- feature.style={
- fillColor:"white",
- strokeColor:"white",
- pointRadius:13,
- strokeWidth:0,
- fillOpacity: 0
- };
- //gis.script.consolelog('pointFeature:',feature);
- gkvectorLayer.addFeatures(feature);
-
- }
- gis.script.openPop_GK_id=function(feature,e){
- if(gis.script.gisidTo){
- //alert(gis.script.gis_gk_key+"_"+feature.attributes.SMID);
-
- if(feature.attributes&&feature.attributes.infokey){
- //var sinfo=gis.script.gisidTo[gis.script.gis_gk_key+"_"+feature.attributes.gisLayerinfoAttr];
- var sinfo=gis.script.gisidTo[feature.attributes.infokey];
- if(sinfo&&sinfo.ID){
- //alert(sinfo.ID);
- gis.script.jsonAjax({url:contextPath+"/zygl/queryGK.html",async:true,data:{id:sinfo.ID}},
- function(data){
- //alert(JSON.stringify(data));
- if(data&&data.message){
- //alert(data.message);
- //alert(gis.script.popSize[feature.attributes.gisLayerinfoKey]);
- var popup = gis.anchored.popupHtml(feature.geometry.getBounds().getCenterLonLat(),{width:320,height:269},data.message,e);
-
- //alert(feature.attributes.labelfieldid);
- gis.anchored.addPopup(map,popup,feature);
- //gis.anchored.addFramedCloud(feature.geometry.getBounds().getCenterLonLat(),{},data.message);
- }
- });
- }else{
- //gis.script.openPopNull(feature);
- }
- }
-
- }
- }
- /*
- * 港口点击事件
- */
- gis.script.openPop_GK=function(feature,e){
- if(feature.attributes&&gis.script.isNotBlank(feature.attributes.gisLayerinfoAttr)){
- //alert(feature.attributes.gisLayerinfoAttr);
- gis.script.jsonAjax({url:contextPath+"/zygl/queryGKCode.html",async:true,data:{gkdm:feature.attributes.gisLayerinfoAttr}},
- function(data){
- if(data&&data.success&&data.message){
- var popup = gis.anchored.popupHtml(feature.geometry.getBounds().getCenterLonLat(),{width:320,height:233},data.message,e);
-
- gis.anchored.addPopup(map,popup,feature);
- }
- });
- }
- }
- gis.script.openPop_GQ_id=function(feature,e){
- if(feature.attributes&&feature.attributes.infokey){
- var sinfo=gis.script.gisidTo[feature.attributes.infokey];
- if(sinfo&&sinfo.ID){
- gis.script.jsonAjax({url:contextPath+"/zygl/queryGQ.html",async:true,data:{id:sinfo.ID}},
- function(data){
- //alert(sinfo.ID);
- //alert(JSON.stringify(data));
- if(data&&data.message){
- //alert(data.message);
- //alert(gis.script.popSize[feature.attributes.gisLayerinfoKey]);
- var popup = gis.anchored.popupHtml(feature.geometry.getBounds().getCenterLonLat(),{width:320,height:297},data.message,e);
-
- gis.anchored.addPopup(map,popup,feature);
- }
- });
- }
- }
-
- //gis.script.openPop_GQ_fbgp(feature);
- }
- /*
- * 港区点击事件
- */
- gis.script.openPop_GQ=function(feature,e){
- if(feature.attributes&&gis.script.isNotBlank(feature.attributes.gisLayerinfoAttr)){
- //alert(feature.attributes.gisLayerinfoAttr);
- gis.script.jsonAjax({url:contextPath+"/zygl/queryGQCode.html",async:true,data:{gqdm:feature.attributes.gisLayerinfoAttr}},
- function(data){
-
- if(data&&data.success&&data.message){
- var popup = gis.anchored.popupHtml(feature.geometry.getBounds().getCenterLonLat(),{width:320,height:233},data.message,e);
- gis.anchored.addPopup(map,popup,feature);
- }
- });
- }
- }
- gis.script.openPop_GQ_fbgp=function(feature){
- //alert(feature.geometry.intersects(feature.geometry));
- /*
- var centerLonLat=feature.geometry.getBounds().getCenterLonLat();
- var point= new SuperMap.Geometry.Point(centerLonLat.lon+100,centerLonLat.lat);
- alert(feature.geometry.intersects(point));
- */
- var getFeaturesByGeometryParameters = new SuperMap.REST.GetFeaturesByGeometryParameters({
- datasetNames: ["gkzyYS:L_GKJYR_PY"],
- toIndex:-1,
- spatialQueryMode:SuperMap.REST.SpatialQueryMode.INTERSECT,
- geometry:feature.geometry
- });
- var getFeaturesByGeometryService = new SuperMap.REST.GetFeaturesByGeometryService("http://192.168.39.120:8090/iserver/services/data-ST/rest/data", {
- eventListeners: {
- "processCompleted": function(e){
- gis.script.consolelog('ee:',e);
- },
- "processFailed": function(e){
-
- }
- }
- });
- getFeaturesByGeometryService.processAsync(getFeaturesByGeometryParameters);
- }
- gis.script.openPop_JYR_id=function(feature,e){
- if(feature.attributes&&feature.attributes.infokey){
- //gis.script.consolelog('gis.script.gisidTo:',gis.script.gisidTo);
- //alert(feature.attributes.smid);
- var sinfo=gis.script.gisidTo[feature.attributes.infokey];
- if(sinfo&&sinfo.ID){
- //alert(sinfo.ID);return;
- gis.script.jsonAjax({url:contextPath+"/zygl/queryJYR.html",async:true,data:{id:sinfo.ID}},
- function(data){
- if(data&&data.message){
- var popup = gis.anchored.popupHtml(feature.geometry.getBounds().getCenterLonLat(),{width:320,height:214},data.message,e);
- gis.anchored.addPopup(map,popup,feature);
- }
- });
- }
- }
- }
- /*
- * 经营人点击事件
- */
- gis.script.openPop_JYR=function(feature,e){
- if(feature.attributes&&gis.script.isNotBlank(feature.attributes.gisLayerinfoAttr)){
- //alert(feature.attributes.gisLayerinfoAttr);
- gis.script.jsonAjax({url:contextPath+"/zygl/queryJYRCode.html",async:true,data:{zyid:feature.attributes.gisLayerinfoAttr}},
- function(data){
- if(data&&data.success&&data.message){
- var popup = gis.anchored.popupHtml(feature.geometry.getBounds().getCenterLonLat(),{width:320,height:187},data.message,e);
- gis.anchored.addPopup(map,popup,feature);
- }
- });
- }
- }
- gis.script.openPop_MT_id=function(feature,e){
- //console.log("gis.script.gisidTo",gis.script.gisidTo)
- //alert(feature.attributes.infokey);return;
- if(feature.attributes&&feature.attributes.infokey){
- //gis.script.consolelog('gis.script.gisidTo:',gis.script.gisidTo);
- //alert(feature.attributes.smid);
- //alert(feature.attributes.infokey);
- var sinfo=gis.script.gisidTo[feature.attributes.infokey];
- if(sinfo&&sinfo.ID){
- //alert(sinfo.ID);return;
- gis.script.jsonAjax({url:contextPath+"/zygl/queryMT.html",async:true,data:{id:sinfo.ID}},
- function(data){
- if(data&&data.message){
- var popup = gis.anchored.popupHtml(feature.geometry.getBounds().getCenterLonLat(),{width:320,height:242},data.message,e);
- gis.anchored.addPopup(map,popup,feature);
- }
- });
- }
- }
- }
- /*
- * 码头点击事件
- */
- gis.script.openPop_MT=function(feature,e){
- if(feature.attributes&&gis.script.isNotBlank(feature.attributes.gisLayerinfoAttr)){
- //alert(feature.attributes.gisLayerinfoAttr);
- gis.script.jsonAjax({url:contextPath+"/zygl/queryMTCode.html",async:true,data:{zyid:feature.attributes.gisLayerinfoAttr}},
- function(data){
- if(data&&data.success&&data.message){
- var popup = gis.anchored.popupHtml(feature.geometry.getBounds().getCenterLonLat(),{width:320,height:210},data.message,e);
- gis.anchored.addPopup(map,popup,feature);
- }
- });
- }
- }
- gis.script.openPop_BW_id=function(feature,e){
- //return;
- if(feature.attributes&&feature.attributes.infokey){
- //gis.script.consolelog('gis.script.gisidTo:',gis.script.gisidTo);
- //alert(feature.attributes.smid);
- //alert(feature.attributes.infokey);
- var sinfo=gis.script.gisidTo[feature.attributes.infokey];
- if(sinfo&&sinfo.ID){
- //alert(sinfo.ID);return;
- gis.script.jsonAjax({url:contextPath+"/zygl/queryBW.html",async:true,data:{id:sinfo.ID}},
- function(data){
- if(data&&data.message){
- var popup = gis.anchored.popupHtml(feature.geometry.getBounds().getCenterLonLat(),{width:460,height:289},data.message,e);
- gis.anchored.addPopup(map,popup,feature);
- }
- });
- }
- }
- }
- /*
- * 泊位点击事件
- */
- gis.script.openPop_BW=function(feature,e){
- if(feature.attributes&&gis.script.isNotBlank(feature.attributes.gisLayerinfoAttr)){
- //alert(feature.attributes.gisLayerinfoAttr);
- gis.script.jsonAjax({url:contextPath+"/zygl/queryBWCode.html",async:true,data:{zyid:feature.attributes.gisLayerinfoAttr}},
- function(data){
- if(data&&data.success&&data.message){
- var popup = gis.anchored.popupHtml(feature.geometry.getBounds().getCenterLonLat(),{width:460,height:289},data.message,e);
- gis.anchored.addPopup(map,popup,feature);
- }
- });
- }
- }
- gis.script.openPop_ZYQ=function(feature,e){
- //console.log('feature>>',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},"<div class='titleClass'>信息</div><div class='openPopNull'>无关联数据<div>");
- 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<value.length; i++) {
- var c = value.charAt(i);
- if ((c!=' ')&&(c!='\n')&&(c!='\t')) return false;
- }
- }
- return true;
- }
- gis.script.isNotBlank=function(value){
- if(typeof(value)!='undefined'){
- value=value+"";
- for(var i=0; i<value.length; i++) {
- var c = value.charAt(i);
- if ((c!=' ')&&(c!='\n')&&(c!='\t')) return true;
- }
- }
- return false;
- }
- gis.script.consolelog=function(t,o){
- //console.log(t,o);
- }
- gis.script.loadzyqsjServices = function(servicename,obj) {
- var dataServices=gisConfigBean.dataconfig;
- if(dataServices&&obj&&gis.script.isNum(obj.zyid)){
- //gis.script.consolelog('dataServices',dataServices);
- var originaldata = gisConfigBean.dataconfig[servicename];
- 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.treelocationHighlight=model.treelocationHighlight||"false";
- data.url=data.url||defdataUrl;
- data.attributeFilter="ID="+obj.zyid
-
- //console.log("data",data);
- gis.script.loadServicetreelocation(data,obj);
-
- }
- }
- }
- gis.script.loadServicexmlzyqsjlocation = function(o,datao) {
- 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);
- var features=result.features;
- if(features&&features.length){
-
- }
-
- },
- "processFailed": gis.script.sqlProcessFailed
- }
- });
- featuresBySQLService.processAsync(featuresBySQLParams);
- }
- $(document).ready(function() {
- //预先加载
- //gis.script.initLoadGisidTo();
- //$.growlUI('提示', '删除成功!');
-
- });
|