当前位置: 首页>>代码示例>>C#>>正文


C# TagsCollection.Add方法代码示例

本文整理汇总了C#中OsmSharp.Collections.Tags.TagsCollection.Add方法的典型用法代码示例。如果您正苦于以下问题:C# TagsCollection.Add方法的具体用法?C# TagsCollection.Add怎么用?C# TagsCollection.Add使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在OsmSharp.Collections.Tags.TagsCollection的用法示例。


在下文中一共展示了TagsCollection.Add方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: TestRandomBlockTagSerializaton

        public void TestRandomBlockTagSerializaton()
        {
            TagsTableCollectionIndex tagsIndex = new TagsTableCollectionIndex();

            TagsCollection tagsCollection = new TagsCollection();
            for (int i = 0; i < 100; i++)
            {
                int tagCollectionSize = OsmSharp.Math.Random.StaticRandomGenerator.Get().Generate(10) + 1;
                for (int idx = 0; idx < tagCollectionSize; idx++)
                {
                    int tagValue = OsmSharp.Math.Random.StaticRandomGenerator.Get().Generate(10);
                    tagsCollection.Add(
                        string.Format("key_{0}", tagValue),
                        string.Format("value_{0}", tagValue));
                }
                uint tagsId = tagsIndex.Add(tagsCollection);
            }

            ITagsCollectionIndexReadonly tagsIndexReadonly = this.SerializeDeserializeBlock(tagsIndex, 10, 0);
            Assert.AreEqual(tagsIndex.Max, tagsIndexReadonly.Max);
            for (uint idx = 0; idx < tagsIndex.Max; idx++)
            {
                ComparisonHelpers.CompareTags(tagsIndex.Get(idx),
                    tagsIndexReadonly.Get(idx));
            }
        }
开发者ID:OpenMaps,项目名称:OsmSharp,代码行数:26,代码来源:TagsCollectionIndexSerializerTests.cs

示例2: TestSerialization

        /// <summary>
        /// Tests preprocessing data from a PBF file.
        /// </summary>
        /// <param name="name"></param>
        /// <param name="pbfFile"></param>
        public static void TestSerialization(string name, string pbfFile)
        {
            FileInfo testFile = new FileInfo(string.Format(@".\TestFiles\{0}", pbfFile));
            Stream stream = testFile.OpenRead();
            PBFOsmStreamSource source = new PBFOsmStreamSource(stream);

            FileInfo testOutputFile = new FileInfo(@"test.routing");
            testOutputFile.Delete();
            Stream writeStream = testOutputFile.OpenWrite();

            CHEdgeGraphFileStreamTarget target = new CHEdgeGraphFileStreamTarget(writeStream,
                Vehicle.Car);
            target.RegisterSource(source);

            PerformanceInfoConsumer performanceInfo = new PerformanceInfoConsumer("CHSerializer");
            performanceInfo.Start();
            performanceInfo.Report("Pulling from {0}...", testFile.Name);

            var data = CHEdgeGraphOsmStreamTarget.Preprocess(
                source, new OsmRoutingInterpreter(), Vehicle.Car);

            TagsCollectionBase metaData = new TagsCollection();
            metaData.Add("some_key", "some_value");
            var routingSerializer = new CHEdgeDataDataSourceSerializer(true);
            routingSerializer.Serialize(writeStream, data, metaData);

            stream.Dispose();
            writeStream.Dispose();

            OsmSharp.Logging.Log.TraceEvent("CHSerializer", OsmSharp.Logging.TraceEventType.Information,
                string.Format("Serialized file: {0}KB", testOutputFile.Length / 1024));

            performanceInfo.Stop();
        }
开发者ID:nubix-biz,项目名称:OsmSharp,代码行数:39,代码来源:CHEdgeGraphFileStreamTargetTests.cs

示例3: MapCSSEvalTagTest

        public void MapCSSEvalTagTest()
        {
            string function = "tag('width')";
            TagsCollectionBase tags = new TagsCollection();
            tags.Add("width", "2");

            Assert.AreEqual(2, EvalInterpreter.Instance.InterpretDouble(function, tags));
        }
开发者ID:JoeCooper,项目名称:ui,代码行数:8,代码来源:MapCSSEvalTests.cs

示例4: TextProbableSpeed

        /// <summary>
        /// Tests the probable speed.
        /// </summary>
        /// <param name="vehicle"></param>
        /// <param name="speed"></param>
        /// <param name="tags"></param>
        protected void TextProbableSpeed(Vehicle vehicle, double speed, params string[] tags)
        {
            // build tags collection.
            TagsCollection tagsCollection = new TagsCollection();
            for (int idx = 0; idx < tags.Length; idx = idx + 2)
            {
                tagsCollection.Add(tags[idx], tags[idx + 1]);
            }

            Assert.AreEqual(speed, vehicle.ProbableSpeed(tagsCollection).Value);
        }
开发者ID:cmberryau,项目名称:routing,代码行数:17,代码来源:VehicleBaseTests.cs

示例5: TestBooleanParsing

        public void TestBooleanParsing()
        {
            // test IsTrue.
            TagsCollectionBase tags = new TagsCollection();
            tags.Add("area", "yes");
            Assert.IsTrue(tags.IsTrue("area"));

            tags = new TagsCollection();
            tags.Add("area", "1");
            Assert.IsTrue(tags.IsTrue("area"));

            tags = new TagsCollection();
            tags.Add("area", "true");
            Assert.IsTrue(tags.IsTrue("area"));

            tags = new TagsCollection();
            tags.Add("area", "false");
            Assert.IsFalse(tags.IsTrue("area"));

            tags = new TagsCollection();
            tags.Add("area", "0");
            Assert.IsFalse(tags.IsTrue("area"));

            tags = new TagsCollection();
            tags.Add("area", "no");
            Assert.IsFalse(tags.IsTrue("area"));

            // test IsFalse.
            tags = new TagsCollection();
            tags.Add("area", "yes");
            Assert.IsFalse(tags.IsFalse("area"));

            tags = new TagsCollection();
            tags.Add("area", "1");
            Assert.IsFalse(tags.IsFalse("area"));

            tags = new TagsCollection();
            tags.Add("area", "true");
            Assert.IsFalse(tags.IsFalse("area"));

            tags = new TagsCollection();
            tags.Add("area", "false");
            Assert.IsTrue(tags.IsFalse("area"));

            tags = new TagsCollection();
            tags.Add("area", "0");
            Assert.IsTrue(tags.IsFalse("area"));

            tags = new TagsCollection();
            tags.Add("area", "no");
            Assert.IsTrue(tags.IsFalse("area"));
        }
开发者ID:UnifyKit,项目名称:OsmSharp,代码行数:52,代码来源:TagParsingTests.cs

示例6: TestSerialize

        /// <summary>
        /// Tests serializing a stream.
        /// </summary>
        /// <param name="name"></param>
        /// <param name="stream"></param>
        /// <param name="scene"></param>
        /// <param name="compress"></param>
        public static void TestSerialize(string name, Stream stream, Scene2D scene, bool compress)
        {
            PerformanceInfoConsumer performanceInfo = new PerformanceInfoConsumer(string.Format("{0}.Serialize", name));
            performanceInfo.Start();
            performanceInfo.Report("Serializing stream...");

            TagsCollectionBase metaTags = new TagsCollection();
            metaTags.Add("generated_by", "performance_test");
            scene.Serialize(stream, compress, metaTags);

            performanceInfo.Stop();

            Console.Write("", scene.BackColor);
        }
开发者ID:nubix-biz,项目名称:OsmSharp,代码行数:21,代码来源:Scene2DTests.cs

示例7: TestSerialization

        /// <summary>
        /// Tests preprocessing data from a PBF file.
        /// </summary>
        /// <param name="name"></param>
        /// <param name="pbfFile"></param>
        public static void TestSerialization(string name, string pbfFile)
        {
            var testFile = new FileInfo(string.Format(@".\TestFiles\{0}", pbfFile));
            var stream = testFile.OpenRead();
            var source = new OsmSharp.Osm.Streams.Filters.OsmStreamFilterProgress();
            source.RegisterSource(new PBFOsmStreamSource(stream));

            var testOutputFile = new FileInfo(@"test.pedestrian.routing");
            testOutputFile.Delete();
            Stream writeStream = testOutputFile.OpenWrite();

            var tagsIndex = new TagsTableCollectionIndex();
            var interpreter = new OsmRoutingInterpreter();
            var graph = new DynamicGraphRouterDataSource<CHEdgeData>(tagsIndex);

            var performanceInfo = new PerformanceInfoConsumer("CHSerializerFlatFile.Serialize");
            performanceInfo.Start();
            performanceInfo.Report("Pulling from {0}...", testFile.Name);

            var data = CHEdgeGraphOsmStreamTarget.Preprocess(
                source, new OsmRoutingInterpreter(), Vehicle.Car);

            var metaData = new TagsCollection();
            metaData.Add("some_key", "some_value");
            var routingSerializer = new CHEdgeFlatfileSerializer();
            routingSerializer.Serialize(writeStream, data, metaData);

            stream.Dispose();
            writeStream.Dispose();

            OsmSharp.Logging.Log.TraceEvent("CHSerializerFlatFile", OsmSharp.Logging.TraceEventType.Information,
                string.Format("Serialized file: {0}KB", testOutputFile.Length / 1024));

            performanceInfo.Stop();

            performanceInfo = new PerformanceInfoConsumer("CHSerializerFlatFile.Deserialize");
            performanceInfo.Start();
            performanceInfo.Report("Deserializing again...");

            // open file again and read.
            writeStream = testOutputFile.OpenRead();
            var deserializedGraph = routingSerializer.Deserialize(writeStream);

            performanceInfo.Stop();
        }
开发者ID:kochizufan,项目名称:OsmSharp,代码行数:50,代码来源:CHEdgeGraphFlatFileSerializerTests.cs

示例8: TestVehicleCanTranverse

        /// <summary>
        /// Tests the can traverse functionality.
        /// </summary>
        protected void TestVehicleCanTranverse(Vehicle vehicle, bool result, params string[] tags)
        {
            // build tags collection.
            TagsCollection tagsCollection = new TagsCollection();
            for (int idx = 0; idx < tags.Length; idx = idx + 2)
            {
                tagsCollection.Add(tags[idx], tags[idx + 1]);
            }

            if (result)
            { // assume the result is true.
                Assert.IsTrue(vehicle.CanTraverse(tagsCollection));
            }
            else
            { // assume the result is false.
                Assert.IsFalse(vehicle.CanTraverse(tagsCollection));
            }
        }
开发者ID:cmberryau,项目名称:routing,代码行数:21,代码来源:VehicleBaseTests.cs

示例9: TestTagsCollectionIndex

        /// <summary>
        /// Tests the given tags collection index.
        /// </summary>
        /// <param name="tagsCollectionIndex"></param>
        protected void TestTagsCollectionIndex(ITagsCollectionIndex tagsCollectionIndex)
        {
            List<KeyValuePair<uint, TagsCollectionBase>> addedTags = new List<KeyValuePair<uint, TagsCollectionBase>>();
            for (int i = 0; i < 100; i++)
            {
                TagsCollection tagsCollection = new TagsCollection();
                int tagCollectionSize = OsmSharp.Math.Random.StaticRandomGenerator.Get().Generate(3) + 1;
                for (int idx = 0; idx < tagCollectionSize; idx++)
                {
                    int tagValue = OsmSharp.Math.Random.StaticRandomGenerator.Get().Generate(3);
                    tagsCollection.Add(
                        string.Format("key_{0}", tagValue),
                        string.Format("value_{0}", tagValue));
                }
                int addCount = OsmSharp.Math.Random.StaticRandomGenerator.Get().Generate(2) + 1;
                for (int idx = 0; idx < addCount; idx++)
                {
                    uint tagsId = tagsCollectionIndex.Add(tagsCollection);
                    addedTags.Add(new KeyValuePair<uint, TagsCollectionBase>(tagsId, tagsCollection));

                    TagsCollectionBase indexTags = tagsCollectionIndex.Get(tagsId);
                    Assert.AreEqual(tagsCollection.Count, indexTags.Count);
                    foreach (Tag tag in tagsCollection)
                    {
                        Assert.IsTrue(indexTags.ContainsKeyValue(tag.Key, tag.Value));
                    }
                }
            }

            // check the index.
            foreach (KeyValuePair<uint, TagsCollectionBase> pair in addedTags)
            {
                TagsCollectionBase indexTags = tagsCollectionIndex.Get(pair.Key);
                Assert.AreEqual(pair.Value.Count, indexTags.Count);
                foreach (Tag tag in pair.Value)
                {
                    Assert.IsTrue(indexTags.ContainsKeyValue(tag.Key, tag.Value));
                }
                foreach (Tag tag in indexTags)
                {
                    Assert.IsTrue(pair.Value.ContainsKeyValue(tag.Key, tag.Value));
                }
            }
        }
开发者ID:nubix-biz,项目名称:OsmSharp,代码行数:48,代码来源:TagsCollectionIndexBaseTests.cs

示例10: FillIndex

 /// <summary>
 /// Tests adding simple tags to the given index.
 /// </summary>
 /// <param name="index"></param>
 /// <param name="collectionCount"></param>
 public static void FillIndex(ITagsCollectionIndex index, int collectionCount)
 {
     for (int i = 0; i < collectionCount; i++)
     {
         TagsCollection tagsCollection = new TagsCollection();
         int tagCollectionSize = OsmSharp.Math.Random.StaticRandomGenerator.Get().Generate(3) + 1;
         for (int idx = 0; idx < tagCollectionSize; idx++)
         {
             int tagValue = OsmSharp.Math.Random.StaticRandomGenerator.Get().Generate(100);
             tagsCollection.Add(
                 string.Format("key_{0}", tagValue),
                 string.Format("value_{0}", tagValue));
         }
         int addCount = OsmSharp.Math.Random.StaticRandomGenerator.Get().Generate(2) + 1;
         for (int idx = 0; idx < addCount; idx++)
         {
             uint tagsId = index.Add(tagsCollection);
         }
     }
 }
开发者ID:nubix-biz,项目名称:OsmSharp,代码行数:25,代码来源:ITagCollectionIndexTests.cs

示例11: TestTagIndexSerialization

        public void TestTagIndexSerialization()
        {
            // set the seed manually.
            OsmSharp.Math.Random.StaticRandomGenerator.Set(116542346);

            // build a tags index and keep what was added.
            var tagsIndex = new TagsIndex(new MemoryMappedStream(new MemoryStream()));
            var addedTags = new List<KeyValuePair<uint, TagsCollectionBase>>();
            for (int i = 0; i < 100; i++)
            {
                var tagsCollection = new TagsCollection();
                var tagCollectionSize = OsmSharp.Math.Random.StaticRandomGenerator.Get().Generate(3) + 1;
                for (int idx = 0; idx < tagCollectionSize; idx++)
                {
                    var tagValue = OsmSharp.Math.Random.StaticRandomGenerator.Get().Generate(3);
                    tagsCollection.Add(
                        string.Format("key_{0}", tagValue),
                        string.Format("value_{0}", tagValue));
                }
                var addCount = OsmSharp.Math.Random.StaticRandomGenerator.Get().Generate(2) + 1;
                for (int idx = 0; idx < addCount; idx++)
                {
                    var tagsId = tagsIndex.Add(tagsCollection);
                    addedTags.Add(new KeyValuePair<uint, TagsCollectionBase>(tagsId, tagsCollection));

                    var indexTags = tagsIndex.Get(tagsId);
                    Assert.AreEqual(tagsCollection.Count, indexTags.Count);
                    foreach (var tag in tagsCollection)
                    {
                        Assert.IsTrue(indexTags.ContainsKeyValue(tag.Key, tag.Value));
                    }
                }
            }

            // serialize/deserialize.
            var deserializedTagsIndex = this.SerializeDeserialize(tagsIndex, false);

            // verify if what was added is still there.
            this.TestTagIndexContent(deserializedTagsIndex, addedTags);
        }
开发者ID:nagyistoce,项目名称:OsmSharp-core,代码行数:40,代码来源:TagsCollectionIndexTests.cs

示例12: TestTagIndex

        /// <summary>
        /// Tests the given tags collection index.
        /// </summary>
        /// <param name="tagsCollectionIndex"></param>
        protected void TestTagIndex(ITagsIndex tagsCollectionIndex)
        {
            // set the seed manually.
            OsmSharp.Math.Random.StaticRandomGenerator.Set(116542346);

            var addedTags = new List<KeyValuePair<uint, TagsCollectionBase>>();
            for (int i = 0; i < 100; i++)
            {
                var tagsCollection = new TagsCollection();
                var tagCollectionSize = OsmSharp.Math.Random.StaticRandomGenerator.Get().Generate(3) + 1;
                for (int idx = 0; idx < tagCollectionSize; idx++)
                {
                    var tagValue = OsmSharp.Math.Random.StaticRandomGenerator.Get().Generate(3);
                    tagsCollection.Add(
                        string.Format("key_{0}", tagValue),
                        string.Format("value_{0}", tagValue));
                }
                var addCount = OsmSharp.Math.Random.StaticRandomGenerator.Get().Generate(2) + 1;
                for (int idx = 0; idx < addCount; idx++)
                {
                    var tagsId = tagsCollectionIndex.Add(tagsCollection);
                    addedTags.Add(new KeyValuePair<uint, TagsCollectionBase>(tagsId, tagsCollection));

                    var indexTags = tagsCollectionIndex.Get(tagsId);
                    Assert.AreEqual(tagsCollection.Count, indexTags.Count);
                    foreach (var tag in tagsCollection)
                    {
                        Assert.IsTrue(indexTags.ContainsKeyValue(tag.Key, tag.Value));
                    }
                }
            }

            // test complete content.
            this.TestTagIndexContent(tagsCollectionIndex, addedTags);
        }
开发者ID:nagyistoce,项目名称:OsmSharp-core,代码行数:39,代码来源:TagsCollectionIndexTests.cs

示例13: TestSerialization

        /// <summary>
        /// Tests preprocessing data from a PBF file.
        /// </summary>
        /// <param name="name"></param>
        /// <param name="pbfFile"></param>
        public static void TestSerialization(string name, string pbfFile)
        {
            var testFile = new FileInfo(string.Format(@".\TestFiles\{0}", pbfFile));

            var performanceInfo = new PerformanceInfoConsumer("LiveSerializerFlatFile.Serialize", 100000);
            performanceInfo.Start();
            performanceInfo.Report("Pulling from {0}...", testFile.Name);

            var stream = testFile.OpenRead();
            var source = new PBFOsmStreamSource(stream);
            var progress = new OsmStreamFilterProgress();
            progress.RegisterSource(source);

            var testOutputFile = new FileInfo(@"test.routing");
            testOutputFile.Delete();
            Stream writeStream = testOutputFile.OpenWrite();

            var tagsIndex = new TagsTableCollectionIndex();
            var interpreter = new OsmRoutingInterpreter();
            var graph = new DynamicGraphRouterDataSource<LiveEdge>(tagsIndex);
            var routingSerializer = new LiveEdgeFlatfileSerializer();

            // read from the OSM-stream.
            using (var fileFactory = new MemoryMappedFileFactory(@"d:\temp\"))
            {
                using (var memoryMappedGraph = new MemoryMappedGraph<LiveEdge>(10000, fileFactory))
                {
                    using (var coordinates = new HugeCoordinateIndex(fileFactory, 10000))
                    {
                        var memoryData = new DynamicGraphRouterDataSource<LiveEdge>(memoryMappedGraph, tagsIndex);
                        var targetData = new LiveGraphOsmStreamTarget(memoryData, new OsmRoutingInterpreter(), tagsIndex, coordinates);
                        targetData.RegisterSource(progress);
                        targetData.Pull();

                        performanceInfo.Stop();

                        performanceInfo = new PerformanceInfoConsumer("LiveSerializerFlatFile.Serialize", 100000);
                        performanceInfo.Start();
                        performanceInfo.Report("Writing file for {0}...", testFile.Name);

                        var metaData = new TagsCollection();
                        metaData.Add("some_key", "some_value");
                        routingSerializer.Serialize(writeStream, memoryData, metaData);
                    }
                }
            }
            stream.Dispose();
            writeStream.Dispose();

            OsmSharp.Logging.Log.TraceEvent("LiveSerializerFlatFile", OsmSharp.Logging.TraceEventType.Information,
                string.Format("Serialized file: {0}KB", testOutputFile.Length / 1024));
            performanceInfo.Stop();

            performanceInfo = new PerformanceInfoConsumer("LiveSerializerFlatFile.Serialize", 100000);
            performanceInfo.Start();
            performanceInfo.Report("Reading file for {0}...", testFile.Name);

            var testInputFile = new FileInfo(@"europe-latest.osm.pbf.routing");
            Stream readStream = testInputFile.OpenRead();

            var deserializedGraph = routingSerializer.Deserialize(readStream, false);

            readStream.Dispose();

            OsmSharp.Logging.Log.TraceEvent("LiveSerializerFlatFile", OsmSharp.Logging.TraceEventType.Information,
                string.Format("Read: {0}KB", testInputFile.Length / 1024));

            OsmSharp.Logging.Log.TraceEvent("LiveSerializerFlatFile", Logging.TraceEventType.Information, deserializedGraph.ToInvariantString());

            performanceInfo.Stop();
        }
开发者ID:OpenMaps,项目名称:OsmSharp,代码行数:76,代码来源:LiveGraphFlatFileSerializerTests.cs

示例14: RoutingSerializationV2CompressedRoutingTest

        public void RoutingSerializationV2CompressedRoutingTest()
        {
            const string embeddedString = "OsmSharp.Test.Unittests.test_network.osm";

            // create the tags index.
            var tagsIndex = new TagsTableCollectionIndex();

            // creates a new interpreter.
            var interpreter = new OsmRoutingInterpreter();

            // do the data processing.
            var original =
                new DynamicGraphRouterDataSource<LiveEdge>(tagsIndex);
            var targetData = new LiveGraphOsmStreamTarget(
                original, interpreter, tagsIndex);
            var dataProcessorSource = new XmlOsmStreamSource(
                Assembly.GetExecutingAssembly().GetManifestResourceStream(embeddedString));
            targetData.RegisterSource(dataProcessorSource);
            targetData.Pull();

            // create serializer.
            var routingSerializer = new V2RoutingDataSourceLiveEdgeSerializer(true);

            // serialize/deserialize.
            TagsCollectionBase metaData = new TagsCollection();
            metaData.Add("some_key", "some_value");
            byte[] byteArray;
            using (var stream = new MemoryStream())
            {
                try
                {
                    routingSerializer.Serialize(stream, original, metaData);
                    byteArray = stream.ToArray();
                }
                catch (Exception)
                {
                    if (Debugger.IsAttached)
                    {
                        Debugger.Break();
                    }
                    throw;
                }
            }

            IBasicRouterDataSource<LiveEdge> deserializedVersion =
                routingSerializer.Deserialize(new MemoryStream(byteArray), out metaData);
            Assert.AreEqual(original.TagsIndex.Get(0), deserializedVersion.TagsIndex.Get(0));

            // try to do some routing on the deserialized version.
            var basicRouter = new DykstraRoutingLive();
            Router router = Router.CreateLiveFrom(deserializedVersion, basicRouter, interpreter);
            RouterPoint source = router.Resolve(Vehicle.Car,
                new GeoCoordinate(51.0578532, 3.7192229));
            RouterPoint target = router.Resolve(Vehicle.Car,
                new GeoCoordinate(51.0576193, 3.7191801));

            // calculate the route.
            Route route = router.Calculate(Vehicle.Car, source, target);
            Assert.IsNotNull(route);
            Assert.AreEqual(5, route.Entries.Length);

            float latitude, longitude;
            deserializedVersion.GetVertex(20, out latitude, out longitude);
            Assert.AreEqual(latitude, route.Entries[0].Latitude, 0.00001);
            Assert.AreEqual(longitude, route.Entries[0].Longitude, 0.00001);
            Assert.AreEqual(RoutePointEntryType.Start, route.Entries[0].Type);

            deserializedVersion.GetVertex(21, out latitude, out longitude);
            Assert.AreEqual(latitude, route.Entries[1].Latitude, 0.00001);
            Assert.AreEqual(longitude, route.Entries[1].Longitude, 0.00001);
            Assert.AreEqual(RoutePointEntryType.Along, route.Entries[1].Type);

            deserializedVersion.GetVertex(16, out latitude, out longitude);
            Assert.AreEqual(latitude, route.Entries[2].Latitude, 0.00001);
            Assert.AreEqual(longitude, route.Entries[2].Longitude, 0.00001);
            Assert.AreEqual(RoutePointEntryType.Along, route.Entries[2].Type);

            deserializedVersion.GetVertex(22, out latitude, out longitude);
            Assert.AreEqual(latitude, route.Entries[3].Latitude, 0.00001);
            Assert.AreEqual(longitude, route.Entries[3].Longitude, 0.00001);
            Assert.AreEqual(RoutePointEntryType.Along, route.Entries[3].Type);

            deserializedVersion.GetVertex(23, out latitude, out longitude);
            Assert.AreEqual(latitude, route.Entries[4].Latitude, 0.00001);
            Assert.AreEqual(longitude, route.Entries[4].Longitude, 0.00001);
            Assert.AreEqual(RoutePointEntryType.Stop, route.Entries[4].Type);
        }
开发者ID:nubix-biz,项目名称:OsmSharp,代码行数:87,代码来源:RoutingSerializationTests.cs

示例15: TestSimpleTagSerializatonNonBeginPosition

        public void TestSimpleTagSerializatonNonBeginPosition()
        {
            TagsTableCollectionIndex tagsIndex = new TagsTableCollectionIndex();

            TagsCollection tagsCollection = new TagsCollection();
            tagsCollection.Add("key1", "value1");

            uint tagsId = tagsIndex.Add(tagsCollection);

            ITagsCollectionIndexReadonly tagsIndexReadonly = this.SerializeDeserialize(tagsIndex, 1201);
            Assert.AreEqual(tagsIndex.Max, tagsIndexReadonly.Max);
            for (uint idx = 0; idx < tagsIndex.Max; idx++)
            {
                ComparisonHelpers.CompareTags(tagsIndex.Get(idx),
                    tagsIndexReadonly.Get(idx));
            }
        }
开发者ID:OpenMaps,项目名称:OsmSharp,代码行数:17,代码来源:TagsCollectionIndexSerializerTests.cs


注:本文中的OsmSharp.Collections.Tags.TagsCollection.Add方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。