⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 aimsmultiservice.js

📁 采用arcims结合asp开发的一个webgis系统,针对地下水,实现了曲线时时绘制的功能.
💻 JS
📖 第 1 页 / 共 3 页
字号:
// aimsMultiService.js
/*
*  JavaScript template file for ArcIMS HTML Viewer Multiple MapService Sample
*		dependent on aimsXML.js, ArcIMSparam.js, aimsCommon.js, aimsMap.js, aimsIdentify.js, aimsSelect.js, and aimsLayers.js
*		To be interactive, dependent also on aimsDHTML.js, aimsClick.js, and aimsNavigation.js
*
*		Assumes that the limit and start extents have been set.
*		Dependent on aimsMultiServiceParam.js
*/

aimsMultiService=true;
	// the main URL for accessing servlet connector extension - default is imsURL value
var baseMapServiceURL = imsURL;
	// maximum number of MapServices that can be loaded together - if more, define more style sheets in MapFrame.htm
var maxNumberMapServices = 10;
	// array for URLs of the MapSrvices. Define in aimsMultiServiceParam.js.
var mapServiceList = new Array();
	// array for descriptive names of the MapServices. Define in aimsMultiServiceParam.js.
var mapServiceName = new Array();
	// array for current visibility of the MapServices. Define in aimsMultiServiceParam.js.
var mapServiceVisible = new Array();
	// array for layer ids for each MapService 
		// string of id for each layer
		// delimited by bars ("|"). Automatically defined by viewer from mapservice info
var mapServiceLayers = new Array();
	// array for layer visibility for each MapService 
		// string of 1's (visible) or 0's (invisible) for each layer
		// delimited by bars ("|"). Automatically defined by viewer from mapservice info
var mapServiceLayersVisible = new Array();
	// definition for first element in the above arrays.  Change or define additional in aimsMultiServiceParam.js.
mapServiceList[0] = imsURL; //zero index starts with imsURL
mapServiceName[0] = "Base Map";
mapServiceVisible[0] = 1; // visible

	// number of defined MapServices. Automatically defined by viewer.
var mapServiceCount = mapServiceList.length;
	// URL of current active MapService - Modify in aimsMultiServiceParam.js
var activeMapService = mapServiceList[0]; //assumes that there is a mapServiceList[0]
	// index of current active MapService - Modify in aimsMultiServiceParam.js
activeMapServiceIndex = 0;

	// list of hosts allowed to access. Delimited by commas (",").
		// The names listed should correspond with names defined in esrimap_prop for redirection
		// Set in aimsMultiServiceParam.js 
var availableHostsList = "";
	// array for available hosts. Automatically defined by viewer from availableHostsList string.
var availableHosts = new Array();

	// current overlay index to be plotted
var overlayIndex = 0;

	// able to add or delete mapservices - Modify in aimsMultiServiceParam.js
var canManageMapServices=true

imsURL = mapServiceList[0];
imsQueryURL= imsURL + "&CustomService=Query";
imsGeocodeURL = imsURL + "&CustomService=Geocode";

var serviceCount = 0;
var ServiceName = new Array();
var serviceImageType = new Array();
var newServiceName = "";
var serviceHost = hostName;

	// set field display to generic
selectFields= "#ALL#";
swapSelectFields=false;
useFieldAlias=false;
canLoad=true;
	// update maps when change of active mapservice?
var updateMaps=false;
var tempcVersion = "";


// send the created xml request to map server
	// this replaces the default sendMapXML() in aimsXML.js
function sendMapXML() {
	// ask for the Main map
	showRetrieveMap();
	updateMaps=false;
	overlayIndex=0;
	var theText = "";
	theText = writeXML();
	hideLayer("theMap");
	for (i=1;i<mapServiceCount;i++) {
		var lyrName = "theMap" + i;
		hideLayer(lyrName);
	}
	if (debugOn==2) alert(msgList[12] + theText);
	
	sendMultiToServer(mapServiceList[0],theText,"parent.MapFrame.processMulti",5001);

}

function sendMultiToServer(theURL, XMLRequest, theFunction, theType) {
	var theForm = parent.PostFrame.document.forms[0];
	theForm.JavaScriptFunction.value = theFunction;
	sendToServer(theURL,XMLRequest,theType)

}

function processMulti(theReplyIn) {
	theReplyIn = replacePlus(theReplyIn);
	var theReply = unescape(theReplyIn);
	//alert(theReply);
	okToSend = true;
	if (debugOn>2) alert(msgList[13] + theReply);
	var theError = getXMLErrorMessage(theReply);
	switch(XMLMode) {
		case 5001:
			//alert("XMLMode=5001\n" + theReply);
			// get the map image
			updateMultiOverlay(theReply, theError);
			break
		
		case 5002:
			//alert("XMLMode=5002");
			// get the layers in the MapServices
			processStartMapServiceLayers(theReply);
			break
			
		case 5003:
			processSwithchActiveMapService(theReply);
			break
		
		case 5004:
			processAddMapServiceLayers(theReply);
			break
		
		case 5005:
			processTopMap(theReply);
		
			break	
		default:
			alert(theReply + msgList[19]);
			
	}

}

function updateMultiOverlay(theReply, theError) {
	//if (theReply!="") {
		//alert ("Received:\n\n" + theReply);
		var theURL = "";
		theURL = getURL(theReply);	
		//alert(theURL);
		var lyrName = "theMap";
		if (overlayIndex>0) lyrName = "theMap" + overlayIndex;
		hideLayer(lyrName);
		if (theURL != "") {
			getXYs(theReply);
			if (overlayIndex==0) {
				document.theImage.src = theURL;
			} else {
				eval("document.theImage" + overlayIndex + ".src = '" + theURL + "'");
			}
			if (mapServiceVisible[overlayIndex]==1) showLayer(lyrName);
		} else {
			if (debugOn>0) {
				alert(msgList[14] + "\n" + theReply);
			} else {
				alert(msgList[14] + theError);
			}
		}
		if (toolMode==3) {
			moveLayer(lyrName,hspc,vspc);
			clipLayer2(lyrName,0,0,iWidth,iHeight);
		}
		if ((legendVisible) && (overlayIndex==parseInt(activeMapServiceIndex))) {
			showLegend();
		}
	//}
	overlayIndex++;
	if (overlayIndex<mapServiceList.length) {
		//if (parseInt(mapServiceVisible[overlayIndex])==1)
			theText = writeXML();
			sendMultiToServer(mapServiceList[overlayIndex],theText,"parent.MapFrame.processMulti",5001);
		//} else {
		//	updateMultiOverlay("");
		//}
		
	} 
	else {
		if (toolMode==3) {
			if (hasLayer("theMapClicks")) {
				moveLayer("theMapClicks",hspc,vspc);
				clipLayer2("theMapClicks",0,0,iWidth,iHeight);
		
			}
		}
		
		
		if (hasOVMap) {
			if (ovIsVisible) {
			// ask for the overview
				if (!pastStart) {
					
					theText = writeOVXML();
					//pastStart=true;
					sendToServer(imsOVURL,theText,2);
				} else {
					putExtentOnOVMap();
					hideRetrieveMap();
				}
			} else {
				if (!pastStart) {
					theText = writeOVXML();
					sendToServer(imsOVURL,theText,2);
				} else {
					hideRetrieveMap();
				}
			
			}
		} else {
	
			hideRetrieveMap();
		}
		if (parent.ServiceFrame!=null) {
			parent.ServiceFrame.document.location = appDir + "MapServices.htm";
		}
	}


}

function processTopMap(theReply) {
	var theURL = "";
	theURL = getURL(theReply);	
	alert(theReply);
	var theError = getXMLErrorMessage(theReply);		
	//alert(theURL);
	var lyrName = "theTopMap";
	showLayer(lyrName);
	if (theURL != "") {
		document.theTopImage.src = theURL;
		showLayer(lyrName);
	} else {
		if (debugOn>0) {
			alert(msgList[14] + "\n" + theReply);
		} else {
			alert(msgList[14] + theError);
		}
	}
	if (hasOVMap) {
		if (ovIsVisible) {
		// ask for the overview
			if (!pastStart) {
				
				theText = writeOVXML();
				//pastStart=true;
				sendToServer(imsOVURL,theText,2);
			} else {
				putExtentOnOVMap();
				hideRetrieveMap();
			}
		} else {
			if (!pastStart) {
				theText = writeOVXML();
				sendToServer(imsOVURL,theText,2);
			} else {
				hideRetrieveMap();
			}
		
		}
	} else {

		hideRetrieveMap();
	}
	if (parent.ServiceFrame!=null) {
		parent.ServiceFrame.document.location = appDir + "MapServices.htm";
	}

}

// get the starting extent
	// this replaces the default getStartExtent() in aimsCommon.js
function getStartExtent() {
	if (parent.PostFrame.document.forms[0]!=null) {
		overlayIndex=0;
		var theString = '<ARCXML version="1.1">\n<REQUEST>\n<GET_SERVICE_INFO renderer="false" extensions="false" fields="false" />\n</REQUEST>\n</ARCXML>\n';
		sendMultiToServer(imsURL,theString,"parent.MapFrame.processMulti",5002);
	}

}
// get the starting extent
	// the original getStartExtent() - run after the replacement function is done
function getStartExtent2() {
	if (parent.PostFrame.document.forms[0]!=null) {
		var theString = '<ARCXML version="1.1">\n<REQUEST>\n<GET_SERVICE_INFO renderer="false" extensions="false" fields="false" />\n';
		theString = theString + '</REQUEST>\n</ARCXML>';
		var theReply="";
		if (hasOVMap) {
			theString = '<ARCXML version="1.1">\n<REQUEST>\n<GET_IMAGE><PROPERTIES>\n';
			theString += '<IMAGESIZE height="' + i2Height + '" width="' + i2Width + '" />\n';
			if (mapBackColor!="") {
				theString += '<BACKGROUND color="' + mapBackColor + '" />\n';
			}
			theString += '</PROPERTIES>\n';
			theString += '</GET_IMAGE>\n</REQUEST>\n</ARCXML>';
			sendToServer(imsOVURL,theString,902);
		} else {
				sendToServer(imsURL,theString,3);
		}
	} else {
		alert(msgList[2]);
	}
}



// get list of layers, id/shape fields, scalefactors, etc.
function getLayerIDs(theReply) {
	//alert("LayerInfo:\n" + theReply.length);
	var theReplyUC = theReply.toUpperCase();
	var startpos = 0;
	var endpos = 0;
	var pos = -1;
	var lpos = 1;
	var epos = 1;
	var zpos=1;
	var zpos2 = 1;
	var tempString="";
	var visString = "";
	var theString = "";
	var theCount = 0;
	var tempArray = new Array();
	//alert("Processing LayerInfo");
	lpos = theReplyUC.indexOf("<LAYERINFO",zpos);

	while (lpos > -1) {
		//alert("<LAYERINFO - pos " + lpos );
		
		if (lpos != -1) {
			
			zpos = theReplyUC.indexOf("</LAYERINFO",lpos);
			//alert("</LAYERINFO - pos " +  zpos);
			if (zpos!=-1) {
				pos = theReplyUC.indexOf("NAME=",lpos);
				if (pos != -1) {
					startpos = pos + 6;
					endpos = theReply.indexOf(dQuote, startpos);
					tempString = theReply.substring(startpos,endpos);
					startpos = theReplyUC.indexOf("ID=",lpos);
					if ((startpos != -1) && (startpos<zpos)) {
						startpos = startpos + 4;
						endpos = theReply.indexOf(dQuote, startpos);
						tempArray[theCount] = theReply.substring(startpos,endpos);
					} else {
						tempArray[theCount] = tempString;
					}
					theCount++;
					endpos = zpos;
					
				}
				lpos = theReplyUC.indexOf("<LAYERINFO",zpos);
			} else {
				lpos = -1;
			}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -