📄 aimsmultiservice.js
字号:
if (drawScaleBar2) {
theString += 'screenlength="' + parseInt(iWidth * (1/10)) + '" coords="' + (iWidth-((parseInt(iWidth * (4/10)))+20)) + coordsDelimiter + '3" ';
} else {
theString += 'screenlength="' + parseInt(iWidth * (2/10)) + '" coords="' + parseInt(iWidth * (6/10)) + coordsDelimiter + '3" ';
}
if (MapUnits=="DEGREES") theString += 'mode="geodesic" ';
if (ScaleBarFont!="") theString += 'font="' + ScaleBarFont + '" ';
theString += 'fontcolor="' + ScaleBarFontColor + '" style="' + ScaleBarStyle + '" barcolor="' + ScaleBarColor + '" ';
if (MapUnits!="DEGREES") {
theString += 'mapunits="' + MapUnits.toLowerCase() + '" ';
}
theString += 'scaleunits="' + ScaleBarUnits.toLowerCase() + '" antialiasing="True" ';
var sDistance = getScaleBarDistance();
if (MapUnits=="DEGREES") {
if (xDistance<1/10){
theString += 'precision="' + ScaleBarPrecision + '" ';
}
} else if (sDistance<5) {
theString += 'precision="' + ScaleBarPrecision + '" ';
}
//theString += 'screenlength="' + parseInt(iWidth * (2/10)) + '" ';
theString += 'fontsize="' + ScaleBarSize + '" barwidth="' + ScaleBarWidth + '" overlap="False" ';
//*/
theString += '/>\n</OBJECT>\n';
theString += '</LAYER>\n';
}
if (drawScaleBar2) {
// draw a scale bar
//ScaleBarPrecision = numDecimals;
theString += '<LAYER type="acetate" name="theScaleBar2">\n';
xDistance = eRight - eLeft;
theString += '<OBJECT units="pixel">\n';
theString += '<SCALEBAR ';
if (drawScaleBar) {
theString += 'screenlength="' + parseInt(iWidth * (1/10)) + '" coords="' + (iWidth-((parseInt(iWidth * (2/10)))+10)) + coordsDelimiter + '3" ';
} else {
theString += 'screenlength="' + parseInt(iWidth * (2/10)) + '" coords="' + parseInt(iWidth * (6/10)) + coordsDelimiter + '3" ';
}
if (MapUnits=="DEGREES") theString += 'mode="geodesic" ';
if (ScaleBar2Font!="") theString += 'font="' + ScaleBar2Font + '" ';
theString += 'fontcolor="' + ScaleBar2FontColor + '" style="' + ScaleBar2Style + '" barcolor="' + ScaleBar2Color + '" ';
if (MapUnits!="DEGREES") {
theString += 'mapunits="' + MapUnits.toLowerCase() + '" ';
}
theString += 'scaleunits="' + ScaleBar2Units.toLowerCase() + '" antialiasing="True" ';
var sDistance = getScaleBarDistance();
if (MapUnits=="DEGREES") {
if (xDistance<1/10){
theString += 'precision="' + ScaleBar2Precision + '" ';
}
} else if (sDistance<5) {
theString += 'precision="' + ScaleBar2Precision + '" ';
}
//theString += 'screenlength="' + parseInt(iWidth * (2/10)) + '" ';
theString += 'fontsize="' + ScaleBar2Size + '" barwidth="' + ScaleBar2Width + '" overlap="False" ';
//*/
theString += '/>\n</OBJECT>\n';
theString += '</LAYER>\n';
}
// any custom stuff to fit here
if (aimsCustomPresent) theString += addCustomToMap3();
if (drawModeOnMap) {
// draw the current mode on the map
theString += '<LAYER type="acetate" name="theMode">\n';
theString += '<OBJECT units="pixel">\n<TEXT coord="5' + coordsDelimiter + (iHeight-10) + '" label="' + modeBlurb + '">\n';
theString += '<TEXTMARKERSYMBOL fontstyle="BOLD" fontsize="12" font="ARIAL" fontcolor="' + modeMapColor + '" ';
theString += 'threed="TRUE" glowing="' + modeMapGlow + '" />\n</TEXT>\n</OBJECT></LAYER>';
}
// any custom stuff to be drawn on top of everything
if (aimsCustomPresent) theString += addCustomToMap4();
return theString;
}
// send request to create graphic legend
// replaces original getLegend() in aimsLegend.js
function getLegend() {
legendVisible=true;
drawLegendOnly=true;
overlayIndex = parseInt(activeMapServiceIndex);
legTitle = mapServiceName[overlayIndex];
var theString=writeXML();
showRetrieveMap();
sendToServer(imsURL,theString,98);
}
function serviceVisibility(index, isVisible) {
//alert(index + " - " + isVisible);
var lyrName = "theMap" ;
if (index>0) lyrName = "theMap" + index;
parent.MapFrame.focus();
if (isVisible) {
showLayer(lyrName);
mapServiceVisible[index]=1;
} else {
hideLayer(lyrName);
mapServiceVisible[index]=0;
}
}
// move map image with mouse
// replaces panMouse() in aimsNavigation.js
function panMouse() {
var xMove = x2-x1;
var yMove = y2-y1;
var cLeft = -xMove;
var cTop = -yMove;
var cRight = iWidth;
var cBottom = iHeight;
if (xMove>0) {
cLeft = 0;
cRight = iWidth - xMove;
}
if (yMove>0) {
cTop = 0;
cBottom = iHeight - yMove;
}
clipLayer2("theMap",cLeft,cTop,cRight,cBottom);
moveLayer("theMap",xMove+hspc,yMove+vspc);
for (var i=1;i<mapServiceCount;i++) {
var lyrName = "theMap" + i;
clipLayer2(lyrName,cLeft,cTop,cRight,cBottom);
moveLayer(lyrName,xMove+hspc,yMove+vspc);
}
if (hasLayer("theMapClicks")) {
clipLayer2("theMapClicks",cLeft,cTop,cRight,cBottom);
moveLayer("theMapClicks",xMove+hspc,yMove+vspc);
}
//return false;
}
// move active service up
function moveServiceUp() {
var k = parseInt(activeMapServiceIndex);
if (k<mapServiceList.length-1) {
var m = k + 1;
activeMapServiceIndex = m;
moveMapService(k, m)
}
}
// move active service down
function moveServiceDown() {
var k = parseInt(activeMapServiceIndex);
if (k>0) {
var m = k - 1;
//var msg = "Before:" + k + "\n" + mapServiceList[k] + "\n" + mapServiceName[k] + "\n" + mapServiceLayers[k] + "\n" + mapServiceLayersVisible[k] + "\n" + mapServiceVisible[k] + "\n\n";
activeMapServiceIndex = m;
moveMapService(k, m)
//var msg = msg + "After:" + k + "\n" + mapServiceList[k] + "\n" + mapServiceName[k] + "\n" + mapServiceLayers[k] + "\n" + mapServiceLayersVisible[k] + "\n" + mapServiceVisible[k] + "\n\n";
//alert(msg);
}
}
function moveMapService(fromPosition, toPosition) {
var fp=parseInt(fromPosition);
var tp=parseInt(toPosition);
var temp1 = mapServiceList[fp];
var temp2 = mapServiceList[tp];
mapServiceList[fp] = temp2;
mapServiceList[tp] = temp1;
temp1 = mapServiceName[fp];
temp2 = mapServiceName[tp];
mapServiceName[fp] = temp2;
mapServiceName[tp] = temp1;
temp1 = mapServiceLayers[fp];
temp2 = mapServiceLayers[tp];
mapServiceLayers[fp] = temp2;
mapServiceLayers[tp] = temp1;
temp1 = mapServiceLayersVisible[fp];
temp2 = mapServiceLayersVisible[tp];
mapServiceLayersVisible[fp] = new String(temp2);
mapServiceLayersVisible[tp] = new String(temp1);
var temp3 = mapServiceVisible[fp];
var temp4 = mapServiceVisible[tp];
mapServiceVisible[fp] = temp4;
mapServiceVisible[tp] = temp3;
temp3 = forceCommaInRequest[fp];
temp4 = forceCommaInRequest[tp];
forceCommaInRequest[fp] = temp4;
forceCommaInRequest[tp] = temp3;
//window.setTimeout("sendMapXML();",1500);
if (parent.TOCFrame!=null) {
parent.TOCFrame.updateLayers2();
} else {
sendMapXML();
}
}
function deleteMapService() {
var k = parseInt(activeMapServiceIndex);
var m = mapServiceList.length-1;
if (k==m) {
activeMapServiceIndex = k-1;
} else {
for (var i=k;i<m;i++) {
mapServiceList[i]=mapServiceList[i+1];
mapServiceName[i]=mapServiceName[i+1];
mapServiceLayers[i]=mapServiceLayers[i+1];
mapServiceLayersVisible[i]=mapServiceLayersVisible[i+1];
mapServiceVisible[i]=mapServiceVisible[i+1];
forceCommaInRequest[i]=forceCommaInRequest[i+1];
}
}
mapServiceList.length=m;
mapServiceName.length=m;
mapServiceLayers.length=m;
mapServiceLayersVisible.length=m;
mapServiceVisible.length=m;
forceCommaInRequest.length=m;
mapServiceCount = mapServiceList.length;
lyrName = "theMap" + m;
hideLayer(lyrName);
swithchActiveMapService(activeMapServiceIndex,true);
}
// 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=0;
serviceCount = 0;
var pos = -1;
var spos = 9;
var lpos = 9;
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);
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 + 5;
if (theReply.substring(startpos,endpos)=="Image") {
startpos = theReplyUC.indexOf("STATUS=",lpos);
startpos = startpos + 8;
endpos = startpos + 7;
if (theReplyUC.substring(startpos,endpos)=="ENABLED") {
ServiceName[i]=tempString;
startpos = theReplyUC.indexOf("<IMAGE",lpos);
if (startpos!=-1) {
endpos = startpos + 7;
startpos = theReplyUC.indexOf("TYPE=",endpos);
startpos = startpos + 6;
endpos = theReply.indexOf(dQuote, startpos);
serviceImageType[i] = theReplyUC.substring(startpos,endpos);
} else {
serviceImageType[i] ="Unknown";
}
i=i+1;
serviceCount=serviceCount+1;
}
//serviceImageType
}
}
}
//ServiceName.sort();
loadServiceForm();
} else {
alert("Error compiling MapService List");
}
hideRetrieveData();
}
function startAddService() {
var tempcVersion = cVersion;
cVersion = "";
var catologURL = "http://" + serviceHost + "/servlet/com.esri.esrimap.Esrimap?ServiceName=catalog";
var theText = "<GETCLIENTSERVICES/>";
sendToServer(catologURL,theText,5);
cVersion = tempcVersion;
}
function loadServiceForm() {
if (useTextFrame) {
parent.TextFrame.document.location= appDir + "addService.htm";
} else {
var Win1 = open(appDir + "addService.htm","AddServiceWindow","width=575,height=150,scrollbars=yes,resizable=yes");
}
}
function addMapService(theServiceURL,addServiceName,serviceIndex) {
// make URL for getting mapservice catalog
//overlayIndex=mapServiceCount;
var theType = serviceImageType[serviceIndex];
var okayToLoad = true;
if ((theType=="JPG") || (theType=="PNG24") || (theType=="Unknown")) {
if (!confirm(noTransMessage,true)) okayToLoad=false;
}
if (okayToLoad) {
mapServiceName[mapServiceCount]=addServiceName;
mapServiceList[mapServiceCount]=theServiceURL;
mapServiceVisible[mapServiceCount]=1;
var theString = '<ARCXML version="1.1">\n<REQUEST>\n<GET_SERVICE_INFO renderer="false" extensions="false" fields="false" />\n</REQUEST>\n</ARCXML>\n';
sendMultiToServer(theServiceURL,theString,"parent.MapFrame.processMulti",5004);
}
}
function processAddMapServiceLayers(theReply) {
mapServiceLayers[mapServiceCount] = getLayerIDs(theReply);
mapServiceLayersVisible[mapServiceCount] = getLayerVisibles(theReply);
if (parent.ServiceFrame!=null) parent.ServiceFrame.document.location = appDir + "MapServices.htm";
mapServiceCount++;
overlayIndex=0;
sendMapXML();
}
function forceCommaInOverlay(theNumber) {
var comma = ",";
var dot = ".";
var charOut = comma;
var charIn = dot;
var numberString = new String(theNumber);
if (commaUsedInTopLayer) {
charOut = dot;
charIn = comma;
}
var pos = numberString.indexOf(charOut);
if (pos!=-1) {
var begin = numberString.substring(0,pos);
var ending = numberString.substring(pos+1, numberString.length);
numberString = begin + charIn + ending;
}
return numberString;
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -