阅读:1570回复:1
有经度,纬度,如何在mo2.3上相应位置画点
<P>procedure TForm1.Map1MouseMove(Sender: TObject; Shift: TShiftState; X,<BR> Y: Integer);<BR>var<BR>P1 : MapObjects2_TLB.Point;<BR>begin<BR> P1 := Map1.ToMapPoint(X,Y);<BR> StatusBar1.Panels.Items[2].Text := Format('经度=%.4f,纬度=%.4f',[(P1.X+1100782.530)*0.01099,(P1.Y+582812.204)*0.005277]);//鼠标掠过时显示坐标<BR>end;</P>
<P>procedure TForm1.Map1MouseDown(Sender: TObject; Button: TMouseButton;<BR> Shift: TShiftState; X, Y: Integer);<BR>var<BR> tl : IMoTrackingLayer;<BR> begin<BR> tl := Map1.Trackinglayer;<BR> if SpeedButton1.down =true then<BR> begin<BR> pt := IMoPoint(CreateOleObject('MapObjects2.Point'));//这里是画点的代码<BR> pt :=Map1.ToMapPoint(x,y);<BR> tl.AddEvent(pt,0);<BR> end<BR> else<BR> begin<BR> if (Button = mbLeft) then<BR> Map1.Extent := Map1.TrackRectangle<BR> else<BR> Map1.Pan;<BR> end;<BR>end;</P> <P>Edit4.text和Edit5.text 显示的是接收到的经度纬度,格式都是=%.4f和MouseMove的一样,用的是mo2.3,请问如何把Edit4.text和Edit5.text在地图的相应位置画个点, 用一个buttenclick实现?</P> |
|
1楼#
发布于:2007-05-11 16:22
<P>试试用 FromMapPoint看看!</P>
|
|