Esempio n. 1
0
        public void SetOnCameraMoveStartedListener([CanBeNull] Action <CameraMoveReason> onCameraMoveStarted)
        {
            if (GoogleMapUtils.IsPlatformNotSupported)
            {
                return;
            }

            CheckIfDismissed();

            if (GoogleMapUtils.IsAndroid)
            {
                GoogleMapAJO.MainThreadCall("setOnCameraMoveStartedListener",
                                            onCameraMoveStarted == null ? null : new setOnCameraMoveStartedListenerProxy(onCameraMoveStarted));
            }

#if UNITY_IOS && !DISABLE_IOS_GOOGLE_MAPS
            Action <int> callbackWrapper = reason =>
            {
                if (onCameraMoveStarted != null)
                {
                    onCameraMoveStarted((CameraMoveReason)reason);
                }
            };
            _googleMapsViewSetOnCameraMoveStartedListener(Callbacks.ActionIntCallback, callbackWrapper.GetPointer());
#endif
        }
Esempio n. 2
0
 void SetValueIfAndroid(string methodName, params object[] args)
 {
     CheckIfDismissed();
     if (GoogleMapUtils.IsAndroid)
     {
         GoogleMapAJO.MainThreadCallNonBlocking(methodName, args);
     }
 }
Esempio n. 3
0
        public override string ToString()
        {
            if (GoogleMapUtils.IsAndroid && GoogleMapAJO.IsJavaNull())
            {
                return("null");
            }

            return(string.Format("[GoogleMapsView: UiSettings={0}, IsMyLocationEnabled={1}, IsVisible={2}, CameraPosition={3}, MapType={4}, IsTrafficEnabled={5}]",
                                 UiSettings, IsMyLocationEnabled, IsVisible, CameraPosition, MapType, IsTrafficEnabled));
        }
Esempio n. 4
0
        public void SetPadding(int left, int top, int right, int bottom)
        {
            if (GoogleMapUtils.IsPlatformNotSupported)
            {
                return;
            }

            CheckIfDismissed();

            if (GoogleMapUtils.IsAndroid)
            {
                GoogleMapAJO.MainThreadCall("setPadding", left, top, right, bottom);
            }

#if UNITY_IOS && !DISABLE_IOS_GOOGLE_MAPS
            _googleMapsViewSetPadding(_mapPtr, left, top, right, bottom);
#endif
        }
Esempio n. 5
0
        public void SetOnLongMapClickListener([CanBeNull] Action <LatLng> onMapLongClicked)
        {
            if (GoogleMapUtils.IsPlatformNotSupported)
            {
                return;
            }

            CheckIfDismissed();

            if (GoogleMapUtils.IsAndroid)
            {
                GoogleMapAJO.MainThreadCall("setOnMapLongClickListener",
                                            onMapLongClicked == null ? null : new OnMapLongClickListenerProxy(onMapLongClicked));
            }

#if UNITY_IOS && !DISABLE_IOS_GOOGLE_MAPS
            _googleMapsViewSetOnMapLongClickListener(Callbacks.OnLocationSelectedCallback, onMapLongClicked.GetPointer());
#endif
        }
Esempio n. 6
0
        public void SetOnInfoWindowClickListener([CanBeNull] Action <Marker> listener)
        {
            if (GoogleMapUtils.IsPlatformNotSupported)
            {
                return;
            }

            CheckIfDismissed();

            if (GoogleMapUtils.IsAndroid)
            {
                GoogleMapAJO.MainThreadCall("setOnInfoWindowClickListener",
                                            listener == null ? null : new OnMarkerInfoWindowClickListenerProxy(listener));
            }

#if UNITY_IOS && !DISABLE_IOS_GOOGLE_MAPS
            _googleMapsViewSetOnMarkerInfoWindowClickListener(Callbacks.OnMarkerClickedCallback, listener.GetPointer());
#endif
        }
Esempio n. 7
0
        public void SetOnMarkerClickListener(Action <Marker> listener, bool defaultClickBehaviour = true)
        {
            if (GoogleMapUtils.IsPlatformNotSupported)
            {
                return;
            }

            CheckIfDismissed();

            if (GoogleMapUtils.IsAndroid)
            {
                GoogleMapAJO.MainThreadCall("setOnMarkerClickListener",
                                            listener == null ? null : new OnMarkerClickListenerProxy(listener, defaultClickBehaviour));
            }

#if UNITY_IOS && !DISABLE_IOS_GOOGLE_MAPS
            _googleMapsViewSetOnMarkerClickListener(Callbacks.OnMarkerClickedCallback, listener.GetPointer(), defaultClickBehaviour);
#endif
        }
Esempio n. 8
0
        public void TakeSnapshot([NotNull] Action <Texture2D> listener)
        {
            if (listener == null)
            {
                throw new ArgumentNullException("listener");
            }

            if (GoogleMapUtils.IsPlatformNotSupported)
            {
                return;
            }

            if (GoogleMapUtils.IsAndroid)
            {
                GoogleMapAJO.MainThreadCall("snapshot", new SnapshotReadyCallbackProxy(listener));
            }

#if UNITY_IOS && !DISABLE_IOS_GOOGLE_MAPS
            _googleMapsViewTakeSnapshot(_mapPtr, Callbacks.ImageResultCallback, listener.GetPointer());
#endif
        }
Esempio n. 9
0
        public void MoveCamera([NotNull] CameraUpdate cameraUpdate)
        {
            if (cameraUpdate == null)
            {
                throw new ArgumentNullException("cameraUpdate");
            }

            if (GoogleMapUtils.IsPlatformNotSupported)
            {
                return;
            }

            CheckIfDismissed();

#if UNITY_IOS && !DISABLE_IOS_GOOGLE_MAPS
            _googleMapsViewAnimateCamera(_mapPtr, Json.Serialize(cameraUpdate.ToDictionary()), false);
#endif

            if (GoogleMapUtils.IsAndroid)
            {
                GoogleMapAJO.MainThreadCall("moveCamera", cameraUpdate.ToAJO());
            }
        }
Esempio n. 10
0
        public bool SetMapStyle([CanBeNull] string styleJson)
        {
            if (GoogleMapUtils.IsPlatformNotSupported)
            {
                return(false);
            }

            CheckIfDismissed();

            if (GoogleMapUtils.IsAndroid)
            {
                return(GoogleMapAJO.MainThreadCall <bool>("setMapStyle", styleJson == null ? null : new AndroidJavaObject("com.google.android.gms.maps.model.MapStyleOptions", styleJson)));
            }

#if UNITY_IOS && !DISABLE_IOS_GOOGLE_MAPS
            return(_googleMapsViewSetStyle(_mapPtr, styleJson));
#endif

#pragma warning disable 0162
            return(false);

#pragma warning restore 0162
        }
Esempio n. 11
0
 T GetValueIfAndroid <T>(string methodName)
 {
     CheckIfDismissed();
     return(GoogleMapUtils.IsAndroid ? GoogleMapAJO.MainThreadCall <T>(methodName) : default(T));
 }