/// <summary> /// 左键弹起 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> void mapControl_eventLButtonUp(object sender, _DHOSOFTMapControlEvents_eventLButtonUpEvent e) { //if (!isShift) //{ // isFinish = true; // isMouseDown = false; // RegistCommondExecutedEvent(); //} if (!isControl) { if (!string.IsNullOrEmpty(tempName)) { mapControl.MgsDelObject(tempName); } Kml kml = new Kml(); KmlCircle circle = new KmlCircle(); kml.Placemark.Name = "mgis_circle" + Utils.ElementIndex; circle.Position = centerPoint; circle.RandomPosition = new MapLngLat(e.dLong, e.dLat); circle.StrokeColor = System.Drawing.Color.Red; circle.FillColor = System.Drawing.Color.FromArgb(0, System.Drawing.Color.White); circle.StrokeWidth = 3; kml.Placemark.Graph = circle; IMFElement element = null; layer.AddElement(kml, out element); circleElement = element as IMFCircle; RegistCommondExecutedEvent(); ReleaseCommond();//修改 陈静 isFinish = true; isMouseDown = false; } }
/// <summary> /// 鼠标左键弹起事件 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void mapControl_eventLButtonUp(object sender, _DHOSOFTMapControlEvents_eventLButtonUpEvent e) { keyDown = false; mapControl.eventMouseMove -= mapControl_eventMouseMove; mapControl.eventLButtonDown -= mapControl_eventLButtonDown; mapControl.eventLButtonUp -= mapControl_eventLButtonUp; }
/// <summary> /// 鼠标弹起结束绘制 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> void mapControl_eventLButtonUp(object sender, _DHOSOFTMapControlEvents_eventLButtonUpEvent e) { if (!isControl) { MapLngLat p1 = new MapLngLat(e.dLong, listPoints[0].Lat); MapLngLat p2 = new MapLngLat(e.dLong, e.dLat); MapLngLat p3 = new MapLngLat(listPoints[0].Lng, e.dLat); listPoints.Add(p1); listPoints.Add(p2); listPoints.Add(p3); if (!string.IsNullOrEmpty(tempName)) { mapControl.MgsDelObject(tempName); } Kml kml = new Kml(); KmlPolygon rectangle = new KmlPolygon(); kml.Placemark.Name = "mgis_rec" + Utils.ElementIndex; rectangle.PositionList = listPoints; rectangle.FillColor = System.Drawing.Color.FromArgb(0, System.Drawing.Color.White); rectangle.OutLineColor = System.Drawing.Color.Red; rectangle.OutLineSize = 3; kml.Placemark.Graph = rectangle; IMFElement element = null; layer.AddElement(kml, out element); recElement = element as IMFPolygon; RegistCommondExecutedEvent(); ReleaseCommond();//修改 陈静 isFinish = true; listPoints.Clear(); } }
//弹起 private void mapControl_eventLButtonUp(object sender, _DHOSOFTMapControlEvents_eventLButtonUpEvent e) { mapControl.eventLButtonUp -= mapControl_eventLButtonUp; if (e.x == startPoint.X && e.y == startPoint.Y) { return; } string objXml = ""; if (startPoint.X < e.x) { if (startPoint.Y < e.y) { //左右下 objXml = mapControl.pickupByRect(startPoint.X, startPoint.Y, e.x, e.y); } else { //左右上 objXml = mapControl.pickupByRect(startPoint.X, e.y, e.x, startPoint.Y); } } else { if (startPoint.Y < e.y) { //右左下 objXml = mapControl.pickupByRect(e.x, startPoint.Y, startPoint.X, e.y); } else { //右左上 objXml = mapControl.pickupByRect(e.x, e.y, startPoint.X, startPoint.Y); } } if (string.IsNullOrEmpty(objXml)) { return; } this.ClearSelectElements();//先清理列表 XmlDocument xmlDoc = new XmlDocument(); xmlDoc.LoadXml(objXml); XmlNode nodes = xmlDoc.SelectSingleNode("root"); foreach (XmlLinkedNode note in nodes.ChildNodes) { IMFElement element = this.mapLogic.GetElement(note.Attributes[0].Value + ""); element.HightLight(true); this.AddElementtoList(element); } RegistCommondExecutedEvent(); }
//地图控件鼠标左键弹起事件 private void axMapControl_eventLButtonUp(object sender, _DHOSOFTMapControlEvents_eventLButtonUpEvent e) { if (Utils.bPublishEvent == false) { return; } MapLngLat lnglat = new MapLngLat(e.dLong, e.dLat); MFMouseEventArgs args = new MFMouseEventArgs(lnglat, MouseButtons.Left, e.x, e.y); if (MouseUpEvent != null) { MouseUpEvent.Invoke(this, args); } }