求明白MAPX和VB查找图元的大哥留个QQ,我有问题求救
发布网友
发布时间:2024-10-02 16:28
我来回答
共3个回答
热心网友
时间:2024-10-09 07:12
mapx查找地图上的图元有多种方法
a, FindObj.Search
这种方法在用的时候有局限性:数据集必须要有索引,查找的字段类型不能是10进制类型(可能还有其它的类型,忘了),否则在图上找不到。
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语句方法
Dim ftrs As MapXLib.Features
Dim lyr As Layer
Dim i As Integer
Set lyr = fMainForm.Map1.Layers(RoadlyrName)
Dim strs As String
strs = Trim("路线编码 = " + Chr(34) + ComRoadID.List(ComRoadID.ListIndex) + Chr(34))‘在值前面加双引号如:ID="001", 观测点名称 like "%天平庄"
Set ftrs = lyr.Search(strs)
lyr.Selection.ClearSelection
lyr.Selection.Add ftrs
If ftrs.Count > 0 Then
fMainForm.Map1.CenterX = ftrs.Item(1).CenterX
fMainForm.Map1.CenterY = ftrs.Item(1).CenterY
End If
热心网友
时间:2024-10-09 07:09
380527801
热心网友
时间:2024-10-09 07:14
看来救不了你以后分数少一点~不然会白仍的~可惜~