本文整理汇总了C#中AxMapControl.TrackPolygon方法的典型用法代码示例。如果您正苦于以下问题:C# AxMapControl.TrackPolygon方法的具体用法?C# AxMapControl.TrackPolygon怎么用?C# AxMapControl.TrackPolygon使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类AxMapControl
的用法示例。
在下文中一共展示了AxMapControl.TrackPolygon方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: QueryByBuffer
//查询
public static void QueryByBuffer(AxMapControl axMapControl)
{
// IDataset data = null;
ILayer layer = axMapControl.get_Layer(0);
IFeatureLayer featureLayer = layer as IFeatureLayer;
//获取featurelayer的featureClass
IFeatureClass featureClass = featureLayer.FeatureClass;
IFeature feature = null;
IQueryFilter queryFilter = new QueryFilterClass();
IFeatureCursor featureCursor;
queryFilter.WhereClause = "NAME";
featureCursor = featureClass.Search(queryFilter, true);
feature = featureCursor.NextFeature();
if (feature != null)
{
axMapControl.Map.SelectFeature(axMapControl.get_Layer(axMapControl.Map.LayerCount), feature);
axMapControl.Refresh(esriViewDrawPhase.esriViewGeoSelection, null, null);
}
axMapControl.MousePointer = ESRI.ArcGIS.Controls.esriControlsMousePointer.esriPointerCrosshair;
IGeometry geometry = null;
geometry = axMapControl.TrackPolygon();
//geometry = axMapControl.get_Layer(axMapControl.Map.LayerCount - 1) as IGeometry;
axMapControl.Map.SelectByShape(geometry, null, false);
axMapControl.Refresh(esriViewDrawPhase.esriViewGeoSelection, null, null);
}
示例2: FreePolygonSt
//自由画面统计
public static void FreePolygonSt(AxMapControl axMapControl,string Path)
{
try
{
IActiveView pActiveView = axMapControl.ActiveView;
IScreenDisplay screenDisplay = pActiveView.ScreenDisplay;
ISimpleFillSymbol sfs = new SimpleFillSymbolClass();
IRgbColor rgbClolor = new RgbColorClass();
sfs.Color = GetRgbColor(23, 255, 55);
IPolygon pGon = axMapControl.TrackPolygon() as IPolygon;
screenDisplay.StartDrawing(screenDisplay.hDC, (short)esriScreenCache.esriNoScreenCache);
screenDisplay.SetSymbol((ISymbol)sfs);
screenDisplay.DrawPolygon((IGeometry)pGon);
screenDisplay.FinishDrawing();
if (MessageBox.Show("是否进行统计?", "询问", MessageBoxButtons.OKCancel, MessageBoxIcon.Question) == DialogResult.OK)
{
CreatePolygonFeature(pGon, Path, "统计");
//axMapControl.AddShapeFile(@"G:\数据库\图层数据", "统计");
}
}
catch(Exception ex)
{
MessageBox.Show(ex.Message);
}
}
示例3: MeasureArea
/// <summary>
/// 面积测量
/// </summary>
/// <param name="axMapControl"></param>
public static void MeasureArea(AxMapControl axMapControl)
{
IActiveView pActiveView = axMapControl.ActiveView;
IScreenDisplay screenDisplay = pActiveView.ScreenDisplay;
ISimpleLineSymbol lineSymbol = new SimpleLineSymbolClass();
IRgbColor rgbClolor = new RgbColorClass();
lineSymbol.Width = 2;
rgbClolor.Red = 255;
lineSymbol.Color = rgbClolor;
axMapControl.Map.MapUnits = esriUnits.esriKilometers;
IPolygon pGon = axMapControl.TrackPolygon() as IPolygon;
screenDisplay.StartDrawing(screenDisplay.hDC, (short)esriScreenCache.esriNoScreenCache);
screenDisplay.SetSymbol((ISymbol)lineSymbol);
screenDisplay.DrawPolyline(pGon);
screenDisplay.FinishDrawing();
try
{
IArea pArea = pGon as IArea;
double s = Math.Abs(pArea.Area*10000);//
MessageBox.Show("测量面积为:" + Convert.ToDouble(s).ToString("0.000") + "平方公里(km2)", "面积测量结果");
IGraphicsContainer pDeletElement = axMapControl.ActiveView.FocusMap as IGraphicsContainer;
pDeletElement.DeleteAllElements();
axMapControl.ActiveView.Refresh();
}
catch(Exception ex)
{
MessageBox.Show(ex.Message);
}
}
示例4: AddPolygonByWrite
public void AddPolygonByWrite(AxMapControl axMapControl1, IFeatureLayer l, double x, double y)
{
ESRI.ArcGIS.Geometry.esriGeometryType featype = l.FeatureClass.ShapeType;
if (featype == esriGeometryType.esriGeometryPolygon)//�жϲ��Ƿ�Ϊ�߲�
{
//IFeatureLayer l = MapCtr.Map.get_Layer(0) as IFeatureLayer;
IFeatureClass fc = l.FeatureClass;
IFeatureClassWrite fr = fc as IFeatureClassWrite;
IWorkspaceEdit w = (fc as IDataset).Workspace as IWorkspaceEdit;
IFeature f;
//��ѡ����������
object Missing = Type.Missing;
IPoint p = new PointClass();
w.StartEditing(true);
w.StartEditOperation();
f = fc.CreateFeature();
//����һ�������߶���
IRgbColor color = new RgbColor();
// ������ɫ����
color.Red = 255;
color.Transparency = 255;
IGeometry iGeom = axMapControl1.TrackPolygon();
AddRegion(axMapControl1, iGeom);
f.Shape = iGeom;
fr.WriteFeature(f);
w.StopEditOperation();
w.StopEditing(true);
}
}