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

📄 fullextentcommand.java

📁 esri的ArcGIS Server超级学习模板程序(for java)
💻 JAVA
字号:
package com.esri.solutions.jitk.commands;

import org.apache.log4j.LogManager;
import org.apache.log4j.Logger;

import com.esri.adf.web.data.WebContext;
import com.esri.adf.web.data.WebMap;
import com.esri.adf.web.data.geometry.WebExtent;

public class FullExtentCommand {
	private static final Logger _logger = LogManager.getLogger(FullExtentCommand.class);
	private WebContext _wContext = null;

	public void fullExtent() {
		if (_logger.isDebugEnabled()) {
			_logger.debug("Full Extent command initiated");
		}
		
		WebContext wContext = getWebContext();
		WebMap webMap = wContext.getWebMap();
		WebExtent fullExt = webMap.getFullExtent();
		com.esri.solutions.jitk.web.data.geometry.WebExtent newExtent = null;
		
		try {
			//The full extent must be adjusted to fit in the aspect ration of the 
			//map control. If this is not done, the ADF will extend the extent 
			//beyond where map data exists. This could extent the extent beyond the 
			//supported horizon of the coordinate system the map is in.
			newExtent = new com.esri.solutions.jitk.web.data.geometry.WebExtent(fullExt);
			newExtent = newExtent.getAdjustedExtent(webMap.getWidth(), webMap.getHeight());
			
			if (_logger.isDebugEnabled()) {
				_logger.debug("Full Extent " + fullExt + " adjusted to " + newExtent + " due to map aspect ratio");
			}
		} catch (Exception ex) {
			_logger.error("Could not adjust full extent to map aspect ration", ex);
			newExtent = new com.esri.solutions.jitk.web.data.geometry.WebExtent(webMap.getFullExtent());
		}
		
		webMap.setCurrentExtent(newExtent);
		wContext.refresh();
	}

	public final WebContext getWebContext() {
		return _wContext;
	}

	public final void setWebContext(WebContext webContext) {
		this._wContext = webContext;
	}
	
}

⌨️ 快捷键说明

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