本文整理汇总了C#中CLLocation.Dispose方法的典型用法代码示例。如果您正苦于以下问题:C# CLLocation.Dispose方法的具体用法?C# CLLocation.Dispose怎么用?C# CLLocation.Dispose使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CLLocation
的用法示例。
在下文中一共展示了CLLocation.Dispose方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: getAllBusStops
//Caution: If radius is too large results will be HUGE!
//radius in meters
public IEnumerable<BusStop> getAllBusStops(CLLocation aboutLoc, double radius)
{
List<BusStop> stops = new List<BusStop>(30);
using (LumenWorks.Framework.IO.Csv.CsvReader csv = new LumenWorks.Framework.IO.Csv.CsvReader(getReader("stops.txt"),true)) {
while (csv.ReadNextRecord()){
CLLocation loc = new CLLocation(double.Parse(csv["stop_lat"]), double.Parse(csv["stop_lon"]));
if (loc.DistanceFrom(aboutLoc)<=radius)
stops.Add(new BusStop(csv["stop_name"],int.Parse(csv["stop_id"]), loc));
loc.Dispose();
}
return stops;
}
}
示例2: getClosestStop
public BusStop? getClosestStop(CLLocation aboutLoc)
{
int closestId = -1;
double closestDist=double.MaxValue;
using (CsvReader csv = new CsvReader(getReader("stops.txt"),true)) {
while (csv.ReadNextRecord()){
CLLocation loc = new CLLocation(double.Parse(csv["stop_lat"]), double.Parse(csv["stop_lon"]));
if (loc.DistanceFrom(aboutLoc)<=closestDist)
closestId=int.Parse(csv["stop_id"]);
loc.Dispose();
}
}
return (closestId==-1)?null:getStopInfo(closestId);
}
示例3: UpdatePosition
private void UpdatePosition(CLLocation location)
{
Position p = (this.position == null) ? new Position() : new Position(this.position);
if (location.HorizontalAccuracy > -1)
{
p.Accuracy = location.HorizontalAccuracy;
p.Latitude = location.Coordinate.Latitude;
p.Longitude = location.Coordinate.Longitude;
}
if (location.VerticalAccuracy > -1)
{
p.Altitude = location.Altitude;
p.AltitudeAccuracy = location.VerticalAccuracy;
}
if (location.Speed > -1)
p.Speed = location.Speed;
//p.Timestamp = new DateTimeOffset(location.Timestamp);
this.position = p;
OnPositionChanged(new PositionEventArgs(p));
location.Dispose();
}