/// <summary> /// Copy constructor /// </summary> /// <param name="cell">The cell to copy</param> public CompactionSummaryVolumesProfileCell(CompactionSummaryVolumesProfileCell cell) { cellType = cell.cellType; station = cell.station; lastPassHeight1 = cell.lastPassHeight1; lastPassHeight2 = cell.lastPassHeight2; designHeight = cell.designHeight; cutFill = cell.cutFill; }
/// <summary> /// Process profile request to get summary volumes profile /// </summary> /// <param name="request">Profile request</param> /// <param name="totalResult">Results for other production data profile types</param> /// <returns>Summary volumes profile</returns> private async Task <CompactionProfileDataResult> ProcessSummaryVolumes(CompactionProfileProductionDataRequest request, CompactionProfileResult <CompactionProfileDataResult> totalResult) { var volumesResult = #if RAPTOR UseTRexGateway("ENABLE_TREX_GATEWAY_PROFILING") ? #endif await ProcessSummaryVolumesWithTRexGateway(request) #if RAPTOR : ProcessSummaryVolumesWithRaptor(request) #endif ; //If we have no other profile results apart from summary volumes, set the total grid distance if (totalResult.results.Count == 0 && volumesResult != null) { totalResult.gridDistanceBetweenProfilePoints = volumesResult.gridDistanceBetweenProfilePoints; } //If we have other profile types but no summary volumes, add summary volumes with just slicer end points if (volumesResult == null && totalResult.results.Count > 0) { var startSlicer = new CompactionSummaryVolumesProfileCell(SumVolGapCell); var endSlicer = new CompactionSummaryVolumesProfileCell(SumVolGapCell); endSlicer.station = totalResult.gridDistanceBetweenProfilePoints; volumesResult = new CompactionProfileResult <CompactionSummaryVolumesProfileCell> { gridDistanceBetweenProfilePoints = totalResult.gridDistanceBetweenProfilePoints, results = new List <CompactionSummaryVolumesProfileCell> { startSlicer, endSlicer } }; } return(profileResultHelper.RearrangeProfileResult(volumesResult, request.VolumeCalcType)); }
private CompactionProfileResult <CompactionSummaryVolumesProfileCell> ProcessSummaryVolumesProfileCells(List <SummaryVolumeProfileCell> profileCells, double gridDistanceBetweenProfilePoints, VolumeCalcType calcType) { var profile = new CompactionProfileResult <CompactionSummaryVolumesProfileCell>(); profile.results = new List <CompactionSummaryVolumesProfileCell>(); SummaryVolumeProfileCell prevCell = null; foreach (var currCell in profileCells) { var gapExists = ProfilesHelper.CellGapExists(prevCell, currCell, out var prevStationIntercept); if (gapExists) { var gapCell = new CompactionSummaryVolumesProfileCell(SumVolGapCell); gapCell.station = prevStationIntercept; profile.results.Add(gapCell); } var lastPassHeight1 = currCell.LastCellPassElevation1 == VelociraptorConstants.NULL_SINGLE ? float.NaN : currCell.LastCellPassElevation1; var lastPassHeight2 = currCell.LastCellPassElevation2 == VelociraptorConstants.NULL_SINGLE ? float.NaN : currCell.LastCellPassElevation2; var designHeight = currCell.DesignElev == VelociraptorConstants.NULL_SINGLE ? float.NaN : currCell.DesignElev; float cutFill = float.NaN; switch (calcType) { case VolumeCalcType.GroundToGround: cutFill = float.IsNaN(lastPassHeight1) || float.IsNaN(lastPassHeight2) ? float.NaN : lastPassHeight2 - lastPassHeight1; break; case VolumeCalcType.GroundToDesign: cutFill = float.IsNaN(lastPassHeight1) || float.IsNaN(designHeight) ? float.NaN : designHeight - lastPassHeight1; break; case VolumeCalcType.DesignToGround: cutFill = float.IsNaN(designHeight) || float.IsNaN(lastPassHeight2) ? float.NaN : lastPassHeight2 - designHeight; break; } profile.results.Add(new CompactionSummaryVolumesProfileCell { cellType = prevCell == null ? ProfileCellType.MidPoint : ProfileCellType.Edge, station = currCell.Station, lastPassHeight1 = lastPassHeight1, lastPassHeight2 = lastPassHeight2, designHeight = designHeight, cutFill = cutFill }); prevCell = currCell; } //Add a last point at the intercept length of the last cell so profiles are drawn correctly if (prevCell != null && prevCell.InterceptLength > ProfilesHelper.ONE_MM) { var lastCell = new CompactionSummaryVolumesProfileCell(profile.results[profile.results.Count - 1]) { station = prevCell.Station + prevCell.InterceptLength }; profile.results.Add(lastCell); } if (profile.results.Count > 0) { profile.results[profile.results.Count - 1].cellType = ProfileCellType.MidPoint; } profile.gridDistanceBetweenProfilePoints = gridDistanceBetweenProfilePoints; var sb = new StringBuilder(); sb.Append($"After summary volumes profile conversion: {profile.results.Count}"); foreach (var cell in profile.results) { sb.Append($",{cell.cellType}"); } log.LogDebug(sb.ToString()); return(profile); }