![]()
使用IScreenDisplay实现
1
public static void FlashGeometry(IGeometry geometry, IScreenDisplay screenDisplay, IRgbColor rgbColor, Int32 delay)
2
{
3
if (geometry == null || rgbColor == null || screenDisplay == null)
4
{
5
return;
6
}
7
8
screenDisplay.StartDrawing(screenDisplay.hDC, (System.Int16)ESRI.ArcGIS.Display.esriScreenCache.esriNoScreenCache); // Explicit Cast
9
10
switch (geometry.GeometryType)
11
{
12
case ESRI.ArcGIS.Geometry.esriGeometryType.esriGeometryPolygon:
13
{
14
//Set the flash geometry's symbol.
15
ESRI.ArcGIS.Display.ISimpleFillSymbol simpleFillSymbol = new ESRI.ArcGIS.Display.SimpleFillSymbolClass();
16
simpleFillSymbol.Color = rgbColor;
17
ESRI.ArcGIS.Display.ISymbol symbol = simpleFillSymbol as ESRI.ArcGIS.Display.ISymbol; // Dynamic Cast
18
symbol.ROP2 = ESRI.ArcGIS.Display.esriRasterOpCode.esriROPNotXOrPen;
19
20
//Flash the input polygon geometry.
21
screenDisplay.SetSymbol(symbol);
22
screenDisplay.DrawPolygon(geometry);
23
System.Threading.Thread.Sleep(delay);
24
screenDisplay.DrawPolygon(geometry);
25
break;
26
}
27
28
case ESRI.ArcGIS.Geometry.esriGeometryType.esriGeometryPolyline:
29
{
30
//Set the flash geometry's symbol.
31
ESRI.ArcGIS.Display.ISimpleLineSymbol simpleLineSymbol = new ESRI.ArcGIS.Display.SimpleLineSymbolClass();
32
simpleLineSymbol.Width = 4;
33
simpleLineSymbol.Color = rgbColor;
34
ESRI.ArcGIS.Display.ISymbol symbol = simpleLineSymbol as ESRI.ArcGIS.Display.ISymbol; // Dynamic Cast
35
symbol.ROP2 = ESRI.ArcGIS.Display.esriRasterOpCode.esriROPNotXOrPen;
36
37
//Flash the input polyline geometry.
38
screenDisplay.SetSymbol(symbol);
39
screenDisplay.DrawPolyline(geometry);
40
System.Threading.Thread.Sleep(delay);
41
screenDisplay.DrawPolyline(geometry);
42
break;
43
}
44
45
case ESRI.ArcGIS.Geometry.esriGeometryType.esriGeometryPoint:
46
{
47
//Set the flash geometry's symbol.
48
ESRI.ArcGIS.Display.ISimpleMarkerSymbol simpleMarkerSymbol = new ESRI.ArcGIS.Display.SimpleMarkerSymbolClass();
49
simpleMarkerSymbol.Style = ESRI.ArcGIS.Display.esriSimpleMarkerStyle.esriSMSCircle;
50
simpleMarkerSymbol.Size = 12;
51
simpleMarkerSymbol.Color = rgbColor;
52
ESRI.ArcGIS.Display.ISymbol symbol = simpleMarkerSymbol as ESRI.ArcGIS.Display.ISymbol; // Dynamic Cast
53
symbol.ROP2 = ESRI.ArcGIS.Display.esriRasterOpCode.esriROPNotXOrPen;
54
55
//Flash the input point geometry.
56
screenDisplay.SetSymbol(symbol);
57
screenDisplay.DrawPoint(geometry);
58
System.Threading.Thread.Sleep(delay);
59
screenDisplay.DrawPoint(geometry);
60
break;
61
}
62
63
case ESRI.ArcGIS.Geometry.esriGeometryType.esriGeometryMultipoint:
64
{
65
//Set the flash geometry's symbol.
66
ESRI.ArcGIS.Display.ISimpleMarkerSymbol simpleMarkerSymbol = new ESRI.ArcGIS.Display.SimpleMarkerSymbolClass();
67
simpleMarkerSymbol.Style = ESRI.ArcGIS.Display.esriSimpleMarkerStyle.esriSMSCircle;
68
simpleMarkerSymbol.Size = 12;
69
simpleMarkerSymbol.Color = rgbColor;
70
ESRI.ArcGIS.Display.ISymbol symbol = simpleMarkerSymbol as ESRI.ArcGIS.Display.ISymbol; // Dynamic Cast
71
symbol.ROP2 = ESRI.ArcGIS.Display.esriRasterOpCode.esriROPNotXOrPen;
72
73
//Flash the input multipoint geometry.
74
screenDisplay.SetSymbol(symbol);
75
screenDisplay.DrawMultipoint(geometry);
76
System.Threading.Thread.Sleep(delay);
77
screenDisplay.DrawMultipoint(geometry);
78
break;
79
}
80
}
81
screenDisplay.FinishDrawing();
82
}
1
public static void FlashFeature2(IScreenDisplay screenDisplay, IFeature feature)2

{3
IFeatureIdentifyObj featureIdentifyObj = new ESRI.ArcGIS.CartoUI.FeatureIdentifyObjectClass();4
featureIdentifyObj.Feature = feature;5

6
IIdentifyObj identifyObj = featureIdentifyObj as IIdentifyObj;7
identifyObj.Flash(screenDisplay);8
}
Notice: IFeatureIdentifyObj接口的实例类FeatureIdentifyObjectClass的命名空间和接口的命名空间不同,接口为ESRI.ArcGIS.Carto,而实例类为ESRI.ArcGIS.CartoUI.
浙公网安备 33010602011771号