• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

C# Model.Marker类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



Marker类属于Android.Gms.Maps.Model命名空间,在下文中一共展示了Marker类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C#代码示例。

示例1: OnCreate

        protected override void OnCreate(Bundle bundle)
        {
            base.OnCreate(bundle);
            SetContentView(Resource.Layout.FirstView);

            var viewModel = (FirstViewModel) ViewModel;

            var mapFragment = (SupportMapFragment)SupportFragmentManager.FindFragmentById(Resource.Id.map);

            var options = new MarkerOptions();
            options.SetPosition(new LatLng(viewModel.Keith.Location.Lat, viewModel.Keith.Location.Lng));
            options.SetTitle("Keith");
            _keith = mapFragment.Map.AddMarker(options);

            var options2 = new MarkerOptions();
            options2.SetPosition(new LatLng(viewModel.Helen.Location.Lat, viewModel.Helen.Location.Lng));
            options2.SetTitle("Helen");
            _helen = mapFragment.Map.AddMarker(options2);

            var set = this.CreateBindingSet<FirstView, FirstViewModel>();
            set.Bind(_keith)
               .For(m => m.Position)
               .To(vm => vm.Keith.Location)
               .WithConversion(new LocationToLatLngValueConverter(), null);
            set.Bind(_helen)
               .For(m => m.Position)
               .To(vm => vm.Helen.Location)
               .WithConversion(new LocationToLatLngValueConverter(), null);
            set.Apply();

        }
开发者ID:KiranKumarAlugonda,项目名称:NPlus1DaysOfMvvmCross,代码行数:31,代码来源:FirstView.cs


示例2: OnMarkerClick

        //
        // Marker related listeners.
        //
        public bool OnMarkerClick(Marker marker)
        {
            // This causes the marker at Perth to bounce into position when it is clicked.
            if (marker.Equals(mPerth)) {
                Handler handler = new Handler ();
                long start = SystemClock.UptimeMillis ();
                Projection proj = mMap.Projection;
                Point startPoint = proj.ToScreenLocation(PERTH);
                startPoint.Offset(0, -100);
                LatLng startLatLng = proj.FromScreenLocation(startPoint);
                long duration = 1500;

                IInterpolator interpolator = new BounceInterpolator();

                Runnable run = null;
                run = new Runnable (delegate {
                        long elapsed = SystemClock.UptimeMillis () - start;
                        float t = interpolator.GetInterpolation ((float) elapsed / duration);
                        double lng = t * PERTH.Longitude + (1 - t) * startLatLng.Longitude;
                        double lat = t * PERTH.Latitude + (1 - t) * startLatLng.Latitude;
                        marker.Position = (new LatLng(lat, lng));

                        if (t < 1.0) {
                            // Post again 16ms later.
                            handler.PostDelayed(run, 16);
                        }
                });
                handler.Post(run);
            }
            // We return false to indicate that we have not consumed the event and that we wish
            // for the default behavior to occur (which is for the camera to move such that the
            // marker is centered and for the marker's info window to open, if it has one).
            return false;
        }
开发者ID:vkheleli,项目名称:monodroid-samples-master,代码行数:37,代码来源:MarkerDemoActivity.cs


示例3: GetInfoContents

		public View GetInfoContents (Marker marker)
		{
			if (view == null) {
				var inflater = context.GetSystemService (Context.LayoutInflaterService).JavaCast<LayoutInflater> ();
				view = inflater.Inflate (Resource.Layout.InfoWindowLayout, null);
				var bikeView = view.FindViewById<ImageView> (Resource.Id.bikeImageView);
				var lockView = view.FindViewById<ImageView> (Resource.Id.lockImageView);
				bikeView.SetImageDrawable (bikeDrawable);
				lockView.SetImageDrawable (lockDrawable);
			}

			var name = view.FindViewById<TextView> (Resource.Id.InfoViewName);
			var bikes = view.FindViewById<TextView> (Resource.Id.InfoViewBikeNumber);
			var slots = view.FindViewById<TextView> (Resource.Id.InfoViewSlotNumber);
			var starButton = view.FindViewById<ToggleButton> (Resource.Id.StarButton); 

			var splitTitle = marker.Title.Split ('|');
			var displayName = splitTitle[1]
				.Split (new string[] { "-", " at " }, StringSplitOptions.RemoveEmptyEntries)
				.FirstOrDefault ();
			Id = int.Parse (splitTitle[0]);
			name.Text = (displayName ?? string.Empty).Trim ();
			var splitNumbers = marker.Snippet.Split ('|');
			bikes.Text = splitNumbers [0];
			slots.Text = splitNumbers [1];

			bool activated = favManager.GetFavoritesStationIds ().Contains (Id);
			starButton.Activated = activated;
			starButton.SetBackgroundDrawable (activated ? starOnDrawable : starOffDrawable);

			return view;
		}
开发者ID:JovinPJ,项目名称:Moyeu,代码行数:32,代码来源:InfoWindowAdapter.cs


示例4: FindMap

		void FindMap ()
		{
			_map = (SupportFragmentManager.FindFragmentById (Resource.Id.map) as SupportMapFragment).Map;
			if (_map != null) {
				_map.MyLocationEnabled = true;

				_map.UiSettings.TiltGesturesEnabled = false;
				_map.UiSettings.RotateGesturesEnabled = false;

				_map.MapClick += OnMapClick;
				_map.MapLongClick += OnMapLongClick;
				_map.MyLocationChange += HandleMyLocationChange;
				_map.MarkerClick += OnMarkerClick;

				_map.SetInfoWindowAdapter (new InfoWindowAdapter ());

				// here because map should be already initialized
				// http://developer.android.com/reference/com/google/android/gms/maps/model/BitmapDescriptorFactory.html
				_alarm_marker_normal = BitmapDescriptorFactory.FromResource (Resource.Drawable.marker_violet);
				_alarm_marker_normal_selected = BitmapDescriptorFactory.FromResource (Resource.Drawable.marker_violet_selected);
				_alarm_marker_disabled_selected = BitmapDescriptorFactory.FromResource (Resource.Drawable.marker_grey_selected);				
				_alarm_marker_disabled = BitmapDescriptorFactory.FromResource (Resource.Drawable.marker_grey);
                
				RefreshData ();

				_map.SetOnMapLoadedCallback (this);

				if (Mode == Mode.Add) {
					if (AlarmToAddMarker != null) {
						AlarmToAddMarker = _map.AddMarker (new MarkerOptions ().SetPosition (AlarmToAddMarker.Position).InvokeIcon (_alarm_marker_normal));
					}
				}
			}
		}
开发者ID:foxanna,项目名称:SimpleLocationAlarm,代码行数:34,代码来源:HomeActivityMapWork.cs


示例5: GetInfoContents

			public View GetInfoContents (Marker marker) {
				if (mOptions.CheckedRadioButtonId != Resource.Id.custom_info_contents) {
					// This means that the default info contents will be used.
					return null;
				}
				Render (marker, mContents);
				return mContents;
			}
开发者ID:89sos98,项目名称:monodroid-samples,代码行数:8,代码来源:MarkerDemoActivity.cs


示例6: GetInfoWindow

			public View GetInfoWindow (Marker marker) {
				if (mOptions.CheckedRadioButtonId != Resource.Id.custom_info_window) {
					// This means that getInfoContents will be called.
					return null;
				}
				Render(marker, mWindow);
				return mWindow;
			}
开发者ID:89sos98,项目名称:monodroid-samples,代码行数:8,代码来源:MarkerDemoActivity.cs


示例7: GetIdentifier

		string GetIdentifier(Marker annotation)
		{
			Position annotationPosition = new Position (annotation.Position.Latitude, annotation.Position.Longitude);
			foreach (var pin in _pins) {
				if (pin.FormsPin.Position == annotationPosition)
					return pin.Identifier;	
			}
			return "";
		}
开发者ID:biyyalakamal,项目名称:customer-success-samples,代码行数:9,代码来源:CustomInfoWindow.cs


示例8: CreateMarker

        private void CreateMarker()
        {
            var latLng = new LatLng(55.816887, 12.532878);

            var markerOptions = new MarkerOptions()
                .SetPosition(latLng)
                .Draggable(true);
            _meMarker = _map.AddMarker(markerOptions);
            _map.AnimateCamera(CameraUpdateFactory.NewLatLngZoom(latLng, 13));
        }
开发者ID:Cheesebaron,项目名称:AppCompatAndMaps,代码行数:10,代码来源:LocationFragment.cs


示例9: OnMapReady

 public void OnMapReady (GoogleMap googleMap)
 {
     googleMap.MarkerDragEnd += (sender, e) => {
         mStreetViewPanorama.SetPosition (e.Marker.Position, 150);
     };
                         
     // Creates a draggable marker. Long press to drag.
     mMarker = googleMap.AddMarker (new MarkerOptions()
         .SetPosition (markerPosition)
         .SetIcon (BitmapDescriptorFactory.FromResource (Resource.Drawable.pegman))
         .Draggable(true));
 }
开发者ID:FirstClickStart,项目名称:yesterdaysMuffins,代码行数:12,代码来源:SplitStreetViewPanoramaAndMapDemoActivity.cs


示例10: GetInfoContents

      public View GetInfoContents (Marker marker)
      {
         Point item = JsonConvert.DeserializeObject<Point> (marker.Snippet);
         bool needToRefresh = item.GetId != _info.GetId;
         if (needToRefresh) {
            SetContents (DeviceUtility.DeviceId, item.id, item.type);
         }

         _marker = marker;

         int customPopupId;
         if (item.GetMapItemType == MapItemType.Point) {
            customPopupId = Resource.Layout.CustomMarkerPopupPoint;
         } else {
            customPopupId = Resource.Layout.CustomMarkerPopupQuest;
         }
         var customPopup = _layoutInflater.Inflate (customPopupId, null);

         var nameTextView = customPopup.FindViewById<TextView> (Resource.Id.customInfoWindow_Name);
         if (nameTextView != null) {
            nameTextView.Text = string.Format ("Название: {0}", marker.Title);
            nameTextView.SetTextColor(Android.Graphics.Color.ParseColor("#bdbdbd"));
         }

         var latLonTextView = customPopup.FindViewById<TextView> (Resource.Id.customInfoWindow_LatLonTextView);
         if (latLonTextView != null) {
            latLonTextView.Text = string.Format ("Координаты: {0}; {1}", marker.Position.Latitude, marker.Position.Longitude);
            latLonTextView.SetTextColor(Android.Graphics.Color.ParseColor("#bdbdbd"));
         }

         if (item.GetMapItemType == MapItemType.Point) {
            var allianceTextView = customPopup.FindViewById<TextView> (Resource.Id.customInfoWindow_AllianceTextView);
            if (allianceTextView != null) {
               allianceTextView.Text = string.Format ("Альянс: {0}", _info.alliance);
               allianceTextView.SetTextColor(Android.Graphics.Color.ParseColor("#bdbdbd"));
            }

            var fractionTextView = customPopup.FindViewById<TextView> (Resource.Id.customInfoWindow_FractionTextView);
            if (fractionTextView != null) {
               fractionTextView.Text = string.Format ("Фракция: {0}", _info.fraction);
               fractionTextView.SetTextColor(Android.Graphics.Color.ParseColor("#bdbdbd"));
            }
         }

         var descriptionTextView = customPopup.FindViewById<TextView> (Resource.Id.customInfoWindow_DescriptionTextView);
         if (descriptionTextView != null) {
            descriptionTextView.Text = string.Format ("Описание: {0}", _info.description);
            descriptionTextView.SetTextColor(Android.Graphics.Color.ParseColor("#bdbdbd"));
         }

         return customPopup;
      }
开发者ID:bkmza,项目名称:goandfindme,代码行数:52,代码来源:CustomInfoWindowAdapter.cs


示例11: AddInitialPolarBarToMap

        private void AddInitialPolarBarToMap()
        {
            MarkerOptions markerOptions = new MarkerOptions()
                .SetSnippet("Click me to go on vacation.")
                .SetPosition(LeaveFromHereToMaui)
                .SetTitle("Goto Maui");
            _polarBearMarker = _map.AddMarker(markerOptions);
            _polarBearMarker.ShowInfoWindow();

            _gotoMauiMarkerId = _polarBearMarker.Id;

            PositionPolarBearGroundOverlay(LeaveFromHereToMaui);
        }
开发者ID:josephkiran,项目名称:Projects,代码行数:13,代码来源:MapWithOverlaysActivity.cs


示例12: GetInfoContents

        /// <summary>
        /// Gets the info contents.
        /// </summary>
        /// <returns>The info contents.</returns>
        /// <param name="marker">Marker object.</param>
        public View GetInfoContents(Marker marker)
        {
            var inflater = Application.Context.GetSystemService(Context.LayoutInflaterService) as LayoutInflater;

            View v = inflater.Inflate(Resource.Layout.field_info_window, null);

            var title = v.FindViewById(Resource.Id.textViewName) as TextView;
            title.Text = marker.Title;

            var description = v.FindViewById(Resource.Id.textViewRows) as TextView;
            description.Text = marker.Snippet;

            return v;
        }
开发者ID:MilenPavlov,项目名称:treewatch,代码行数:19,代码来源:FieldInfoWindow.cs


示例13: GetInfoWindow

		public View GetInfoWindow(Marker p0)
		{
			string identifier = GetIdentifier (p0);

			//These would be the markers you want special views for
			switch (identifier) {
			case "Xamarin":
				return (_context as Activity).LayoutInflater.Inflate (Resource.Layout.XamarinPinView, _viewGroup, false);
			case "Train":
				return (_context as Activity).LayoutInflater.Inflate (Resource.Layout.TrainPinView, _viewGroup, false);
			}

			//This would be the default view that you want to set
			var view = new Android.Views.View (_context);

			return view;
		}
开发者ID:biyyalakamal,项目名称:customer-success-samples,代码行数:17,代码来源:CustomInfoWindow.cs


示例14: GetInfoContents

        public View GetInfoContents(Marker marker)
        {
            var customPopup = _layoutInflater.Inflate(Resource.Layout.info_window, null);

            var titleTextView = customPopup.FindViewById<TextView>(Resource.Id.lblNameValue);
            if (titleTextView != null)
            {
                titleTextView.Text = marker.Title;
            }

            var snippetTextView = customPopup.FindViewById<TextView>(Resource.Id.lblCommentValue);
            if (snippetTextView != null)
            {
                snippetTextView.Text = marker.Snippet;
            }

            return customPopup;
        }
开发者ID:znajdzWC,项目名称:znajdz-wc-android,代码行数:18,代码来源:CustomMarkerPopupAdapter.cs


示例15: Render

            private void Render(Marker marker, View view)
            {

                var resourceId = 0;
                if (parent._crueltyLookup.ContainsKey(marker.Id))
                {
                    CrueltySpot spot = parent._crueltyLookup[marker.Id];
                    if (spot.CrueltySpotCategory.IconName != null)
                    {
                        resourceId = parent.Resources.GetIdentifier(spot.CrueltySpotCategory.IconName.Replace(".png", ""), "drawable", parent.PackageName);
                    }
                }
                ((ImageView)view.FindViewById(Resource.Id.badge)).SetImageResource(resourceId);

                String title = marker.Title;
                TextView titleUi = ((TextView)view.FindViewById(Resource.Id.title));
                if (title != null)
                {
                    // Spannable string allows us to edit the formatting of the text.
                    SpannableString titleText = new SpannableString(title);

                    // FIXME: this somehow rejects to compile
                    //titleText.SetSpan (new ForegroundColorSpan(Color.Red), 0, titleText.Length, st);
                    titleUi.TextFormatted = (titleText);
                }
                else
                {
                    titleUi.Text = ("");
                }

                String snippet = marker.Snippet;
                TextView snippetUi = ((TextView)view.FindViewById(Resource.Id.snippet));
                if (snippet != null)
                {
                    SpannableString snippetText = new SpannableString(snippet);
                    //	snippetText.SetSpan(new ForegroundColorSpan(Color.Magenta), 0, 10, 0);
                    //	snippetText.SetSpan(new ForegroundColorSpan(Color.Blue), 12, 21, 0);
                    snippetUi.TextFormatted = (snippetText);
                }
                else
                {
                    snippetUi.Text = ("");
                }
            }
开发者ID:America4Animals,项目名称:AFA,代码行数:44,代码来源:IntroActivity.cs


示例16: Render

			private void Render (Marker marker, View view) {
				int badge;
				// Use the equals() method on a Marker to check for equals.  Do not use ==.
				if (marker.Equals(parent.mBrisbane)) {
					badge = Resource.Drawable.badge_qld;
				} else if (marker.Equals(parent.mAdelaide)) {
					badge = Resource.Drawable.badge_sa;
				} else if (marker.Equals(parent.mSydney)) {
					badge = Resource.Drawable.badge_nsw;
				} else if (marker.Equals(parent.mMelbourne)) {
					badge = Resource.Drawable.badge_victoria;
				} else if (marker.Equals(parent.mPerth)) {
					badge = Resource.Drawable.badge_wa;
				} else {
					// Passing 0 to setImageResource will clear the image view.
					badge = 0;
				}
				((ImageView) view.FindViewById (Resource.Id.badge)).SetImageResource (badge);
				
				String title = marker.Title;
				TextView titleUi = ((TextView) view.FindViewById (Resource.Id.title));
				if (title != null) {
					// Spannable string allows us to edit the formatting of the text.
					SpannableString titleText = new SpannableString (title);
					SpanTypes st = (SpanTypes) 0;
					// FIXME: this somehow rejects to compile
					//titleText.SetSpan (new ForegroundColorSpan(Color.Red), 0, titleText.Length, st);
					titleUi.TextFormatted = (titleText);
				} else {
					titleUi.Text = ("");
				}
				
				String snippet = marker.Snippet;
				TextView snippetUi = ((TextView) view.FindViewById(Resource.Id.snippet));
				if (snippet != null) {
					SpannableString snippetText = new SpannableString(snippet);
					snippetText.SetSpan(new ForegroundColorSpan(Color.Magenta), 0, 10, 0);
					snippetText.SetSpan(new ForegroundColorSpan(Color.Blue), 12, 21, 0);
					snippetUi.TextFormatted = (snippetText);
				} else {
					snippetUi.Text = ("");
				}
			}
开发者ID:89sos98,项目名称:monodroid-samples,代码行数:43,代码来源:MarkerDemoActivity.cs


示例17: OnCreateView

		public override View OnCreateView (LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState)
		{
			var pager = new ViewPager (inflater.Context) {
				Id = 0x34532,
				Adapter = new MonkeyPageAdapter (ChildFragmentManager),
			};
			pager.PageSelected += async (sender, e) => {
				var map = (SupportMapFragment)FragmentManager.FindFragmentById (Resource.Id.map);
				var monkeyName = ((MonkeyPageAdapter)pager.Adapter).GetMonkeyAtPosition (e.Position);
				var location = await WikipediaApi.FetchHabitatLocation (monkeyName);
				var latLng = new Android.Gms.Maps.Model.LatLng (location.Item1, location.Item2);
				map.Map.AnimateCamera (CameraUpdateFactory.NewLatLng (latLng), 250, null);
				if (existingMarker != null)
					existingMarker.Remove ();
				existingMarker = map.Map.AddMarker (new MarkerOptions ().SetPosition (latLng));
			};

			return pager;
		}
开发者ID:jamesmontemagno,项目名称:Xamarin.Android-AppCompat,代码行数:19,代码来源:ViewPagerFragment.cs


示例18: OnLocationChanged

        public void OnLocationChanged(Location location)
        {
            _currentLocation = location;
            coord = new LatLng(location.Latitude, location.Longitude);
            CameraUpdate update = CameraUpdateFactory.NewLatLngZoom(coord, 17);

            map.AnimateCamera(update);

            if (currentLocationMarker != null) {
                currentLocationMarker.Position = coord;
            }
            else {
                var markerOptions = new MarkerOptions()
                    .SetIcon(BitmapDescriptorFactory.DefaultMarker(BitmapDescriptorFactory.HueBlue))
                    .SetPosition(coord)
                    .SetTitle("Current Position")
                    .SetSnippet("You are here");
                currentLocationMarker = map.AddMarker(markerOptions);
            }
        }
开发者ID:Dev-Idres,项目名称:MyFriends,代码行数:20,代码来源:MainActivity.cs


示例19: OnMapClick

        private void OnMapClick(object sender, GoogleMap.MapClickEventArgs e)
        {
            var latlng = e.Point;
            // Create new destination marker.
            if (_destinationMarker == null)
            {
                var marker = new MarkerOptions();
                marker.SetPosition(latlng);
                marker.SetTitle("Do");
                marker.Draggable(true);
                marker.SetSnippet("Punkt docelowy");
                // TODO: Custom destination icon.

                _destinationMarker = _map.AddMarker(marker);
                _destinationMarker.ShowInfoWindow();
            }
            // Move existing marker.
            else
            {
                _destinationMarker.Position = latlng;
                _destinationMarker.ShowInfoWindow();
            }
        }
开发者ID:Lichwa,项目名称:JakDojadeXamarin,代码行数:23,代码来源:MyMapRenderer.cs


示例20: OnInfoWindowClick

 public void OnInfoWindowClick(Marker marker)
 {
     Toast.MakeText(BaseContext, "Click Info Window", ToastLength.Short).Show();
 }
开发者ID:vkheleli,项目名称:monodroid-samples-master,代码行数:4,代码来源:MarkerDemoActivity.cs



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C# Model.MarkerOptions类代码示例发布时间:2022-05-24
下一篇:
C# Model.LatLng类代码示例发布时间:2022-05-24
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap