lethe2002
路人甲
路人甲
  • 注册日期2004-06-18
  • 发帖数20
  • QQ
  • 铜币216枚
  • 威望0点
  • 贡献值0点
  • 银元0个
阅读:1202回复:0

如何实现车子移动?

楼主#
更多 发布于:2006-04-18 11:30
网上有如下代码,用于gps车子移动的,它用的是OffsetByXY,如果我直接输入经纬度实现车子移动,应怎样改写?<BR>Catalog  cat = MapInfo.Engine.Session.Current.Catalog;<BR>   Table tbl = cat.GetTable("Animation");<BR>   <BR>   if (tbl != null) <BR>   {<BR>    //Update the position of the points<BR>    SearchInfo  si = MapInfo.Data.SearchInfoFactory.SearchWhere("Name = 'Kelly'");<BR>    Feature ftr = cat.SearchForFeature(tbl, si);<BR>    SearchInfo si2 = MapInfo.Data.SearchInfoFactory.SearchWhere("Name = 'Greg'");<BR>    Feature ftr2 = cat.SearchForFeature(tbl, si2);<BR>    <BR>    <BR>    
<br>
<P><BR>    if (DateTime.Now.TimeOfDay.Seconds % 4 == 0)<BR>    {<BR>     ftr.Geometry.GeometryEditor.OffsetByXY(120.297919-ftr.Geometry.GeometricCentroid.x, 31.573062-ftr.Geometry.GeometricCentroid.y, DistanceUnit.Kilometer, DistanceType.Spherical);<BR>     ftr2.Geometry.GeometryEditor.OffsetByXY(0, 25, DistanceUnit.Mile, DistanceType.Spherical);<BR>    }<BR>       else<BR>    {<BR>     ftr.Geometry.GeometryEditor.OffsetByXY(-10, 0, DistanceUnit.Mile, DistanceType.Spherical);<BR>     ftr2.Geometry.GeometryEditor.OffsetByXY(10, 5, DistanceUnit.Mile, DistanceType.Spherical);<BR>    }<BR>     <BR>    ftr.Geometry.EditingComplete();<BR>    ftr2.Geometry.EditingComplete();<BR>    ftr.Update();<BR>    ftr2.Update();<BR>   }</P>
喜欢0 评分0
游客

返回顶部