MapX + VB Summary Summary (4)

xiaoxiao2021-03-06  111

PPP80 went to Tianjin last month to do this project, overtime is all very busy, now the project is final

The first phase is completed, and it can be left out. Before doing this project, I just learned a month of supermap, but I feel these east

West is a small difference, there is no terrible; the key is that it is originally .NET, now

It is really too much to use VB. . . Forget it, catch the foil, will not have to have it!

In fact, I really can only call this kind of half-solving, learning, and use.

It is to leave something with others, maybe it will help:) (a total of five)

12 Finding the chart Mapx Find the map on the map There are multiple methods A, Findobj.Search This method has limitations when used: The data set must have an index, the field type of the lookup cannot be 10 en-product type (possibly There are other types, forgot), otherwise you can't find it on the figure.

Set FindObj = fMainForm.Map1.Layers (LayerCombo.Text) .Find Set FindObj.FindDataset = fMainForm.Map1.DataSets (LayerCombo.Text & "dataset") Set FindObj.FindField = FindObj.FindDataset.Fields (FieldCombo.Text) Set FoundFeature = FindObj.Search (FindText.Text) If FoundFeature.FindRC Mod 10 = 1 Or FoundFeature.FindRC Mod 10 = 2 Then fMainForm.Map1.Layers (LayerCombo.Text) .Selection.Add FoundFeature fMainForm.Map1.AutoRedraw = False fMainForm .Map1.CenterX = FoundFeature.CenterX fMainForm.Map1.CenterY = FoundFeature.CenterY End If b, SQL statements method Dim ftrs As MapXLib.FeaturesDim lyr As LayerDim i As Integer Set lyr = fMainForm.Map1.Layers (RoadlyrName) Dim strs As String strs = trim ("route code =" chr (34) comroadid.list (comroadid.listindex) chr (34)) Plus double quotes in front of: ID = "001", observation point name LIKE " % Tianpingzhuang "SET FTRS = lyr.search (strs) lyr.selection.cleratelection lyr.selection.add fTRS if fTRS.COUNT> 0 THEN FMAINFORM.MAP1.Centerx = fTRS.Item (1) .Centerx Fmainform.map1.c Entertainment = fTRS.ITEM (1) .Centery End IF13 displays the current latitude and longitude private sub map1_mousemove (Button As Integer, Shift As Integer, X as Single, Y As Single) DIM MX As Double, My As Double Map1.Convertcoord X, Y, mx, my, 1 text1.item (1) .caption = "Current position" text1.item (2) .caption = "East" & format (MX, "### 0.0000") ", north latitude" Format (My, "### 0.0000") text1.item (3) .caption = "Current Layer" text1.item (4) .caption =

Map1.Layers (1) .NameEnd Sub14 automatic scrolling Private Sub Map1_MouseMove (Button As Integer, Shift As Integer, x As Single, y As Single) If mnuMoveCenter.Checked = True Then If x> Map1.MapScreenWidth - 10 Then Map1.CenterX = Map1.CenterX 0.05 Map1.Refresh Else If x <10 Then Map1.CenterX = Map1.CenterX - 0.05 Map1.Refresh Else If y> Map1.MapScreenHeight - 10 Then Map1.CenterY = Map1.CenterY - 0.05 Map1.Refresh Else If y <10 Then Map1.CenterY = Map1.CenterY 0.05 Map1.Refresh End If End If End If End IfEnd If End Sub15 distance and planimetry Private Sub Form_Load () Map1.CreateCustomTool PolyRulerToolID, miToolTypePoly, miSizeAllCursor Map1.CreateCustomTool PolyAreaToolID , miToolTypePolygon, miSelectRegionMinusCursorEnd Sub Private Sub Map1_PolyToolUsed (ByVal ToolNum As Integer, ByVal flags As Long, ByVal Points As Object, ByVal bShift As Boolean, ByVal bCtrl As Boolean, EnableDefau lt As Boolean) If ToolNum = PolyRulerToolID Then Dim i As Integer Dim DistanceSoFar As Double Map1.MapUnit = RulerUnit DistanceSoFar = 0 # If Points.Count> 1 Then For i = 2 To Points.Count DistanceSoFar = DistanceSoFar Map1.Distance (Points .Item (i) .X, Points.Item (i) .y, points.Item (i - 1) .x, Points.Item (i - 1) .y) Next end End End End End End End End End End End End End End End End End End End End End End End End End End End End End End End End End End End End End End End End End End End End End End End End End End End End End End End End End End End End End End End End End End End End End Ends' First, Clear The Status bar text1.item (4) .caption = "" Msgbox "Distance:" & DistanceSofar & "&"

RulerUnitString Else Text1.Item (3) .Caption = "Distance" Text1.Item (4) .Caption = DistanceSoFar & "" & RulerUnitString End If End If If ToolNum = PolyAreaToolID Then 'area Map1.AreaUnit = miUnitSquareKilometer On Error Resume Next Dim apolygoN As New MapXLib.Feature Dim ax As Double If (Points.Count> 2) Then Set apolygoN = New Feature Set apolygoN = Map1.FeatureFactory.CreateRegion (Points) ax = apolygoN.Area MsgBox "area:" & ax End If End IFEND SUB

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

New Post(0)