| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342 | 
gis.script.loadtestVectorLayerdata = function() {	gis.script.loadtestSql();}gis.script.loadtestVectorLayerdata2 = function() {	vectorLayer.removeAllFeatures();    var point= new SuperMap.Geometry.Point(lon,lat);    var pointFeature = new SuperMap.Feature.Vector(point);    pointFeature.id="p1";       pointFeature.styleMap=new SuperMap.StyleMap({ 	      "default":new SuperMap.Style({ 	             fillColor:"#ffcc33", 	             strokeColor:"#ccff99", 	             strokeWidth:2, 	             graphicZIndex:1 	      }), 	      "select":{ 	             fillColor:"33eeff", 	             strokeColor:"3366aa", 	             graphicZIndex:2 	      } 	  });    //console.log('pointFeature:',pointFeature);    vectorLayer.addFeatures(pointFeature);           var point1= new SuperMap.Geometry.Point(lon+0.5,lat+0.5);    var pointFeature1 = new SuperMap.Feature.Vector(point1);    pointFeature1.id="p2";     pointFeature1.style={        fillColor:"red",        strokeColor:"yellow",        pointRadius:7     };    vectorLayer.addFeatures(pointFeature1);               	 var points1=[                  //new SuperMap.Geometry.Point(119,33),                  //new SuperMap.Geometry.Point(119,32)                  new SuperMap.Geometry.Point(lon,lat),                  new SuperMap.Geometry.Point(lon+0.5,lat+0.5)              ];     var line =  new SuperMap.Geometry.LinearRing(points1);     var lineVector = new SuperMap.Feature.Vector(line);     lineVector.id="l1";     lineVector.style={             strokeColor: "#304DBE",             strokeDashstyle:"dot",             strokeWidth: 2,             pointerEvents: "visiblePainted",             fillColor: "#304DBE",             fillOpacity: 0.8              } ;     vectorLayer.addFeatures(lineVector);            gis.script.loadtestSql();         //gis.script.loadtestTheme();}gis.script.loadtestMarkersLayerdata = function() {	var data=[{type:"1",functionName:"showMarkerInfo",lon:lon+0.15,lat:lat+0.15,w:21,h:25},	          {type:"2",functionName:"showMarkerInfo",lon:lon+0.25,lat:lat+0.25,w:21,h:25},	          {type:"1",functionName:"showMarkerInfo",lon:lon+0.35,lat:lat+0.35,w:21,h:25}];		$.each(data, function(i, item){		//alert(i+","+JSON.stringify(item));		//alert(contextPath);		item.src=contextPath+'/images/markerbig_select.png';		gis.script.addMarker(item);	});			 gis.script.loadtestSql2();}gis.script.loadtestMarkersLayerdata2 = function() {    var size = new SuperMap.Size(21,25);    var offset = new SuperMap.Pixel(-(size.w/2), -size.h);    var icon = new SuperMap.Icon('../images/markerbig_select.png', size, offset);    //初始化标记覆盖物类    //var marker = new SuperMap.Marker(new SuperMap.LonLat(23.6530190,37.9439259),icon);//Math.ceil(Math.random()*50)    var marker = new SuperMap.Marker(new SuperMap.LonLat(lon+0.25,lat+0.25),icon);    //添加覆盖物到标记图层    markersLayer.addMarker(marker);    //注册 click 事件,触发 mouseClickHandler()方法    marker.events.on({"click":function(e) {    	//console.log('e:',e);    	//console.log('this:',this);    	//var popup = gis.anchored.popup(this.getLonLat(),{});        gis.anchored.addPopup(map,popup);    }});}gis.script.loadtestSql = function(){	var fileterParam = new SuperMap.REST.FilterParameter({		attributeFilter:"smid>1",		//name:"市界@合并",		name:"市界@合并#1",		fields:["smid","name"]	});		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;	    	console.log('result:',e);	    	if(result&&result.totalCount>0){	    			    		var recordset=result.recordsets[0];	    		//alert(recordset.datasetName)	    		//alert(recordset.features.length);	    		for(var k=0;k<recordset.features.length;k++){	    			var feature = recordset.features[k];	    			var centerLonLat=feature.geometry.getBounds().getCenterLonLat();	    			//alert(centerLonLat.lon+"_"+centerLonLat.lat);	    			//alert(JSON.stringify(feature.attributes));	    			//var feature=new SuperMap.Feature.Vector();	    			/*	    			feature.style = {	    		            strokeColor: "#304DBE",	    		            strokeWidth: 2,	    		            pointerEvents: "visiblePainted",	    		            fillColor: "#304DBE",	    		            fillOpacity: 0.5	    		        };	    		    */	    			feature.styleMap=new SuperMap.StyleMap({ 	    			      "default":new SuperMap.Style({ 	    			    	  	strokeColor: "#304DBE",		    		            strokeWidth: 2,		    		            pointerEvents: "visiblePainted",		    		            fillColor: "#304DBE",		    		            fillOpacity: 0.5,	    			             graphicZIndex:1 	    			      }), 	    			      "select":{ 	    			    	  	strokeColor: "#304DBE",		    		            strokeWidth: 2,		    		            pointerEvents: "visiblePainted",		    		            fillColor: "#304DBE",		    		            fillOpacity: 0.8,	    			             graphicZIndex:2 	    			      } 	    			  });	    				    				    				    			vectorLayer.addFeatures(feature);  	    			break;	    		}	    	}	    	     }, 	    "processFailed": function(e){	    	alert(e.error.errorMsg);	    	//console.log('err:',e);	    } 	  } 	}); 	//alert(queryBySQLService);	queryBySQLService.processAsync(queryBySQLParams); }gis.script.loadtestSql2 = function(){	var fileterParam = new SuperMap.REST.FilterParameter({		attributeFilter:"smid>0",		name:"港口@合并#3",				fields:["smid","name","类别"]	});		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;	    	//console.log('result:',e);	    	if(result&&result.totalCount>0){	    			    		var recordset=result.recordsets[0];	    		//alert(recordset.datasetName)	    		//alert(recordset.features.length);	    		for(var k=0;k<recordset.features.length;k++){	    			var feature = recordset.features[k];	    			//alert(JSON.stringify(feature.attributes));	    			//alert(feature.geometry.getBounds().getCenterLonLat())	    			if(feature.attributes.name==""){	    				continue;	    			}	    			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);   				    				    			//var feature=new SuperMap.Feature.Vector();	    			/*	    			feature.style = {	    		            strokeColor: "#304DBE",	    		            strokeWidth: 2,	    		            pointerEvents: "visiblePainted",	    		            fillColor: "#304DBE",	    		            fillOpacity: 0.5	    		        };	    		    	    			feature.styleMap=new SuperMap.StyleMap({ 	    			      "default":new SuperMap.Style({ 	    			    	  	strokeColor: "#304DBE",		    		            strokeWidth: 2,		    		            pointerEvents: "visiblePainted",		    		            fillColor: "#304DBE",		    		            fillOpacity: 0.5,	    			             graphicZIndex:1 	    			      }), 	    			      "select":{ 	    			    	  	strokeColor: "#304DBE",		    		            strokeWidth: 2,		    		            pointerEvents: "visiblePainted",		    		            fillColor: "#304DBE",		    		            fillOpacity: 0.8,	    			             graphicZIndex:2 	    			      } 	    			  });	    				    				    				    			vectorLayer.addFeatures(feature);  	    			*/	    			//break;	    		}	    	}	    	     }, 	    "processFailed": function(e){	    	alert(e.error.errorMsg);	    	//console.log('err:',e);	    } 	  } 	}); 	//alert(queryBySQLService);	queryBySQLService.processAsync(queryBySQLParams); }gis.script.loadtestTheme = function(){	//港口@合并#3	var themeGraph = new SuperMap.REST.ThemeGraph();	var themeParam = new SuperMap.REST.ThemeParameters({		datasetNames:["港口"],		dataSourceNames:["合并#3"],		themes:[themeGraph]	});	var themeService = new SuperMap.REST.ThemeService(gis.script.url, { 	    eventListeners: { 	          "processCompleted": function(e){	        	  //console.log('result1:',e);	          }, 	          "processFailed": function(e){alert(e.error.errorMsg);} 	          } 	});	themeService.processAsync(themeParam);  }gis.script.testUTFGrid = function() {	utfgrid = new SuperMap.Layer.UTFGrid("UTFGridLayer", gis.script.url,            {                layerName: "市界@合并",                utfTileSize: 256,                pixcell: 8,                isUseCache: true            },            {                utfgridResolution: 8            });	layer.events.on({"layerInitialized": function(){		try{			map.addLayer(utfgrid);					}catch (e) {			// TODO: handle exception		}			}});		control = new SuperMap.Control.UTFGrid({        layers: [utfgrid],        callback: function(infoLookup, loc, pixel) {        	//console.log('infoLookup',infoLookup);        	var info;            for (var idx in infoLookup) {                info = infoLookup[idx];                if (info && info.data) {                	//console.log('info',info);                	alert(info.data.NAME)                }            }        },        handlerMode: "click"    });    map.addControl(control);}gis.script.testiframe= function() {    //console.log("tabitem",tabitem);    var iframearray=$("iframe");    $.each(iframearray, function(i,documentObj){      	      //var obj=$(documentObj);  	  if(tabitem&&tabitem.menuurl&&documentObj.src){  		  if(documentObj.src.indexOf(tabitem.menuurl)>=0){  			  //alert(i+">>"+documentObj.src);  			  var iframepage=documentObj;  			  if(iframepage&&iframepage.contentWindow){		        	  alert(iframepage.src);		          }  			    			    			  return false;  		  }  	  }    });	    	$(".triggle").find("a").click(function(){		//console.log($(this).index());		var imgs = $("#demo_boat>img");		for(var i=0;i<imgs.length;i++)		{			imgs[i].className=i==$(this).index()?"block":"hide";		}	})   }
 |