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

📄 aimsselect.js

📁 用ARCIMS在客户端框选一块区域求面积。
💻 JS
📖 第 1 页 / 共 2 页
字号:
	}
	showRetrieveData();
	var theString = writeShapeSelect(theType);
	sendToServer(imsQueryURL,theString,selectXMLMode);
}

// request more records to display
function getMoreData(startRecord) {
	var theString = "";
	queryStartRecord = startRecord;
	if (selectionMode==1) {
		//query
		theString = writeQueryXML(setQueryString);
	} else if (selectionMode==2) {
		theString = writeGetFeatures3();
	} else {
		var theType = clickType-1;
		theString = writeShapeSelect(theType);
	}
	showRetrieveData();
	sendToServer(imsQueryURL,theString,selectXMLMode);
}

// refresh map with hightlighted selection
function showHighlight(selNum) {
		highlightedOne = LayerIDField[ActiveLayerIndex] + " = " + selectPoints[selNum];
		//alert(selectLeft[selNum] + "," + selectRight[selNum]);
		var fWidth = selectRight[selNum] - selectLeft[selNum];
		var fHeight = selectTop[selNum] - selectBottom[selNum];
		var mWMargin = 0;
		var mHMargin = 0;
		if (selectType=="point") {			
			mWMargin = fullWidth * selectPointMargin;
			mHMargin = fullHeight * selectPointMargin;
			if (mWMargin > xDistance/2) {
				mWMargin = xDistance/2;
				mHMargin = yDistance/2;
			}
		} else {
			mWMargin = fWidth * selectMargin;
			mHMargin = fHeight * selectMargin; 
		}
		saveLastExtent();
		eLeft = selectLeft[selNum] - mWMargin;
		eRight = selectRight[selNum] + mWMargin;
		eTop = selectTop[selNum] + mHMargin;
		eBottom = selectBottom[selNum] - mHMargin;
		//alert(highlightedOne);
			legendTemp=legendVisible;
			legendVisible=false;
			sendMapXML();
			
}

// calculate max envelope for returned records
function calcSelectEnvelope() {
	//alert(selectCount);
	if (selectCount>0) {
		selMaxEnvelope[0] = selectLeft[0];
		selMaxEnvelope[1] = selectBottom[0];
		selMaxEnvelope[2] = selectRight[0];
		selMaxEnvelope[3] = selectTop[0];
		//alert("0 - " + selMaxEnvelope[0] + "," + selMaxEnvelope[1] + "," + selMaxEnvelope[2] + "," + selMaxEnvelope[3]);
		if (selectCount>1) {
			for (var i=1;i<selectCount;i++) {
				if (selectLeft[i]<selMaxEnvelope[0]) selMaxEnvelope[0] = selectLeft[i];
				if (selectBottom[i]<selMaxEnvelope[1]) selMaxEnvelope[1] = selectBottom[i];
				if (selectRight[i]>selMaxEnvelope[2]) selMaxEnvelope[2] = selectRight[i];
				if (selectTop[i]>selMaxEnvelope[3]) selMaxEnvelope[3] = selectTop[i];
				//alert(i + " - " + selMaxEnvelope[0] + "," + selMaxEnvelope[1] + "," + selMaxEnvelope[2] + "," + selMaxEnvelope[3]);
			}
		}
	}
}

function zoomToReturnedRecords() {
	calcSelectEnvelope();
	var fWidth = selMaxEnvelope[2] - selMaxEnvelope[0];
	var fHeight = selMaxEnvelope[3] - selMaxEnvelope[1];
	var mWMargin = 0;
	var mHMargin = 0;
	if ((fWidth==0) && (fHeight==0)) {			
		mWMargin = fullWidth * selectPointMargin;
		mHMargin = fullHeight * selectPointMargin;
		if (mWMargin > xDistance/2) {
			mWMargin = xDistance/2;
			mHMargin = yDistance/2;
		}
	} else {
		mWMargin = fWidth * selectMargin;
		mHMargin = fHeight * selectMargin; 
	}
	saveLastExtent();
	eLeft = selMaxEnvelope[0] - mWMargin;
	eRight = selMaxEnvelope[2] + mWMargin;
	eTop = selMaxEnvelope[3] + mHMargin;
	eBottom = selMaxEnvelope[1] - mHMargin;
	//legendTemp=legendVisible;
	//legendVisible=false;
	sendMapXML();

}
// clear current selection
function clearSelection() {
	var theCount = selectCount;
	var theHL = highlightedOne;
	selectCount=0;
	showBuffer=false;
	highlightedOne="";
	selectPoints.length=0;
	selectLeft.length=0;
	selectRight.length=0;
	selectTop.length=0;
	selectBottom.length=0;
	drawSelectBoundary=false;
	showGeocode=false;
	clickCount=0;
	totalMeasure=0;
	currentMeasure=0;
	if (useTextFrame) {
		parent.TextFrame.document.open();
		parent.TextFrame.document.writeln('<meta http-equiv="Content-Type" content="text/html; charset=' + charSet + '"><html>');
		parent.TextFrame.document.writeln('<body bgcolor="White" text="Black" link="Blue" vlink="Blue">');
		parent.TextFrame.document.writeln('<FONT FACE="Arial" SIZE="-1"><b>' + LayerName[ActiveLayerIndex] + '</b><br>');
		if (toolMode==20) {
			parent.TextFrame.document.writeln(msgList[70]);
			//MeasureArea
      currentArea=0;
			// end MeasureArea
			updateMeasureBox()
			}
		else 
			parent.TextFrame.document.writeln(msgList[71]);
		parent.TextFrame.document.writeln('</body></html>');
		parent.TextFrame.document.close()
	} else {
		if (toolMode==20) {
			showLayer("measureBox");
			//MeasureArea
      currentArea=0;
			// end MeasureArea
			updateMeasureBox()
			alert(msgList[70]);
		} else {
			alert(msgList[71]);
		}
	}

	
	//if ((theCount>0) || (theHL!="")) {
			//legendTemp=legendVisible;
			//legendVisible=false;
			selectBlurb="";
			//showLayer("LoadMap");
			//var theString = writeXML();
			//sendToServer(imsURL,theString,99);
			sendMapXML();
	//}

}

// add Draw Selected Features to Map XML request
function addSelectToMap(){
	var selString = "";
	var sFactor = (eRight-eLeft) / iWidth
	if (((sFactor>=LayerMinScale[ActiveLayerIndex]) && (sFactor<=LayerMaxScale[ActiveLayerIndex]) && (LayerVisible[ActiveLayerIndex]==1)) || (canSelectInvisible)) {
		if ((selectCount>0) && (showSelectedFeatures)) {
			selString +='<LAYER type="featureclass" name="Selected Features" visible="true">\n';
			//selString +='<DATASET fromlayer="' + ActiveLayer + '" />\n';
			selString +='<DATASET fromlayer="' + LayerID[ActiveLayerIndex] + '" />\n';
			if (selectionMode==1) {
				selString +='<SPATIALQUERY  where="' + setQueryString + '"';
				if (useLimitExtent) {
					// keep this within the limitExtent
					
					selString +='>\n<SPATIALFILTER relation="area_intersection">\n';
					selString +='<ENVELOPE maxx="' + forceComma(limitRight) + '" maxy="' + forceComma(limitTop) + '" minx="' + forceComma(limitLeft) + '" miny="' + forceComma(limitBottom) + '" />\n';
					selString +='</SPATIALFILTER>\n';
					selString +='</SPATIALQUERY>\n';
				} else {
				selString +='/>\n';
				}
			
			} else {
				selString +='<SPATIALQUERY>\n';
				selString +='<SPATIALFILTER relation="area_intersection" >\n';
				if (selectionMode==2) {
					selString +='<ENVELOPE ' + selectEnvelope + ' />\n';
				} else {
					if ((shapeSelectBuffer) && (shapeBufferDistance>0)) {
					//if (shapeBufferDistance>0) {
						// do a buffer around the shape before selecting
						
						selString += '<BUFFER distance="' + forceComma(shapeBufferDistance) + '" ';
						
						selString += ' bufferunits="' + ScaleBarUnits + '"';
						selString += ' />\n';
					}
					if (clickType==2) {
						selString +='<POLYLINE>\n<PATH>\n';
					} else if (clickType==3) {
						selString +='<POLYGON>\n<RING>\n';
					} else {
						selString +='<MULTIPOINT>\n';
					}
					if (clickType==1) {
						selString +='<POINT x="' + clickPointX[clickCount-1] + '" y="' + clickPointY[clickCount-1] + '" />\n';
					} else {
						for (var i=0;i<clickCount;i++) {
							selString +='<POINT x="' + clickPointX[i] + '" y="' + clickPointY[i] + '" />\n'; 
						}
					}
					if (clickType==3) {
						//selString +='<POINT x="' + clickPointX[0] + '" y="' + clickPointY[0] + '" />\n';
						selString +='</RING>\n</POLYGON>\n';
					} else if (clickType==2) {
						selString +='</PATH>\n</POLYLINE>\n';
					} else {
						selString +='</MULTIPOINT>\n';
					}
				}
				selString +='</SPATIALFILTER>\n';
				///*
				if (useLimitExtent) {
					// keep this within the limitExtent
					selString +='<SPATIALFILTER relation="area_intersection">\n';
					selString +='<ENVELOPE maxx="' + forceComma(limitRight) + '" maxy="' + forceComma(limitTop) + '" minx="' + forceComma(limitLeft) + '" miny="' + forceComma(limitBottom) + '" />\n';
					selString +='</SPATIALFILTER>\n';
				} 
				//*/
				selString +='</SPATIALQUERY>\n';
			}
			selString +='<SIMPLERENDERER>\n';
		
			if (selectType=="point") {
				selString +='<SIMPLEMARKERSYMBOL color="' + selectColor + '" type="Circle" width="10" />\n';
			} else if (selectType=="line") {
				selString +='<SIMPLELINESYMBOL type="SOLID" color="' + selectColor + '" width="3" />\n';
			} else {
				//selString +='<SIMPLEPOLYGONSYMBOL FILLCOLOR="' + selectColor + '" FILLTYPE="Gray" ';
				selString +='<SIMPLEPOLYGONSYMBOL fillcolor="' + selectColor + '" filltype="solid" transparency="' + forceComma(transparentLevel) + '" boundarycolor="255,255,255" />\n';
			}
			selString +='</SIMPLERENDERER>\n';
			selString +='</LAYER>\n';
			
		
		}
		
		
		if (selectBlurb!="") {
			// add SelectBlurb to Map XML request
			selString +='<LAYER type="featureclass" name="Selected Features" visible="true">\n';
			//selString +='<DATASET fromlayer="' + ActiveLayer + '" />\n';
			selString +='<DATASET fromlayer="' + LayerID[ActiveLayerIndex] + '" />\n';
			selString +='<QUERY where="' + selectBlurb + '" />\n';
			selString +='<SIMPLERENDERER>\n';
		
			if (selectType=="point") {
				selString +='<SIMPLEMARKERSYMBOL color="' + selectColor + '" type="Circle" width="10" />\n';
			} else if (selectType=="line") {
				selString +='<SIMPLELINESYMBOL type="SOLID" color="' + selectColor + '" width="3" />\n';
			} else {
				selString +='<SIMPLEPOLYGONSYMBOL fillcolor="' + selectColor + '" filltype="solid" transparency="' + forceComma(transparentLevel) + '" boundarycolor="255,255,255" />\n';
				}
			selString +='</SIMPLERENDERER>\n';
			selString +='</LAYER>\n';
		
		}
		
		if (highlightedOne!="") {
			// add Draw Highlighed Feature to Map XML request
			selString +='<LAYER type="featureclass" name="Highlighted Feature" visible="true">\n';
			//selString +='<DATASET fromlayer="' + ActiveLayer + '" />\n';
			selString +='<DATASET fromlayer="' + LayerID[ActiveLayerIndex] + '" />\n';
			selString +='<QUERY where="' + highlightedOne + '" />\n';
			selString +='<SIMPLERENDERER>\n';
		
			if (selectType=="point") {
				selString +='<SIMPLEMARKERSYMBOL color="' + highlightColor + '" type="Circle" width="10" />\n';
			} else if (selectType=="line") {
				selString +='<SIMPLELINESYMBOL type="SOLID" color="' + highlightColor + '" width="3" />\n';
			} else {
				//selString +='<SIMPLEPOLYGONSYMBOL FILLCOLOR="' + highlightColor + '" FILLTYPE="Gray" ';
				selString +='<SIMPLEPOLYGONSYMBOL fillcolor="' + highlightColor + '" filltype="solid" transparency="' + forceComma(transparentLevel) + '" boundarycolor="255,255,255" />\n';
			}
			selString +='</SIMPLERENDERER>\n';
			selString +='</LAYER>\n';
			//alert(selString);
		}	
	}
	return selString;
}

⌨️ 快捷键说明

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