/// <summary> /// 获取鼠标位置的地点ID /// </summary> /// <param name="p_point"></param> public string GetMouseLocationPlaceID(double x, double y) { if (_placeLocation == null || _placeLocation.Count == 0) { return(""); } ClientUtile clientUtile = ClientUtile.Create(); foreach (var itm in _placeLocation) { string placeid = itm.Key; var list = ShowMap.DrawList.Where(item => item.Key.StartsWith(placeid + "-")).ToList(); if (list != null && list.Count > 0) { for (int i = 0; i < list.Count; i++) { ReturnDrawGraphicInfo info = list[i].Value as ReturnDrawGraphicInfo; if (info != null) { if (x >= info.GraphicExtent.Xy1.X && x <= info.GraphicExtent.Xy2.X && y >= info.GraphicExtent.Xy2.Y && y <= info.GraphicExtent.Xy1.Y) { List <MapPointEx> points = null; if (info.QueryObject is PolygonQueryBehaviorEventArgs) { points = (info.QueryObject as PolygonQueryBehaviorEventArgs).Points; } if (info.QueryObject is CircleBehaviorEventArgs) { points = (info.QueryObject as CircleBehaviorEventArgs).Points; } if (info.QueryObject is RectangleQueryBehaviorEventArgs) { points = (info.QueryObject as RectangleQueryBehaviorEventArgs).Points; } if (points == null || points.Count == 0) { continue; } List <Point> pList = new List <Point>(); points.ForEach(item => pList.Add(new Point(item.X, item.Y))); if (clientUtile.CalcPointPolygonRelation(new Point(x, y), pList.ToArray())) { return(placeid); } } } } } } return(""); }
public object Convert(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture) { ActivityPlaceLocation activityPlaceLocation = value as ActivityPlaceLocation; if (activityPlaceLocation != null) { ClientUtile client = ClientUtile.Create(); double[] a = client.DecimalDegreeToDegree(activityPlaceLocation.LocationLG); string str = ""; if (a.Length > 0) { str = a[0] + "°" + a[1] + "′" + a[2] + "″"; } return(str); } else { return("0"); } }
private void DrawLine(MapPointEx[] arrPoint) { if (arrPoint != null && arrPoint.Length > 1) { mapLayer.DrawPolyLine(arrPoint.ToList(), new I_GS_MapBase.Portal.SymbolElement("track") { ControlTemplate = Obj.screenMap.MainMap.Resources["TrackLine"], DataSources = new List<KeyValuePair<string, object>>{ new KeyValuePair<string,object>("Visibled","Visible"), } }); ClientUtile client = ClientUtile.Create(); double angle = client.GetAzimuthAngle(arrPoint[1].X, arrPoint[1].Y, arrPoint[0].X, arrPoint[0].Y); PointEx pNew = client.GetRelativePoint(new PointEx(arrPoint[1].X, arrPoint[1].Y),angle,2); mapLayer.DrawArrow(new List<MapPointEx>() { Obj.screenMap.GetMapPointEx(pNew.X,pNew.Y), arrPoint[1] }, new I_GS_MapBase.Portal.SymbolElement("track") { DataSources = new List<KeyValuePair<string, object>>{ new KeyValuePair<string,object>(GraphicStyle.ArrowSize.ToString(),"10"), new KeyValuePair<string,object>(GraphicStyle.ArrowColor.ToString(),"Green"), } }); } }