protected override void OnElementPropertyChanged(object sender, PropertyChangedEventArgs e)
        {
            base.OnElementPropertyChanged(sender, e);

            //System.Console.WriteLine("THis is customPins count: " + customPins.Count);

            if (e.PropertyName.Equals("VisibleRegion") && !isDrawn)
            {
                var formsMap = (CustomMap)Element;
                NativeMap.Clear();
                NativeMap.InfoWindowClick += OnInfoWindowClick;
                NativeMap.SetInfoWindowAdapter(this);

                foreach (var pin in formsMap.CustomPins)
                {
                    var marker = new MarkerOptions();
                    marker.SetPosition(new LatLng(pin.Pin.Position.Latitude, pin.Pin.Position.Longitude));
                    marker.SetTitle(pin.Pin.Label);
                    marker.SetSnippet(pin.Pin.Address);
                    //marker.SetIcon(BitmapDescriptorFactory.FromResource(Resource.Drawable.pin));

                    NativeMap.AddMarker(marker);
                }
                isDrawn = true;
            }
        }
        protected override void OnElementPropertyChanged(object sender, PropertyChangedEventArgs e)
        {
            base.OnElementPropertyChanged(sender, e);

            if (e.PropertyName.Equals("VisibleRegion") && !isDrawn)
            {
                NativeMap.Clear();
                NativeMap.InfoWindowClick += OnInfoWindowClick;
                NativeMap.SetInfoWindowAdapter(this);

                // for route
                //var polylineOptions = new PolylineOptions();
                //polylineOptions.InvokeColor(0x66FF0000);

                //foreach (var position in routeCoordinates)
                //{
                //	polylineOptions.Add(new LatLng(position.Latitude, position.Longitude));
                //}

                //NativeMap.AddPolyline(polylineOptions);

                // for pins
                foreach (var pin in customPins)
                {
                    var marker = new MarkerOptions();
                    marker.SetPosition(new LatLng(pin.Pin.Position.Latitude, pin.Pin.Position.Longitude));
                    marker.SetTitle(pin.Pin.Label);
                    marker.SetSnippet(pin.Pin.Address);
                    marker.SetIcon(BitmapDescriptorFactory.FromResource(Resource.Drawable.pin));

                    NativeMap.AddMarker(marker);
                }
                isDrawn = true;
            }
        }
예제 #3
0
        protected override void OnElementPropertyChanged(object sender, PropertyChangedEventArgs e)
        {
            base.OnElementPropertyChanged(sender, e);

            if (e.PropertyName.Equals("VisibleRegion") && !isDrawn)
            {
                NativeMap.Clear();
                NativeMap.InfoWindowClick += OnInfoWindowClick;
                NativeMap.SetInfoWindowAdapter(this);

                foreach (var pin in customPins)
                {
                    var marker = new MarkerOptions();
                    marker.SetPosition(new LatLng(pin.Pin.Position.Latitude, pin.Pin.Position.Longitude));
                    marker.SetTitle(pin.Pin.Label);
                    marker.SetSnippet(pin.Pin.Address);
                    if (pin.Estado == true)
                    {
                        marker.SetIcon(BitmapDescriptorFactory.FromResource(Resource.Drawable.pin));
                    }
                    else
                    {
                        marker.SetIcon(BitmapDescriptorFactory.FromResource(Resource.Drawable.pin2));
                    }
                    NativeMap.AddMarker(marker);
                }
                isDrawn = true;
            }
        }
예제 #4
0
 protected override void OnMapReady(GoogleMap map)
 {
     base.OnMapReady(map);
     _map           = map;
     _map.MapClick += GoogleMap_MapClick;
     NativeMap.SetInfoWindowAdapter(this);
 }
 // Disables default controls
 protected override void OnMapReady(GoogleMap map)
 {
     base.OnMapReady(map);
     NativeMap.SetInfoWindowAdapter(this);
     map.UiSettings.ZoomControlsEnabled = false;
     map.UiSettings.MapToolbarEnabled   = false;
 }
예제 #6
0
        protected override void OnMapReady(GoogleMap map)
        {
            base.OnMapReady(map);

            NativeMap.InfoWindowClick += OnInfoWindowClick;
            NativeMap.SetInfoWindowAdapter(this);
        }
예제 #7
0
        private void OnGoogleMapReady()
        {
            //if (_mapReady) return;
            NativeMap.InfoWindowClick += OnInfoWindowClick;
            NativeMap.SetInfoWindowAdapter(this);

            //_mapReady = true;
        }
예제 #8
0
 protected override void OnMapReady(Android.Gms.Maps.GoogleMap map)
 {
     map.MapClick += Map_MapClick;
     NativeMap.InfoWindowClick += OnInfoWindowClick;
     NativeMap.SetInfoWindowAdapter(this);
     drawMarkers(150);
     base.OnMapReady(map);
 }
예제 #9
0
        protected override void OnMapReady(GoogleMap map)
        {
            base.OnMapReady(map);

            NativeMap.InfoWindowClick += OnInfoWindowClick;

            NativeMap.MapLongClick  += ClickingLongMap;
            NativeMap.MarkerDragEnd += AfterDraggingMarker;
            NativeMap.SetInfoWindowAdapter(this);
        }
예제 #10
0
        protected override void OnElementPropertyChanged(object sender, PropertyChangedEventArgs e)
        {
            base.OnElementPropertyChanged(sender, e);


            if (e.PropertyName.Equals("VisibleRegion"))
            {
                NativeMap.SetInfoWindowAdapter(this);
            }
        }
        protected override void OnMapReady(GoogleMap map)
        {
            base.OnMapReady(map);

            //method registers an event handler for the InfoWindowClick event, which fires when the info window is clicked,
            NativeMap.InfoWindowClick += OnInfoWindowClick;

            //SetInfoWindowAdapter method to specify that the CustomMapRenderer class instance will provide the methods to customize the info window.
            NativeMap.SetInfoWindowAdapter(this);
        }
        /// <summary>
        /// When the map screen is loaded, we set up some event handlers for tapping on the pins.
        /// </summary>
        /// <param name="map"></param>
        protected override void OnMapReady(GoogleMap map)
        {
            base.OnMapReady(map);
            NativeMap.InfoWindowClick += OnInfoWindowClick;
            NativeMap.MapClick        += GoogleMap_MapClick;
            NativeMap.MarkerClick     += OnPinCliked;
            NativeMap.SetInfoWindowAdapter(this);

            /*TE: Call this when the map loads. It wwill not create a pin if we are not selecting a location for a new event.*/
            SetUsersStartingLocation();
        }
예제 #13
0
 protected override void OnMapReady(GoogleMap map)
 {
     base.OnMapReady(map);
     NativeMap.SetMapStyle(MapStyleOptions.LoadRawResourceStyle(context, Resource.Raw.map_style));
     NativeMap.InfoWindowClick += OnInfoWindowClick;
     // NativeMap.MyLocationEnabled = true;
     NativeMap.UiSettings.CompassEnabled      = true;
     NativeMap.UiSettings.ZoomControlsEnabled = false;
     NativeMap.SetInfoWindowAdapter(this);
     NativeMap.UiSettings.MyLocationButtonEnabled = true;
 }
        protected override void OnMapReady(GoogleMap map)
        {
            var clickListener = new MapClickListener(map);

            map.SetOnMapClickListener(clickListener);
            _map = map;
            base.OnMapReady(_map);

            NativeMap.InfoWindowClick += OnInfoWindowClick;
            NativeMap.SetInfoWindowAdapter(this);
        }
예제 #15
0
        protected override void OnMapReady(GoogleMap map)
        {
            base.OnMapReady(map);

            NativeMap.InfoWindowClick += OnInfoWindowClick;
            NativeMap.SetInfoWindowAdapter(this);

            if (map != null)
            {
                map.MapClick += GoogleMap_MapClick;
            }
        }
예제 #16
0
        public override void OnViewRemoved(Android.Views.View child)
        {
            base.OnViewRemoved(child);
            if (NativeMap != null)
            {
                customPins.Clear();
                NativeMap.SetInfoWindowAdapter(null);
            }

            _isdrawn = false;
            MessagingCenter.Unsubscribe <CrimesNearMeView>(this, "Clear");
            MessagingCenter.Unsubscribe <CrimesNearMeView, CustomPin>(this, "DroidPin");
            MessagingCenter.Unsubscribe <SearchResultsMap, CustomPin>(this, "DroidPin");
        }
        protected override void OnMapReady(GoogleMap map)
        {
            base.OnMapReady(map);

            customMap = map;

            if (customMap != null)
            {
                customMap.MapClick += map_MapClick;
            }

            NativeMap.InfoWindowClick += OnInfoWindowClick;
            NativeMap.SetInfoWindowAdapter(this);

            UpdateCircles();
        }
예제 #18
0
        protected override void OnMapReady(GoogleMap map)
        {
            base.OnMapReady(map);
            NativeMap.InfoWindowClick += OnInfoWindowClick;
            NativeMap.SetInfoWindowAdapter(this);


            var polylineOptions = new PolylineOptions();

            polylineOptions.InvokeColor(0x66FF0000);
            foreach (var position in routeCoordinates)
            {
                polylineOptions.Add(new LatLng(position.Latitude, position.Longitude));
            }

            NativeMap.AddPolyline(polylineOptions);
        }
예제 #19
0
        /// <summary>
        /// This method registers an event handler for the InfoWindowClick event,
        /// which fires when the info window is clicked, and is unsubscribed from
        /// only when the element the renderer is attached to changes (stop memory leak).
        /// </summary>
        /// <param name="map"></param>
        protected override void OnMapReady(GoogleMap map)
        {
            base.OnMapReady(map);

            NativeMap.InfoWindowClick += OnInfoWindowClick;
            // specify that the CustomMapRenderer class will provide the methods to customize the info window
            NativeMap.SetInfoWindowAdapter(this);

            // Add a marker that has the info window showing by default
            //var marker = new MarkerOptions();
            //marker.SetPosition(new LatLng(30.274054, -97.749074));
            //marker.SetTitle("TEST");
            //marker.SetSnippet("TEST");
            //marker.SetIcon(BitmapDescriptorFactory.DefaultMarker(BitmapDescriptorFactory.HueOrange));
            //
            //var m = NativeMap.AddMarker(marker);
            //m.ShowInfoWindow();
        }
예제 #20
0
        protected override void OnMapReady(GoogleMap map)
        {
            base.OnMapReady(map);

            NativeMap.UiSettings.ZoomControlsEnabled = false;
            NativeMap.InfoWindowClick += OnInfoWindowClick;
            NativeMap.MarkerClick     += OnMarkerClicked;
            NativeMap.SetInfoWindowAdapter(this);
            NativeMap.CameraChange += Map_CameraChange;
            Device.StartTimer(TimeSpan.FromSeconds(1), () =>
            {
                if (DateTime.Now.Subtract(TimeSpan.FromSeconds(1)) >= mapDraggedTime && !CanFetch && !customMap.OnSelect && Constants.OnInit)
                {
                    NativeMap.Clear();
                    customMap.getplace(lat, lng, 0);
                    CanFetch = true;
                    marketList.Clear();

                    CancelPinAnimation();
                }
                return(true);
            });
            //Device.StartTimer(TimeSpan.FromSeconds(20), () =>
            //{
            //    Device.BeginInvokeOnMainThread(() =>
            //    {
            //        foreach (var item in marketList)
            //        {
            //            //System.Diagnostics.Debug.WriteLine("ctr = {0}", ctr++);
            //            //Marker marker = (Marker)item.Value;
            //            //marker.Remove();
            //            //marker.Visible = false;
            //            //item.Value.Dispose();
            //            //var marker = new MarkerOptions();
            //            //marker.SetPosition(new LatLng(item.Value.Position.Latitude, item.Value.Position.Longitude));
            //            //marker.SetTitle(item.Key.Label);
            //            //marker.SetSnippet(item.Key.Address);
            //            //marker.SetIcon(BitmapDescriptorFactory.FromResource(Resource.Drawable.heart_eyes));
            //            //NativeMap.AddMarker(marker);
            //        }
            //    });
            //    return false;
            //});
        }
예제 #21
0
        protected override void OnMapReady(GoogleMap mapG)
        {
            base.OnMapReady(mapG);

            NativeMap.InfoWindowClick += OnInfoWindowClick;
            NativeMap.SetInfoWindowAdapter(this);
            NativeMap.MarkerClick += OnMarkerClick;
            NativeMap.UiSettings.ZoomControlsEnabled   = false;
            NativeMap.UiSettings.ScrollGesturesEnabled = false;
            //  addShape();
            NativeMap.InfoWindowLongClick += NativeMap_InfoWindowLongClick;
            // NativeMap.MyLocationChange += method;
            if (init)
            {
                var incc = Map.Pins as INotifyCollectionChanged;
                incc.CollectionChanged += OnCollectionChanged;
                init = false;
            }
        }
예제 #22
0
        protected override void OnMapReady(GoogleMap map)
        {
            // OnMapReady is called twice, not entirely certain why, known issue
            if (isDrawn)
            {
                return;
            }

            base.OnMapReady(map);
            _map = map;

            NativeMap.InfoWindowClick += OnInfoWindowClick;
            NativeMap.SetInfoWindowAdapter(this);
            this.NativeMap.InfoWindowClick += OnNativeMapInfoWindowClick;

            if (_map != null)
            {
                _map.MapClick += googleMap_MapClick;
            }

            isDrawn = true;
        }
예제 #23
0
        protected override void OnMapReady(GoogleMap map)
        {
            if (mapDrawn)
            {
                return;
            }
            base.OnMapReady(map);

            NativeMap.SetInfoWindowAdapter(this);

            NativeMap.MarkerClick     += OnMarkerClick;
            NativeMap.InfoWindowClick += OnInfoWindowClick;

            pins                  = new List <Pin>(formsMap.Pins);
            CoworkingClicked     += formsMap.OnCoworking;
            formsMap.PinsUpdated += OnPinsUpdate;

            bool isEnabled = DependencyService.Get <IPermissionRequester>().IsGPSEnabled();

            if (me != null)
            {
                me.Remove();
            }

            if (isEnabled)
            {
                var ret    = LocationHelper.GetLocation();
                var marker = new MarkerOptions();
                marker.SetPosition(new LatLng(ret.Latitude, ret.Longitude));

                var bitmap = BitmapFactory.DecodeResource(Resources, Resource.Drawable.HereIcon);
                marker.SetIcon(BitmapDescriptorFactory.FromBitmap(Bitmap.CreateScaledBitmap(bitmap, 350, 200, false)));
                marker.Draggable(false);
                me = NativeMap.AddMarker(marker);
            }

            mapDrawn = true;
        }