/// <summary>
        /// Resets this source.
        /// </summary>
        public override void Reset()
        {
            _cachingDone = false;

            _dataCache.Clear();
            _simpleSource.Reset();
        }
예제 #2
0
 /// <summary>
 /// Closes this target.
 /// </summary>
 public override void Close()
 {
     _coordinates.Clear();
     _dataCache.Clear();
     _idTransformations.Clear();
     if (_nodesToCache != null)
     {
         _nodesToCache.Clear();
     }
     if (_waysToCache != null)
     {
         _waysToCache.Clear();
     }
     _preIndex      = null;
     _relevantNodes = null;
     _tagsIndex     = null;
 }
예제 #3
0
        /// <summary>
        /// Tests the clear functionality on the datacache.
        /// </summary>
        /// <param name="cache"></param>
        public void DoOsmDataCacheTestClear(OsmDataCache cache)
        {
            Node node = Node.Create(1, new TagsCollection(
                                        Tag.Create("node", "yes")), 1, 2);
            Way way = Way.Create(1, new TagsCollection(
                                     Tag.Create("way", "yes")), 1, 2);
            Relation relation = Relation.Create(1, new TagsCollection(
                                                    Tag.Create("relation", "yes")), RelationMember.Create(1, "something", OsmGeoType.Node));

            cache.AddNode(node);
            cache.AddWay(way);
            cache.AddRelation(relation);

            Assert.IsTrue(cache.ContainsNode(node.Id.Value));
            Assert.IsTrue(cache.ContainsWay(way.Id.Value));
            Assert.IsTrue(cache.ContainsRelation(relation.Id.Value));

            cache.Clear();

            Assert.IsFalse(cache.ContainsNode(node.Id.Value));
            Assert.IsFalse(cache.ContainsWay(way.Id.Value));
            Assert.IsFalse(cache.ContainsRelation(relation.Id.Value));
        }