예제 #1
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();
        }
 /// <summary>
 /// Creates a new processor target.
 /// </summary>
 /// <param name="target"></param>
 public ProcessorTarget(OsmStreamTarget target)
 {
     _isReady = false;
     _target = target;
 }
예제 #3
0
            private void transferData(OsmStreamSource src, OsmStreamTarget sqlTarget)
            {
                src.Initialize();
                sqlTarget.Initialize();

                while (src.MoveNext(false, false, false) && !_shouldStop)
                {

                    OsmGeo sourceObject = src.Current();

                    if (!typeCount.ContainsKey(sourceObject.Type))
                    {
                        typeCount.Add(sourceObject.Type, 0);
                    }

                    typeCount[sourceObject.Type] = 1 + typeCount[sourceObject.Type];

                    if (sourceObject is Node)
                    {
                        sqlTarget.AddNode(sourceObject as Node);
                    }
                    else if (sourceObject is Way)
                    {
                        sqlTarget.AddWay(sourceObject as Way);
                    }
                    else if (sourceObject is Relation)
                    {
                        sqlTarget.AddRelation(sourceObject as Relation);
                    }
                }

                try
                {

                    sqlTarget.Flush();
                    sqlTarget.Close();
                }
                catch (Exception ex)
                {
                    Console.Error.WriteLine(ex);
                }
            }
예제 #4
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();
        }