/// <summary> 
/// 根据查询条件构造
/// </summary> 
/// <param name="where">查询条件</param> 
public void FilterLayer(string where) 

IFeatureLayer flyr = (IFeatureLayer)axMapControl1.get_Layer(0); 
IFeatureClass fcls = flyr.FeatureClass;

IQueryFilter queryFilter = new QueryFilterClass(); 
queryFilter.WhereClause = where;

// 缩放到选择结果集,并高亮显示 
ZoomToSelectedFeature(flyr, queryFilter);

//闪烁选中得图斑 
IFeatureCursor featureCursor = fcls.Search(queryFilter, true); 
FlashPolygons(featureCursor); 
}

/// <summary> 
/// 缩放到选择结果集,并高亮显示 
/// </summary> 
/// <param name="pFeatureLyr"></param> 
/// <param name="pQueryFilter"></param> 
private void ZoomToSelectedFeature(IFeatureLayer pFeatureLyr, IQueryFilter pQueryFilter) 

#region 高亮显示查询到的要素集合

//符号边线颜色 
IRgbColor pLineColor = new RgbColor(); 
pLineColor.Red = 255; 
ILineSymbol ilSymbl = new SimpleLineSymbolClass(); 
ilSymbl.Color = pLineColor; 
ilSymbl.Width = 5;

//定义选中要素的符号为红色 
ISimpleFillSymbol ipSimpleFillSymbol = new SimpleFillSymbol(); 
ipSimpleFillSymbol.Outline = ilSymbl; 
RgbColor pFillColor = new RgbColor(); 
pFillColor.Green = 60; 
ipSimpleFillSymbol.Color = pFillColor; 
ipSimpleFillSymbol.Style = esriSimpleFillStyle.esriSFSForwardDiagonal;

//选取要素集 
IFeatureSelection pFtSelection = pFeatureLyr as IFeatureSelection; 
pFtSelection.SetSelectionSymbol = true; 
pFtSelection.SelectionSymbol = (ISymbol)ipSimpleFillSymbol; 
pFtSelection.SelectFeatures(pQueryFilter, esriSelectionResultEnum.esriSelectionResultNew, false);

#endregion

ISelectionSet pSelectionSet = pFtSelection.SelectionSet; 
//居中显示选中要素 
IEnumGeometry pEnumGeom = new EnumFeatureGeometry(); 
IEnumGeometryBind pEnumGeomBind = pEnumGeom as IEnumGeometryBind; 
pEnumGeomBind.BindGeometrySource(null, pSelectionSet); 
IGeometryFactory pGeomFactory = new GeometryEnvironmentClass(); 
IGeometry pGeom = pGeomFactory.CreateGeometryFromEnumerator(pEnumGeom);

axMapControl1.ActiveView.Extent = pGeom.Envelope; 
axMapControl1.ActiveView.Refresh(); 
}

/// <summary> 
/// 闪烁选中得图斑 
/// </summary> 
/// <param name="featureCursor"></param> 
private void FlashPolygons(IFeatureCursor featureCursor) 

IArray geoArray = new ArrayClass(); 
IFeature feature = null; 
while ((feature = featureCursor.NextFeature()) != null) 

//feature是循环外指针,所以必须用ShapeCopy 
geoArray.Add(feature.ShapeCopy); 
}

//通过IHookActions闪烁要素集合 
HookHelperClass m_pHookHelper = new HookHelperClass(); 
m_pHookHelper.Hook = axMapControl1.Object; 
IHookActions hookActions = (IHookActions)m_pHookHelper;

hookActions.DoActionOnMultiple(geoArray, esriHookActions.esriHookActionsPan); 
//hookActions.DoActionOnMultiple(geoArray, esriHookActions.esriHookActionsGraphic); 
//hookActions.DoActionOnMultiple(geoArray, esriHookActions.esriHookActionsZoom); 
Application.DoEvents(); 
m_pHookHelper.ActiveView.ScreenDisplay.UpdateWindow();

hookActions.DoActionOnMultiple(geoArray, esriHookActions.esriHookActionsFlash); 

}

from: http://www.cnblogs.com/feilong3540717/archive/2011/07/27/2118651.html

同时闪烁多个要素代码(ArcEngine)的更多相关文章

  1. ARM汇编程序闪烁灯与其反汇编代码比较

    /* *LED闪烁 *led.s */ #define GPJ0CON 0xE0200240 #define GPJ0DAT 0xE0200244 .global _start //把 _start ...

  2. ArcGIS 要素闪烁

    ArcGIS 要素闪烁 通过双击要素图例,闪烁定位到要素,并且闪烁一段时间: IFeatureLayer featureLayer = layer as IFeatureLayer;          ...

  3. arcengine 开发经典帖

    http://bbs.esrichina-bj.cn/ESRI/viewthread.php?tid=25575&page=1&extra= 使用ArcGIS Engine 开发自定义 ...

  4. arcengine 开发经典帖 【强烈推荐仔细研读】

    转自原文 arcengine 开发经典帖 使用ArcGIS Engine 开发自定义GIS应用: 第一部分:使用ArcGIS Engine 发布自定义GIS应用软件-全面了解ArcGIS Engine ...

  5. NodeMCU入门(2):在线构建、刷入固件,上传代码

    准备工作 1.NodeMCU模块 2.ESP8266Flasher.exe 3.ESPlorer v0.2.0-rc6 构建固件 Building the firmware提供了三种构建你自己固件的方 ...

  6. arcgis 要素服务增删改查

    两种方式: 第一种 要素服务的增删改操作,在ArcGIS API for JS中给我们提供了三个类用于要素的增Add,删Delete,改Update 添加draw和要素服务 //用于操作的要素图层,注 ...

  7. 关于印发利用DEM确定耕地坡度分级技术规定(试行)的通知

    下载:http://files.cnblogs.com/files/gisoracle/%E5%88%A9%E7%94%A8DEM%E7%A1%AE%E5%AE%9A%E8%80%95%E5%9C%B ...

  8. JavaScript侧边悬浮框

    <script> window.onscroll=function(){ var oDiv=document.getElementById('div1'); var scrollTop=d ...

  9. css兼容问题集合

    css兼容问题 兼容问题 1.文字本身的大小不兼容.同样是font-size:14px的宋体文字,在不同浏览器下占的空间是不一样的,ie下实际占高16px,下留白3px,ff下实际占高17px,上留白 ...

随机推荐

  1. python 自学 1 day

    #!/usr/bin/env python #coding = utf-8 age_of_oldby = 56 user = "fyt" word = "fyt" ...

  2. CLR via C# 3rd - 05 - Primitive, Reference, and Value Types

    1. Primitive Types        Any data types the compiler directly supports are called primitive types. ...

  3. html页面元素事件丢失

    前段时间做网站包括最近用mvc做oa都发现这个奇怪现象,就是页面加载完毕后页面元素事件(比如按钮点击.复选框change)一切正常,但是当执行查询或者其他操作后页面事件丢失.具体原因暂没有时间分析,现 ...

  4. Spark 累加器

    由于spark是分布式的计算,所以使得每个task间不存在共享的变量,而为了实现共享变量spark实现了两种类型 - 累加器与广播变量, 对于其概念与理解可以参考:共享变量(广播变量和累加器).可能需 ...

  5. 【Django】Django 定时任务实现(django-crontab+command)

    一.编写自定义django-admin命令 注:利用django-admin自定义命令我们可以ORM框架对model进行操作,如:定时更新数据库,检测数据库状态..... Django为项目中每一个应 ...

  6. 转~~~ DIV+CSS实现三角形提示框

    <!DOCTYPE html> <html> <head> <meta charset="UTF-8"> <link rel= ...

  7. eclipse的tomcat内在溢出

    在最前或最后加上: -Xms256m -Xmx512m -Xss2024K -XX:PermSize=128m -XX:MaxPermSize=256m

  8. dentry与inode有什么联系和区别

    我们在进程中要怎样去描述一个文件呢?我们用目录项(dentry)和索引节点(inode).它们的定义如下: struct dentry {struct inode                    ...

  9. C++命名空间问题

    名称空间支持是一项c++特性,是用来解决在编写大型程序中不同文件(厂商)中相同变量名问题.​ 例如:有两个已经封装好的产品(类)中同时包含一个名为wanda()的函数,为了能够准确调用其中一个wand ...

  10. 关于C语言的一些trick

    很多东西已经记不起来了,想到一点写一点,碰到一点写一点,慢慢累积. 关于# #在宏定义中用于替换传入变量的字符,例如: #define whole_operation(n)  do { printf( ...