b2科目四模拟试题多少题驾考考爆了怎么补救
b2科目四模拟试题多少题 驾考考爆了怎么补救

mapxtreme_mapxtreme 售价_判断点是否在面内(4)

电脑杂谈  发布时间:2017-03-08 04:07:58  来源:网络整理

7、问:如何在一个Web应用中将打开的SpatialWare地图存储成为一个文件?

答:代码如下:

MIConnection Connection =new MIConnection ();

Connection.Open() ;

TableInfoServer tis = new TableInfoServer("usa",

"dsn=sqlserver;UID=sa;PWD=zackary","Select * from usa",MapInfo.Data.ServerToolkit.Odbc );

MapInfo.Data.Table StateCapXY = Connection.Catalog.OpenTable(tis);

mapControl1.Map.Load(new MapTableLoader(StateCapXY ));

MapInfo.Mapping.FeatureLayer lyr=mapControl1.Map.Layers["USA"] as FeatureLayer ;

MapInfo.Data.Table ti = MapInfo.Engine.Session.Current.Catalog.GetTable("usa");

MapInfo.Data.SearchInfo si = MapInfo.Data.SearchInfoFactory.SearchAll();

si.QueryDefinition.SetColumns("*");

MapInfo.Data.IResultSetFeatureCollection irfc = MapInfo.Engine.Session.Current.Catalog.Search(ti.Alias, si);

MapInfo.Data.TableInfoNative tf = (MapInfo.Data.TableInfoNative)MapInfo.Data.TableInfoFactory.CreateFromFeatureCollection("newtab",MapInfo.Data.TableType.Native ,irfc);

foreach(MapInfo.Data.Column cl in tf.Columns)

{

cl.ReadOnly =false;

}

tf.TablePath = "c:\\temp\\newtab.tab";

tf.WriteTabFile ();

MapInfo.Data.Table t = MapInfo.Engine.Session.Current.Catalog.CreateTable (tf);

MapInfo.Engine.Session.Current.Catalog.CloseTable("newtab");

t=MapInfo.Engine.Session.Current.Catalog.OpenTable("c:\\temp\\newtab.tab");

mapControl1.Map.Load(new MapTableLoader(t));

MapInfo.Data.MICommand micomm=new MapInfo.Data.MICommand ("insert into " + t.Alias + " (obj,state,state_name,sw_member) select obj,state,state_name,sw_member from usa", Connection);


本文来自电脑杂谈,转载请注明本文网址:
http://www.pc-fly.com/a/tongxinshuyu/article-36378-4.html

相关阅读
    发表评论  请自觉遵守互联网相关的政策法规,严禁发布、暴力、反动的言论

    每日福利
    热点图片
    拼命载入中...