ArcGIS 要素闪烁

通过双击要素图例,闪烁定位到要素,并且闪烁一段时间:

IFeatureLayer featureLayer = layer as IFeatureLayer;
                    ITable table = featureLayer as ITable;
                    IRow row = table.GetRow((int)data);
                    IFeature feature = row as IFeature;                   
                    IEnvelope envelope = feature.Shape.Envelope;                   
                    switch(feature.Shape.GeometryType)
                    {
                        case esriGeometryType.esriGeometryPoint:
                            IPoint point = feature.Shape as IPoint;
                            envelope.Expand(2.7, 2.7, true);
                            axMapControl1.FlashShape(point, 1, 300, null);
                            axMapControl1.Extent = envelope;
                            Application.DoEvents();
                            axMapControl1.Refresh();
                            axMapControl1.FlashShape(point, 6, 300, null);
                            break;
                        case esriGeometryType.esriGeometryPolyline:
                            IPolyline polyline = feature.Shape as IPolyline;
                            envelope.Expand(1.7, 1.7, true);
                            axMapControl1.FlashShape(polyline, 1, 300, null);
                            axMapControl1.Extent = envelope;
                            Application.DoEvents();
                            axMapControl1.Refresh();
                            axMapControl1.FlashShape(polyline, 15, 300, null);
                            break;
                        case esriGeometryType.esriGeometryPolygon:
                            IPolygon polygon = feature.Shape as IPolygon;
                            envelope.Expand(1.7, 1.7, true);
                            axMapControl1.FlashShape(polygon, 1, 300, null);
                            axMapControl1.Extent = envelope;
                            Application.DoEvents();
                            axMapControl1.Refresh();
                            ITopologicalOperator topOperator = polygon as ITopologicalOperator;
                            IPolyline line = new PolylineClass();
                            line=topOperator.Boundary as IPolyline;
                            axMapControl1.FlashShape(line, 15, 300, null);
                            break;

}

第一种:通过FlashShape来实现闪烁功能

public void PositionFlashElement(AxMapControl axMapControl, IElement pElement)
{
IGeometry pGeometry = pElement.Geometry;
ICartographicLineSymbol ipCartographicLineSymbol;
ISimpleFillSymbol ipSimpleFillSymbol;
ISimpleMarkerSymbol ipSimpleMarkersymbol;
ISymbol ipSymbol = null;
IRgbColor ipColor;
IPoint pPoint = new PointClass();
pPoint.X = pGeometry.Envelope.LowerLeft.X + pGeometry.Envelope.Width / 2;
pPoint.Y = pGeometry.Envelope.LowerLeft.Y + pGeometry.Envelope.Height / 2;
axMapControl.CenterAt(pPoint);
//pGeometry.Envelope.LowerLeft
int Size;

ipColor = new RgbColor();
ipColor.Red = 255;
Size = 10;

//esriGeometryType type = pGeometry.GeometryType;

if (type == esriGeometryType.esriGeometryPolyline)
{
ipCartographicLineSymbol = new CartographicLineSymbol();

ipSymbol = (ISymbol)ipCartographicLineSymbol;
ipSymbol.ROP2 = esriRasterOpCode.esriROPNotXOrPen;
ipCartographicLineSymbol.Width = Size;
ipCartographicLineSymbol.Color = ipColor;
}
else if (type == esriGeometryType.esriGeometryPolygon)
{
ipSimpleFillSymbol = new SimpleFillSymbol();
ipSymbol = (ISymbol)ipSimpleFillSymbol;
ipSimpleFillSymbol.Color = ipColor;
}
else if (type == esriGeometryType.esriGeometryPoint || type == esriGeometryType.esriGeometryMultipoint)
{
ipSimpleMarkersymbol = new SimpleMarkerSymbol();
ipSymbol = (ISymbol)ipSimpleMarkersymbol;
ipSymbol.ROP2 = esriRasterOpCode.esriROPWhite;
ipSimpleMarkersymbol.Color = ipColor;
ipSimpleMarkersymbol.Size = 20;
}
axMapControl.FlashShape(pGeometry, 3, 300, ipSymbol);
}
 
        第二种:编辑自己闪烁的对象
 自己定义一个FlashObjectsClass类来完成闪烁的功能,网上很对这样类的原代码.
     //获取对应要素
            LayerIdentifiedResult layerResult = identifiedResultsList[layerIndex];
            //点击了图层下的要素
            if (featureIndex > -1)
            {
                IFeatureIdentifyObj identifyObjDefault = layerResult.IdentifiedFeatureObjList[featureIndex];
                IFeature featureDefault = (identifyObjDefault as IRowIdentifyObject).Row as IFeature;
                //显示属性
                ShowFeatureAttributes(featureDefault);
                //判断是否闪烁要素
                if (doFlash)
                {
                    (identifyObjDefault as IIdentifyObj).Flash(associateMapControl.ActiveView.ScreenDisplay);
                }
            }
            //点击了图层,同时闪烁图层下的所有要素图形
            else
            {
                flashObjects.FlashObjects(layerResult);
            }
 
 第三种:结合IHookActions的DoAction方法并搭上esriHookActionsFlash动作,这样做效果很接近arcmap中的效果,速度也比较快。
 
          Action方面有6个constant,可以根据需要选择.

Constant

Value

Description

esriHookActionsFlash

0

Flash the geometry.

esriHookActionsPan

1

Pan to the geometry.

esriHookActionsZoom

2

Zoom to the geometry.

esriHookActionsGraphic

3

Create a graphic for the geometry.

esriHookActionsLabel

4

Create a graphic and label for the geometry.

esriHookActionsCallout

5

Create a callout for the geometry.

 

完成闪烁的代码如下:

IHookActions hookActions;
hookActions.DoAction(feature.Shape, esriHookActions.esriHookActionsPan);

 Application.DoEvent();
hookActions.DoAction(feature.Shape,esriHookActions.esriHookActionsFlash);

第四种   接口IIdentify的返回对象IFeatureIdentifyObj也可以实现这个功能。特摘录代码如下:

Dim pEnvs As IEnvelope
pEnvs = AxMapControl1.TrackRectangle

Dim pLayer As IFeatureLayer
pLayer = pMainMap.Layer(0)
Dim pIdentify As IIdentify
pIdentify = pLayer
Dim pArr As IArray
pArr = pIdentify.Identify(pEnvs)

Dim pFtIdenObj As IFeatureIdentifyObj
Dim pIdenObj As IIdentifyObj
If Not pArr Is Nothing Then
Dim j As Integer
For j = 0 To pArr.Count - 1
        pFtIdenObj = pArr.Element(j)
        pIdenObj = pFtIdenObj
        pIdenObj.Flash(pMainAV.ScreenDisplay)
        pIdenObj = Nothing
        pFtIdenObj = Nothing
Next
End If

ArcGIS 要素闪烁的更多相关文章

  1. ArcGIS 要素类平移工具-arcgis案例实习教程

    ArcGIS 要素类平移工具-arcgis案例实习教程 联系方式:谢老师,135-4855-4328,xiexiaokui#qq.com 目的:对整个要素类,按指定偏移距离,进行整体平移. 优点:使用 ...

  2. DWG 对象与ArcGIS 要素的强制对应关系

    转自原文DWG 对象与ArcGIS 要素的强制对应关系 DWG 对象与ArcGIS 要素的强制对应关系如下: Feature type DWG object types   Point Point, ...

  3. ArcGIS 要素类整体平移工具-arcgis/arcpy/模型构建器案例实习教程

    ArcGIS 要素类整体平移工具-arcgis/arcpy/模型构建器案例实习教程 联系方式:谢老师,135-4855_4328,xiexiaokui#qq.com 目的:对整个要素类,按指定偏移距离 ...

  4. arcgis 要素服务增删改查

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

  5. ArcGIS 要素合并

    1.选择工具 2.选择输入要素.输出要素.按照什么字段进行合并 3.查看融合结果 4.GP工具-创建GP模型 拖入“融合”工具,设置融合的参数,如下图: 右击左边椭圆,勾选 模型参数 右击右边椭圆,勾 ...

  6. Arcgis Javascript API 开发笔记

    JS API3.4的要求 à(1)  IE9或以上版本 否则dijit1.8.3不匹配 1.如何发布ArcgisJavascript API应用 0.准备工作: (1).有web应用: (2).有js ...

  7. AO Identify地图交互

    转自supernever文章 Identify 1.框选要素高亮显示 private void axMapControl1_OnMouseDown(object sender, ESRI.ArcGIS ...

  8. 2013Esri全球用户大会之互操作和标准

    1:Esri在开源领域做过哪些工作? Esri一直以来就是开源技术的用户和支持者.我们相信,通过提供从上到下的开放平台可使我们的用户成为开发能力强大的解决方案的积极参与者.在现有技术形势下,我们正在将 ...

  9. QGIS练手 - 数据

    又熬夜了... 这篇博客可能会将QGIS数据管理部分和ArcGIS数据管理进行对比学习. 1. 本地数据文件与数据库(矢量) 1.1 文件 QGIS用的是shp文件.kml文件.geojson文件较多 ...

随机推荐

  1. 完整table

    .table-bordered{ border:1px solid #cccccc; } .table { border-spacing: 0;/*设置或检索当表格边框独立时(即border-coll ...

  2. linux常用命令:/etc/group文件详解

    Linux /etc/group文件与/etc/passwd和/etc/shadow文件都是有关于系统管理员对用户和 用户组管理时相关的文件.linux /etc/group文件是有关于系统管理员对用 ...

  3. c++第十七天

    p101~p104: 1.数组中的元素个数也属于数组类型的一部分. 2.编译的时候数组的维度应该是已知的,也就是说维度必须是 const expression 3.const expression 是 ...

  4. 20145303刘俊谦 Exp7 网络欺诈技术防范

    20145303刘俊谦 Exp7 网络欺诈技术防范 1.实验后回答问题 (1)通常在什么场景下容易受到DNS spoof攻击 局域网内的攻击,arp入侵攻击和DNS欺骗攻击 公共wifi点上的攻击. ...

  5. 20145310《网络对抗》Exp2 后门原理与实践

    实验内容 (1)使用netcat获取主机操作Shell,cron启动,使用socat获取主机操作Shell, 任务计划启动. (2)使用MSF meterpreter生成可执行文件,利用ncat或so ...

  6. [c/c++]指针(3)

    在指针2中提到了怎么用指针申配内存,但是,指针申配的内存不会无缘无故地 被收回.很多poj上的题都是有多组数据,每次地数组大小会不同,所以要重新申请 一块内存.但是原来的内存却不会被收回,也是说2.3 ...

  7. luogu P2073 送花 线段树

    思路&心路 一眼认定沙比提 写的比较慢,写了1小时吧 开心的交上去 卧槽,只有20? 不服不服,拿着题解的代码去对拍 Emma,<100没问题 100000数据错了,还只是错了一个数据 ...

  8. POJ 1236 Network of Schools(tarjan)题解

    题意:一个有向图.第一问:最少给几个点信息能让所有点都收到信息.第二问:最少加几个边能实现在任意点放信息就能传遍所有点 思路:把所有强连通分量缩成一点,然后判断各个点的入度和出度 tarjan算法:问 ...

  9. swift设计模式学习 - 策略模式

    移动端访问不佳,请访问我的个人博客 设计模式学习的demo地址,欢迎大家学习交流 策略模式 策略模式定义了算法家族,分别封装起来,让它们之间可以相互替换,此模式让算法的变化,不会影响到使用算法的客户. ...

  10. phantomjs在win10下的安装

    phantomjs只能通过官网下载,下载地址:http://phantomjs.org/download.html. 1.最好下载在英文文件夹下.下载完成后,解压. 2.进入bin文件,右击属性,将p ...