|
阅读:1090回复:1
求助求助 delphi +mapx 查找地名
<P>各位大虾们,你们好呀</P>
<P>我最近碰到一个头疼的问题,就是 delphi +mapx 查找地名,怎么调试也不成功,望各位大虾们指点,我急呀,我的代码如下:望指点:</P> <P>var Countlyr:integer; counter:integer; Foundobj:CMapXFindResult; Result:integer; II:integer; NN:integer; Lyrname:string;</P> <P> ftrFeature: CMapXFeature; ZOOMLEVEL:double; Address:string;</P> <P>begin Address:=Trim(TextEdit1.text); ZOOMLEVEL:= 1.5;</P> <P> Countlyr:= CurrMap.Layers.Count; For counter := 1 To Countlyr - 1 do begin Lyrname := CurrMap.Layers.Item[counter].Name;</P> <P> if CurrMap.Layers.Item[counter].Visible = True Then begin CurrMap.Layers[counter].Find.ClosestAddr := False; CurrMap.Layers[counter].Find.CloseMatchMax := 75; Foundobj:=CoFindResult.Create; Foundobj := CurrMap.Layers.Item[counter].Find.SearchEx(Address,emptyparam);</P> <P> If (Foundobj.ExactMatch) And (not Foundobj.MultipleMatches) Then begin ftrFeature:= CoFeature.Create; ftrFeature := Foundobj.MatchedFeature; showmessage(floattostr(ftrFeature.CenterX)); CurrMap.AutoRedraw := False; CurrMap.ZoomTo(2.0,ftrFeature.CenterX, ftrFeature.CenterY); // CurrMap.ZoomTo(2.0,100,100); CurrMap.AutoRedraw := True; end else begin</P> <P> II := Foundobj.Matches.Count; For NN:=1 to II do begin // If Foundobj.Matches.Item[NN].Score > 50 Then // ListBox1.AddItem(Foundobj.Matches.Item[NN].Name + '---' + '(' + inttostr(Foundobj.Matches.Item[NN].Score) + '%)' + CurrMap.Layers[counter].Name,1) ;ListBox1.AddItem(Foundobj.Matches.Item[NN].Name + '---' + '(' + inttostr(Foundobj.Matches.Item[NN].Score) + '%)' + CurrMap.Layers[counter].Name,self) ; // ListBox1.AddItem(Foundobj.Matches.Item[NN].Name + '---' + '(' + inttostr(Foundobj.Matches.Item[NN].Score) + '%)' + CurrMap.Layers[counter].Name,self) ; // ListBox1.AddItem(Foundobj.Matches.Item[NN].Name ,self) ; end;</P> <P> end; end; end;</P> <P> If ListBox1.Count> 0 Then ListBox1.Visible := True</P> <P> else Application.MessageBox('没有找到!','系统提示',48+MB_SYSTEMMODAL);</P> <P> end; </P> |
|
|
1楼#
发布于:2004-08-13 19:33
<P>程序运行报什么错误啊!</P>
|
|