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

📄 aimsgeneric.js

📁 采用arcims结合asp开发的一个webgis系统,针对地下水,实现了曲线时时绘制的功能.
💻 JS
字号:
// aimsGeneric.js
/*
*  JavaScript template file for ArcIMS HTML Viewer
*		dependent on aimsXML.js, ArcIMSparam.js, aimsCommon.js, aimsMap.js,
*		aimsLayers.js, aimsDHTML.js
*/

aimsGenericPresent=true;

var serviceCount = 0;
var ServiceName = new Array();
var ServiceType = new Array();
var serviceList = new Array();

selectFields= "#ALL#";
swapSelectFields=false;
useFieldAlias=false;
canLoad=true;

var holdPan=usePan;
var holdPanNorth=usePanNorth;
var holdPanWest=usePanWest;
var holdPanEast=usePanEast;
var holdPanSouth=usePanSouth;
var holdZoomIn=useZoomIn;
var holdZoomOut=useZoomOut;
var holdFullExtent=useFullExtent;
var holdZoomActive=useZoomActive;
var holdZoomLast=useZoomLast;
var holdIdentify=useIdentify;
var holdMeasure=useMeasure;
var holdSetUnits=useSetUnits;
var holdSelect=useSelect;
var holdQuery=useQuery;
var holdFind=useFind;
var holdGeocode=useGeocode;
var holdStoredQuery=useStoredQuery;
var holdClearSelect=useClearSelect;
var holdPrint=usePrint;
var holdBuffer=useBuffer;
var holdExtract=useExtract;
var holdHyperLink=useHyperLink;
var holdHyperLinkAny=useHyperLinkAny;
var holdIdentifyAll=useIdentifyAll;
var holdBufferShape=useBufferShape; 
var holdDebug=setDebug;

var holdNorthArrowSize=NorthArrowSize;

// process the catalog and list the ImageServices
function processCatalog(theReply) {
		//alert ("function startMap\nResponse:\n" + theReply);
		var theReplyUC = theReply.toUpperCase();
		var startpos = 0;
		var endpos = 0;
		ServiceName.length;
		serviceCount = 0;
		var pos = -1;
		var spos = 9;
		var lpos = 9;
		var epos = -1
		var i=0;
		var tempString=""
		var visString = ""
		var testString = "";
		pos = theReply.indexOf("ERROR",endpos);
		if (pos==-1) {
			while (lpos > -1) {
				// find the mapper service group
				lpos = theReplyUC.indexOf("<SERVICE ",endpos);
				epos = theReplyUC.indexOf("</SERVICE ",lpos);
				if (lpos != -1) {
					startpos = theReplyUC.indexOf("NAME=",lpos + 8);
					startpos = startpos + 6
					endpos = theReply.indexOf(dQuote, startpos);
					tempString = theReply.substring(startpos,endpos);
					startpos = theReplyUC.indexOf("TYPE=",lpos);
					startpos = startpos + 6;
					endpos = startpos + 11;
					if (theReply.substring(startpos,endpos)=="ImageServer") {
						startpos = theReplyUC.indexOf("STATUS=",lpos);
						startpos = startpos + 8;
						endpos = startpos + 7;
						if (theReplyUC.substring(startpos,endpos)=="ENABLED") {
							serviceList[i]=tempString;
							
							startpos = theReplyUC.indexOf("VERSION=",lpos);
							startpos = startpos + 9;
							endpos = startpos + 6;
							if (theReplyUC.substring(startpos,endpos)=="ARCMAP") {
								serviceList[i]+=":ArcMap";
							} else {
								serviceList[i]+=":Classic";
							}
							i=i+1;
							serviceCount=serviceCount+1;
						}
					}
					
				}
				//lpos = theReplyUC.indexOf("</SERVICE>",endpos);
			}
			serviceList.sort();
			for (var i=0;i<serviceList.length;i++) {
				var tempA = serviceList[i].split(":");
				ServiceName[i]=tempA[0];
				ServiceType[i]=tempA[1];
			}
			loadMapForm();
		} else {
			alert("Error compiling MapService List");
		}
		hideRetrieveData();
	
}

function loadMapForm() {
	if (genericLoadForm!=null) {
		if (genericLoadForm==2) {
			loadMapForm2();
		} else {
			loadMapForm1();
		}
	} else {
		loadMapForm1();
	}
}

// write out a form for loading MapService
	// default form used in sample
function loadMapForm1() {
		var Win1;
		if ((useExternalWindow) || (!useTextFrame)) {
			Win1 = window.open("","LoadWindow","width=550,height=100,scrollbars=yes,resizable=yes");
		} else {
			Win1 = parent.TextFrame;
			Win1.document.open();
		}
		Win1.document.writeln('<html><meta http-equiv="Content-Type" content="text/html; charset=' + charSet + '"><head><title>Load MapService</title>');
		Win1.document.write('<scri');
		Win1.document.writeln('pt language="javascript">');
		Win1.document.writeln('	function loadIt() {');
		Win1.document.writeln('		var theForm = document.forms[0];');
		Win1.document.writeln('		var theIndex=theForm.theValue.selectedIndex;');
		Win1.document.writeln('		var mURL = "' + serverURL + '" + theForm.theValue.options[theIndex].value;');
		Win1.document.writeln('		var mOVURL = "";');
		Win1.document.writeln('		if (theForm.putOV.checked) {');
		Win1.document.writeln('			theIndex=theForm.theOVValue.selectedIndex;');
		Win1.document.writeln('			mOVURL = "' + serverURL + '" + theForm.theOVValue.options[theIndex].value;');
		Win1.document.writeln('		} ');
		Win1.document.writeln('		var theFrame;');
		Win1.document.writeln('		if (opener) {');
		Win1.document.writeln('			theFrame = opener.parent.MapFrame;');
		Win1.document.writeln('		} else {');
		Win1.document.writeln('			theFrame = parent.MapFrame;');
		Win1.document.writeln('		}');
		Win1.document.writeln('		theFrame.loadMapService(mURL,mOVURL,true);');
		Win1.document.writeln('		if (opener) window.close();');
		Win1.document.writeln('	}');
		Win1.document.writeln('</script>');
		Win1.document.writeln('</head>');
		Win1.document.writeln('<body bgcolor="black" topmargin=0 leftmargin=0 rightmargin=0 text="Black" onload="window.focus()">');
		Win1.document.writeln('<div align="center"><form onsubmit="javascipt:loadIt();return false;">');
		Win1.document.writeln('<table width=100% cellpadding="2" cellspacing="2">');
		Win1.document.writeln('	<tr><td bgcolor="' + textFrameBackColor + '" align="center" colspan=3><font face="Arial" size="-1"><b>Load MapService</b></font></td></tr>');
		Win1.document.writeln('<tr><td bgcolor="' + textFrameBackColor + '" align="center"><font face="Arial" size="-2">Main Map:');
		Win1.document.writeln('	<select name="theValue">');
		for (var i=0;i<serviceCount;i++) {
			Win1.document.writeln('<option value="' + ServiceName[i] + '">' + ServiceName[i] + '</option>');
		}
		Win1.document.writeln('	</select>');
		Win1.document.writeln('</td>');
		Win1.document.writeln('	<td bgcolor="' + textFrameBackColor + '" align="center"><font face="Arial" size="-2">Overview Map:<select name="theOVValue">');
		for (var i=0;i<serviceCount;i++) {
			Win1.document.writeln('<option value="' + ServiceName[i] + '">' + ServiceName[i] + '</option>');
		}
		Win1.document.writeln('	</select>');

		Win1.document.writeln('</td>');
		Win1.document.write('<td bgcolor="' + textFrameBackColor + '" align="center"><font face="Arial" size="-2">&nbsp;<input type="Checkbox" name="putOV" value="yes"');
		if (hasOVMap) Win1.document.write(' checked');
		Win1.document.writeln('>Use Overview Map</td>');
		Win1.document.write('</tr><tr><td align="center" bgcolor="' + textFrameBackColor + '" colspan=3>');
		Win1.document.writeln('<input type="button" name="submit" value="Load" onclick="loadIt()">');
		if (useExternalWindow) Win1.document.writeln('&nbsp;&nbsp;&nbsp;<input type="button" name="submit1" value="Cancel" onclick="window.close()">');

		Win1.document.write('</tr></table></form></div></body></html>');
		Win1.document.close();
		Win1=null;

}

// load in MapService
function loadMapService(mapURL,ovURL,checkExtents) {
	if (mapURL!="") {
		showRetrieveData();
		if (aimsSelectPresent) {
			selectCount=0;
			highlightedOne="";
			selectPoints.length=1;
			selectLeft.length=1;
			selectRight.length=1;
			selectTop.length=1;
			selectBottom.length=1;
		}
		ActiveLayerIndex=0;
		LayerID.length=0;
		resetParams();
		//showGeocode=false;
		clickCount=0;
		imsURL = mapURL;
		imsQueryURL= imsURL + "&CustomService=Query";
		imsGeocodeURL = imsURL + "&CustomService=Geocode";
		if (ovURL!="") {
			imsOVURL = ovURL;
			hasOVMap=true;
		} else {
			ovIsVisible=true;
			toggleOVMap();
			imsOVURL = "";
			hasOVMap=false;
		}
		if (parent.TextFrame!=null) parent.TextFrame.document.location= appDir + "text.htm";
		if (checkExtents) {
			//chkUnits=true;
			getLimitExtent=true;
			enforceFullExtent=false;
			pastStart=false;
			adjustLimit=true;
			startUp();
		} else {
			sendMapXML();
		}
	} 
}

// get the default parameters and save them
function getDefaultParams() {
	holdPan=usePan;
	holdPanNorth=usePanNorth;
	holdPanWest=usePanWest;
	holdPanEast=usePanEast;
	holdPanSouth=usePanSouth;
	holdZoomIn=useZoomIn;
	holdZoomOut=useZoomOut;
	holdFullExtent=useFullExtent;
	holdZoomActive=useZoomActive;
	holdZoomLast=useZoomLast;
	holdIdentify=useIdentify;
	holdMeasure=useMeasure;
	holdSetUnits=useSetUnits;
	holdSelect=useSelect;
	holdQuery=useQuery;
	holdFind=useFind;
	holdGeocode=useGeocode;
	holdStoredQuery=useStoredQuery;
	holdClearSelect=useClearSelect;
	holdPrint=usePrint;
	holdBuffer=useBuffer;
	holdExtract=useExtract;
	holdHyperLink=useHyperLink;
	holdHyperLinkAny=useHyperLinkAny;
	holdIdentifyAll=useIdentifyAll;
	holdBufferShape=useBufferShape; 
	holdDebug=setDebug;
	holdNorthArrowSize=NorthArrowSize;
	

}

function resetParams() {
	usePan=holdPan;
	usePanNorth=holdPanNorth;
	usePanWest=holdPanWest;
	usePanEast=holdPanEast;
	usePanSouth=holdPanSouth;
	useZoomIn=holdZoomIn;
	useZoomOut=holdZoomOut;
	useFullExtent=holdFullExtent;
	useZoomActive=holdZoomActive;
	useZoomLast=holdZoomLast;
	useIdentify=holdIdentify;
	useMeasure=holdMeasure;
	useSetUnits=holdSetUnits;
	useSelect=holdSelect;
	useQuery=holdQuery;
	useFind=holdFind;
	useGeocode=holdGeocode;
	useStoredQuery=holdStoredQuery;
	useClearSelect=holdClearSelect;
	usePrint=holdPrint;
	useBuffer=holdBuffer;
	useExtract=holdExtract;
	useHyperLink=holdHyperLink;
	useHyperLinkAny=holdHyperLinkAny;
	useIdentifyAll=holdIdentifyAll;
	useBufferShape=holdBufferShape; 
	setDebug=holdDebug;
	
	NorthArrowSize=holdNorthArrowSize;
}

var currentHost = hostName;
var currentURL = "http://" + currentHost + esriBlurb;
var currentService = "";

// write out a form for loading MapService
	// for loading from remote hosts
function loadMapForm2() {
		var Win1;
		if ((useExternalWindow) || (!useTextFrame)) {
			Win1 = window.open("","LoadWindow","width=550,height=100,scrollbars=yes,resizable=yes");
		} else {
			Win1 = parent.TextFrame;
			Win1.document.open();
		}
		Win1.document.writeln('<html><meta http-equiv="Content-Type" content="text/html; charset=' + charSet + '"><head><title>Load MapService</title>');
		Win1.document.write('<scri');
		Win1.document.writeln('pt language="javascript">');
		Win1.document.writeln('		var theFrame;');
		Win1.document.writeln('		var theNameFrame;');
		Win1.document.writeln('		if (opener) {');
		Win1.document.writeln('			theFrame = opener.parent.MapFrame;');
		Win1.document.writeln('			theNameFrame = opener.parent.ServiceFrame;');
		Win1.document.writeln('		} else {');
		Win1.document.writeln('			theFrame = parent.MapFrame;');
		Win1.document.writeln('			theNameFrame = parent.ServiceFrame;');
		Win1.document.writeln('		}');
		Win1.document.writeln('	function loadIt() {');
		Win1.document.writeln('		var theForm = document.forms[0];');
		Win1.document.writeln('		var theIndex=theForm.theValue.selectedIndex;');
		Win1.document.writeln('		var mURL = theFrame.currentURL + theForm.theValue.options[theIndex].value;');
		Win1.document.writeln('		var mOVURL = "";');
		Win1.document.writeln('		if (theForm.putOV.checked) ');
		Win1.document.writeln('			mOVURL = mURL;');
		Win1.document.writeln('		theFrame.currentService = theForm.theValue.options[theIndex].value;');
		Win1.document.writeln('		theFrame.currentService = theForm.theValue.options[theIndex].value;');
		Win1.document.writeln('		theNameFrame.document.location="' + appDir + 'serviceName.htm";');
		Win1.document.writeln('		theFrame.loadMapService(mURL,mOVURL,true);');
		Win1.document.writeln('		if (opener) window.close();');
		Win1.document.writeln('	}');
		Win1.document.writeln('	function setHost() {');
		Win1.document.writeln('		var theForm = document.forms[0];');
		Win1.document.writeln('		var theHost=theForm.theHost.value;');
		Win1.document.writeln('		theFrame.currentHost = theHost;');
		Win1.document.writeln('		theFrame.currentURL = "http://" + theHost + theFrame.esriBlurb;');
		Win1.document.writeln('		theFrame.getNewCatalog();');
		Win1.document.writeln('	}');
		Win1.document.writeln('</script>');
		Win1.document.writeln('</head>');
		Win1.document.writeln('<body bgcolor="black" topmargin=0 leftmargin=0 rightmargin=0 text="Black" onload="window.focus()">');
		Win1.document.writeln('<div align="center"><form onsubmit="javascipt:loadIt();return false;">');
		Win1.document.writeln('<table width=100% cellpadding="2" cellspacing="2">');
		Win1.document.writeln('	<tr><td bgcolor="' + textFrameBackColor + '" align="center" colspan=2><font face="Arial" size="-1"><b>Load MapService</b></font></td></tr>');
		Win1.document.writeln('<tr><td bgcolor="' + textFrameBackColor + '" align="center"><font face="Arial" size="-2">Host:');
		Win1.document.writeln('	<input type="text" name="theHost" value="' + currentHost + '" size="10">');
		Win1.document.writeln('	<input type="button" name="switcher" value="Change Host" onClick="setHost()">');
		Win1.document.writeln('</td>');
		Win1.document.writeln('<td bgcolor="' + textFrameBackColor + '" align="center"><font face="Arial" size="-2">Main Map:');
		Win1.document.writeln('	<select name="theValue">');
		for (var i=0;i<serviceCount;i++) {
			Win1.document.write('<option value="' + ServiceName[i] + '">' + ServiceName[i]);
			if (ServiceType[i]=="ArcMap") Win1.document.write(' [ArcMap]');
			//Win1.document.write(' [' + ServiceType[i] + "]");
			Win1.document.writeln('</option>');
		}
		Win1.document.writeln('	</select>');
		Win1.document.writeln('</td>');
		Win1.document.write('</tr><tr><td bgcolor="' + textFrameBackColor + '" align="center"><font face="Arial" size="-2">&nbsp;<input type="Checkbox" name="putOV" value="yes"');
		if (hasOVMap) Win1.document.write(' checked');
		Win1.document.writeln('>Use Overview Map</td>');
		Win1.document.write('<td align="center" bgcolor="' + textFrameBackColor + '" >');
		Win1.document.writeln('<input type="button" name="submit" value="Load" onclick="loadIt()">');
		if (useExternalWindow) Win1.document.writeln('&nbsp;&nbsp;&nbsp;<input type="button" name="submit1" value="Cancel" onclick="window.close()">');

		Win1.document.write('</tr></table></form></div></body></html>');
		Win1.document.close();
		Win1=null;

}

function getNewCatalog() {
		var newCatURL = currentURL + "catalog";
		var theText = "<GETCLIENTSERVICES/>";
		sendToServer(newCatURL,theText,5);

}

⌨️ 快捷键说明

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