示例#1
0
 /// <summary>
 /// Constructor
 /// </summary>
 /// <param name="turnFinal"></param>
 public DominantZoneEntryMonitor(ArbiterPerimeterWaypoint turnFinal, ArbiterInterconnect ai, bool isOurs,
                                 IntersectionMonitor globalMonitor, IntersectionInvolved involved)
 {
     this.finalWaypoint = turnFinal;
     this.entryPolygon  = this.GenerateEntryMonitorPolygon(ai);
     this.failedTimer   = new Stopwatch();
     this.isOurs        = isOurs;
     this.globalMonitor = globalMonitor;
     this.involved      = involved;
 }
        /// <summary>
        /// Constructor
        /// </summary>
        /// <param name="globalMonitor"></param>
        /// <param name="involved"></param>
        public DominantLaneEntryMonitor(IntersectionMonitor globalMonitor, IntersectionInvolved involved)
        {
            this.waitingTimer  = new Stopwatch();
            this.globalMonitor = globalMonitor;
            this.lane          = (ArbiterLane)involved.Area;
            this.involved      = involved;

            if (involved.Exit != null)
            {
                this.exit = (ArbiterWaypoint)involved.Exit;
            }
            else
            {
                this.exit = null;
            }

            if (this.exit != null)
            {
                // create the polygon
                this.exitPolygon = this.ExitPolygon();
            }
        }
示例#3
0
        /// <summary>
        /// Gets priotiy lane determination
        /// </summary>
        /// <param name="ii"></param>
        /// <param name="path"></param>
        /// <param name="end"></param>
        /// <returns></returns>
        private Coordinates?LaneIntersectsPath(IntersectionInvolved ii, LinePath path, IArbiterWaypoint end)
        {
            ArbiterLane al = (ArbiterLane)ii.Area;

            LinePath.PointOnPath current = path.StartPoint;
            bool go = true;

            while (go)            // && !(current.Location.DistanceTo(path.EndPoint.Location) < 0.1))
            {
                Coordinates alClose = al.LanePath().GetClosestPoint(current.Location).Location;
                double      alDist  = alClose.DistanceTo(current.Location);
                if (alDist <= 0.05)
                {
                    return(al.LanePath().GetClosestPoint(current.Location).Location);
                }

                if (current.Location.Equals(path.EndPoint.Location))
                {
                    go = false;
                }

                current = path.AdvancePoint(current, 0.1);
            }

            /*if (ii.Exit != null)
             * {
             *      ITraversableWaypoint laneExit = ii.Exit;
             *      foreach (ArbiterInterconnect tmpAi in laneExit.OutgoingConnections)
             *      {
             *              if (tmpAi.FinalGeneric.Equals(end))
             *              {
             *                      return tmpAi.FinalGeneric.Position;
             *              }
             *      }
             * }*/

            return(null);
        }