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

📄 aimsmap.js

📁 arcmis是webgis网站的掩码
💻 JS
📖 第 1 页 / 共 2 页
字号:
// aimsMap.js
/*
*  JavaScript template file for ArcIMS HTML Viewer
*		dependent on aimsXML.js, ArcIMSparam.js, aimsCommon.js
*/

aimsMapPresent=true;

// global variables
	// show xml responses
var debugOn = 0;
  // can debug be toggled?
var setDebug = true;

var useLimitExtent=false;
var getStartingExtent=true;
var getLimitExtent=true;
var enforceFullExtent=false;

// map extents. . . dynamically updated
var eLeft = -180.0;
var eRight = 180.0;
var eTop = 90.0;
var eBottom = -90.0;
var fullLeft = eLeft;
var fullRight = eRight;
var fullTop = eTop;
var fullBottom = eBottom;

// map size . . . dynamically updated
var iWidth = 630;
var iHeight = 512;
// location map size . . . dynamically updated
var i2Width = 150;
var i2Height = 120;

var imageLimitLeft = limitLeft;
var imageLimitTop = limitTop;
var imageLimitRight = limitRight;
var imageLimitBottom = limitBottom;

var appDir = "";

var xDistance = Math.abs(eRight-eLeft);
var yDistance = Math.abs(eTop-eBottom);
var panX = xDistance * panFactor;
var panY = yDistance * panFactor;
var pixelX = xDistance/iWidth;
var pixelY = yDistance/iHeight;
var mapX = eLeft;
var mapY = eTop;
var lastLeft = eLeft;
var lastRight = eRight;
var lastTop = eTop;
var lastBottom = eBottom;
var fullOVLeft = eLeft;
var fullOVRight = eRight;
var fullOVTop = eTop;
var fullOVBottom = eBottom;
var theCursor = "crosshair";
var canLoad=false;
//if (imsURL!="") canLoad=false;

var fullWidth = Math.abs(fullRight - fullLeft);
var fullHeight = Math.abs(fullTop - fullBottom);
var fullOVWidth = Math.abs(fullOVRight - fullOVLeft);
var fullOVHeight = Math.abs(fullOVTop - fullOVBottom);
var mapScaleFactor = xDistance / iWidth;

var geocodeX = 0;
var geocodeY = 0;
var showGeocode = false;
var geocodeLabel = "";

var queryZoom=false;

var sQuote = "'";
var dQuote = '"';

var toolMode = 1;
var legendVisible=false;
// set legend visible at service load... showTOC=false & hasTOC=true
if ((hasTOC) && (!showTOC)) legendVisible=true;

MapUnits = MapUnits.toUpperCase();
ScaleBarUnits = ScaleBarUnits.toUpperCase();
if (drawScaleBar2) {
	switch (ScaleBarUnits) {
		case "MILES":
			ScaleBar2Units = "KILOMETERS";
			break;
		case "KILOMETERS":
			ScaleBar2Units = "MILES";
			break;
		case "FEET":
			ScaleBar2Units = "METERS";
			break;
		case "METERS":
			ScaleBar2Units = "FEET";
			break;
		
	}
}


// save the extent 
function saveLastExtent() {
	lastLeft = eLeft;
	lastRight = eRight;
	lastTop = eTop;
	lastBottom = eBottom;
}

// zoom out to full extent
function fullExtent() {
	if (aimsDHTMLPresent) moveLayer("theMap",hspc,vspc);
	window.scrollTo(0,0);
	saveLastExtent();
	eLeft = fullLeft;
	eRight = fullRight;
	eTop = fullTop;
	eBottom = fullBottom;
	//var theString = writeXML();
	sendMapXML();
}

function startExtent() {
	if (aimsDHTMLPresent) moveLayer("theMap",hspc,vspc);
	window.scrollTo(0,0);
	saveLastExtent();
	eLeft = startLeft;
	eRight = startRight;
	eTop = startTop;
	eBottom = startBottom;
	//var theString = writeXML();
	sendMapXML();
}

// zoom back to last extent
function zoomBack() {
	if (aimsDHTMLPresent) moveLayer("theMap",hspc,vspc);
	var left1 = eLeft;
	var right1 = eRight;
	var top1 = eTop;
	var bottom1 = eBottom;
	eLeft = lastLeft;
	eRight = lastRight;
	eTop = lastTop;
	eBottom = lastBottom;
	lastLeft = left1;
	lastRight = right1;
	lastTop = top1;
	lastBottom = bottom1;
	//var theString = writeXML();
	sendMapXML();	
}

function zoomToPoint(xIn, yIn, drawIt,theLabel) {
	//alert(xIn + "," + yIn); 
	var mWMargin = 0;
	var mHMargin = 0;
	mWMargin = Math.abs(limitRight-limitLeft) * selectPointMargin;
	mHMargin = Math.abs(limitTop-limitBottom) * selectPointMargin;
	var xNum = parseFloat(xIn);
	var yNum = parseFloat(yIn);
	saveLastExtent();
	eLeft = xNum - mWMargin;
	eRight = xNum + mWMargin;
	eTop = yNum + mHMargin;
	eBottom = yNum - mHMargin;
	if (drawIt) {
		showGeocode=true;
		geocodeX=xNum;
		geocodeY=yNum;
		geocodeLabel=theLabel;
	}
	sendMapXML();
}

function zoomToEnvelope(minXin,minYin,maxXin,maxYin) {
	saveLastExtent();
	eLeft=minXin;
	eBottom=minYin;
	eRight=maxXin;
	eTop=maxYin;
	checkFullExtent();
	sendMapXML()
	
}

// zoom to center of fullextent at set scale
function zoomScale(inScale) {
	// inScale is scale factor where 1.0 = 100% of fullWidth and fullHeight
	var halfWidth = fullWidth / 2;
	var halfHeight = fullHeight / 2
	var midX = eRight - (xDistance / 2);
	var midY = eTop - (yDistance / 2);
	var newWidth = halfWidth * inScale;
	var newHeight = halfHeight * inScale;
	saveLastExtent();
	eLeft = midX - newWidth;
	eRight = midX + newWidth;
	eTop = midY + newHeight;
	eBottom = midY - newHeight;
	sendMapXML();
	
}

// get URLs and extents from URL
function getCommandLineParams(cmdString) {
	// Parse out from URL querystring parameters 
	// to pass to the viewer.
	// Syntax:
	// Host=Hostmachine					name of Host, if not default
	// Service=MapService				name of MapService, if not default
	// OVMap=OvMapService				name of Overview MapService, if not default
	// Box=minX:minY:maxX:maxY			extent to be displayed
	// Layers=0101101					visible layers,starting from topmost: 0=not visible;1=visible
	// ActiveLayer=layerIndex			index of layer to be active, if not default
	// Query=queryExpression			query expression to be send on load - expression must be escaped in URL
	// QueryZoom=Yes					zoom to above query?
	// StartLeft,StartTop,
	// StartRight,StartBottom			starting coords - alternative to Box
	// LimitLeft,LimitTop,
	// LimitRight,LimitBottom			limit coords
	// DebugOn=Yes						Show all requests, responses						
	//
	setLayerVisible.length=0;
	var cmdString2 = cmdString.toUpperCase();
	var startpos = 0;
	var endpos = 0;
	var pos = cmdString2.indexOf("HOST=");
	if (pos!=-1) {
		startpos = pos + 5;
		endpos = cmdString.indexOf("&",startpos);
		if (endpos==-1) endpos = cmdString.length;
		hostName = cmdString.substring(startpos,endpos);
		serverURL  = "http://" + hostName + "/servlet/com.esri.esrimap.Esrimap?ServiceName=";
	}
	pos = cmdString2.indexOf("SERVICE="); // formally was MAPSERVICE=
	if (pos!=-1) {
		startpos = pos + 8;
		endpos = cmdString.indexOf("&",startpos);
		if (endpos==-1) endpos = cmdString.length;
		imsURL = serverURL + cmdString.substring(startpos,endpos);
	}
	pos = cmdString2.indexOf("OVMAP="); // formally was OVMAPSERVICE=
	if (pos!=-1) {
		startpos = pos + 6;
		endpos = cmdString.indexOf("&",startpos);
		if (endpos==-1) endpos = cmdString.length;
		imsOVURL = serverURL + cmdString.substring(startpos,endpos);
	}
	pos = cmdString2.indexOf("BOX=");
	if (pos!=-1) {
		startpos = pos + 4;
		endpos = cmdString.indexOf("&",startpos);
		if (endpos==-1) endpos = cmdString.length;
		var boxString = cmdString.substring(startpos,endpos);
		//alert(boxString);
		var xyBox = boxString.split(":");
		if (xyBox.length==4) {
			startLeft = parseFloat(xyBox[0]);
			startBottom = parseFloat(xyBox[1]);
			startRight = parseFloat(xyBox[2]);
			startTop = parseFloat(xyBox[3]);
			eLeft=startLeft;
			eBottom=startBottom;
			eRight=startRight;
			eTop = startTop;
		}
		//xyBox=null;
	}
	pos = cmdString2.indexOf("MAXRECT=");
	if (pos!=-1) {
		startpos = pos + 8;
		endpos = cmdString.indexOf("&",startpos);
		if (endpos==-1) endpos = cmdString.length;
		var boxString = cmdString.substring(startpos,endpos);
		//alert(boxString);
		var xyBox = boxString.split(":");
		if (xyBox.length==4) {
			limitLeft = xyBox[0];
			limitBottom = xyBox[1];
			limitRight = xyBox[2];
			limitTop = xyBox[3];
		}
		//xyBox=null;
	}
	if (aimsLayersPresent) {
		// you need to have aimsLayers.js loaded
		pos = cmdString2.indexOf("LAYERS=");
		if (pos!=-1) {
			startpos = pos + 7;
			endpos = cmdString.indexOf("&",startpos);
			if (endpos==-1) endpos = cmdString.length;
			var layers = cmdString.substring(startpos,endpos);
			//"0" means the layer should be turned off, and "1" means
			//the layer should be visible.  For example, "1001" means there
			//are 4 layers.  The first and last layer are visible, and the
			//middle two layers are turned off. The first number represents
			//the top-most layer.
			
			//Parse the layers string
			var numLayers=layers.length;
			icount=0;
			//alert(layers);
			while (icount<=numLayers-1) {
			  onoff=layers.substring(icount,icount+1);
			  if (onoff=='0') {
			  	setLayerVisible[icount]=false;
			  }
			  else if (onoff=='1') {
			    setLayerVisible[icount]=true;
			  }
			  icount=icount+1;
			}
			layers="";
		}
		
		pos = cmdString2.indexOf("ACTIVELAYER=");
		if (pos!=-1) {
			startpos = pos + 12;
			endpos = cmdString.indexOf("&",startpos);
			if (endpos==-1) endpos = cmdString.length;
			var actlyr = cmdString.substring(startpos,endpos);
			//alert(actlyr);
			ActiveLayerIndex = parseInt(actlyr);
			//selectType = LayerType[ActiveLayerIndex];	
			actlyr = "";
		}	
		if (aimsQueryPresent) {
			// you need to have aimsQuery.js loaded
			pos = cmdString2.indexOf("QUERY=");
			if (pos!=-1) {
				startpos = pos + 6;
				endpos = cmdString.indexOf("&",startpos);
				if (endpos==-1) endpos = cmdString.length;
				var escQuery = cmdString.substring(startpos,endpos);
				escQuery = replacePlus(escQuery);
				escQuery = unescape(escQuery);
				highlightedOne = makeXMLsafe(escQuery);
				escQuery="";
			}	
			if (highlightedOne!="") {
				pos = cmdString2.indexOf("QUERYZOOM=YES");
				if (pos!=-1) queryZoom = true;
			}
		}
	}
	
	pos = cmdString2.indexOf("STARTLEFT=");
	if (pos!=-1) {
		startpos = pos + 10;
		endpos = cmdString.indexOf("&",startpos);
		if (endpos==-1) endpos = cmdString.length;
		startLeft = cmdString.substring(startpos,endpos);
	}
	pos = cmdString2.indexOf("STARTTOP=");
	if (pos!=-1) {
		startpos = pos + 9;
		endpos = cmdString.indexOf("&",startpos);
		if (endpos==-1) endpos = cmdString.length;
		startTop = cmdString.substring(startpos,endpos);
	}
	pos = cmdString2.indexOf("STARTRIGHT=");
	if (pos!=-1) {
		startpos = pos + 11;
		endpos = cmdString.indexOf("&",startpos);
		if (endpos==-1) endpos = cmdString.length;
		startRight = cmdString.substring(startpos,endpos);
	}
	pos = cmdString2.indexOf("STARTBOTTOM=");
	if (pos!=-1) {
		startpos = pos + 12;
		endpos = cmdString.indexOf("&",startpos);
		if (endpos==-1) endpos = cmdString.length;
		startBottom = cmdString.substring(startpos,endpos);
	}
	pos = cmdString2.indexOf("LIMITLEFT=");
	if (pos!=-1) {
		startpos = pos + 10;
		endpos = cmdString.indexOf("&",startpos);
		if (endpos==-1) endpos = cmdString.length;
		limitLeft = cmdString.substring(startpos,endpos);
	}
	pos = cmdString2.indexOf("LIMITTOP=");
	if (pos!=-1) {
		startpos = pos + 9;
		endpos = cmdString.indexOf("&",startpos);
		if (endpos==-1) endpos = cmdString.length;
		limitTop = cmdString.substring(startpos,endpos);
	}
	pos = cmdString2.indexOf("LIMITRIGHT=");
	if (pos!=-1) {
		startpos = pos + 11;
		endpos = cmdString.indexOf("&",startpos);
		if (endpos==-1) endpos = cmdString.length;
		limitRight = cmdString.substring(startpos,endpos);
	}
	pos = cmdString2.indexOf("LIMITBOTTOM=");
	if (pos!=-1) {
		startpos = pos + 12;
		endpos = cmdString.indexOf("&",startpos);

⌨️ 快捷键说明

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