
ateFeatureGeometryColumn(map.GetDisplayCoordSys()));
tblInfoTemp.Columns.Add(ColumnFactory.CreateStyleColumn());
tblInfoTemp.Columns.Add(ColumnFactory.CreateStringColumn('Name',40));
tblInfoTemp.Columns.Add(ColumnFactory.CreateStringColumn('Dept',15));
tblInfoTemp.Columns.Add(ColumnFactory.CreateIntColumn('Level'));
tblTemp = Cat.CreateTable(tblInfoTemp);
FeatureLayer lyr = new FeatureLayer(tblTemp);
map.Layers.Add(lyr);
}
//添加图元
public void insert_feature(string fileName,double x,double y,stringGPS_NUMBER)
{
BitmapPointStyle bStyle = new BitmapPointStyle(fileName);//fileName格式为@'gpscar2_p2.bmp' 这个@代表C:\Program Files\CommonFiles\MapInfo\MapXtreme\6.7.1\CustSymb
bStyle.PointSize = Convert.ToInt16(24);
bStyle.NativeSize = true;
bStyle.Attributes = StyleAttributes.PointAttributes.BaseAll;
bStyle.SetApplyAll();
FeatureGeometry pt = newMapInfo.Geometry.Point(map.GetDisplayCoordSys(), new DPoint(y, x))as FeatureGeometry;
Feature ftr = new Feature(tblTemp.TableInfo.Columns);
ftr.Geometry = pt; //图元地理位置设置
ftr.Style = bStyle; //图元为位图样式
ftr['Name'] = 'aaaa';
ftr['Dept'] = GPS_NUMBER; //GPS终端号
ftr['Level'] = 2;
tblTemp.InsertFeature(ftr); //插入图元
}
//加图层标注
public void creat_mark()
{
MapInfo.Data.Table tblTemp = Cat.GetTable('Animation');
LabelSource labelSource = new LabelSource(tblTemp);//给所创建的临时表Animation中的图元加标注
//指定要标准字段所在的列
labelSource.DefaultLabelProperties.Caption = 'Name';//所要标注的列名
labelSource.DefaultLabelProperties.Layout.Offset = 8; //标注偏移
labelSource.DefaultLabelProperties.Layout.Alignment =MapInfo.Text.Alignment.TopRight;//标注对齐方式
本文来自电脑杂谈,转载请注明本文网址:
http://www.pc-fly.com/a/tongxinshuyu/article-28217-1.html