void _watcher_PositionChanged(object sender, GeoPositionChangedEventArgs <GeoCoordinate> e) { MRGCSearch.GPSToOffset(new double[] { e.Position.Location.Longitude }, new double[] { e.Position.Location.Latitude }, (o) => { if (o.Erro == null) { if (centerMarker == null) { map.Children.Add(centerMarker = new MMarker() { LngLat = o.RGCItemList[0], IconURL = "/location_on.png", Anchor = new Point(0.5, 0.5) }); map.Children.Add(centerCircle = new MCircle() { }); centerCircle.SetCenterAndRadius(o.RGCItemList[0], 500); } else { centerMarker.LngLat = o.RGCItemList[0]; centerCircle.SetCenterAndRadius(o.RGCItemList[0], 500); } map.Center = o.RGCItemList[0]; } }); }
void searchCallBack(MPOISearchResult sender) { // MessageBox.Show("关键字查询信息如下:\nCount:" + sender.Count.ToString() + " Record:" + sender.Record.ToString() + " Total:" + sender.Total.ToString() + " POIs.count:" + sender.POIs.Count); if (sender.Erro == null) { List <MOverlay> list = new List <MOverlay>(); for (int i = 0; i < sender.POIs.Count; i++) { MMarker mk; //string url = "Address:" + sender.POIs[i].Address + "\n" + "Code:" + sender.POIs[i].Code + "\n" + "Distance:" + sender.POIs[i].Distance + "\n" + "DriverDistance:" + sender.POIs[i].DriverDistance + "\n" + "Match:" + sender.POIs[i].Match + "\n" + "Name:" + sender.POIs[i].Name + "\n" + "Pguid:" + sender.POIs[i].Pguid + "\n" + "Tel:" + sender.POIs[i].Tel + "\n" + "Type:" + sender.POIs[i].Type + "\n" + "Url:" + sender.POIs[i].Url + "\n" + "X:" + sender.POIs[i].X + "\n" + "Y:" + sender.POIs[i].Y + "\n"; //MessageBox.Show("第" + i + "个" + "关键字(肯德基)查询信息 如下:\n" + url); map.Children.Add(mk = new MMarker() { LngLat = new MLngLat(sender.POIs[i].X, sender.POIs[i].Y), TipFrameworkElement = new MTip() { Title = sender.POIs[i].Name, ContentText = sender.POIs[i].Address } }); list.Add(mk); } //根据覆盖物来调整视野 map.SetFitview(list); } else { MessageBox.Show(sender.Erro.Message); } }
void CallBack(MGeoCodingResult sender) { if (sender.Erro == null) { List <MOverlay> list = new List <MOverlay>(); // MessageBox.Show("根据参数选项信息进行地理编码 如下:\n" + "count:" + sender.Count.ToString() + " GeoCodingList.count:" + sender.GeoCodingList.Count); for (int i = 0; i < sender.GeoCodingList.Count; i++) { //MessageBox.Show("第" + i + "个" + "MGeoPOI信息如下:\n" + "Address" + sender.GeoCodingList[i].Address + "\nCity" + sender.GeoCodingList[i].City + "\nDistrict" + sender.GeoCodingList[i].District + "\nEaddress" + sender.GeoCodingList[i].Eaddress + "\nECity" + sender.GeoCodingList[i].ECity + "\nEdistrict" + sender.GeoCodingList[i].Edistrict + "\nEname" + sender.GeoCodingList[i].Ename + "\nEprovince" + sender.GeoCodingList[i].Eprovince + "\nLevel" + sender.GeoCodingList[i].Level + "\nName" + sender.GeoCodingList[i].Name + "\nProvince" + sender.GeoCodingList[i].Province + "\nRange" + sender.GeoCodingList[i].Range + "\nX" + sender.GeoCodingList[i].X + "\nY" + sender.GeoCodingList[i].Y); MMarker mk; map.Children.Add(mk = new MMarker() { LngLat = new MLngLat(sender.GeoCodingList[i].X, sender.GeoCodingList[i].Y), TipFrameworkElement = new MTip() { Title = sender.GeoCodingList[i].Name, ContentText = sender.GeoCodingList[i].Address } }); list.Add(mk); } //根据覆盖物来调整视野 map.SetFitview(list); } else { MessageBox.Show(sender.Erro.Message); } }
void locationwatcher_PositionChanged(object sender, AGeoPositionChangedEventArgs e) { if (mylocation == null) { mylocation = new MMarker() { LngLat = e.LngLat }; } this.LatitudeTextBlock.Text = e.LngLat.LatY.ToString(); this.LongitudeTextBlock.Text = e.LngLat.LngX.ToString(); Dataclass.latX = e.LngLat.LatY; Dataclass.lonY = e.LngLat.LngX; }
void map_MapLoaded(object sender, MapEventArgs e) { MMarker editMarker; map.Children.Add(editMarker = new MMarker() { LngLat = map.Center, IsEditable = true, Anchor = new Point(0.5, 1) }); editMarker.EditStart += new EventHandler <MapEventArgs>(editMarker_EditStart); editMarker.Editing += new EventHandler <MapEventArgs>(editMarker_Editing); editMarker.EditEnd += new EventHandler <MapEventArgs>(editMarker_EditEnd); }
private void MMarkerButton_Click(object sender, RoutedEventArgs e) { MMarker mk; map.Children.Add(mk = new MMarker() { LngLat = map.Center, TipFrameworkElement = new MTip() { Title = "测试名称", ContentText = "测试内容" } }); //map.Children.Remove(mk);删除方法 }
void CallBack(MReverseGeoCodingResult sender) { if (sender.Erro == null) { // MessageBox.Show("resultList.count:" + sender.resultList.Count.ToString()); List <MOverlay> list = new List <MOverlay>(); for (int i = 0; i < sender.resultList.Count; i++) { //MessageBox.Show("City" + sender.resultList[i].City + "\nCrosses.count" + sender.resultList[i].Crosses.Count + "\nDistrict\n" + "Bounds" + sender.resultList[i].District.Bounds + "Code" + sender.resultList[i].District.Code + "Name" + sender.resultList[i].District.Name + "X" + sender.resultList[i].District.X + "Y" + sender.resultList[i].District.Y + "\nPois.count" + sender.resultList[i].Pois.Count + "\nProvince\n" + "Code" + sender.resultList[i].Province.Code + "Code" + sender.resultList[i].Province.Name + "\nRoads.Count" + sender.resultList[i].Roads.Count.ToString()); //for (int j = 0; j < sender.resultList[i].Crosses.Count; j++) //{ // MessageBox.Show("第" + j + "个" + "Crosses信息 如下:\n" + "Name" + sender.resultList[i].Crosses[j].Name + ",X" + sender.resultList[i].Crosses[j].X + ",Y" + sender.resultList[i].Crosses[j].Y); //} //for (int k = 0; k < sender.resultList[i].Pois.Count; k++) //{ // MessageBox.Show("第" + k + "个" + "Pois信息 如下:\n" + "Address" + sender.resultList[i].Pois[k].Address + ",Code" + sender.resultList[i].Pois[k].Code + ",Distance" + sender.resultList[i].Pois[k].Distance + ",DriverDistance" + sender.resultList[i].Pois[k].DriverDistance + ",Match" + sender.resultList[i].Pois[k].Match + ",Name" + sender.resultList[i].Pois[k].Name + ",Pguid" + sender.resultList[i].Pois[k].Pguid + ",Tel" + sender.resultList[i].Pois[k].Tel + ",Type" + sender.resultList[i].Pois[k].Type + ",Url" + sender.resultList[i].Pois[k].Url + ",X" + sender.resultList[i].Pois[k].X + ",Y" + sender.resultList[i].Pois[k].Y); //} //for (int m = 0; m < sender.resultList[i].Roads.Count; m++) //{ // MessageBox.Show("第" + m + "个" + "Roads信息 如下:\n" + "Direction" + sender.resultList[i].Roads[m].Direction + ",Distance" + sender.resultList[i].Roads[m].Distance + ",Ename" + sender.resultList[i].Roads[m].Ename + ",Id" + sender.resultList[i].Roads[m].Id + ",Level" + sender.resultList[i].Roads[m].Level + ",Name" + sender.resultList[i].Roads[m].Name + ",Width" + sender.resultList[i].Roads[m].Width); //} for (int j = 0; j < sender.resultList[i].Pois.Count; j++) { MMarker mk; map.Children.Add(mk = new MMarker() { LngLat = new MLngLat(sender.resultList[i].Pois[j].X, sender.resultList[i].Pois[j].Y), TipFrameworkElement = new MTip() { Title = sender.resultList[i].Pois[j].Name, ContentText = sender.resultList[i].Pois[j].Address } }); list.Add(mk); } } //根据覆盖物来调整视野 map.SetFitview(list); } else { MessageBox.Show(sender.Erro.Message); } }
void amapGeoCoordinateWatcher_PositionChanged(object sender, AGeoPositionChangedEventArgs e) { if (mk == null) { mk = new MMarker() { LngLat = e.LngLat }; } if (!map.Children.Contains(mk)) { map.Children.Add(mk); } else { mk.LngLat = e.LngLat; } map.Center = e.LngLat; }
public void TestChapterParse() { Assert.AreEqual(1, ((CMarker)parser.ParseFromString("\\c 1").Contents[0]).Number); Assert.AreEqual(1000, ((CMarker)parser.ParseFromString("\\c 1000").Contents[0]).Number); Assert.AreEqual(0, ((CMarker)parser.ParseFromString("\\c 0").Contents[0]).Number); // Chapter Labels Assert.AreEqual("Chapter One", ((CLMarker)parser.ParseFromString("\\c 1 \\cl Chapter One").Contents[0].Contents[0]).Label); Assert.AreEqual("Chapter One", ((CLMarker)parser.ParseFromString("\\cl Chapter One \\c 1").Contents[0]).Label); Assert.AreEqual("Chapter Two", ((CLMarker)parser.ParseFromString("\\c 1 \\cl Chapter One \\c 2 \\cl Chapter Two").Contents[1].Contents[0]).Label); USFMDocument doc = parser.ParseFromString("\\cp Q"); Assert.IsInstanceOfType(doc.Contents[0], typeof(CPMarker)); Assert.AreEqual("Q", ((CPMarker)doc.Contents[0]).PublishedChapterMarker); doc = parser.ParseFromString("\\ca 53 \\ca*"); Assert.AreEqual(2, doc.Contents.Count); CAMarker caBegin = (CAMarker)doc.Contents[0]; CAEndMarker caEnd = (CAEndMarker)doc.Contents[1]; Assert.AreEqual("53", caBegin.AltChapterNumber); doc = parser.ParseFromString("\\va 22 \\va*"); Assert.AreEqual(2, doc.Contents.Count); VAMarker vaBegin = (VAMarker)doc.Contents[0]; VAEndMarker vaEnd = (VAEndMarker)doc.Contents[1]; Assert.AreEqual("22", vaBegin.AltVerseNumber); doc = parser.ParseFromString("\\p In the beginning God created the heavens and the earth."); Assert.IsInstanceOfType(doc.Contents[0], typeof(PMarker)); Assert.AreEqual("In the beginning God created the heavens and the earth.", ((TextBlock)doc.Contents[0].Contents[0]).Text); doc = parser.ParseFromString("\\pc In the beginning God created the heavens and the earth."); Assert.IsInstanceOfType(doc.Contents[0], typeof(PCMarker)); Assert.AreEqual("In the beginning God created the heavens and the earth.", ((TextBlock)doc.Contents[0].Contents[0]).Text); doc = parser.ParseFromString("\\p \\v 1 In the beginning God created the heavens and the earth."); Assert.IsInstanceOfType(doc.Contents[0], typeof(PMarker)); PMarker pm = (PMarker)doc.Contents[0]; VMarker vm = (VMarker)pm.Contents[0]; Assert.AreEqual("In the beginning God created the heavens and the earth.", ((TextBlock)vm.Contents[0]).Text); doc = parser.ParseFromString("\\mi"); Assert.AreEqual(1, doc.Contents.Count); Assert.IsInstanceOfType(doc.Contents[0], typeof(MIMarker)); doc = parser.ParseFromString("\\d A Psalm of David"); Assert.AreEqual("A Psalm of David", ((DMarker)doc.Contents[0]).Description); doc = parser.ParseFromString("\\nb"); Assert.IsInstanceOfType(doc.Contents[0], typeof(NBMarker)); doc = parser.ParseFromString("\\fq the Son of God"); Assert.IsInstanceOfType(doc.Contents[0], typeof(FQMarker)); Assert.AreEqual("the Son of God", ((TextBlock)doc.Contents[0].Contents[0]).Text); doc = parser.ParseFromString("\\pi The one who scattered"); Assert.IsInstanceOfType(doc.Contents[0], typeof(PIMarker)); Assert.AreEqual(1, doc.Contents.Count); Assert.AreEqual("The one who scattered", ((TextBlock)doc.Contents[0].Contents[0]).Text); Assert.AreEqual(1, ((PIMarker)parser.ParseFromString("\\pi").Contents[0]).Depth); Assert.AreEqual(1, ((PIMarker)parser.ParseFromString("\\pi1").Contents[0]).Depth); Assert.AreEqual(2, ((PIMarker)parser.ParseFromString("\\pi2").Contents[0]).Depth); Assert.AreEqual(3, ((PIMarker)parser.ParseFromString("\\pi3").Contents[0]).Depth); doc = parser.ParseFromString("\\m \\v 37 David himself called him 'Lord';"); Assert.AreEqual(1, doc.Contents.Count); MMarker mm = (MMarker)doc.Contents[0]; Assert.AreEqual(1, mm.Contents.Count); vm = (VMarker)mm.Contents[0]; Assert.AreEqual("David himself called him 'Lord';", ((TextBlock)vm.Contents[0]).Text); doc = parser.ParseFromString("\\b"); Assert.AreEqual(1, doc.Contents.Count); Assert.IsInstanceOfType(doc.Contents[0], typeof(BMarker)); }
void editMarker_EditStart(object sender, MapEventArgs e) { MMarker mk = sender as MMarker; showEdit.Text = "编辑开始:" + mk.LngLat; }
/// <summary> /// 定位位置变化 /// </summary> /// <param name="sender"></param> /// <param name="args"></param> void geo_PositionChanged(AMapGeolocator sender, AMapPositionChangedEventArgs args) { this.Dispatcher.BeginInvoke(() => { try { if (myLoaction == null) { myLoaction = new MMarker() { LngLat = new Com.AMap.Maps.Api.BaseTypes.MLngLat(args.LngLat.longitude, args.LngLat.latitude), IconURL = "/Images/location_on.png" }; } if (!mapLocationLayer.Children.Contains(myLoaction)) { mapLocationLayer.Children.Add(myLoaction); } else { myLoaction.LngLat = new Com.AMap.Maps.Api.BaseTypes.MLngLat(args.LngLat.longitude, args.LngLat.latitude); } map.Center = new Com.AMap.Maps.Api.BaseTypes.MLngLat(args.LngLat.longitude, args.LngLat.latitude); SearchKeyWordToilet(myLoaction.LngLat, 1000);//搜索,默认半径1000m geo.PositionChanged -= geo_PositionChanged; geo.Stop(); geo = null; } catch (Exception ex) { Debug.WriteLine("geo_PositionChanged:" + ex.Message); } }); }
/// <summary> /// 搜索厕所 /// </summary> /// <param name="mlnglat"></param> /// <param name="radios"></param> private async void SearchKeyWordToilet(MLngLat mlnglat, uint radios) { //AMapFilterOption option=new AMapFilterOption (); //option.Groupbuy=false; //option.Discount=false; try { AMapPOIResults pois = await AMapPOISearch.POIAround(mlnglat.LngX, mlnglat.LatY, "公厕|厕所|洗手间|麦当劳|肯德基|必胜客|德克士", "", false, false, radios, 0, 100, 1, Extensions.All); this.Dispatcher.BeginInvoke(() => { if (pois.Erro != null) { return; } if (pois.POIList == null) { } List<MOverlay> list = new List<MOverlay>(); foreach (AMapPOI poi in pois.POIList.ToList()) { MMarker Marker; mapToiletLayer.Children.Add(Marker = new MMarker() { LngLat = new Com.AMap.Maps.Api.BaseTypes.MLngLat(poi.Location.Lon, poi.Location.Lat), Anchor = new Point(0.5, 1), IconURL = "Images/54x74.png", TipFrameworkElement = tip = new ToiletTip() { Text = poi.Name, MarkerAMapPOI = poi }, }); tip.TapNavigation += tip_TapNavigation; list.Add(Marker); Debug.WriteLine(poi.Name.ToString()); //TODO:gridNavigation } map.SetFitview(list); }); } catch (Exception ex) { Debug.WriteLine("SearchKeyWordToilet:" + ex.Message); } }