示例#1
0
 /// <summary>
 /// Creates an instance of the CompactionColorPalettesResult class.
 /// </summary>
 /// <returns>An instance of the CompactionColorPalettesResult class.</returns>
 public static CompactionColorPalettesResult CreateCompactionColorPalettesResult(
     DetailPalette cmvDetailPalette,
     DetailPalette passCountDetailPalette,
     SummaryPalette passCountSummaryPalette,
     DetailPalette cutFillPalette,
     SummaryPalette temperatureSummaryPalette,
     SummaryPalette cmvSummaryPalette,
     SummaryPalette mdpSummaryPalette,
     DetailPalette cmvPercentChangePalette,
     SummaryPalette speedSummaryPalette,
     DetailPalette temperatureDetailPalette)
 {
     return(new CompactionColorPalettesResult
     {
         CmvDetailPalette = cmvDetailPalette,
         PassCountDetailPalette = passCountDetailPalette,
         PassCountSummaryPalette = passCountSummaryPalette,
         CutFillPalette = cutFillPalette,
         TemperatureSummaryPalette = temperatureSummaryPalette,
         CmvSummaryPalette = cmvSummaryPalette,
         MdpSummaryPalette = mdpSummaryPalette,
         CmvPercentChangePalette = cmvPercentChangePalette,
         SpeedSummaryPalette = speedSummaryPalette,
         TemperatureDetailPalette = temperatureDetailPalette
     });
 }
示例#2
0
        public async Task <CompactionColorPalettesResult> GetColorPalettes(
            [FromQuery] Guid projectUid)
        {
            Log.LogInformation("GetColorPalettes: " + Request.QueryString);
            var projectSettings       = GetProjectSettingsTargets(projectUid);
            var projectSettingsColors = GetProjectSettingsColors(projectUid);

            await Task.WhenAll(projectSettings, projectSettingsColors);

            //Note: elevation palette is a separate call as it requires a filter
            List <DisplayMode> modes = new List <DisplayMode>
            {
                DisplayMode.CCV,
                DisplayMode.PassCount,
                DisplayMode.PassCountSummary,
                DisplayMode.CutFill,
                DisplayMode.TemperatureSummary,
                DisplayMode.CCVPercentSummary,
                DisplayMode.MDPPercentSummary,
                DisplayMode.TargetSpeedSummary,
                DisplayMode.CMVChange,
                DisplayMode.TemperatureDetail
            };

            DetailPalette  cmvDetailPalette          = null;
            DetailPalette  passCountDetailPalette    = null;
            SummaryPalette passCountSummaryPalette   = null;
            DetailPalette  cutFillPalette            = null;
            SummaryPalette temperatureSummaryPalette = null;
            SummaryPalette cmvSummaryPalette         = null;
            SummaryPalette mdpSummaryPalette         = null;
            DetailPalette  cmvPercentChangePalette   = null;
            SummaryPalette speedSummaryPalette       = null;
            DetailPalette  temperatureDetailPalette  = null;

            foreach (var mode in modes)
            {
                List <ColorValue> colorValues;
                var compactionPalette = SettingsManager.CompactionPalette(mode, null, projectSettings.Result, projectSettingsColors.Result);
                switch (mode)
                {
                case DisplayMode.CCV:
                    colorValues = new List <ColorValue>();
                    for (int i = 0; i < compactionPalette.Count; i++)
                    {
                        colorValues.Add(ColorValue.CreateColorValue(compactionPalette[i].Color,
                                                                    compactionPalette[i].Value / 10));//Raptor CMV is 10ths but return actual CMV to UI
                    }
                    cmvDetailPalette = DetailPalette.CreateDetailPalette(colorValues, null, null);
                    break;

                case DisplayMode.PassCount:
                    colorValues = new List <ColorValue>();
                    for (int i = 0; i < compactionPalette.Count - 1; i++)
                    {
                        colorValues.Add(ColorValue.CreateColorValue(compactionPalette[i].Color,
                                                                    compactionPalette[i].Value));
                    }
                    passCountDetailPalette = DetailPalette.CreateDetailPalette(colorValues,
                                                                               compactionPalette[compactionPalette.Count - 1].Color, null);
                    break;

                case DisplayMode.PassCountSummary:
                    passCountSummaryPalette = SummaryPalette.CreateSummaryPalette(compactionPalette[2].Color,
                                                                                  compactionPalette[1].Color, compactionPalette[0].Color);
                    break;

                case DisplayMode.CutFill:
                    colorValues = new List <ColorValue>();
                    for (int i = compactionPalette.Count - 1; i >= 0; i--)
                    {
                        colorValues.Add(ColorValue.CreateColorValue(compactionPalette[i].Color,
                                                                    compactionPalette[i].Value));
                    }
                    cutFillPalette = DetailPalette.CreateDetailPalette(colorValues, null, null);
                    break;

                case DisplayMode.TemperatureSummary:
                    temperatureSummaryPalette = SummaryPalette.CreateSummaryPalette(compactionPalette[2].Color,
                                                                                    compactionPalette[1].Color, compactionPalette[0].Color);
                    break;

                case DisplayMode.CCVPercentSummary:
                    cmvSummaryPalette = SummaryPalette.CreateSummaryPalette(compactionPalette[3].Color,
                                                                            compactionPalette[0].Color, compactionPalette[2].Color);
                    break;

                case DisplayMode.MDPPercentSummary:
                    mdpSummaryPalette = SummaryPalette.CreateSummaryPalette(compactionPalette[3].Color,
                                                                            compactionPalette[0].Color, compactionPalette[2].Color);
                    break;

                case DisplayMode.TargetSpeedSummary:
                    speedSummaryPalette = SummaryPalette.CreateSummaryPalette(compactionPalette[2].Color,
                                                                              compactionPalette[1].Color, compactionPalette[0].Color);
                    break;

                case DisplayMode.CMVChange:
                    colorValues = new List <ColorValue>();
                    for (int i = 0; i < compactionPalette.Count - 1; i++)
                    {
                        colorValues.Add(ColorValue.CreateColorValue(compactionPalette[i].Color,
                                                                    compactionPalette[i].Value));
                    }
                    cmvPercentChangePalette = DetailPalette.CreateDetailPalette(colorValues,
                                                                                compactionPalette[compactionPalette.Count - 1].Color, null);
                    break;

                case DisplayMode.TemperatureDetail:
                    colorValues = new List <ColorValue>();
                    for (int i = 0; i < compactionPalette.Count; i++)
                    {
                        colorValues.Add(ColorValue.CreateColorValue(compactionPalette[i].Color,
                                                                    compactionPalette[i].Value / 10));//Raptor Temperature is 10ths but return actual Temperature to UI
                    }
                    temperatureDetailPalette = DetailPalette.CreateDetailPalette(colorValues, null, null);
                    break;
                }
            }
            return(CompactionColorPalettesResult.CreateCompactionColorPalettesResult(
                       cmvDetailPalette, passCountDetailPalette, passCountSummaryPalette, cutFillPalette, temperatureSummaryPalette,
                       cmvSummaryPalette, mdpSummaryPalette, cmvPercentChangePalette, speedSummaryPalette, temperatureDetailPalette));
        }