示例#1
0
 public RouterDbStreamTarget(RouterDb db, Vehicle[] vehicles, bool allCore = false, int minimumStages = 1, bool normalizeTags = true, IEnumerable <ITwoPassProcessor> processors = null)
 {
     this._db              = db;
     this._vehicles        = vehicles;
     this._allNodesAreCore = allCore;
     this._normalizeTags   = normalizeTags;
     this._createNodeCoordinatesDictionary = (Func <NodeCoordinatesDictionary>)(() => new NodeCoordinatesDictionary());
     this._stageCoordinates = this._createNodeCoordinatesDictionary();
     this._allRoutingNodes  = (ILongIndex) new OsmSharp.Collections.LongIndex.LongIndex.LongIndex();
     this._anyStageNodes    = (ILongIndex) new OsmSharp.Collections.LongIndex.LongIndex.LongIndex();
     this._coreNodes        = (ILongIndex) new OsmSharp.Collections.LongIndex.LongIndex.LongIndex();
     this._coreNodeIdMap    = new CoreNodeIdMap();
     this._processedWays    = (ILongIndex) new OsmSharp.Collections.LongIndex.LongIndex.LongIndex();
     this._minimumStages    = minimumStages;
     foreach (Vehicle vehicle in vehicles)
     {
         foreach (Profile profile in vehicle.GetProfiles())
         {
             db.AddSupportedProfile(profile);
         }
     }
     if (processors == null)
     {
         processors = (IEnumerable <ITwoPassProcessor>) new List <ITwoPassProcessor>();
     }
     this.Processors = new List <ITwoPassProcessor>(processors);
     this.InitializeDefaultProcessors();
 }
示例#2
0
 public override bool OnBeforePull()
 {
     this.DoPull(false, false, false);
     this._stage     = 0;
     this._firstPass = false;
     while (this._stage < this._stages.Count)
     {
         this.Source.Reset();
         this.DoPull(false, false, false);
         this._stage            = this._stage + 1;
         this._stageCoordinates = this._createNodeCoordinatesDictionary();
     }
     return(false);
 }
示例#3
0
 public override void AddNode(Node node)
 {
     if (this._firstPass)
     {
         this._nodeCount = this._nodeCount + 1L;
         double num1 = node.Latitude.Value;
         if (num1 < this._minLatitude)
         {
             this._minLatitude = num1;
         }
         if (num1 > this._maxLatitude)
         {
             this._maxLatitude = num1;
         }
         double num2 = node.Longitude.Value;
         if (num2 < this._minLongitude)
         {
             this._minLongitude = num2;
         }
         if (num2 > this._maxLongitude)
         {
             this._maxLongitude = num2;
         }
         if (this.Processors == null)
         {
             return;
         }
         foreach (ITwoPassProcessor processor in this.Processors)
         {
             processor.FirstPass(node);
         }
     }
     else
     {
         if (this.Processors != null)
         {
             foreach (ITwoPassProcessor processor in this.Processors)
             {
                 processor.SecondPass(node);
             }
         }
         long?id1;
         if (!this._stages[this._stage].Contains(node.Longitude.Value, node.Latitude.Value))
         {
             ILongIndex anyStageNodes = this._anyStageNodes;
             id1 = ((OsmGeo)node).Id;
             long number = id1.Value;
             if (!anyStageNodes.Contains(number))
             {
                 return;
             }
         }
         ILongIndex allRoutingNodes = this._allRoutingNodes;
         id1 = ((OsmGeo)node).Id;
         long number1 = id1.Value;
         if (!allRoutingNodes.Contains(number1))
         {
             return;
         }
         NodeCoordinatesDictionary stageCoordinates = this._stageCoordinates;
         id1 = ((OsmGeo)node).Id;
         long id2 = id1.Value;
         // ISSUE: variable of a boxed type
         GeoCoordinateSimple local = new GeoCoordinateSimple()
         {
             Latitude  = (float)node.Latitude.Value,
             Longitude = (float)node.Longitude.Value
         };
         stageCoordinates.Add(id2, (ICoordinate)local);
     }
 }