예제 #1
0
 public ActionResult YellowAndRedOptions(int id)
 {
     MOE.Common.Business.WCFServiceLibrary.YellowAndRedOptions yellowAndRedOptions =
         new MOE.Common.Business.WCFServiceLibrary.YellowAndRedOptions();
     yellowAndRedOptions.SetDefaults();
     return(PartialView("YellowAndRedOptions", yellowAndRedOptions));
 }
예제 #2
0
 public ActionResult GetYellowAndRedMetric(MOE.Common.Business.WCFServiceLibrary.YellowAndRedOptions 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));
 }
예제 #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));
            }
        }
예제 #4
0
파일: RLMChart.cs 프로젝트: zfx1982/ATSPM
        public Chart GetChart(RLMSignalPhase signalPhase, WCFServiceLibrary.YellowAndRedOptions options)
        {
            Options = options;
            Chart    chart          = new Chart();
            TimeSpan reportTimespan = Options.EndDate - Options.StartDate;


            //Set the chart properties
            chart.ImageType        = ChartImageType.Jpeg;
            chart.Height           = 700;
            chart.Width            = 1100;
            chart.ImageStorageMode = ImageStorageMode.UseImageLocation;
            SetChartTitle(chart, signalPhase);

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

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


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

            chartArea.Name = "ChartArea1";
            if (Options.YAxisMax != null)
            {
                chartArea.AxisY.Maximum = Options.YAxisMax.Value;
            }
            chartArea.AxisY.Minimum = 0;
            chartArea.AxisY.Title   = "Yellow Red Time (Seconds) ";
            chartArea.AxisY.MinorTickMark.Enabled = true;
            chartArea.AxisY.MajorTickMark.Enabled = true;
            chartArea.AxisY.MajorGrid.Interval    = 5;
            chartArea.AxisY.MinorGrid.Interval    = 1;
            chartArea.AxisX.Title              = "Time (Hour of Day)";
            chartArea.AxisX.IntervalType       = DateTimeIntervalType.Hours;
            chartArea.AxisX.LabelStyle.Format  = "HH";
            chartArea.AxisX2.LabelStyle.Format = "HH";
            chartArea.AxisX.MajorGrid.Enabled  = true;
            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.AxisX.Minimum = 0;

            chartArea.AxisX2.Enabled = AxisEnabled.True;
            chartArea.AxisX2.MajorTickMark.Enabled = true;

            chartArea.AxisX2.IntervalType      = DateTimeIntervalType.Hours;
            chartArea.AxisX2.LabelAutoFitStyle = LabelAutoFitStyles.None;
            //chartArea.AxisX.Minimum = 0;

            chart.ChartAreas.Add(chartArea);

            Color yelowish   = Color.FromArgb(245, 237, 127);
            Color blueish    = Color.FromArgb(128, 10, 117, 182);
            Color greenish   = Color.FromArgb(64, 177, 14);
            Color tanish     = Color.FromArgb(220, 138, 78);
            Color whiteish   = Color.FromArgb(243, 240, 235);
            Color redish     = Color.FromArgb(128, 255, 0, 0);
            Color darkRedish = Color.FromArgb(196, 222, 2, 2);
            //Color redish = Color.FromArgb(163, 60, 62);

            //Add the red series
            Series redSeries = new Series();

            redSeries.ChartType = SeriesChartType.Area;
            redSeries.Color     = redish;
            //redSeries.BackGradientStyle = GradientStyle.VerticalCenter;
            redSeries.Name       = "Red";
            redSeries.XValueType = ChartValueType.DateTime;

            chart.Series.Add(redSeries);

            //Add the yellow series
            Series redClearanceSeries = new Series();

            redClearanceSeries.ChartType  = SeriesChartType.Area;
            redClearanceSeries.Color      = darkRedish;
            redClearanceSeries.Name       = "Red Clearance";
            redClearanceSeries.XValueType = ChartValueType.DateTime;
            chart.Series.Add(redClearanceSeries);

            //Add the green series
            Series yellowClearanceSeries = new Series();

            yellowClearanceSeries.ChartType = SeriesChartType.Area;
            yellowClearanceSeries.Color     = yelowish;
            //yellowClearanceSeries.BackGradientStyle = GradientStyle.DiagonalLeft;
            yellowClearanceSeries.BackSecondaryColor = yelowish;
            yellowClearanceSeries.Name       = "Yellow Clearance";
            yellowClearanceSeries.XValueType = ChartValueType.DateTime;
            chart.Series.Add(yellowClearanceSeries);

            //Add the point series
            Series pointSeries = new Series();

            pointSeries.ChartType  = SeriesChartType.Point;
            pointSeries.Color      = Color.Black;
            pointSeries.Name       = "Detector Activation";
            pointSeries.XValueType = ChartValueType.DateTime;
            pointSeries.MarkerSize = 3;
            chart.Series.Add(pointSeries);



            //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["Detector Activation"].Points.AddXY(Options.StartDate, 0);
            chart.Series["Detector Activation"].Points.AddXY(Options.EndDate, 0);

            AddDataToChart(chart, signalPhase);
            return(chart);
        }