Пример #1
0
        private void GetGlobalChart(GlobalGetDataTimingAndActuations globalGetDataTimingAndActuations,
                                    TimingAndActuationsOptions options)
        {
            if (ReturnList == null)
            {
                ReturnList = new List <string>();
            }
            var taaGlobalChart =
                new ChartForGlobalEventsTimingAndActuations(globalGetDataTimingAndActuations, options)
            {
                Chart = { BackColor = Color.LightSkyBlue }
            };
            var chartName = CreateFileName();

            taaGlobalChart.Chart.ImageLocation = MetricFileLocation + chartName;
            taaGlobalChart.Chart.SaveImage(MetricFileLocation + chartName, ChartImageFormat.Jpeg);
            ReturnList.Add(MetricWebPath + chartName);
        }
Пример #2
0
        public override List <string> CreateMetric()
        {
            base.CreateMetric();
            var signalRepository = SignalsRepositoryFactory.Create();

            Signal = signalRepository.GetVersionOfSignalByDateWithDetectionTypes(SignalID, StartDate);
            var chart = new Chart();

            HeadTitleCounter = 0;
            var timingAndActuationsForPhases = new List <TimingAndActuationsForPhase>();

            PhaseEventCodesList = ExtractListOfNumbers(PhaseEventCodes);
            int phaseCounter = 0;

            PhaseFilterList = ExtractListOfNumbers(PhaseFilter);
            if (ShowRawEventData)
            {
                for (int i = 1; i <= 16; i++)
                {
                    if (PhaseFilterList.Any() && PhaseFilterList.Contains(i) || PhaseFilterList.Count == 0)
                    {
                        var phaseOrOverlap = true;
                        timingAndActuationsForPhases.Add(new TimingAndActuationsForPhase(i, phaseOrOverlap, this));
                        timingAndActuationsForPhases[phaseCounter++].PhaseNumberSort = "Phase - " + i.ToString("D2");
                        phaseOrOverlap = false;
                        timingAndActuationsForPhases.Add(new TimingAndActuationsForPhase(i, phaseOrOverlap, this));
                        timingAndActuationsForPhases[phaseCounter++].PhaseNumberSort = "zOverlap - " + i.ToString("D2");
                    }
                }
            }
            else
            {
                if (Signal.Approaches.Count > 0)
                {
                    foreach (var approach in Signal.Approaches)
                    {
                        bool permissivePhase;
                        if (approach.PermissivePhaseNumber != null && approach.PermissivePhaseNumber > 0)
                        {
                            if (PhaseFilterList.Any() && PhaseFilterList.Contains((int)approach.PermissivePhaseNumber) ||
                                PhaseFilterList.Count == 0)
                            {
                                var permissivePhaseNumber = (int)approach.PermissivePhaseNumber;
                                permissivePhase = true;
                                timingAndActuationsForPhases.Add(
                                    new TimingAndActuationsForPhase(approach, this, permissivePhase));
                                timingAndActuationsForPhases[phaseCounter++].PhaseNumberSort =
                                    approach.PermissivePhaseNumber.Value + "-1";
                            }
                        }

                        if (approach.ProtectedPhaseNumber > 0)
                        {
                            if (PhaseFilterList.Any() && PhaseFilterList.Contains(approach.ProtectedPhaseNumber) ||
                                PhaseFilterList.Count == 0)
                            {
                                permissivePhase = false;
                                timingAndActuationsForPhases.Add(
                                    new TimingAndActuationsForPhase(approach, this, permissivePhase));
                                timingAndActuationsForPhases[phaseCounter++].PhaseNumberSort =
                                    approach.ProtectedPhaseNumber + "-2";
                            }
                        }
                    }
                }
            }
            timingAndActuationsForPhases = timingAndActuationsForPhases.OrderBy(t => t.PhaseNumberSort).ToList();
            foreach (var timingAndActutionsForPhase in timingAndActuationsForPhases)
            {
                GetChart(timingAndActutionsForPhase);
            }
            GlobalEventCodesList  = ExtractListOfNumbers(GlobalCustomEventCodes);
            GlobalEventParamsList = ExtractListOfNumbers(GlobalCustomEventParams);
            GlobalEventCounter    = 0;
            if (GlobalEventCodesList != null && GlobalEventParamsList != null &&
                GlobalEventCodesList.Any() && GlobalEventCodesList.Count > 0 &&
                GlobalEventParamsList.Any() && GlobalEventParamsList.Count > 0)
            {
                var globalGetDataTimingAndActuations = new GlobalGetDataTimingAndActuations(SignalID, this);
                GetGlobalChart(globalGetDataTimingAndActuations, this);
            }
            if (ShowLegend)
            {
                GetChartLegend();
            }
            return(ReturnList);
        }