void busInfoByIdCallBack(MBusLineSearchResult sender) { if (sender.Erro == null) { string url = ""; List <MOverlay> list = new List <MOverlay>(); for (int i = 0; i < sender.BusLineList.Count; i++) { url = "Air:" + sender.BusLineList[i].Air + "\n" + "AutoTicket:" + sender.BusLineList[i].AutoTicket + "\n" + "BasicPrice:" + sender.BusLineList[i].BasicPrice + "\n" + "CommutationTicket:" + sender.BusLineList[i].CommutationTicket + "\n" + "Company:" + sender.BusLineList[i].Company + "\n" + "CoorDesc:" + sender.BusLineList[i].CoorDesc + "\n" + "DataSource:" + sender.BusLineList[i].DataSource + "\n" + "Description:" + sender.BusLineList[i].Description + "\n" + "DoubleDeck:" + sender.BusLineList[i].DoubleDeck + "\n" + "EndTime:" + sender.BusLineList[i].EndTime + "\n" + "ExpressWay:" + sender.BusLineList[i].ExpressWay + "\n" + "FrontName:" + sender.BusLineList[i].FrontName + "\n" + "FrontSpell:" + sender.BusLineList[i].FrontSpell + "\n" + "IcCard:" + sender.BusLineList[i].IcCard + "\n" + "Interval1:" + sender.BusLineList[i].Interval1 + "\n" + "Interval2:" + sender.BusLineList[i].Interval2 + "\n" + "Interval3:" + sender.BusLineList[i].Interval3 + "\n" + "Interval4:" + sender.BusLineList[i].Interval4 + "\n" + "Interval5:" + sender.BusLineList[i].Interval5 + "\n" + "Interval6:" + sender.BusLineList[i].Interval6 + "\n" + "Interval7:" + sender.BusLineList[i].Interval7 + "\n" + "Interval8:" + sender.BusLineList[i].Interval8 + "\n" + "KeyName:" + sender.BusLineList[i].KeyName + "\n" + "Length:" + sender.BusLineList[i].Length + "\n" + "LineId:" + sender.BusLineList[i].LineId + "\n" + "Loop:" + sender.BusLineList[i].Loop + "\n" + "Name:" + sender.BusLineList[i].Name + "\n" + "ServicePeriod:" + sender.BusLineList[i].ServicePeriod + "\n" + "Speed:" + sender.BusLineList[i].Speed + "\n" + "StartTime:" + sender.BusLineList[i].StartTime + "\n" + "StationDesc:" + sender.BusLineList[i].StationDesc + "\n" + "Status:" + sender.BusLineList[i].Status + "\n" + "TerminalName:" + sender.BusLineList[i].TerminalName + "\n" + "TerminalSpell:" + sender.BusLineList[i].TerminalSpell + "\n" + "TimeDesc:" + sender.BusLineList[i].TimeDesc + "\n" + "TimeInterval1:" + sender.BusLineList[i].TimeInterval1 + "\n" + "TimeInterval2:" + sender.BusLineList[i].TimeInterval2 + "\n" + "TimeInterval3:" + sender.BusLineList[i].TimeInterval3 + "\n" + "TimeInterval4:" + sender.BusLineList[i].TimeInterval4 + "\n" + "TimeInterval5:" + sender.BusLineList[i].TimeInterval5 + "\n" + "TimeInterval6:" + sender.BusLineList[i].TimeInterval6 + "\n" + "TimeInterval7:" + sender.BusLineList[i].TimeInterval7 + "\n" + "TimeInterval8:" + sender.BusLineList[i].TimeInterval8 + "\n" + "TotalPrice:" + sender.BusLineList[i].TotalPrice + "\n" + "Type:" + sender.BusLineList[i].Type; // MessageBox.Show("通过公交线路id搜索公交引导信息 如下:\nCount:" + sender.Count.ToString() + " Record:" + sender.Record.ToString() + " SearchTime:" + sender.SearchTime.ToString() + " Total:" + sender.Total.ToString() + " BusLineList信息:" + url); MPolyline mp; map.Children.Add(mp = new MPolyline() { LngLats = sender.BusLineList[i].LngLats, LineColor = Colors.Green, LineThickness = 6 }); list.Add(mp); map.Children.Add(new MMarker() { LngLat = mp.LngLats[0], IsEditable = true, IconURL = "/bus_start_pic.jpg", Anchor = new Point(0.5, 1) }); map.Children.Add(new MMarker() { LngLat = mp.LngLats[mp.LngLats.Count - 1], IconURL = "/bus_end_pic.jpg", Anchor = new Point(0.5, 1) }); } //根据覆盖物来调整视野 map.SetFitview(list); } else { MessageBox.Show(sender.Erro.Message); } }
private void PolylineButton_Click(object sender, RoutedEventArgs e) { MPolyline mp; MLngLatCollection xys = new MLngLatCollection(); xys.Add(map.Center); xys.Add(new MLngLat(map.Center.LngX + 0.0001, map.Center.LatY + 0.0001)); xys.Add(new MLngLat(map.Center.LngX - 0.0041, map.Center.LatY - 0.0001)); xys.Add(new MLngLat(map.Center.LngX + 0.0021, map.Center.LatY + 0.0031)); xys.Add(new MLngLat(map.Center.LngX + 0.0051, map.Center.LatY - 0.0031)); map.Children.Add(mp = new MPolyline() { LngLats = xys, LineColor = Colors.Green, LineThickness = 4 }); }
void CallBack(MRouteSearchResult sender) { if (sender.Erro == null) { List <MOverlay> list = new List <MOverlay>(); // MessageBox.Show("通过设置MRouteSearchOption对象属性进行导航路径搜索信息 如下:\nBounds" + sender.Bounds + "Coors:" + sender.Coors + "Count:" + sender.Count.ToString() + "Length:" + sender.Length.ToString() + " Routes.count:" + sender.Routes.Count + " SearchTime:" + sender.SearchTime.ToString()); for (int i = 0; i < sender.Routes.Count; i++) { //string url = "AccessorialInfo:" + sender.Routes[i].AccessorialInfo + "\n" + "Action:" + sender.Routes[i].Action + "\n" + "Coor:" + sender.Routes[i].Coor.ToString() + "\n" + "Direction:" + sender.Routes[i].Direction + "\n" + "DriveTime:" + sender.Routes[i].DriveTime + "\n" + "Form:" + sender.Routes[i].Form + "\n" + "Grade:" + sender.Routes[i].Grade + "\n" + "RoadLength:" + sender.Routes[i].RoadLength + "\n" + "RoadName:" + sender.Routes[i].RoadName + "\n" + "TextInfo:" + sender.Routes[i].TextInfo + "\n"; //MessageBox.Show("第" + i + "个路段信息 如下:\n" + url); MLngLatCollection mc = sender.Routes[i].LngLats;//构造经纬度序列集合 MPolyline polyline = new MPolyline(); polyline.LngLats = mc; //mc为组成线的经纬度坐标串 polyline.LineColor = Utilities.HexToColor("#022672"); //线的颜色 polyline.LineThickness = 6; //线的粗细 polyline.CanShowTip = false; map.Children.Add(polyline); //添加到地图 list.Add(polyline); } map.SetFitview(list); if (sender.ViaCities != null) { for (int i = 0; i < sender.ViaCities.Count; i++) { string url = "CityEnglishName:" + sender.ViaCities[i].CityEnglishName + "\n" + "CityName:" + sender.ViaCities[i].CityName + "\n" + "Code:" + sender.ViaCities[i].Code + "\n" + "Telnum:" + sender.ViaCities[i].Telnum; MessageBox.Show("途径第" + i + "个城市信息 如下:\n" + url); } } else { return; } } else { MessageBox.Show(sender.Erro.Message); } }
void CallBack(MBusRouteSearchResult sender) { // MessageBox.Show("通过参数类对象进行公交导航搜索信息 如下:\nCount:" + sender.Count.ToString() + " Routes.count:" + sender.Routes.Count + " SearchTime:" + sender.SearchTime.ToString()); if (sender.Erro == null) { List <MOverlay> list = new List <MOverlay>(); for (int routescount = 0; routescount < sender.Routes.Count; routescount++) { // string url = "Bounds:" + sender.Routes[routescount].Bounds + "\n" + "Expense:" + sender.Routes[routescount].Expense + "\n" + "FootEndLength:" + sender.Routes[routescount].FootEndLength + "\n"; // MessageBox.Show("第" + routescount + "个MBus信息 如下:\n" + url); for (int segmentArraycount = 0; segmentArraycount < sender.Routes[routescount].SegmentArray.Count; segmentArraycount++) { // string url1 = "BusName:" + sender.Routes[routescount].SegmentArray[segmentArraycount].BusName + "\n" + "DriveLength:" + sender.Routes[routescount].SegmentArray[segmentArraycount].DriveLength + "\n" + "EndName:" + sender.Routes[routescount].SegmentArray[segmentArraycount].EndName + "\n" + "FootLength:" + sender.Routes[routescount].SegmentArray[segmentArraycount].FootLength + "\n" + "PassDeportCoordinate:" + sender.Routes[routescount].SegmentArray[segmentArraycount].PassDeportCoordinate + "\n" + "CoordinateList:" + sender.Routes[routescount].SegmentArray[segmentArraycount].LngLats.Count + "\n" + "PassDeportCount:" + sender.Routes[routescount].SegmentArray[segmentArraycount].PassDeportCount + "\n" + "PassDeportName:" + sender.Routes[routescount].SegmentArray[segmentArraycount].PassDeportName + "\n" + "StartName:" + sender.Routes[routescount].SegmentArray[segmentArraycount].StartName + "\n"; // MessageBox.Show("第" + routescount + "个的第" + segmentArraycount + "个" + "路段信息 如下:\n" + url1); if (segmentArraycount == 0)//只显示第一条 { MPolyline mp; map.Children.Add(mp = new MPolyline() { LngLats = sender.Routes[routescount].SegmentArray[segmentArraycount].LngLats, LineColor = Colors.Green, LineThickness = 6 }); //根据覆盖物来调整视野 map.SetFitview(list); list.Add(mp); return; } } } ////根据覆盖物来调整视野 //map.SetFitview(list); } }
void CallBack(MRouteSearchResult sender) { if (sender.Erro == null) { List<MOverlay> list = new List<MOverlay>(); // MessageBox.Show("通过设置MRouteSearchOption对象属性进行导航路径搜索信息 如下:\nBounds" + sender.Bounds + "Coors:" + sender.Coors + "Count:" + sender.Count.ToString() + "Length:" + sender.Length.ToString() + " Routes.count:" + sender.Routes.Count + " SearchTime:" + sender.SearchTime.ToString()); for (int i = 0; i < sender.Routes.Count; i++) { //string url = "AccessorialInfo:" + sender.Routes[i].AccessorialInfo + "\n" + "Action:" + sender.Routes[i].Action + "\n" + "Coor:" + sender.Routes[i].Coor.ToString() + "\n" + "Direction:" + sender.Routes[i].Direction + "\n" + "DriveTime:" + sender.Routes[i].DriveTime + "\n" + "Form:" + sender.Routes[i].Form + "\n" + "Grade:" + sender.Routes[i].Grade + "\n" + "RoadLength:" + sender.Routes[i].RoadLength + "\n" + "RoadName:" + sender.Routes[i].RoadName + "\n" + "TextInfo:" + sender.Routes[i].TextInfo + "\n"; //MessageBox.Show("第" + i + "个路段信息 如下:\n" + url); MLngLatCollection mc = sender.Routes[i].LngLats;//构造经纬度序列集合 MPolyline polyline = new MPolyline(); polyline.LngLats = mc;//mc为组成线的经纬度坐标串 polyline.LineColor = Utilities.HexToColor("#022672");//线的颜色 polyline.LineThickness = 6;//线的粗细 polyline.CanShowTip = false; map.Children.Add(polyline);//添加到地图 list.Add(polyline); } map.SetFitview(list); if (sender.ViaCities != null) { for (int i = 0; i < sender.ViaCities.Count; i++) { string url = "CityEnglishName:" + sender.ViaCities[i].CityEnglishName + "\n" + "CityName:" + sender.ViaCities[i].CityName + "\n" + "Code:" + sender.ViaCities[i].Code + "\n" + "Telnum:" + sender.ViaCities[i].Telnum; // MessageBox.Show("途径第" + i + "个城市信息 如下:\n" + url); } } else { return; } } else { MessageBox.Show(sender.Erro.Message); } }
private async void SearchWalking(MLngLat stat, MLngLat end) { try { AMapRouteResults rr = await AMapNavigationSearch.WalkingNavigation(stat.LngX, stat.LatY, end.LngX, end.LatY); if (rr.Erro != null) { return; } if (rr.Route != null && rr.Count != 0) { AMapRoute route = rr.Route; List<AMapPath> paths = route.Paths.ToList(); MLngLatCollection lnglats = new MLngLatCollection(); List<MOverlay> list = new List<MOverlay>(); List<string> walkSteps = new List<string>(); foreach (AMapPath path in paths) { //画路线 List<AMapStep> steps = path.Steps.ToList(); foreach (AMapStep st in steps) { Debug.WriteLine(st.Instruction); walkSteps.Add(st.Instruction); lnglats = latLagsFromString(st.Polyline); MPolyline walkPolyling = new MPolyline(lnglats); walkPolyling.LineThickness = 6; walkPolyling.LineColor = Colors.Green; mapWalkingLayer.Children.Add(walkPolyling); list.Add(walkPolyling); } } map.SetFitview(list); //TODO: tip walkSteps } } catch (Exception ex) { Debug.WriteLine("SearchWalking:" + ex.Message); } }
/// <summary> /// 不包括根点的树单分支递归绘制 /// </summary> /// <param name="previousMp">前一个mol类</param> /// <param name="branchList">分支smiles记录</param> /// <param name="index">当前次序</param> /// <param name="rootMol">根mol</param> /// <param name="md">文档对象</param> /// <param name="isRoot">是否是最长分支路线</param> private void WriteSimpleBranch(MoleCulePostion previousMp, List <string> branchList, int index, Molecule rootMol, MDocument md, bool isRoot) { double molLeftSpace = 0; if (branchList.Count <= index) { //WriteText(md); return; } double curY = previousMp.Center_y; double curX = previousMp.Right_x; if (index % BranchOneLineNum == 0) { curY -= SpanceY * BranchSPFWithY; curX = 0 - SpanceX * BranchSPFWithX; //WriteText(md); } //写反应的其他物质,仅限最长路线 int anotherMolNum = 0; double maxLength = 0; if (!string.IsNullOrEmpty(DicBranchSmiles[index]) && isRoot) { List <string> listSmiles = DicBranchSmiles[index].Split(',').ToList(); anotherMolNum = listSmiles.Count; if (listSmiles.Count == 1) { var molList = listSmiles[0].Split(';').ToList(); MoleCulePostion mp1 = new MoleCulePostion(molList[0]); double leftDistance = mp1.Center_x - mp1.Left_x; double bottomDistance = mp1.Center_y - mp1.Bottom_y; maxLength = mp1.Right_x - mp1.Left_x + BranchAnotherMolDistanceX * 2; SetMolPosition(mp1, previousMp.Right_x + leftDistance + BranchAnotherMolDistanceX, previousMp.Center_y + bottomDistance + BranchAnotherMolDistanceY + 1.5); //写箭头上mol层次号 md.addObject(CreateMTextBox(molList[1], new MPoint(previousMp.Right_x + leftDistance + BranchAnotherMolDistanceX, previousMp.Center_y + 1.5))); rootMol.fuse(mp1.Mol); } else if (listSmiles.Count == 2) { foreach (var smiles in listSmiles) { var molList = smiles.Split(';').ToList(); MoleCulePostion mp1 = new MoleCulePostion(molList[0]); double leftDistance = mp1.Center_x - mp1.Left_x; double bottomDistance = mp1.Center_y - mp1.Bottom_y; SetMolPosition(mp1, maxLength + previousMp.Right_x + leftDistance + BranchAnotherMolDistanceX, previousMp.Center_y + bottomDistance + BranchAnotherMolDistanceY + 1.5); //写箭头上mol层次号 md.addObject(CreateMTextBox(molList[1], new MPoint(maxLength + previousMp.Right_x + leftDistance + BranchAnotherMolDistanceX, previousMp.Center_y + 1.5))); rootMol.fuse(mp1.Mol); maxLength += mp1.Right_x - mp1.Left_x + BranchAnotherMolDistanceX * 2; } } } //箭头绘制; MPoint p1 = new MPoint(previousMp.Right_x + SpanceX * BranchSPFWithX * 0.15, previousMp.Center_y); MPoint p2 = new MPoint(previousMp.Right_x + SpanceX * BranchSPFWithX * 0.85, previousMp.Center_y); if (anotherMolNum == 2) { p1 = new MPoint(previousMp.Right_x + maxLength * 0.15, previousMp.Center_y); p2 = new MPoint(previousMp.Right_x + maxLength * 0.85, previousMp.Center_y); } if (anotherMolNum == 1) { p1 = new MPoint(previousMp.Right_x + maxLength * 0.15, previousMp.Center_y); p2 = new MPoint(previousMp.Right_x + maxLength * 0.85, previousMp.Center_y); } MPolyline arrow = new MPolyline(p1, p2); arrow.setArrow(true); arrow.setArrowLength(1, chemaxon.struc.graphics.MPolyline.DEFAULT_ARROW_HEAD_LENGTH / 2); arrow.setArrowWidth(1, chemaxon.struc.graphics.MPolyline.DEFAULT_ARROW_HEAD_WIDTH); arrow.setArrowFlags(1, chemaxon.struc.graphics.MPolyline.ARROW_DASHED_FLAG); md.addObject(arrow); //分子绘制 var molList1 = branchList[index].Split(';').ToList(); MoleCulePostion tempMp = new MoleCulePostion(molList1[0]); molLeftSpace = tempMp.Center_x - tempMp.Left_x; if (curX == -SpanceX * BranchSPFWithX) { molLeftSpace = 0; maxLength = SpanceX * BranchSPFWithX; } if (anotherMolNum == 2) { SetMolPosition(tempMp, curX + maxLength + molLeftSpace, curY); } else if (anotherMolNum == 1) { SetMolPosition(tempMp, curX + maxLength + molLeftSpace, curY); } else if (anotherMolNum == 0) { SetMolPosition(tempMp, curX + SpanceX * BranchSPFWithX + molLeftSpace, curY); } rootMol.fuse(tempMp.Mol); //写mol层次号 string txt = molList1[1]; if (txt != "0a") { _ListTextPosition.Add(txt + "," + tempMp.Center_x + "," + (tempMp.Bottom_y - TxtspaceWithMolInY)); } //下一级 WriteSimpleBranch(tempMp, branchList, index + 1, rootMol, md, isRoot); }