初探GIS Mapxtreme 根据数据集合 DataSet/DataTable 添加点

根据查询获得的dataset数据集合,添加集合中点信息,包括点的样式:
 
注:  其中要说明的是mapxtreme中样式列的类型,
 
我在数据库“点表”中添加了一个样式列为string类型,
 
在内部存在的字符为:Symbol(34,16711680,9): 
 
Symbol(shape, color, size)----------------------------------Symbol(35,0,12)
Symbol(shape,color,size,font,fontstyle,rotation)------------Symbol(64,255,12,"MapInfo Weather",17,0)
Symbol(bitmapname,color,size,customstyle)----------------Symbol("sign.bmp", 255, 18, 0)
此例仅适宜添加点集合。
 
 1  public void AddPoint(DataSet fds,Map map)
 //此处dataset在下面转化成datatble 
 2  {
 3      MapInfo.Geometry.CoordSysFactory coordSysFactory = new MapInfo.Geometry.CoordSysFactory();
 4      // MapInfo.Geometry.CoordSys coordSys = coordSysFactory.CreateLongLat(MapInfo.Geometry.DatumID.NAD83);
 5      MapInfo.Data.SpatialSchemaXY xy = new MapInfo.Data.SpatialSchemaXY();
 6      xy.XColumn = "fx";
 7      xy.YColumn = "fy";
 8      xy.DefaultStyle = new MapInfo.Styles.SimpleVectorPointStyle(); //此处先写,如果写在后面则会将设置更改为默认黑色五角星
 9      xy.StyleColumn = "MI_Style";  //样式列名
10      xy.StyleType = StyleType.MapBasicString; //这里必须StyleType.MapBasicString属性,如果是None 设置默认的样式
11      //xy.CoordSys = coordSys;
12      xy.NullPoint = "0.0, 0.0";
13      xy.CoordSys = Session.Current.CoordSysFactory.CreateFromPrjString("1, 0"); ;
14      MapInfo.Data.TableInfoAdoNet ti = new MapInfo.Data.TableInfoAdoNet("aaaa", fds.Tables[0]);
15     ti.SpatialSchema = xy;
16      MapInfo.Data.Table table = MapInfo.Engine.Session.Current.Catalog.CreateTable(ti);
17      MapInfo.Mapping.FeatureLayer lyr = new MapInfo.Mapping.FeatureLayer(table);
18     map.Layers.Add(lyr);
19    }
 
重点:mapinfo提供了MapInfo.Data.TableInfoAdoNet类库。
 
通过初始化数据集合将datatble类型数据转化为tableinfo基类型。
原文地址:https://www.cnblogs.com/googlegis/p/2978838.html