当前位置: 首页>>代码示例>>C#>>正文


C# GoogleMap.SetOnCameraChangeListener方法代码示例

本文整理汇总了C#中Android.Gms.Maps.GoogleMap.SetOnCameraChangeListener方法的典型用法代码示例。如果您正苦于以下问题:C# GoogleMap.SetOnCameraChangeListener方法的具体用法?C# GoogleMap.SetOnCameraChangeListener怎么用?C# GoogleMap.SetOnCameraChangeListener使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Android.Gms.Maps.GoogleMap的用法示例。


在下文中一共展示了GoogleMap.SetOnCameraChangeListener方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: SetupMapIfNeeded

        private void SetupMapIfNeeded()
        {
            if (_map == null)
            {
                _map = _mapFragment.Map;
                if (_map != null)
                {
                    SetViewPoint (new LatLng(63.430515, 10.395053), false);

                    _clusterManager = new ClusterManager (this, _map);
                    _clusterManager.SetOnClusterClickListener (this);
                    _clusterManager.SetOnClusterItemClickListener (this);
                    _map.SetOnCameraChangeListener (_clusterManager);
                    _map.SetOnMarkerClickListener (_clusterManager);

                    AddClusterItems ();
                }
            }
        }
开发者ID:Zve,项目名称:MapsUtilityDemo,代码行数:19,代码来源:MainActivity.cs

示例2: OnMapReady

        public async void OnMapReady(GoogleMap googleMap)
        {
            _gettingMap = false;
            // TODO TO HELP DEBUG auto download paris to help dev on performances 
            //var contractToTest = "Paris";
            //var contractService = SimpleIoc.Default.GetInstance<IContractService>();
            //var contract = contractService.GetCountries().First(country => country.Contracts.Any(c => c.Name == contractToTest)).Contracts.First(c => c.Name == contractToTest);
            //await SimpleIoc.Default.GetInstance<ContractsViewModel>().AddOrRemoveContract(contract);
            _contractService = SimpleIoc.Default.GetInstance<IContractService>();
            _contractService.ContractRefreshed += OnContractRefreshed;
            _contractService.StationRefreshed += OnStationRefreshed;

            // set the initial visual state of the bike/parking buttons
            SwitchModeStationParkingVisualState();

            _map = googleMap;
            _maxZoom = _map.MaxZoomLevel;

            LoadPreviousTile();

            //Setup and customize your Google Map
            _map.UiSettings.CompassEnabled = true;
            _map.UiSettings.MyLocationButtonEnabled = false;
            _map.UiSettings.MapToolbarEnabled = false;
            _map.MyLocationEnabled = true;

            // add padding to prevent action bar to hide the position button
            //var dp = (int)(48 * Resources.DisplayMetrics.Xdpi / Resources.DisplayMetrics.Density);
            //_map.SetPadding(0, dp, 0, 0);
            //_map.vie
            //View locationButton = suppormanagerObj.getView().findViewById(2);
            //var rlp = (RelativeLayout.LayoutParams)locationButton.getLayoutParams(); 
            //// position on right bottom 
            //rlp.addRule(RelativeLayout.ALIGN_PARENT_TOP, 0); rlp.addRule(RelativeLayout.ALIGN_PARENT_BOTTOM, RelativeLayout.TRUE); 

            // Initialize the camera position
            SetViewPoint(await GetStartingCameraPosition(), false);

            // Initialize the marker with the stations
            _clusterManager = new ClusterManager(this, _map);
            _clusterRender = new StationRenderer(this, _map, _clusterManager);
            _clusterManager.SetRenderer(_clusterRender);

            _map.SetOnCameraChangeListener(_clusterManager);
            // this disable the rest of the event handlers
            // so there is no way to distinct a click on a cluster and a marker 
            _map.MarkerClick += _map_MarkerClick;
            //_map.SetOnMarkerClickListener(new OnMarkerClickListener());
            //_clusterManager.SetOnClusterClickListener(this);
            //_clusterManager.SetOnClusterItemClickListener(this);

            // check if the app contains a least one city, otherwise, tells the user to download one
            MainViewModel.MainPageLoadedCommand.Execute(null);

            // On long click, display the address on a info window
            Observable.FromEventPattern<GoogleMap.MapLongClickEventArgs>(_map, "MapLongClick")
                .Subscribe(e =>
                {
                    AddPlaceMarker(e.EventArgs.Point, null, null);
                    SelectItem(e.EventArgs.Point);
                    //IList<Address> addresses = new List<Address>();
                    //try
                    //{
                    //    // Convert latitude and longitude to an address (GeoCoder)
                    //    addresses = await (new Geocoder(this).GetFromLocationAsync(currentMarkerPosition.Latitude, currentMarkerPosition.Longitude, 1));
                    //}
                    //catch (Exception ex)
                    //{
                    //    Log.Debug("MyActivity", "Geocoder crashed: " + ex.Message);
                    //}
                    //return new AddressesFromLocationDTO { Addresses = addresses, Location = FormatLatLng(e.EventArgs.Point) };

                });
            _map.MapClick += _map_MapClick;


            if (_parameterLat != 0 && _parameterLon != 0)
            {
                ShowIntentLocation();
            }
            else
            {
                // center the map on last user location
                GetPreviousLastUserLocation();
            }





            // Initialize the behavior when long clicking somewhere on the map
            //_map.MapLongClick += async (sender, e) =>
            //{
            //    // On long click, display the address on a info window
            //    if (longClickMarker != null)
            //    {
            //        // Remove a previously created marker
            //        longClickMarker.Remove();
            //    }

//.........这里部分代码省略.........
开发者ID:ThePublicBikeGang,项目名称:EasyBike,代码行数:101,代码来源:MainActivity.cs


注:本文中的Android.Gms.Maps.GoogleMap.SetOnCameraChangeListener方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。