📄 aimsmultiservice.js
字号:
}
}
//alert("LayerInfo processed");
tempArray.reverse();
theString = tempArray.join("|");
theReplyUC="";
tempArray = null;
//alert(theString);
return theString;
}
// get list of layers, id/shape fields, scalefactors, etc.
function getLayerVisibles(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 = theReplyUC.indexOf("VISIBLE=",lpos);
if (startpos != -1) {
startpos = startpos + 9;
endpos = startpos + 4;
visString = theReply.substring(startpos,endpos);
}
if (visString=="true") {tempArray[theCount] = 1} else {tempArray[theCount] = 0};
theCount++;
endpos = zpos;
}
lpos = theReplyUC.indexOf("<LAYERINFO",zpos);
} else {
lpos = -1;
}
}
}
//alert("LayerInfo processed");
tempArray.reverse();
theString = tempArray.join("|");
theReplyUC="";
tempArray = null;
//alert(theString);
return theString;
}
function processStartMapServiceLayers(theReply) {
mapServiceLayers[overlayIndex] = getLayerIDs(theReply);
mapServiceLayersVisible[overlayIndex] = getLayerVisibles(theReply);
//alert(overlayIndex);
overlayIndex++;
if (overlayIndex<mapServiceCount) {
var theString = '<ARCXML version="1.1">\n<REQUEST>\n<GET_SERVICE_INFO renderer="false" extensions="false" fields="false" />\n</REQUEST>\n</ARCXML>\n';
sendMultiToServer(mapServiceList[overlayIndex],theString,"parent.MapFrame.processMulti",5002);
} else {
if (parent.ServiceFrame!=null) parent.ServiceFrame.document.location = appDir + "MapServices.htm";
overlayIndex=0;
getStartExtent2();
}
}
function processSwithchActiveMapService(theReply) {
if (parent.ServiceFrame!=null) {
parent.ServiceFrame.document.location = appDir + "MapServices.htm";
}
theIndex = parseInt(activeMapServiceIndex);
if (aimsLayersPresent) {
getLayers(theReply);
//if (setLayerVisible.length>0) setupLayerVisible();
LayerVisible.length=0;
if (mapServiceLayersVisible[theIndex].indexOf("|")!=-1) {
LayerVisible = mapServiceLayersVisible[theIndex].split("|");
} else {
LayerVisible[0] = mapServiceLayersVisible[theIndex]
}
mapServiceLayers[theIndex] = getLayerIDs(theReply);
}
if (aimsQueryPresent) {
if (useStoredQuery) checkStoredQueries(theReply);
} else {
useStoredQuery=false;
}
if (aimsLayersPresent) {
if ((hasTOC) && (showTOC)) {
parent.TOCFrame.document.location=appDir+"toc.htm";
}
}
if (aimsGeocodePresent) {
if (GCLayerCount==0) {
if ((useGeocode) || (useReverseGeocode)) {
useGeocode=false;
useReverseGeocode=false;
}
}
} else {
useGeocode=false;
useReverseGeocode=false;
}
if (parent.ToolFrame!=null) {
//alert("Refreshing toolbar");
parent.ToolFrame.document.location= appDir + "toolbar.htm";
} else if (hasToolBarOnLayer) {
// requires custom function getLayerListContent. . .
var content = getLayerListContent();
if (isNav) {
replaceLayerContent("theToolBar",content);
} else {
content = swapStuff(content,"\\'",sQuote);
document.all.theToolBar.innerHTML = content;
}
}
hideRetrieveData();
if (updateMaps) sendMapXML();
}
function swithchActiveMapService(indexIn,redrawMaps) {
var index = parseInt(indexIn);
//alert("Stuff goes here");
activeMapServiceIndex = index;
activeMapService = mapServiceList[index];
showRetrieveData();
updateMaps=redrawMaps;
LayerName.length=0;
LayerType.length=0;
LayerVisible.length=0;
LayerExtent.length=0;
LayerIsFeature.length=0;
LayerID.length=0;
LayerIDField.length=0;
LayerShapeField.length=0;
LayerMinScale.length=0;
LayerMaxScale.length=0;
LayerFieldTypeList.length=0;
LayerFieldList.length=0;
LayerRenderString.length=0;
LayerFieldSizeList.length=0;
LayerFieldPrecisionList.length=0;
layerCount = 0;
var theString = '<ARCXML version="1.1">\n<REQUEST>\n<GET_SERVICE_INFO renderer="false" extensions="true" fields="true" />\n</REQUEST>\n</ARCXML>';
sendMultiToServer(mapServiceList[index],theString,"parent.MapFrame.processMulti",5003);
imsURL = mapServiceList[index];
imsQueryURL= imsURL + "&CustomService=Query";
imsGeocodeURL = imsURL + "&CustomService=Geocode";
}
// prepare the request in xml format for Main Map
function writeXML() {
//alert(overlayIndex);
if (mapServiceLayers[overlayIndex].indexOf("|")!=-1) {
var idArray = mapServiceLayers[overlayIndex].split("|");
var visArray = mapServiceLayersVisible[overlayIndex].split("|");
} else {
var idArray = new Array();
var visArray = new Array();
idArray[0] = mapServiceLayers[overlayIndex];
visArray[0] = mapServiceLayersVisible[overlayIndex];
}
var theString = '<ARCXML version="1.1">\n<REQUEST>\n<GET_IMAGE>\n<PROPERTIES>\n<ENVELOPE minx="' + forceComma(eLeft) + '" miny="' + forceComma(eBottom) + '" maxx="' + forceComma(eRight) + '" maxy="' + forceComma(eTop) + '" />\n';
theString += '<IMAGESIZE height="' + iHeight + '" width="' + iWidth + '" />\n';
var visString = "";
if (aimsLayersPresent) {
// tell the server which layers are to be visible
if (toggleVisible) {
theString += '<LAYERLIST >\n';
for (var i=0;i<idArray.length;i++) {
if (visArray[i]==1) {
theString += '<LAYERDEF id="' + idArray[i] + '" visible="true" />\n';
}
else {
theString += '<LAYERDEF id="' + idArray[i] + '" visible="false" />\n';
}
}
theString += '</LAYERLIST>\n';
}
}
// map background color
if ((mapTransparent) && (overlayIndex!=0)) {
theString += '<BACKGROUND color="' + transColor + '" transcolor="' + transColor + '" />\n';
} else {
if (mapBackColor!="") {
theString += '<BACKGROUND color="' + mapBackColor + '" />\n\n';
}
}
if (overlayIndex==parseInt(activeMapServiceIndex)) {
if (aimsLegendPresent) {
// create a legend image
if (legendVisible) theString += addLegendToMap();
}
}
theString += '</PROPERTIES>\n';
if (overlayIndex==parseInt(activeMapServiceIndex)) {
// buffer
if (aimsBufferPresent) {
if (showBuffer) theString += addBufferToMap();
}
// select
if (aimsSelectPresent) {
theString += addSelectToMap();
}
}
// any custom stuff to fit here
if ((aimsCustomPresent) && (overlayIndex==mapServiceCount-1)) theString += addCustomToMap1();
if (overlayIndex==parseInt(activeMapServiceIndex)) {
// geocoding or point with label
if (showGeocode) {
// draw the point . . . also used to display any point with a label on map
theString += '<LAYER type="acetate" name="GeoCode1">\n';
theString += '<OBJECT units="database">\n<POINT coord="' + forceComma(geocodeX) + coordsDelimiter + forceComma(geocodeY) + '">\n';
theString += '<SIMPLEMARKERSYMBOL type="circle" color="' + geocodePointColor + '" width="' + geocodePointSize +'" />\n</POINT></OBJECT>\n';
if (geocodeLabel!="") {
theString += '<OBJECT units="database">\n<TEXT coord="' + forceComma(geocodeX) + coordsDelimiter + forceComma(geocodeY) + '" label="' + geocodeLabel + '">\n';
theString += '<TEXTMARKERSYMBOL fontcolor="' + geocodePointColor + '" fontsize="12" shadow="64,64,64" glowing="255,255,0" halignment="right" valignment="top" /></TEXT></OBJECT>\n';
}
theString += '</LAYER>\n';
}
if (aimsClickPresent) {
// clickpoints
if (clickCount>0) {
// draw click points and lines between them on map
var clickColor = selectColor;
if (clickType==1) clickColor = clickMarkerColor;
theString += '<LAYER type="acetate" name="allTheClicks">\n';
if (clickCount>1) {
theString += '<OBJECT units="database">\n<LINE coords="' + forceComma(clickPointX[0]) + coordsDelimiter + forceComma(clickPointY[0]);
for (var i=1;i<clickCount;i++) {
theString += pairsDelimiter + forceComma(clickPointX[i]) + coordsDelimiter + forceComma(clickPointY[i]);
}
theString += '" >\n';
theString += '<SIMPLELINESYMBOL type="solid" color="' + clickMarkerColor;
theString += '" width="3" />\n</LINE>\n</OBJECT>\n';
theString += '<OBJECT units="database">\n<LINE coords="' + forceComma(clickPointX[0]) + coordsDelimiter + forceComma(clickPointY[0]);
for (var i=1;i<clickCount;i++) {
theString += pairsDelimiter + forceComma(clickPointX[i]) + coordsDelimiter + forceComma(clickPointY[i]);
}
theString += '" >\n';
theString += '<SIMPLELINESYMBOL type="solid" color="255,255,255" width="1" />\n</LINE>\n</OBJECT>\n';
}
for (var i=0;i<clickCount;i++) {
theString += '<OBJECT units="acetate">\n<POINT coord="' + forceComma(clickPointX[i]) + coordsDelimiter + forceComma(clickPointY[i]) + '">\n';
theString += '<SIMPLEMARKERSYMBOL type="' + clickMarkerType + '"';
theString += ' color="' + clickMarkerColor + '" width="' + clickMarkerSize + '" />\n</POINT>\n</OBJECT>\n';
}
theString += '</LAYER>\n';
}
}
if (overlayIndex==mapServiceList.length - 1) theString += addMapElements();
}
theString += '</GET_IMAGE>\n</REQUEST>\n</ARCXML>';
idArray = null;
visArray = null;
//alert(theString);
return theString;
}
// write out a blank map. . . to get image extents from limit extents
function writeTopXML() {
var theString = '<ARCXML version="1.1">\n<REQUEST>\n<GET_IMAGE>\n<PROPERTIES>\n<ENVELOPE minx="' + forceCommaInOverlay(eLeft) + '" miny="' + forceCommaInOverlay(eBottom) + '" maxx="' + forceCommaInOverlay(eRight) + '" maxy="' + forceCommaInOverlay(eTop) + '" />\n';
theString += '<IMAGESIZE height="' + iHeight + '" width="' + iWidth + '" />\n';
theString += addMapElements();
theString += '</GET_IMAGE>\n</REQUEST>\n</ARCXML>';
//alert(theString);
return theString;
}
function addMapElements() {
var theString = "";
// any custom stuff to fit here
if (aimsCustomPresent) theString += addCustomToMap2();
if (drawBottomBar) {
theString += '<LAYER type="acetate" name="theBottomBar">\n';
theString += '<OBJECT units="pixel">\n<POLYGON ';
theString += 'coords="0' + coordsDelimiter + '1' + pairsDelimiter;
theString += '1' + coordsDelimiter + bottomBarHeight + pairsDelimiter;
theString += (iWidth-1) + coordsDelimiter + bottomBarHeight + pairsDelimiter;
theString += (iWidth-1) + coordsDelimiter + '1' + pairsDelimiter;
theString += '0' + coordsDelimiter + '1">\n';
theString += '<SIMPLEPOLYGONSYMBOL fillcolor="' + bottomBarColor + '" boundary="true" boundarycolor="' + bottomBarOutline + '" overlap="false" />\n';
theString += '</POLYGON>\n</OBJECT>\n';
theString += '</LAYER>\n';
}
if (drawCopyright) {
// draw text on the map
theString += '<LAYER type="acetate" name="theCopyright" id="theCopyright">\n';
theString += '<OBJECT units="pixel">\n<TEXT coords="' + CopyrightCoords + '" label="' + CopyrightText + '">\n';
theString += '<TEXTMARKERSYMBOL fontstyle="' + CopyrightStyle + '" fontsize="' + CopyrightSize + '" ';
if (CopyrightFont!="") theString += 'font="' + CopyrightFont + '" ';
theString += 'fontcolor="' + CopyrightColor + '" antialiasing="True" ';
//if (CopyrightBackground.toUpperCase()=="TRUE") theString += 'background="' + CopyrightBackground + '" backcolor="' + CopyrightBGColor + '" ';
if (CopyrightBackground.toUpperCase()=="TRUE") theString += 'blockout="' + CopyrightBGColor + '" ';
if (CopyrightShadow.toUpperCase()=="TRUE") theString += 'shadow="' + CopyrightShadowColor + '" ';
theString += 'overlap="false" ';
if (CopyrightGlow.toUpperCase()=="TRUE") theString += ' glowing="' + CopyrightGlowColor + '" ';
theString += '/>\n</TEXT>\n</OBJECT>\n';
theString += '</LAYER>\n';
}
if (drawNorthArrow) {
// draw a north arrow
theString += '<LAYER type="acetate" name="theNorthArrow" id="theNorthArrow">\n';
theString += '<OBJECT units="pixel">\n<NORTHARROW type="' + NorthArrowType + '" size="' + NorthArrowSize + '" coords="' + NorthArrowCoords + '" shadow="32,32,32" ';
theString += 'angle="' + NorthArrowAngle + '" antialiasing="True" overlap="False" />\n</OBJECT>\n';
theString += '</LAYER>\n';
}
if (drawScaleBar) {
// draw a scale bar
//ScaleBarPrecision = numDecimals;
theString += '<LAYER type="acetate" name="theScaleBar">\n';
xDistance = eRight - eLeft;
theString += '<OBJECT units="pixel">\n';
theString += '<SCALEBAR ';
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -