mapxtreme中 用多邊形選擇工具SelectPolygon 選定地圖后 會返回一個 選擇區域的圖層嗎
以什么樣方式 返回 是一個建立好的新圖層返回? 還是新圖元的形式返回? 如果自動返回新圖
層“Polygontable”,那下面的代碼為什么提示table=null呢
?
Catalog catalog = Session.Current.Catalog;
Table table = catalog.GetTable("polygontable"); //這里出現錯誤 table=null
MapInfo.Mapping.FeatureLayer lyr = new MapInfo.Mapping.FeatureLayer(table);
MapInfo.Data.SearchInfo si = MapInfo.Data.SearchInfoFactory.SearchWhere("Field1 = 'er' "); //這里的Field1=‘er’ 是代表選定的圖元嗎? 如果不是那代表什么?
MapInfo.Data.Feature feature = MapInfo.Engine.Session.Current.Catalog.SearchForFeature(lyr.Table, si);
MapInfo.Data.MIConnection connection = new MapInfo.Data.MIConnection();
connection.Open();
MapInfo.Data.MICommand command = connection.CreateCommand();
command.CommandText = "Select * from pointTable where PointTable.obj within @vb"; //這里VB又應該用什么參數呢
command.Parameters.Add("@vb", feature.Geometry);
command.Prepare();
MapInfo.Data.IResultSetFeatureCollection irfc = command.ExecuteFeatureCollection();
System.Windows.Forms.MessageBox.Show(irfc.Count.ToString());
command.Dispose();
connection.Close();
irfc.Close();
2 ?Field1=‘er’ ?這是什么 field是表名 還是選定區域的返回的表名?
3 @vb應該設置什么參數嗎
1 回答

30秒到達戰場
TA貢獻1828條經驗 獲得超6個贊
不會返回新圖層,被選中的圖元全都在Session.Current.Selection.DefaultSelection里
Field1是列名,@param這種形式是MiSql即MapInfo Sql的參數形式,與使用的編程語言無關
- 1 回答
- 0 關注
- 371 瀏覽
添加回答
舉報
0/150
提交
取消