本文整理汇总了C#中IDisplay.SetSymbol方法的典型用法代码示例。如果您正苦于以下问题:C# IDisplay.SetSymbol方法的具体用法?C# IDisplay.SetSymbol怎么用?C# IDisplay.SetSymbol使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类IDisplay
的用法示例。
在下文中一共展示了IDisplay.SetSymbol方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: DrawGeometry
/// <summary>
/// Draws the input geometry using the specified colors.
/// </summary>
/// <param name="geometry">The input IGeometry to draw. Supported geometry types are GeometryBag, Polygon, Polyline, Point and Multipoint.</param>
/// <param name="fillColor">An IRgbColor reference for the fill color</param>
/// <param name="lineColor">An IRgbColor reference for the line or outline color</param>
/// <param name="display">An IDisplay reference</param>
/// <param name="cancelTracker">An ITrackCancel reference</param>
private static void DrawGeometry(IGeometry geometry, IRgbColor fillColor, IRgbColor lineColor, IDisplay display, ITrackCancel cancelTracker)
{
bool continueDrawing = true;
switch (geometry.GeometryType)
{
case esriGeometryType.esriGeometryBag:
{
IEnumGeometry enumGeometry = (IEnumGeometry)geometry;
IGeometry innerGeometry = enumGeometry.Next();
while (innerGeometry != null && continueDrawing == true)
{
DrawGeometry(innerGeometry, fillColor, lineColor, display, cancelTracker); // Recursive method call
innerGeometry = enumGeometry.Next();
if (cancelTracker != null)
{
continueDrawing = cancelTracker.Continue();
}
}
break;
}
case esriGeometryType.esriGeometryPolygon:
{
// Set the input polygon geometry's symbol.
ISimpleFillSymbol fillSymbol = new SimpleFillSymbolClass();
fillSymbol.Color = (IColor)fillColor;
ILineSymbol lineSymbol = new SimpleLineSymbolClass();
lineSymbol.Color = lineColor;
fillSymbol.Outline = lineSymbol;
// Draw the input polygon geometry.
display.SetSymbol((ISymbol)fillSymbol);
display.DrawPolygon(geometry);
break;
}
case esriGeometryType.esriGeometryPolyline:
{
// Set the input polyline geometry's symbol.
IMultiLayerLineSymbol multiLineSymbol = new MultiLayerLineSymbolClass();
ISimpleLineSymbol simpleLineSymbol1 = new SimpleLineSymbolClass();
ISimpleLineSymbol simpleLineSymbol2 = new SimpleLineSymbolClass();
simpleLineSymbol1.Width = 3;
simpleLineSymbol1.Color = fillColor;
simpleLineSymbol2.Width = 5;
simpleLineSymbol2.Color = lineColor;
multiLineSymbol.AddLayer((ILineSymbol)simpleLineSymbol2);
multiLineSymbol.AddLayer((ILineSymbol)simpleLineSymbol1);
// Draw the input polyline geometry.
display.SetSymbol((ISymbol)multiLineSymbol);
display.DrawPolyline(geometry);
break;
}
case esriGeometryType.esriGeometryPoint:
{
// Set the input point geometry's symbol.
ISimpleMarkerSymbol simpleMarkerSymbol = new SimpleMarkerSymbolClass();
simpleMarkerSymbol.Style = esriSimpleMarkerStyle.esriSMSCircle;
simpleMarkerSymbol.Size = 12;
simpleMarkerSymbol.Color = fillColor;
simpleMarkerSymbol.Outline = true;
simpleMarkerSymbol.OutlineColor = lineColor;
// Draw the input point geometry.
display.SetSymbol((ISymbol)simpleMarkerSymbol);
display.DrawPoint(geometry);
break;
}
case esriGeometryType.esriGeometryMultipoint:
{
// Set the input multipoint geometry's symbol.
ISimpleMarkerSymbol simpleMarkerSymbol = new SimpleMarkerSymbolClass();
simpleMarkerSymbol.Style = esriSimpleMarkerStyle.esriSMSCircle;
simpleMarkerSymbol.Size = 8;
simpleMarkerSymbol.Color = fillColor;
simpleMarkerSymbol.Outline = true;
simpleMarkerSymbol.OutlineColor = lineColor;
// Draw the input multipoint geometry.
display.SetSymbol((ISymbol)simpleMarkerSymbol);
display.DrawMultipoint(geometry);
break;
}
}
}
示例2: Draw
/// <summary>
/// Draws the layer to the specified display for the given draw phase.
/// </summary>
/// <param name="drawPhase"></param>
/// <param name="Display"></param>
/// <param name="trackCancel"></param>
/// <remarks>the draw method is set as an abstract method and therefore must be overridden</remarks>
public override void Draw(esriDrawPhase drawPhase, IDisplay Display, ITrackCancel trackCancel)
{
if(drawPhase != esriDrawPhase.esriDPGeography) return;
if(Display == null) return;
if(m_table == null || m_symbolTable == null) return;
m_display = Display;
IEnvelope envelope = Display.DisplayTransformation.FittedBounds as IEnvelope;
double lat, lon;
int iconCode;
bool selected;
ISymbol symbol = null;
//loop through the rows. Draw each row that has a shape
foreach (DataRow row in m_table.Rows)
{
//get the Lat/Lon of the item
lat = Convert.ToDouble(row[3]);
lon = Convert.ToDouble(row[4]);
//get the icon ID
iconCode = Convert.ToInt32(row[8]);
//get the selection state of the item
selected = Convert.ToBoolean(row[13]);
if(lon >= envelope.XMin && lon <= envelope.XMax && lat >= envelope.YMin && lat <= envelope.YMax)
{
//search for the symbol in the symbology table
symbol = GetSymbol(iconCode, row);
if(null == symbol)
continue;
m_point.X = lon;
m_point.Y = lat;
m_point.SpatialReference = m_spatialRef;
//reproject the point to the DataFrame's spatial reference
if (null != m_mapSpatialRef && m_mapSpatialRef.FactoryCode != m_layerSRFactoryCode)
m_point.Project(m_mapSpatialRef);
Display.SetSymbol(symbol);
Display.DrawPoint(m_point);
if(selected)
{
Display.SetSymbol(m_selectionSymbol);
Display.DrawPoint(m_point);
}
}
}
}
示例3: Draw
public void Draw(IFeatureCursor cursor, esriDrawPhase DrawPhase, IDisplay Display, ITrackCancel trackCancel)
{
string ActiveErrorHandler = null;
try
{
// loop through and draw each feature
IFeature pFeat = null;
IFeatureRenderer pRend = null;
bool bContinue = false;
// do not draw features if no display
if (Display == null)
return;
// we can't draw without somewhere to get our base symbols from
if (m_pMainRend == null)
return;
if (m_pSizeRend != null)
{
// size varies
if (m_ShapeType == esriGeometryType.esriGeometryPoint | m_ShapeType == esriGeometryType.esriGeometryPolyline)
{
if (DrawPhase == esriDrawPhase.esriDPGeography)
{
// draw symbols in order from large to small
DrawSymbolsInOrder(cursor, DrawPhase, Display, trackCancel);
}
}
else if (m_ShapeType == esriGeometryType.esriGeometryPolygon)
{
if (DrawPhase == esriDrawPhase.esriDPAnnotation)
{
// draw primary symbology from large to small
DrawSymbolsInOrder(cursor, DrawPhase, Display, trackCancel);
}
else if (DrawPhase == esriDrawPhase.esriDPGeography)
{
// draw background symbology
pFeat = cursor.NextFeature();
bContinue = true;
// while there are still more features and drawing has not been cancelled
IFillSymbol pBackFillSym;
while ((pFeat != null) & (bContinue == true))
{
// draw the feature
IFeatureDraw pFeatDraw = pFeat as IFeatureDraw;
if (m_pSizeRend is IClassBreaksRenderer)
{
IClassBreaksRenderer pCBRend = m_pSizeRend as IClassBreaksRenderer;
pBackFillSym = pCBRend.BackgroundSymbol;
}
else
{
IProportionalSymbolRenderer pPropRend = m_pSizeRend as IProportionalSymbolRenderer;
pBackFillSym = pPropRend.BackgroundSymbol;
}
Display.SetSymbol(pBackFillSym as ISymbol);
//implementation of IExportSupport
BeginFeature(pFeat, Display);
pFeatDraw.Draw(DrawPhase, Display, pBackFillSym as ISymbol, true, null, esriDrawStyle.esriDSNormal);
//implementation of IExportSupport
GenerateExportInfo(pFeat, Display);
EndFeature(Display);
pFeat = cursor.NextFeature();
if (trackCancel != null)
bContinue = trackCancel.Continue();
}
}
else
{
Marshal.ThrowExceptionForHR(147500037); //E_FAIL
}
}
}
else
{
// size does not vary
if (DrawPhase != esriDrawPhase.esriDPGeography)
{
Marshal.ThrowExceptionForHR(147500037); //E_FAIL
}
else
DrawSymbols(cursor, DrawPhase, Display, trackCancel);
}
}
catch
//.........这里部分代码省略.........
示例4: DrawLogoStandard
private void DrawLogoStandard(IDisplay Display)
{
tagRECT r = Display.DisplayTransformation.get_DeviceFrame();
Display.StartDrawing(Display.hDC, (short)esriScreenCache.esriNoScreenCache);
if (null == m_logoSymbol)
{
m_logoSymbol = CreateStandardLogoSymbol();
}
Display.SetSymbol(m_logoSymbol);
Display.DrawPoint(Display.DisplayTransformation.ToMapPoint(120, r.bottom - 160));
Display.FinishDrawing();
}
示例5: DrawSymbols
private void DrawSymbols(IFeatureCursor Cursor, esriDrawPhase drawPhase, IDisplay Display, ITrackCancel trackCancel)
{
IFeature pFeat = null;
IFeatureDraw pFeatDraw = null;
bool bContinue = true;
ISymbol pDrawSym = null;
pFeat = Cursor.NextFeature();
bContinue = true;
// while there are still more features and drawing has not been cancelled
while ((pFeat != null) & (bContinue == true))
{
// get symbol to draw
pDrawSym = GetFeatureSymbol(pFeat);
// draw the feature
pFeatDraw = pFeat as IFeatureDraw;
Display.SetSymbol(pDrawSym);
//implementation of IExportSupport
BeginFeature(pFeat, Display);
pFeatDraw.Draw(drawPhase, Display, pDrawSym, true, null, esriDrawStyle.esriDSNormal);
//implementation of IExportSupport
GenerateExportInfo(pFeat, Display);
EndFeature(Display);
// get next feature
pFeat = Cursor.NextFeature();
if (trackCancel != null)
bContinue = trackCancel.Continue();
}
}
示例6: DrawSymbolsInOrder
private void DrawSymbolsInOrder(IFeatureCursor Cursor, esriDrawPhase drawPhase, IDisplay Display, ITrackCancel trackCancel)
{
// this sub draws either markers or line symbols from large small so that the smallest symbols will be drawn on top
// in graduated symbol case, a cursor is built and parsed n times for n size classes
// in proportional symbol case, symbols are sorted and drawn from largest to smallest
int iSizeIndex = 0;
int iCurrentDrawableSymbolIndex = 0;
IFeatureCursor pMyCursor = null;
IFeature pFeat = null;
IFeatureDraw pFeatDraw = null;
bool bContinue = true;
ISymbol pSizeSym = null;
ISymbol pDrawSym = null;
IFeatureCursor pSortedCursor = null;
if (m_pSizeRend is IProportionalSymbolRenderer)
{
// sort
pSortedCursor = SortData(Cursor, trackCancel);
// draw
pFeat = pSortedCursor.NextFeature();
while (pFeat != null)
{
pDrawSym = GetFeatureSymbol(pFeat);
// draw the feature
pFeatDraw = pFeat as IFeatureDraw;
Display.SetSymbol(pDrawSym);
//implementation of IExportSupport
BeginFeature(pFeat, Display);
pFeatDraw.Draw(drawPhase, Display, pDrawSym, true, null, esriDrawStyle.esriDSNormal);
//implementation of IExportSupport
GenerateExportInfo(pFeat, Display);
EndFeature(Display);
// get next feature
pFeat = pSortedCursor.NextFeature();
if (trackCancel != null)
bContinue = trackCancel.Continue();
}
}
else
{
IClassBreaksRenderer pSizeCBRend = null;
pSizeCBRend = m_pSizeRend as IClassBreaksRenderer;
pMyCursor = Cursor;
for (iCurrentDrawableSymbolIndex = (pSizeCBRend.BreakCount - 1); iCurrentDrawableSymbolIndex >= 0; iCurrentDrawableSymbolIndex--)
{
// do not build a cursor the 1st time because we already have one
if (iCurrentDrawableSymbolIndex < (pSizeCBRend.BreakCount - 1))
{
// build pMyCursor
pMyCursor = m_pFeatureClass.Search(m_pQueryFilter, true);
}
pFeat = pMyCursor.NextFeature();
while (pFeat != null)
{
// check to see if we will draw in this pass
pSizeSym = m_pSizeRend.get_SymbolByFeature(pFeat);
iSizeIndex = GetSymbolIndex(pSizeSym, pSizeCBRend);
if (iSizeIndex == iCurrentDrawableSymbolIndex)
{
// go ahead and draw the symbol
// get symbol to draw
pDrawSym = GetFeatureSymbol(pFeat);
// draw the feature
pFeatDraw = pFeat as IFeatureDraw;
Display.SetSymbol(pDrawSym);
//implementation of IExportSupport
BeginFeature(pFeat, Display);
pFeatDraw.Draw(drawPhase, Display, pDrawSym, true, null, esriDrawStyle.esriDSNormal);
//implementation of IExportSupport
GenerateExportInfo(pFeat, Display);
EndFeature(Display);
if (trackCancel != null)
bContinue = trackCancel.Continue();
}
pFeat = pMyCursor.NextFeature();
}
} // increment DOWN to next symbol size
}
}
示例7: while
void IFeatureRenderer.Draw(IFeatureCursor cursor, esriDrawPhase DrawPhase, IDisplay Display, ITrackCancel trackCancel)
{
Display.SetSymbol(sym);
IFeature f = cursor.NextFeature();
while (f != null)
{
IFeatureDraw fd = f as IFeatureDraw;
fd.Draw(DrawPhase, Display, sym, true, f.Shape, esriDrawStyle.esriDSNormal);
f = cursor.NextFeature();
}
}
示例8: Draw
/// <summary>
/// Draw feture (Paolo, march 2007)
/// </summary>
/// <param name="drawPhase"></param>
/// <param name="Display"></param>
/// <param name="Symbol"></param>
/// <param name="symbolInstalled"></param>
/// <param name="Geometry"></param>
/// <param name="DrawStyle"></param>
public void Draw(esriDrawPhase drawPhase, IDisplay Display, ISymbol Symbol, bool symbolInstalled, IGeometry Geometry, esriDrawStyle DrawStyle)
{
// This if-statement might not be necessary. The proper
// filtering may have already occurred before this.
//Paolo : remove this filter, without it selection should work
/*
if (!(drawPhase == esriDrawPhase.esriDPGeography && DrawStyle == esriDrawStyle.esriDSNormal)) return;
*/
if (Shape == null) return;
Display.SetSymbol(Symbol);
postGisFeatureClass.layerHelper.draw(Display, Shape);
}
示例9: Draw
public void Draw(IDisplay Display, ITrackCancel TrackCancel)
{
if (null != m_triangle && null != m_fillSymbol)
{
Display.SetSymbol((ISymbol)m_fillSymbol);
Display.DrawPolygon(m_triangle);
}
}