阅读:1524回复:1
mapXtreme中列属性赋值的问题,求救
<P><BR>建表信息如下:<BR> currentTable = "NativeTable";<BR> tableInfoNative = new MapInfo.Data.TableInfoNative(currentTable);<BR> tableInfoNative.TablePath = @savefd.FileName;<BR> tableInfoNative.Columns.Add(MapInfo.Data.ColumnFactory.CreateIntColumn("ID"));<BR> tableInfoNative.Columns.Add(MapInfo.Data.ColumnFactory.CreateStyleColumn());<BR> MapInfo.Geometry.CoordSys coordSys = mapControl1.Map.GetDisplayCoordSys();<BR> tableInfoNative.Columns.Add(MapInfo.Data.ColumnFactory.CreateFeatureGeometryColumn(coordSys));<BR> table = MapInfo.Engine.Session.Current.Catalog.CreateTable(tableInfoNative);<BR> MapInfo.Mapping.FeatureLayer featureLayer = new MapInfo.Mapping.FeatureLayer(table);<BR> this.mapControl1.Map.Layers.Add(featureLayer);<BR> MapInfo.Mapping.LayerHelper.SetEditable(featureLayer, true);<BR> MapInfo.Mapping.IMapLayerFilter filter = MapInfo.Mapping.MapLayerFilterFactory.FilterByTable(table);<BR> this.mapControl1.Tools.AddMapToolProperties.InsertionLayerFilter = filter;<BR> this.mapControl1.Map.Invalidate();<BR> this.mapControl1.Map.Zoom = this.mapControl1.Map.Zoom;</P>
<P>然后添加图元</P> <P> MapInfo.Styles.BitmapPointStyle bitmappointstyle = new MapInfo.Styles.BitmapPointStyle("pump.bmp", MapInfo.Styles.BitmapStyles.None, new Color(), 30);<BR> MapInfo.Geometry.Point point = new MapInfo.Geometry.Point(this.mapControl1.Map.GetDisplayCoordSys(), e.MapCoordinate.x, e.MapCoordinate.y);<BR> MapInfo.Data.Feature ftr = new MapInfo.Data.Feature(point, bitmappointstyle);<BR> MapInfo.Data.Table tab = MapInfo.Engine.Session.Current.Catalog.GetTable(currentTable);<BR> tab.InsertFeature(ftr);<BR>tableInfo中有一列叫"ID",我想为图元的ID列赋值,于是在上面程序中加入了ftr["ID"]= 12345;<BR>但是出现了数组越界的错误,请问应该如何正确地为列赋值呢?谢谢</P> |
|
1楼#
发布于:2006-10-17 19:41
<img src="images/post/smile/dvbbs/em06.gif" />
|
|