本文整理汇总了C#中OsmSharp.Math.Geo.GeoCoordinate.ToString方法的典型用法代码示例。如果您正苦于以下问题:C# GeoCoordinate.ToString方法的具体用法?C# GeoCoordinate.ToString怎么用?C# GeoCoordinate.ToString使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类OsmSharp.Math.Geo.GeoCoordinate
的用法示例。
在下文中一共展示了GeoCoordinate.ToString方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: DoTestSimple
/// <summary>
/// Tests adding some simple data.
/// </summary>
protected void DoTestSimple()
{
// create the index.
ILocatedObjectIndex<GeoCoordinate, LocatedObjectData> index = this.CreateIndex();
// add the data.
GeoCoordinate point1 = new GeoCoordinate(0, 0);
LocatedObjectData point1_data = new LocatedObjectData()
{
SomeData = point1.ToString()
};
GeoCoordinate point2 = new GeoCoordinate(1, 1);
LocatedObjectData point2_data = new LocatedObjectData()
{
SomeData = point2.ToString()
};
GeoCoordinateBox location_box = new GeoCoordinateBox(
new GeoCoordinate(point1.Latitude - 0.0001, point1.Longitude - 0.0001),
new GeoCoordinate(point1.Latitude + 0.0001, point1.Longitude + 0.0001));
// try and get data from empty index.
// regression test for issue: https://osmsharp.codeplex.com/workitem/1244
IEnumerable<LocatedObjectData> location_box_data = index.GetInside(location_box);
Assert.IsNotNull(location_box_data);
Assert.AreEqual(0, location_box_data.Count());
// try point1.
index.Add(point1, point1_data);
location_box_data = index.GetInside(
location_box);
Assert.IsNotNull(location_box_data);
bool found = false;
foreach (LocatedObjectData location_data in location_box_data)
{
if (location_data.SomeData == point1.ToString())
{
found = true;
}
}
Assert.IsTrue(found, string.Format("Data added at location {0} not found in box {1}!",
point1, location_box));
// try point2.
index.Add(point2, point2_data);
location_box = new GeoCoordinateBox(
new GeoCoordinate(point2.Latitude - 0.0001, point2.Longitude - 0.0001),
new GeoCoordinate(point2.Latitude + 0.0001, point2.Longitude + 0.0001));
location_box_data = index.GetInside(
location_box);
Assert.IsNotNull(location_box_data);
found = false;
foreach (LocatedObjectData location_data in location_box_data)
{
if (location_data.SomeData == point2.ToString())
{
found = true;
}
}
Assert.IsTrue(found, string.Format("Data added at location {0} not found in box {1}!",
point2, location_box));
}
示例2: Start
/// <summary>
/// Starts an animation to the given parameters.
/// </summary>
/// <param name="center"></param>
/// <param name="zoomLevel"></param>
/// <param name="mapTilt"></param>
/// <param name="time"></param>
public void Start(GeoCoordinate center, float zoomLevel, Degree mapTilt, TimeSpan time)
{
lock (this)
{
// stop the previous timer.
if (_timer != null)
{ // timer exists.
_timer.Dispose();
_timer = null;
}
// set the targets.
_targetCenter = center;
_targetTilt = mapTilt;
_targetZoom = zoomLevel;
// calculate the animation steps.
_maxSteps = (int)System.Math.Round((double)time.TotalMilliseconds / (double)_minimumTimeSpan.TotalMilliseconds, 0);
_currentStep = 0;
_stepCenter = new GeoCoordinate(
(_targetCenter.Latitude - _mapView.MapCenter.Latitude) / _maxSteps,
(_targetCenter.Longitude - _mapView.MapCenter.Longitude) / _maxSteps);
_stepZoom = (float)((_targetZoom - _mapView.MapZoom) / _maxSteps);
// calculate the map tilt, make sure it turns along the smallest corner.
double diff = _targetTilt.Subtract180(_mapView.MapTilt);
OsmSharp.Logging.Log.TraceEvent ("MapViewAnimator", OsmSharp.Logging.TraceEventType.Information, diff.ToString());
_stepTilt = (diff / _maxSteps);
OsmSharp.Logging.Log.TraceEvent("MapViewAnimator", OsmSharp.Logging.TraceEventType.Verbose,
string.Format("Started new animation with steps z:{0} t:{1} c:{2} to z:{3} t:{4} c:{5} from z:{6} t:{7} c:{8}.",
_stepZoom, _stepTilt, _stepCenter.ToString(),
_targetZoom, _targetTilt, _targetCenter.ToString(),
_mapView.MapZoom, _mapView.MapTilt, _mapView.MapCenter.ToString()));
// disable auto invalidate.
//_mapView.AutoInvalidate = false;
_mapView.RegisterAnimator (this);
// start the timer.
_timer = new Timer(new TimerCallback(_timer_Elapsed), null, 0, (int)_minimumTimeSpan.TotalMilliseconds);
}
}