1 / 20

Mapinfo China 罗兴祚

MapXtreme for Java 开发基础. Mapinfo China 罗兴祚. 内容. 应用程序组织模式 MapXtreme for Java 主要构成部分 实现基本地图功能的核心代码分析 Servlet 简述 IDE 开发调试工具 典型例程分析与扩展 中间件演示. 应用程序组织模式. Mapxtreme for Java 程序模式 “ Thin” Client 瘦客户机/服务器模式 “Medium” Client 中等客户机/服务器模式 “Thick” Client 胖客户机/服务器模式. 应用程序组织模式.

neo
Télécharger la présentation

Mapinfo China 罗兴祚

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. MapXtreme for Java 开发基础 Mapinfo China 罗兴祚

  2. 内容 • 应用程序组织模式 • MapXtreme for Java主要构成部分 • 实现基本地图功能的核心代码分析 • Servlet简述 • IDE开发调试工具 • 典型例程分析与扩展 • 中间件演示

  3. 应用程序组织模式 • Mapxtreme for Java程序模式 • “Thin” Client 瘦客户机/服务器模式 • “Medium” Client 中等客户机/服务器模式 • “Thick” Client 胖客户机/服务器模式

  4. 应用程序组织模式 • “Thin” Client 瘦客户机/服务器模式特点 • 服务器端通过Servlet程序向客户机端提供Image图片(GIF) • 客户机浏览器端只有HTML网页,并不需要写客户端的Java程序 • 开发此类程序需要知道如何在服务器端产生HTML网页

  5. 应用程序组织模式 • “Thick” Client 胖客户机/服务器模式特点 • 客户机浏览器端网页里含有Applet下载控件,需要客户机浏览器含有Java解释器 • 服务器端向客户机端传递的是矢量数据而不是位图数据,更适合于Intranet • 开发此类程序需要知道如何用Java Beans开发Applet程序

  6. 应用程序组织模式 • “Medium” Client 中等客户机/服务器模式特点 • 服务器端通过Servlet程序向客户机端提供Image图片(GIF) • 客户机浏览器端网页里含有Applet下载控件,需要客户机浏览器含有Java解释器 • 客户端包含Applet控件使用户界面更友好,交互性更强

  7. 应用程序组织模式 • 三种模式性能比较 • “Thin” Client • 传输的图形格式:栅格图 • 传输速率:快 • 交互性:弱 • “Medium” Client • 传输的图形格式:栅格图 • 传输速率:中 • 交互性:中等 • “Thick” Client • 传输的图形格式:矢量图 • 传输速率:慢 • 交互性:强

  8. MapXtreme for Java主要构成部分 • MapXtremeServlet • MapJ • Data Providers • Renderers

  9. MapXtreme for Java主要构成部分 • MapXtremeServlet • mapxtremeServlet是系统的地图服务供给者,它提供如下服务: • 提供栅格地图数据服务 • 提供矢量地图数据服务 • 提供图元文件数据服务(例:tab表里的属性信息)

  10. MapXtreme for Java主要构成部分 • MapJ Object • MapJ管理地图集的各种状态(例:地图中心位置、地图视野、地图坐标系等) • MapJ通过向MapxtremeServlet服务实例转发客户请求,获得Servlet响应的数据和图片 • MapJ位于Mapxtreme客户端应用程序开发包API的最顶端

  11. MapXtreme for Java主要构成部分 • Renderers • 用来生成返回客户端地图数据的组件 • LocalRenderer • MapXtremeImageRenderer • Intra-Servlet Container Renderer • Composite Renderer

  12. MapXtreme for Java主要构成部分 • Data Providers • Data Providers在MapJ对象访问地图数据时起中间枢纽作用,它能访问以下几种数据源: • MapInfo tab format (.tab) • Oracle8i with Spatial Option • Informix Universal Server SpatialWare DataBlade • DB2 SpatialWare Extender • JDBC compatible tables containing longitude and latitude columns • GeoTIFF and MIGrid Raster • ESRI Shapefiles • Data Binding • Annotation 可自定义Data Provider: 将系统未提供接口的数据(如其他矢量、光栅数据)引入

  13. MapXtreme for Java主要构成部分 • TableDescHelper(表名):describes the data • DataProviderHelper(路径):defines the source of the data • DataProviderRef(LocalDataProviderRef、MapXtremeDataProviderRef) :describes how to get the data • For example:TABDataProvider • // specify the url to the MapXtreme servlet which • remotely • // connects us to the map engine • String MapXtremeURL = "http://localhost:8080/mapxtreme/ • servlet/mapxtreme"; • // create the tab Table Desc • TABTableDescHelper TabDesc = new TABTableDescHelper(new • File("mytab.tab").getName()); • // create the tab Data Provider • TABDataProviderHelper DPHelper = new • TABDataProviderHelper("d:\\maps"); • // Create the Remote Dataprovider needed to access the • Data • MapXtremeDataProviderRef MXDPRef = new • MapXtremeDataProviderRef(DPHelper, MapXtremeURL); • // assign it to MapJ • map.getLayers().add(MXDPRef, TabDesc, "tabLayer");

  14. MapXtreme例程框架结构图 Browser Web Server Application Server Oracle8i TAB 1010100111010010101010101010010101010101 Internet MiddleWare DataBase Client Applet Servlet/ JSP MapXtreme Servlet Request User servlet HTML & Map Response Thematics

  15. 实现基本地图功能的核心代码分析Creating Your First Map • 1. Create a MapJ Object. MapJ myMap = new MapJ(); • 2. Load map data. MapDefContainer mdc = new FileMapDefContainer(dir): MapDefContainer mdc = new FileMapDefContainer("c:\\mapxtreme\maps") myMap.loadMapDefinition(mapDefContainer, name) myMap.loadMapDefinition(mdc, "Asia"); • 3. Set map device bounds. myMap.setDeviceBounds(new DoubleRect(0, 0, 800, 600)); • 4. Render the map to an image file. String mapxtremeServletUrl = “http://localhost:8080/mapxtreme40/servlet/mapxtreme”; ImageRequestComposer imageRC =ImageRequestComposer.create(myMap, 256, Color.blue,“image/gif”); MapXtremeImageRenderer renderer = new MapXtremeImageRenderer(mapxtremeServletURL); Renderer.render(imageRC); //myMap.render(renderer); Renderer.toFile("comp.gif");

  16. 实现基本地图功能的核心代码分析 Controlling the Map Setting the Zoom Level:setZoom(), setCenter(), and setZoomAndCenter() myMap.setZoom(500); Recentering the Map: // Create the screen point screenpoint = new DoublePoint(event.getX(),event.getY()); // Create the real world point worldpoint = myMap.transformScreenToNumeric(screenpoint); // Set the center of the map myMap.setCenter(worldpoint); Setting the Map Bounds //This example uses opposing corners to set the bounds to the entire world: DoubleRect bounds = new DoubleRect(-180,-90,180,90); //This example uses opposing corners to set the bounds to a zoomed-in map area: DoubleRect bounds = new DoubleRect(-1.969272, 50.560410, 1.443363, 52.315529); //This example uses the center point, width, and height to set the bounds for the world: DoubleRect bounds = new DoubleRect(new DoublePoint(0,0),360,180); myMap.setBounds(bounds); Setting the Map Distance Units distUnit = LinearUnit.kilometer; myMap.setDistanceUnits(distUnit);

  17. Servlet简述 • javax.servlet package • 接口 • Servlet • ServletConfig • ServletRequest • ServletResponse • 类 • GenericServlet • ServletInputStream • ServletOutputStream • 异常 • ServletException • UnavailableException

  18. Servlet简述 • javax.servlet.http package • 接口 • httpServletRequest • httpServletResponse • 类 • httpServlet: • HTTP1.0:doGet、doPost • HTTP1.1: service(httpServletRequest req,httpServletResponse res) • httpUtils

  19. IDE开发调试工具 • Visual Cafe 4.0 Symantec公司发行 • JDeveloper Orcale公司发行 • JBulider Borland 公司发行 • IBM Visual Age

  20. 操作演示 • 讲解JDeveloper集成开发环境:在Mapxtreme for Java自带“Middle”Cilent模式例程基础上进行扩展 • 讲解基于 “Middle”Cilent模式 的中间件

More Related