MapXtreme2004常用代码
2009-12-14 16:29
337 查看
1、加载地图,选择图层
if(!Page.IsPostBack)
{
MapControl1.Map.Clear();
MapControl1.Map.Load(MapLoader.CreateFromFile(Server.MapPath("/mymap")+"\\map\\xy.gst"));
MapControl1.SelectableLayers.Clear();
MapControl1.SelectableLayers.Add("o地名p");
}
可以把图层当成一个结果集
(_tempTable as IFeatureCollection).Clear();
2、遍历所有结果集
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);
3、根据关键字获得(第一个)图元
MapInfo.Engine.Session.Current.Catalog.SearchForFeature("Layer1",MapInfo.Data.SearchInfoFactory.SearchWhere("MI_Key='"+strKey+"'") )
if(!Page.IsPostBack)
{
MapControl1.Map.Clear();
MapControl1.Map.Load(MapLoader.CreateFromFile(Server.MapPath("/mymap")+"\\map\\xy.gst"));
MapControl1.SelectableLayers.Clear();
MapControl1.SelectableLayers.Add("o地名p");
}
可以把图层当成一个结果集
(_tempTable as IFeatureCollection).Clear();
2、遍历所有结果集
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);
3、根据关键字获得(第一个)图元
MapInfo.Engine.Session.Current.Catalog.SearchForFeature("Layer1",MapInfo.Data.SearchInfoFactory.SearchWhere("MI_Key='"+strKey+"'") )
相关文章推荐
- MapXtreme2004常用代码
- MapXtreme2004代码 MapControl控件中显示地图文件
- MapXtreme2004代码 搜索特定图元并将其显示到地图上
- MapXtreme2004代码 之 自定义范围主题地图
- MapXtreme2004代码 之 自定义范围主题地图
- MapXtreme2004代码 读取TAB表中的元素
- mapxtreme2004经典代码之一:添加几何对象
- MapXtreme2004代码 之 自定义范围主题地图
- 应用MapXtreme2004开发GIS代码(C#) 搜索TAB表中的元素
- 开始在这个BLOG里放一部分MapXtreme2004相关代码
- MapXtreme2004代码 几个地图工具的使用(C#)
- 应用MapXtreme2004开发GIS代码(C#) 搜索TAB表中的元素
- MapXtreme2004代码 搜索特定图元并将其显示到地图上
- MapXtreme2004代码 在地图上新增加点图元
- MapXtreme2004代码 搜索指定点的最近图元(SearchNearst)
- MapXtreme2004代码 读取TAB表中的元素
- MapXtreme2004代码 读取TAB表中的元素
- MapXtreme2004代码 简单专题图的显示
- 15个常用JS优化代码技巧
- 30个redis常用代码例子