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


C# Model.Marker类代码示例

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


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


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