/// <summary> /// 地图更新 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void MainMapControl_OnExtentUpdated(object sender, IMapControlEvents2_OnExtentUpdatedEvent e) { IEnvelope envelope = e.newEnvelope as IEnvelope; DrawRectangle(envelope); TOCControl.Update(); }
//重载地图当前范围变化的事件 private void Ctrl_ExtentUpdated(object sender, IMapControlEvents2_OnExtentUpdatedEvent e) { m_pMapExtent = e.newEnvelope as IEnvelope; m_rRect = MapExtent2Rect(m_pMapExtent); this.Refresh(); //RefreshMap(); }
private void MainMapControl_OnExtentUpdated(object sender, IMapControlEvents2_OnExtentUpdatedEvent e)//主地图:范围变化,鹰眼图跟随变化 { //在绘制前,清除axMapControlEagleMap中的任何图形元素 var graphicsContainer = (IGraphicsContainer)EagleMapControl.Map; graphicsContainer.DeleteAllElements(); //主地图地图范围变化时,鹰眼中的地图范围也跟随着变化 var rectangleElement = (IRectangleElement) new RectangleElement(); var element = (IElement)rectangleElement; var envelope = (IEnvelope)e.newEnvelope; //得到主地图的新范围 element.Geometry = envelope; //设置鹰眼中的红线框 var fillShapeElement = (IFillShapeElement)element; fillShapeElement.Symbol = SymbolCreate.GetSimpleFillSymbol("ff000000", "ff0000", 1.6); graphicsContainer.AddElement((IElement)fillShapeElement, 0); //刷新 envelope.Expand(2, 2, true); var activeView = (IActiveView)graphicsContainer; activeView.Extent = envelope; activeView.PartialRefresh(esriViewDrawPhase.esriViewGeography, null, null); }
private void axMapControl_Main_OnExtentUpdated(object sender, IMapControlEvents2_OnExtentUpdatedEvent e) { if (axMapControl_HawkEye.Visible) { AeUtils.DrawExtent(e.newEnvelope as IEnvelope, axMapControl_HawkEye); } }
private void axMapControl1_OnExtentUpdated(object sender, IMapControlEvents2_OnExtentUpdatedEvent e) { //if (this.pDisplayFeedback != null) //{ // this.pDisplayFeedback.Refresh(this.pScreenDisplay.hWnd); //} }
private void axMapControl_main_OnExtentUpdated(object sender, IMapControlEvents2_OnExtentUpdatedEvent e) { if (axMapControl_hawkeye.Visible) { Hawkeye_DrawExtent(e.newEnvelope as IEnvelope); } }
private void axMapControl1_OnExtentUpdated(object sender, IMapControlEvents2_OnExtentUpdatedEvent e) { //新建一个矩形元素对象 IElement ele = new RectangleElementClass(); //矩形设置为主地图的显示范围 ele.Geometry = axMapControl1.Extent; //新建一个简单填充样式对象 IFillSymbol symbol = new SimpleFillSymbolClass(); //新建一个RGB颜色对象 IRgbColor clr = new RgbColorClass(); //设置填充样式对象的颜色为无色、透明 clr.NullColor = true; clr.Transparency = 0; symbol.Color = clr; //新建一个线样式对象 ILineSymbol linSymbol = new SimpleLineSymbolClass(); //设置填充样式对象的边框为红色 IRgbColor linClr = new RgbColorClass(); linClr.Red = 255; linSymbol.Color = linClr; symbol.Outline = linSymbol; //用填充样式对象来绘制矩形元素 ((IFillShapeElement)ele).Symbol = symbol; //删除鹰眼中的所有元素 axMapControl2.ActiveView.GraphicsContainer.DeleteAllElements(); //将矩形元素添加到鹰眼中,并局部刷新 axMapControl2.ActiveView.GraphicsContainer.AddElement(ele, 0); axMapControl2.ActiveView.PartialRefresh(esriViewDrawPhase.esriViewGraphics, null, null); }
private void UcMap_OnExtentUpdated(object sender, IMapControlEvents2_OnExtentUpdatedEvent e) { if (MapExtentChanged != null) { MapExtentChanged.Invoke(); } }
//主地图:地图范围(Extent)变化 private void axMapControlMainMap_OnExtentUpdated(object sender, IMapControlEvents2_OnExtentUpdatedEvent e) { #region 主地图地图范围Extent变化时,鹰眼中的地图范围Extent也跟随着变化 IEnvelope envelope = (IEnvelope)e.newEnvelope; //得到主地图的新范围 IGraphicsContainer graphicsContainer = axMapControlEagleMap.Map as IGraphicsContainer; IActiveView activeView = graphicsContainer as IActiveView; graphicsContainer.DeleteAllElements(); //在绘制前,清除axMapControlEagleMap中的任何图形元素 IRectangleElement rectangleElement = new RectangleElement() as IRectangleElement; IElement element = rectangleElement as IElement; element.Geometry = envelope; //产生一个线符号对象,设置鹰眼中的红线框 ILineSymbol lineSymbol = new SimpleLineSymbol(); lineSymbol.Width = 1.6; lineSymbol.Color = RenderOpt.GetIColor(255, 0, 0); //设置填充符号的属性 IFillSymbol fillSymbol = new SimpleFillSymbol(); fillSymbol.Color = RenderOpt.GetIColor(255, 0, 0, 0); fillSymbol.Outline = lineSymbol; IFillShapeElement fillShapeElement = element as IFillShapeElement; fillShapeElement.Symbol = fillSymbol; graphicsContainer.AddElement((IElement)fillShapeElement, 0); //刷新 envelope.Expand(2, 2, true); activeView.Extent = envelope; activeView.PartialRefresh(esriViewDrawPhase.esriViewGeography, null, null); #endregion }
///////////////////////////////////////// private void axMapControl_sub_OnExtentUpdated(object sender, IMapControlEvents2_OnExtentUpdatedEvent e) { //实现鹰眼的方框的 symbol 部分 ILineSymbol outLineSymbol = new SimpleLineSymbol(); //设置鹰眼图中的红线! outLineSymbol.Width = 2; outLineSymbol.Color = GetColor(255, 0, 0, 255); IFillSymbol fillSymbol = new SimpleFillSymbol(); //设置填充符号的属性! fillSymbol.Color = GetColor(255, 0, 0, 0); //设置完全透明色 fillSymbol.Outline = outLineSymbol; //实现信息传递 IEnvelope envlope2 = e.newEnvelope as IEnvelope; IElement element2 = new RectangleElement(); element2.Geometry = envlope2; IFillShapeElement fillShapeElement2 = element2 as IFillShapeElement; fillShapeElement2.Symbol = fillSymbol; IGraphicsContainer graphicsContainer2 = axMapControl_sub.Map as IGraphicsContainer; graphicsContainer2.DeleteAllElements(); IElement pElement = fillShapeElement2 as IElement; graphicsContainer2.AddElement(pElement, 0); axMapControl_sub.Refresh(esriViewDrawPhase.esriViewGeography, null, null); }
private void m_pMainMapControl_OnExtentUpdated(object sender, IMapControlEvents2_OnExtentUpdatedEvent e) { if (this.m_CanDo) { this.m_pEnvelope = this.m_pMainMapControl.Extent; if (this.m_ZoomWithMainView) { IEnvelope extent = this.axMapControl1.ActiveView.Extent; double num = extent.Width / extent.Height; if (this.m_pEnvelope.Width > (this.m_pEnvelope.Height * num)) { this.m_pEnvelope.YMin = this.m_pEnvelope.YMax - (this.m_pEnvelope.Width / num); } else { this.m_pEnvelope.XMax = this.m_pEnvelope.XMin + (this.m_pEnvelope.Height * num); } this.axMapControl1.ActiveView.Extent = this.m_pEnvelope; this.axMapControl1.ActiveView.Refresh(); } if (!this.axMapControl1.IsDisposed) { this.DrawRectangle(this.axMapControl1.ActiveView); } } if (this.m_OverwindowsLayersType == OverwindowsLayersType.LayerSettings) { this.SetLayerVisible(MapHelper.GetMapScale(this.m_pMainMapControl.Map)); } }
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 mainMapControl_OnExtentUpdated(object sender, IMapControlEvents2_OnExtentUpdatedEvent e) { IEnvelope pEnvelope = e.newEnvelope as IEnvelope; ISimpleLineSymbol pSimpleLineSymbol = new SimpleLineSymbolClass(); pSimpleLineSymbol.Style = esriSimpleLineStyle.esriSLSDash; pSimpleLineSymbol.Width = 2; pSimpleLineSymbol.Color = this.getRGBColor(0, 0, 0); ISimpleFillSymbol pSimpleFillSymbol = new SimpleFillSymbolClass(); pSimpleFillSymbol.Color = this.getRGBColor(255, 0, 0); pSimpleFillSymbol.Outline = pSimpleLineSymbol as ILineSymbol; pSimpleFillSymbol.Style = esriSimpleFillStyle.esriSFSHollow; IRectangleElement pRectangleElement = new RectangleElementClass(); IElement pElement = pRectangleElement as IElement; pElement.Geometry = pEnvelope as IGeometry; IFillShapeElement pFillShapeElement = pRectangleElement as IFillShapeElement; pFillShapeElement.Symbol = pSimpleFillSymbol as IFillSymbol; IGraphicsContainer pGraphicsContainer = this.EagleaxMapControl.Map as IGraphicsContainer; pGraphicsContainer.DeleteAllElements(); pGraphicsContainer.AddElement(pElement, 0); this.EagleaxMapControl.ActiveView.PartialRefresh(esriViewDrawPhase.esriViewGraphics, null, null); }
private void MapMainControl_OnExtentUpdated(object sender, IMapControlEvents2_OnExtentUpdatedEvent e) { if (SetMainMapScale != null) { SetMainMapScale(mainMapControl.MapScale); } UpdateBarEditScaleText(); }
private void axMapControl_Main_OnExtentUpdated(object sender, IMapControlEvents2_OnExtentUpdatedEvent e) { ShowMapScaleInfo(); // 地图比例尺显示 if (f_HawkEye != null && !f_HawkEye.IsDisposed) { f_HawkEye.DrawExtent(); } }
private void ucHistoryMap2_AxMapCtrlHis_OnExtentUpdated(object sender, IMapControlEvents2_OnExtentUpdatedEvent e) { try { ucHistoryMap1.AxMapCtrlHis.Extent = e.newEnvelope as IEnvelope; } catch { } }
private void Ctrl_Map_OnExtentUpdated(object sender, IMapControlEvents2_OnExtentUpdatedEvent e) { IObjectCopy cpyOper = new ObjectCopyClass(); object cpyTo = Ctrl_PageLayout.ActiveView.FocusMap; cpyOper.Overwrite(Ctrl_Map.Map, ref cpyTo); Lb_MapScale.Text = "1:" + ((UInt32)Ctrl_Map.MapScale).ToString(); Ctrl_PageLayout.Refresh(); }
// 同步 数据视图、布局视图 private void axMapControl1_OnExtentUpdated(Object sender, IMapControlEvents2_OnExtentUpdatedEvent e) { IObjectCopy pobjectcopy = new ObjectCopyClass(); object from = pobjectcopy.Copy(axMapControl1.Map); object to = axPageLayoutControl1.ActiveView.FocusMap; pobjectcopy.Overwrite(from, ref to); axPageLayoutControl1.ActiveView.Refresh(); }
private void UCMap_OnExtentUpdated(object sender, IMapControlEvents2_OnExtentUpdatedEvent e) { if (scaleUpdated != null) { scaleUpdated(MapScale); } ucMapNavigate1.MapScale = (int)base.MapScale; // 得到新范围 IEnvelope pEnv = (IEnvelope)e.newEnvelope; IGraphicsContainer pGra = this.Map as IGraphicsContainer; IActiveView pAv = pGra as IActiveView; //在绘制前,清除axMapControl2中的任何图形元素 pGra.DeleteAllElements(); IRectangleElement pRectangleEle = new RectangleElementClass(); IElement pEle = pRectangleEle as IElement; pEle.Geometry = pEnv; //设置鹰眼图中的红线框 IRgbColor pColor = new RgbColorClass(); pColor.Red = 255; pColor.Green = 0; pColor.Blue = 0; pColor.Transparency = 255; //产生一个线符号对象 ILineSymbol pOutline = new SimpleLineSymbolClass(); pOutline.Width = 1; pOutline.Color = pColor; //设置颜色属性 pColor = new RgbColorClass(); pColor.Red = 255; pColor.Green = 0; pColor.Blue = 0; pColor.Transparency = 0; //设置填充符号的属性 IFillSymbol pFillSymbol = new SimpleFillSymbolClass(); pFillSymbol.Color = pColor; pFillSymbol.Outline = pOutline; IFillShapeElement pFillShapeEle = pEle as IFillShapeElement; pFillShapeEle.Symbol = pFillSymbol; pGra.AddElement((IElement)pFillShapeEle, 0); pAv.PartialRefresh(esriViewDrawPhase.esriViewGraphics, null, null); }
private void axMapControl1_OnExtentUpdated(object sender, IMapControlEvents2_OnExtentUpdatedEvent e) { // 得到新范围 IEnvelope pEnvelope = (IEnvelope)e.newEnvelope; IGraphicsContainer pGraphicsContainer = axMapControl2.Map as IGraphicsContainer; IActiveView pActiveView = pGraphicsContainer as IActiveView; //在绘制前,清除axMapControl2中的任何图形元素 pGraphicsContainer.DeleteAllElements(); IRectangleElement pRectangleEle = new RectangleElementClass(); IElement pElement = pRectangleEle as IElement; pElement.Geometry = pEnvelope; //设置鹰眼图中的红线框 IRgbColor pColor = new RgbColorClass(); pColor.Red = 255; pColor.Green = 0; pColor.Blue = 0; pColor.Transparency = 255; //产生一个线符号对象 ILineSymbol pOutline = new SimpleLineSymbolClass(); pOutline.Width = 3; pOutline.Color = pColor; //设置颜色属性 pColor = new RgbColorClass(); pColor.Red = 255; pColor.Green = 0; pColor.Blue = 0; pColor.Transparency = 0; //设置填充符号的属性 IFillSymbol pFillSymbol = new SimpleFillSymbolClass(); pFillSymbol.Color = pColor; pFillSymbol.Outline = pOutline; IFillShapeElement pFillShapeEle = pElement as IFillShapeElement; pFillShapeEle.Symbol = pFillSymbol; pGraphicsContainer.AddElement((IElement)pFillShapeEle, 0); pActiveView.PartialRefresh(esriViewDrawPhase.esriViewGraphics, null, null); }
private void axMapControl1_OnExtentUpdated(object sender, IMapControlEvents2_OnExtentUpdatedEvent e) { //创建矩形元素 IFillShapeElement fillShapeElement = ElementsHelper.GetRectangleElement(e.newEnvelope as IGeometry); //刷新总览窗体的mapcontrol if (m_FormOverview != null && !m_FormOverview.IsDisposed) { m_FormOverview.UpdateMapControlGraphics(fillShapeElement as IElement); } }
private void axMapControl1_OnExtentUpdated(object sender, IMapControlEvents2_OnExtentUpdatedEvent e) { if (Variable.pEagleEyeMapFrm == null || Variable.pEagleEyeMapFrm.IsDisposed) { Variable.pEnvelop = e.newEnvelope as IEnvelope; } else { Variable.pEnvelop = (IEnvelope)e.newEnvelope; EagleEyeClass.DrawRectangle(Variable.pEnvelop); } }
/// <summary> /// 作用:动态显示地图比例尺 /// 作者:汪建龙 /// 编写时间:2016年12月27日14:08:11 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void mapMain_OnExtentUpdated(object sender, IMapControlEvents2_OnExtentUpdatedEvent e) { try { string scale = Math.Round(mapMain.ActiveView.FocusMap.MapScale, 3).ToString("f2"); WorkBench.SetStatusBarValue("Scale", string.Format("比例尺:1:{0}", scale)); } catch (Exception ex) { WorkBench.SetStatusBarValue("Scale", ""); System.Diagnostics.Trace.WriteLine(ex); } }
public void OverViewSynchronizeDraw(object sender, IMapControlEvents2_OnExtentUpdatedEvent e) { IEnvelope pEnv; pEnv = (IEnvelope)e.newEnvelope; IGraphicsContainer pGraphicsContrainer; IActiveView pActiveView; pGraphicsContrainer = (IGraphicsContainer)m_axMapControl.Map; pActiveView = (IActiveView)pGraphicsContrainer; //在绘制新的矩形框前,清除Map对象中的任何图形元素 pGraphicsContrainer.DeleteAllElements(); IRectangleElement pRectangleEle = new RectangleElementClass(); IElement pEle = (IElement)pRectangleEle; pEle.Geometry = pEnv; IRgbColor pColor; pColor = new RgbColorClass(); pColor.Red = 255; pColor.Transparency = 255; ILineSymbol pOutLine = new SimpleLineSymbolClass(); pOutLine.Width = 1; pOutLine.Color = pColor; pColor = new RgbColorClass(); pColor.Red = 255; pColor.Transparency = 0; IFillSymbol pFillSymbol = new SimpleFillSymbolClass(); pFillSymbol.Color = pColor; pFillSymbol.Outline = pOutLine; IFillShapeElement pFillShapeEle; pFillShapeEle = (IFillShapeElement)pEle; pFillShapeEle.Symbol = pFillSymbol; pEle = (IElement)pFillShapeEle; pGraphicsContrainer.AddElement(pEle, 0); pActiveView.PartialRefresh(esriViewDrawPhase.esriViewGraphics, null, null); }
private void _axmapcontrol_OnExtentUpdated(object sender, IMapControlEvents2_OnExtentUpdatedEvent e) { if (!this.IsDisposed) { p1.Visible = p2.Visible = p3.Visible = p4.Visible = false; int x = Convert.ToInt32(point.X); int y = Convert.ToInt32(point.Y); _axmapcontrol.ActiveView.ScreenDisplay.DisplayTransformation.FromMapPoint(point, out x, out y); p1.Location = new System.Drawing.Point(x - 11, y - 1); p2.Location = new System.Drawing.Point(x - 1, y - 11); p3.Location = new System.Drawing.Point(x + 1, y - 1); p4.Location = new System.Drawing.Point(x - 1, y + 1); p1.Visible = p2.Visible = p3.Visible = p4.Visible = true; } }
private void axMapControl1_OnExtentUpdated(object sender, IMapControlEvents2_OnExtentUpdatedEvent e) { //创建鹰眼中线框 IEnvelope pEnv = (IEnvelope)e.newEnvelope; IRectangleElement pRectangleEle = new RectangleElementClass(); IElement pEle = pRectangleEle as IElement; pEle.Geometry = pEnv; //设置线框的边线对象,包括颜色和线宽 IRgbColor pColor = new RgbColorClass(); pColor.Red = 255; pColor.Green = 0; pColor.Blue = 0; pColor.Transparency = 255; // 产生一个线符号对象 ILineSymbol pOutline = new SimpleLineSymbolClass(); pOutline.Width = 2; pOutline.Color = pColor; // 设置颜色属性 pColor.Red = 255; pColor.Green = 0; pColor.Blue = 0; pColor.Transparency = 0; // 设置线框填充符号的属性 IFillSymbol pFillSymbol = new SimpleFillSymbolClass(); pFillSymbol.Color = pColor; pFillSymbol.Outline = pOutline; IFillShapeElement pFillShapeEle = pEle as IFillShapeElement; pFillShapeEle.Symbol = pFillSymbol; // 得到鹰眼视图中的图形元素容器 IGraphicsContainer pGra = axMapControl2.Map as IGraphicsContainer; IActiveView pAv = pGra as IActiveView; // 在绘制前,清除 axMapControl2 中的任何图形元素 pGra.DeleteAllElements(); // 鹰眼视图中添加线框 pGra.AddElement((IElement)pFillShapeEle, 0); // 刷新鹰眼 pAv.PartialRefresh(esriViewDrawPhase.esriViewGraphics, null, null); }
void MapCntrls_OnExtentUpdated(object sender, IMapControlEvents2_OnExtentUpdatedEvent e) { try { if (m_blnPanelSizeChanged) { return; } //try //{ if (m_blnInitialMaps) { IEnvelope pNewEnv = (IEnvelope)e.newEnvelope; //Get New envelope from e. 061516 HK //Check the sender AxMapControl FocusedMapCntrl = (AxMapControl)sender; IMapControl3 pFocusedMapContrl = (IMapControl3)FocusedMapCntrl.Object; //this event will be evoked only from the first map control that is same to the buddy of the toolbar control object objBuddy = axTools.Buddy; IToolbarControl2 ptbControl = (IToolbarControl2)axTools.Object; IMapControl3 BuddyMapCntrl = (IMapControl3)objBuddy; if (BuddyMapCntrl == pFocusedMapContrl) { int intMapCntrlCnt = this.m_axMapControls.Length; for (int i = 0; i < intMapCntrlCnt; i++) { string strName = "axMapControl" + i.ToString(); AxMapControl pMapCntrl = (AxMapControl)this.pnMapCntrls.Controls[strName]; if (pMapCntrl != FocusedMapCntrl) { pMapCntrl.Extent = pNewEnv; } } } } } catch (Exception ex) { frmErrorLog pfrmErrorLog = new frmErrorLog(); pfrmErrorLog.ex = ex; pfrmErrorLog.ShowDialog(); return; } }
private void ArcGisMapControl_OnExtentUpdated(object sender, IMapControlEvents2_OnExtentUpdatedEvent e) { if (LstArcGisMapControl == null) { return; } if (LstArcGisMapControl.Count == 0) { return; } foreach (AxMapControl arcgisMapControl in LstArcGisMapControl) { arcgisMapControl.Extent = e.newEnvelope as ESRI.ArcGIS.Geometry.IEnvelope; arcgisMapControl.ActiveView.Refresh(); } }
private void axMapControl1_OnExtentUpdated(object sender, IMapControlEvents2_OnExtentUpdatedEvent e) { //定义边界对象 IEnvelope pEnv; pEnv = e.newEnvelope as IEnvelope; IGraphicsContainer pGraphicsContainer; IActiveView pActiveView; //获取鹰眼图地图数据的图形容器句柄 pGraphicsContainer = axMapControl2.Map as IGraphicsContainer; pActiveView = pGraphicsContainer as IActiveView; pGraphicsContainer.DeleteAllElements(); IRectangleElement pRectangleEle; pRectangleEle = new RectangleElementClass(); IElement pEle; pEle = pRectangleEle as IElement; pEle.Geometry = pEnv; IRgbColor pColor; pColor = new RgbColor(); pColor.RGB = 255; pColor.Transparency = 255; ILineSymbol pOutline; pOutline = new SimpleLineSymbol(); pOutline.Width = 1; pOutline.Color = pColor; pColor = new RgbColor(); pColor.RGB = 255; pColor.Transparency = 0; IFillSymbol pFillSymbol; pFillSymbol = new SimpleFillSymbol(); pFillSymbol.Color = pColor; pFillSymbol.Outline = pOutline; IFillShapeElement pFillshapeEle; pFillshapeEle = pEle as IFillShapeElement; pFillshapeEle.Symbol = pFillSymbol; pEle = pFillshapeEle as IElement; pGraphicsContainer.AddElement(pEle, 0); pActiveView.PartialRefresh(esriViewDrawPhase.esriViewGraphics, null, null); }
private void axMapControl_1_OnExtentUpdated(object sender, IMapControlEvents2_OnExtentUpdatedEvent e) { //调动鹰眼图 //定义边界对象 IEnvelope pEnv = e.newEnvelope as IEnvelope; RectangleElement pRectangleEle = new RectangleElement(); IElement pEle = pRectangleEle as IElement; pEle.Geometry = pEnv; //定义图像句柄指向鹰眼图 IGraphicsContainer pGraphicsContainer = axMapControl_Eagle.Map as IGraphicsContainer; //获取鹰眼图地图数据的图形容器句柄 IActiveView pActiveView = pGraphicsContainer as IActiveView; pGraphicsContainer.DeleteAllElements(); //定义颜色 IRgbColor pColor = new RgbColor(); pColor.Red = 255; //定义线样式 ILineSymbol pOutline = new SimpleLineSymbol(); pOutline.Width = 2; pOutline.Color = pColor; //重新定义颜色 pColor = new RgbColor(); pColor.Transparency = 0; //定义填充样式 IFillSymbol pFillSymbol = new SimpleFillSymbol(); pFillSymbol.Color = pColor; pFillSymbol.Outline = pOutline; //定义填充元素样式 IFillShapeElement pFillshapeEle = pEle as IFillShapeElement; pFillshapeEle.Symbol = pFillSymbol; pEle = pFillshapeEle as IElement; //鹰眼图添加元素 pGraphicsContainer.AddElement(pEle, 0); pActiveView.PartialRefresh(esriViewDrawPhase.esriViewGraphics, null, null); }
//axMapControl1显示范围变化,axMapControl2绘制矩形框 private void axMapControl1_OnExtentUpdated(object sender, IMapControlEvents2_OnExtentUpdatedEvent e) { // 得到新范围 IEnvelope pEnv = (IEnvelope)e.newEnvelope; IGraphicsContainer pGra = axMapControl2.Map as IGraphicsContainer; IActiveView pAv = pGra as IActiveView; // 在绘制前,清除 axMapControl2 中的任何图形元素 pGra.DeleteAllElements(); IRectangleElement pRectangleEle = new RectangleElementClass(); IElement pEle = pRectangleEle as IElement; pEle.Geometry = pEnv; // 设置鹰眼图中的红线框 IRgbColor pColor = new RgbColorClass(); pColor.Red = 255; pColor.Green = 0; pColor.Blue = 0; pColor.Transparency = 255; // 产生一个线符号对象 ILineSymbol pOutline = new SimpleLineSymbolClass(); pOutline.Width = 2; pOutline.Color = pColor; // 设置颜色属性 pColor = new RgbColorClass(); pColor.Red = 255; pColor.Green = 0; pColor.Blue = 0; pColor.Transparency = 0; // 设置填充符号的属性 IFillSymbol pFillSymbol = new SimpleFillSymbolClass(); pFillSymbol.Color = pColor; pFillSymbol.Outline = pOutline; IFillShapeElement pFillShapeEle = pEle as IFillShapeElement; pFillShapeEle.Symbol = pFillSymbol; pGra.AddElement((IElement)pFillShapeEle, 0); // 刷新 pAv.PartialRefresh(esriViewDrawPhase.esriViewGraphics, null, null); }
private void axMapControl1_OnExtentUpdated(object sender, IMapControlEvents2_OnExtentUpdatedEvent e) { setMap2(e); }
private void axMapControl1_OnExtentUpdated(object sender, IMapControlEvents2_OnExtentUpdatedEvent e) { if ((topPublicMosaicLayer != null) && (botPublicMosaicLayer != null)) { if (((ILayer)topPublicMosaicLayer).MinimumScale >= m_MapControl.MapScale) { IEnvelope envCurrent = m_MapControl.ActiveView.Extent; IPoint ptViewCenter = new PointClass(); ptViewCenter.X = (m_MapControl.ActiveView.Extent.XMin + m_MapControl.ActiveView.Extent.XMax) / 2; ptViewCenter.Y = (m_MapControl.ActiveView.Extent.YMin + m_MapControl.ActiveView.Extent.YMax) / 2; ISpatialFilter pSFIndex = new SpatialFilterClass(); pSFIndex.SpatialRel = esriSpatialRelEnum.esriSpatialRelIntersects; pSFIndex.Geometry = envCurrent; //treat old images like 1980 1984 differently int ii = System.Array.IndexOf(oldYears, cboTopYear.Text); if (ii > -1) { IFeatureClass fcMosaicTop = topPublicMosaicLayer.MosaicDataset.Catalog; if (!(fcMosaicTop == null)) { IFeatureCursor pFCurSFResult = fcMosaicTop.Search(pSFIndex, true); ICursor pCursor = (ICursor)pFCurSFResult; string strClosetPhotoName = ""; int ixName = fcMosaicTop.Fields.FindField("Name"); int ixX = fcMosaicTop.Fields.FindField("CenterX"); int ixY = fcMosaicTop.Fields.FindField("CenterY"); IRow pRow = pCursor.NextRow(); double dsMin = 10000000000000000; while (!(pRow == null)) { double xCoor = ((System.IConvertible)pRow.get_Value(ixX)).ToDouble(null); double yCoor = ((System.IConvertible)pRow.get_Value(ixY)).ToDouble(null); double distance = (ptViewCenter.X - xCoor) * (ptViewCenter.X - xCoor) + (ptViewCenter.Y - yCoor) * (ptViewCenter.Y - yCoor); if (distance < dsMin) { dsMin = distance; strClosetPhotoName = pRow.get_Value(ixName).ToString(); } pRow = pCursor.NextRow(); } IMosaicFunction mosaicfunctionTop = topPublicMosaicLayer.MosaicDataset.MosaicFunction; mosaicfunctionTop.DefinitionExpression = "Name = " + "'" + strClosetPhotoName + "'"; IMapFrame MF1 = this.axPageLayoutControl1.FindElementByName("MapTop", 1) as IMapFrame; IMosaicLayer mlTopMF = Helper.FindMyMosaicLayer(MF1.Map, strTopYr); if (!(mlTopMF == null)) { IMosaicFunction mftopMosaicFunction = mlTopMF.MosaicDataset.MosaicFunction; mftopMosaicFunction.DefinitionExpression = mosaicfunctionTop.DefinitionExpression; } } } int iii = System.Array.IndexOf(oldYears, cboBotYear.Text); if (iii > -1) { IFeatureClass fcMosaicBot = botPublicMosaicLayer.MosaicDataset.Catalog; if (!(fcMosaicBot == null)) { IFeatureCursor pFCurSFResult = fcMosaicBot.Search(pSFIndex, true); ICursor pCursor = (ICursor)pFCurSFResult; string strClosetPhotoName = ""; int ixName = fcMosaicBot.Fields.FindField("Name"); int ixX = fcMosaicBot.Fields.FindField("CenterX"); int ixY = fcMosaicBot.Fields.FindField("CenterY"); IRow pRow = pCursor.NextRow(); double dsMin = 10000000000000000; while (!(pRow == null)) { double xCoor = ((System.IConvertible)pRow.get_Value(ixX)).ToDouble(null); double yCoor = ((System.IConvertible)pRow.get_Value(ixY)).ToDouble(null); double distance = (ptViewCenter.X - xCoor) * (ptViewCenter.X - xCoor) + (ptViewCenter.Y - yCoor) * (ptViewCenter.Y - yCoor); if (distance < dsMin) { dsMin = distance; strClosetPhotoName = pRow.get_Value(ixName).ToString(); } pRow = pCursor.NextRow(); } IMosaicFunction mosaicfunctionBot = botPublicMosaicLayer.MosaicDataset.MosaicFunction; mosaicfunctionBot.DefinitionExpression = "Name = " + "'" + strClosetPhotoName + "'"; IMapFrame MF2 = this.axPageLayoutControl1.FindElementByName("MapBot", 1) as IMapFrame; IMosaicLayer mlBotMF = Helper.FindMyMosaicLayer(MF2.Map, strBaseYr); if (!(mlBotMF == null)) { IMosaicFunction mfbotMosaicFunction = mlBotMF.MosaicDataset.MosaicFunction; mfbotMosaicFunction.DefinitionExpression = mosaicfunctionBot.DefinitionExpression; } } } double mapScale = m_MapControl.MapScale; m_MapControltop.CenterAt(ptViewCenter); m_MapControlbase.CenterAt(ptViewCenter); m_MapControltop.MapScale = mapScale; m_MapControlbase.MapScale = mapScale; m_MapControl.ActiveView.PartialRefresh(esriViewDrawPhase.esriViewGeography, null, null); //Update scale bar division length IElement eleScaleBar = this.axPageLayoutControl1.FindElementByName("Alternating Scale Bar", 1); IMapSurroundFrame msfScaleBar = eleScaleBar as IMapSurroundFrame; IMapSurround mapSurround = msfScaleBar.MapSurround; IScaleBar markerScaleBar = (IScaleBar)mapSurround; if (m_MapControl.MapScale < 500) { markerScaleBar.Division = 100; } else if (m_MapControl.MapScale < 1000) { markerScaleBar.Division = 250; } else if (m_MapControl.MapScale < 2000) { markerScaleBar.Division = 500; } else { markerScaleBar.Division = 1000; } } if (!(this.axPageLayoutControl1.FindElementByName("MapBot", 1) == null)) { m_bUpdateFocusMap1 = true; m_bUpdateFocusMap2 = true; SetExtent1(); SetExtent2(); } } }
private void axMapControl1_OnExtentUpdated(object sender, IMapControlEvents2_OnExtentUpdatedEvent e) { double scale = axMapControl1.ActiveView.FocusMap.MapScale; string a = scale.ToString("#0.00"); this.scaletextbox.Text = "1:" + a; IEnvelope penvelope = (IEnvelope)e.newEnvelope; IGraphicsContainer pgraghicscontainer = axMapControl2.Map as IGraphicsContainer; IActiveView pactiveview = pgraghicscontainer as IActiveView; pgraghicscontainer.DeleteAllElements(); IRectangleElement prectangle = new RectangleElementClass(); IElement pelement = prectangle as IElement; pelement.Geometry = penvelope; IRgbColor pcolor1 = new RgbColorClass(); pcolor1.Red = 255; pcolor1.Green = 0; pcolor1.Blue = 0; pcolor1.Transparency = 0; IRgbColor pcolor2 = new RgbColorClass(); pcolor2.Red = 255; pcolor2.Green = 0; pcolor2.Blue = 0; pcolor2.Transparency = 255; ISimpleFillSymbol simplefillsymbol = new SimpleFillSymbolClass(); simplefillsymbol.Color = pcolor1; simplefillsymbol.Outline.Color = pcolor2; simplefillsymbol.Outline.Width = 3; IFillShapeElement pfillshapefile = pelement as IFillShapeElement; pfillshapefile.Symbol = simplefillsymbol; pgraghicscontainer.AddElement((IElement)pfillshapefile, 0); axMapControl2.ActiveView.PartialRefresh(esriViewDrawPhase.esriViewGraphics, null, null); }
private void UcMap_OnExtentUpdated(object sender, IMapControlEvents2_OnExtentUpdatedEvent e) { if (MapExtentChanged != null) MapExtentChanged.Invoke(); }
private void axMapControl1_OnExtentUpdated(object sender, IMapControlEvents2_OnExtentUpdatedEvent e) { if (m_ucTripleMap != null && m_ucTripleMap.Visible) { m_ucTripleMap.MapExtent = this.axMapControl1.ActiveView.Extent; } }
void mapControlOnExtentUpdated(object sender, IMapControlEvents2_OnExtentUpdatedEvent e) { AxMapControl axControl= sender as AxMapControl; if (axControl == null) { return; } IMapControl4 mapControl4 = axControl.Object as IMapControl4; if (mapControl4 == null) { return; } IGraphicsContainer basicGraphicsContainer = mapControl4.Map.BasicGraphicsLayer as IGraphicsContainer; basicGraphicsContainer.Reset(); IElement currentElement = basicGraphicsContainer.Next(); IEnvelope extentEnvelope = e.newEnvelope as IEnvelope; IDisplayTransformation displayTransformation = e.displayTransformation as IDisplayTransformation; tagRECT displayRectangle = displayTransformation.get_DeviceFrame(); while (currentElement != null) { if (((IElementProperties)currentElement).Name == "DeleteMarker") { IPoint deleteMarkerLocation = new PointClass(); deleteMarkerLocation.SpatialReference = mapControl4.SpatialReference; deleteMarkerLocation = displayTransformation.ToMapPoint(displayRectangle.left + 45, displayRectangle.bottom - 45); currentElement.Geometry = deleteMarkerLocation; } else if (((IElementProperties)currentElement).Name == "AcceptMarker") { IPoint acceptMarkerLocation = new PointClass(); acceptMarkerLocation.SpatialReference = mapControl4.SpatialReference; acceptMarkerLocation = displayTransformation.ToMapPoint(displayRectangle.left + 45, displayRectangle.bottom - 45); currentElement.Geometry = acceptMarkerLocation; } currentElement = basicGraphicsContainer.Next(); } mapControl4.Refresh(esriViewDrawPhase.esriViewGraphics, null, null); }
private void axMapControl1_OnExtentUpdated(object sender, IMapControlEvents2_OnExtentUpdatedEvent e) { //AxMapControl mapControl = (AxMapControl)sender; //extent = mapControl.ActiveView.Extent; //MapExtent = extent; //mapExtentChange(extent); }
private void UCMap_OnExtentUpdated(object sender, IMapControlEvents2_OnExtentUpdatedEvent e) { if (scaleUpdated != null) scaleUpdated(MapScale); ucMapNavigate1.MapScale = (int) base.MapScale; // �õ��·�Χ IEnvelope pEnv = (IEnvelope) e.newEnvelope; IGraphicsContainer pGra = this.Map as IGraphicsContainer; IActiveView pAv = pGra as IActiveView; //�ڻ���ǰ�����axMapControl2�е��κ�ͼ��Ԫ�� pGra.DeleteAllElements(); IRectangleElement pRectangleEle = new RectangleElementClass(); IElement pEle = pRectangleEle as IElement; pEle.Geometry = pEnv; //����ӥ��ͼ�еĺ��߿� IRgbColor pColor = new RgbColorClass(); pColor.Red = 255; pColor.Green = 0; pColor.Blue = 0; pColor.Transparency = 255; //����һ���߷��Ŷ��� ILineSymbol pOutline = new SimpleLineSymbolClass(); pOutline.Width = 1; pOutline.Color = pColor; //������ɫ���� pColor = new RgbColorClass(); pColor.Red = 255; pColor.Green = 0; pColor.Blue = 0; pColor.Transparency = 0; //���������ŵ����� IFillSymbol pFillSymbol = new SimpleFillSymbolClass(); pFillSymbol.Color = pColor; pFillSymbol.Outline = pOutline; IFillShapeElement pFillShapeEle = pEle as IFillShapeElement; pFillShapeEle.Symbol = pFillSymbol; pGra.AddElement((IElement) pFillShapeEle, 0); pAv.PartialRefresh(esriViewDrawPhase.esriViewGraphics, null, null); }
private void axMapControl1_OnExtentUpdated(object sender, IMapControlEvents2_OnExtentUpdatedEvent e) { pEn = e.newEnvelope as IEnvelope; axMapControl2.ActiveView.PartialRefresh(esriViewDrawPhase.esriViewForeground, null, null); }
//������ӥ�۵���ק����ʵ�ִ��� private void axMapControl1_OnExtentUpdated(object sender, IMapControlEvents2_OnExtentUpdatedEvent e) { IElement element = m_AOI as IElement; element.Geometry = e.newEnvelope as IGeometry; UpdateUI(); }