示例#1
0
        public override List <string> CreateMetric()
        {
            base.CreateMetric();
            var signalRepository = SignalsRepositoryFactory.Create();

            Signal       = signalRepository.GetVersionOfSignalByDate(SignalID, StartDate);
            MetricTypeID = 6;
            var chart            = new Chart();
            var metricApproaches = Signal.GetApproachesForSignalThatSupportMetric(MetricTypeID);

            if (metricApproaches.Count > 0)
            {
                foreach (var approach in metricApproaches)
                {
                    var signalPhase = new SignalPhase(StartDate, EndDate, approach, ShowVolumes, SelectedBinSize,
                                                      MetricTypeID, false);
                    chart = GetNewChart();
                    AddDataToChart(chart, signalPhase);
                    var chartName = CreateFileName();
                    chart.ImageLocation = MetricFileLocation + chartName;
                    chart.SaveImage(MetricFileLocation + chartName, ChartImageFormat.Jpeg);
                    ReturnList.Add(MetricWebPath + chartName);
                }
            }

            return(ReturnList);
        }
示例#2
0
        public override List <string> CreateMetric()
        {
            base.CreateMetric();
            MOE.Common.Models.Repositories.ISignalsRepository signalRepository =
                MOE.Common.Models.Repositories.SignalsRepositoryFactory.Create();
            Signal            = signalRepository.GetSignalBySignalID(SignalID);
            this.MetricTypeID = 6;

            Chart  chart    = new Chart();
            string location = GetSignalLocation();

            //SignalPhaseCollection signalphasecollection = new SignalPhaseCollection(
            //    StartDate,
            //    EndDate,
            //    SignalID,
            //    ShowVolumes,
            //    SelectedBinSize,
            //    MetricTypeID);

            //If there are phases in the database add the charts
            //if (signalphasecollection.SignalPhaseList.Count > 0)
            //{
            //    foreach (MOE.Common.Business.SignalPhase signalPhase in signalphasecollection.SignalPhaseList)
            //    {
            //        if (signalPhase.Plans.PlanList.Count > 0)
            //        {
            //            chart = GetNewChart(signalPhase.Approach);
            //            AddDataToChart(chart, signalPhase);
            //            string chartName = CreateFileName();
            //            chart.ImageLocation = MetricFileLocation + chartName;
            //            chart.SaveImage(MetricFileLocation + chartName, System.Web.UI.DataVisualization.Charting.ChartImageFormat.Jpeg);
            //            ReturnList.Add(MetricWebPath + chartName);
            //    }

            //}
            List <Approach> metricApproaches = Signal.GetApproachesForSignalThatSupportMetric(this.MetricTypeID);

            if (metricApproaches.Count > 0)
            {
                foreach (Approach approach in metricApproaches)
                {
                    MOE.Common.Business.SignalPhase signalPhase = new SignalPhase(StartDate, EndDate, approach,
                                                                                  ShowVolumes, SelectedBinSize, MetricTypeID);

                    chart = GetNewChart(approach);
                    AddDataToChart(chart, signalPhase);
                    string chartName = CreateFileName();
                    chart.ImageLocation = MetricFileLocation + chartName;
                    chart.SaveImage(MetricFileLocation + chartName, System.Web.UI.DataVisualization.Charting.ChartImageFormat.Jpeg);
                    ReturnList.Add(MetricWebPath + chartName);
                }
            }



            return(ReturnList);
        }
示例#3
0
文件: PCDOptions.cs 项目: gmonk/ATSPM
        private void SetChartTitle(Chart chart, SignalPhase signalPhase, Dictionary <string, string> statistics)
        {
            var detectorsForMetric = signalPhase.Approach.GetDetectorsForMetricType(MetricTypeID);
            var message            = "\n Advanced detector located " + detectorsForMetric.FirstOrDefault().DistanceFromStopBar +
                                     " ft. upstream of stop bar";

            chart.Titles.Add(ChartTitleFactory.GetChartName(MetricTypeID));
            chart.Titles.Add(
                ChartTitleFactory.GetSignalLocationAndDateRangeAndMessage(signalPhase.Approach.SignalID, StartDate, EndDate,
                                                                          message));
            chart.Titles.Add(ChartTitleFactory.GetPhaseAndPhaseDescriptions(signalPhase.Approach, signalPhase.GetPermissivePhase));
            chart.Titles.Add(ChartTitleFactory.GetStatistics(statistics));
        }
示例#4
0
        void AddArrivalOnGreen(Chart chart, double totalOnGreenArrivals, double totalDetectorHits,
                               SignalPhase signalPhase)
        {
            double percentArrivalOnGreen = 0;

            if (totalDetectorHits > 0)
            {
                percentArrivalOnGreen = totalOnGreenArrivals / totalDetectorHits * 100;
            }
            var statistics = new Dictionary <string, string>();

            statistics.Add("AoG", Math.Round(percentArrivalOnGreen) + "%");
            SetChartTitle(chart, signalPhase, statistics);
        }
示例#5
0
文件: PCDOptions.cs 项目: gmonk/ATSPM
        private void AddDataToChart(Chart chart, SignalPhase signalPhase)
        {
            double totalDetectorHits    = 0;
            double totalOnGreenArrivals = 0;

            foreach (var cycle in signalPhase.Cycles)
            {
                totalOnGreenArrivals += AddCycleToChart(chart, cycle);
                totalDetectorHits    += cycle.DetectorEvents.Count;
            }
            if (ShowVolumes)
            {
                AddVolumeToChart(chart, signalPhase.Volume);
            }
            if (ShowArrivalsOnGreen)
            {
                AddArrivalOnGreen(chart, totalOnGreenArrivals, totalDetectorHits, signalPhase);
            }
            if (ShowPlanStatistics)
            {
                SetPlanStrips(signalPhase.Plans, chart);
            }
        }