MapInfo.Data.SpatialSchemaXY xy = new MapInfo.Data.SpatialSchemaXY();
xy.XColumn = "X";
xy.YColumn = "Y";
xy.NullPoint = "0.0, 0.0";
xy.StyleType = MapInfo.Data.StyleType.None;
xy.DefaultStyle = new MapInfo.Styles.CompositeStyle();
xy.CoordSys = MapInfo.Engine.Session.Current.CoordSysFactory.CreateLongLat(MapInfo.Geometry.DatumID.WGS84);
//建立TableInfo
MapInfo.Data.TableInfoServer ti = new MapInfo.Data.TableInfoServer("Customers","Driver={SQL Server};Server=LIXIAOHUI;Database=test;Uid=sa;Pwd=sa;","select * from Us_Cust",MapInfo.Data.ServerToolkit.Odbc);
ti.SpatialSchema = xy;
MapInfo.Data.Table miCustomers = MapInfo.Engine.Session.Current.Catalog.OpenTable (ti);
MapInfo.Mapping.FeatureLayer featureLayer = new MapInfo.Mapping.FeatureLayer(miCustomers);
mapControl1.Map.Layers.Add(featureLayer);
mapControl1.Map.SetView(featureLayer);
3.如何查看整个地图
Map map = mapControl1.Map;
IMapLayerFilter lyrFilter = MapLayerFilterFactory.FilterByType(typeof(FeatureLayer));
MapLayerEnumerator lyrEnum= map.Layers.GetMapLayerEnumerator(lyrFilter);
map.SetView(lyrEnum);
或者:
Map map = mapControl1.Map;
IMapLayerFilter lyrFilter = new FilterByLayerType(LayerType.Normal);
MapLayerEnumerator lyrEnum= map.Layers.GetMapLayerEnumerator(lyrFilter);
map.SetView(lyrEnum);
本文来自电脑杂谈,转载请注明本文网址:
http://www.pc-fly.com/a/tongxinshuyu/article-27878-7.html
没有女人好睡
美国害的伊拉克还不够惨吗