本文整理汇总了C#中Android.Gms.Maps.Model.MarkerOptions类的典型用法代码示例。如果您正苦于以下问题:C# MarkerOptions类的具体用法?C# MarkerOptions怎么用?C# MarkerOptions使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
MarkerOptions类属于Android.Gms.Maps.Model命名空间,在下文中一共展示了MarkerOptions类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C#代码示例。
示例1: setAdress
private async void setAdress(MarkerOptions pinMarker, GoogleMap.MapClickEventArgs e)
{
string adress = "";
// Obtengo la posible dirección a partir de la latitud y longitud
Geocoder geocoder = new Geocoder();
IEnumerable<string> possibleAdresses = await geocoder.GetAddressesForPositionAsync(new Position(e.Point.Latitude, e.Point.Longitude));
adress = possibleAdresses.ElementAt(0);
pinMarker.SetTitle(adress);
// Añado el pin al mapa
_map.AddMarker(pinMarker).ShowInfoWindow();
// Comparto el punto en App
var myApp = App.Current as App;
myApp.meetingPoint = new MeetingPoint
{
Name = adress,
Place = new Position(e.Point.Latitude, e.Point.Longitude)
};
}
开发者ID:HeikkiDev,项目名称:Mapas_XamarinForms,代码行数:21,代码来源:MyMapRenderer.cs
示例2: OnElementPropertyChanged
protected override void OnElementPropertyChanged(object sender, System.ComponentModel.PropertyChangedEventArgs e)
{
base.OnElementPropertyChanged (sender, e);
var androidMapView = (MapView)Control;
var formsMap = (CustomMap)sender;
if (e.PropertyName.Equals ("VisibleRegion") && !_isDrawnDone) {
androidMapView.Map.Clear ();
androidMapView.Map.MarkerClick += HandleMarkerClick;
androidMapView.Map.MyLocationEnabled = formsMap.IsShowingUser;
var formsPins = formsMap.CustomPins;
foreach (var formsPin in formsPins) {
var markerWithIcon = new MarkerOptions ();
markerWithIcon.SetPosition (new LatLng (formsPin.Position.Latitude, formsPin.Position.Longitude));
markerWithIcon.SetTitle (formsPin.Label);
markerWithIcon.SetSnippet (formsPin.Address);
if (!string.IsNullOrEmpty (formsPin.PinIcon))
markerWithIcon.InvokeIcon (BitmapDescriptorFactory.FromAsset (String.Format ("{0}.png", formsPin.PinIcon)));
else
markerWithIcon.InvokeIcon (BitmapDescriptorFactory.DefaultMarker ());
androidMapView.Map.AddMarker (markerWithIcon);
}
_isDrawnDone = true;
}
}
开发者ID:vmoll,项目名称:ShouldIWashMyCar,代码行数:33,代码来源:MapViewRenderer.cs
示例3: 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
示例4: OnCreate
protected override void OnCreate(Bundle bundle)
{
base.OnCreate(bundle);
SetContentView(Resource.Layout.SecondView);
var viewModel = (SecondViewModel) ViewModel;
var mapFragment = (SupportMapFragment)SupportFragmentManager.FindFragmentById(Resource.Id.map);
var options = new MarkerOptions();
options.SetPosition(new LatLng(viewModel.Han.Location.Lat, viewModel.Han.Location.Lng));
options.SetTitle("Han");
options.Draggable(true);
var hanMarker = mapFragment.Map.AddMarker(options);
_han = new MarkerWrapper(hanMarker);
mapFragment.Map.MarkerDragEnd += (sender, args) =>
{
_han.FirePositionChangedFromMap();
};
var set = this.CreateBindingSet<SecondView, SecondViewModel>();
set.Bind(_han)
.For(m => m.Position)
.To(vm => vm.Han.Location)
.WithConversion(new LocationToLatLngValueConverter(), null);
set.Apply();
}
开发者ID:KiranKumarAlugonda,项目名称:NPlus1DaysOfMvvmCross,代码行数:30,代码来源:SecondView.cs
示例5: MapRoute
public MapRoute(GoogleMap map, List<Station> stations)
{
_map = map;
_mapRoutes = new List<Polyline>();
_mapStations = new List<Marker>();
// Choose color;
Color color = Color.DodgerBlue;
// Create polyline.
var polyline = new PolylineOptions();
polyline.InvokeWidth(4f);
polyline.InvokeColor(color);
for (var i = 0; i < stations.Count; i++)
{
// Add points to polyline.
var station = stations[i];
if (station != null && station.latitude != 0f && station.longitude != 0f)
{
var latlng = new Android.Gms.Maps.Model.LatLng(station.latitude, station.longitude);
polyline.Add(latlng);
// Create marker.
var marker = new MarkerOptions();
marker.SetPosition(latlng);
marker.SetTitle((i + 1) + ". " + station.postName);
marker.Draggable(false);
marker.SetSnippet("ul. " + station.street);
_mapStations.Add(_map.AddMarker(marker));
}
}
// Add polyline to map.
_mapRoutes.Add(_map.AddPolyline(polyline));
}
开发者ID:Lichwa,项目名称:JakDojadeXamarin,代码行数:35,代码来源:MapRoute.cs
示例6: updateEpins
private void updateEpins()
{
var androidMapView = (MapView)Control;
var formsMap = (Xam.Plugin.MapExtend.Abstractions.MapExtend)Element;
androidMapView.Map.Clear();
androidMapView.Map.MarkerClick += HandleMarkerClick;
androidMapView.Map.MyLocationEnabled = formsMap.IsShowingUser;
var items = formsMap.EPins;
foreach (var item in items)
{
var markerWithIcon = new MarkerOptions();
markerWithIcon.SetPosition(new LatLng(item.Location.Latitude, item.Location.Longitude));
markerWithIcon.SetTitle(string.IsNullOrWhiteSpace(item.Name) ? "-" : item.Name);
markerWithIcon.SetSnippet(item.Details);
try
{
markerWithIcon.InvokeIcon(BitmapDescriptorFactory.FromResource(Resources.GetIdentifier(item.ResourceNameImg, "drawable", Context.PackageName)));
}
catch (Exception)
{
markerWithIcon.InvokeIcon(BitmapDescriptorFactory.DefaultMarker());
}
androidMapView.Map.AddMarker(markerWithIcon);
}
}
开发者ID:whosol,项目名称:mapextend-plugin,代码行数:32,代码来源:MapExtendRenderer.cs
示例7: MapRenderer2Android
public MapRenderer2Android()
: base()
{
WireUpMap();
MessagingCenter.Subscribe<IEnumerable<HeritageProperty>>(this, MapRenderer2.MESSAGE_ADD_AND_ZOOM_ON_PINS, async (items) =>
{
// wait for map
await WaitForMap();
// loop all the properties and add them as markers
foreach (var item in items)
{
// create the marker
var m = new MarkerOptions();
m.SetPosition(new LatLng(item.Latitude, item.Longitude));
m.SetTitle(item.Name);
// add to map
this.NativeMap.AddMarker(m);
}
// zoom in on the pins
ZoomAndCenterMap(items);
});
MessagingCenter.Subscribe<IEnumerable<HeritageProperty>>(this, MapRenderer2.MESSAGE_ZOOM_ON_PINS, (items) =>
{
// zoom in on the pins
ZoomAndCenterMap(items);
});
}
开发者ID:RhysPartlett,项目名称:oakville-heritage-properties,代码行数:32,代码来源:MapRenderer2Android.cs
示例8: adddatatomap
// Function to add data fields passed on from Main Activity (Latitude, Longitude, Address - then adds a tag to marker utilising the address field if there's any)
public void adddatatomap()
{
MarkerOptions opt = new MarkerOptions();
double lat = Convert.ToDouble(Intent.GetStringExtra("Latitude"));
double lng = Convert.ToDouble(Intent.GetStringExtra("Longitude"));
string address = Intent.GetStringExtra("Address");
LatLng location = new LatLng(lat, lng);
opt.SetPosition(location);
opt.SetTitle(address);
map.AddMarker(opt); // Adds a marker to map based on the address that was past on from our Main Activity
// Positioning the camera to show the marker based on fields parameter as set below
CameraPosition.Builder builder = CameraPosition.InvokeBuilder();
builder.Target(location);
builder.Zoom(15);
builder.Bearing(90);
builder.Tilt(65);
CameraPosition cameraPosition = builder.Build();
CameraUpdate cameraUpdate = CameraUpdateFactory.NewCameraPosition(cameraPosition);
map.MoveCamera(cameraUpdate);
// Marker window clicked event
map.InfoWindowClick += map_InfoWindowClick;
// Marker dragged event
map.MarkerDragEnd += map_MarkerDragEnd;
}
开发者ID:TigerIke,项目名称:WIC-PROJECT,代码行数:30,代码来源:MapActivity.cs
示例9: UpdatePins
private void UpdatePins()
{
var androidMapView = (MapView)Control;
var formsMap = (ExtendedMap)Element;
androidMapView.Map.Clear ();
androidMapView.Map.MarkerClick += HandleMarkerClick;
androidMapView.Map.MyLocationEnabled = formsMap.IsShowingUser;
var items = formsMap.Items;
foreach (var item in items) {
var markerWithIcon = new MarkerOptions ();
markerWithIcon.SetPosition (new LatLng (item.Location.Latitude, item.Location.Longitude));
markerWithIcon.SetTitle (string.IsNullOrWhiteSpace(item.Name) ? "-" : item.Name);
markerWithIcon.SetSnippet (item.Details);
try
{
markerWithIcon.InvokeIcon(BitmapDescriptorFactory.FromResource(GetPinIcon()));
}
catch (Exception)
{
markerWithIcon.InvokeIcon(BitmapDescriptorFactory.DefaultMarker());
}
androidMapView.Map.AddMarker (markerWithIcon);
}
}
开发者ID:raechten,项目名称:BindableMapTest,代码行数:30,代码来源:ExtendedMapRenderer.cs
示例10: OnResume
protected override void OnResume ()
{
base.OnResume ();
// Get a handle on the map element
_mapFragment = FragmentManager.FindFragmentById(Resource.Id.map) as MapFragment;
_map = _mapFragment.Map;
// Set the map type
_map.MapType = GoogleMap.MapTypeNormal;
// show user location
_map.MyLocationEnabled = true;
// setup a location manager
_locationManager = GetSystemService(Context.LocationService) as LocationManager;
// Add points on the map
MarkerOptions marker1 = new MarkerOptions()
.SetPosition(Location_Xamarin)
.SetTitle("Xamarin")
.InvokeIcon(BitmapDescriptorFactory.DefaultMarker(BitmapDescriptorFactory.HueBlue));
_map.AddMarker(marker1);
MarkerOptions marker2 = new MarkerOptions()
.SetPosition(Location_Atlanta)
.SetTitle("Atlanta, GA")
.InvokeIcon(BitmapDescriptorFactory.DefaultMarker(BitmapDescriptorFactory.HueRed));
_map.AddMarker(marker2);
// Add custom marker images on the map
AddMonkeyMarkersToMap();
// Add custom arrow callout on map
AddInitialNewYorkBarToMap();
// Add custom overlay image on the map
PositionChicagoGroundOverlay(Location_Chicago);
// use a generic location provider instead
Criteria locationCriteria = new Criteria();
locationCriteria.Accuracy = Accuracy.Coarse;
locationCriteria.PowerRequirement = Power.Medium;
var locationProvider = _locationManager.GetBestProvider(locationCriteria, true);
if (locationProvider != null)
{
_locationManager.RequestLocationUpdates(locationProvider, 2000, 1, this);
} else
{
Log.Info("error", "Best provider is not available. Does the device have location services enabled?");
}
// TODO: Step 4a - attach map handler for marker touch
// _map.MarkerClick += MapOnMarkerClick;
// TODO: Step 4c - attach map handler for info window touch
// _map.InfoWindowClick += HandleInfoWindowClick;
}
开发者ID:flolovebit,项目名称:xamarin-evolve-2014,代码行数:59,代码来源:MainActivity.cs
示例11: addEvent
private void addEvent(net.cloudapp.geteventinfo.Eventas event1)
{
MarkerOptions marker = new MarkerOptions();
marker.SetPosition(new LatLng(event1.latitude, event1.longitude));
marker.SetTitle(event1.eventname);
marker.SetSnippet(event1.description);
marker.SetIcon(BitmapDescriptorFactory.FromAsset("f.png"));
gMap.AddMarker(marker);
}
开发者ID:RimvydasJ,项目名称:Application,代码行数:9,代码来源:GoogleMaps.cs
示例12: EntityMarker
public EntityMarker(BankEntity entity, IconType iconType)
{
this.Entity = entity;
this.MarkerOptions = new MarkerOptions ();
this.MarkerOptions.SetTitle (entity.Description());
this.MarkerOptions.SetPosition (new LatLng(entity.Latitude, entity.Longitude));
this.Type = MarkerType.Regular;
IconType = iconType;
}
开发者ID:priyaaank,项目名称:XamarinMapsPoc,代码行数:9,代码来源:EntityMarker.cs
示例13: InitMarkers
public void InitMarkers()
{
foreach (var element in ListMarkers) {
MarkerOptions markerOptions = new MarkerOptions ();
markerOptions.SetPosition (new LatLng (element.Coordinate.Latitude, element.Coordinate.Longitude));
markerOptions.SetIcon(BitmapDescriptorFactory.DefaultMarker ());
var marker = this.map.AddMarker (markerOptions);
this.listMarkers.Add (marker);
}
}
开发者ID:rubixware,项目名称:blist-mobile,代码行数:10,代码来源:MapActivity.cs
示例14: 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
示例15: FindCar
public static List<MarkerOptions> FindCar()
{
List<MarkerOptions> markers = new List<MarkerOptions>();
locationsFile = System.Environment.GetFolderPath(System.Environment.SpecialFolder.Personal);
locationsFile = Path.Combine(locationsFile, "locations.txt");
IEnumerable<string> lines;
if (File.Exists (locationsFile)) {
lines = File.ReadLines (locationsFile);
} else {
return new List<MarkerOptions> ();
}
List<LocationRecord> records = new List<LocationRecord>();
foreach (string line in lines ){
LocationRecord record = JsonConvert.DeserializeObject<LocationRecord> (line);
records.Add(record);
}
IEnumerable<string> speed = from record in records
select record.calculatedSpeed > speedLimit ? "fast": "slow";
string[] speeds = speed.ToArray();
int i = 0;
for(i=0; i<speeds.Count(); i++) {
if (i > 0)
{
if (speeds[i] != speeds[i - 1] && speeds[i] == "slow")
{
int fasts = CountFasts(speeds, i);
int slows = CountSlows(speeds, i);
long fastTime = records[i].unixTime - records[i-fasts].unixTime;
long slowTime = -( records[i].unixTime - records[i+slows].unixTime );
if (fastTime > millisBefore && slowTime > millisAfter && (DateTime.Now - records[i].time).TotalDays < 3)
{
MarkerOptions options = new MarkerOptions ();
options.SetPosition (new LatLng (records[i].latitude, records[i].longitude));
options.SetTitle (records[i].time.ToShortTimeString ());
options.SetSnippet (!double.IsNaN(records[i].recordedSpeed)?"Speed: " + String.Format ("{0:0.00}", records[i].recordedSpeed*3.6) + " km/h":"Speed: " + String.Format ("{0:0.00}", records[i].calculatedSpeed*3.6) + " km/h");
markers.Add(options);
}
}
}
}
return markers;
}
开发者ID:MatejVukosav,项目名称:GdjeMiJeAuto,代码行数:53,代码来源:FinderAlgorithm.cs
示例16: 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
示例17: AddMonkeyMarkersToMap
/// <summary>
/// Add three markers to the map.
/// </summary>
private void AddMonkeyMarkersToMap()
{
for (int i = 0; i < LocationForCustomIconMarkers.Length; i++)
{
BitmapDescriptor icon = BitmapDescriptorFactory.FromResource(Resource.Drawable.monkey);
MarkerOptions mapOption = new MarkerOptions()
.SetPosition(LocationForCustomIconMarkers[i])
.InvokeIcon(icon)
.SetSnippet(String.Format("This is marker #{0}.", i))
.SetTitle(String.Format("Marker {0}", i));
_map.AddMarker(mapOption);
}
}
开发者ID:DiLRandI,项目名称:Xamarin.android,代码行数:16,代码来源:MapWithMarkersActivity.cs
示例18: OnMapReady
public void OnMapReady(GoogleMap googleMap)
{
mMap = googleMap;
LatLng latlng = new LatLng(loc.Latitude, loc.Longitude); //Wijnhaven
CameraUpdate camera = CameraUpdateFactory.NewLatLngZoom(latlng, 15);
mMap.MoveCamera(camera);
MarkerOptions start = new MarkerOptions()
.SetPosition(latlng)
.SetTitle("Uw huidige locatie")
.SetSnippet("U bevind zich hier")
.SetIcon(BitmapDescriptorFactory.DefaultMarker(BitmapDescriptorFactory.HueBlue));
mMap.AddMarker(start);
MarkerFactory mFactory = new MarkerFactory(preLoad.csvFT.getMarkers());
float lowest = 99999;
for (Iterator iter = mFactory.getIterator(); iter.hasNext();)
{
FietsTrommel ft = iter.next();
if (ft.xcoord.Length > 0 && ft.ycoord.Length > 0)
{
double lat = Convert.ToDouble(ft.xcoord.Replace('.', ','));
double lon = Convert.ToDouble(ft.ycoord.Replace('.', ','));
Location fietsT = new Location("");
fietsT.Latitude = lat;
fietsT.Longitude = lon;
if (fietsT.DistanceTo(loc) < 500)
{
LatLng coords = new LatLng(lat, lon);
MarkerOptions newMarker = new MarkerOptions()
.SetPosition(coords)
.SetTitle(ft.Straat)
.SetSnippet("Sinds: " + ft.Mutdatum)
.Draggable(true);
mMap.AddMarker(newMarker);
}
if (fietsT.DistanceTo(loc) < lowest)
{
lowest = fietsT.DistanceTo(loc);
closest = ft;
}
}
}
Location closestF = new Location("");
double closLat = Convert.ToDouble(closest.xcoord.Replace('.', ','));
double closLon = Convert.ToDouble(closest.ycoord.Replace('.', ','));
closestF.Latitude = closLat;
closestF.Longitude = closLon;
}
开发者ID:Reinierr,项目名称:Project4,代码行数:50,代码来源:gmaps.cs
示例19: OnMapReady
public void OnMapReady (GoogleMap googleMap)
{
gMap = googleMap;
SetUpMapAllEvents ();
gMap.MapLongClick += (object sender, GoogleMap.MapLongClickEventArgs e) => {
MarkerOptions marker = new MarkerOptions();
marker.SetPosition(new LatLng(e.Point.Latitude, e.Point.Longitude));
marker.SetTitle("Kasis");
marker.SetIcon(BitmapDescriptorFactory.DefaultMarker (BitmapDescriptorFactory.HueCyan));
gMap.AddMarker(marker);
};
}
开发者ID:RimvydasJ,项目名称:Application,代码行数:14,代码来源:GoogleMaps.cs
示例20: OnElementChanged
protected override void OnElementChanged(Xamarin.Forms.Platform.Android.ElementChangedEventArgs<Xamarin.Forms.View> e)
{
base.OnElementChanged(e);
extendedMap = (ExtendedMap)Element;
mapView = Control as MapView;
map = mapView.Map;
map.MarkerClick+= HandleMarkerClick;
// Pin tıklanınca sağalta açılan menüyü engellemek için
map.UiSettings.MapToolbarEnabled = true;
map.UiSettings.MyLocationButtonEnabled = true;
if (extendedMap.isOverlayNeeded) {
LatLng southwest = new LatLng (extendedMap.sw.Latitude, extendedMap.sw.Longitude);
LatLng northeast = new LatLng (extendedMap.ne.Latitude, extendedMap.ne.Longitude);
LatLngBounds bounds = new LatLngBounds (southwest, northeast);
string url = extendedMap.overlayURL;//"http://www.mgm.gov.tr/mobile/mblhrt/data/radar/MAX--_6100_P00.png";
Bitmap objBitmap = GetImageBitmapFromUrl (url);
BitmapDescriptor objBitmapDescriptor = BitmapDescriptorFactory.FromBitmap (objBitmap);
GroundOverlayOptions objGroundOverlayOptions = new GroundOverlayOptions ().PositionFromBounds (bounds)/*.Position (objMapPosition, 100000)*/.InvokeImage (objBitmapDescriptor);
map.AddGroundOverlay (objGroundOverlayOptions);
//For freeing memory
objBitmap.Recycle ();
}
for (int i = 0; i < extendedMap.pinDatas.Count; i++) {
var markerWithIcon = new MarkerOptions ();
markerWithIcon.SetPosition (new LatLng (extendedMap.pinDatas[i].lat, extendedMap.pinDatas[i].lng));
markerWithIcon.SetTitle (i.ToString());
/*markerWithIcon.SetTitle ("aa");
markerWithIcon.SetSnippet ("bb");*/
int resID = Resources.GetIdentifier (extendedMap.pinDatas [i].icon, "drawable" , "com.app1001.bluemart");
//System.Diagnostics.Debug.WriteLine (resID);
markerWithIcon.SetIcon(BitmapDescriptorFactory.FromResource(resID));
map.AddMarker (markerWithIcon);
}
//Add Pins
//map.SetInfoWindowAdapter(this);
map.UiSettings.RotateGesturesEnabled = false;
}
开发者ID:jiletx,项目名称:Bluemart,代码行数:50,代码来源:ExtendedMapRenderer.cs
注:本文中的Android.Gms.Maps.Model.MarkerOptions类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论