/// <summary>
        /// gets nearby stops to the connection
        /// </summary>
        /// <param name="icaw"></param>
        /// <returns></returns>
        private List <ArbiterWaypoint> GetNearbyStops(IConnectAreaWaypoints icaw)
        {
            List <ArbiterWaypoint> aws = new List <ArbiterWaypoint>();

            foreach (IArbiterWaypoint iaw in this.roadNetwork.ArbiterWaypoints.Values)
            {
                if (iaw is ArbiterWaypoint)
                {
                    ArbiterWaypoint aw = (ArbiterWaypoint)iaw;
                    if (aw.IsStop)
                    {
                        if (icaw.DistanceTo(aw.Position) < this.stopLineSearchDist)
                        {
                            aws.Add(aw);
                        }
                    }
                }
            }

            return(aws);
        }
示例#2
0
        /// <summary>
        /// Distance to another connect
        /// </summary>
        /// <param name="icaw"></param>
        /// <returns></returns>
        public double DistanceTo(IConnectAreaWaypoints icaw)
        {
            LinePath.PointOnPath current = this.PartitionPath.StartPoint;
            double inc     = 1.0;
            double dist    = 0;
            double minDist = double.MaxValue;

            while (dist == 0)
            {
                double tmpDist = icaw.DistanceTo(this.PartitionPath.GetPoint(current));

                if (tmpDist < minDist)
                {
                    minDist = tmpDist;
                }

                dist    = inc;
                current = PartitionPath.AdvancePoint(current, ref dist);
            }

            return(minDist);
        }
        /// <summary>
        /// get nearby
        /// </summary>
        /// <param name="icaw"></param>
        /// <param name="icaws"></param>
        /// <returns></returns>
        private List <IConnectAreaWaypoints> GetNearbyPartitions(IConnectAreaWaypoints icaw, List <IConnectAreaWaypoints> icaws)
        {
            List <IConnectAreaWaypoints> final = new List <IConnectAreaWaypoints>();

            foreach (IConnectAreaWaypoints tmp in icaws)
            {
                double dist = this.nearbyPartitionsDist;
                if (icaw is SceneZonePartition)
                {
                    dist = ((SceneZonePartition)icaw).Zone.Perimeter.PerimeterPolygon.CalculateBoundingCircle().r + this.nearbyPartitionsDist;
                }
                else if (tmp is SceneZonePartition)
                {
                    dist = ((SceneZonePartition)tmp).Zone.Perimeter.PerimeterPolygon.CalculateBoundingCircle().r + this.nearbyPartitionsDist;
                }

                if (icaw.DistanceTo(tmp) <= dist)
                {
                    final.Add(tmp);
                }
            }

            return(final);
        }
 public double DistanceTo(IConnectAreaWaypoints icaw)
 {
     return(icaw.DistanceTo(this.Zone.Perimeter.PerimeterPolygon.Center));
 }
        /// <summary>
        /// get nearby
        /// </summary>
        /// <param name="icaw"></param>
        /// <param name="icaws"></param>
        /// <returns></returns>
        private List<IConnectAreaWaypoints> GetNearbyPartitions(IConnectAreaWaypoints icaw, List<IConnectAreaWaypoints> icaws)
        {
            List<IConnectAreaWaypoints> final = new List<IConnectAreaWaypoints>();

            foreach (IConnectAreaWaypoints tmp in icaws)
            {
                double dist = this.nearbyPartitionsDist;
                if (icaw is SceneZonePartition)
                    dist = ((SceneZonePartition)icaw).Zone.Perimeter.PerimeterPolygon.CalculateBoundingCircle().r + this.nearbyPartitionsDist;
                else if(tmp is SceneZonePartition)
                    dist = ((SceneZonePartition)tmp).Zone.Perimeter.PerimeterPolygon.CalculateBoundingCircle().r + this.nearbyPartitionsDist;

                if (icaw.DistanceTo(tmp) <= dist)
                {
                    final.Add(tmp);
                }
            }

            return final;
        }
 public double DistanceTo(IConnectAreaWaypoints icaw)
 {
     return icaw.DistanceTo(this.Zone.Perimeter.PerimeterPolygon.Center);
 }
        /// <summary>
        /// gets nearby stops to the connection
        /// </summary>
        /// <param name="icaw"></param>
        /// <returns></returns>
        private List<ArbiterWaypoint> GetNearbyStops(IConnectAreaWaypoints icaw)
        {
            List<ArbiterWaypoint> aws = new List<ArbiterWaypoint>();

            foreach (IArbiterWaypoint iaw in this.roadNetwork.ArbiterWaypoints.Values)
            {
                if (iaw is ArbiterWaypoint)
                {
                    ArbiterWaypoint aw = (ArbiterWaypoint)iaw;
                    if (aw.IsStop)
                    {
                        if (icaw.DistanceTo(aw.Position) < this.stopLineSearchDist)
                        {
                            aws.Add(aw);
                        }
                    }
                }
            }

            return aws;
        }
        /// <summary>
        /// Distance to another connect
        /// </summary>
        /// <param name="icaw"></param>
        /// <returns></returns>
        public double DistanceTo(IConnectAreaWaypoints icaw)
        {
            LinePath.PointOnPath current = this.PartitionPath.StartPoint;
            double inc = 1.0;
            double dist = 0;
            double minDist = double.MaxValue;

            while (dist == 0)
            {
                double tmpDist = icaw.DistanceTo(this.PartitionPath.GetPoint(current));

                if (tmpDist < minDist)
                    minDist = tmpDist;

                dist = inc;
                current = PartitionPath.AdvancePoint(current, ref dist);
            }

            return minDist;
        }