コード例 #1
0
ファイル: Marker.cs プロジェクト: philoushka/GooglemapMvc
 public Marker(GoogleMap map)
     : base(map)
 {
     Clickable = true;
     Draggable = false;
     index = map.Markers.Count;
 }
コード例 #2
0
 public static GoogleMap GoogleMap(this AjaxHelper helper, string mapID)
 {
     if (string.IsNullOrEmpty(mapID))
     {
         throw new ArgumentNullException("mapID");
     }
     var map = new GoogleMap(helper, mapID);
     return map;
 }
コード例 #3
0
        public static GoogleMap GoogleMap(this AjaxHelper helper, string mapID)
        {
            if (string.IsNullOrEmpty(mapID))
            {
                throw new ArgumentNullException("mapID");
            }
            var map = new GoogleMap(helper, mapID);

            //edit
            //map.Zoom( 4 )
            //    .Center( 39.9097362345372, -97.470703125 )
            //    .MapType( MapType.Road );

            map.MapType( MapType.Road );
            //end edit

            return map;
        }
コード例 #4
0
ファイル: MainActivity.cs プロジェクト: Xtremrules/dot42
        private void SetUpMapIfNeeded()
        {
            // Do a null check to confirm that we have not already instantiated the map.
            if (mMap == null)
            {
                mMap = ((MapFragment)FragmentManager.FindFragmentById(R.Id.map)).GetMap();
                // Check if we were successful in obtaining the map.
                if (mMap != null)
                {
                    // The Map is verified. It is now safe to manipulate the map.
                    mMap.SetMapType(GoogleMap.MAP_TYPE_SATELLITE);

                    mMap.SetMyLocationEnabled(true);
                    // Zoom in the Google Map
                    mMap.AnimateCamera(CameraUpdateFactory.ZoomTo(20));

                }
            }
        }
コード例 #5
0
 public MapHandler(string MapsApiKey, GoogleMap Map)
 {
     this.MapKey = MapsApiKey;
     this.Map    = Map;
 }
コード例 #6
0
 public CenterFactory(GoogleMap map)
 {
     Map = map;
 }
コード例 #7
0
 public void OnMapReady(GoogleMap map)
 {
     map.AddMarker(new MarkerOptions().SetPosition(new LatLng(0, 0)).SetTitle("Marker"));
 }
コード例 #8
0
        internal void AddComponent(GoogleMap component)
        {
            if(component == null) throw new ArgumentNullException("component");

            components.Add(component);
        }
コード例 #9
0
        protected override async void OnElementChanged(ElementChangedEventArgs <View> e)
        {
            base.OnElementChanged(e);

            // For XAML Previewer or FormsGoogleMaps.Init not called.
            if (!FormsGoogleMaps.IsInitialized)
            {
                var tv = new TextView(Context)
                {
                    Gravity = GravityFlags.Center,
                    Text    = "Xamarin.Forms.GoogleMaps"
                };
                tv.SetBackgroundColor(Color.Teal.ToAndroid());
                tv.SetTextColor(Color.Black.ToAndroid());
                SetNativeControl(tv);
                return;
            }

            var oldMapView = (MapView)Control;

            var mapView = new MapView(Context);

            mapView.OnCreate(s_bundle);
            mapView.OnResume();
            SetNativeControl(mapView);

            var activity = Context as Activity;

            if (activity != null)
            {
                var metrics = new DisplayMetrics();
                activity.WindowManager.DefaultDisplay.GetMetrics(metrics);
                foreach (var logic in _logics)
                {
                    logic.ScaledDensity = metrics.ScaledDensity;
                }

                _cameraLogic.ScaledDensity = metrics.ScaledDensity;
            }

            if (e.OldElement != null)
            {
                var oldMapModel = (Map)e.OldElement;

                _cameraLogic.Unregister();

                var oldGoogleMap = await oldMapView.GetGoogleMapAsync();

                if (oldGoogleMap != null)
                {
                    oldGoogleMap.SetOnCameraChangeListener(null);
                    oldGoogleMap.SetOnMapClickListener(null);
                    oldGoogleMap.SetOnMapLongClickListener(null);
                    oldGoogleMap.SetOnMyLocationButtonClickListener(null);
                }

                oldMapView.Dispose();
            }

            if (oldMapView != null)
            {
                _oldNativeMap = await oldMapView.GetGoogleMapAsync();

                _oldMap = (Map)e.OldElement;
            }

            NativeMap = await((MapView)Control).GetGoogleMapAsync();

            _cameraLogic.Register(Map, NativeMap);

            OnMapReady(NativeMap);
        }
コード例 #10
0
 public MarkerClusteringOptionsFactory(GoogleMap component)
 {
     this.Map = component;
 }
コード例 #11
0
ファイル: Polygon.cs プロジェクト: philoushka/GooglemapMvc
 public Polygon(GoogleMap map)
     : base(map)
 {
     points = new List<Location>();
 }
コード例 #12
0
ファイル: MainActivity.cs プロジェクト: ivanlav/Scenery
 public void OnMapReady(GoogleMap googleMap)
 {
     mMap = googleMap;
 }
コード例 #13
0
 public void OnMapReady(GoogleMap googleMap)
 {
     mGoogleMap = googleMap;
     mGoogleMap.UiSettings.ZoomControlsEnabled = true;
     mGoogleMap.MyLocationEnabled = true;
 }
コード例 #14
0
 public MapFunctionHelper(string mMapkey, GoogleMap mmap)
 {
     mapkey  = mMapkey;
     mainMap = mmap;
 }
コード例 #15
0
 public void OnMapReady(GoogleMap googleMap)
 {
     map = googleMap;
     map.InfoWindowClick += OnInfoWindowClick;
     map.SetInfoWindowAdapter(this);
 }
コード例 #16
0
 public CustomerPage()
 {
     this.InitializeComponent();
     GoogleMap.NavigateToString("maps.google.com");
     Update(10);
 }
コード例 #17
0
 public MapCanvasView(Context context, GoogleMap map) : base(context)
 {
     _map = map;
     setupPaint();
 }
コード例 #18
0
        protected override async void OnElementChanged(ElementChangedEventArgs <Map> e)
        {
            base.OnElementChanged(e);

            if (e.OldElement == e.NewElement)
            {
                return;
            }

            // For XAML Previewer or FormsGoogleMaps.Init not called.
            if (!FormsGoogleMaps.IsInitialized)
            {
                var tv = new TextView(Context)
                {
                    Gravity = GravityFlags.Center,
                    Text    = "Xamarin.Forms.GoogleMaps"
                };
                tv.SetBackgroundColor(Color.Teal.ToAndroid());
                tv.SetTextColor(Color.Black.ToAndroid());
                SetNativeControl(tv);
                return;
            }

            // Uninitialize old view
            GoogleMap oldNativeMap = null;
            Map       oldMap       = null;

            if (e.OldElement != null)
            {
                try
                {
                    var oldNativeView = Control as MapView;
                    // ReSharper disable once PossibleNullReferenceException
                    oldNativeMap = await oldNativeView?.GetGoogleMapAsync();

                    oldMap = e.OldElement;
                    Uninitialize(oldNativeMap, oldMap);
                    oldNativeView?.Dispose();
                }
                catch (System.Exception ex)
                {
                    var message = ex.Message;
                    System.Diagnostics.Debug.WriteLine($"Uninitialize old view failed. - {message}");
                }
            }

            if (e.NewElement == null)
            {
                return;
            }

            var mapView = new MapView(Context);

            mapView.OnCreate(s_bundle);
            mapView.OnResume();
            SetNativeControl(mapView);

            var activity = Context as Activity;

            if (activity != null)
            {
                _scaledDensity             = activity.GetScaledDensity();
                _cameraLogic.ScaledDensity = _scaledDensity;
                foreach (var logic in Logics)
                {
                    logic.ScaledDensity = _scaledDensity;
                }
            }

            var newMap = e.NewElement;

            NativeMap = await mapView.GetGoogleMapAsync();

            foreach (var logic in Logics)
            {
                logic.Register(oldNativeMap, oldMap, NativeMap, newMap);
                logic.ScaledDensity = _scaledDensity;
            }

            OnMapReady(NativeMap, newMap);
        }
コード例 #19
0
ファイル: Layer.cs プロジェクト: philoushka/GooglemapMvc
 protected internal Layer(string name, GoogleMap map)
     : base(map)
 {
     Name = name;
 }
コード例 #20
0
ファイル: KmlLayer.cs プロジェクト: philoushka/GooglemapMvc
 public KmlLayer(GoogleMap map)
     : base("kml", map)
 {
     Clickable = true;
     ScreenOverlays = true;
 }
コード例 #21
0
ファイル: Circle.cs プロジェクト: philoushka/GooglemapMvc
 public Circle(GoogleMap map)
     : base(map)
 {
 }
コード例 #22
0
ファイル: MapSample.cs プロジェクト: BOTLANNER/Ooui
        GoogleMap MakeMap()
        {
            var map = new GoogleMap(mapType: GoogleMap.MapType.HYBRID, firstMapControlOnPage: true)
            {
                APIKey = "YOUR_GOOGLE_MAPS_API_KEY_HERE",
            };


            //Add Marker from code on creating of view
            map.AddMarker(new GoogleMap.MapMarker()
            {
                lat        = 51.511884,
                lng        = -0.195421,
                title      = "Testing Markers on Load",
                infoWindow = new GoogleMap.MapInfoWindow()
                {
                    content = "This is the first pin placement (I think it is at Kensington Palace)"
                }
            });

            ThreadPool.QueueUserWorkItem((state) =>
            {
                //Add Marker from code after view has been loaded
                Thread.Sleep(5000);
                map.AddMarker(new GoogleMap.MapMarker
                {
                    lat        = 51.5073346,
                    lng        = -0.1276831,
                    title      = "Testing Markers",
                    infoWindow = new GoogleMap.MapInfoWindow
                    {
                        content = "This is a random pin placement"
                    }
                });
            });
            ThreadPool.QueueUserWorkItem((state) =>
            {
                //Change map center location after ten seconds and add a marker there
                Thread.Sleep(10000);

                var pos = new GoogleMap.Position
                {
                    latitude  = 40.6892,
                    longitude = 74.0445,
                };
                map.CenterOn(pos);
                map.AddMarker(new GoogleMap.MapMarker
                {
                    lat        = pos.latitude,
                    lng        = pos.longitude,
                    title      = "Kyrgyzstan",
                    infoWindow = new GoogleMap.MapInfoWindow
                    {
                        content = "This should be in Kyrgyzstan"
                    }
                });
                ThreadPool.QueueUserWorkItem(async(state2) =>
                {
                    await Task.Delay(5000);

                    var pos2 = await map.GetCenter();
                });
            });
            return(map);
        }
コード例 #23
0
 public void GoToLocation(double latitude, double longitude)
 {
     GoogleMap.MoveToRegion(MapSpan.FromCenterAndRadius(new Position(latitude, longitude),
                                                        Distance.FromMiles(1)));
 }
コード例 #24
0
 public MapRenderService(GoogleMap map)
 {
     _map = map;
 }
コード例 #25
0
 public ImageMapTypeFactory(GoogleMap map)
 {
     this.map = map;
 }
コード例 #26
0
        protected override void CreateChildControls()
        {
            base.CreateChildControls();

            if (base.DesignedControl != null)
            {
                //set up the editor properties
                this.component = (GoogleMap)base.DesignedControl;
                this.editorDialog = new PropertyEditorDialog();
                this.editorDialog.TypeContainer = this.component;
                this.editorDialog.PropertyChanged += new PropertyValueChangedEventHandler(this.EditorDialog_PropertyChanged);
                this.Controls.Add(this.editorDialog);
                this.properties = TypeDescriptor.GetProperties(this.component);

                //bind the zoom drop down
                BindZoomOptions();

                //set the properties of the controls in the designer
                this.GoogleKey.Text = this.component.GoogleKey;
                this.Address.Text = this.component.Address;
                this.Heading.Text = this.component.Heading;

                if (this.Width != null)
                    this.Width.Text = this.component.Width.ToString();

                if (this.Height != null)
                    this.Height.Text = this.component.Height.ToString();

                if (this.EnableDirections != null)
                    this.EnableDirections.Checked = this.component.EnableDirections;

                if (this.Zoom != null)
                {
                    ListItem foundZoom= this.Zoom.Items.FindByValue(this.component.Zoom.ToString());
                    if (foundZoom != null)
                        foundZoom.Selected = true;
                }

                this.UpdateMapButton.Click += new EventHandler(UpdateMapButton_Click);
            }

            SetMapPreview();
        }
コード例 #27
0
 public StyledMapTypeFactory(GoogleMap map)
 {
     Map = map;
 }
コード例 #28
0
ファイル: MapObject.cs プロジェクト: philoushka/GooglemapMvc
 protected MapObject(GoogleMap map)
 {
     if (map == null) throw new ArgumentNullException("map");
     Map = map;
 }
コード例 #29
0
 public PolygonFactory(GoogleMap map)
 {
     this.map = map;
 }
コード例 #30
0
 public MarkerFactory(GoogleMap map)
 {
     if(map == null) throw new ArgumentNullException("map");
     this.map = map;
 }
コード例 #31
0
 public CameraPositionlHandler(GoogleMap googleMap, PickDetailActivity rootVC)
 {
     _googleMap  = googleMap;
     this.rootVC = rootVC;
 }
コード例 #32
0
 void IOnMapReadyCallback.OnMapReady(GoogleMap map)
 {
     NativeMap = map;
     OnMapReady(map);
 }
コード例 #33
0
 public void OnMapReady(GoogleMap googleMap)
 {
     _map = googleMap;
     LoadStoresToMap();
 }
コード例 #34
0
        public async void getCurLocation(GoogleMap googleMap)
        {
            Console.WriteLine("Test - CurrentLoc");
            try
            {
                var request  = new GeolocationRequest(GeolocationAccuracy.Medium);
                var location = await Geolocation.GetLocationAsync(request);

                if (location != null)
                {
                    Console.WriteLine($"current Loc - Latitude: {location.Latitude}, Longitude: {location.Longitude}, Altitude: {location.Altitude}");
                    MarkerOptions curLoc = new MarkerOptions();
                    curLoc.SetPosition(new LatLng(location.Latitude, location.Longitude));
                    var address = await Geocoding.GetPlacemarksAsync(location.Latitude, location.Longitude);

                    var placemark      = address?.FirstOrDefault();
                    var geocodeAddress = "";
                    if (placemark != null)
                    {
                        geocodeAddress =
                            $"AdminArea: {placemark.AdminArea}\n" +
                            $"CountryCode: {placemark.CountryCode}\n" +
                            $"CountryName: {placemark.CountryName}\n" +
                            $"FeatureName: {placemark.FeatureName}\n" +
                            $"Locality: {placemark.Locality}\n" +
                            $"PostalCode: {placemark.PostalCode}\n" +
                            $"SubAdminArea: {placemark.SubAdminArea}\n" +
                            $"SubLocality: {placemark.SubLocality}\n" +
                            $"SubThoroughfare: {placemark.SubThoroughfare}\n" +
                            $"Thoroughfare: {placemark.Thoroughfare}\n";
                    }
                    curLoc.SetTitle("You are here" + geocodeAddress);
                    curLoc.SetIcon(BitmapDescriptorFactory.DefaultMarker(BitmapDescriptorFactory.HueAzure));

                    googleMap.AddMarker(curLoc);

                    CameraPosition.Builder builder = CameraPosition.InvokeBuilder();
                    builder.Target(new LatLng(location.Latitude, location.Longitude));
                    builder.Zoom(20);
                    builder.Tilt(65);

                    CameraPosition cPos         = builder.Build();
                    CameraUpdate   cameraUpdate = CameraUpdateFactory.NewCameraPosition(cPos);
                    googleMap.MoveCamera(cameraUpdate);
                }
                else
                {
                    OnMapReady(googleMap);
                }
            }
            catch (FeatureNotSupportedException fnsEx)
            {
                // Handle not supported on device exception
                // Toast.MakeText(Activity"Feature Not Supported", ToastLength.Short);
            }
            catch (FeatureNotEnabledException fneEx)
            {
                // Handle not enabled on device exception
                // Toast.MakeText(Activity, "Feature Not Enabled", ToastLength.Short);
            }
            catch (PermissionException pEx)
            {
                // Handle permission exception
                // Toast.MakeText(Activity, "Needs more permission", ToastLength.Short);
            }
            catch (Exception ex)
            {
                OnMapReady(googleMap);
            }
        }
コード例 #35
0
 void ArcgisMapLoaded(object sender, RoutedEventArgs e)
 {
     timer.Duration = new TimeSpan(0, 0, 0, 0, 500);
     Dtimer.Duration = new TimeSpan(0, 0, 0, 15);
     Ltimer.Duration = new TimeSpan(0, 0, 0, 45);
     var ml = new WuXiMapLayer();
     var MOml = new WuXiMapLayer();
     var gmap = new GoogleMap();
     var ly = new realLayer();
     var osm = new OpenStreetMapLayer();
     var cd = new ClientDynamicTileMapServiceLayer();
     var myGraphicsLayer = new GraphicsLayer { ID = "MyGraphicsLayer" };
     var myLineLayer = new GraphicsLayer { ID = "MyLineLayer" };
     MyMap.Layers.Add(ml);
     MyMap.Layers.Add(ly);
     MyMap.Layers.Add(myLineLayer);
     MyMap.Layers.Add(myGraphicsLayer);
     MyOverviewMap.Layer = MOml;
     AddPictureMarker();
 }
コード例 #36
0
ファイル: Overlay.cs プロジェクト: philoushka/GooglemapMvc
 public Overlay(GoogleMap map)
     : base(map)
 {
 }
コード例 #37
0
 public CircleFactory(GoogleMap map)
 {
     this.map = map;
 }
コード例 #38
0
 public MapHandler(string MapsApiKey, GoogleMap Map, EventHandler <GoogleMap.MarkerClickEventArgs> OnMarkerClickAction)
 {
     this.MapKey      = MapsApiKey;
     this.Map         = Map;
     Map.MarkerClick += OnMarkerClickAction;
 }