?? aimsselect.js
字號:
// aimsSelect.js
/*
* JavaScript template file for ArcIMS HTML Viewer
* dependent on aimsXML.js, ArcIMSparam.js, aimsCommon.js, aimsMap.js, aimsIdentify, and aimsLayers.js
* To be interactive, dependent also on aimsDHTML.js, aimsClick.js, and aimsNavigation.js
*/
aimsSelectPresent=true;
var selectData = new Array();
var selectLeft = new Array();
var selectRight = new Array();
var selectTop = new Array();
var selectBottom = new Array();
var selMaxEnvelope = new Array();
var selectLayer="";
var selectType = "";
var selectCount = 0;
var selectBlurb = "";
var selectEnvelope="";
var highlightedOne = "";
//mode - 0=selection; 1=query
var queryMode=1;
//mode - 1=query; 2=box,point; 3=line,polygon
var selectionMode=1;
var setQueryString="";
var shapeBufferDistance = 0;
/*
***************************************************************************************
Selection functions
***************************************************************************************
*/
// select feature
function select(e) {
//getImageXY(e);
getMapXY(mouseX,mouseY);
searchTolerance = (xDistance/iWidth) * pixelTolerance;
var tempWest = mapX - searchTolerance;
var tempNorth = mapY + searchTolerance;
var tempEast = mapX + searchTolerance;
var tempSouth = mapY - searchTolerance;
queryStartRecord=1;
selectEnvelope='maxy="' + forceComma(tempNorth) + '" maxx="' + forceComma(tempEast) + '" miny="' + forceComma(tempSouth) + '" minx="' + forceComma(tempWest) + '"';
selectionMode=2;
showRetrieveData();
var theString = writeGetFeatures2(tempWest,tempSouth,tempEast,tempNorth);
sendToServer(imsQueryURL,theString,selectXMLMode);
}
// start select box display
function startSelectBox(e) {
if (checkIfActiveLayerAvailable()) {
moveLayer("theMap",hspc,vspc);
getImageXY(e);
// keep it within the MapImage
if ((mouseX<iWidth) && (mouseY<iHeight)) {
if (selectBox) {
stopSelectBox(e);
} else {
x1=mouseX;
y1=mouseY
x2=x1+1;
y2=y1+1;
zleft=x1;
ztop=y1;
zbottom=y1;
zright=x1
boxIt(x1,y1,x2,y2);
/*
clipLayer("zoomBoxTop",x1,y1,x2,y2);
clipLayer("zoomBoxLeft",x1,y1,x2,y2);
clipLayer("zoomBoxRight",x1,y1,x2,y2);
clipLayer("zoomBoxBottom",x1,y1,x2,y2);
*/
selectBox=true;
//if (isNav4) {
showLayer("zoomBoxTop");
showLayer("zoomBoxLeft");
showLayer("zoomBoxRight");
showLayer("zoomBoxBottom");
//} else {
// showLayer("zoomBox");
//}
}
highlightedOne="";
}
return false;
}
}
// stop select box display..... select
function stopSelectBox(e) {
selectBox=false;
/*
var tempLeft=lastLeft;
var tempRight=lastRight;
var tempTop=lastTop;
var tempBottom=lastBottom;
*/
//if (isNav4) {
hideLayer("zoomBoxTop");
hideLayer("zoomBoxLeft");
hideLayer("zoomBoxRight");
hideLayer("zoomBoxBottom");
//} else {
// showLayer("zoomBox");
//}
// /*
if ((zright <zleft+2) && (zbottom < ztop+2)) {
//getMapXY(mouseX-pixelTolerance,mouseY-pixelTolerance);
getMapXY(mouseX,mouseY);
searchTolerance = (xDistance/iWidth) * pixelTolerance;
tempLeft = mapX-searchTolerance;
tempTop = mapY-searchTolerance;
tempRight = mapX+searchTolerance;
tempBottom = mapY+searchTolerance;
//select(e);
} else {
// */
pixelX = xDistance / iWidth;
var theY = iHeight - ztop;
pixelY = yDistance / iHeight;
tempTop = pixelY * theY + eBottom;
tempRight = pixelX * zright + eLeft;
tempLeft = pixelX * zleft + eLeft;
theY = iHeight - zbottom;
pixelY = yDistance / iHeight;
tempBottom = pixelY * theY + eBottom;
}
window.scrollTo(0,0);
queryStartRecord=1;
var theString = writeGetFeatures2(tempLeft,tempBottom,tempRight,tempTop);
selectEnvelope='maxy="' + forceComma(tempTop) + '" maxx="' + forceComma(tempRight) + '" miny="' + forceComma(tempBottom) + '" minx="' + forceComma(tempLeft) + '"';
drawSelectBoundary=true;
showBuffer=false;
selectionMode=2;
//if (useTextFrame) parent.TextFrame.document.location = "text.htm";
sendToServer(imsQueryURL,theString,selectXMLMode);
return true;
}
// write out XML request to select features
function writeGetFeatures2(west1,south1,east1,north1) {
if (swapSelectFields) {
selectFields=selFieldList[ActiveLayerIndex];
//alert(selectFields);
}
var theEnvelope = 'maxy="' + forceComma(north1) + '" maxx="' + forceComma(east1) + '" miny="' + forceComma(south1) + '" minx="' + forceComma(west1 )+ '"';
var theString = writeEnvelopeXML(ActiveLayer,ActiveLayerType,selectFields,maxFeaturesReturned,queryStartRecord,theEnvelope,useLimitExtent);
//alert(theString);
selectLayer=ActiveLayer;
selectType=ActiveLayerType;
selectCount=0;
hightlightedOne="";
selectPoints.length=1;
selectLeft.length=1;
selectRight.length=1;
selectTop.length=1;
selectBottom.length=1;
return theString;
}
function writeGetFeatures3() {
if (swapSelectFields) {
selectFields=selFieldList[ActiveLayerIndex];
}
var theString = writeEnvelopeXML(ActiveLayer,ActiveLayerType,selectFields,maxFeaturesReturned,queryStartRecord,selectEnvelope,useLimitExtent);
//alert(theString);
selectLayer=ActiveLayer;
selectType=ActiveLayerType;
selectCount=0;
hightlightedOne="";
selectPoints.length=1;
selectLeft.length=1;
selectRight.length=1;
selectTop.length=1;
selectBottom.length=1;
return theString;
}
// generic envelope select xml write routine
function writeEnvelopeXML(theLayer,theLayerType,theFields,maxReturned,startRec,theEnvelope,hasLimit) {
var theString = '<ARCXML version="1.1">\n<REQUEST>\n<GET_FEATURES outputmode="xml" envelope="true" geometry="false"';
theString += ' featurelimit="' + maxReturned + '" beginrecord="' + startRec + '">\n';
theString += '<LAYER id="' + theLayer + '" />';
theString += '<SPATIALQUERY subfields="' + theFields + '">';
//theString += '<SPATIALFILTER relation=envelope_intersection >';
theString += '<SPATIALFILTER relation="area_intersection" >';
theString += '<ENVELOPE ' + theEnvelope + ' />';
theString += '</SPATIALFILTER>';
if (hasLimit) {
// keep this within the limitExtent
theString += '<SPATIALFILTER relation="area_intersection">\n';
theString += '<ENVELOPE maxx="' + forceComma(limitRight) + '" maxy="' + forceComma(limitTop) + '" minx="' + forceComma(limitLeft) + '" miny="' + forceComma(limitBottom) + '" />\n';
theString += '</SPATIALFILTER>\n';
}
theString += '</SPATIALQUERY>';
theString += '</GET_FEATURES>';
theString += '</REQUEST>';
theString += '</ARCXML>';
return theString;
}
// write out xml request for selection by shape
function writeShapeSelect(theType) {
if (swapSelectFields) {
selectFields=selFieldList[ActiveLayerIndex];
}
var theString = '<ARCXML version="1.1">\n<REQUEST>\n<GET_FEATURES outputmode="xml" envelope="true" geometry="false"';
theString += ' featurelimit="' + maxFeaturesReturned + '" beginrecord="' + queryStartRecord + '">\n';
theString += '<LAYER id="' + ActiveLayer + '" />';
theString += '<SPATIALQUERY subfields="' + selectFields + '">';
theString += '<SPATIALFILTER relation="area_intersection" >';
if ((shapeSelectBuffer) && (shapeBufferDistance>0)) {
//if (shapeBufferDistance>0) {
// do a buffer around the shape before selecting
theString += '<BUFFER distance="' + forceComma(shapeBufferDistance) + '" ';
theString += ' bufferunits="' + ScaleBarUnits + '"';
theString += ' />\n';
}
if (theType==1) {
theString += '<POLYLINE>\n<PATH>\n';
} else if (theType==2) {
theString += '<POLYGON>\n<RING>\n';
} else {
theString += '<MULTIPOINT>\n';
}
if (theType==0) {
theString += '<POINT x="' + clickPointX[clickCount-1] + '" y="' + clickPointY[clickCount-1] + '" />\n';
} else {
for (var i=0;i<clickCount;i++) {
theString += '<POINT x="' + clickPointX[i] + '" y="' + clickPointY[i] + '" />\n';
}
}
if (theType==0) {
theString += '</MULTIPOINT>\n';
} else if (theType==2) {
theString += '</RING>\n</POLYGON>\n';
} else {
theString += '</PATH>\n</POLYLINE>\n';
}
theString += '</SPATIALFILTER>';
if (useLimitExtent) {
// keep this within the limitExtent
theString += '<SPATIALFILTER relation="area_intersection">\n';
theString += '<ENVELOPE maxx="' + forceComma(limitRight) + '" maxy="' + forceComma(limitTop) + '" minx="' + forceComma(limitLeft) + '" miny="' + forceComma(limitBottom) + '" />\n';
theString += '</SPATIALFILTER>\n';
}
theString += '</SPATIALQUERY>';
theString += '</GET_FEATURES>';
theString += '</REQUEST>';
theString += '</ARCXML>';
//alert(theString);
selectLayer=ActiveLayer;
selectType=ActiveLayerType;
selectCount=0;
hightlightedOne="";
selectPoints.length=1;
selectLeft.length=1;
selectRight.length=1;
selectTop.length=1;
selectBottom.length=1;
return theString;
}
// request a selection using a shape
function sendShapeSelect(theType) {
queryStartRecord=1;
selectionMode=3;
showBuffer=false;
if (theType==2) {
if ((clickPointX[0]!=clickPointX[clickCount-1]) && (clickPointY[0]!=clickPointY[clickCount-1])) {
clickPointX[clickCount]=clickPointX[0];
clickPointY[clickCount]=clickPointY[0];
clickCount=clickCount+1;
}
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -