Example #1
0
        private bool ConcurrentMoveNext(OsmStreamSource source, out OsmGeo current,
                                        bool ignore_nodes     = false, bool igonre_ways = false,
                                        bool ignore_relations = false)
        {
            bool available = false;

            current = null;

            lock (_source_lock)
            {
                if (_cancel_pull)
                {
                    return(false);
                }

                available = source.MoveNext();

                if (available)
                {
                    current = source.Current();
                    _pull_progress++;
                }
            }

            return(available);
        }
Example #2
0
        private void StreamSourceToTargetThread(OsmStreamSource source, OsmStreamTarget target)
        {
            var concurrent_target = target.ConcurrentCopy();

            concurrent_target.Initialize();

            OsmGeo current;

            while (ConcurrentMoveNext(source, out current))
            {
                concurrent_target.Add(current);
            }

            concurrent_target.Flush();
            concurrent_target.Close();
        }
Example #3
0
 public virtual void RegisterSource(IEnumerable <OsmGeo> source)
 {
     this._source = source.ToOsmStreamSource();
 }
Example #4
0
 public virtual void RegisterSource(OsmStreamSource source)
 {
     this._source = source;
 }
Example #5
0
 /// <summary>
 /// Registers a reader on this writer.
 /// </summary>
 /// <param name="source"></param>
 public void RegisterSource(OsmStreamSource source)
 {
     _source = source;
 }