本文整理汇总了C#中OsmSharp.AddLayer方法的典型用法代码示例。如果您正苦于以下问题:C# OsmSharp.AddLayer方法的具体用法?C# OsmSharp.AddLayer怎么用?C# OsmSharp.AddLayer使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类OsmSharp
的用法示例。
在下文中一共展示了OsmSharp.AddLayer方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: InitializeRouting
private void InitializeRouting(OsmSharp.UI.Map.Map map)
{
//var osmInterpreter = new OsmRoutingInterpreter();
//_router = Router.CreateLiveFrom(new XmlOsmStreamSource(new FileInfo(@"c:\OSM\bin\wechel.osm").OpenRead()),
// osmInterpreter);
// creates a new interpreter.
var interpreter = new OsmRoutingInterpreter();
// var routingSerializer = new OsmSharp.Routing.CH.Serialization.Sorted.CHEdgeDataDataSourceSerializer(true);
var original = CHEdgeGraphOsmStreamTarget.Preprocess(new XmlOsmStreamSource(
new FileInfo(@"c:\OSM\bin\wechel.osm").OpenRead()),
interpreter,
Vehicle.Car);
//byte[] byteArray;
//var stream = new MemoryStream();
//using (stream)
//{
// try
// {
// routingSerializer.Serialize(stream, original);
// byteArray = stream.ToArray();
// }
// catch (Exception)
// {
// throw;
// }
//}
//stream = new MemoryStream(byteArray);
//Stream stream = new FileInfo(@"c:\OSM\bin\test.osm.pbf.routing.3").OpenRead();
//IBasicRouterDataSource<CHEdgeData> deserializedVersion =
// routingSerializer.Deserialize(stream);
var basicRouter = new CHRouter();
_router = Router.CreateCHFrom(
original, basicRouter, interpreter);
_routeLayer = new LayerRoute(map.Projection);
map.AddLayer(_routeLayer);
}