Esempio n. 1
0
 public ActionResult ApproachDelayOptions(int id)
 {
     MOE.Common.Business.WCFServiceLibrary.ApproachDelayOptions approachDelayOptions =
         new MOE.Common.Business.WCFServiceLibrary.ApproachDelayOptions();
     approachDelayOptions.SetDefaults();
     return(PartialView("ApproachDelayOptions", approachDelayOptions));
 }
Esempio n. 2
0
 public ActionResult GetApproachDelayMetric(MOE.Common.Business.WCFServiceLibrary.ApproachDelayOptions metricOptions)
 {
     metricOptions.MetricType = GetMetricType(metricOptions.MetricTypeID);
     string[] result = new string[1] {
         ""
     };
     if (ModelState.IsValid)
     {
         MetricGeneratorService.MetricGeneratorClient client =
             new MetricGeneratorService.MetricGeneratorClient();
         try
         {
             client.Open();
             result = client.CreateMetric(metricOptions);
             client.Close();
         }
         catch (Exception ex)
         {
             client.Close();
             return(Content("<h1>" + ex.Message + "</h1>"));
         }
     }
     return(PartialView("MetricResult", result));
 }
Esempio n. 3
0
        public ActionResult MetricOptions(int id)
        {
            switch (id)
            {
            case 1:
                MOE.Common.Business.WCFServiceLibrary.PhaseTerminationOptions phaseTerminationOptions =
                    new MOE.Common.Business.WCFServiceLibrary.PhaseTerminationOptions();
                phaseTerminationOptions.SetDefaults();
                return(PartialView("PhaseTerminationOptions", phaseTerminationOptions));

            case 2:
                MOE.Common.Business.WCFServiceLibrary.SplitMonitorOptions SplitMonitorOptions =
                    new MOE.Common.Business.WCFServiceLibrary.SplitMonitorOptions();
                return(PartialView("SplitMonitorOptions", SplitMonitorOptions));

            case 3:
                MOE.Common.Business.WCFServiceLibrary.PedDelayOptions pedDelayOptions =
                    new MOE.Common.Business.WCFServiceLibrary.PedDelayOptions();
                pedDelayOptions.SetDefaults();
                return(PartialView("PedDelayOptions", pedDelayOptions));

            case 5:
                MOE.Common.Business.WCFServiceLibrary.TMCOptions tMCOptions =
                    new MOE.Common.Business.WCFServiceLibrary.TMCOptions();
                tMCOptions.SetDefaults();
                return(PartialView("TMCOptions", tMCOptions));

            case 4:
                MOE.Common.Business.WCFServiceLibrary.MetricOptions preemptOptions =
                    new MOE.Common.Business.WCFServiceLibrary.MetricOptions();
                preemptOptions.YAxisMax  = 3;
                preemptOptions.Y2AxisMax = 10;
                return(PartialView("PreemptOptions", preemptOptions));

            case 6:
                MOE.Common.Business.WCFServiceLibrary.PCDOptions pcdOptions =
                    new MOE.Common.Business.WCFServiceLibrary.PCDOptions();
                return(PartialView("PCDOptions", pcdOptions));

            case 7:
                MOE.Common.Business.WCFServiceLibrary.ApproachVolumeOptions approachVolumeOptions =
                    new MOE.Common.Business.WCFServiceLibrary.ApproachVolumeOptions();
                return(PartialView("ApproachVolumeOptions", approachVolumeOptions));

            case 8:
                MOE.Common.Business.WCFServiceLibrary.ApproachDelayOptions approachDelayOptions =
                    new MOE.Common.Business.WCFServiceLibrary.ApproachDelayOptions();
                approachDelayOptions.SetDefaults();
                return(PartialView("ApproachDelayOptions", approachDelayOptions));

            case 9:
                MOE.Common.Business.WCFServiceLibrary.AoROptions aoROptions =
                    new MOE.Common.Business.WCFServiceLibrary.AoROptions();
                aoROptions.SetDefaults();
                return(PartialView("AoROptions", aoROptions));

            case 10:
                MOE.Common.Business.WCFServiceLibrary.ApproachSpeedOptions approachSpeedOptions =
                    new MOE.Common.Business.WCFServiceLibrary.ApproachSpeedOptions();
                approachSpeedOptions.SetDefaults();
                return(PartialView("ApproachSpeedOptions", approachSpeedOptions));

            case 11:
                MOE.Common.Business.WCFServiceLibrary.YellowAndRedOptions yellowAndRedOptions =
                    new MOE.Common.Business.WCFServiceLibrary.YellowAndRedOptions();
                yellowAndRedOptions.SetDefaults();
                return(PartialView("YellowAndRedOptions", yellowAndRedOptions));

            case 12:
            default:
                MOE.Common.Business.WCFServiceLibrary.SplitFailOptions splitFailOptions =
                    new MOE.Common.Business.WCFServiceLibrary.SplitFailOptions();
                splitFailOptions.SetDefaults();
                return(PartialView("SplitFailOptions", splitFailOptions));
            }
        }
Esempio n. 4
0
        public DelayChart(WCFServiceLibrary.ApproachDelayOptions options, MOE.Common.Business.SignalPhase signalPhase)
        {
            Options = options;
            TimeSpan reportTimespan    = Options.EndDate - Options.StartDate;
            string   extendedDirection = signalPhase.Approach.DirectionType.Description;

            //Set the chart properties
            chart.ImageStorageMode = ImageStorageMode.UseImageLocation;
            chart.ImageType        = ChartImageType.Jpeg;
            chart.Height           = 550;
            chart.Width            = 1100;


            //Create the chart legend
            Legend chartLegend = new Legend();

            chartLegend.Name    = "MainLegend";
            chartLegend.Docking = Docking.Left;
            chart.Legends.Add(chartLegend);


            //Create the chart area
            ChartArea chartArea = new ChartArea();

            chartArea.Name = "ChartArea1";

            //Primary Y axis (delay per vehicle)
            if (Options.ShowDelayPerVehicle)
            {
                if (Options.YAxisMax != null)
                {
                    chartArea.AxisY.Maximum = Options.YAxisMax.Value;
                }
                chartArea.AxisY.Minimum = 0;
                chartArea.AxisY.Enabled = AxisEnabled.True;
                chartArea.AxisY.MajorTickMark.Enabled = true;
                chartArea.AxisY.MajorGrid.Enabled     = true;
                chartArea.AxisY.Interval       = 5;
                chartArea.AxisY.TitleForeColor = Color.Blue;
                chartArea.AxisY.Title          = "Delay Per Vehicle (Seconds) ";
            }

            //secondary y axis (total delay)
            if (Options.ShowDelayPerVehicle)
            {
                if (Options.Y2AxisMax != null && Options.Y2AxisMax > 0)
                {
                    chartArea.AxisY2.Maximum = Options.Y2AxisMax.Value;
                }
                else
                {
                    chartArea.AxisY2.Maximum = 50000;
                }
                chartArea.AxisY2.Minimum = 0;
                chartArea.AxisY2.Enabled = AxisEnabled.True;
                chartArea.AxisY2.MajorTickMark.Enabled = true;
                chartArea.AxisY2.MajorGrid.Enabled     = false;
                chartArea.AxisY2.Interval       = 5000;
                chartArea.AxisY2.Title          = "Delay per Hour (Seconds) ";
                chartArea.AxisY2.TitleForeColor = Color.Red;
            }
            chartArea.AxisX.Title              = "Time (Hour of Day)";
            chartArea.AxisX.IntervalType       = DateTimeIntervalType.Hours;
            chartArea.AxisX.LabelStyle.Format  = "HH";
            chartArea.AxisX2.LabelStyle.Format = "HH";
            if (reportTimespan.Days < 1)
            {
                if (reportTimespan.Hours > 1)
                {
                    chartArea.AxisX2.Interval = 1;
                    chartArea.AxisX.Interval  = 1;
                }
                else
                {
                    chartArea.AxisX.LabelStyle.Format  = "HH:mm";
                    chartArea.AxisX2.LabelStyle.Format = "HH:mm";
                }
            }
            chartArea.AxisX2.Enabled = AxisEnabled.True;
            chartArea.AxisX2.MajorTickMark.Enabled = true;
            chartArea.AxisX2.IntervalType          = DateTimeIntervalType.Hours;
            chartArea.AxisX2.LabelAutoFitStyle     = LabelAutoFitStyles.None;

            chart.ChartAreas.Add(chartArea);


            //Add the point series

            Series delayPerVehicleSeries = new Series();

            delayPerVehicleSeries.ChartType  = SeriesChartType.Line;
            delayPerVehicleSeries.Color      = Color.Blue;
            delayPerVehicleSeries.Name       = "Approach Delay Per Vehicle";
            delayPerVehicleSeries.YAxisType  = AxisType.Primary;
            delayPerVehicleSeries.XValueType = ChartValueType.DateTime;

            Series delaySeries = new Series();

            delaySeries.ChartType  = SeriesChartType.Line;
            delaySeries.Color      = Color.Red;
            delaySeries.Name       = "Approach Delay";
            delaySeries.YAxisType  = AxisType.Secondary;
            delaySeries.XValueType = ChartValueType.DateTime;



            Series pointSeries = new Series();

            pointSeries.ChartType         = SeriesChartType.Point;
            pointSeries.Color             = Color.White;
            pointSeries.Name              = "Posts";
            pointSeries.XValueType        = ChartValueType.DateTime;
            pointSeries.IsVisibleInLegend = false;


            chart.Series.Add(pointSeries);
            chart.Series.Add(delaySeries);
            chart.Series.Add(delayPerVehicleSeries);



            //Add points at the start and and of the x axis to ensure
            //the graph covers the entire period selected by the user
            //whether there is data or not
            chart.Series["Posts"].Points.AddXY(Options.StartDate, 0);
            chart.Series["Posts"].Points.AddXY(Options.EndDate, 0);

            AddDataToChart(chart, signalPhase, Options.StartDate, Options.EndDate, Options.SelectedBinSize,
                           signalPhase.Approach.SignalID, Options.ShowTotalDelayPerHour, Options.ShowDelayPerVehicle);
            SetPlanStrips(signalPhase.Plans.PlanList, chart, Options.StartDate, Options.ShowPlanStatistics);
        }