文章详情

  • 游戏榜单
  • 软件榜单
关闭导航
热搜榜
热门下载
热门标签
php爱好者> php文档>ArcGIS 要素闪烁

ArcGIS 要素闪烁

时间:2010-08-19  来源:St.Dlng

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

/// <summary>
/// 定位闪烁元素
/// </summary>
/// <param name="axMapControl"></param>
/// <param name="pElement"></param>
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

排行榜 更多 +
翌日波奇狗的历险记手机版下载

翌日波奇狗的历险记手机版下载

休闲益智 下载
怪兽远征安卓版下载

怪兽远征安卓版下载

角色扮演 下载
谷歌卫星地图免费版下载

谷歌卫星地图免费版下载

生活实用 下载