private void axMapControlContent_OnMouseMove(object sender, IMapControlEvents2_OnMouseMoveEvent e) { IActiveView pActiveView = axMapControlContent.ActiveView; IMap pMap = axMapControlContent.Map; // 得到一个Envelop对象 IPoint point; point = axMapControlContent.ToMapPoint(e.x, e.y); // 新建选择集环境对象 ISelectionEnvironment pSelectionEnv; pSelectionEnv = new SelectionEnvironmentClass(); pSelectionEnv.DefaultColor = GetRGBColor(233, 150, 122); // 选择要素,将它们放入到选择集 pMap.SelectByShape(point, pSelectionEnv, true); //获取高亮选择集要素 ISelection selection = pMap.FeatureSelection; IEnumFeatureSetup enumFeatureSetup = selection as IEnumFeatureSetup; enumFeatureSetup.AllFields = true; IEnumFeature enumFeature = enumFeatureSetup as IEnumFeature; enumFeature.Reset(); IFeature feature = enumFeature.Next(); while (feature != null) { label1.Text = feature.get_Value(feature.Fields.FindField("Name")).ToString();//可以得到任意字段的值 textBoxDescription.Text = feature.get_Value(feature.Fields.FindField("Description")).ToString(); label3.Text = feature.get_Value(feature.Fields.FindField("URL")).ToString(); feature = enumFeature.Next(); } pActiveView.PartialRefresh(esriViewDrawPhase.esriViewGeoSelection, null, null); }
private void axMapControl1_OnMouseMove(object sender, IMapControlEvents2_OnMouseMoveEvent e) { AxMapControl MapControl = (AxMapControl)sender; if (e.button == 4 && axMapControl1.ActiveView != null) { MapControl.ActiveView.ScreenDisplay.PanMoveTo(axMapControl1.ActiveView.ScreenDisplay.DisplayTransformation.ToMapPoint(e.x, e.y)); } }
private void mapCtlMain_OnMouseMove(object sender, IMapControlEvents2_OnMouseMoveEvent e) { if (m_bEditNode) { m_editor.EditFeatureMouseMove(e.x, e.y); } ILayer lyr; for (int i = 0; i < this.mapCtlMain.LayerCount; i++) { lyr = this.mapCtlMain.get_Layer(i); if (lyr is ITinLayer) { this.m_tin = ((ITinLayer)lyr).Dataset; } } if (m_tin != null) { IPoint point = new PointClass(); point.X = e.mapX; point.Y = e.mapY; ISurface sur = m_tin as ISurface; double z = sur.GetElevation(point); string zStr = ",Z=" + z.ToString("#######.##"); this.StatusBar.Panels[2].Text = string.Format("{0}, {1} {2} {3}", "X=" + e.mapX.ToString("#######.##"), "Y=" + e.mapY.ToString("#######.##"), zStr, this.mapCtlMain.MapUnits.ToString().Substring(4)); } else { this.StatusBar.Panels[2].Text = string.Format("{0}, {1} {2}", "X=" + e.mapX.ToString("#######.##"), "Y=" + e.mapY.ToString("#######.##"), this.mapCtlMain.MapUnits.ToString().Substring(4)); } string XN = e.mapX.ToString(); string YE = e.mapY.ToString(); this.PlanarToGeoCoor(ref XN, ref YE); this.StatusBar.Panels[3].Text = YE + " N " + XN + " E"; }
private void mapControl_OnMouseMove(object sender, IMapControlEvents2_OnMouseMoveEvent e) { textBlock1.Text = " X,Y Coordinates on Map: " + string.Format("{0}, {1} {2}", e.mapX.ToString("#######.##"), e.mapY.ToString("#######.##"), mapControl.MapUnits.ToString().Substring(4)); }
private void axMapControl1_OnMouseMove(object sender, IMapControlEvents2_OnMouseMoveEvent e) { if (e.button == 1 && search)//如果是查询状态并且是左键点击 { identifyDialog.OnMouseMove(e.mapX, e.mapY); } statusBarXY.Text = string.Format("{0}, {1} {2}", e.mapX.ToString("#######.##"), e.mapY.ToString("#######.##"), axMapControl1.MapUnits.ToString().Substring(4)); }
private void axMapControl2_OnMouseMove(object sender, IMapControlEvents2_OnMouseMoveEvent e) { if (e.button == 1) { IPoint ppoint = new PointClass(); ppoint.PutCoords(e.mapX, e.mapY); axMapControl1.CenterAt(ppoint); axMapControl1.ActiveView.PartialRefresh(esriViewDrawPhase.esriViewGraphics, null, null); } }
private void axMapControl_OnMouseMove(object sender, IMapControlEvents2_OnMouseMoveEvent e) { toolStripStatusLabel1.Text = " 当前坐标 X = " + e.mapX.ToString() + " Y = " + e.mapY.ToString() + " " + axMapControl.MapUnits; }
private void axMapControl1_OnMouseMove(object sender, IMapControlEvents2_OnMouseMoveEvent e) { try { //'状态栏显示当前坐标,wgs84,经纬度 //'StatusBar1.Panels(1).Text = Format(mapX, ".0") & " " & Format(mapY, ".0") & " " & "Degree" 'sMapUnits //MDIApplication.ParentForm pfrm = new ParentForm(); this.toolStripStatusLabel4.Text = "X坐标:" + e.mapX.ToString() + "," + "Y坐标:" + e.mapY.ToString(); //ypp需要改 //StatusBar1.Panels(3) = "MapX:" & mapX & " " & "MapY:" & mapY; //this.axMapControl1.MousePointer = esriPointerDefault; this.axMapControl1.MousePointer = esriControlsMousePointer.esriPointerDefault; if (MDIApplication.ParentForm.pyBtn == 1) { if (m_pDisplayFeedback != null) { ////////IPoint pPoint; //' 得到鼠标点击位置在地图上的坐标 //Set pPoint = m_pScreenDisplay.displayTransformation.ToMapPoint(X, Y) //'pPoint.x = X_First pPoint.Y = Y_First; m_pDisplayFeedback.MoveTo(pPoint); } return; } else { return; } } catch { return; } }
private void axMapControlMain_OnMouseMove(object sender, IMapControlEvents2_OnMouseMoveEvent e) { this.toolStripStatusLabelCoordinate.Text = string.Format("{0} {1} {2} {3}","当前坐标:", e.mapX.ToString("#######.###"), e.mapY.ToString("#######.###"), this.axMapControlMain.MapUnits.ToString().Substring(4)); }
private void axMapControl1_OnMouseMove(object sender, IMapControlEvents2_OnMouseMoveEvent e) { toolStripLabel3.Text = " 当前坐标 X = " + e.mapX.ToString("F8") + " Y = " + e.mapY.ToString("F8"); }
private void axMapControl1_OnMouseMove(object sender, IMapControlEvents2_OnMouseMoveEvent e) { statusBarXY.Text = string.Format("{0}, {1} {2}", e.mapX.ToString("#######.##"), e.mapY.ToString("#######.##"), axMapControl1.MapUnits.ToString().Substring(4)); }
private void axMapControl_OnMouseMove(object sender, IMapControlEvents2_OnMouseMoveEvent e) { sMapUnits = Utils.MapUtils.GetMapUnit(axMapControl.Map.MapUnits); StatusBarInfoSet(String.Format("当前坐标:X = {0:#.######} Y = {1:#.######} {2}", e.mapX, e.mapY, sMapUnits)); pMovePt = (axMapControl.Map as IActiveView).ScreenDisplay.DisplayTransformation.ToMapPoint(e.x, e.y); if (!ApplicationV.IsBanFormMainMapClick) { #region 长度量算 if (pMouseOperate == "MeasureLength") { if (pNewLineFeedback != null) { pNewLineFeedback.MoveTo(pMovePt); } double deltaX = 0; //两点之间X差值 double deltaY = 0; //两点之间Y差值 if ((pPointPt != null) && (pNewLineFeedback != null)) { deltaX = pMovePt.X - pPointPt.X; deltaY = pMovePt.Y - pPointPt.Y; dSegmentLength = Math.Round(Math.Sqrt((deltaX * deltaX) + (deltaY * deltaY)), 3); dToltalLength = dToltalLength + dSegmentLength; if (frmMeasureResult != null) { frmMeasureResult.lblMeasureResult.Text = String.Format( "当前线段长度:{0} ({1});\r\n总长度为:{2} ({1})", dSegmentLength.ToString("f6"), sMapUnits, dToltalLength.ToString("f6")); dToltalLength = dToltalLength - dSegmentLength; //鼠标移动到新点重新开始计算 } frmMeasureResult.frmClosed += new FormMeasureResult.FormMeasureResult.FormClosedEventHandler(frmMeasureResult_frmColsed); } } #endregion #region 面积量算 if (pMouseOperate == "MeasureArea") { if (pNewPolygonFeedback != null) { pNewPolygonFeedback.MoveTo(pMovePt); } IPointCollection pPointCol = new Polygon(); IPolygon pPolygon = new PolygonClass(); IGeometry pGeo = null; ITopologicalOperator pTopo = null; for (int i = 0; i <= pAreaPointCol.PointCount - 1; i++) { pPointCol.AddPoint(pAreaPointCol.get_Point(i), ref missing, ref missing); } pPointCol.AddPoint(pMovePt, ref missing, ref missing); if (pPointCol.PointCount < 3) { return; } pPolygon = pPointCol as IPolygon; if ((pPolygon != null)) { pPolygon.Close(); pGeo = pPolygon as IGeometry; pTopo = pGeo as ITopologicalOperator; //使几何图形的拓扑正确 pTopo.Simplify(); pGeo.Project(axMapControl.Map.SpatialReference); IArea pArea = pGeo as IArea; frmMeasureResult.lblMeasureResult.Text = String.Format( "总面积为:{0} (平方{1});\r\n总长度为:{2} ({1})", pArea.Area.ToString("F7"), sMapUnits, pPolygon.Length.ToString("F7")); pPolygon = null; } } #endregion } }
private void MapControl_OnMouseMove(object sender, IMapControlEvents2_OnMouseMoveEvent e) { lblCoordinate.Text = String.Format("{0} {1} {2}", e.mapX.ToString("#######.###"), e.mapY.ToString("#######.###"), MapControl.MapUnits.ToString().Substring(4)); lblSpatialReference.Text = "WGS_1984_UTM_Zone_40N"; }
//移动 private void axMapControl1_OnMouseMove(object sender, IMapControlEvents2_OnMouseMoveEvent e) { lblCoords.Text = string.Format("{0:#.#####},{1:#.#####}", e.mapX, e.mapY); }
private void axMapControl1_OnMouseMove(object sender, IMapControlEvents2_OnMouseMoveEvent e) { textBox1.Text = String.Format("X:" + e.mapX + "\t" + "Y:" + e.mapY);//显示当前鼠标指向的地图坐标 }
private void axMapControl1_OnMouseMove(object sender, IMapControlEvents2_OnMouseMoveEvent e) { IActiveView pActiveView = axMapControl1.ActiveView.FocusMap as IActiveView; IPoint pPoint = pActiveView.ScreenDisplay.DisplayTransformation.ToMapPoint(e.x, e.y); object Missing = Type.Missing; switch (m_BasicOperationTool) { case "isMeasure": if (!m_bInUse) break; bool bFirstTime = false; if (m_pLineSymbol == null) bFirstTime = true; pActiveView.ScreenDisplay.StartDrawing(pActiveView.ScreenDisplay.hDC, -1); if (bFirstTime == true) { IRgbColor pRgbColor = new RgbColorClass(); m_pLineSymbol = new SimpleLineSymbolClass(); m_pLineSymbol.Width = 2; pRgbColor.Red = 223; pRgbColor.Green = 223; pRgbColor.Blue = 223; m_pLineSymbol.Color = pRgbColor; ISymbol pSymbol = m_pLineSymbol as ISymbol; pSymbol.ROP2 = esriRasterOpCode.esriROPXOrPen; //�����ı����� m_pTextSymbol = new TextSymbolClass(); m_pTextSymbol.HorizontalAlignment = esriTextHorizontalAlignment.esriTHACenter; m_pTextSymbol.VerticalAlignment = esriTextVerticalAlignment.esriTVACenter; m_pTextSymbol.Size = 16; pSymbol = m_pTextSymbol as ISymbol; stdole.IFontDisp fnt = (stdole.IFontDisp)new stdole.StdFontClass(); fnt.Name = "Arial"; fnt.Size = Convert.ToDecimal(20); m_pTextSymbol.Font = fnt; pSymbol.ROP2 = esriRasterOpCode.esriROPXOrPen; //�������Ի��ı� m_pTextPoint = new PointClass(); } else { pActiveView.ScreenDisplay.SetSymbol(m_pTextSymbol as ISymbol); pActiveView.ScreenDisplay.DrawText(m_pTextPoint, m_pTextSymbol.Text); pActiveView.ScreenDisplay.SetSymbol(m_pLineSymbol as ISymbol); if (m_pLinePolyline.Length > 0) pActiveView.ScreenDisplay.DrawPolyline(m_pLinePolyline); } //����㵽�յ�֮������߲������ı��ĽǶ� ILine pLine = new LineClass(); pLine.PutCoords(m_pStartPoint, pPoint); double angle = pLine.Angle; angle = angle * (180 / 3.1415926); if ((angle > 90) || (angle < 180)) angle = angle + 180; if ((angle < 0) || (angle > -90)) angle = angle - 180; if ((angle < -90) || (angle > -180)) angle = angle - 180; if (angle > 180) angle = angle - 180; //Ϊ�˻����ı�������ı��ľ��룬�ǶȺ͵� double deltaX = pPoint.X - m_pStartPoint.X; double deltaY = pPoint.Y - m_pStartPoint.Y; m_pTextPoint.X = m_pStartPoint.X + deltaX / 2; m_pTextPoint.Y = m_pStartPoint.Y + deltaY / 2; m_pTextSymbol.Angle = angle; int distance = Convert.ToInt32(Math.Sqrt((deltaX * deltaX) + (deltaY * deltaY))); m_pTextSymbol.Text = "[" + distance.ToString() + "]"; //�����ı� pActiveView.ScreenDisplay.SetSymbol(m_pTextSymbol as ISymbol); pActiveView.ScreenDisplay.DrawText(m_pTextPoint, m_pTextSymbol.Text); //��ö���� IPolyline pPolyline = new PolylineClass(); ISegmentCollection pSegColl = pPolyline as ISegmentCollection; pSegColl.AddSegment(pLine as ISegment, ref Missing, ref Missing); m_pLinePolyline = GetSmashedLine(pActiveView.ScreenDisplay, m_pTextSymbol as ISymbol, m_pTextPoint, pPolyline); //���ƶ���� pActiveView.ScreenDisplay.SetSymbol(m_pLineSymbol as ISymbol); if (m_pLinePolyline.Length > 0) { pActiveView.ScreenDisplay.DrawPolyline(m_pLinePolyline); } pActiveView.ScreenDisplay.FinishDrawing(); break; } }
private void axMapControl1_OnMouseMove(object sender, IMapControlEvents2_OnMouseMoveEvent e) { string XYTxt = "经度:" + e.mapX.ToString("#0.0000") + ",纬度:" + e.mapY.ToString("#0.0000") + " 地图比例尺:1:" + axMapControl1.MapScale.ToString("#0"); this.bSI_xy.Caption = XYTxt; }
private void axMapControl2_OnMouseMove(object sender, IMapControlEvents2_OnMouseMoveEvent e) { if (e.button == 1) { IElement element = m_AOI as IElement; IEnvelope envelope = element.Geometry.Envelope as IEnvelope; if (HitTest(envelope, e.mapX, e.mapY)) { IPoint point = new PointClass(); point.PutCoords(e.mapX, e.mapY); envelope.CenterAt(point); m_AOI.Geometry = envelope; this.UpdateUI(); } } }
private void axMapControl1_OnMouseMove(object sender, IMapControlEvents2_OnMouseMoveEvent e) { if (e.button == 1) //设置右键 { IPoint pPoint = new PointClass(); pPoint.PutCoords(e.mapX, e.mapY); Global.eagleeye.CenterAt(pPoint); Global.eagleeye.ActiveView.PartialRefresh(esriViewDrawPhase.esriViewGeography, null, null); } }
/// <summary> /// 鼠标移动,各种工作中鼠标移动的处理是一致的 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void axMapControl1_OnMouseMove(object sender, IMapControlEvents2_OnMouseMoveEvent e) { IPoint pPoint = new PointClass(); pPoint.PutCoords(e.mapX, e.mapY); if (this.pDisplayFeedback != null) { this.pDisplayFeedback.MoveTo(pPoint); } }
//地图状态栏 private void axMapControl1_OnMouseMove(object sender, IMapControlEvents2_OnMouseMoveEvent e) { // 显示当前比例尺 this.StatusScale.Text = " 比例尺 1:" + ((long)this.axMapControl1.MapScale).ToString(); // 显示当前坐标 this.StatusCoordinate.Text = " 当前坐标 X = " + Math.Round(e.mapX, 4).ToString() + " Y = " + Math.Round(e.mapY, 4).ToString() + " " + this.axMapControl1.MapUnits; }
private void axMapControl1_OnMouseMove(object sender, IMapControlEvents2_OnMouseMoveEvent e) { this.coorText.Text = string.Format("{0}{1}{2}{3} {4}", "���꣺", e.mapX.ToString("#######.###"), "��", e.mapY.ToString("#######.###"), axMapControl1.MapUnits.ToString().Substring(4)); }
private void mapControl_OP_OnMouseMove(object sender, IMapControlEvents2_OnMouseMoveEvent e) { if (m_currentButton == 1 || m_currentButton == 2 || m_currentButton == 3) { var pt = mapControl_OP.ActiveView.ScreenDisplay.DisplayTransformation.ToMapPoint(e.x, e.y); SnapSetting.getSnapPoint(pt); } }
private void axMapControl_OnMouseMove(object sender, IMapControlEvents2_OnMouseMoveEvent e) { if (_App.CurrentTool != null) { _Tool = _ToolCol[_App.CurrentTool]; _Tool.OnMouseMove(e.button, e.shift, (int)e.mapX, (int)e.mapY); } statusButton2.Text = " 当前坐标X:" + e.mapX.ToString() + " Y:" + e.mapY.ToString(); statusButton3.Text = "比例尺:" + ((long)(_mapControl.MapScale)).ToString(); }
/// <summary> /// 鼠标移动的事件处理 /// </summary> public void OnMouseMove(object sender, IMapControlEvents2_OnMouseMoveEvent e) { //必须在画框的过程中才调用鼠标移动函数 if (trackNewEnvelope == null) return; //获取移动点 IPoint moveToPoint = new PointClass(); moveToPoint.PutCoords(e.mapX, e.mapY); moveToPoint.SpatialReference = pAxMapControl.SpatialReference; //显示当前位置 DisplayCoordinates(e.mapX, e.mapY); // trackNewEnvelope.MoveTo(moveToPoint); }
//移动axMapControl2矩形框,同时也改变axMapControl1显示范围。 private void axMapControl2_OnMouseMove(object sender, IMapControlEvents2_OnMouseMoveEvent e) { // 如果不是左键按下就直接返回 if (e.button != 1) return; IPoint pPoint = new PointClass(); pPoint.PutCoords(e.mapX, e.mapY); this.axMapControl1.CenterAt(pPoint); this.axMapControl1.ActiveView.PartialRefresh(esriViewDrawPhase.esriViewGeography, null, null); }
private void axMapControl1_OnMouseMove(object sender, IMapControlEvents2_OnMouseMoveEvent e) { ScaleLabel.Text = "1:" + ((long)this.axMapControl1.MapScale).ToString(); CoordnateLabel.Text = "x=" +e.x.ToString()+ "|" + "y=" + e.y.ToString()+this.axMapControl1.MapUnits; }
private void mainMapControl_OnMouseMove(object sender, IMapControlEvents2_OnMouseMoveEvent e) { //this.lblCurrentLocation.Text = string.Format("{0},{1},{2}", e.mapX.ToString("#######.###"), e.mapY.ToString("#######.###"), this.mainMapControl.MapUnits.ToString().Substring(4)); this.lblCurrentLocation.Text = string.Format("{0} {1} {2}", e.mapX.ToString("#######.###"), e.mapY.ToString("#######.###"), this.mainMapControl.MapUnits.ToString().Substring(4)); }
private void axMapControl2_OnMouseMove(object sender, IMapControlEvents2_OnMouseMoveEvent e) { if (isTrackingSmallViewer) { moveCount++; if (moveCount % 4 == 0)//因为一刷新,红框就没了。所以每移动4次就刷新一下,保持红框的连续性。 axMapControl2.ActiveView.PartialRefresh(esriViewDrawPhase.esriViewForeground, null, null); pSmallViewerMouseDownPt.PutCoords(e.mapX, e.mapY); pSmallViewerEnvelope.MoveTo(pSmallViewerMouseDownPt); } }
private void UcMap_OnMouseMove(object sender, IMapControlEvents2_OnMouseMoveEvent e) { if (MapMouseMove != null) { IPoint pt = new PointClass(); pt.PutCoords(e.mapX, e.mapY); pt.SpatialReference = UcMap.Map.SpatialReference; MapMouseMove.Invoke(pt); } }
private void axMapControl2_OnMouseMove(object sender, IMapControlEvents2_OnMouseMoveEvent e) { //if (e.button != 1) // return; //IPoint pPt = new PointClass(); //pPt.X = e.mapX; //pPt.Y = e.mapY; //axMapControl1.CenterAt(pPt); //axMapControl2.ActiveView.PartialRefresh(esriViewDrawPhase.esriViewGeography, null, null); if (e.button == 1) { IPoint pPoint = new PointClass(); pPoint.PutCoords(e.mapX, e.mapY); axMapControl1.CenterAt(pPoint); axMapControl1.ActiveView.PartialRefresh(esriViewDrawPhase.esriViewGeography, null, null); } }
private void mapControl_OnMouseMove(object sender, IMapControlEvents2_OnMouseMoveEvent e) { System.Console.WriteLine(e.mapX.ToString()); System.Windows.MessageBox.Show(e.mapX.ToString()); }