从MapX到MapXtreme2004[3]-搜索图元Feature
一、根据名称搜索图元 1、Mapxtreme的架构和Mapx有所变化,Mapx中,Layer包含Features,而Mapxtreme中则不是 2、Mapxtreme的例子中的查找,是通过Find对象来实现的,而Find对象的构造,需要指定Table和Colume,Table好办,FeatureLayer.table即可,而Colume通过FeatureLayer.table.tableinfo.colums["列名"]来指定。但是,关键问题,大多数的地图,并未设计过多的字段来供查询,查的其实就是个标题和label而已。 3、要用笨办法,遍历图层的features,通过这个方法
foreach(Feature feature in lyr.table)
{
}
4、Feature派生自Object,包含一个Geometry属性,这个属性是各种几何图形对象的基类
Geometry classes that derive from FeatureGeometry include: Point, MultiPoint, MultiCurve, MultiPolygon, FeatureGeometryCollection, Rectangle, RoundedRectangle, Ellipse, LegacyArc, and LegacyText.
5、通过如下方式引用feature对象
((MapInfo.Geometry.LegacyText)feature.Geometry).Caption
二、通过search方法搜索
1、catalog的search方法可以按条件搜索图元(第一个图元)
// also uses search for feature
Feature fDEU = _catalog.SearchForFeature("europe", MapInfo.Data.SearchInfoFactory.SearchWhere
("Country='DEU'"));
2、先利用SearchInfoFactory构造一个SearchInfo对象,指定其搜索属性:
SearchAll: Returns all the rows.
SearchNearest: Returns the rows with table geometries that are closest to the given search point.
SearchWhere: Returns the rows specified by the given where Clause.
SearchWithinDistance: Returns the rows where the table geometry is contained within a buffer of the search point, rectangle or geometry.
SearchWithinFeature: Returns the rows where the table geometry is contained within the search features's geometry.
SearchWithinGeometry: Returns the rows where the table geometry is contained within the search geometry.
SearchWithinRect: Returns the rows where the table geometry intersects the given rectangle.
SearchIntersectsFeature: Returns the rows where the table geometry intersects with the search features's geometry.
SearchIntersectsGeometry: Returns the rows where the table geometry intersects with the search geometry.
SearchWithinScreenRadius: Creates a SearchInfo that returns the rows where the table geometry intersects a screen circle.
SearchWithinScreenRect:Returns the rows where the table geometry intersects the given screen rectangle
3、再调用search方法,将结果放到
MultiResultSetFeatureCollection
IResultSetFeatureCollection
4、或许还要设置视图
MapInfo.Engine.Session.Current.MapFactory[0].SetView(fc.Envelope);
三、通过选择工具来选择一个范围
1、需要控制选择的图层
2、选择的结果,通过MapInfo.Engine.Session.Current.Selections.DefaultSelection
得到一个Selection对象
3、Selection对象,是一个IResultSetFeatureCollection的集合,每个对应一个表
4、对每一个IResultSetFeatureCollection,可以通过枚举器来遍历访问
Selection sl =MapInfo.Engine.Session.Current.Selections.DefaultSelection;
IResultSetFeatureCollection fc=sl[0];
IFeatureEnumerator fn=fc.GetFeatureEnumerator();
ListBox1.Items.Clear();
while(fn.MoveNext())
if(fn.Current.Geometry.GetType().ToString()=="MapInfo.Geometry.LegacyText")
ListBox1.Items.Add(((MapInfo.Geometry.LegacyText)fn.Current.Geometry).Caption);
- 企业级Tomcat安全管理优化方案
- “妈妈”域名Mommy.com66万高价易主 现已建站
- 脸书Messenger已中招,新的加密货币挖矿病毒出现!
- Linux中MySQL配置文件my.cnf参数优化
- 干货,比较全面的c#.net公共帮助类(Common.Utility)
- Linux中如何恢复rm命令误删除的文件之extundelete编译安装及使用
- JDK1.7 安装加(一劳永逸的环境配置)
- Jquery 遍历数组之$().each方法与$.each()方法介绍
- ExtJs学习笔记(2)_Basic GridPanel[基本网格]
- Jquery 遍历数组之grep()方法介绍
- ExtJs学习笔记(1)_Hello World!
- Jquery filter()方法简介
- 加拿大滑铁卢大学刘腾博士:平行增强学习及其无人驾驶应用
- 曾六位数被秒的yadea.com 终端真是雅迪!
- JavaScript 教程
- JavaScript 编辑工具
- JavaScript 与HTML
- JavaScript 与Java
- JavaScript 数据结构
- JavaScript 基本数据类型
- JavaScript 特殊数据类型
- JavaScript 运算符
- JavaScript typeof 运算符
- JavaScript 表达式
- JavaScript 类型转换
- JavaScript 基本语法
- JavaScript 注释
- Javascript 基本处理流程
- Javascript 选择结构
- Javascript if 语句
- Javascript if 语句的嵌套
- Javascript switch 语句
- Javascript 循环结构
- Javascript 循环结构实例
- Javascript 跳转语句
- Javascript 控制语句总结
- Javascript 函数介绍
- Javascript 函数的定义
- Javascript 函数调用
- Javascript 几种特殊的函数
- JavaScript 内置函数简介
- Javascript eval() 函数
- Javascript isFinite() 函数
- Javascript isNaN() 函数
- parseInt() 与 parseFloat()
- escape() 与 unescape()
- Javascript 字符串介绍
- Javascript length属性
- javascript 字符串函数
- Javascript 日期对象简介
- Javascript 日期对象用途
- Date 对象属性和方法
- Javascript 数组是什么
- Javascript 创建数组
- Javascript 数组赋值与取值
- Javascript 数组属性和方法
- Spring Boot 通过 XML 的方式整合 MyBatis
- layUI登录界面验证码功能模块儿封装
- go语言微信公众号开发后台接口封装
- 【DB宝14】在Docker中只需2步即可拥有Oracle 11g企业版环境(11.2.0.4)
- 别忘了给gcc编译器工具链加上-fno-common选项
- 轻量安全的部署方案
- 算法集锦(34) | 强化学习| 出租车载客问题
- 前端测试题:(解析)关于ajax跨域的说法,下面错误的是?
- 什么才是定制化 IDE 的核心价值?
- RTOS内功修炼记(八)— CMSIS RTOS API,内核通用API接口
- 从零搭建Spring Boot脚手架(1):开篇以及技术选型
- 盘点 Python 10 大常用数据结构(下篇)
- 「干货」你需要了解的六种渲染模式
- 分享两个操作Java枚举的实用方法
- 从零开始强化学习:在Python笔记本中设计和解决一个任务