#region
要素选择
IGeometry selectGeometry =
null;
private void pointSelect(object sender,
ESRI.ArcGIS.Controls.IMapControlEvents2_OnMouseDownEvent e)
//点选
{
IEnvelope pEnv;
IActiveView pActiveView =
axMapControl1.ActiveView;
IMap pMap =
axMapControl1.Map;
pEnv = axMapControl1.TrackRectangle();
if (pEnv.IsEmpty == true)
{
ESRI.ArcGIS.esriSystem.tagRECT
r;
r.bottom = e.y + 5;
r.top = e.y - 5;
r.left = e.x - 5;
r.right = e.x + 5;
pActiveView.ScreenDisplay.DisplayTransformation.TransformRect(pEnv,
ref r, 4);
pEnv.SpatialReference =
pActiveView.FocusMap.SpatialReference;
}
selectGeometry = pEnv as
IGeometry;
axMapControl1.Map.SelectByShape(selectGeometry, null, false);
axMapControl1.Refresh(esriViewDrawPhase.esriViewGeoSelection,
null, null);
}
private void lineSelect()
//线选
{
selectGeometry = axMapControl1.TrackLine();
axMapControl1.Map.SelectByShape(selectGeometry, null, false);
axMapControl1.Refresh(esriViewDrawPhase.esriViewGeoSelection,
null, null);
}
private void cubeSelect()
//框选
{
IMap pMap =
axMapControl1.Map;
IActiveView pActiveView = pMap
as IActiveView;
IEnvelope pEnv =
axMapControl1.TrackRectangle();
pMap.SelectByShape(pEnv, null,
false);
pActiveView.PartialRefresh(esriViewDrawPhase.esriViewGeoSelection,
null, null);
}
private void circleSelect()
//圆选
{
selectGeometry
= axMapControl1.TrackCircle();
axMapControl1.Map.SelectByShape(selectGeometry, null, false);
axMapControl1.Refresh(esriViewDrawPhase.esriViewGeoSelection,
null, null);
}
private void zoomIn()
{
IEnvelope pEnv =
axMapControl1.TrackRectangle();
pEnv = axMapControl1.Extent;
pEnv.Expand(0.5, 0.5, true);
axMapControl1.Extent = pEnv;
}
private void zoomOut()
{
IEnvelope pEnv =
axMapControl1.TrackRectangle();
pEnv = axMapControl1.Extent;
pEnv.Expand(2, 2, true);
axMapControl1.Extent = pEnv;
}
#endregion