总的来说MapXteme比MapX强悍得多,使用上麻烦得多,很多地方变化之大,相当于从头学起。mapxtreme
先总结一下,免得久了不看又忘了。mapxtreme
一、图元
MapXtreme中叫几何,图元对应表中的一行,用CreateFeatureGeometryColumn创建几何字段,CreateStyleColumn创建样式字段,早期版本字段名长度有限制
图元的选中情况MapInfo.Engine.Session.Current.Selections.DefaultSelection
点:Point,MultiPoint
线:MultiCurve
多边形:Polygon,MutiPolygon
二、样式
MapXtreme的样式老复杂了,例如区域样式是由边线加填充样式组成,组合方式很多,灵活倒是灵活,2005 v6.7及以上版本还可以抗锯齿、半透明
点样式:简单向量点SimpleVectorPointStyle、字体点FontPointStyle、图片BitmapPointStyle,
线样式:SimpleLineStyle
面样式:AreaStyle
二、图层
MapX下图层是图元的集合,即Layer下是Features,可以给图层添加多个字段,不过字段一多效率极低
MapXtreme中将图层变成了二维表,而且需要用MapInfo.Engine.Session.Current.Catalog来遍历(添加或获取),图层有两个名字一是图层名,二是别名(表名),别名是唯一区别图层的。
1、图层的显示
在MapXtreme中,用IsVisible查看图层显示状态。用Layer.Enable来设置显示状态。
2、图层的添加
代码如下(C#):
Catalog _catalog = MapInfo.Engine.Session.Current.Catalog;
MapInfo.Data.Table _tempTable = null;
Map _map = MapControl1.Map ;
//默认为内存表,永久表应使用参数MapInfo.Data.TableType.Native
TableInfo ti = TableInfoFactory.CreateTemp("临时");
//创建geometry列
ti.Columns.Add(MapInfo.Data.ColumnFactory.CreateFeatureGeometryColumn("Obj", CoordSys));
//创建MI_Style列
ti.Columns.Add(MapInfo.Data.ColumnFactory.CreateStyleColumn());
//向表信息中添加自定义字段
ti.Columns.Add(MapInfo.Data.ColumnFactory.CreateIntColumn("Index"));
ti.Columns.Add(MapInfo.Data.ColumnFactory.CreateStringColumn("Name", 50));
//永久表需设置文件的全路径,Temporary = false
ti.TablePath = tlbFilePath;
ti.Temporary = false;
_tempTable = _catalog.CreateTable(ti);
_map.Layers.Insert(0, new FeatureLayer(_tempTable));
本文来自电脑杂谈,转载请注明本文网址:
http://www.pc-fly.com/a/tongxinshuyu/article-33755-1.html
看完觉得好尴尬
气死我啦
更需战略战术把舵导航