Application MAPX programming two cases

zhaozj2021-02-16  54

Application MAPX programming two CITYLAMP

0 MAPX Introduction Mapx is an ActiveX control product with powerful map analytics feature provided by MapInfo. Since it is a standard control based on a Windows operating system, it can support most standard visual development environments, such as Visual C , Visual Basic, Delphi, Powerbuilder, Visual Studio.net, and more. Programmaker can use its most familiar development language during the development process, easily embed the map function in the application, and can be run from the MapInfo software platform. With MAPX, you can easily quickly and easily embed the map of the map, enhance the spatial analysis capabilities of the software. Mapx uses the same map of MapInfo Professional, which enables Most map editing and spatial analysis functions with MapInfo Professional. The main features of MAPX include: [1] Topics Map Drawing Use topic map drawing can intuitively represent data. Associate data with objects on the map, then use color coding (or other style) to intuitively expose data. Data can be viewed using any of six different styles (color range, point density, separate value, grading symbol, pie chart or bar chart). [2] Refine layer-by-layer map drawing can be detailed in detail by simply clicking. For OLAP / DSS, you can finely refine the area on the map by tap. [3] The data binding map can be connected to the container, ODBC, or DAO data source nested by MAPX. Mapx provides several different types of data bindings, including geocogue levels of postal coding levels. [4] Note You can define the display orientation of the comment. Highlight specific data. You can also add text, symbols, forms to make map information more and intuitive. [5] Layerization can display and control the map layer to make it scaled in the preset distance. Seamless layers can be used or created, thereby processing a set of tables like processing a table. Special applications can be supported by special layers, including animation layers (for real-time tracking) and userDRAW layers (for drawing special map elements on the top of the map, such as a logo). [6] Grid image Add a grid image layer in the layer as a background that can make the final map clearer and beautiful. [7] The automatic tag can automatically add a label to the map and control its properties and display. [8] Select the object to drag the mouse on a map to select one or more objects or records on a circle, rectangle or specific point for analysis. [9] Feature Factory You can create, merge, buffer, or clear points, line, and region objects with FeatureFactory objects. [10] Toolset users can interact with maps by clicking and dragging. You can use the MapX built-in navigation, selection, label, zoom tool, or create custom tools to meet the requirements of the program. [11] Map editing allows users to add, modify, delete special objects such as text, editing area, point on the map. [12] Projection and coordinate system The MAPX allows the image display and processing X-Y coordinate data in the local coordinates by supporting various coordinate systems and map projections. [13] Remote Space Server Connections Access to remote map data stored in Oracle 8i and MapInfo Spatialware. Space data servers such as Spatialware and Oracle 8i provide advanced query processing capabilities to improve the performance of spatial data organizations. Store spatial data into the relational database, you can increase the flexibility of the application and the security of the map data.

1 Simple GIS feature For map scaling, translation, selection, tag, etc., can be easily obtained by setting the CurrentTool property of the MAPX control object. If the translation feature can be obtained simply: map1.currenttool = Mipantool (assuming the MAPX Control Name is MAP1) 2 Object Flashing features Many GIS systems to use the graphic objects to be used in the graphic object. For example, the node displays gray when the status is unknown, and it is flickering when receiving the query. This part of the function is implemented by means of timer controls. The main part of the program code is as follows: 'Record the node icon currently processed DIM CURCUSSYM AS New Mapxlib.Feature' Two alternating icons DIM NewStyle as new mapxlib.Style, OldStyle as new mapxlib.style 'for replacing the icon Boolean Dim blnold As Boolean ............ Private Sub Timer1_Timer () (each timer interval when this function is called) Set lyr = Map1.Layers.Item (1) Set FeaFac = Map1.FeatureFactory With NewStyle .SymbolType = miSymbolTypeBitmap. SymbolBitmapSize = 24 .SymbolBitmapTransparent = True .SymbolBitmapName = "red.BMP" (to display the first picture) End With With OldStyle .SymbolType = miSymbolTypeBitmap .SymbolBitmapSize = 24 .SymbolBitmapTransparent = True .SymbolBitmapName = "gray.BMP" (to The second picture of the display) End with map1.autoredraw = false (forbidden automatic refresh) IF (blnold = true) "If the first picture is displayed, it is replaced with the second picture) curcussym.style = OldStyle BLNold = False else curcussym.style = newstyle (if the first picture is displayed, replace the second picture) BLNOLD = True End if curcussym.Update (refresh picture) End Sub

3 Program Delete Site icon features This function is used when it is increased, reduced, and change the node. This part of the function is implemented by a custom tool. The main codes are as follows: 'module tool in engineering constants defined deletions node Public Const CreateRTUSymbolTool = 106 Public Const DeleteRTUSymbolTool = 107' registration tool Private Sub Form_Load () ............ Map1.CreateCustomTool CreateRTUSymbolTool, miToolTypePoint, miSizeAllCursor Map1.CreateCustomTool DeleteRTUSymbolTool call Private miToolTypePoint, miSizeAllCursor End Sub 'tools Sub Map1_ToolUsed (ByVal ToolNum As Integer, ByVal X1 As Double, ByVal Y1 As Double, ByVal X2 As Double, ByVal Y2 As Double, ByVal Distance As Double, ByVal Shift As Boolean, ByVal ctrl As Boolean, EnableDefault As Boolean) ............ 'add node icon If ToolNum = CreateRTUSymbolTool Then Dim Pnt As New MapXLib.Point Dim FeaFac As New MapXLib.FeatureFactory Dim lyr As New MapXLib.Layer Dim ftr As New MapXLib.Feature Dim NewStyle As New MapXLib.Style set lyr = Map1.Layers.Item (1) style set FeaFac = Map1.FeatureFactory 'set the node icon With NewStyle .SymbolType = miSymbolTypeBitmap .SymbolBitmapSize = 24 .SymbolBitmap Transparent = true .symbitmapname = "gray.bmp" end with map1.autoredraw = false 'prohibition layer Auto Refresh Lyr.editable = true' Creating Current Layers Creating PNT.SET X1, Y1 SET FTR = Feafac.createSymbol (PNT, NewStyle) 'Creating Symbol' records The user tag set curcussym = ftr 'adds node icon into the current layer and refreshes Lyr.Addfeature Ftr lyr.refresh

Map1.AutoRedraw = True 'Restore Layer automatically refresh lyr.Editable = False' release objects Set Pnt = Nothing Set FeaFac = Nothing Set lyr = Nothing Set ftr = Nothing End If 'Delete Node icon If ToolNum = DeletePointTool Then Dim obj As MapXLib.Feature Dim selectedFtrs As MapXLib.Features Dim lyr As MapXLib.LayerSet lyr = Map1.Layers.Item (1) Set selectedFtrs = lyr.Selection For Each obj In selectedFtrs lyr.DeleteFeature (obj) Next End If End Sub

4 Note The BMP picture for display must be placed in the CUSTSYMB subdirectory in the MAPX installation directory, which is not more than 256 colors, so that the display can be called with the statement that .Symbylbitmapname = "gray.bmp".

5 Mapx and .NET binding Because Mapx is an AVTIVEX control, it can be managed by .NET hosting. However, due to the implementation of the .NET to the ActiveX control, it is achieved with a "shell" packaging object, and many of the ActiveX methods under VB6 are no longer supported (such as default parameters, etc.), there are some of the MAPX to .NET. Difficulty. Of course, the basic function is more easily implemented, such as the statement to select tool calls: axmap1.currenttool = mapxlib.toolconstants.MisElectrtool (Axmap1 is equivalent to the MAP1 object below VB6). Later this year, MapInfo will launch MapInfo .NET, I believe this new version will become a weapon developed under the .NET platform.

[Note] This article refers to the "Mapx Reference Guide" in the English version of the MAPX control function.

转载请注明原文地址:https://www.9cbs.com/read-23693.html

New Post(0)