コード例 #1
0
ファイル: RoutePlanDemo.cs プロジェクト: Yi-shion/Xamarin
        public void SearchButtonProcess(View v)
        {
            //��������ڵ��·������
            route = null;
            mBtnPre.Visibility = ViewStates.Invisible;
            mBtnNext.Visibility = ViewStates.Invisible;
            mBaidumap.Clear();
            // ����������ť��Ӧ
            EditText editSt = FindViewById<EditText>(Resource.Id.start);
            EditText editEn = FindViewById<EditText>(Resource.Id.end);
            //�������յ���Ϣ������tranist search ��˵��������������
            PlanNode stNode = PlanNode.WithCityNameAndPlaceName("����", editSt.Text);
            PlanNode enNode = PlanNode.WithCityNameAndPlaceName("����", editEn.Text);

            // ʵ��ʹ�����������յ���н�����ȷ���趨
            if (v.Id == Resource.Id.drive)
            {
                mSearch.DrivingSearch((new DrivingRoutePlanOption())
                        .From(stNode)
                        .To(enNode));
            }
            else if (v.Id == Resource.Id.transit)
            {
                mSearch.TransitSearch((new TransitRoutePlanOption())
                        .From(stNode)
                        .City("����")
                        .To(enNode));
            }
            else if (v.Id == Resource.Id.walk)
            {
                mSearch.WalkingSearch((new WalkingRoutePlanOption())
                        .From(stNode)
                        .To(enNode));
            }
        }
コード例 #2
0
ファイル: RoutePlanDemo.cs プロジェクト: Yi-shion/Xamarin
 public void OnGetWalkingRouteResult(WalkingRouteResult result)
 {
     if (result == null || result.Error != SearchResult.ERRORNO.NoError)
     {
         Toast.MakeText(this, "��Ǹ��δ�ҵ����", ToastLength.Short).Show();
     }
     if (result.Error == SearchResult.ERRORNO.AmbiguousRoureAddr)
     {
         //���յ��;�����ַ����壬ͨ�����½ӿڻ�ȡ�����ѯ��Ϣ
         //result.getSuggestAddrInfo()
         return;
     }
     if (result.Error == SearchResult.ERRORNO.NoError)
     {
         nodeIndex = -1;
         mBtnPre.Visibility = ViewStates.Visible;
         mBtnNext.Visibility = ViewStates.Visible;
         route = result.RouteLines[0];
         WalkingRouteOverlay overlay = new MyWalkingRouteOverlay(this, mBaidumap);
         mBaidumap.SetOnMarkerClickListener(overlay);
         routeOverlay = overlay;
         overlay.SetData(result.RouteLines[0]);
         overlay.AddToMap();
         overlay.ZoomToSpan();
     }
 }