本文整理汇总了C#中Android.Gms.Maps.Model.MarkerOptions.SetSnippet方法的典型用法代码示例。如果您正苦于以下问题:C# MarkerOptions.SetSnippet方法的具体用法?C# MarkerOptions.SetSnippet怎么用?C# MarkerOptions.SetSnippet使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Android.Gms.Maps.Model.MarkerOptions
的用法示例。
在下文中一共展示了MarkerOptions.SetSnippet方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: 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);
}
}
示例2: 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);
}
}
示例3: 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;
}
}
示例4: 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));
}
示例5: 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);
}
示例6: 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;
}
示例7: OnElementPropertyChanged
protected override void OnElementPropertyChanged (object sender, PropertyChangedEventArgs e)
{
base.OnElementPropertyChanged (sender, e);
if (e.PropertyName.Equals ("VisibleRegion") && !isDrawn) {
map.Clear ();
foreach (var pin in customPins) {
var marker = new MarkerOptions ();
marker.SetPosition (new LatLng (pin.Pin.Position.Latitude, pin.Pin.Position.Longitude));
marker.SetTitle (pin.Pin.Label);
marker.SetSnippet (pin.Pin.Address);
marker.SetIcon (BitmapDescriptorFactory.FromResource (Resource.Drawable.pin));
map.AddMarker (marker);
}
isDrawn = true;
}
}
示例8: PlaceMarkersOnTheMap
public static void PlaceMarkersOnTheMap(List<Feature> data, GoogleMap map)
{
foreach (var feature in data)
{
MarkerOptions wc = new MarkerOptions ();
znajdzwc.Models.Geometry g = feature.geometry;
Properties p = feature.properties;
wc.SetPosition (new LatLng (g.coordinates [1], g.coordinates [0]));
wc.SetTitle (p.name);
wc.SetSnippet (p.comment);
if(p.isFree)
wc.SetIcon(BitmapDescriptorFactory.FromResource(Resource.Drawable.znajdz_wc_logo_free));
else
wc.SetIcon(BitmapDescriptorFactory.FromResource(Resource.Drawable.znajdz_wc_logo_free_money));
map.AddMarker (wc);
}
}
示例9: AddPin
private void AddPin(ExtendedPin formsPin)
{
var androidMapView = (MapView) Control;
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.FromResource(GetResourceIdByName(formsPin.PinIcon)));
}
else
markerWithIcon.InvokeIcon(BitmapDescriptorFactory.DefaultMarker());
androidMapView.Map.AddMarker(markerWithIcon);
}
示例10: CreateMarker
void CreateMarker()
{
var markerWithIcon = new MarkerOptions();
var id = UIFileUtils.GetResourceIdFromFilename("pin.png");
markerWithIcon.SetPosition(new LatLng(formsMap.MapPinLocation.Latitude, formsMap.MapPinLocation.Longitude));
markerWithIcon.SetTitle("A blue pin");
markerWithIcon.SetSnippet(string.Empty);
markerWithIcon.SetIcon(BitmapDescriptorFactory.FromResource(id));
map.MyLocationEnabled = formsMap.IsShowingUser;
map.SetIndoorEnabled(false);
try
{
map.AddMarker(markerWithIcon);
}
catch (NullPointerException ex)
{
System.Console.WriteLine("Exception : {0}--{1}", ex.Message, ex.InnerException);
}
isDrawnDone = true;
}
示例11: OnMapReady
public void OnMapReady(GoogleMap googleMap)
{
globMap = googleMap;
markerColor = new Dictionary<string, HamsterColor>();
foreach ( var a in ViewModel.Markers) {
var markerOpt = new MarkerOptions();
double la = double.Parse(a.HamsterLatitude, System.Globalization.CultureInfo.InvariantCulture);
double lon = double.Parse (a.HamsterLongitude, System.Globalization.CultureInfo.InvariantCulture);
latlng = new LatLng (la, lon);
markerOpt.SetPosition (latlng);
markerOpt.SetTitle (String.Format("Name: {0} {1} ", a.FirstName, a.LastName));
markerOpt.SetSnippet (String.Format("Latitude: {0} Longitude: {1} ", a.HamsterLatitude, a.HamsterLongitude));
globMap.AddMarker(markerOpt);
markerColor.Add(String.Format("{0}{1}",markerOpt.Title, markerOpt.Snippet), a.Color);
}
globMap.MyLocationEnabled = true;
globMap.UiSettings.CompassEnabled = true;
globMap.UiSettings.MapToolbarEnabled = false;
globMap.UiSettings.ZoomControlsEnabled = true;
globMap.UiSettings.MyLocationButtonEnabled = false;
globMap.SetInfoWindowAdapter (this);
}
示例12: GetMarkerOptionsForAssignment
MarkerOptions GetMarkerOptionsForAssignment (Assignment assignment)
{
var markerOptions = new MarkerOptions ();
markerOptions.SetPosition (new LatLng (assignment.Latitude, assignment.Longitude));
markerOptions.SetTitle (assignment.CompanyName);
markerOptions.SetSnippet (string.Format ("{0} {1}, {2} {3}",
assignment.Address, assignment.City, assignment.State, assignment.Zip));
return markerOptions;
}
示例13: DrawRunTrack
void DrawRunTrack(bool mapShouldFollow)
{
if (mRunLocations.Count < 1)
return;
// Set up overlay for the map with the current run's locations
// Create a polyline with all of the points
PolylineOptions line = new PolylineOptions();
// Create a LatLngBounds so you can zoom to fit
LatLngBounds.Builder latLngBuilder = new LatLngBounds.Builder();
// Add the locations of the current run
foreach (RunLocation loc in mRunLocations) {
LatLng latLng = new LatLng(loc.Latitude, loc.Longitude);
line.Add(latLng);
latLngBuilder.Include(latLng);
}
// Add the polyline to the map
mGoogleMap.AddPolyline(line);
// Add markers
LatLng startLatLng = new LatLng(mRunLocations[0].Latitude, mRunLocations[0].Longitude);
MarkerOptions startMarkerOptions = new MarkerOptions();
startMarkerOptions.SetPosition(startLatLng);
startMarkerOptions.SetTitle(Activity.GetString(Resource.String.run_start));
startMarkerOptions.SetSnippet(Activity.GetString(Resource.String.run_started_at_format, new Java.Lang.Object[]{new Java.Lang.String(mRunLocations[0].Time.ToLocalTime().ToLongTimeString())}));
mGoogleMap.AddMarker(startMarkerOptions);
var activeRun = mRunManager.GetActiveRun();
if (activeRun == null || (activeRun != null && CurrentRun.Id != activeRun.Id)) {
LatLng stopLatLng = new LatLng(mRunLocations[mRunLocations.Count-1].Latitude, mRunLocations[mRunLocations.Count-1].Longitude);
MarkerOptions stopMarkerOptions = new MarkerOptions();
stopMarkerOptions.SetPosition(stopLatLng);
stopMarkerOptions.SetTitle(Activity.GetString(Resource.String.run_finish));
stopMarkerOptions.SetSnippet(Activity.GetString(Resource.String.run_finished_at_format, new Java.Lang.Object[]{new Java.Lang.String(mRunLocations[mRunLocations.Count-1].Time.ToLocalTime().ToLongTimeString())}));
mGoogleMap.AddMarker(stopMarkerOptions);
}
// Make the map zoom to show the track, with some padding
// Use the size of the map linear layout in pixels as a bounding box
LatLngBounds latLngBounds = latLngBuilder.Build();
// Construct a movement instruction for the map
CameraUpdate movement = CameraUpdateFactory.NewLatLngBounds(latLngBounds, mMapWidth, mMapHeight, 50);
if (mMapShouldFollow) {
try {
mGoogleMap.MoveCamera(movement);
mMapShouldFollow = mapShouldFollow;
}
catch (Exception ex) {
Console.WriteLine("[{0}] No Layout yet {1}", TAG, ex.Message);
}
}
}
示例14: OnCreateView
public override View OnCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState)
{
var rootView = inflater.Inflate(Resource.Layout.fragment, null);
var containerMap = (FrameLayout) rootView.FindViewById(Resource.Id.container_map);
var mapView = base.OnCreateView(inflater, container, savedInstanceState);
containerMap.AddView(mapView,
new FrameLayout.LayoutParams(ViewGroup.LayoutParams.MatchParent, ViewGroup.LayoutParams.MatchParent));
var map = Map;
map.MoveCamera(CameraUpdateFactory.NewLatLngZoom(new LatLng(48.35, 31.16), 5.5f));
map.UiSettings.RotateGesturesEnabled = false;
map.SetOnMapClickListener(this);
map.SetOnMarkerClickListener(this);
map.Clear();
_spots.Clear();
var icon = BitmapDescriptorFactory.FromResource(Resource.Drawable.pin);
foreach (var spot in SpotsArray)
{
var mo = new MarkerOptions();
mo.SetPosition(spot.Position);
mo.SetIcon(icon);
mo.SetTitle(spot.Name);
mo.SetSnippet("foo");
var marker = map.AddMarker(mo);
_spots.Add(marker.Id, new AnnotationModel(marker, spot));
}
_infoWindowContainer = rootView.FindViewById(Resource.Id.container_popup);
// Subscribe to resize pop-up window
_infoWindowLayoutListener = new InfoWindowLayoutListener();
_infoWindowContainer.ViewTreeObserver.AddOnGlobalLayoutListener(_infoWindowLayoutListener);
OverlayLayoutParams = (AbsoluteLayout.LayoutParams) _infoWindowContainer.LayoutParameters;
textView = (TextView) _infoWindowContainer.FindViewById(Resource.Id.textview_title);
_button = (Button) _infoWindowContainer.FindViewById(Resource.Id.foo);
_button.SetOnClickListener(this);
return rootView;
}
示例15: AddPin
/// <summary>
/// Adds a marker to the map
/// </summary>
/// <param name="pin">The Forms Pin</param>
private async void AddPin(TKCustomMapPin pin)
{
var markerWithIcon = new MarkerOptions();
markerWithIcon.SetPosition(new LatLng(pin.Position.Latitude, pin.Position.Longitude));
if (!string.IsNullOrWhiteSpace(pin.Title))
markerWithIcon.SetTitle(pin.Title);
if (!string.IsNullOrWhiteSpace(pin.Subtitle))
markerWithIcon.SetSnippet(pin.Subtitle);
await this.UpdateImage(pin, markerWithIcon);
markerWithIcon.Draggable(pin.IsDraggable);
markerWithIcon.Visible(pin.IsVisible);
this._markers.Add(pin, this._googleMap.AddMarker(markerWithIcon));
}