<clk></clk>arcIMS的客户端<nobr oncontextmenu="return false;" onmousemove="kwM(1);" id="clickeyekey1" onmouseover="kwE(event,1, this);" style="COLOR: #6600ff; BORDER-BOTTOM: #6600ff 1px dotted; BACKGROUND-COLOR: transparent; TEXT-DECORATION: underline" onclick="return kwC(event,1)" onmouseout="kwL(event, this);" target="_1">开发</nobr>模式分HTML Viewer和Java Viewer两种,Java Viewer由于需要在客户端安装JRE,在webGIS开发中已经被一棒打死。而arcIMS提供的HTML Viewer中,大量处理地图的代码都是用JavaScript编写,界面代码和业务处理代码大量的混杂在一起,调试起来很不方便。利用struts对arcIMS请求代码进行封装,实现了业务代码和界面代码的分离。进行<nobr oncontextmenu="return false;" onmousemove="kwM(7);" id="clickeyekey7" onmouseover="kwE(event,7, this);" style="COLOR: #6600ff; BORDER-BOTTOM: #6600ff 1px dotted; BACKGROUND-COLOR: transparent; TEXT-DECORATION: underline" onclick="return kwC(event,7)" onmouseout="kwL(event, this);" target="_1">JSP</nobr>开发时,利用可中MVC框架使得开发起来非常便利。比较有名的MVC框架有struts,spring等。简单,快捷的Struts是应用最广泛的一个。
(1)在struts中新建一个action
<action-mappings >
<action
attribute="requestMapForm"
input="/index1.jsp"
name="requestMapForm"
path="/requestMap"
scope="request"
type="com.suzhou.struts.action.RequestMapAction" />
</action-mappings>
(2)在map.jsp中新建一个form,对应这个action,记住,struts的<url-pattern>必须设置成*.do的格式(在web.xml中设置),如果设置成/do/*格式,多次请求这个action会出现找不到action的错误。
字串5
<FORM action="requestMap.do" name="requestMapForm">
<INPUT type="submit" value="确定"/>
</FORM>
(3)编写action代码
字串1
代码
package com.suzhou.struts.action;
import <clk></clk>javax.servlet.<nobr oncontextmenu="return false;" onmousemove="kwM(2);" id="clickeyekey2" onmouseover="kwE(event,2, this);" style="COLOR: #6600ff; BORDER-BOTTOM: #6600ff 1px dotted; BACKGROUND-COLOR: transparent; TEXT-DECORATION: underline" onclick="return kwC(event,2)" onmouseout="kwL(event, this);" target="_1">http</nobr>.HttpServletRequest;
import javax.servlet.http.HttpServletResponse; 字串6
import org.apache.struts.action.Action;
import org.apache.struts.action.ActionForm;
import org.apache.struts.action.ActionForward;
import org.apache.struts.action.ActionMapping;
字串7
import com.esri.aims.mtier.io.ConnectionProxy;
import com.esri.aims.mtier.model.map.Map;
import com.suzhou.struts.form.RequestMapForm;
/***/ /** 字串8
*MyEclipseStruts
*Creationdate:03-29-2006
*
*XDocletdefinition:
*@struts.actionpath="/requestMap"name="requestMapForm"input="jspForm.jsp"scope="request"validate="true"
*/
public class RequestMapAction extends Action {
字串6
// ---------------------------------------------------------InstanceVariables
// ---------------------------------------------------------Methods
/***/ /**
字串9
*Methodexecute
* @param mapping
* @param form
* @param request
* @param response
* @return ActionForward
字串4
*/
public ActionForwardexecute(
ActionMappingmapping,
ActionFormform,
HttpServletRequestrequest,
HttpServletResponseresponse) { 字串5
RequestMapFormrequestMapForm = (RequestMapForm)form;
StringstrAction = requestMapForm.getAction();
ConnectionProxyconn = new ConnectionProxy();
conn.setHost( " menglikun " ); // <clk></clk>ArcIMS<nobr oncontextmenu="return false;" onmousemove="kwM(3);" id="clickeyekey3" onmouseover="kwE(event,3, this);" style="COLOR: #6600ff; BORDER-BOTTOM: #6600ff 1px dotted; BACKGROUND-COLOR: transparent; TEXT-DECORATION: underline" onclick="return kwC(event,3)" onmouseout="kwL(event, this);" target="_1">服务</nobr>器的名称或者IP 字串1
conn.setConnectionType(conn.TCP);
conn.setPort( 5300 ); // <clk></clk>ArcIMS<nobr oncontextmenu="return false;" onmousemove="kwM(9);" id="clickeyekey9" onmouseover="kwE(event,9, this);" style="COLOR: #6600ff; BORDER-BOTTOM: #6600ff 1px dotted; BACKGROUND-COLOR: transparent; TEXT-DECORATION: underline" onclick="return kwC(event,9)" onmouseout="kwL(event, this);" target="_1">服务器</nobr>的端口
conn.setService( " zixian " ); // 需要调用的ArcIMS服务器的服务名称
conn.setDisplayMessages( false );
字串5
// 使用Map对象的访问方式
/**/ /*
Mapmap=(Map)request.getSession().getAttribute("gongzhongMap");
if(map==null){ 字串7
//如果Map对象为空,新建一个Map对象
map=newMap();
try{
map.initMap(conn,0,false,false,false,false);
map.refresh();
request.setAttribute("mapURL",map.getMapOutput().getURL());
字串5
request.getSession().setAttribute("gongzhongMap",map);
returnmapping.getInputForward();
}catch(Exceptionex){
System.out.println(ex.getMessage());
ex.printStackTrace(); 字串1
}
}else{
map.refresh();
request.setAttribute("mapURL",map.getMapOutput().getURL());
request.getSession().setAttribute("gongzhongMap",map);
returnmapping.getInputForward();
字串6
}
*/
/**/ /*
*不使用Map对象,直接通过arcXML进行请求的访问方式。
<clk></clk>*这种方式的<nobr oncontextmenu="return false;" onmousemove="kwM(6);" id="clickeyekey6" onmouseover="kwE(event,6, this);" style="COLOR: #6600ff; BORDER-BOTTOM: #6600ff 1px dotted; BACKGROUND-COLOR: transparent; TEXT-DECORATION: underline" onclick="return kwC(event,6)" onmouseout="kwL(event, this);" target="_1">好处</nobr>是可以使用arcXML所有的功能,功能非常强大。
字串7
*但要自己写代码处理arcIMS返回的结果。
*/
StringstrArcXML = " <?xmlversion=/ " 1.0 / " encoding=/ " UTF - 8 / " ?> "
字串7
+ " <ARCXMLversion=/ " 1.1 / " > "
+ " <REQUEST> "
+ " <GET_IMAGE> "
字串9
+ " <PROPERTIES> "
+ " <ENVELOPEminx=/ " - 13.62 / " miny=/ " 33.91 / " maxx=/ " 53.62 / " maxy=/ " 73.33 / " /> "
字串8
+ " <IMAGESIZEwidth=/ " 600 / " height=/ " 400 / " /> "
+ " </PROPERTIES> "
字串8
+ " <LAYERtype=/ " acetate/ " name=/ " acetate/ " id=/ " acetate/ " > "
+ " <OBJECTunits=/ " pixel/ " > " 字串5
+ " <NORTHARROWtype=/ " 4 / " coords=/ " 20 30 / " shadow=/ " 32 , 32 , 32 / " size=/ " 15 / " /> "
字串9
+ " </OBJECT> "
+ " </LAYER> "
+ " </GET_IMAGE> " 字串8
+ " </REQUEST> "
+ " </ARCXML> " ;
try {
字串7
conn.send(strArcXML);
return mapping.getInputForward();
} catch (Exceptionex) {
System.out.println(ex.getMessage()); 字串6
ex.printStackTrace();
}
102 return null ;
103}
104 }
分享到:
相关推荐
基于J2EE架构结合ArcIMS_ArcSDE开发WebGIS应用的研究与实现
本文针对这些应用领域,分 析了国内外现有的大量WebGIS站点,将其大致归结为提供公共信息的WebGIS 和面向专业领域的WebGIS,并针对这两类WebGIS的特点,讨论了开发每一类 WebGIS经常要遇到的问题,并在分析...
基于Struts架构和ArcIMS的WebGIS研究与开发
基于ARCIMS的webgis 相关期刊文章
ArcIMS+ArcSDE开发例子,简单查询,缓冲功能
ArcIMS技术和切片技术开发WebGIS对比研究
该文在研究分析J2EE和ArcIMS结构体系和运行机制的基础上,结合具体的项目开发实例,论述了基于二者结合下的多层分布式WebGIS总体架构的设计以及系统的逻辑层次与功能部署,并对系统利用EJB组件实现地理空间信息与非...
基于ArcIMS Java Connector开发的WebGIS.zip
基于ArcIMS的完整的WebGIS网页发布程序,可以实现缩放,打印,漫游,查询,绑定等多种功能。
摘要:以Java连接器为中心.结合JavaBean-JSP-Servlet的...它是根据WebGIS软件平台ArcIMS4.0的工作原理和体系结构,确定了基于Java连接器ArclMS客户端的开发方案,实现和开发了基于Java技术的果树病虫害信息发布系统。
arcgis地图技术WebGIS 可以简单定义为在Internet 上 ...展, W e b G I S 的开发也涌现出许多新技术, 其中基于A r c I M S 的动态地图技术以及切 片方式的静态地图技术成为目前比较主流 的WebGIS 技术。
一个实用详细的webgis开发实例(基于arcims,需要arcims服务)
基于ArcIMS的WebGIS原理及简单实现实例基于ArcIMS的WebGIS原理及简单实现实例
比较不错的论文。有很大的参考价值。对实现GIS系统有参考帮助。
AECGIS的WEBGIS arcims 开发程序源代码
此文档内容结构如下:第一章主要介绍webGIS的开发原理、设计思想和功能,对主要GIS产品厂家介绍,以及主要的webGIS产品进行各方面的对比介绍。 第二章主要介绍ESRI主要产品之一ArcIMS的体系结构、组成、开发模式以及...
ArcIMS .net开发
主要介绍了ArcGIS 9.0 搭建WebGIS平台
本程序对于学习WebGIS很有用,用ArcIMS进行WebGIS开发