コード例 #1
0
ファイル: LayersDemo.cs プロジェクト: Yi-shion/Xamarin
 protected override void OnCreate(Bundle savedInstanceState)
 {
     base.OnCreate(savedInstanceState);
     SetContentView(Resource.Layout.activity_layers);
     mMapView = FindViewById<MapView>(Resource.Id.bmapView);
     mBaiduMap = mMapView.Map;
 }
コード例 #2
0
ファイル: MapControlDemo.cs プロジェクト: Yi-shion/Xamarin
 protected override void OnCreate(Bundle savedInstanceState)
 {
     base.OnCreate(savedInstanceState);
     SetContentView(Resource.Layout.activity_mapcontrol);
     mMapView = FindViewById<MapView>(Resource.Id.bmapView);
     mBaiduMap = mMapView.Map;
     mStateBar = FindViewById<TextView>(Resource.Id.state);
     InitListener();
 }
コード例 #3
0
        protected override void OnCreate(Bundle icicle)
        {
            base.OnCreate(icicle);
            SetContentView(Resource.Layout.activity_lbssearch);
            CloudManager.Instance.Init(this);
            mMapView = FindViewById<MapView>(Resource.Id.bmapView);
            mBaiduMap = mMapView.Map;
            FindViewById(Resource.Id.regionSearch).Click += delegate
            {
                LocalSearchInfo info = new LocalSearchInfo();
                info.Ak = "B266f735e43ab207ec152deff44fec8b";
                info.GeoTableId = 31869;
                info.Tags = "";
                info.Q = "�찲��";
                info.Region = "������";
                CloudManager.Instance.LocalSearch(info);

            };
            FindViewById(Resource.Id.regionSearch).Click += delegate
            {
                LocalSearchInfo info = new LocalSearchInfo();
                info.Ak = "B266f735e43ab207ec152deff44fec8b";
                info.GeoTableId = 31869;
                info.Tags = "";
                info.Q = "�찲��";
                info.Region = "������";
                CloudManager.Instance.LocalSearch(info);
            };
            FindViewById(Resource.Id.nearbySearch).Click += delegate
            {
                NearbySearchInfo info = new NearbySearchInfo();
                info.Ak = "D9ace96891048231e8777291cda45ca0";
                info.GeoTableId = 32038;
                info.Radius = 30000;
                info.Location = "116.403689,39.914957";
                CloudManager.Instance.NearbySearch(info);
            };

            FindViewById(Resource.Id.boundsSearch).Click += delegate
            {
                BoundSearchInfo info = new BoundSearchInfo();
                info.Ak = "B266f735e43ab207ec152deff44fec8b";
                info.GeoTableId = 31869;
                info.Q = "�찲��";
                info.Bound = "116.401663,39.913961;116.406529,39.917396";
                CloudManager.Instance.BoundSearch(info);
            };
            FindViewById(Resource.Id.detailsSearch).Click += delegate
            {
                DetailSearchInfo info = new DetailSearchInfo();
                info.Ak = "B266f735e43ab207ec152deff44fec8b";
                info.GeoTableId = 31869;
                info.Uid = 18622266;
                CloudManager.Instance.DetailSearch(info);
            };
        }
コード例 #4
0
		private void InitView()
		{
			//设置标题栏

			var img_header_back = FindViewById<ImageView> (Resource.Id.img_header_back);
			img_header_back.Click += (sender, e) => 
			{
				this.Finish();
				OverridePendingTransition(Android.Resource.Animation.SlideInLeft,Android.Resource.Animation.SlideOutRight);
			};
			var bundle = Intent.Extras;
			var alarmPosition = bundle.GetString ("alarmPosition");
			if (!string.IsNullOrEmpty (alarmPosition) && alarmPosition.Contains (",")) {
				var Positions =  alarmPosition.Split(new char[]{','});
				nPosition =  Convert.ToDouble(Positions [0].Substring (1));
				ePosition =  Convert.ToDouble(Positions [1].Substring (1));
			}
				
			var tv_back = FindViewById<TextView> (Resource.Id.tv_back);
			tv_back.Text = "报警详细";
			var tv_desc = FindViewById<TextView> (Resource.Id.tv_desc);
			tv_desc.Text = "报警位置显示";

			mMapView = FindViewById<MapView> (Resource.Id.bmap_view);
			bdMap = mMapView.Map;
			bdMap.MapType = BaiduMap.MapTypeNormal;
			LatLng sourceLatLng = new LatLng(nPosition,ePosition);
     		// 将GPS设备采集的原始GPS坐标转换成百度坐标  
			CoordinateConverter converter  = new CoordinateConverter();  
			converter.From(Com.Baidu.Mapapi.Utils.CoordinateConverter.CoordType.Gps);  
			// sourceLatLng待转换坐标  
			converter.Coord(sourceLatLng);  
			LatLng desLatLng = converter.Convert();
			//构建MarkerOption,用于在地图上添加Marker
			//构建Marker图标  
			BitmapDescriptor bitmap = BitmapDescriptorFactory  
				.FromResource(Resource.Drawable.ic_map);  
			OverlayOptions option = new MarkerOptions().InvokePosition (desLatLng).InvokeIcon(bitmap).Draggable(true).InvokeZIndex(9);

			//在地图上添加Marker,并显示  
			bdMap.AddOverlay(option);
			// 将地图移动到覆盖物位置  
			MapStatusUpdate u = MapStatusUpdateFactory.NewLatLng(desLatLng);
			bdMap.SetMapStatus(u);

		}
コード例 #5
0
ファイル: BaseMapDemo.cs プロジェクト: Yi-shion/Xamarin
 protected override void OnCreate(Bundle savedInstanceState)
 {
     base.OnCreate(savedInstanceState);
     Intent intent = Intent;
     if (intent.HasExtra("x") && intent.HasExtra("y"))
     {
         // 当用intent参数时,设置中心点为指定点
         Bundle b = intent.Extras;
         LatLng p = new LatLng(b.GetDouble("y"), b.GetDouble("x"));
         mMapView = new MapView(this,
                 new BaiduMapOptions().MapStatus(new MapStatus.Builder()
                         .Target(p).Build()));
     }
     else
     {
         mMapView = new MapView(this, new BaiduMapOptions());
     }
     SetContentView(mMapView);
     mBaiduMap = mMapView.Map;
 }
コード例 #6
0
ファイル: BaiduMapSample.cs プロジェクト: Yi-shion/Xamarin
        private void InitialLocation()
        {
            mBaiduMap = bmapView.Map;
            mBaiduMap.MyLocationEnabled = true;
            var mLocOption = new LocationClientOption
            {
                OpenGps = true,
                CoorType = "bd0911",
                ScanSpan = 5000,
                AddrType = "all"
            };

            var mLocClient = new LocationClient(this)
            {
                LocOption = mLocOption
            };
            mLocClient.Start();
            mLocClient.RequestLocation();
            mLocClient.RegisterLocationListener(new MapLocationListenner { Context = this });
        }
コード例 #7
0
        protected override void OnCreate(Bundle savedInstanceState)
        {
            base.OnCreate(savedInstanceState);
            SetContentView(Resource.Layout.activity_location);
            myListener = new MyLocationListenner(this);
            requestLocButton = FindViewById<Button>(Resource.Id.button1);
            mCurrentMode = MyLocationConfigeration.LocationMode.Normal;
            requestLocButton.Text = "��ͨ";
            requestLocButton.Click += delegate
            {
                if (mCurrentMode.Equals(MyLocationConfigeration.LocationMode.Normal))
                {
                    requestLocButton.Text = "����";
                    mCurrentMode = MyLocationConfigeration.LocationMode.Following;
                    mBaiduMap
                            .SetMyLocationConfigeration(new MyLocationConfigeration(
                                    mCurrentMode, true, mCurrentMarker));
                }
                else if (mCurrentMode.Equals(MyLocationConfigeration.LocationMode.Compass))
                {
                    requestLocButton.Text = "��ͨ";
                    mCurrentMode = MyLocationConfigeration.LocationMode.Normal;
                    mBaiduMap
                            .SetMyLocationConfigeration(new MyLocationConfigeration(
                                    mCurrentMode, true, mCurrentMarker));
                }
                else if (mCurrentMode.Equals(MyLocationConfigeration.LocationMode.Following))
                {
                    requestLocButton.Text = "����";
                    mCurrentMode = MyLocationConfigeration.LocationMode.Compass;
                    mBaiduMap
                            .SetMyLocationConfigeration(new MyLocationConfigeration(
                                    mCurrentMode, true, mCurrentMarker));
                }

                #region [ �ӵ�, ���˼�������, ��ʱ�޷���C#ʵ��, ʹ������� if/else... ]
                //switch (mCurrentMode)
                //{
                //    case MyLocationConfigeration.LocationMode.Normal:
                //        requestLocButton.Text = "����";
                //        mCurrentMode = MyLocationConfigeration.LocationMode.Following;
                //        mBaiduMap
                //                .SetMyLocationConfigeration(new MyLocationConfigeration(
                //                        mCurrentMode, true, mCurrentMarker));
                //        break;
                //    case MyLocationConfigeration.LocationMode.Compass:
                //        requestLocButton.Text = "��ͨ";
                //        mCurrentMode = MyLocationConfigeration.LocationMode.Normal;
                //        mBaiduMap
                //                .SetMyLocationConfigeration(new MyLocationConfigeration(
                //                        mCurrentMode, true, mCurrentMarker));
                //        break;
                //    case MyLocationConfigeration.LocationMode.Following:
                //        requestLocButton.Text = "����";
                //        mCurrentMode = MyLocationConfigeration.LocationMode.Compass;
                //        mBaiduMap
                //                .SetMyLocationConfigeration(new MyLocationConfigeration(
                //                        mCurrentMode, true, mCurrentMarker));
                //        break;
                //}
                #endregion
            };

            RadioGroup group = this.FindViewById<RadioGroup>(Resource.Id.radioGroup);
            // group.CheckedChange += delegate(object sender, RadioGroup.CheckedChangeEventArgs args) { };
            group.CheckedChange += (sender, args) =>
            {
                int CheckedId = args.CheckedId;

                if (CheckedId == Resource.Id.defaulticon)
                {
                    // ����null�򣬻ָ�Ĭ��ͼ��
                    mCurrentMarker = null;
                    mBaiduMap
                            .SetMyLocationConfigeration(new MyLocationConfigeration(
                                    mCurrentMode, true, null));
                }
                if (CheckedId == Resource.Id.customicon)
                {
                    // �޸�Ϊ�Զ���marker
                    mCurrentMarker = BitmapDescriptorFactory
                            .FromResource(Resource.Drawable.icon_geo);
                    mBaiduMap
                            .SetMyLocationConfigeration(new MyLocationConfigeration(
                                    mCurrentMode, true, mCurrentMarker));
                }
            };

            // ��ͼ��ʼ��
            mMapView = FindViewById<MapView>(Resource.Id.bmapView);
            mBaiduMap = mMapView.Map;
            // �����λͼ��
            mBaiduMap.MyLocationEnabled = true;
            // ��λ��ʼ��
            mLocClient = new LocationClient(this);
            mLocClient.RegisterLocationListener(myListener);
            LocationClientOption option = new LocationClientOption();
            option.OpenGps = true;// ��gps
            option.CoorType = "bd09ll"; // ������������
            option.ScanSpan = 1000;
            mLocClient.LocOption = option;
            mLocClient.Start();
        }
コード例 #8
0
ファイル: UISettingDemo.cs プロジェクト: Yi-shion/Xamarin
        protected override void OnCreate(Bundle savedInstanceState)
        {
            base.OnCreate(savedInstanceState);
            SetContentView(Resource.Layout.activity_uisetting);

            mMapView = FindViewById<MapView>(Resource.Id.bmapView);
            mBaiduMap = mMapView.Map;
            mUiSettings = mBaiduMap.UiSettings;

            MapStatus ms = new MapStatus.Builder().Overlook(-30).Build();
            MapStatusUpdate u = MapStatusUpdateFactory.NewMapStatus(ms);
            mBaiduMap.AnimateMapStatus(u, 1000);
        }
コード例 #9
0
ファイル: PoiSearchDemo.cs プロジェクト: Yi-shion/Xamarin
        protected override void OnCreate(Bundle savedInstanceState)
        {
            base.OnCreate(savedInstanceState);
            SetContentView(Resource.Layout.activity_poisearch);
            // ��ʼ������ģ�飬ע�������¼�����
            mPoiSearch = PoiSearch.NewInstance();
            mPoiSearch.SetOnGetPoiSearchResultListener(this);
            mSuggestionSearch = SuggestionSearch.NewInstance();
            mSuggestionSearch.SetOnGetSuggestionResultListener(this);
            keyWorldsView = FindViewById<AutoCompleteTextView>(Resource.Id.searchkey);
            sugAdapter = new ArrayAdapter<string>(this,
                    Android.Resource.Layout.SimpleDropDownItem1Line);
            keyWorldsView.Adapter = sugAdapter;
            mBaiduMap = (Android.Runtime.Extensions.JavaCast<SupportMapFragment>(SupportFragmentManager
                    .FindFragmentById(Resource.Id.map))).BaiduMap;

            /**
             * ������ؼ��ֱ仯ʱ����̬���½����б�
             */
            keyWorldsView.AfterTextChanged += (sender, e) => { };
            keyWorldsView.BeforeTextChanged += (sender, e) => { };
            keyWorldsView.TextChanged += (sender, e) =>
            {
                ICharSequence cs = new String(e.Text.ToString());
                if (cs.Length() <= 0)
                {
                    return;
                }
                string city = (FindViewById<EditText>(Resource.Id.city)).Text;
                /**
                 * ʹ�ý������������ȡ�����б�������onSuggestionResult()�и���
                 */
                mSuggestionSearch
                        .RequestSuggestion((new SuggestionSearchOption())
                                .Keyword(cs.ToString()).City(city));
            };
        }
コード例 #10
0
ファイル: GeometryDemo.cs プロジェクト: Yi-shion/Xamarin
        protected override void OnCreate(Bundle savedInstanceState)
        {
            base.OnCreate(savedInstanceState);
            SetContentView(Resource.Layout.activity_geometry);
            // ��ʼ����ͼ
            mMapView = FindViewById<MapView>(Resource.Id.bmapView);
            mBaiduMap = mMapView.Map;
            // UI��ʼ��
            clearBtn = FindViewById<Button>(Resource.Id.button1);
            resetBtn = FindViewById<Button>(Resource.Id.button2);

            clearBtn.Click += delegate { ClearClick(); };
            resetBtn.Click += delegate { ResetClick(); };

            // �������ʱ��ӻ���ͼ��
            AddCustomElementsDemo();
        }
コード例 #11
0
ファイル: BusLineSearchDemo.cs プロジェクト: Yi-shion/Xamarin
 protected override void OnCreate(Bundle savedInstanceState)
 {
     base.OnCreate(savedInstanceState);
     SetContentView(Resource.Layout.activity_busline);
     ICharSequence titleLable = new String("������·��ѯ����");
     Title = titleLable.ToString();
     mBtnPre = FindViewById<Button>(Resource.Id.pre);
     mBtnNext = FindViewById<Button>(Resource.Id.next);
     mBtnPre.Visibility = ViewStates.Invisible;
     mBtnNext.Visibility = ViewStates.Invisible;
     mBaiduMap = (Android.Runtime.Extensions.JavaCast<SupportMapFragment>(SupportFragmentManager
             .FindFragmentById(Resource.Id.bmapView))).BaiduMap;
     mBaiduMap.SetOnMapClickListener(this);
     mSearch = PoiSearch.NewInstance();
     mSearch.SetOnGetPoiSearchResultListener(this);
     mBusLineSearch = BusLineSearch.NewInstance();
     mBusLineSearch.SetOnGetBusLineSearchResultListener(this);
     busLineIDList = new List<string>();
 }
コード例 #12
0
ファイル: ShareDemoActivity.cs プロジェクト: Yi-shion/Xamarin
 public PoiShareOverlay(ShareDemoActivity shareDemoActivity, BaiduMap baiduMap)
     : base(baiduMap)
 {
     this.shareDemoActivity = shareDemoActivity;
 }
コード例 #13
0
ファイル: OverlayDemo.cs プロジェクト: Yi-shion/Xamarin
 protected override void OnCreate(Bundle savedInstanceState)
 {
     base.OnCreate(savedInstanceState);
     SetContentView(Resource.Layout.activity_overlay);
     mMapView = FindViewById<MapView>(Resource.Id.bmapView);
     mBaiduMap = mMapView.Map;
     MapStatusUpdate msu = MapStatusUpdateFactory.ZoomTo(14.0f);
     mBaiduMap.SetMapStatus(msu);
     InitOverlay();
     mBaiduMap.SetOnMarkerClickListener(new IOnMarkerClickListenerImpl(this));
 }
コード例 #14
0
ファイル: GeoCoderDemo.cs プロジェクト: Yi-shion/Xamarin
        protected override void OnCreate(Bundle savedInstanceState)
        {
            base.OnCreate(savedInstanceState);
            SetContentView(Resource.Layout.activity_geocoder);
            ICharSequence titleLable = new String("������빦��");
            Title = titleLable.ToString();

            // ��ͼ��ʼ��
            mMapView = FindViewById<MapView>(Resource.Id.bmapView);
            mBaiduMap = mMapView.Map;

            // ��ʼ������ģ�飬ע���¼�����
            mSearch = GeoCoder.NewInstance();
            mSearch.SetOnGetGeoCodeResultListener(this);
        }
コード例 #15
0
ファイル: ShareDemoActivity.cs プロジェクト: Yi-shion/Xamarin
 protected override void OnCreate(Bundle savedInstanceState)
 {
     base.OnCreate(savedInstanceState);
     SetContentView(Resource.Layout.activity_share_demo_activity);
     mMapView = FindViewById<MapView>(Resource.Id.bmapView);
     mBaiduMap = mMapView.Map;
     mPoiSearch = PoiSearch.NewInstance();
     mPoiSearch.SetOnGetPoiSearchResultListener(this);
     mShareUrlSearch = ShareUrlSearch.NewInstance();
     mShareUrlSearch.SetOnGetShareUrlResultListener(this);
     mGeoCoder = GeoCoder.NewInstance();
     mGeoCoder.SetOnGetGeoCodeResultListener(this);
 }
コード例 #16
0
ファイル: PoiSearchDemo.cs プロジェクト: Yi-shion/Xamarin
 public MyPoiOverlay(PoiSearchDemo poiSearchDemo, BaiduMap baiduMap)
     : base(baiduMap)
 {
     this.poiSearchDemo = poiSearchDemo;
 }
コード例 #17
0
ファイル: RoutePlanDemo.cs プロジェクト: Yi-shion/Xamarin
 protected override void OnCreate(Bundle savedInstanceState)
 {
     base.OnCreate(savedInstanceState);
     SetContentView(Resource.Layout.activity_routeplan);
     ICharSequence titleLable = new String("·�߹滮����");
     Title = titleLable.ToString();
     //��ʼ����ͼ
     mMapView = FindViewById<MapView>(Resource.Id.map);
     mBaidumap = mMapView.Map;
     mBtnPre = FindViewById<Button>(Resource.Id.pre);
     mBtnNext = FindViewById<Button>(Resource.Id.next);
     mBtnPre.Visibility = ViewStates.Invisible;
     mBtnNext.Visibility = ViewStates.Invisible;
     //��ͼ����¼�����
     mBaidumap.SetOnMapClickListener(this);
     // ��ʼ������ģ�飬ע���¼�����
     mSearch = RoutePlanSearch.NewInstance();
     mSearch.SetOnGetRoutePlanResultListener(this);
 }
コード例 #18
0
        protected override void OnCreate(Bundle bundle)
        {
            base.OnCreate(bundle);
            SetContentView(Resource.Layout.Details);
            // Create your application here
            try
            {
                _mMapView = FindViewById<MapView>(Resource.Id.bmapView);
                var txtHotelName = FindViewById<TextView>(Resource.Id.txtHotelName);
                var txtHotelCoordinate = FindViewById<TextView>(Resource.Id.txtHotelCoordinate);
                _btnReserve = FindViewById<Button>(Resource.Id.btnReserve);


                #region 数据初始化

                //var hotelEntity =(HotelEntity) Intent.GetSerializableExtra("HOTELENTITY");
                var name = Intent.GetStringExtra("Name");
                var latitude = Intent.GetDoubleExtra("Latitude", 0.00);
                var longitude = Intent.GetDoubleExtra("Longitude", 0.00);
                _hotelEntity = new HotelEntity() { Name = name, Latitude = latitude, Longitude = longitude };

                txtHotelName.Text = _hotelEntity.Name;
                txtHotelCoordinate.Text = string.Format("({0}, {1})", _hotelEntity.Longitude.ToString("0.0000"), _hotelEntity.Latitude.ToString("0.0000"));

                #endregion 数据初始化

                _mBaiduMap = _mMapView.Map;
                #region 标记酒店位置

                InitOverlay();

                #endregion 标记酒店位置

                #region 添加事件
                // _mBaiduMap.SetOnMarkerClickListener(new OnMarkerClickListener(this));
                _mBaiduMap.MarkerClick += (sender, args) =>
                {
                    var marker = args.P0;
                    try
                    {
                        HotelEntity entity = marker.ExtraInfo.GetSerializable("info") as HotelEntity;

                        TextView location = new TextView(ApplicationContext);
                        location.SetBackgroundResource(Resource.Drawable.infowindow_bg);
                        location.SetPadding(30, 20, 30, 50);
                        if (entity != null) location.Text = entity.Name;

                        var latlng = marker.Position;
                        var point = _mBaiduMap.Projection.ToScreenLocation(latlng);
                        Log.Info(Tag, "--!" + point.X + " , " + point.Y);
                        point.Y -= 47;
                        var pointInfo = _mBaiduMap.Projection.FromScreenLocation(point);
                        var window = new InfoWindow(location, pointInfo, 0);
                        _mBaiduMap.ShowInfoWindow(window);
                    }
                    catch (Exception ex)
                    {

                        Log.Error(Tag, "MarkerClick Excetipn :" + ex.Message);
                    }
                };
                //_mBaiduMap.SetOnMapClickListener(new OnMapClickListener(this));
                _mBaiduMap.MapClick += (sender, args) =>
                {
                    _mBaiduMap.HideInfoWindow();
                };
                _btnReserve.Click += (sender, args) =>
                {
                    StartActivity(new Intent(this, typeof(PayLayout)));
                };

                #endregion


            }
            catch (Exception ex)
            {
                Log.Error(Tag, ex.StackTrace);
            }
        }
コード例 #19
0
ファイル: RoutePlanDemo.cs プロジェクト: Yi-shion/Xamarin
 public MyWalkingRouteOverlay(RoutePlanDemo routePlanDemo, BaiduMap baiduMap)
     : base(baiduMap)
 {
     this.routePlanDemo = routePlanDemo;
 }
コード例 #20
0
ファイル: RoutePlanDemo.cs プロジェクト: Yi-shion/Xamarin
 public MyTransitRouteOverlay(RoutePlanDemo routePlanDemo, BaiduMap baiduMap)
     : base(baiduMap)
 {
     this.routePlanDemo = routePlanDemo;
 }