亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频

? 歡迎來到蟲蟲下載站! | ?? 資源下載 ?? 資源專輯 ?? 關(guān)于我們
? 蟲蟲下載站

?? mapperservlet.java

?? 利用mapxtreme java的實現(xiàn)的WebGis
?? JAVA
字號:
import javax.servlet.*;
import javax.servlet.http.*;
import java.awt.Color;
import java.io.*;
import java.util.*;

// Needed in this servlet for MapJ support
import java.net.Socket;

// MapInfo classes
import com.mapinfo.mapj.*;
import com.mapinfo.util.*;
import com.mapinfo.unit.LinearUnit;
import com.mapinfo.mapxtreme.client.*;
import com.mapinfo.xmlprot.mxtj.ImageRequestComposer;

/**
 * This is a simple example of an HTTP Map Servlet that extends the HttpServlet
 * class and contains MapJ objects.  This servlet is designed to send
 * map images down to an applet (MapperClientApplet.java). 
 *
 * @see javax.servlet.http.HttpServlet , com.mapinfo.mapj.MapJ
 */
public class MapperServlet extends HttpServlet
{
	// TODO: Specify the physical path to the directory containing maps.
	// Or you can specify this value using an init parameter called 'mappath'.
	// Include a path separator at the end.
	private static String m_mapPath = "C:\\mapxtreme\\maps\\";

	// TODO: Specify the path & name of desired map definition to load.
	// Or you can specify this value using an init parameter called 'filetoload'.
	private static String m_fileToLoad = "c:\\data\\world.mdf";

	// TODO: Specify the URL of the MapXtremeServlet that will
	// service our mapping requests.
	// Or you can specify this value using an init parameter called 'mapxtremeurl'.
	private static String m_mxtURL =
		"http://localhost:8080/mapxtreme45/servlet/mapxtreme";

	// TODO (optional): Set m_debug to true if you want error messages to include
	// debugging information, or false otherwise.  Or you can set this variable
	// by setting a 'debug' init parameter to 'true'.
	private boolean m_debug = false;

	// TODO (optional): Set m_mapWidth & m_mapHeight to some initial value.
	// Or you can set this variable by setting 'mapwidth' and 'mapheight'.
	// NOTE: If you change the map dimensions, you may also want to change
	// the applet width and height settings, which are specified in the
	// HTML page that loads the applet (e.g. RunApplet.html). 
	// init parameters
	private int m_mapWidth = 500;
	private int m_mapHeight = 350;

	// Tools
	private final int NO_TOOL = 0;
	private final int ZOOM_IN_TOOL = 1;
	private final int ZOOM_OUT_TOOL = 2;
	private final int PAN_TOOL = 3;

	// Define constants to control various rendering options
	public static final int NUM_OF_COLORS = 256;
	public static final Color BACKGROUND_COLOR = Color.blue;

	/**
	* This method initializes the servlet and then reads and sets
	* initialization parameters
	*
	* @param config ServletConfig servlet initialization parameter
	*
	* @see com.mapinfo.mapj.MapJ
	*
	* @exception ServletException if detected when handling the request
	*/
	public void init(ServletConfig config)
	throws ServletException
	{
		super.init(config);

		// If the servlet set-up has provided initialization parameters,
		// use those parameters to override the hard-coded values
		// declared above.
		String strParam = getInitParameter("mappath");
		if (strParam != null) {
			m_mapPath = strParam;
		}

		strParam = getInitParameter("filetoload");
		if (strParam != null) {
			m_fileToLoad = strParam;
		}

		strParam = getInitParameter("mapxtremeurl");
		if (strParam != null  &&  strParam.length() > 0) {
			m_mxtURL = strParam;
		}

		strParam = getInitParameter("mapwidth");
		if (strParam != null) {
			m_mapWidth = Integer.valueOf(strParam).intValue();
		}

		strParam = getInitParameter("mapheight");
		if (strParam != null) {
			m_mapHeight = Integer.valueOf(strParam).intValue();
		}

		strParam = getInitParameter("debug");
		if (strParam != null  &&  strParam.equalsIgnoreCase("true") ) {
			m_debug = true;
		}
	}

	/**
	 *  service  -- handle both GET and POST requests.
	 *
	 * @param req HttpServletRequest that encapsulates the request to
	 * the servlet
	 * @param resp HttpServletResponse that encapsulates the response
	 * from the servlet
	 *
	 * @exception IOException if detected when handling the request
	 * @exception ServletException if the request could not be handled
	*/
	public void service (HttpServletRequest req, HttpServletResponse res)
	throws ServletException, IOException
	{
		// Get the session object
		HttpSession session = req.getSession(true);
		if (req.getParameter("init") != null)
		{
			res.setContentType("text/html");
			PrintWriter out = new PrintWriter(res.getOutputStream());
			String thisServletName = HttpUtils.getRequestURL(req).toString();
			
			// Note: if using Servlet API 2.0, you must use the encodeUrl method.
			// For later APIs, use encodeURL instead.
			out.println(res.encodeURL(thisServletName));
			out.close();
		}
		else
		{
			if (m_debug)
			{
				debugSession(req, session);
			}
			// Draw the map and encode the URL
			try
			{
				renderMap(session, req, res);
			}
			catch (ServletException se)
			{
				log(se.getMessage());
				throw se;
			}
			catch (IOException ioe)
			{
				log(ioe.getMessage());
				throw ioe;
			}
			// only handle errors the map generation process caused
			catch (Exception e)
			{
				log(e.getMessage());
			}
		}
	}

	/**
	 *  This method returns an About string for this servlet
	 */
	public String getServletInfo()
	{
		return "A simple Map servlet";
	}

	/**
	 *  This establishes communications with the MapXtreme Java
	 *  servlet and then loads the map definition. A fully initialized MapJ
	 *  object is returned.
	 */
	public MapJ initMapJ()	throws Exception
	{
		// instantiate a MapJ and set the bounds
		MapJ myMap = new MapJ();    // this MapJ object
		myMap.setDeviceBounds(new DoubleRect(0, 0, m_mapWidth, m_mapHeight));

		// Query for image locations and load the geoset
		try
		{
			if (m_fileToLoad.endsWith(".gst"))
			{
				myMap.loadGeoset(m_fileToLoad, m_mapPath, null);
			}
			else {
				myMap.loadMapDefinition(m_fileToLoad); 
			}
		}
		catch(Exception e)
		{
			log("Can't load geoset: " + m_fileToLoad + "\n");
			throw e;
		}
		return myMap;
	}

	/**
		* This method sets previous state information, checks if any map
		* tools were used, resets the map extents if necessary, renders the map
		* and renders the map and then finally encodes the output HTML with a
		* link to the rendered gif file.
		*
		* @param session HttpSession session info for this client
		* @param req HttpServletRequest that encapsulates the request to
		* the servlet
		* @param resp HttpServletResponse that encapsulates the response
		* from the servlet
		*
		* @see javax.servlet.http.HttpSession
		* @see com.mapinfo.util , com.mapinfo.mapj.MapJ , com.mapinfo.util.graphics
		*/
	private void renderMap(HttpSession session,HttpServletRequest req,
				HttpServletResponse res)
	throws Exception
	{
		String reqParam;                   // to hold request parameter
		Double xStr = null;                // to hold x request params
		Double yStr = null;                // to hold y request params

		int tool = NO_TOOL;                // Zoom In, Out or Pan

		// Try to retrieve the user's previous MapJ object.
		MapJ myMap = (MapJ) session.getAttribute("mapinfo.mapj");
		if (myMap == null) {
			// This is probably the user's first time requesting a map.
			myMap = initMapJ();
		}

		// Check to see if which tool, if any, was set
		if ((reqParam = req.getParameter("tool"))!=null) {
			tool = Integer.valueOf(reqParam).intValue();
		}

		// Tool used, so transform map accordingly
		if (tool != NO_TOOL)
		{
			// Get the previous center point locations
			DoublePoint newpoint = myMap.getCenter();
			if ((reqParam = req.getParameter("ptx"))!=null) {
				xStr = new Double(reqParam);
			}
			if ((reqParam = req.getParameter("pty"))!=null) {
				yStr = new Double(reqParam);
			}
			if (xStr != null && yStr != null)
			{
				// Transform GIF coordinate to real world coordinate
				DoublePoint screenpoint = new DoublePoint(xStr.doubleValue(),
												  yStr.doubleValue());
				newpoint = myMap.transformScreenToNumeric(screenpoint);
			}

			double newZoom = myMap.getZoom();
			if (tool == ZOOM_IN_TOOL) {
				newZoom /= 2.0;
			}
			else if (tool == ZOOM_OUT_TOOL) {
				newZoom *= 2.0;
			}

			if (m_debug) {
				log("tool: " + tool + "  setting zoom to: " + newZoom + " at: " + newpoint);
			}

			// Reset the bounding rectangle, note - Pan handled by default
			myMap.setZoomAndCenter(newZoom, newpoint);
		} // End if tool used

		// Set up the renderer for this mapJ
		try 
		{
			MapXtremeImageRenderer rr = new MapXtremeImageRenderer(m_mxtURL);
			rr.render(ImageRequestComposer.create(
					myMap, NUM_OF_COLORS, BACKGROUND_COLOR, "image/gif"));

			//Output the map
			rr.toStream(res.getOutputStream());
		}
		catch(Exception e)
		{
			log(e.getMessage());
			throw e;
		}

		// Save state info for next time around
		session.setAttribute("mapinfo.mapj", myMap);
	}

	/**
	 * This method will output state information for this servlet client request
	 *
	 * @param req HttpServletRequest that encapsulates the request to
	 * the servlet
	 * @param resp HttpServletResponse that encapsulates the response
	 * from the servlet
	 */
	private void debugSession(HttpServletRequest req,
			HttpSession session)
	{
		log("Request and Session Data:");
		log("Session ID in Request: " + req.getRequestedSessionId());
		log("Session ID in Request from Cookie: " +
					req.isRequestedSessionIdFromCookie());
		
		// If using Servlet API 2.0, you must use the isRequestedSessionIdFromUrl 
		// method.	For later APIs, use isRequestedSessionIdFromURL instead. 
		log("Session ID in Request from URL: " +
					req.isRequestedSessionIdFromURL());
		log("Valid Session ID: " + req.isRequestedSessionIdValid());
		log("Session Data:");
		log("New Session: " + session.isNew());
		log("Session ID: " + session.getId());
		log("Creation Time: " + session.getCreationTime());
		log("Last Accessed Time: " + session.getLastAccessedTime());
	}
}

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
老司机午夜精品| 久久99国产精品免费| 亚洲一区在线看| 亚洲bt欧美bt精品| 激情伊人五月天久久综合| 国产精品一区在线| 97久久超碰国产精品电影| 欧美剧情片在线观看| 精品区一区二区| 国产精品二三区| 日韩av在线播放中文字幕| 美洲天堂一区二卡三卡四卡视频| 国产一区二区视频在线播放| 日韩天堂在线观看| 亚洲精品欧美专区| 国产99久久久久久免费看农村| 色综合视频一区二区三区高清| 日韩欧美中文字幕一区| 亚洲欧美福利一区二区| 韩日av一区二区| 欧美精品三级在线观看| 亚洲免费在线视频一区 二区| 国产在线不卡一卡二卡三卡四卡| 欧美伊人久久久久久午夜久久久久| 久久精品一二三| 麻豆一区二区99久久久久| 欧美午夜免费电影| 亚洲一区二区三区小说| 欧美一区二区三区在线视频| 亚洲乱码精品一二三四区日韩在线| 日韩欧美国产综合一区| 国产精品乱码人人做人人爱| 国产精品网站在线| 国产精品污网站| 亚洲va欧美va国产va天堂影院| 亚洲高清免费观看| 成人精品视频.| 国产精品―色哟哟| 91美女在线视频| 亚洲午夜免费视频| 欧美乱熟臀69xxxxxx| 亚洲伊人色欲综合网| 日本韩国一区二区三区视频| 亚洲精品水蜜桃| 欧美日韩亚洲综合在线| 免费久久精品视频| 2020国产精品自拍| 成人国产一区二区三区精品| 中文字幕佐山爱一区二区免费| 一本色道亚洲精品aⅴ| 亚欧色一区w666天堂| 欧美大尺度电影在线| 成人av片在线观看| 亚洲成人精品一区| 国产午夜久久久久| 在线视频综合导航| 激情欧美一区二区| 一个色妞综合视频在线观看| 日韩欧美精品在线| 在线区一区二视频| 国产成人亚洲综合a∨猫咪 | 国产欧美精品一区| 制服丝袜中文字幕亚洲| av电影天堂一区二区在线| 蜜桃av噜噜一区二区三区小说| 中文字幕免费一区| 日韩欧美一区电影| 在线中文字幕一区| 国产成人精品免费网站| 麻豆成人久久精品二区三区小说| 亚洲欧美日本韩国| 国产亚洲午夜高清国产拍精品| 欧美日韩成人综合在线一区二区| 成人av资源下载| 国产ts人妖一区二区| 国产激情精品久久久第一区二区| 亚洲mv在线观看| 亚洲高清免费视频| 亚洲国产美女搞黄色| 亚洲黄色性网站| 亚洲午夜一区二区三区| 亚洲一区二区三区在线播放| 一区二区三区中文在线| 亚洲欧美视频在线观看| 亚洲欧美日韩小说| 亚洲成人av一区二区| 日本系列欧美系列| 韩国精品在线观看| 成人免费高清在线观看| 色美美综合视频| 成人黄动漫网站免费app| 91在线视频观看| 欧美日本国产视频| 久久九九影视网| 亚洲黄一区二区三区| 精品中文字幕一区二区小辣椒| 日韩精品一二三区| 成人av网站免费观看| 欧美日韩国产首页在线观看| 欧美精品一区二| 一级特黄大欧美久久久| 久久精品国产秦先生| 91视频在线观看免费| 91麻豆精品国产91久久久更新时间| 精品成人私密视频| 亚洲裸体xxx| 国产jizzjizz一区二区| 欧美日韩电影一区| 18成人在线视频| 国内精品免费**视频| 欧美丝袜自拍制服另类| 欧美激情中文字幕一区二区| 日日夜夜精品免费视频| 91小视频免费观看| 欧美国产日韩在线观看| 蜜臀av一区二区三区| 9191国产精品| 日日摸夜夜添夜夜添亚洲女人| heyzo一本久久综合| 国产精品私房写真福利视频| 久久99热狠狠色一区二区| 777色狠狠一区二区三区| 一区二区免费视频| av午夜一区麻豆| 亚洲女爱视频在线| 欧美午夜精品理论片a级按摩| 亚洲少妇屁股交4| 欧美性感一区二区三区| 亚洲一区二区四区蜜桃| 欧美日韩久久不卡| 奇米一区二区三区| 久久综合狠狠综合久久激情| 国产一区二区中文字幕| 国产精品女主播av| 在线亚洲人成电影网站色www| 亚洲女爱视频在线| 制服视频三区第一页精品| 蜜桃视频在线一区| 亚洲午夜久久久久中文字幕久| 99久久777色| 老汉av免费一区二区三区| 久久久久88色偷偷免费| av不卡在线播放| 日韩avvvv在线播放| 久久久久久久久久久久电影| 成人美女视频在线观看18| 亚洲一区二区三区影院| 精品国内片67194| 欧美在线制服丝袜| 黄一区二区三区| 偷窥国产亚洲免费视频| 国产精品素人一区二区| 欧美一区二区在线免费播放| www.亚洲精品| 国产精品一区二区你懂的| 午夜欧美视频在线观看| 国产精品国产自产拍高清av王其| 精品成人佐山爱一区二区| 2022国产精品视频| 国产欧美综合在线| 亚洲国产视频a| 国产一区二区福利| 成人av免费观看| 欧美变态凌虐bdsm| 久久久久国产一区二区三区四区| 日韩精品中文字幕在线不卡尤物| 日韩精品一区二区三区四区| 国产人久久人人人人爽| 亚洲综合丁香婷婷六月香| 男女男精品网站| 懂色一区二区三区免费观看| 一本大道av伊人久久综合| 欧美精品1区2区3区| 欧美激情综合五月色丁香小说| 日韩精品欧美成人高清一区二区| 亚洲成人资源在线| 国产成人鲁色资源国产91色综| 在线观看不卡视频| 日本一区二区三区久久久久久久久不| 亚洲激情成人在线| 韩国v欧美v日本v亚洲v| aaa欧美日韩| 久久久精品免费观看| 亚洲一区二区三区不卡国产欧美 | 制服丝袜亚洲色图| 亚洲天堂久久久久久久| 国产麻豆精品久久一二三| 欧美自拍偷拍一区| 久久综合色一综合色88| 亚洲午夜精品久久久久久久久| 国产精品一色哟哟哟| 欧美猛男gaygay网站| 欧美国产欧美综合| 国产综合色产在线精品| 91.xcao| 亚洲电影视频在线| 日本精品视频一区二区三区| 国产精品乱人伦一区二区| 成人动漫视频在线| 国产欧美日韩在线看|