/// <summary> /// 地图鼠标按下事件 /// </summary> private void picBoxMap_MouseDown(object sender, MouseEventArgs e) { isClick = true; switch (operationType) { case MapOperation.SelectElement: break; case MapOperation.ZoomIn: break; case MapOperation.ZoomOut: break; case MapOperation.Pan: //漫游 mouseOldLoc = e.Location; break; case MapOperation.SelectFeatures: //选择要素 startPoint = e.Location; break; case MapOperation.Edit: //编辑要素 mouseOldLoc = e.Location; SelectByPoint(e.Location, EditingIndex); UpdateMapImg(); //重绘 break; case MapOperation.EditVertices: //编辑要素顶点 myMap.Layers[EditingIndex].SelectVertex(e.Location, picBoxMap.Bounds, centerLngLat, ratio * scaleChoice[scaleIndex]); break; case MapOperation.CreateFeatures: //创建要素 if (e.Button == MouseButtons.Left && e.Clicks == 1) { UpdateMapImg(); picBoxMap.Refresh(); trackingPoint = new Point(e.Location.X, e.Location.Y); switch (myMap.Layers[EditingIndex].DataType) { case MySpaceDataType.MyPoint: myMap.AddFeature(ScreenToWGS84(trackingPoint), EditingIndex); DrawTrackingFeature(); //点要素在这里画编辑的图形 break; case MySpaceDataType.MyPolyLine: trackingPoints.Add(trackingPoint); wgsPoints.Add(ScreenToWGS84(trackingPoint)); break; case MySpaceDataType.MyPolygon: trackingPoints.Add(trackingPoint); wgsPoints.Add(ScreenToWGS84(trackingPoint)); break; } } break; case MapOperation.Identify: break; } }