private async Task HandleSectionSelectionChanged(bool isStartMode)
        {
            DirectionBgr direction = GetSelectedDirection(isStartMode);

            BindStartStopSousRouteDDLs(isStartMode, direction);
            await ShowEndSectionChainage(isStartMode, direction);
        }
        private async Task ShowEndSectionChainage(bool isStartMode, DirectionBgr direction)
        {
            var rtssc = GetSelectedRtssc(isStartMode);

            if (rtssc == null)
            {
                return;
            }

            MaskedTextBox mtxtChainageSelection = isStartMode ? mtxtChainageSelectionStart : mtxtChainageSelectionStop;

            switch (direction)
            {
            case DirectionBgr.ForwardChaining:
                mtxtChainageSelection.Text = (await GetSectionLength(rtssc)).ToString("F0");
                break;

            case DirectionBgr.BackwardChaining:
                mtxtChainageSelection.Text = 0.ToString("F0");
                break;

            default:
                mtxtChainageSelection.Text = "";
                break;
            }
        }
        private void ShowSpecificDirection(bool isStartMode, DirectionBgr direction)
        {
            Panel       pnlDirection = isStartMode ? pnlStartDirection : pnlStopDirection;
            RadioButton rdDirection1 = isStartMode ? rdStartDirection1 : rdStopDirection1;
            RadioButton rdDirection2 = isStartMode ? rdStartDirection2 : rdStopDirection2;

            rdDirection1.Checked = (direction == DirectionBgr.ForwardChaining);
            rdDirection2.Checked = (direction == DirectionBgr.BackwardChaining);
        }
        public Rtssc(string route, string troncon, string section, string sousRoute, DirectionBgr direction = DirectionBgr.Unknown, double?chainage = null)
            : this()
        {
            this.Route     = route;
            this.Troncon   = troncon;
            this.Section   = section;
            this.SousRoute = sousRoute;

            this.Direction  = direction;
            this.Chainage   = chainage;
            this.NumeroRTSS = this.ToString().Replace(" ", "");
        }
        private void BindStartStopSousRouteDDLs(bool isStartMode, DirectionBgr direction)
        {
            RadDropDownList ddlTroncon   = isStartMode ? ddlTronconStart : ddlTronconStop;
            RadDropDownList ddlSection   = isStartMode ? ddlSectionStart : ddlSectionStop;
            RadDropDownList ddlSousRoute = isStartMode ? ddlSousRouteStart : ddlSousRouteStop;

            if (ddlSection.SelectedItem != null)
            {
                if (direction != DirectionBgr.Unknown)
                {
                    var rtssFromRoute = isStartMode ? _rtssFromRouteStart : _rtssFromRouteStop;

                    if (direction == DirectionBgr.ForwardChaining)
                    {
                        ddlSousRoute.DataSource = (
                            from currentRTSS in rtssFromRoute
                            where currentRTSS.Section == (string)ddlSection.SelectedValue &&
                            currentRTSS.Troncon == (string)ddlTroncon.SelectedValue &&
                            (
                                currentRTSS.CodeSousRoute == "3" ||
                                currentRTSS.CodeCoteChaussee == "D" ||
                                currentRTSS.CodeCoteChaussee == "C")
                            orderby currentRTSS.SousRoute ascending
                            select currentRTSS.SousRoute)
                                                  .Distinct().ToList();
                    }
                    else if (direction == DirectionBgr.BackwardChaining)
                    {
                        ddlSousRoute.DataSource = (
                            from currentRTSS in rtssFromRoute
                            where currentRTSS.Section == (string)ddlSection.SelectedValue &&
                            currentRTSS.Troncon == (string)ddlTroncon.SelectedValue &&
                            (
                                currentRTSS.CodeCoteChaussee == "G" ||
                                currentRTSS.CodeCoteChaussee == "C")
                            orderby currentRTSS.SousRoute ascending
                            select currentRTSS.SousRoute)
                                                  .Distinct().ToList();
                    }
                }
                else
                {
                    ddlSousRoute.DataSource = null;
                }
            }
            else
            {
                ddlSousRoute.DataSource = null;
                //ddlSection.Enabled = false;
            }
        }
 private async Task HandleDirectionCheckedChanged(bool isStartMode)
 {
     await DoAndIgnoreRtssIndexChanged(async() =>
     {
         AcquisitionTriggerMode triggerMode = GetSelectedTriggerMode(isStartMode);
         switch (triggerMode)
         {
         case AcquisitionTriggerMode.Rtssc:
         case AcquisitionTriggerMode.RtsscProximity:
             DirectionBgr direction = GetSelectedDirection(isStartMode);
             BindStartStopSousRouteDDLs(isStartMode, direction);
             await ShowEndSectionChainage(isStartMode, direction);
             break;
         }
     });
 }
示例#7
0
 protected abstract IRtssc ObtenirRtsscSuivant(GeoCoordinate coord, double searchRadiusInMeters, DirectionBgr direction);
 private Task ShowBeginSectionChainage(bool isStartMode, DirectionBgr direction)
 {
     return(ShowEndSectionChainage(isStartMode, direction == DirectionBgr.BackwardChaining ? DirectionBgr.ForwardChaining : direction == DirectionBgr.ForwardChaining ? DirectionBgr.BackwardChaining : DirectionBgr.Unknown));
 }
        protected override IRtssc ObtenirRtsscSuivant(GeoCoordinate coord, double searchRadiusInMeters, DirectionBgr direction)
        {
            if (coord == null)
            {
                throw new ArgumentNullException("coord");
            }
            if (searchRadiusInMeters < 0)
            {
                throw new ArgumentOutOfRangeException("searchRadiusInMeters", "searchRadiusInMeters must be greater than or equal to 0.");
            }

            IRtssc rtssc = GeoCodageInverse(coord);

            if (rtssc == null)
            {
                return(null);
            }

            double distance;

            if (direction == DirectionBgr.ForwardChaining)
            {
                distance = rtssc.Longueur - rtssc.Chainage.Value + 1;
            }
            else
            {
                distance = -1 * (rtssc.Chainage.Value + 5);
            }

            long absoluteDistance = Convert.ToInt64(Math.Abs(distance));

            rtssc = SelectRtssc(coord, searchRadiusInMeters, DateTime.Now)
                    .Where(r => r.Longueur <= absoluteDistance)
                    .FirstOrDefault();

            if (rtssc != null)
            {
                rtssc.Chainage = distance >= 0 ? distance : rtssc.Longueur + distance;
            }

            return(rtssc);
        }