初探GIS Mapxtreme 添加自定义图元 bmp

添加自定义 图元,将bmp 放入 C:\Program Files\Common Files\MapInfo\MapXtreme\6.8.0\CustSymb目录下

这个 6.8.0 是版本号。

  
/// <summary>
/// 添加自定义图元
/// </summary>
/// <param name="dPoint"> 点坐标 </param>
public void AddCustomFeature(DPoint dPoint)
{
TableInfoMemTable tableInfoMemTable
= new TableInfoMemTable( " temp " );
tableInfoMemTable.Columns.Add(ColumnFactory.CreateFeatureGeometryColumn(map.GetDisplayCoordSys()));
tableInfoMemTable.Columns.Add(ColumnFactory.CreateStyleColumn());
// 样式列
Table table = MapInfo.Engine.Session.Current.Catalog.CreateTable(tableInfoMemTable);
FeatureLayer featureLayer
= new FeatureLayer(table);
map.Layers.Add(featureLayer);

FeatureGeometry featureGeometry
= new MapInfo.Geometry.Point(featureLayer.CoordSys, dPoint);
BitmapPointStyle bitmapPointStyle
= new BitmapPointStyle( " chinaz2.BMP " , BitmapStyles.None, new System.Drawing.Color(), 25 );
CompositeStyle compositeStyle
= new CompositeStyle(bitmapPointStyle);

Feature feature
= new Feature(featureLayer.Table.TableInfo.Columns);
feature.Geometry
= featureGeometry;
feature.Style
= compositeStyle;

featureLayer.Table.InsertFeature(feature);
}

你可能感兴趣的:(map)