private void axMapControl_main_OnExtentUpdated(object sender, IMapControlEvents2_OnExtentUpdatedEvent e) { #region 在鹰眼控件中更新范围示意框 IEnvelope pEnvelope = e.newEnvelope as IEnvelope; AeUtils.DrawMapShape(pEnvelope, axMapControl_eye.Object as IMapControl2); #endregion }
private void Buttons_Click(object sender, EventArgs e) { Button button = (Button)sender; if (button == btn_saveDocument) { AeUtils.SaveDocument(m_pMapDoc); } }
private void ckbx_eye_CheckedChanged(object sender, EventArgs e) { if (ckbx_eye.Checked) { axMapControl_eye.Visible = true; // 数据同步 IMap pMap = m_pMapC2.Map; axMapControl_eye.Map.ClearLayers(); for (int i = pMap.LayerCount - 1; i >= 0; i--) { axMapControl_eye.Map.AddLayer(pMap.get_Layer(i)); } IEnvelope pEnvelope = axMapControl_main.ActiveView.Extent; AeUtils.DrawMapShape(pEnvelope, axMapControl_eye.Object as IMapControl2); } else { axMapControl_eye.Visible = false; } }
// ******************************************************************************************** #region 标点击地图控件(axMapControl_main)事件 private void axMapControl_main_OnMouseDown(object sender, IMapControlEvents2_OnMouseDownEvent e) { #region 中键点击实现地图平移(Pan) if (e.button == 4) { m_pMapC2.MousePointer = esriControlsMousePointer.esriPointerPanning; m_pMapC2.Pan(); m_pMapC2.MousePointer = esriControlsMousePointer.esriPointerArrow; } #endregion #region 左键点击事件 if (e.button == 1) { #region 绘制图形控制事件 if (cmbx_draw.SelectedIndex != 0) { IGeometry pGeom; switch (cmbx_draw.SelectedIndex) { // 绘制多边形、矩形、圆形和直线 case 1: pGeom = m_pMapC2.TrackPolygon(); break; case 2: pGeom = m_pMapC2.TrackRectangle(); break; case 3: pGeom = m_pMapC2.TrackCircle(); break; case 4: pGeom = m_pMapC2.TrackLine(); break; default: return; } AeUtils.DrawMapShape(pGeom, m_pMapC2); m_pMapC2.Refresh(esriViewDrawPhase.esriViewGraphics, null, null); } #endregion } #endregion }