070918搜索图元 定位

MapInfo.Engine.Session.Current.Selections.DefaultSelection.Clear();
   Selection  isf=MapInfo.Engine.Session.Current.Selections[0];
   SearchInfo si = MapInfo.Data.SearchInfoFactory.SearchWhere("siteId like '%" + test + "%'");
   MapInfo.Data.IResultSetFeatureCollection result=MapInfo.Engine.Session.Current.Catalog.Search(this.tableName,si);

既然是Collection,那就是可以枚举的

foreach(Feature f in table)
{
...
}

string sef = "";//字段值
string strTable = "";//表名

 MapInfo.Data.QueryFilter filter = new MapInfo.Data.SqlExpressionFilter(sef);


    MapInfo.Data.QueryDefinition qd = new MapInfo.Data.QueryDefinition(filter, "*");
    MapInfo.Data.SearchInfo si = new MapInfo.Data.SearchInfo(null, qd);
    MapInfo.Data.IResultSetFeatureCollection fc = null;
 

    if (MapInfo.Engine.Session.Current.Catalog.GetTable(strTable) != null)
    {
     fc=MapInfo.Engine.Session.Current.Catalog.Search(strTable,si);               
    }

     if (fc != null)
     {
      if (fc.Envelope != null)//Envelope 类 表示与坐标系封装的矩形。从 Geometry 派生。Envelope 类从 Geometry 派生,表示封装在坐标系的矩形。Envelope 类的一项主要作用就是封装作为 Geometry 的 Bounds (Minimum Bounding Rectangle)。Envelope 从 Geometry.Envelope 属性返回。

      {
       this.GetMapObj().SetView(fc.Envelope);

       int kil = Convert.ToInt32(this.DropDownList_Dis.SelectedItem.Text);
       this.GetMapObj().Zoom = new MapInfo.Geometry.Distance(kil, DistanceUnit.Kilometer);
      
       Map map = GetMapObj();

       MapInfo.Engine.Session.Current.Selections.DefaultSelection.Style.LineStyle = new MapInfo.Styles.SimpleLineStyle(new MapInfo.Styles.LineWidth(7, MapInfo.Styles.LineWidthUnit.Pixel), 2, System.Drawing.Color.Red);
       MapInfo.Engine.Session.Current.Selections.DefaultSelection.Clear();
       MapInfo.Engine.Session.Current.Selections.DefaultSelection.Add(fc);
      
       MapInfo.Geometry.DPoint dpt1 = fc.Envelope.GeometricCentroid;
      
      }
     }

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值