liuguanhua
路人甲
路人甲
  • 注册日期2006-06-30
  • 发帖数3
  • QQ
  • 铜币122枚
  • 威望0点
  • 贡献值0点
  • 银元0个
阅读:1524回复:1

mapXtreme中列属性赋值的问题,求救

楼主#
更多 发布于:2006-10-17 14:40
<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>
喜欢0 评分0
whmwxhanshan123
路人甲
路人甲
  • 注册日期2006-06-17
  • 发帖数3108
  • QQ
  • 铜币6445枚
  • 威望0点
  • 贡献值0点
  • 银元0个
1楼#
发布于:2006-10-17 19:41
<img src="images/post/smile/dvbbs/em06.gif" />
举报 回复(0) 喜欢(0)     评分
游客

返回顶部