Exemplo n.º 1
0
 protected override void OnCreate(Bundle savedInstanceState)
 {
     base.OnCreate(savedInstanceState);
     SetContentView(Resource.Layout.activity_layers);
     mMapView = FindViewById<MapView>(Resource.Id.bmapView);
     mBaiduMap = mMapView.Map;
 }
        protected override void OnCreate(Bundle savedInstanceState)
        {
            base.OnCreate(savedInstanceState);
            /**
             * 使用地图sdk前需先初始化BMapManager.
             * BMapManager是全局的,可为多个MapView共用,它需要地图模块创建前创建,
             * 并在地图地图模块销毁后销毁,只要还有地图模块在使用,BMapManager就不应该销毁
             */
            DemoApplication app = (DemoApplication)this.Application;
            if (app.mBMapManager == null)
            {
                app.mBMapManager = new BMapManager(ApplicationContext);
                /**
                 * 如果BMapManager没有初始化则初始化BMapManager
                 */
                app.mBMapManager.Init(new DemoApplication.MyGeneralListener());
            }
            SetContentView(Resource.Layout.activity_offline);
            mMapView = new MapView(this);
            mMapController = mMapView.Controller;

            mOffline = new MKOfflineMap();
            /**
             * 初始化离线地图模块,MapControler可从MapView.getController()获取
             */
            mOffline.Init(mMapController, this);
            InitView();

        }
 private void InitMap()
 {
     mMapView = (Android.Runtime.Extensions.JavaCast<SupportMapFragment>(SupportFragmentManager
             .FindFragmentById(Resource.Id.map)).MapView);
     GeoPoint p = new GeoPoint((int)(39.945 * 1E6), (int)(116.404 * 1E6));
     mMapView.Controller.SetCenter(p);
     mMapView.Controller.SetZoom(13);
 }
Exemplo n.º 4
0
 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();
 }
Exemplo n.º 5
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);
            };
        }
Exemplo n.º 6
0
        protected override void OnCreate(Bundle savedInstanceState)
        {
            base.OnCreate(savedInstanceState);
            
            
            // Create your application here
            SetContentView(Resource.Layout.BaiduMapView);
            mMapView = FindViewById<MapView>(Resource.Id.bmapView);


        }
        protected override void OnCreate(Bundle savedInstanceState)
        {
            base.OnCreate(savedInstanceState);
            /**
             * 使用地图sdk前需先初始化BMapManager.
             * BMapManager是全局的,可为多个MapView共用,它需要地图模块创建前创建,
             * 并在地图地图模块销毁后销毁,只要还有地图模块在使用,BMapManager就不应该销毁
             */
            DemoApplication app = (DemoApplication)this.Application;
            if (app.mBMapManager == null)
            {
                app.mBMapManager = new BMapManager(ApplicationContext);
                /**
                 * 如果BMapManager没有初始化则初始化BMapManager
                 */
                app.mBMapManager.Init(new DemoApplication.MyGeneralListener());
            }
            /**
             * 由于MapView在setContentView()中初始化,所以它需要在BMapManager初始化之后
             */
            SetContentView(Resource.Layout.activity_layers);

            mMapView = FindViewById<MapView>(Resource.Id.bmapView);
            /**
             * 获取地图控制器
             */
            mMapController = mMapView.Controller;
            /**
             *  设置地图是否响应点击事件  .
             */
            mMapController.EnableClick(true);
            /**
             * 设置地图缩放级别
             */
            mMapController.SetZoom(12);
            /**
             * 显示内置缩放控件
             */
            mMapView.SetBuiltInZoomControls(true);

            /**
             * 将地图移动至天安门
             * 使用百度经纬度坐标,可以通过http://api.map.baidu.com/lbsapi/getpoint/index.html查询地理坐标
             * 如果需要在百度地图上显示使用其他坐标系统的位置,请发邮件至[email protected]申请坐标转换接口
             */
            double cLat = 39.945;
            double cLon = 116.404;
            GeoPoint p = new GeoPoint((int)(cLat * 1E6), (int)(cLon * 1E6));
            mMapController.SetCenter(p);
        }
		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);

		}
Exemplo n.º 9
0
 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;
 }
Exemplo n.º 10
0
        public LocationServiceImpl(BMap.MapView mapView, Context context)
        {
            this.mapView = mapView;
            LocationClientOption option = new LocationClientOption();

            option.SetLocationMode(LocationClientOption.LocationMode.HightAccuracy);
            option.CoorType = "bd09ll";              // gcj02 by default
            option.ScanSpan = 1000;                  // 0 by default(just once)
            option.SetIsNeedAddress(false);          // false by default
            option.OpenGps        = true;            // false by default
            option.LocationNotify = true;            // false by default
            option.SetIsNeedLocationDescribe(false); // 通过 getLocationDescribe 获取语义化结果
            option.SetIsNeedLocationPoiList(false);  // 通过 getPoiList 获取
            option.IsIgnoreKillProcess    = false;
            option.IsIgnoreCacheException = false;
            option.SetEnableSimulateGps(false);
            option.LocationNotify = true;
            native           = new LocationClient(context);
            native.LocOption = option;
            native.RegisterLocationListener(this);
        }
Exemplo n.º 11
0
        public LocationServiceImpl(BMap.MapView mapView, Context context)
        {
            this.mapView = mapView;
            LocationClientOption option = new LocationClientOption();

            //option.SetLocationMode(LocationClientOption.LocationMode.HightAccuracy);
            //option.CoorType = "bd09ll"; // gcj02 by default
            //option.ScanSpan = 1000; // 0 by default(just once)
            //option.SetIsNeedAddress(false); // false by default
            //option.OpenGps = true; // false by default
            //option.LocationNotify = true; // false by default
            //option.SetIsNeedLocationDescribe(false); // 通过 getLocationDescribe 获取语义化结果
            //option.SetIsNeedLocationPoiList(false); // 通过 getPoiList 获取
            //option.IsIgnoreKillProcess = false;
            //option.IsIgnoreCacheException = false;
            //option.SetEnableSimulateGps(false);
            //option.LocationNotify = true;


            option.SetLocationMode(LocationClientOption.LocationMode.HightAccuracy); //可选,默认高精度,设置定位模式,高精度,低功耗,仅设备
            option.CoorType = "bd09ll";                                              //可选,默认gcj02,设置返回的定位结果坐标系
            int span = 1000;

            option.ScanSpan = span;                 //可选,默认0,即仅定位一次,设置发起定位请求的间隔需要大于等于1000ms才是有效的
            option.SetIsNeedAddress(true);          //可选,设置是否需要地址信息,默认不需要
            option.OpenGps        = true;           //可选,默认false,设置是否使用gps
            option.LocationNotify = true;           //可选,默认false,设置是否当GPS有效时按照1S/1次频率输出GPS结果
            option.SetIsNeedLocationDescribe(true); //可选,默认false,设置是否需要位置语义化结果,可以在BDLocation.getLocationDescribe里得到,结果类似于“在北京天安门附近”
            option.SetIsNeedLocationPoiList(true);  //可选,默认false,设置是否需要POI结果,可以在BDLocation.getPoiList里得到
            option.SetIgnoreKillProcess(false);     //可选,默认true,定位SDK内部是一个SERVICE,并放到了独立进程,设置是否在stop的时候杀死这个进程,默认不杀死
            option.SetIgnoreCacheException(false);  //可选,默认false,设置是否收集CRASH信息,默认收集
            option.EnableSimulateGps = false;       //可选,默认false,设置是否需要过滤GPS仿真结果,默认需要
            option.SetEnableSimulateGps(false);
            option.LocationNotify = true;


            native           = new LocationClient(context);
            native.LocOption = option;
            native.RegisterLocationListener(this);
        }
        protected override void OnCreate(Bundle savedInstanceState)
        {
            base.OnCreate(savedInstanceState);
            /**
             * 使用地图sdk前需先初始化BMapManager.
             * BMapManager是全局的,可为多个MapView共用,它需要地图模块创建前创建,
             * 并在地图地图模块销毁后销毁,只要还有地图模块在使用,BMapManager就不应该销毁
             */
            DemoApplication app = (DemoApplication)this.Application;
            if (app.mBMapManager == null)
            {
                app.mBMapManager = new BMapManager(ApplicationContext);
                /**
                 * 如果BMapManager没有初始化则初始化BMapManager
                 */
                app.mBMapManager.Init(new DemoApplication.MyGeneralListener());
            }
            SetContentView(Resource.Layout.activity_geometry);
            ICharSequence titleLable = new String("自定义绘制功能");
            Title = titleLable.ToString();

            //初始化地图
            mMapView = FindViewById<MapView>(Resource.Id.bmapView);
            mMapView.Controller.SetZoom(12.5f);
            mMapView.Controller.EnableClick(true);

            //UI初始化
            clearBtn = FindViewById<Button>(Resource.Id.button1);
            resetBtn = FindViewById<Button>(Resource.Id.button2);

            Android.Views.View.IOnClickListener clearListener = new ClearListenerImpl(this);
            Android.Views.View.IOnClickListener restListener = new RestListenerImpl(this);

            clearBtn.SetOnClickListener(clearListener);
            resetBtn.SetOnClickListener(restListener);

            //界面加载时添加绘制图层
            AddCustomElementsDemo();
        }
 public override bool OnTap(GeoPoint pt, MapView mMapView)
 {
     if (overlayDemo.pop != null)
     {
         overlayDemo.pop.HidePop();
         overlayDemo.mMapView.RemoveView(overlayDemo.button);
     }
     return false;
 }
        protected override void OnCreate(Bundle savedInstanceState)
        {
            base.OnCreate(savedInstanceState);
            /**
             * 使用地图sdk前需先初始化BMapManageResource.
             * BMapManager是全局的,可为多个MapView共用,它需要地图模块创建前创建,
             * 并在地图地图模块销毁后销毁,只要还有地图模块在使用,BMapManager就不应该销毁
             */
            DemoApplication app = (DemoApplication)this.Application;
            if (app.mBMapManager == null)
            {
                app.mBMapManager = new BMapManager(ApplicationContext);
                /**
                 * 如果BMapManager没有初始化则初始化BMapManager
                 */
                app.mBMapManager.Init(new DemoApplication.MyGeneralListener());
            }
            /**
              * 由于MapView在setContentView()中初始化,所以它需要在BMapManager初始化之后
              */
            SetContentView(Resource.Layout.activity_overlay);
            mMapView = FindViewById<MapView>(Resource.Id.bmapView);
            mClearBtn = FindViewById<Button>(Resource.Id.clear);
            mResetBtn = FindViewById<Button>(Resource.Id.reset);
            /**
             * 获取地图控制器
             */
            mMapController = mMapView.Controller;
            /**
             *  设置地图是否响应点击事件  .
             */
            mMapController.EnableClick(true);
            /**
             * 设置地图缩放级别
             */
            mMapController.SetZoom(14);
            /**
             * 显示内置缩放控件
             */
            mMapView.SetBuiltInZoomControls(true);

            InitOverlay();

            /**
             * 设定地图中心点
             */
            GeoPoint p = new GeoPoint((int)(39.933859 * 1E6), (int)(116.400191 * 1E6));
            mMapController.SetCenter(p);
        }
        protected override void OnCreate(Bundle icicle)
        {
            base.OnCreate(icicle);
            /**
             * 使用地图sdk前需先初始化BMapManager.
             * BMapManager是全局的,可为多个MapView共用,它需要地图模块创建前创建,
             * 并在地图地图模块销毁后销毁,只要还有地图模块在使用,BMapManager就不应该销毁
             */
            DemoApplication app = (DemoApplication)this.Application;
            if (app.mBMapManager == null)
            {
                app.mBMapManager = new BMapManager(ApplicationContext);
                /**
                 * 如果BMapManager没有初始化则初始化BMapManager
                 */
                app.mBMapManager.Init(new DemoApplication.MyGeneralListener());
            }
            SetContentView(Resource.Layout.lbssearch);
            CloudManager.Instance.Init(this);

            mMapView = FindViewById<MapView>(Resource.Id.bmapView);
            mMapView.Controller.EnableClick(true);
            mMapView.Controller.SetZoom(12);
            mMapView.DoubleClickZooming = true;

            FindViewById(Resource.Id.regionSearch).Click += (sender, e) =>
            {
                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 += (sender, e) =>
            {
                NearbySearchInfo info = new NearbySearchInfo();
                info.Ak = "D9ace96891048231e8777291cda45ca0";
                info.GeoTableId = 32038;
                info.Filter = "time:20130801,20130810";
                info.Location = "116.403689,39.914957";
                info.Radius = 30000;
                CloudManager.Instance.NearbySearch(info);
            };

            FindViewById(Resource.Id.boundsSearch).Click += (sender, e) =>
            {
                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 += (sender, e) =>
            {
                DetailSearchInfo info = new DetailSearchInfo();
                info.Ak = "B266f735e43ab207ec152deff44fec8b";
                info.GeoTableId = 31869;
                info.Uid = 18622266;
                CloudManager.Instance.DetailSearch(info);
            };
        }
 public MyOverlay(OverlayDemo overlayDemo, Drawable defaultMarker, MapView mapView) :
     base(defaultMarker, mapView)
 {
     this.overlayDemo = overlayDemo;
 }
        protected override void OnCreate(Bundle savedInstanceState)
        {
            base.OnCreate(savedInstanceState);

            /**
             * 使用地图sdk前需先初始化BMapManageResource.
             * BMapManager是全局的,可为多个MapView共用,它需要地图模块创建前创建,
             * 并在地图地图模块销毁后销毁,只要还有地图模块在使用,BMapManager就不应该销毁
             */
            DemoApplication app = (DemoApplication)this.Application;
            if (app.mBMapManager == null)
            {
                app.mBMapManager = new BMapManager(ApplicationContext);
                /**
                 * 如果BMapManager没有初始化则初始化BMapManager
                 */
                app.mBMapManager.Init(new DemoApplication.MyGeneralListener());
            }

            SetContentView(Resource.Layout.activity_poisearch);
            mMapView = FindViewById<MapView>(Resource.Id.bmapView);
            mMapView.Controller.EnableClick(true);
            mMapView.Controller.SetZoom(12);

            // 初始化搜索模块,注册搜索事件监听
            mSearch = new MKSearch();
            mSearch.Init(app.mBMapManager, new IMKSearchListenerImpl(this));

            keyWorldsView = FindViewById<AutoCompleteTextView>(Resource.Id.searchkey);
            sugAdapter = new ArrayAdapter<string>(this, Android.Resource.Layout.SimpleDropDownItem1Line);
            keyWorldsView.Adapter = sugAdapter;

            /**
             * 当输入关键字变化时,动态更新建议列表
             */

            keyWorldsView.AddTextChangedListener(new ITextWatcherImpl(this));
        }
Exemplo n.º 18
0
 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));
 }
        public CloudOverlay(Activity context, MapView mMapView)
            : base(null, mMapView)
        {

            mContext = context;
        }
Exemplo n.º 20
0
 private void InitialView()
 {
     this.bmapView = FindViewById<MapView>(Resource.Id.bmapView);
 }
        protected override void OnCreate(Bundle savedInstanceState)
        {
            base.OnCreate(savedInstanceState);

            /**
             * 使用地图sdk前需先初始化BMapManager.
             * BMapManager是全局的,可为多个MapView共用,它需要地图模块创建前创建,
             * 并在地图地图模块销毁后销毁,只要还有地图模块在使用,BMapManager就不应该销毁
             */
            DemoApplication app = (DemoApplication)this.Application;

            if (app.mBMapManager == null)
            {
                app.mBMapManager = new BMapManager(ApplicationContext);

                /**
                 * 如果BMapManager没有初始化则初始化BMapManager
                 */
                app.mBMapManager.Init(new DemoApplication.MyGeneralListener());
            }

            /**
              * 由于MapView在setContentView()中初始化,所以它需要在BMapManager初始化之后
              */
            SetContentView(Resource.Layout.activity_main);

            mMapView = FindViewById<MapView>(Resource.Id.bmapView);

            /**
             * 获取地图控制器
             */
            mMapController = mMapView.Controller;

            /**
             *  设置地图是否响应点击事件  .
             */
            mMapController.EnableClick(true);

            /**
             * 设置地图缩放级别
             */
            mMapController.SetZoom(12);

            /**
             * 将地图移动至指定点
             * 使用百度经纬度坐标,可以通过http://api.map.baidu.com/lbsapi/getpoint/index.html查询地理坐标
             * 如果需要在百度地图上显示使用其他坐标系统的位置,请发邮件至[email protected]申请坐标转换接口
             */
            GeoPoint p;
            double cLat = 39.945;
            double cLon = 116.404;

            var intent = Intent;

            if (intent.HasExtra("x") && intent.HasExtra("y"))
            {
                //当用intent参数时,设置中心点为指定点
                Bundle b = intent.Extras;

                p = new GeoPoint(b.GetInt("y"), b.GetInt("x"));
            }
            else
            {
                //设置中心点为天安门
                p = new GeoPoint((int)(cLat * 1E6), (int)(cLon * 1E6));
            }

            mMapController.SetCenter(p);

            /**
             *  MapView的生命周期与Activity同步,当activity挂起时需调用MapView.onPause()
             */
            mMapListener = new MKMapViewListenerImpl(this);

            mMapView.RegMapViewListener(DemoApplication.getInstance().mBMapManager, mMapListener);
        }
		protected override void OnDestroy ()
		{
			mMapView.OnDestroy ();
			mMapView = null;
			base.OnDestroy ();
		}
        protected override void OnCreate(Bundle savedInstanceState)
        {
            base.OnCreate(savedInstanceState);

            /**
             * 使用地图sdk前需先初始化BMapManager.
             * BMapManager是全局的,可为多个MapView共用,它需要地图模块创建前创建,
             * 并在地图地图模块销毁后销毁,只要还有地图模块在使用,BMapManager就不应该销毁
             */
            DemoApplication app = (DemoApplication)this.Application;

            if (app.mBMapManager == null)
            {
                app.mBMapManager = new BMapManager(ApplicationContext);
                /**
                 * 如果BMapManager没有初始化则初始化BMapManager
                 */
                app.mBMapManager.Init(new DemoApplication.MyGeneralListener());
            }

            SetContentView(Resource.Layout.buslinesearch);

            ICharSequence titleLable = new String("公交线路查询功能");

            Title = titleLable.ToString();

            //地图初始化
            mMapView = FindViewById<MapView>(Resource.Id.bmapView);
            mMapView.Controller.EnableClick(true);
            mMapView.Controller.SetZoom(12);
            busLineIDList = new List<string>();

            //创建 弹出泡泡图层
            CreatePaopao();

            // 设定搜索按钮的响应
            mBtnSearch = FindViewById<Button>(Resource.Id.search);
            mBtnNextLine = FindViewById<Button>(Resource.Id.nextline);
            mBtnPre = FindViewById<Button>(Resource.Id.pre);
            mBtnNext = FindViewById<Button>(Resource.Id.next);
            mBtnPre.Visibility = ViewStates.Invisible;
            mBtnNext.Visibility = ViewStates.Invisible;

            //地图点击事件处理
            mMapView.RegMapTouchListner(new MKMapTouchListenerImpl(this));

            // 初始化搜索模块,注册事件监听
            mSearch = new MKSearch();
            mSearch.Init(app.mBMapManager, new MKSearchListenerImpl(this));

            Android.Views.View.IOnClickListener clickListener = new ClickListenerImpl(this);
            Android.Views.View.IOnClickListener nextLineClickListener = new NextLineClickListener(this);
            Android.Views.View.IOnClickListener nodeClickListener = new NodeClickListener(this);

            mBtnSearch.SetOnClickListener(clickListener);
            mBtnNextLine.SetOnClickListener(nextLineClickListener);
            mBtnPre.SetOnClickListener(nodeClickListener);
            mBtnNext.SetOnClickListener(nodeClickListener);

            //mBtnSearch.Click += (sender, e) =>
            //{
            //    SearchButtonProcess(mBtnSearch);
            //};


            //mBtnNextLine.Click += (sender, e) =>
            //{
            //    SearchNextBusline();
            //};

            //mBtnPre.Click += (sender, e) =>
            //{
            //    NodeClick(mBtnPre);
            //};

            //mBtnNext.Click += (sender, e) =>
            //{
            //    NodeClick(mBtnNext);
            //};
        }
Exemplo n.º 24
0
 public ProjectionImpl(BMap.MapView mapView)
 {
     NativeView = mapView;
 }
Exemplo n.º 25
0
        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();
        }
Exemplo n.º 26
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);
            }
        }
        protected override void OnCreate(Bundle savedInstanceState)
        {
            base.OnCreate(savedInstanceState);
            /**
             * 使用地图sdk前需先初始化BMapManager.
             * BMapManager是全局的,可为多个MapView共用,它需要地图模块创建前创建,
             * 并在地图地图模块销毁后销毁,只要还有地图模块在使用,BMapManager就不应该销毁
             */
            DemoApplication app = (DemoApplication)this.Application;
            if (app.mBMapManager == null)
            {
                app.mBMapManager = new BMapManager(ApplicationContext);
                /**
                 * 如果BMapManager没有初始化则初始化BMapManager
                 */
                app.mBMapManager.Init(new DemoApplication.MyGeneralListener());
            }
            SetContentView(Resource.Layout.routeplan);
            ICharSequence titleLable = new String("路线规划功能");
            Title = titleLable.ToString();
            //初始化地图
            mMapView = FindViewById<MapView>(Resource.Id.bmapView);
            mMapView.SetBuiltInZoomControls(false);
            mMapView.Controller.SetZoom(12);
            mMapView.Controller.EnableClick(true);

            //初始化按键
            mBtnDrive = FindViewById<Button>(Resource.Id.drive);
            mBtnTransit = FindViewById<Button>(Resource.Id.transit);
            mBtnWalk = FindViewById<Button>(Resource.Id.walk);
            mBtnPre = FindViewById<Button>(Resource.Id.pre);
            mBtnNext = FindViewById<Button>(Resource.Id.next);
            mBtnCusRoute = FindViewById<Button>(Resource.Id.custombutton);
            mBtnCusIcon = FindViewById<Button>(Resource.Id.customicon);
            mBtnPre.Visibility = ViewStates.Invisible;
            mBtnNext.Visibility = ViewStates.Invisible;

            //按键点击事件
            Android.Views.View.IOnClickListener clickListener = new ClickListenerImpl(this);
            Android.Views.View.IOnClickListener nodeClickListener = new NodeClickListenerImpl(this);
            Android.Views.View.IOnClickListener customClickListener = new CustomClickListenerImpl(this);
            Android.Views.View.IOnClickListener changeRouteIconListener = new ChangeRouteIconListenerImpl(this);

            mBtnDrive.SetOnClickListener(clickListener);
            mBtnTransit.SetOnClickListener(clickListener);
            mBtnWalk.SetOnClickListener(clickListener);
            mBtnPre.SetOnClickListener(nodeClickListener);
            mBtnNext.SetOnClickListener(nodeClickListener);
            mBtnCusRoute.SetOnClickListener(customClickListener);
            mBtnCusIcon.SetOnClickListener(changeRouteIconListener);
            //创建 弹出泡泡图层
            CreatePaopao();

            //地图点击事件处理
            mMapView.RegMapTouchListner(new IMKMapTouchListenerImpl(this));
            // 初始化搜索模块,注册事件监听
            mSearch = new MKSearch();
            mSearch.Init(app.mBMapManager, new IMKSearchListenerImpl(this));
        }
Exemplo n.º 28
0
        protected override void OnCreate(Bundle bundle)
        {
            base.OnCreate(bundle);
            //在使用SDK各组件之前初始化context信息,传入ApplicationContext
            //注意该方法要再setContentView方法之前实现
            SDKInitializer.Initialize(ApplicationContext);
            SetContentView(Resource.Layout.Main);
            //获取地图控件引用
            //mMapView = FindViewById<MapView>(Resource.Id.bmapView);
            //mBaiduMap = mMapView.Map;

            // 地图初始化
            mMapView = FindViewById<MapView>(Resource.Id.bmapView);
            mBaiduMap = mMapView.Map;

            mCurrentMode = MyLocationConfiguration.LocationMode.Normal;
            //requestLocButton.Text = "普通";
            //requestLocButton.Click += delegate
            //{
            if (mCurrentMode.Equals(MyLocationConfiguration.LocationMode.Normal))
            {
                //requestLocButton.Text = "跟随";
                mCurrentMode = MyLocationConfiguration.LocationMode.Following;
                mBaiduMap.SetMyLocationConfigeration(new MyLocationConfiguration(mCurrentMode, true, mCurrentMarker));
            }
            //    else if (mCurrentMode.Equals(MyLocationConfiguration.LocationMode.Compass))
            //    {
            //        requestLocButton.Text = "普通";
            //        mCurrentMode = MyLocationConfiguration.LocationMode.Normal;
            //        mBaiduMap
            //                .SetMyLocationConfigeration(new MyLocationConfiguration(
            //                        mCurrentMode, true, mCurrentMarker));
            //    }
            //    else if (mCurrentMode.Equals(MyLocationConfiguration.LocationMode.Following))
            //    {
            //        requestLocButton.Text = "罗盘";
            //        mCurrentMode = MyLocationConfiguration.LocationMode.Compass;
            //        mBaiduMap
            //                .SetMyLocationConfigeration(new MyLocationConfiguration(
            //                        mCurrentMode, true, mCurrentMarker));
            //    }
            //};

            //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));
            //    }
            //};

            // 开启定位图层
            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();
        }
 public MyPoiOverlay(Activity activity, MapView mapView, MKSearch search)
     : base(activity, mapView)
 {
     mSearch = search;
 }
        MapView mMapView = null;	// 地图View
        protected override void OnCreate(Bundle savedInstanceState)
        {
            base.OnCreate(savedInstanceState);
            /**
             * 使用地图sdk前需先初始化BMapManager.
             * BMapManager是全局的,可为多个MapView共用,它需要地图模块创建前创建,
             * 并在地图地图模块销毁后销毁,只要还有地图模块在使用,BMapManager就不应该销毁
             */
            DemoApplication app = (DemoApplication)this.Application;
            if (app.mBMapManager == null)
            {
                app.mBMapManager = new BMapManager(ApplicationContext);
                /**
                 * 如果BMapManager没有初始化则初始化BMapManager
                 */
                app.mBMapManager.Init(new DemoApplication.MyGeneralListener());
            }
            SetContentView(Resource.Layout.activity_customroute);
            ICharSequence titleLable = new String("路线规划功能——自设路线示例");
            Title = titleLable.ToString();
            //初始化地图
            mMapView = FindViewById<MapView>(Resource.Id.bmapView);
            mMapView.Controller.EnableClick(true);
            mMapView.Controller.SetZoom(13);

            /** 演示自定义路线使用方法	
             *  在北京地图上画一个北斗七星
             *  想知道某个点的百度经纬度坐标请点击:http://api.map.baidu.com/lbsapi/getpoint/index.html	
             */
            GeoPoint p1 = new GeoPoint((int)(39.9411 * 1E6), (int)(116.3714 * 1E6));
            GeoPoint p2 = new GeoPoint((int)(39.9498 * 1E6), (int)(116.3785 * 1E6));
            GeoPoint p3 = new GeoPoint((int)(39.9436 * 1E6), (int)(116.4029 * 1E6));
            GeoPoint p4 = new GeoPoint((int)(39.9329 * 1E6), (int)(116.4035 * 1E6));
            GeoPoint p5 = new GeoPoint((int)(39.9218 * 1E6), (int)(116.4115 * 1E6));
            GeoPoint p6 = new GeoPoint((int)(39.9144 * 1E6), (int)(116.4230 * 1E6));
            GeoPoint p7 = new GeoPoint((int)(39.9126 * 1E6), (int)(116.4387 * 1E6));
            //起点坐标
            GeoPoint start = p1;
            //终点坐标
            GeoPoint stop = p7;
            //第一站,站点坐标为p3,经过p1,p2
            GeoPoint[] step1 = new GeoPoint[3];
            step1[0] = p1;
            step1[1] = p2;
            step1[2] = p3;
            //第二站,站点坐标为p5,经过p4
            GeoPoint[] step2 = new GeoPoint[2];
            step2[0] = p4;
            step2[1] = p5;
            //第三站,站点坐标为p7,经过p6
            GeoPoint[] step3 = new GeoPoint[2];
            step3[0] = p6;
            step3[1] = p7;
            //站点数据保存在一个二维数据中
            GeoPoint[][] routeData = new GeoPoint[3][];
            routeData[0] = step1;
            routeData[1] = step2;
            routeData[2] = step3;
            //用站点数据构建一个MKRoute
            MKRoute route = new MKRoute();
            route.CustomizeRoute(start, stop, routeData);
            //将包含站点信息的MKRoute添加到RouteOverlay中
            RouteOverlay routeOverlay = new RouteOverlay(this, mMapView);
            routeOverlay.SetData(route);
            //向地图添加构造好的RouteOverlay
            mMapView.Overlays.Add(routeOverlay);
            //执行刷新使生效
            mMapView.Refresh();
        }
 public SelectPoiOverlay(Activity activity, MapView mapView) :
     base(activity, mapView)
 {
     this.activity = activity;
 }
Exemplo n.º 32
0
        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);
        }
Exemplo n.º 33
0
 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);
 }