本文整理汇总了C#中Geopoint类的典型用法代码示例。如果您正苦于以下问题:C# Geopoint类的具体用法?C# Geopoint怎么用?C# Geopoint使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
Geopoint类属于命名空间,在下文中一共展示了Geopoint类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C#代码示例。
示例1: OnLoaded
// TODO: test data
private async void OnLoaded(object sender, RoutedEventArgs e)
{
var locator=new Geolocator();
var geoposition = await locator.GetGeopositionAsync();
UserLocation = new Geopoint(new BasicGeoposition
{
Latitude = geoposition.Coordinate.Latitude,
Longitude = geoposition.Coordinate.Longitude
});
var file = await Package.Current.InstalledLocation.GetFileAsync(@"Assets\service-icon.png");
var geolocator = new Geolocator();
var myPosition = await geolocator.GetGeopositionAsync();
Recipients = new[]
{
new Recipient
{
Name = "Recipient",
Birthday = DateTime.Now.AddYears(-20),
Latitude = myPosition.Coordinate.Latitude,
Longitude = myPosition.Coordinate.Longitude,
Description = "I'm so depressed...",
IsActive = true,
MainPhoto = await ConvertionExtensions.ReadFile(file)
}
};
}
开发者ID:damonslu,项目名称:Charity,代码行数:27,代码来源:RecipientsMap.cs
示例2: GetNearMapItems
public async Task GetNearMapItems(Geopoint currentGeopoint)
{
if (_currentElements == null)
{
_currentElements = await _cicloStationService.GetCicloStationsAsync();
}
var result = _currentElements.Select(pre => new MapItem()
{
Id = pre.id,
Geopoint = new Geopoint(new BasicGeoposition()
{
Latitude = pre.location.Lat,
Longitude = pre.location.Lon
}),
ItemType = ItemType.EcobiciStation,
Name = pre.name
});
result = result
.OrderBy(pre => pre.Geopoint.CalculateDistance(currentGeopoint))
.Where(pre => pre.Geopoint.CalculateDistance(currentGeopoint) <= 1)
.Take(5);
GetNearMapItemsCompleted?.Invoke(this, new NearMapItemEventArgs(result));
}
开发者ID:Satur01,项目名称:MapaEcobici,代码行数:26,代码来源:MapItemsModel.cs
示例3: GetPositionFromAddressAsync
public async Task<MapLocation> GetPositionFromAddressAsync(string address)
{
var locator = new Geolocator();
locator.DesiredAccuracyInMeters = 50;
TimeSpan maxAge = new TimeSpan(0, 0, 1);
TimeSpan timeout = new TimeSpan(0, 0, 15);
// var position = await locator.GetGeopositionAsync();
var basicGeoposition = new BasicGeoposition();
var point = new Geopoint(basicGeoposition);
var mapLocationFinderResult = await MapLocationFinder.FindLocationsAsync(address, point, 2);
if (mapLocationFinderResult.Status == MapLocationFinderStatus.Success)
{
try
{
return mapLocationFinderResult.Locations[0];
}
catch (Exception e)
{
return null;
}
}
return default(MapLocation);
}
开发者ID:frederikdesmedt,项目名称:Windows-App,代码行数:29,代码来源:MapService.cs
示例4: showSpaceNeedleButton_Click
private async void showSpaceNeedleButton_Click(object sender, RoutedEventArgs e)
{
if (myMap.Is3DSupported)
{
this.myMap.Style = MapStyle.Aerial3DWithRoads;
BasicGeoposition spaceNeedlePosition = new BasicGeoposition();
spaceNeedlePosition.Latitude = 47.6204;
spaceNeedlePosition.Longitude = -122.3491;
Geopoint spaceNeedlePoint = new Geopoint(spaceNeedlePosition);
MapScene spaceNeedleScene = MapScene.CreateFromLocationAndRadius(spaceNeedlePoint,
400, /* show this many meters around */
135, /* looking at it to the south east*/
60 /* degrees pitch */);
await myMap.TrySetSceneAsync(spaceNeedleScene);
}
else
{
string status = "3D views are not supported on this device.";
rootPage.NotifyUser(status, NotifyType.ErrorMessage);
}
}
开发者ID:RasmusTG,项目名称:Windows-universal-samples,代码行数:27,代码来源:Scenario4.xaml.cs
示例5: getAddressBtn_Click
private async void getAddressBtn_Click(object sender, RoutedEventArgs e)
{
try
{
//Request permission to get location
//Pop up will occur if your app doesnot have permission to access location service of device
var accessStatus = await Geolocator.RequestAccessAsync();
switch (accessStatus)
{
case GeolocationAccessStatus.Allowed:
// The location to reverse geocode.
//For now i am getting my current location
Geolocator geolocator = new Geolocator { DesiredAccuracyInMeters = 50, DesiredAccuracy = PositionAccuracy.High }; //Set the desired accuracy that you want in meters
Geoposition pos = await geolocator.GetGeopositionAsync();
BasicGeoposition location = new BasicGeoposition();
location.Latitude = pos.Coordinate.Point.Position.Latitude;
location.Longitude = pos.Coordinate.Point.Position.Longitude;
Geopoint pointToReverseGeocode = new Geopoint(location);
// Reverse geocode the specified geographic location.
MapLocationFinderResult result =
await MapLocationFinder.FindLocationsAtAsync(pointToReverseGeocode);
// If the query returns results, display the name of the town
// contained in the address of the first result.
if (result.Status == MapLocationFinderStatus.Success)
{
continent.Text = result.Locations[0].Address.Continent;
countryName.Text = result.Locations[0].Address.Country;
countryCode.Text = result.Locations[0].Address.CountryCode;
region.Text = result.Locations[0].Address.Region;
town.Text = result.Locations[0].Address.Town;
street.Text = result.Locations[0].Address.Street;
}
else
{
await new MessageDialog("Something went wrong. Could not get finish current operation. Error: " + result.Status).ShowAsync();
}
break;
case GeolocationAccessStatus.Denied:
//Unable to get data
LoadPositionData(null);
break;
case GeolocationAccessStatus.Unspecified:
//Unable to get data
LoadPositionData(null);
break;
}
}
catch (Exception ex)
{
await new MessageDialog("Something went wrong. Could not get finish current operation.").ShowAsync();
}
}
开发者ID:janaks09,项目名称:Windows10-Samples,代码行数:60,代码来源:MainPage.xaml.cs
示例6: RequestImage
//string imagerySet = MapType.Aerial.ToString();
public async Task<WriteableBitmap> RequestImage(Geopoint point)
{
if (geo == null)
{
geo = new Geolocator();
}
Geoposition pos = await geo.GetGeopositionAsync();
//Geopoint point = pos.Coordinate.Point;
myMap.Center = new Location(point.Position.Latitude, point.Position.Longitude);
myMap.ZoomLevel = 2;
myMap.Width = 100;
this.myMap.Height = 100;
string url = String.Format("http://dev.virtualearth.net/REST/v1/Imagery/Map/{0}/{1},{2}/{3}" +
"?mapSize={4},{5}&key={6}",
//imagerySet,
this.myMap.Center.Latitude,
this.myMap.Center.Longitude,
Math.Floor(this.myMap.ZoomLevel),
this.myMap.Width,
this.myMap.Height,
apiKey);
var backgroundDownloader = new BackgroundDownloader();
var file = await ApplicationData.Current.TemporaryFolder.CreateFileAsync("tempmapimage.jpg",
CreationCollisionOption.ReplaceExisting);
var downloadOperation = backgroundDownloader.CreateDownload(new Uri(url), file);
await downloadOperation.StartAsync();
return await BitmapFactory.New(1, 1).FromStream(await file.OpenReadAsync(),
Windows.Graphics.Imaging.BitmapPixelFormat.Unknown);
}
开发者ID:rvrtex,项目名称:mJohnsonYouMaps,代码行数:36,代码来源:ImageDownloader.cs
示例7: button_Click
private async void button_Click(object sender, RoutedEventArgs e)
{
if (MapControl1.IsStreetsideSupported)
{
BasicGeoposition cityPosition = new BasicGeoposition() { Latitude = 48.858, Longitude = 2.295 };
Geopoint cityCenter = new Geopoint(cityPosition);
StreetsidePanorama panoramaNearCity = await StreetsidePanorama.FindNearbyAsync(cityCenter);
if (panoramaNearCity != null)
{
StreetsideExperience ssView = new StreetsideExperience(panoramaNearCity);
ssView.OverviewMapVisible = true;
MapControl1.CustomExperience = ssView;
}
}
else
{
ContentDialog viewNotSupportedDialog = new ContentDialog()
{
Title = "Streetside is not supported",
Content = "\nStreetside views are not supported on this device.",
PrimaryButtonText = "OK"
};
await viewNotSupportedDialog.ShowAsync();
}
}
开发者ID:myCodePixel,项目名称:blogsamples,代码行数:32,代码来源:MainPage.xaml.cs
示例8: button_Click
async private void button_Click(object sender, RoutedEventArgs e)
{
LocationProvider providerLocation = new LocationProvider();
var accessStatus = await Geolocator.RequestAccessAsync();
switch (accessStatus)
{
case GeolocationAccessStatus.Allowed:
// If DesiredAccuracy or DesiredAccuracyInMeters are not set (or value is 0), DesiredAccuracy.Default is used.
Geolocator geolocator = new Geolocator { DesiredAccuracyInMeters = 2000 };
// Carry out the operation.
Geoposition pos = await geolocator.GetGeopositionAsync();
Geopoint geo = new Geopoint(new BasicGeoposition { Latitude = pos.Coordinate.Point.Position.Latitude, Longitude = pos.Coordinate.Point.Position.Longitude });
providerLocation.AddLocation(geo, 1);
this.Frame.Navigate(typeof(Friends), pos);
break;
case GeolocationAccessStatus.Denied:
break;
case GeolocationAccessStatus.Unspecified:
break;
}
}
开发者ID:IgorGoncalves,项目名称:OurTripWinApp,代码行数:34,代码来源:LocationCapture.xaml.cs
示例9: GetRandomPoints
public static IEnumerable<PointList> GetRandomPoints(Geopoint point1, Geopoint point2, int nrOfPoints)
{
var result = new List<PointList>();
var p1 = new BasicGeoposition
{
Latitude = Math.Min(point1.Position.Latitude, point2.Position.Latitude),
Longitude = Math.Min(point1.Position.Longitude, point2.Position.Longitude)
};
var p2 = new BasicGeoposition
{
Latitude = Math.Max(point1.Position.Latitude, point2.Position.Latitude),
Longitude = Math.Max(point1.Position.Longitude, point2.Position.Longitude)
};
var dLat = p2.Latitude - p1.Latitude;
var dLon = p2.Longitude - p1.Longitude;
var r = new Random(DateTime.Now.Millisecond);
for (var i = 0; i < nrOfPoints; i++)
{
var item = new PointList { Name = "Point " + i };
item.Points.Add(new Geopoint(
new BasicGeoposition
{
Latitude = p1.Latitude + (r.NextDouble() * dLat),
Longitude = p1.Longitude + (r.NextDouble() * dLon)
}));
result.Add(item);
}
return result;
}
开发者ID:crua9,项目名称:Tech-Reviews-and-Help-Windows-app,代码行数:31,代码来源:PointList.cs
示例10: OnNavigatedTo
/// <summary>
/// Invoked when this page is about to be displayed in a Frame.
/// </summary>
/// <param name="e">Event data that describes how this page was reached.
/// This parameter is typically used to configure the page.</param>
protected async override void OnNavigatedTo(NavigationEventArgs e)
{
Geopoint myPoint;
if (e.Parameter == null)
{
//Add
isViewing = false;
var locator = new Geolocator();
locator.DesiredAccuracyInMeters = 50;
// MUST ENABLE THE LOCATION CAPABILITY!!
var position = await locator.GetGeopositionAsync();
myPoint = position.Coordinate.Point;
}
else
{
//View or Delete
isViewing = true;
lifeThread = (LifeThread)e.Parameter;
titleTextBox.Text = lifeThread.Title;
noteTextBox.Text = lifeThread.Thread;
addButton.Content = "Delete";
var myPosition = new Windows.Devices.Geolocation.BasicGeoposition();
myPosition.Latitude = lifeThread.Latitude;
myPosition.Longitude = lifeThread.Longitude;
myPoint = new Geopoint(myPosition);
}
await MyMap.TrySetViewAsync(myPoint, 16d);
}
开发者ID:tb594s,项目名称:LifeThreads,代码行数:40,代码来源:AddLifeThread.xaml.cs
示例11: Contains
public static bool Contains(List<Geopoint> polyPoints, Geopoint point)
{
bool inside = false;
Geopoint p1, p2;
//iterate each side of the polygon
Geopoint oldPoint = polyPoints[polyPoints.Count - 1];
foreach (Geopoint newPoint in polyPoints)
{
//order points so p1.lat <= p2.lat;
if (newPoint.Position.Latitude > oldPoint.Position.Latitude)
{
p1 = oldPoint;
p2 = newPoint;
}
else
{
p1 = newPoint;
p2 = oldPoint;
}
//test if the line is crossed and if so invert the inside flag.
if ((newPoint.Position.Latitude < point.Position.Latitude) == (point.Position.Latitude <= oldPoint.Position.Latitude)
&& (point.Position.Longitude - p1.Position.Longitude) * (p2.Position.Latitude - p1.Position.Latitude)
< (p2.Position.Longitude - p1.Position.Longitude) * (point.Position.Latitude - p1.Position.Latitude))
{
inside = !inside;
}
oldPoint = newPoint;
}
return inside;
}
开发者ID:ThePublicBikeGang,项目名称:EasyBike,代码行数:35,代码来源:MapExtensions.cs
示例12: MapView
public MapView()
{
mapControl = new MapControl();
mapControl.ZoomInteractionMode = MapInteractionMode.GestureAndControl;
mapControl.TiltInteractionMode = MapInteractionMode.GestureAndControl;
mapControl.MapServiceToken = "ift37edNFjWtwMkOrquL~7gzuj1f0EWpVbWWsBaVKtA~Amh-DIg5R0ZPETQo7V-k2m785NG8XugPBOh52EElcvxaioPYSYWXf96wL6E_0W1g";
// Specify a known location
BasicGeoposition cityPosition;
Geopoint cityCenter;
cityPosition = new BasicGeoposition() { Latitude = 2.4448143, Longitude = -76.6147395 };
cityCenter = new Geopoint(cityPosition);
// Set map location
mapControl.Center = cityCenter;
mapControl.ZoomLevel = 13.0f;
mapControl.LandmarksVisible = true;
AddIcons();
this.Children.Add(mapControl);
//this.Children.Add(_map);
}
开发者ID:simonbedoya,项目名称:PlansPop-W10,代码行数:27,代码来源:MapView.cs
示例13: addPinsToMap
public void addPinsToMap(MapControl mapControl, Action<MapPin> tappedCallback = null)
{
removePinsFromMap(mapControl);
m_mapPins = new List<MapPin>();
int i = 1;
DB_station prevStation = null;
foreach (List<DB_station> route in m_routes)
{
foreach(DB_station station in route)
{
if (station == prevStation || (station.latitude == 0f && station.longitude == 0f))
continue;
// Title for station.
string title = "Przystanek " + (i++) + "\n" + station.post_id + " " + station.post_name + "\n" + station.street;
// Add pin into map.
var location = new Geopoint(new BasicGeoposition()
{
Latitude = station.latitude,
Longitude = station.longitude
});
MapPin pin = new MapPin(title, station, MapPin.PinType.RegularPin, MapPin.PinSize.Small, tappedCallback);
pin.addToMap(mapControl, location);
m_mapPins.Add(pin);
prevStation = station;
}
}
}
开发者ID:Lichwa,项目名称:JakDojadeXamarin,代码行数:30,代码来源:MapRoute.cs
示例14: handleResults
private async void handleResults(PhotoCollection results, ObservableCollection<ThumbnailImage> List)
{
foreach (var res in results)
{
Geopoint point = null;
if (res.Longitude != 0 && res.Latitude != 0)
{
var position = new BasicGeoposition()
{
Latitude = res.Latitude,
Longitude = res.Longitude
};
point = new Geopoint(position);
}
else if (res.Tags.Contains("cars"))
{
var position = new BasicGeoposition()
{
Longitude = 13.416350,
Latitude = 52.526105
};
point = new Geopoint(position);
}
List.Add(new ThumbnailImage() { ImagePath = new Uri(res.ThumbnailUrl), ImageTitle = res.Title, BigImage = new Uri(res.LargeUrl), GeoLocation = point });
}
}
开发者ID:mmohareb,项目名称:SimpleFlickrClient,代码行数:26,代码来源:MainViewModel.cs
示例15: AddMapa
public AddMapa()
{
this.InitializeComponent();
rootFrame = Window.Current.Content as Frame;
SystemNavigationManager.GetForCurrentView().AppViewBackButtonVisibility
= AppViewBackButtonVisibility.Visible;
SystemNavigationManager.GetForCurrentView().BackRequested += AddMapa_BackRequested;
mapControl.ZoomInteractionMode = MapInteractionMode.GestureAndControl;
mapControl.TiltInteractionMode = MapInteractionMode.GestureAndControl;
mapControl.MapServiceToken = "ift37edNFjWtwMkOrquL~7gzuj1f0EWpVbWWsBaVKtA~Amh-DIg5R0ZPETQo7V-k2m785NG8XugPBOh52EElcvxaioPYSYWXf96wL6E_0W1g";
// Specify a known location
BasicGeoposition posicion = new BasicGeoposition() { Latitude = 2.4448143, Longitude = -76.6147395 };
Geopoint point = new Geopoint(posicion);
// Set map location
mapControl.Center = point;
mapControl.ZoomLevel = 13.0f;
mapControl.LandmarksVisible = true;
AddIcons();
//GridMapa.Children.Add(mapControl);
}
开发者ID:simonbedoya,项目名称:PlansPop-W10,代码行数:30,代码来源:AddMapa.xaml.cs
示例16: button1_Click
private async void button1_Click(object sender, RoutedEventArgs e)
{
if (MapControl1.Is3DSupported)
{
MapControl1.Style = MapStyle.Aerial3D;
BasicGeoposition hwGeoposition = new BasicGeoposition() { Latitude = 48.858, Longitude = 2.295 };
Geopoint hwPoint = new Geopoint(hwGeoposition);
MapScene hwScene = MapScene.CreateFromLocationAndRadius(hwPoint, 80, 0, 60);
await MapControl1.TrySetSceneAsync(hwScene, MapAnimationKind.Bow);
}
else
{
ContentDialog viewNotSupportedDialog = new ContentDialog()
{
Title = "3D is not supported",
Content = "\n3D views are not supported on this device.",
PrimaryButtonText = "OK"
};
await viewNotSupportedDialog.ShowAsync();
}
}
开发者ID:myCodePixel,项目名称:blogsamples,代码行数:27,代码来源:MainPage.xaml.cs
示例17: GetDistrictUsingLocation
public static async Task<String> GetDistrictUsingLocation(Geopoint point)
{
MapLocationFinderResult result = await MapLocationFinder.FindLocationsAtAsync(point);
MapLocation location = result.Locations[0] as MapLocation;
string district = location.Address.District;
return district;
}
开发者ID:yvanwang1992,项目名称:Indoor-Map-UWP,代码行数:7,代码来源:LocationManager.cs
示例18: MapsViewModel
public MapsViewModel(MapControl mapControl)
{
_mapControl = mapControl;
StopStreetViewCommand = new DelegateCommand(StopStreetView, () => IsStreetView);
StartStreetViewCommand = new DelegateCommand(StartStreetViewAsync, () => !IsStreetView);
if (!DesignMode.DesignModeEnabled)
{
_dispatcher = CoreWindow.GetForCurrentThread().Dispatcher;
}
_locator.StatusChanged += async (s, e) =>
{
await _dispatcher.RunAsync(CoreDispatcherPriority.Low, () =>
PositionStatus = e.Status
);
};
// intialize defaults at startup
CurrentPosition = new Geopoint(new BasicGeoposition { Latitude = 48.2, Longitude = 16.3 });
// { Latitude = 47.604, Longitude = -122.329 });
CurrentMapStyle = MapStyle.Road;
DesiredPitch = 0;
ZoomLevel = 12;
}
开发者ID:ProfessionalCSharp,项目名称:ProfessionalCSharp6,代码行数:25,代码来源:MapsViewModel.cs
示例19: CalculateRoute
public static async void CalculateRoute(MapControl mapControl,double startLatitude, double startLongitude, double endLatitude, double endLongitude)
{
BasicGeoposition startLocation = new BasicGeoposition();
startLocation.Latitude = startLatitude;
startLocation.Longitude = startLongitude;
Geopoint startPoint = new Geopoint(startLocation);
BasicGeoposition endLocation = new BasicGeoposition();
endLocation.Latitude = endLatitude;
endLocation.Longitude = endLongitude;
Geopoint endPoint = new Geopoint(endLocation);
MapRouteFinderResult routeResult = await MapRouteFinder.GetDrivingRouteAsync(
startPoint,
endPoint,
MapRouteOptimization.Time,
MapRouteRestrictions.None);
if (routeResult.Status == MapRouteFinderStatus.Success)
{
MapRouteView viewOfRoute = new MapRouteView(routeResult.Route);
viewOfRoute.RouteColor = Colors.Aqua;
viewOfRoute.OutlineColor = Colors.Black;
mapControl.Routes.Add(viewOfRoute);
await mapControl.TrySetViewBoundsAsync(
routeResult.Route.BoundingBox,
null,
Windows.UI.Xaml.Controls.Maps.MapAnimationKind.Bow);
var distance = routeResult.Route.LengthInMeters.ToString();
}
}
开发者ID:Wizjonersky,项目名称:TaxiCalculator,代码行数:35,代码来源:RouteCalculator.cs
示例20: ExecuteQuery
// http://msdn.microsoft.com/en-us/library/windows/apps/xaml/dn631249.aspx
public async Task<List<Portable.Model.GeocodeResult>> ExecuteQuery(string query)
{
throw new NotImplementedException("Not yet fully implemented, testing only");
try
{
// TODO: center for Austria (lat, lon), hint Austria in search string
BasicGeoposition queryHint = new BasicGeoposition();
queryHint.Latitude = 47.643;
queryHint.Longitude = -122.131;
Geopoint hintPoint = new Geopoint(queryHint);
MapLocationFinderResult result = await MapLocationFinder.FindLocationsAsync(query, hintPoint);
if (result.Status == MapLocationFinderStatus.Success)
{
return result.Locations.Select(l => new Portable.Model.GeocodeResult()
{
Latitude = l.Point.Position.Latitude,
Longitude = l.Point.Position.Longitude,
Name = l.DisplayName,
}).ToList();
}
}
catch (Exception ex)
{
Debug.WriteLine(ex.ToString());
}
return new List<GeocodeResult>();
}
开发者ID:christophwille,项目名称:Sprudelsuche,代码行数:32,代码来源:WpaGeocodeService.cs
注:本文中的Geopoint类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论