HOW TO FLASH A FEATURE.
Example:
#region Flash Geometry
public void FlashGeometry(IGeometry geometry, IRgbColor color, IDisplay display, Int32 delay)
{
if (geometry == null || color == null || display == null)
{
return;
}
display.StartDrawing(display.hDC, (System.Int16)ESRI.ArcGIS.Display.esriScreenCache.esriNoScreenCache); // Explicit Cast
{
if (geometry == null || color == null || display == null)
{
return;
}
display.StartDrawing(display.hDC, (System.Int16)ESRI.ArcGIS.Display.esriScreenCache.esriNoScreenCache); // Explicit Cast
switch (geometry.GeometryType)
{
case ESRI.ArcGIS.Geometry.esriGeometryType.esriGeometryPolygon:
{
//Set the flash geometry’s symbol.
ESRI.ArcGIS.Display.ISimpleFillSymbol simpleFillSymbol = new ESRI.ArcGIS.Display.SimpleFillSymbolClass();
simpleFillSymbol.Color = color;
ESRI.ArcGIS.Display.ISymbol symbol = simpleFillSymbol as ESRI.ArcGIS.Display.ISymbol; // Dynamic Cast
symbol.ROP2 = ESRI.ArcGIS.Display.esriRasterOpCode.esriROPNotXOrPen;
//Flash the input polygon geometry.
display.SetSymbol(symbol);
display.DrawPolygon(geometry);
System.Threading.Thread.Sleep(delay);
display.DrawPolygon(geometry);
break;
}
case ESRI.ArcGIS.Geometry.esriGeometryType.esriGeometryPolyline:
{
//Set the flash geometry’s symbol.
ESRI.ArcGIS.Display.ISimpleLineSymbol simpleLineSymbol = new ESRI.ArcGIS.Display.SimpleLineSymbolClass();
simpleLineSymbol.Width = 4;
simpleLineSymbol.Color = color;
ESRI.ArcGIS.Display.ISymbol symbol = simpleLineSymbol as ESRI.ArcGIS.Display.ISymbol; // Dynamic Cast
symbol.ROP2 = ESRI.ArcGIS.Display.esriRasterOpCode.esriROPNotXOrPen;
//Flash the input polyline geometry.
display.SetSymbol(symbol);
display.DrawPolyline(geometry);
System.Threading.Thread.Sleep(delay);
display.DrawPolyline(geometry);
break;
}
case ESRI.ArcGIS.Geometry.esriGeometryType.esriGeometryPoint:
{
//Set the flash geometry’s symbol.
ESRI.ArcGIS.Display.ISimpleMarkerSymbol simpleMarkerSymbol = new ESRI.ArcGIS.Display.SimpleMarkerSymbolClass();
simpleMarkerSymbol.Style = ESRI.ArcGIS.Display.esriSimpleMarkerStyle.esriSMSCircle;
simpleMarkerSymbol.Size = 12;
simpleMarkerSymbol.Color = color;
ESRI.ArcGIS.Display.ISymbol symbol = simpleMarkerSymbol as ESRI.ArcGIS.Display.ISymbol; // Dynamic Cast
symbol.ROP2 = ESRI.ArcGIS.Display.esriRasterOpCode.esriROPNotXOrPen;
//Flash the input point geometry.
display.SetSymbol(symbol);
display.DrawPoint(geometry);
System.Threading.Thread.Sleep(delay);
display.DrawPoint(geometry);
break;
}
case ESRI.ArcGIS.Geometry.esriGeometryType.esriGeometryMultipoint:
{
//Set the flash geometry’s symbol.
ESRI.ArcGIS.Display.ISimpleMarkerSymbol simpleMarkerSymbol = new ESRI.ArcGIS.Display.SimpleMarkerSymbolClass();
simpleMarkerSymbol.Style = ESRI.ArcGIS.Display.esriSimpleMarkerStyle.esriSMSCircle;
simpleMarkerSymbol.Size = 12;
simpleMarkerSymbol.Color = color;
ESRI.ArcGIS.Display.ISymbol symbol = simpleMarkerSymbol as ESRI.ArcGIS.Display.ISymbol; // Dynamic Cast
symbol.ROP2 = ESRI.ArcGIS.Display.esriRasterOpCode.esriROPNotXOrPen;
//Flash the input multipoint geometry.
display.SetSymbol(symbol);
display.DrawMultipoint(geometry);
System.Threading.Thread.Sleep(delay);
display.DrawMultipoint(geometry);
break;
}
}
display.FinishDrawing();
}
#endregion
{
case ESRI.ArcGIS.Geometry.esriGeometryType.esriGeometryPolygon:
{
//Set the flash geometry’s symbol.
ESRI.ArcGIS.Display.ISimpleFillSymbol simpleFillSymbol = new ESRI.ArcGIS.Display.SimpleFillSymbolClass();
simpleFillSymbol.Color = color;
ESRI.ArcGIS.Display.ISymbol symbol = simpleFillSymbol as ESRI.ArcGIS.Display.ISymbol; // Dynamic Cast
symbol.ROP2 = ESRI.ArcGIS.Display.esriRasterOpCode.esriROPNotXOrPen;
//Flash the input polygon geometry.
display.SetSymbol(symbol);
display.DrawPolygon(geometry);
System.Threading.Thread.Sleep(delay);
display.DrawPolygon(geometry);
break;
}
case ESRI.ArcGIS.Geometry.esriGeometryType.esriGeometryPolyline:
{
//Set the flash geometry’s symbol.
ESRI.ArcGIS.Display.ISimpleLineSymbol simpleLineSymbol = new ESRI.ArcGIS.Display.SimpleLineSymbolClass();
simpleLineSymbol.Width = 4;
simpleLineSymbol.Color = color;
ESRI.ArcGIS.Display.ISymbol symbol = simpleLineSymbol as ESRI.ArcGIS.Display.ISymbol; // Dynamic Cast
symbol.ROP2 = ESRI.ArcGIS.Display.esriRasterOpCode.esriROPNotXOrPen;
//Flash the input polyline geometry.
display.SetSymbol(symbol);
display.DrawPolyline(geometry);
System.Threading.Thread.Sleep(delay);
display.DrawPolyline(geometry);
break;
}
case ESRI.ArcGIS.Geometry.esriGeometryType.esriGeometryPoint:
{
//Set the flash geometry’s symbol.
ESRI.ArcGIS.Display.ISimpleMarkerSymbol simpleMarkerSymbol = new ESRI.ArcGIS.Display.SimpleMarkerSymbolClass();
simpleMarkerSymbol.Style = ESRI.ArcGIS.Display.esriSimpleMarkerStyle.esriSMSCircle;
simpleMarkerSymbol.Size = 12;
simpleMarkerSymbol.Color = color;
ESRI.ArcGIS.Display.ISymbol symbol = simpleMarkerSymbol as ESRI.ArcGIS.Display.ISymbol; // Dynamic Cast
symbol.ROP2 = ESRI.ArcGIS.Display.esriRasterOpCode.esriROPNotXOrPen;
//Flash the input point geometry.
display.SetSymbol(symbol);
display.DrawPoint(geometry);
System.Threading.Thread.Sleep(delay);
display.DrawPoint(geometry);
break;
}
case ESRI.ArcGIS.Geometry.esriGeometryType.esriGeometryMultipoint:
{
//Set the flash geometry’s symbol.
ESRI.ArcGIS.Display.ISimpleMarkerSymbol simpleMarkerSymbol = new ESRI.ArcGIS.Display.SimpleMarkerSymbolClass();
simpleMarkerSymbol.Style = ESRI.ArcGIS.Display.esriSimpleMarkerStyle.esriSMSCircle;
simpleMarkerSymbol.Size = 12;
simpleMarkerSymbol.Color = color;
ESRI.ArcGIS.Display.ISymbol symbol = simpleMarkerSymbol as ESRI.ArcGIS.Display.ISymbol; // Dynamic Cast
symbol.ROP2 = ESRI.ArcGIS.Display.esriRasterOpCode.esriROPNotXOrPen;
//Flash the input multipoint geometry.
display.SetSymbol(symbol);
display.DrawMultipoint(geometry);
System.Threading.Thread.Sleep(delay);
display.DrawMultipoint(geometry);
break;
}
}
display.FinishDrawing();
}
#endregion
No comments:
Post a Comment