📄 layerinfo.htm
字号:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<html>
<head>
<title>Layer Parameters</title>
<SCRIPT TYPE="text/javascript" LANGUAGE="JavaScript" SRC="ArcIMSparam.js"></SCRIPT>
<SCRIPT TYPE="text/javascript" LANGUAGE="JavaScript" SRC="javascript/aimsLayers.js"></SCRIPT>
<SCRIPT LANGUAGE="JavaScript" TYPE="text/javascript">
//var cmdString = document.location.search;
// encoding for XML header
var localeEncoding = 'encoding="UTF-8" ';
var XMLMode = 1;
var lastURL = "";
// client version
var cVersion = "&ClientVersion=4.0";
// get machine name
var hostName = document.location.host;
// the base servlet connector URL
var connectorURL = "http://" + hostName + "/servlet/com.esri.esrimap.Esrimap?ServiceName=redirect";
var sQuote = "'";
var dQuote = '"';
// character used by browser in decimals - either point or comma
var decimalChar = ((("theChar is" + (10/100)).indexOf("."))==-1) ? "," : ".";
// ending position to start parse scan of XML string
var xmlEndPos = 0;
// send in XML request and get XML response - uses helper applet
function sendToServer(URLString,XMLRequest,theType) {
if (parent.PostFrame.document.forms[0]!=null) {
lastURL = URLString;
XMLMode = theType;
var theForm = parent.PostFrame.document.forms[0];
//alert(URLString);
URLString = URLString + cVersion;
var requestURL = URLString;
if (theForm.RedirectURL!=null) {
if (isNotSameHostInURL(URLString, hostName)) {
requestURL = connectorURL;
theForm.RedirectURL.value = URLString;
} else {
theForm.RedirectURL.value = "";
}
}
if (doURLencode) {
theForm.action=requestURL + "&Form=True&Encode=True";
} else {
theForm.action=requestURL + "&Form=True&Encode=False";
}
var xmlHeader = '<?xml version="1.0" ' + localeEncoding + '?>';
theForm.ArcXMLRequest.value=xmlHeader + XMLRequest;
//theForm.JavaScriptFunction.value = theFunction;
theForm.submit();
} else {
alert(msgList[11]);
}
}
// process the response xml
function processXML(theReplyIn) {
if (doURLencode) {
theReplyIn = replacePlus(theReplyIn);
var theReply = unescape(theReplyIn);
} else {
var theReply = theReplyIn;
}
var theError = getXMLErrorMessage(theReply);
if (theError!="") {
writePage(theError,lastURL);
//alert(theError + "\n\n" + lastURL);
} else {
theError = checkForbiddenGetImageTag(theReply);
if (theError=="") {
switch(XMLMode) {
case 1:
processLayers(theReply);
break
default:
alert("default:\n" + theReply);
}
} else {
writePage(theError,lastURL);
}
}
}
// replace + in string with space to allow parsing of unescaped xml response
function replacePlus(inText) {
var re = /\+/g;
inText = inText.replace(re," ");
return inText;
}
function requestInfo(theType) {
var URLString = imsURL;
//if (theType==2) URLString = imsOVURL;
var XMLRequest = '<ARCXML version="1.1">\n<REQUEST>\n<GET_SERVICE_INFO renderer="false" extensions="false" fields="true" />\n</REQUEST>\n</ARCXML>\n';
sendToServer(URLString,XMLRequest,theType)
}
function processLayers(theReply) {
var pos = theReply.indexOf("ERROR");
if (pos!=-1) {
alert(theType + "\n" + getXMLErrorMessage(theReply));
} else {
//alert(theReply);
getLayers(theReply);
var theString = "// Layer Parameters\n\n";
for (var i=0;i<LayerID.length;i++) {
theString += "// Parameters for " + LayerName[i] + " layer\n";
theString += 'LayerName[' + i + '] = "' + LayerName[i] + '";\n';
theString += 'LayerID[' + i + '] = "' + LayerID[i] + '";\n';
theString += 'LayerType[' + i + '] = "' + LayerType[i] + '";\n';
theString += 'LayerVisible[' + i + '] = ' + LayerVisible[i] + ';\n';
theString += 'LayerExtent[' + i + '] = "' + LayerExtent[i] + '";\n';
theString += 'LayerMinScale[' + i + '] = ' + LayerMinScale[i] + ';\n';
theString += 'LayerMaxScale[' + i + '] = ' + LayerMaxScale[i] + ';\n';
theString += 'LayerIsFeature[' + i + '] = ' + LayerIsFeature[i] + ';\n';
theString += 'LayerFieldList[' + i + '] = "' + LayerFieldList[i] + '";\n';
theString += 'LayerFieldTypeList[' + i + '] = "' + LayerFieldTypeList[i] + '";\n';
theString += 'LayerFieldSizeList[' + i + '] = "' + LayerFieldSizeList[i] + '";\n';
theString += 'LayerFieldPrecisionList[' + i + '] = "' + LayerFieldPrecisionList[i] + '";\n';
theString += 'LayerIDField[' + i + '] = "' + LayerIDField[i] + '";\n';
theString += 'LayerShapeField[' + i + '] = "' + LayerShapeField[i] + '";\n';
theString += 'LayerRenderString[' + i + '] = "' + LayerRenderString[i] + '";\n';
theString += "\n";
}
theString += "FeatureLayerCount = " + FeatureLayerCount + ";\n";
theString += "layerCount = " + layerCount + ";\n";
document.forms[0].layerParams.value = theString;
}
}
// check if there is an error message in the response
function getXMLErrorMessage(theString) {
var pos1 = 0;
var pos2 = 0;
var pos3 = 0;
var theError = "";
pos3 = theString.indexOf("<ERROR");
if (pos3!=-1) {
pos1 = theString.indexOf(">",pos3);
pos1 += 1;
pos2 = theString.indexOf("</ERROR");
theError = theString.substring(pos1,pos2)
}
return theError;
}
// get directory path of URL
function getPath(theFullPath) {
var theSlash = theFullPath.lastIndexOf("/");
var theDir = theFullPath.substring(0,theSlash);
if (theDir==null) theDir="";
theDir = theDir + "/";
return theDir;
}
function writePage(errorString,theURL) {
document.open();
document.writeln('<html>');
document.writeln('<body BGCOLOR="White" TEXT="Black" TOPMARGIN=20>');
document.writeln('<DIV ALIGN="center">');
document.writeln(' <FONT FACE="Arial,sans-serif" SIZE="+1">');
document.writeln(' <B>');
document.writeln(errorString);
document.writeln('<p>');
document.writeln(' </FONT>');
document.writeln(' <FONT FACE="Arial,sans-serif" SIZE="-1">');
document.writeln(theURL);
document.writeln(' </B>');
document.writeln(' </FONT>');
document.writeln('</DIV>');
document.writeln('</body>');
document.writeln('</html>');
document.close();
}
// test for forbidden tags for this service
function checkForbiddenGetImageTag(theString) {
var theError="";
var dQuote = '"';
var startpos = theString.indexOf("CAPABILITIES forbidden=");
if (startpos!=-1) {
startpos = startpos + 24;
endpos = theString.indexOf(dQuote,startpos);
var forbiddenTags = theString.substring(startpos,endpos);
//alert(forbiddenTags);
if (forbiddenTags.indexOf("GET_IMAGE")!=-1) {
theError = msgList[119];
// No image requests!!!! Abort viewer
}
}
return theError;
}
// check if theURL has different host from theHost
function isNotSameHostInURL(theURL, theHost) {
var startpos = theURL.indexOf("//");
if (startpos==-1) {
startpos = 0;
} else {
startpos = startpos + 2;
}
var endpos = theURL.indexOf("/",startpos);
if (endpos==-1) endpos = theURL.length;
var thisHost = theURL.substring(startpos,endpos);
if (thisHost==theHost) {
return false;
} else {
return true;
}
}
// get min and max x,y's from xml stream . . . return an array with values
function getEnvelopeXYs(theString, startpos) {
var theEnvelope = new Array();
//forceCommaInRequest[activeMapServiceIndex] = false;
theString = theString.toUpperCase();
var tempString = "";
var pos = theString.indexOf("ENVELOPE",startpos);
if (pos!=-1) {
pos = pos + 8;
startpos = theString.indexOf("MINX=",pos);
startpos += 6;
var endpos = theString.indexOf(dQuote,startpos);
tempString = theString.substring(startpos,endpos);
theEnvelope[0] = parseFloat(setDecimalString(tempString));
startpos = theString.indexOf("MINY=",pos);
startpos += 6;
endpos = theString.indexOf(dQuote,startpos);
tempString = theString.substring(startpos,endpos);
theEnvelope[1] = parseFloat(setDecimalString(tempString));
startpos = theString.indexOf("MAXX=",pos);
startpos += 6;
endpos = theString.indexOf(dQuote,startpos);
tempString = theString.substring(startpos,endpos);
theEnvelope[2] = parseFloat(setDecimalString(tempString));
startpos = theString.indexOf("MAXY=",pos);
startpos += 6;
endpos = theString.indexOf(dQuote,startpos);
tempString = theString.substring(startpos,endpos);
theEnvelope[3] = parseFloat(setDecimalString(tempString));
}
return theEnvelope;
}
// set number string to have decimal character to match browser language type - point or comma
function setDecimalString(numberString) {
if (decimalChar==".") {
numberString = numberString.replace(/,/g, ".");
} else {
numberString = numberString.replace(/./g, ",");
}
return numberString;
}
</SCRIPT>
</head>
<body bgcolor="#666666" text="White" topmargin=5>
<div align="center">
<table cellspacing="5" cellpadding="5" bgcolor="#003366">
<tr>
<td align="center" valign="top" bgcolor="#006699">
<font face="Arial,Helvetica,sans-serif" size="-1">
<form>
<b>Layer Parameters</b><br>
<textarea cols="80" rows="20" name="layerParams">
</textarea><br>
To use these in the viewer:<br>
Create a file called aimsLayerParam.js in the site directory and paste the above text into it.<BR>
Then in MapFrame.htm, uncomment the following line:<br>
<font color="#CCCCCC"><!-- <SCRIPT TYPE="text/javascript" LANGUAGE="JavaScript" SRC="aimsLayerParam.js"></SCRIPT> --></font><br>
Applying these changes will speed up layer parameter setup.<br>
This may be noticeable only with large MapServices.
</form>
</font>
</td>
</tr>
</table>
</div>
</body>
</html>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -