惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

V
Vulnerabilities – Threatpost
U
Unit 42
F
Fortinet All Blogs
aimingoo的专栏
aimingoo的专栏
P
Proofpoint News Feed
F
Full Disclosure
月光博客
月光博客
Engineering at Meta
Engineering at Meta
博客园_首页
The Register - Security
The Register - Security
G
Google Developers Blog
The Cloudflare Blog
博客园 - Franky
K
Kaspersky official blog
A
Arctic Wolf
Scott Helme
Scott Helme
C
Cisco Blogs
Hugging Face - Blog
Hugging Face - Blog
C
Check Point Blog
NISL@THU
NISL@THU
AI
AI
D
DataBreaches.Net
Cyber Security Advisories - MS-ISAC
Cyber Security Advisories - MS-ISAC
Stack Overflow Blog
Stack Overflow Blog
Project Zero
Project Zero
The GitHub Blog
The GitHub Blog
H
Hackread – Cybersecurity News, Data Breaches, AI and More
量子位
Vercel News
Vercel News
T
Tor Project blog
P
Privacy International News Feed
D
Docker
I
Intezer
L
LangChain Blog
P
Proofpoint News Feed
Security Latest
Security Latest
C
CXSECURITY Database RSS Feed - CXSecurity.com
T
Threatpost
博客园 - 聂微东
AWS News Blog
AWS News Blog
Martin Fowler
Martin Fowler
P
Privacy & Cybersecurity Law Blog
V
V2EX
Last Week in AI
Last Week in AI
C
Cybersecurity and Infrastructure Security Agency CISA
The Hacker News
The Hacker News
T
Tenable Blog
Blog — PlanetScale
Blog — PlanetScale
钛媒体:引领未来商业与生活新知
钛媒体:引领未来商业与生活新知
T
Tailwind CSS Blog

博客园 - Tony Wu

关于研究性和工程性 送出orkut邀请,当然如果需要gmail邀请,还有很多 原来好男人还真不容易做啊! 第一次上班吃便当 预测分析研究 地理信息系统应用于教育领域之查询功能 关于点相对于线的位置判定 <用演示说话>读书笔记 网络数据集的构建以及基于网络数据集的路径分析 天。鬼。法 超图SuperMap Is.Net开发心得及一些问题 开始在NEC做事,心情愉快 元月6日的回忆 关于大学 自己录了一首歌,嘻嘻 使用jxl读和写Excel文件 关于JSP发布地图服务 java的一些基本概念 .NET启动时,出现无法加载MSXML3.dll
ArcIMS 开发学习笔记(一)
Tony Wu · 2005-10-15 · via 博客园 - Tony Wu

最近在公司做WebGIS项目,感觉很爽快,将学习到的东西整理一下,供大家交流。

1.环境配置
    Web服务器:Apache2048
    Servlet:Tomcat4129
    GIS开发平台:ArcIMS 9.0
    Java编译环境:Eclipse
2.上述环境设置好之后,进入ArcIMS开发阶段,主要的工作分三块:java类/jsp/javascript
   用Struts 开发实质上将请求和处理完全隔离,jsp网页中只需要写与action对应的form,这些Action
   通过struts-config.xml和jsp网页当中的form等对应起来.
   下文主要按照功能对代码实现进行研究
   初始化地图 InitMap Action:
   需要用到的核心类:import com.esri.aims.mtier.io.ConnectionProxy和import  com.esri.aims.mtier.model.map.Map
     *************代码*********  
        ConnectionProxy conn = null;
        Map map = null;
        try {
            conn = new ConnectionProxy();
            map = new Map();
            conn.setHost(host);//ArcIMS服务器的名称或者IP
            conn.setConnectionType(connectionType);
            conn.setPort(port);//ArcIMS服务器的端口
            conn.setService(service);//需要调用的ArcIMS服务器的服务名称
            conn.setDisplayMessages(displayMessages);
            map.initMap(conn, 0, true, true, true, true);//初始化地图
            //地图和图例的风格设置
            map.setWidth(width);
            map.setHeight(height);
            map.getLegend().setFont("宋体");
     map.getLegend().setAntialiasing(false);
     map.getLegend().setTitle("图例");
            map.getLegend().setTitleFontSize(18);
     map.getLegend().setLayerFontSize(12);
     map.getLegend().setValueFontSize(10);
     map.getLegend().setAutoExtend(true);
     map.getLegend().setWidth(125);
            map.getLegend().setCellSpacing(7);
          //获取地图的全图范围和一些参数,并且传送给客户端
            Envelope extent = map.getEnvelope();
            double minx = extent.getMinX();
            double miny = extent.getMinY();
            double maxx = extent.getMaxX();
            double maxy = extent.getMaxY();
           
            double mapXDistance = maxx - minx;
            double mapYDistance = maxy - miny;
           
            double doubleWidth = Double.parseDouble(Long.toString(width));
            double doubleHeight = Double.parseDouble(Long.toString(height));
            double mapRatio = (maxx - minx) / (maxy-miny);
            double windowRatio = doubleWidth / doubleHeight;       
           
            double mapHeight = (windowRatio/mapRatio) * doubleHeight;
           
            double upperHeight = (doubleHeight - mapHeight) / 2;
           
            double distancePerPixel = mapXDistance / doubleWidth;
           
            double mapMaxY = maxy + distancePerPixel * upperHeight;
            double mapMinY = miny - distancePerPixel * upperHeight;
         
             //将地图的全图范围传递到客户端
            request.setAttribute("fullMinX", new Double(extent.getMinX()));
            request.setAttribute("fullMinY", new Double(mapMinY));
            request.setAttribute("fullMaxX", new Double(extent.getMaxX()));
            request.setAttribute("fullMaxY", new Double(mapMaxY));
            //将地图的当前范围传递到客户端
            request.setAttribute("minX", new Double(extent.getMinX()));
            request.setAttribute("minY", new Double(mapMinY));
            request.setAttribute("maxX", new Double(extent.getMaxX()));
            request.setAttribute("maxY", new Double(mapMaxY));
           
            //告知客户端这是在初始化地图
            request.setAttribute("initMap", "true");
           //获取地图图片的 mapUrl和图例了legendurl
            request.setAttribute("mapUrl", map.getMapOutput().getURL());
            request.setAttribute("legendUrl", map.getLegend().getLegendOutput()
                    .getURL()); 
           //将Map对象放入Session中,以后在这个对话中一直使用这个map对象来生成地图
            request.getSession().setAttribute("map", map);
            request.getSession().setAttribute("fullExtent", extent);
   }
catch(){}

        return mapping.findForward("ConetentFrame");//将网页重定向到ConetentFrame

        ConetentFrame对应的content.jsp里面只需要写一个form,对应这个Action类InitMap
就可以初始化地图并获取相关的参数。

在content.jsp中,获取地图的参数,并赋给客户端。
<script language="JavaScript" type="text/javascript">
   var m = parent.mapFrame;  //
<%
//初始化地图时,获得地图的初始化的全图范围
if (initMap != null){
%>  
   
    m.fullMinX = <%=(Double)request.getAttribute("fullMinX")%>;
    m.fullMinY = <%=(Double)request.getAttribute("fullMinY")%>;
    m.fullMaxX = <%=(Double)request.getAttribute("fullMaxX")%>;
    m.fullMaxY = <%=(Double)request.getAttribute("fullMaxY")%>;
    m.fullOVLeft = m.fullMinX;
    m.fullOVRight = m.fullMaxX;
    m.fullOVTop = m.fullMaxY;
    m.fullOVBottom = m.fullMinY;
    m.fullOVWidth = Math.abs(m.fullOVRight - m.fullOVLeft);
    m.fullOVHeight = Math.abs(m.fullOVTop - m.fullOVBottom);
<%
}