zgl_email
路人甲
路人甲
  • 注册日期2009-03-20
  • 发帖数3
  • QQ
  • 铜币115枚
  • 威望0点
  • 贡献值0点
  • 银元0个
阅读:1974回复:1

后台线程如何更新地图数据

楼主#
更多 发布于:2009-03-30 15:44
<P>MapXtreme B/S程序中,后台线程如何更新地图数据?</P>
喜欢0 评分0
zgl_email
路人甲
路人甲
  • 注册日期2009-03-20
  • 发帖数3
  • QQ
  • 铜币115枚
  • 威望0点
  • 贡献值0点
  • 银元0个
1楼#
发布于:2009-03-31 10:53
<P>后台线程运行时,页面的地图显示失败。后台线程的代码如下,望各位高手指点</P>
<P>  private void updateFeature()<BR>  {<BR>   while(1==1)<BR>   {</P>
<P>    i+=1 ;<BR>    try<BR>    {<BR>     if(MapInfo.Engine.Session.Current.MapFactory!=null) <BR>     {<BR>      MapInfo.Mapping.Map map = MapInfo.Engine.Session.Current.MapFactory[0] ;</P>
<P>      if(map == null) return ;<BR>   <BR>      string FacilityCode = "12345" ;<BR>      string LayerName = "layer1" ;<BR>      MapInfo.Data.IResultSetFeatureCollection fc = MapInfo.Engine.Session.Current.Catalog.Search(LayerName, MapInfo.Data.SearchInfoFactory.SearchWhere("obj_code =" + FacilityCode ));<BR>      if (fc.Count == 0) return ;<BR>      if (fc == null) return ;</P>
<P>      foreach(MapInfo.Data.Feature f in fc)<BR>      {<BR>       MapInfo.Styles.AreaStyle ass = (MapInfo.Styles.AreaStyle) f.Style ;<BR>       MapInfo.Styles.SimpleInterior simpleInterior = new MapInfo.Styles.SimpleInterior() ;<BR>       int k = i ;<BR>       if( k%2 == 0)<BR>       {<BR>        simpleInterior.ForeColor = Color.Blue ;<BR>       }<BR>       else <BR>       {<BR>        simpleInterior.ForeColor = Color.Red  ;<BR>       }</P>
<P>       ass.Interior = simpleInterior ; <BR>       <BR>       f.Update() ;       }<BR>     }<BR>    }<BR>    catch(Exception er)<BR>    {<BR>     string ss = er.Message.ToString() ;  <BR>    }<BR>   }<BR>  }<BR></P>
举报 回复(0) 喜欢(0)     评分
游客

返回顶部