本文整理汇总了C#中ESRI.SetSymbol方法的典型用法代码示例。如果您正苦于以下问题:C# ESRI.SetSymbol方法的具体用法?C# ESRI.SetSymbol怎么用?C# ESRI.SetSymbol使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ESRI
的用法示例。
在下文中一共展示了ESRI.SetSymbol方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: FlashGeometry
///<summary>Flash geometry on the display. The geometry type could be polygon, polyline, point, or multipoint.</summary>
///
///<param name="geometry"> An IGeometry interface</param>
///<param name="color">An IRgbColor interface</param>
///<param name="display">An IDisplay interface</param>
///<param name="delay">A System.Int32 that is the time im milliseconds to wait.</param>
///
///<remarks></remarks>
private void FlashGeometry(ESRI.ArcGIS.Geometry.IGeometry geometry, ESRI.ArcGIS.Display.IRgbColor color, ESRI.ArcGIS.Display.IDisplay display, System.Int32 delay)
{
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.esriSMSDiamond;
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();
}
示例2: OnActiveViewEventsAfterDraw
private void OnActiveViewEventsAfterDraw(ESRI.ArcGIS.Display.IDisplay display, ESRI.ArcGIS.Carto.esriViewDrawPhase phase)
{
ESRI.ArcGIS.Carto.esriViewDrawPhase m_phase = phase;
//if the drawing pahse geography, find all feature layer and selected feature and draw them on screen if they are polygons. Please note don't call display::StartDrawing as it is already started by the system.
if (m_phase == ESRI.ArcGIS.Carto.esriViewDrawPhase.esriViewGeography)
{
IMap m_Map = m_MxDoc.FocusMap;
ESRI.ArcGIS.esriSystem.UID m_UID = new ESRI.ArcGIS.esriSystem.UID();
m_UID.Value = "{40A9E885-5533-11d0-98BE-00805F7CED21}";
IEnumLayer m_EnumLayer = m_Map.Layers[m_UID];
ILayer m_Layer = m_EnumLayer.Next();
//if you want to change the selection color you can change it here.
ISimpleFillSymbol m_FillSymbol = new SimpleFillSymbol();
m_Rgb = new RgbColor();
m_Rgb.Red = 255;
m_FillSymbol.Color = m_Rgb;
display.SetSymbol(m_FillSymbol as ISymbol);
do
{
if (m_Layer is IFeatureLayer)
{
if (m_Layer != null)
{
IFeatureSelection m_FeatureSelection = (IFeatureSelection)m_Layer;
ISelectionSet m_SelSet = m_FeatureSelection.SelectionSet;
IFeatureCursor m_FeatCur;
ICursor m_Cursor;
m_SelSet.Search(null, false, out m_Cursor);
m_FeatCur = (IFeatureCursor) m_Cursor;
IFeature m_Feature;
m_Feature = m_FeatCur.NextFeature();
do
{
if (m_Feature != null)
{
if (m_Feature.Shape is IPolygon)
{
display.DrawPolygon(m_Feature.Shape);
}
}
m_Feature = m_FeatCur.NextFeature();
} while (m_Feature != null);
}
}
m_Layer = m_EnumLayer.Next();
} while (m_Layer != null);
}
#endregion
}
示例3: Draw
public void Draw(ESRI.ArcGIS.Geodatabase.IFeatureCursor cursor, ESRI.ArcGIS.esriSystem.esriDrawPhase DrawPhase, ESRI.ArcGIS.Display.IDisplay Display, ESRI.ArcGIS.esriSystem.ITrackCancel TrackCancel)
{
bool bContinue = true;
IFeature pFeat = null;
IFeatureDraw pFeatDraw = null;
ISymbol pFeatSymbol = null;
try
{
if (FeatureSelection != null)
this.SelectedOIDs = this.UpdateSelectedOIDs(FeatureSelection);
pFeat = cursor.NextFeature();
while (((pFeat != null) && bContinue == true))
{
pFeatDraw = pFeat as IFeatureDraw;
pFeatSymbol = GetFeatureSymbol(pFeat);
Display.SetSymbol(pFeatSymbol);
pFeatDraw.Draw(DrawPhase, Display, pFeatSymbol, true, null, esriDrawStyle.esriDSNormal);
pFeat = cursor.NextFeature();
if ((TrackCancel != null))
{
bContinue = TrackCancel.Continue();
}
}
}
catch (Exception ex)
{
// EngineLogger.Logger.LogException(ex);
}
finally
{
bContinue = false;
pFeat = null;
pFeatDraw = null;
pFeatSymbol = null;
}
}
示例4: DrawCrossHair
private static void DrawCrossHair(ESRI.ArcGIS.Geometry.IGeometry geometry, ESRI.ArcGIS.Display.IDisplay display, IEnvelope extent, ISymbol markerSymbol, ISymbol lineSymbol)
{
var point = geometry as IPoint;
var numSegments = 10;
var latitudeMid = point.Y;//envelope.YMin + ((envelope.YMax - envelope.YMin) / 2);
var longitudeMid = point.X;
var leftLongSegment = (point.X - extent.XMin) / numSegments;
var rightLongSegment = (extent.XMax - point.X) / numSegments;
var topLatSegment = (extent.YMax - point.Y) / numSegments;
var bottomLatSegment = (point.Y - extent.YMin) / numSegments;
var fromLeftLong = extent.XMin;
var fromRightLong = extent.XMax;
var fromTopLat = extent.YMax;
var fromBottomLat = extent.YMin;
var av = (ArcMap.Application.Document as IMxDocument).ActiveView;
var leftPolyline = new PolylineClass();
var rightPolyline = new PolylineClass();
var topPolyline = new PolylineClass();
var bottomPolyline = new PolylineClass();
leftPolyline.SpatialReference = geometry.SpatialReference;
rightPolyline.SpatialReference = geometry.SpatialReference;
topPolyline.SpatialReference = geometry.SpatialReference;
bottomPolyline.SpatialReference = geometry.SpatialReference;
var leftPC = leftPolyline as IPointCollection;
var rightPC = rightPolyline as IPointCollection;
var topPC = topPolyline as IPointCollection;
var bottomPC = bottomPolyline as IPointCollection;
leftPC.AddPoint(new PointClass() { X = fromLeftLong, Y = latitudeMid });
rightPC.AddPoint(new PointClass() { X = fromRightLong, Y = latitudeMid });
topPC.AddPoint(new PointClass() { X = longitudeMid, Y = fromTopLat });
bottomPC.AddPoint(new PointClass() { X = longitudeMid, Y = fromBottomLat });
for (int x = 1; x <= numSegments; x++)
{
//Flash the input polygon geometry.
display.SetSymbol(markerSymbol);
display.SetSymbol(lineSymbol);
leftPC.AddPoint(new PointClass() { X = fromLeftLong + leftLongSegment * x, Y = latitudeMid });
rightPC.AddPoint(new PointClass() { X = fromRightLong - rightLongSegment * x, Y = latitudeMid });
topPC.AddPoint(new PointClass() { X = longitudeMid, Y = fromTopLat - topLatSegment * x });
bottomPC.AddPoint(new PointClass() { X = longitudeMid, Y = fromBottomLat + bottomLatSegment * x });
// draw
display.DrawPolyline(leftPolyline);
display.DrawPolyline(rightPolyline);
display.DrawPolyline(topPolyline);
display.DrawPolyline(bottomPolyline);
System.Threading.Thread.Sleep(15);
display.FinishDrawing();
av.PartialRefresh(esriViewDrawPhase.esriViewForeground, null, null);
//av.Refresh();
System.Windows.Forms.Application.DoEvents();
display.StartDrawing(display.hDC, (System.Int16)ESRI.ArcGIS.Display.esriScreenCache.esriNoScreenCache); // Explicit Cast
}
}