本文整理汇总了C#中OsmSharp.ToString方法的典型用法代码示例。如果您正苦于以下问题:C# OsmSharp.ToString方法的具体用法?C# OsmSharp.ToString怎么用?C# OsmSharp.ToString使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类OsmSharp
的用法示例。
在下文中一共展示了OsmSharp.ToString方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: GenerateImmidiateTurn
/// <summary>
/// Generates an immidiate turn.
/// </summary>
/// <param name="instruction"></param>
/// <param name="firstStreetCountTo"></param>
/// <param name="firstStreetTo"></param>
/// <param name="firstDirection"></param>
/// <param name="secondStreetTo"></param>
/// <param name="secondDirection"></param>
/// <returns></returns>
public Instruction GenerateImmidiateTurn(Instruction instruction,
int firstStreetCountTo,
List<KeyValuePair<string, string>> firstStreetTo,
OsmSharp.Tools.Math.Geo.Meta.RelativeDirection firstDirection,
List<KeyValuePair<string, string>> secondStreetTo,
RelativeDirection secondDirection)
{
instruction.Text = string.Format("GenerateImmidiateTurn:{0}_{1}_{2}_{3}",
firstStreetCountTo, firstDirection,
firstDirection.ToString(),
secondDirection.ToString());
return instruction;
}
示例2: GenerateImmidiateTurn
/// <summary>
/// Generates an immidiate turn.
/// </summary>
/// <param name="instruction"></param>
/// <param name="firstStreetCountTo"></param>
/// <param name="firstStreetTo"></param>
/// <param name="firstDirection"></param>
/// <param name="secondStreetTo"></param>
/// <param name="secondDirection"></param>
/// <returns></returns>
public Instruction GenerateImmidiateTurn(Instruction instruction,
int firstStreetCountTo,
TagsCollection firstStreetTo,
OsmSharp.Math.Geo.Meta.RelativeDirection firstDirection,
TagsCollection secondStreetTo,
RelativeDirection secondDirection)
{
instruction.Text = string.Format("GenerateImmidiateTurn:{0}_{1}_{2}_{3}",
firstStreetCountTo, firstDirection,
firstDirection.ToString(),
secondDirection.ToString());
instruction.Extras = new Dictionary<string, object>();
instruction.Extras.Add("firstStreetCountTo", firstStreetCountTo);
instruction.Extras.Add("firstStreetTo", firstStreetTo);
instruction.Extras.Add("firstDirection", firstDirection);
instruction.Extras.Add("secondStreetTo", secondStreetTo);
instruction.Extras.Add("secondDirection", secondDirection);
return instruction;
}
示例3: Convert
/// <summary>
/// Converts the given OsmSharp feature into an NTS feature.
/// </summary>
/// <param name="feature"></param>
/// <returns></returns>
public static Feature Convert(OsmSharp.Geo.Features.Feature feature)
{
if (feature == null) { throw new ArgumentNullException("feature"); }
var geometryFactory = new NetTopologySuite.Geometries.GeometryFactory();
if(feature.Geometry is OsmSharp.Geo.Geometries.Polygon)
{ // a polygon.
var polygon = (feature.Geometry as OsmSharp.Geo.Geometries.Polygon);
var holes = polygon.Holes.Select((hole) => {
return (ILinearRing)geometryFactory.CreateLinearRing(hole.Coordinates.Select((coordinate) => {
return new Coordinate(coordinate.Longitude, coordinate.Latitude);
}).ToArray());
}).ToArray();
var shell = geometryFactory.CreateLinearRing(polygon.Ring.Coordinates.Select((coordinate) => {
return new Coordinate(coordinate.Longitude, coordinate.Latitude);
}).ToArray());
return new Feature(geometryFactory.CreatePolygon(shell, holes),
OsmSharpToNTSFeatureConvertor.Convert(feature.Attributes));
}
else if (feature.Geometry is OsmSharp.Geo.Geometries.LineairRing)
{ // a lineair ring.
var lineairRing = (feature.Geometry as OsmSharp.Geo.Geometries.LineairRing);
var coordinates = lineairRing.Coordinates.Select((coordinate) => {
return new Coordinate(coordinate.Longitude, coordinate.Latitude);
});
return new Feature(geometryFactory.CreateLinearRing(coordinates.ToArray()),
OsmSharpToNTSFeatureConvertor.Convert(feature.Attributes));
}
else if (feature.Geometry is OsmSharp.Geo.Geometries.LineString)
{ // a line string.
var lineString = (feature.Geometry as OsmSharp.Geo.Geometries.LineString);
var coordinates = lineString.Coordinates.Select((coordinate) =>
{
return new Coordinate(coordinate.Longitude, coordinate.Latitude);
});
return new Feature(geometryFactory.CreateLineString(coordinates.ToArray()),
OsmSharpToNTSFeatureConvertor.Convert(feature.Attributes));
}
else if (feature.Geometry is OsmSharp.Geo.Geometries.Point)
{ // a point.
var point = (feature.Geometry as OsmSharp.Geo.Geometries.Point);
return new Feature(geometryFactory.CreatePoint(new Coordinate(point.Coordinate.Longitude, point.Coordinate.Latitude)),
OsmSharpToNTSFeatureConvertor.Convert(feature.Attributes));
}
else if (feature.Geometry is OsmSharp.Geo.Geometries.MultiLineString)
{ // a multi line string.
throw new NotSupportedException("A MultiLineString is not supported.");
}
else if (feature.Geometry is OsmSharp.Geo.Geometries.MultiPoint)
{ // a multi point.
throw new NotSupportedException("A MultiPoint is not supported.");
}
else if (feature.Geometry is OsmSharp.Geo.Geometries.MultiPolygon)
{ // a multi polygon.
throw new NotSupportedException("A MultiPolygon is not supported.");
}
throw new ArgumentOutOfRangeException("Geometry not recognized: {0}", feature.ToString());
}
开发者ID:APLANA-Alexey-Stolyarov,项目名称:OsmSharpDataProcessor,代码行数:63,代码来源:OsmSharpToNTSFeatureConvertor.cs