1 / 27

Layers

Layers. 用户的数据反映在地图上通常根据点、线、面的层次结构进行归类。每一个独立的图层都可以作为一个独立的地图。 MapX 中调用的是一个由多个独立地图图层组成的地图集合。. Regions. Lines. Points. Text. Pacific Ocean. Layers Methods. 图层控制对话框 Map1.Layers.LayersDlg. Layers Property. AnimationLayer ( 示例 ) Bounds Count InsertionLayer

danae
Download Presentation

Layers

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. Layers • 用户的数据反映在地图上通常根据点、线、面的层次结构进行归类。每一个独立的图层都可以作为一个独立的地图。MapX中调用的是一个由多个独立地图图层组成的地图集合。

  2. Regions Lines Points Text Pacific Ocean

  3. Layers Methods • 图层控制对话框 • Map1.Layers.LayersDlg

  4. Layers Property • AnimationLayer (示例) • Bounds • Count • InsertionLayer This property specifies what new layer objects will be inserted into by the built-in object editing tools. • Item

  5. Layers Methods • 建新层 • Map1.Layers.CreateLayer “Offices” [Layer=]OBJECT.CreateLayer (Name , [FileSpec] , [Position] , [KeyLength] , [CoordSys]) • 加入图层 • Map1.Layers.Add “C:\Data\Ireland.tab” [Layer=]OBJECT.Add (LayerInfo, [Position]) ] LayerInfo: This can be either a LayerInfo object or a Pathname of the MapInfo table (.TAB) file to be added as a layer. If no Position parameter is specified, the layer is positioned automatically with respect to other layers in the map. For example, a layer with points is placed above a layer with regions.

  6. Layers Methods • 删除图层 • Map1.Layers.Remove 3 • 移动图层 • Map1.Layers.Move 1,2 • 用户自定义图层 • Map1.AddUserDrawLayer (示例)

  7. layerInfo对象 • 标准Table表: • 用户自定义图层:在此图层中,用户可以使用如Windows API函数来画图。 • 可自注册的栅格图象:如:GeoTiff。 • 栅格图象:以Tab表形式调入。支持24位真彩栅格图象。支持格网文件支持(MIG)。 • ARCVIEW的SHAPE文件:步骤如下: • .将其中的DBF文件写成TAB表形式. • .打开.tab文件,将 “Type DBF Charset "WindowsSimpChinese"”改为”Type SHAPEFILE Charset "WindowsSimpChinese"”. • .将文件加入应用.

  8. LayerInfoTypeConstants • miLayerInfoTypeTab = 0 • miLayerInfoTypeUserDraw = 1 • miLayerInfoTypeRaster = 2 • miLayerInfoTypeShape = 3 • miLayerInfoTypeServer = 4 • miLayerInfoTypeGeodictUserName = 5 • miLayerInfoTypeTemp = 6 • miLayerInfoTypeNewTable = 7

  9. 远程数据库 连接ODBC数据源,MS Access/SQL Server/其他ODBC数据源.:要求数据库已经地图化。程序:Dim LayerInfo As New MapXLib.LayerInfo LayerInfo.Type = miLayerInfoTypeServer LayerInfo.AddParameter “name”, “ODBCLayer” ’ ‘Mapstats为ODBC数据源 LayerInfo.AddParameter”connectstring",“Mapstats” LayerInfo.AddParameter "query",”Select * from Us_cust” LayerInfo.AddParameter "cache", “on” LayerInfo.AddParameter "MBRSearch", “on” LayerInfo.AddParameter "toolkit", "ODBC" layerinfo.AddParameter "AutoCreateDataset", 1 layerinfo.AddParameter "datasetname", “us_cust” Set lyr = Formmain.Map1.Layers.Add(LayerInfo, 1)

  10. 连接Oracle8I数据源,通过Oracle Call Interface (OCI) MapX可以将存储在Oralce8I数据库服务器中的Mapinfo空间数据和属性数据同时下载到本地。 • Dim LayerInfo As New MapXLib.LayerInfo • LayerInfo.Type = miLayerInfoTypeServer LayerInfo.AddParameter “name”, “oranLayer” LayerInfo.AddParameter”connectstring",“uid=system;pwd=manager;srvr=mapx” LayerInfo.AddParameter “query”,”Select * from Us_cust” LayerInfo.AddParameter “cache”, “on” • LayerInfo.AddParameter “MBRSearch”, “on” • LayerInfo.AddParameter "toolkit", "ORAINET” layerinfo.AddParameter "AutoCreateDataset", 1 • layerinfo.AddParameter "datasetname", “us_cust” Set lyr = Formmain.Map1.Layers.Add(LayerInfo, 1)

  11. 连接空间数据服务器如SpatialWare for Oracle, SpatialWare Informix DataBlade, 以及SpatialWare DB2 Extender. 采用ODBC连接. • 连接空间数据服务器亦可使用AddServerLayer方法:Map1.Layers.AddServerLayer "ssa","DSN=Spatial;HOST=spw;UUID=mapzk;UPWD=mapzk;UID=mapzk; PWD=mapzk;OSID=map", "select * from ""sloil"""

  12. 常用的Layer property • AutoLabel • Name • OverrideStyle • Selectable, Editable, Visible • Style • ZoomLayer, ZoomMax, ZoomMin • FileSpec • Type • LabelProperties

  13. 常用的Layer method • AddFeature, DeleteFeature • BeginAccess, EndAccess This method will open and lock the table for read/write access. This improves the performance for repeated layer and Dataset operations. You must call Layer.EndAccess once for each call to Layer.BeginAccess. • Refresh • UpdateFeature • Search [ Features collection= ]OBJECT.Search (strWhere, [Variables]) strWhere : An expression to evaluate for each feature.

  14. 标准 Tool的使用 很多地图应用,都需要用户给出一些地图控件。大多数解决方法是提供给用户一些工具类型。 • Map1.CurrentTool = miRadiusSelectTool Map1是 MapX的对象名,miRadiusSelect 是常量。在指定位置使用用户工具。

  15. 标准 Tool的分类 • Navigation tools (Zoom-In, Zoom-Out, Pan, Center) that let the user change the scale and placement of the map. • A Labeling tool that lets the user click a map feature to label it. • A set of Selection tools that give the user various ways to select map features. • Annotations (symbols and text).

  16. 标准 Tool的使用

  17. 自定义Tools • 用户可以创建自定义工具,按照以下三步 • .创建工具 • .编写工具程序代码 • .使用工具

  18. Step 1: 创建用户自定义工具 下面是帮助文件中解释用户自定义工具的说明,[ ] 里面是可选参数: • Map.CreateCustomTool ToolNumber, Type, Cursor, [ShiftCursor], [CtrlCursor] • ToolNumber以后要引用工具的编号,在1-99之间 • Type 描述工具类型 • Cursor 当前使用工具的光标形状。 • ShiftCursor 当前使用工具的光标形状 ,按住<SHIFT>键光标被隐藏。 • CtrlCursor 当前使用工具的光标形状,按住<Ctrl>键光标被隐藏。

  19. 常数

  20. 自定义Tools • Step2. 指定程序将执行的任务: • 使用过程工具 例如,你要画一条长线,这时用户需要在地图上使用工具记录移动的状况。由此,在地图对象上使用MouseMove 事件。 • 使用工具 例如,用鼠标画出一个圆,以便计算圆内的用户数。由此,需要使用功能性工具,在地图对象上使用ToolUsed 事件。

  21. 自定义Tools • Step3. 如果要使用工具,需要设置MapX对象CurrentTool的值。 • Map1.CurrentTool = miCenterTool • Map1.CurentTool = 430

  22. style • Map.defaultstyle • layer.style • feature.style The Style Override is only in effect during the current work session, as are the other display settings. To make them permanent,you would have to modify the geoset.

  23. Style.LineColor Style.LineWidth Style.LineWidthUnit Style.RegionBackColor Style.RegionBorderColor Style.RegionBorderStyle Style.RegionBorderWidth Style.SupportsBitmapSymbols Style.SymbolBitmapColor Style.SymbolCharacter Style.SymbolFont Style.TextFont Style.TextFontColor Style.SymbolType Style.Clone Style.DrawLineSample Style.DrawRegionSample Style.DrawSymbolSample Style.DrawTextSample Style.ExportLineSample Style.ExportRegionSample Style.ExportSymbolSample Style.ExportTextSample Style.PickLine Style.PickRegion Style.PickSymbol Style.PickText Style: Feature的属性设置 常用property 常用method

  24. Style.PickLine Style.PickRegion Style.PickSymbol Style.PickText Style: Feature的属性设置

  25. coordinate Every map has a coordinate system, which affects mapping software in various ways: • The coordinate system affects how X-Y coordinates are processed. For example, a location can be expressed in terms of degrees longitude/latitude, or it can be expressed in terms of other units, such as meters. • The coordinate system affects the appearance of the map. Changing a map's coordinate system can make the map appear stretched or distorted.

  26. coordinate Every map has a coordinate system, which affects mapping software in various ways: • The coordinate system affects how X-Y coordinates are processed. For example, a location can be expressed in terms of degrees longitude/latitude, or it can be expressed in terms of other units, such as meters. • The coordinate system affects the appearance of the map. Changing a map's coordinate system can make the map appear stretched or distorted.

  27. coordinate • Map.DisplayCoordSys 显示坐标系统 • Map.NumericCoordSys 数字坐标系统 • Layer.CoordSys If you set the Map.DisplayCoordSys to match a Layer.CoordSys, you maximize the display speed of that layer. Note:If a map includes one or more raster image layers, MapX automatically displays the map in the projection specified by the most visible raster image. The coordinate system could then change as the map view changes (due to zooming or panning) if a different raster image with a different projection becomes the most visible. In this case, you cannot change the map's display coordinate system.

More Related