阅读:1974回复:1
后台线程如何更新地图数据
<P>MapXtreme B/S程序中,后台线程如何更新地图数据?</P>
|
|
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> |
|