ArcEngine中画点、线、面的经典代码
(2013-08-29 00:24:41)分类: ArcGIS |
画点
[C#]
public void OnMouseDown(int Button, int Shift, int X, int Y)
{
IMxDocument mxDoc =
m_App.Document as IMxDocument;
IActiveView activeView =
mxDoc.FocusMap as IActiveView;
IScreenDisplay screenDisplay =
activeView.ScreenDisplay;
screenDisplay.StartDrawing(screenDisplay.hDC,
(short) esriScreenCache.esriNoScreenCache);
screenDisplay.SetSymbol(new
SimpleMarkerSymbolClass());
screenDisplay.DrawPoint(mxDoc.CurrentLocation);
screenDisplay.FinishDrawing();
}
画线
public void OnMouseDown(int Button, int Shift, int X, int Y)
{
IMxDocument mxDoc =
m_App.Document as IMxDocument;
IActiveView activeView =
mxDoc.FocusMap as IActiveView;
IScreenDisplay screenDisplay =
activeView.ScreenDisplay;
ISimpleLineSymbol lineSymbol =
new SimpleLineSymbolClass();
IRgbColor rgbColor = new
RgbColorClass();
rgbColor.Red = 255;
lineSymbol.Color =
rgbColor;
IRubberBand rubberLine = new
RubberLineClass();
IPolyline newPolyline =
(IPolyline)rubberLine.TrackNew(screenDisplay,
(ISymbol)lineSymbol);
screenDisplay.StartDrawing(screenDisplay.hDC,
(short)esriScreenCache.esriNoScreenCache);
screenDisplay.SetSymbol((ISymbol)lineSymbol);
screenDisplay.DrawPolyline(newPolyline);
screenDisplay.FinishDrawing();
}
画线2
{
ICartographicLineSymbol pCartoLineSyl;
pCartoLineSyl = new
CartographicLineSymbolClass();
pCartoLineSyl.Color = getRGB(255, 110,
210);
pCartoLineSyl.Cap =
esriLineCapStyle.esriLCSButt;
pCartoLineSyl.Join =
esriLineJoinStyle.esriLJSBevel;
pCartoLineSyl.Width=4;
pCartoLineSyl.MiterLimit=4;
ILineProperties pLinePro ;
pLinePro = pCartoLineSyl as
ILineProperties;//取地址
ISimpleLineDecorationElement pSimpleLineDecoEle;
pSimpleLineDecoEle = new
SimpleLineDecorationElementClass();
pSimpleLineDecoEle.FlipAll = true;
pSimpleLineDecoEle.FlipFirst = true;
ILineDecoration pLineDeco;
[C#]
public void OnMouseDown(int Button, int Shift, int X, int Y)
{
}
画线
public void OnMouseDown(int Button, int Shift, int X, int Y)
{
}
画线2
{