Esempio n. 1
0
        public void PD_PostProfileProductionDataFailed()
        {
            ProfileProductionDataRequest request = CreateRequest();
            MemoryStream raptorResult            = null;

            Assert.IsTrue(RaptorConverters.DesignDescriptor(request.AlignmentDesign).IsNull(), "A linear profile expected.");

            ProfilesHelper.ConvertProfileEndPositions(request.GridPoints, request.WGS84Points, out TWGS84Point startPt, out var endPt, out bool positionsAreGrid);

            TASNodeServiceRPCVerb_RequestProfile_Args args
                = __Global.Construct_RequestProfile_Args
                      (request.ProjectId.Value,
                      -1, // don't care
                      positionsAreGrid,
                      startPt,
                      endPt,
                      RaptorConverters.ConvertFilter(request.Filter),
                      RaptorConverters.ConvertLift(request.LiftBuildSettings, TFilterLayerMethod.flmAutomatic),
                      RaptorConverters.DesignDescriptor(request.AlignmentDesign),
                      request.ReturnAllPassesAndLayers);

            // Create the mock PDSClient with successful result...
            var mockRaptorClient = new Mock <IASNodeClient>();
            var mockLogger       = new Mock <ILoggerFactory>();
            var mockConfigStore  = new Mock <IConfigurationStore>();

            mockRaptorClient.Setup(prj => prj.GetProfile(It.IsAny <TASNodeServiceRPCVerb_RequestProfile_Args>() /*args*/)).Returns(raptorResult);

            // Create an executor...
            var executor = RequestExecutorContainerFactory.Build <ProfileProductionDataExecutor>(mockLogger.Object, mockRaptorClient.Object, configStore: mockConfigStore.Object);

            Assert.ThrowsExceptionAsync <ServiceException>(async() => await executor.ProcessAsync(request));
        }
Esempio n. 2
0
        private ContractExecutionResult ProcessWithRaptor(ExportReport request)
        {
            var raptorFilter = RaptorConverters.ConvertFilter(request.Filter, request.ProjectId, raptorClient);

            bool success = raptorClient.GetProductionDataExport(request.ProjectId ?? VelociraptorConstants.NO_PROJECT_ID,
                                                                ASNodeRPC.__Global.Construct_TASNodeRequestDescriptor(request.CallId ?? Guid.NewGuid(), 0,
                                                                                                                      TASNodeCancellationDescriptorType.cdtProdDataExport),
                                                                RaptorConverters.convertToRaptorUserPreferences(request.UserPrefs), (int)request.ExportType, request.CallerId, raptorFilter,
                                                                RaptorConverters.ConvertLift(request.LiftBuildSettings, raptorFilter.LayerMethod),
                                                                request.TimeStampRequired, request.CellSizeRequired, request.RawData, request.RestrictSize, true,
                                                                request.Tolerance, request.IncludeSurveydSurface,
                                                                request.Precheckonly, request.Filename, RaptorConverters.convertToRaptorMachines(request.MachineList), (int)request.CoordType, (int)request.OutputType,
                                                                request.DateFromUTC, request.DateToUTC,
                                                                RaptorConverters.convertToRaptorTranslations(request.Translations),
                                                                RaptorConverters.convertToRaptorProjectExtents(request.ProjectExtents), out var dataexport);

            if (success)
            {
                try
                {
                    return(ExportResult.Create(
                               File.ReadAllBytes(BuildFilePath(request.ProjectId ?? VelociraptorConstants.NO_PROJECT_ID, request.CallerId, request.Filename, true)),
                               dataexport.ReturnCode));
                }
                catch (Exception ex)
                {
                    throw new ServiceException(HttpStatusCode.NoContent,
                                               new ContractExecutionResult(ContractExecutionStatesEnum.ValidationError,
                                                                           "Failed to retrieve received export data: " + ex.Message));
                }
            }

            throw CreateServiceException <ExportReportExecutor>(dataexport.ReturnCode);
        }
Esempio n. 3
0
        private CellPassesV2Result GetRaptorResult(CellPassesRequest request)
        {
            bool   isGridCoord  = request.probePositionGrid != null;
            bool   isLatLgCoord = request.probePositionLL != null;
            double probeX       = isGridCoord ? request.probePositionGrid.x : (isLatLgCoord ? request.probePositionLL.Lon : 0);
            double probeY       = isGridCoord ? request.probePositionGrid.y : (isLatLgCoord ? request.probePositionLL.Lat : 0);

            var raptorFilter = RaptorConverters.ConvertFilter(request.filter, request.ProjectId, raptorClient, overrideAssetIds: new List <long>());

            int code = raptorClient.RequestCellProfile
                           (request.ProjectId ?? VelociraptorConstants.NO_PROJECT_ID,
                           RaptorConverters.convertCellAddress(request.cellAddress ?? new CellAddress()),
                           probeX, probeY,
                           isGridCoord,
                           RaptorConverters.ConvertLift(request.liftBuildSettings, raptorFilter.LayerMethod),
                           request.gridDataType,
                           raptorFilter,
                           out var profile);


            if (code == 1)//TICServerRequestResult.icsrrNoError
            {
                return(ConvertRaptorResult(profile));
            }

            return(null);
        }
Esempio n. 4
0
        public void CompactionReportStationOffsetExecutor_Raptor_NoResult()
        {
            var userPreferences = new UserPreferenceData {
                Language = "en-US"
            };
            var request = CompactionReportStationOffsetRequest.CreateRequest(
                33, null, null, 0, null, true, true, true, true, true, true, null, null, 0, 0, 0, null, userPreferences, "New Zealand Standard Time");
            var filterSettings          = RaptorConverters.ConvertFilter(request.Filter);
            var cutfillDesignDescriptor = RaptorConverters.DesignDescriptor(request.DesignFile);
            var alignmentDescriptor     = RaptorConverters.DesignDescriptor(request.AlignmentFile);
            var TASNodeUserPreference   = ExportRequestHelper.ConvertToRaptorUserPreferences(request.UserPreferences, request.ProjectTimezone);

            var options = RaptorConverters.convertOptions(null, request.LiftBuildSettings, 0,
                                                          request.Filter?.LayerType ?? FilterLayerMethod.None, DisplayMode.Height, false);

            var mockConfigStore = new Mock <IConfigurationStore>();

            mockConfigStore.Setup(x => x.GetValueBool("ENABLE_TREX_GATEWAY_STATIONOFFSET")).Returns(false);

            MemoryStream responseData;

            var raptorClient = new Mock <IASNodeClient>();

            var args = ASNode.StationOffsetReport.RPC.__Global.Construct_StationOffsetReport_Args(
                request.ProjectId ?? VelociraptorConstants.NO_PROJECT_ID,
                (int)CompactionReportType.StationOffset,
                ASNodeRPC.__Global.Construct_TASNodeRequestDescriptor(Guid.NewGuid(), 0,
                                                                      TASNodeCancellationDescriptorType.cdtProdDataReport),
                TASNodeUserPreference,
                alignmentDescriptor,
                cutfillDesignDescriptor,
                request.StartStation,
                request.EndStation,
                request.Offsets,
                request.CrossSectionInterval,
                request.ReportElevation,
                request.ReportCutFill,
                request.ReportCMV,
                request.ReportMDP,
                request.ReportPassCount,
                request.ReportTemperature,
                (int)GridReportOption.Unused,
                0, 0, 0, 0, 0, 0, 0, // Northings, Eastings and Direction values are not used on Station Offset report.
                filterSettings,
                RaptorConverters.ConvertLift(request.LiftBuildSettings, filterSettings.LayerMethod),
                options
                );

            raptorClient.Setup(x => x.GetReportStationOffset(args, out responseData)).Returns(0); // icsrrUnknownError
            var executor = RequestExecutorContainerFactory
                           .Build <CompactionReportStationOffsetExecutor>(_logger, raptorClient.Object, configStore: mockConfigStore.Object);

            Assert.ThrowsExceptionAsync <ServiceException>(async() => await executor.ProcessAsync(request));
        }
Esempio n. 5
0
        protected override async Task <ContractExecutionResult> ProcessAsyncEx <T>(T item)
        {
            try
            {
                var request = CastRequestObjectTo <CutFillDetailsRequest>(item);
#if RAPTOR
                if (UseTRexGateway("ENABLE_TREX_GATEWAY_CUTFILL"))
                {
#endif
                var trexRequest = new TRexCutFillDetailsRequest(
                    request.ProjectUid.Value,
                    request.CutFillTolerances,
                    request.Filter,
                    request.DesignDescriptor,
                    AutoMapperUtility.Automapper.Map <OverridingTargets>(request.LiftBuildSettings),
                    AutoMapperUtility.Automapper.Map <LiftSettings>(request.LiftBuildSettings));
                return(await trexCompactionDataProxy.SendDataPostRequest <CompactionCutFillDetailedResult, TRexCutFillDetailsRequest>(trexRequest, "/cutfill/details", customHeaders));

#if RAPTOR
            }

            var filter            = RaptorConverters.ConvertFilter(request.Filter, request.ProjectId, raptorClient);
            var designDescriptor  = RaptorConverters.DesignDescriptor(request.DesignDescriptor);
            var liftBuildSettings =
                RaptorConverters.ConvertLift(request.LiftBuildSettings, TFilterLayerMethod.flmNone);

            var raptorResult = raptorClient.GetCutFillDetails(request.ProjectId ?? VelociraptorConstants.NO_PROJECT_ID,
                                                              ASNodeRPC.__Global.Construct_TASNodeRequestDescriptor(Guid.NewGuid(), 0, TASNodeCancellationDescriptorType.cdtCutfillDetailed),
                                                              new TCutFillSettings
            {
                Offsets          = request.CutFillTolerances,
                DesignDescriptor = designDescriptor
            }
                                                              ,
                                                              filter,
                                                              liftBuildSettings,
                                                              out var cutFillDetails);

            if (raptorResult == TASNodeErrorStatus.asneOK)
            {
                return(new CompactionCutFillDetailedResult(cutFillDetails.Percents));
            }

            throw CreateServiceException <CompactionCutFillExecutor>((int)raptorResult);
#endif
            }
            finally
            {
                ContractExecutionStates.ClearDynamic();
            }
        }
Esempio n. 6
0
        private ContractExecutionResult ProcessWithRaptor(CompactionReportStationOffsetRequest request)
        {
            var filterSettings          = RaptorConverters.ConvertFilter(request.Filter, request.ProjectId, raptorClient);
            var cutfillDesignDescriptor = RaptorConverters.DesignDescriptor(request.DesignFile);
            var alignmentDescriptor     = RaptorConverters.DesignDescriptor(request.AlignmentFile);
            var userPreferences         =
                ExportRequestHelper.ConvertToRaptorUserPreferences(request.UserPreferences, request.ProjectTimezone);

            var options = RaptorConverters.convertOptions(null, request.LiftBuildSettings, 0,
                                                          request.Filter?.LayerType ?? FilterLayerMethod.None, DisplayMode.Height, false);

            log.LogDebug($"{nameof(ProcessWithRaptor)}: About to call GetReportStationOffset");

            var args = ASNode.StationOffsetReport.RPC.__Global.Construct_StationOffsetReport_Args(
                request.ProjectId ?? VelociraptorConstants.NO_PROJECT_ID,
                (int)CompactionReportType.StationOffset,
                ASNodeRPC.__Global.Construct_TASNodeRequestDescriptor(Guid.NewGuid(), 0,
                                                                      TASNodeCancellationDescriptorType.cdtProdDataReport),
                userPreferences,
                alignmentDescriptor,
                cutfillDesignDescriptor,
                request.StartStation,
                request.EndStation,
                request.Offsets,
                request.CrossSectionInterval,
                request.ReportElevation,
                request.ReportCutFill,
                request.ReportCMV,
                request.ReportMDP,
                request.ReportPassCount,
                request.ReportTemperature,
                (int)GridReportOption.Unused,
                0, 0, 0, 0, 0, 0, 0, // Northings, Eastings and Direction values are not used on Station Offset report.
                filterSettings,
                RaptorConverters.ConvertLift(request.LiftBuildSettings, filterSettings.LayerMethod),
                options
                );

            int raptorResult = raptorClient.GetReportStationOffset(args, out var responseData);

            if (raptorResult == 1) // icsrrNoError
            {
                return(responseData.Length > 0
          ? ConvertStationOffsetResult(request, responseData)
          : CreateNullStationOffsetReturnedResult());
            }

            throw CreateServiceException <CompactionReportStationOffsetExecutor>();
        }
Esempio n. 7
0
        private CompactionProfileResult <CompactionProfileCell> ProcessProductionDataWithRaptor(
            CompactionProfileProductionDataRequest request)
        {
            MemoryStream memoryStream;

            var filter              = RaptorConverters.ConvertFilter(request.Filter, request.ProjectId, raptorClient);
            var designDescriptor    = RaptorConverters.DesignDescriptor(request.CutFillDesignDescriptor);
            var alignmentDescriptor = RaptorConverters.DesignDescriptor(request.AlignmentDesign);
            var liftBuildSettings   =
                RaptorConverters.ConvertLift(request.LiftBuildSettings, TFilterLayerMethod.flmNone);

            ProfilesHelper.ConvertProfileEndPositions(request.GridPoints, request.WGS84Points, out var startPt, out var endPt,
                                                      out var positionsAreGrid);

            if (request.IsAlignmentDesign)
            {
                var args
                    = ASNode.RequestAlignmentProfile.RPC.__Global.Construct_RequestAlignmentProfile_Args
                          (request.ProjectId ?? VelociraptorConstants.NO_PROJECT_ID,
                          ProfilesHelper.PROFILE_TYPE_NOT_REQUIRED,
                          request.StartStation ?? ValidationConstants3D.MIN_STATION,
                          request.EndStation ?? ValidationConstants3D.MIN_STATION,
                          alignmentDescriptor,
                          filter,
                          liftBuildSettings,
                          designDescriptor,
                          request.ReturnAllPassesAndLayers);

                memoryStream = raptorClient.GetAlignmentProfile(args);
            }
            else
            {
                var args
                    = ASNode.RequestProfile.RPC.__Global.Construct_RequestProfile_Args
                          (request.ProjectId ?? VelociraptorConstants.NO_PROJECT_ID,
                          ProfilesHelper.PROFILE_TYPE_HEIGHT,
                          positionsAreGrid,
                          startPt,
                          endPt,
                          filter,
                          liftBuildSettings,
                          designDescriptor,
                          request.ReturnAllPassesAndLayers);

                memoryStream = raptorClient.GetProfile(args);
            }

            return(memoryStream != null?ConvertProfileResult(memoryStream, request.LiftBuildSettings) : null);
        }
Esempio n. 8
0
        /// <summary>
        /// Processes the summary CMV request by passing the request to Raptor and returning the result.
        /// </summary>
        protected override async Task <ContractExecutionResult> ProcessAsyncEx <T>(T item)
        {
            try
            {
                var request = CastRequestObjectTo <CMVRequest>(item);
#if RAPTOR
                if (configStore.GetValueBool("ENABLE_TREX_GATEWAY_CMV") ?? false)
                {
#endif
                await PairUpAssetIdentifiers(request.ProjectUid.Value, request.Filter);
                await PairUpImportedFileIdentifiers(request.ProjectUid.Value, filter1 : request.Filter);

                var cmvSummaryRequest = new CMVSummaryRequest(
                    request.ProjectUid.Value,
                    request.Filter,
                    request.CmvSettings.CmvTarget,
                    request.CmvSettings.OverrideTargetCMV,
                    request.CmvSettings.MaxCMVPercent,
                    request.CmvSettings.MinCMVPercent, AutoMapperUtility.Automapper.Map <LiftSettings>(request.LiftBuildSettings));
                log.LogDebug($"{nameof(SummaryCMVExecutor)} trexRequest {JsonConvert.SerializeObject(cmvSummaryRequest)}");

                return(await trexCompactionDataProxy.SendDataPostRequest <CMVSummaryResult, CMVSummaryRequest>(cmvSummaryRequest, "/cmv/summary", customHeaders));

#if RAPTOR
            }

            var raptorFilter = RaptorConverters.ConvertFilter(request.Filter, request.ProjectId, raptorClient, request.OverrideStartUTC, request.OverrideEndUTC, request.OverrideAssetIds);

            var raptorResult = raptorClient.GetCMVSummary(request.ProjectId ?? VelociraptorConstants.NO_PROJECT_ID,
                                                          ASNodeRPC.__Global.Construct_TASNodeRequestDescriptor(request.CallId ?? Guid.NewGuid(), 0, TASNodeCancellationDescriptorType.cdtCMVSummary),
                                                          ConvertSettings(request.CmvSettings),
                                                          raptorFilter,
                                                          RaptorConverters.ConvertLift(request.LiftBuildSettings, raptorFilter.LayerMethod),
                                                          out var cmvSummary);

            if (raptorResult == TASNodeErrorStatus.asneOK)
            {
                return(ConvertResult(cmvSummary));
            }

            throw CreateServiceException <SummaryCMVExecutor>((int)raptorResult);
#endif
            }
            finally
            {
                ContractExecutionStates.ClearDynamic();
            }
        }
Esempio n. 9
0
        protected virtual bool GetCellDatumData(CellDatumRequest request, out TCellProductionData data)
        {
            var raptorFilter = RaptorConverters.ConvertFilter(request.Filter, request.ProjectId, raptorClient);

            return(raptorClient.GetCellProductionData
                       (request.ProjectId ?? VelociraptorConstants.NO_PROJECT_ID,
                       (int)RaptorConverters.convertDisplayMode(request.DisplayMode),
                       request.GridPoint?.x ?? 0,
                       request.GridPoint?.y ?? 0,
                       request.LLPoint != null ? RaptorConverters.ConvertWGSPoint(request.LLPoint) : new TWGS84Point(),
                       request.LLPoint == null,
                       raptorFilter,
                       RaptorConverters.ConvertLift(request.LiftBuildSettings, raptorFilter.LayerMethod),
                       RaptorConverters.DesignDescriptor(request.Design),
                       out data));
        }
Esempio n. 10
0
        protected override async Task <ContractExecutionResult> ProcessAsyncEx <T>(T item)
        {
            var request = CastRequestObjectTo <TemperatureDetailsRequest>(item);

            var temperatureTargets = request.Targets.Select(t => (int)t).ToArray(); // already converted to 10ths

#if RAPTOR
            if (UseTRexGateway("ENABLE_TREX_GATEWAY_TEMPERATURE"))
            {
#endif
            var temperatureDetailsRequest = new TemperatureDetailRequest(
                request.ProjectUid.Value,
                request.Filter,
                temperatureTargets,
                AutoMapperUtility.Automapper.Map <OverridingTargets>(request.LiftBuildSettings),
                AutoMapperUtility.Automapper.Map <LiftSettings>(request.LiftBuildSettings));

            var temperatureDetailsResult = await trexCompactionDataProxy.SendDataPostRequest <TemperatureDetailResult, TemperatureDetailRequest>(temperatureDetailsRequest, "/temperature/details", customHeaders);

            return(new CompactionTemperatureDetailResult(temperatureDetailsResult));

#if RAPTOR
        }

        var filter            = RaptorConverters.ConvertFilter(request.Filter, request.ProjectId, raptorClient);
        var liftBuildSettings =
            RaptorConverters.ConvertLift(request.LiftBuildSettings, TFilterLayerMethod.flmNone);

        var raptorResult = raptorClient.GetTemperatureDetails(request.ProjectId ?? VelociraptorConstants.NO_PROJECT_ID,
                                                              ASNodeRPC.__Global.Construct_TASNodeRequestDescriptor(Guid.NewGuid(), 0, TASNodeCancellationDescriptorType.cdtTemperatureDetailed),
                                                              new TTemperatureDetailSettings
        {
            TemperatureList = temperatureTargets,
        }
                                                              ,
                                                              filter,
                                                              liftBuildSettings,
                                                              out var temperatureDetails);

        if (raptorResult == TASNodeErrorStatus.asneOK)
        {
            return(new CompactionTemperatureDetailResult(temperatureDetails.Percents));
        }

        throw CreateServiceException <DetailedTemperatureExecutor>((int)raptorResult);
#endif
        }
Esempio n. 11
0
        /// <summary>
        /// Processes the detailed pass counts request by passing the request to Raptor and returning the result.
        /// </summary>
        protected override async Task <ContractExecutionResult> ProcessAsyncEx <T>(T item)
        {
            try
            {
                var request = CastRequestObjectTo <PassCounts>(item);
#if RAPTOR
                if (UseTRexGateway("ENABLE_TREX_GATEWAY_PASSCOUNT"))
                {
#endif
                await PairUpAssetIdentifiers(request.ProjectUid.Value, request.Filter);
                await PairUpImportedFileIdentifiers(request.ProjectUid.Value, filter1 : request.Filter);

                var pcDetailsRequest = new PassCountDetailsRequest(
                    request.ProjectUid.Value,
                    request.Filter,
                    request.passCountSettings.passCounts,
                    AutoMapperUtility.Automapper.Map <OverridingTargets>(request.liftBuildSettings),
                    AutoMapperUtility.Automapper.Map <LiftSettings>(request.liftBuildSettings));
                log.LogDebug($"{nameof(DetailedPassCountExecutor)} trexRequest {JsonConvert.SerializeObject(pcDetailsRequest)}");

                return(await trexCompactionDataProxy.SendDataPostRequest <PassCountDetailedResult, PassCountDetailsRequest>(pcDetailsRequest, "/passcounts/details", customHeaders));

#if RAPTOR
            }

            var raptorFilter = RaptorConverters.ConvertFilter(request.Filter, request.ProjectId, raptorClient, request.OverrideStartUTC, request.OverrideEndUTC, request.OverrideAssetIds);
            var raptorResult = raptorClient.GetPassCountDetails(request.ProjectId ?? VelociraptorConstants.NO_PROJECT_ID,
                                                                ASNodeRPC.__Global.Construct_TASNodeRequestDescriptor((request.CallId ?? Guid.NewGuid()), 0,
                                                                                                                      TASNodeCancellationDescriptorType.cdtPassCountDetailed),
                                                                request.passCountSettings != null ? ConvertSettings(request.passCountSettings) : new TPassCountSettings(),
                                                                raptorFilter,
                                                                RaptorConverters.ConvertLift(request.liftBuildSettings, raptorFilter.LayerMethod),
                                                                out var passCountDetails);

            if (raptorResult == TASNodeErrorStatus.asneOK)
            {
                return(ConvertResult(passCountDetails, request.liftBuildSettings));
            }

            throw CreateServiceException <DetailedPassCountExecutor>((int)raptorResult);
#endif
            }
            finally
            {
                ContractExecutionStates.ClearDynamic();
            }
        }
Esempio n. 12
0
        protected override async Task <ContractExecutionResult> ProcessAsyncEx <T>(T item)
        {
            try
            {
                var request = CastRequestObjectTo <CMVChangeSummaryRequest>(item);
#if RAPTOR
                if (UseTRexGateway("ENABLE_TREX_GATEWAY_CMV"))
                {
#endif
                await PairUpAssetIdentifiers(request.ProjectUid.Value, request.Filter);
                await PairUpImportedFileIdentifiers(request.ProjectUid.Value, filter1 : request.Filter);

                var cmvChangeDetailsRequest = new CMVChangeDetailsRequest(
                    request.ProjectUid.Value,
                    request.Filter,
                    request.CMVChangeSummaryValues,
                    AutoMapperUtility.Automapper.Map <OverridingTargets>(request.LiftBuildSettings),
                    AutoMapperUtility.Automapper.Map <LiftSettings>(request.LiftBuildSettings));
                return(await trexCompactionDataProxy.SendDataPostRequest <CMVChangeSummaryResult, CMVChangeDetailsRequest>(cmvChangeDetailsRequest, "/cmv/percentchange", customHeaders));

#if RAPTOR
            }
            new TASNodeCMVChangeResult();

            TASNodeCMVChangeSettings settings = new TASNodeCMVChangeSettings(request.CMVChangeSummaryValues);

            var raptorResult = raptorClient.GetCMVChangeSummary(request.ProjectId ?? VelociraptorConstants.NO_PROJECT_ID,
                                                                ASNodeRPC.__Global.Construct_TASNodeRequestDescriptor(request.CallId ?? Guid.NewGuid(), 0,
                                                                                                                      TASNodeCancellationDescriptorType.cdtCMVChange),
                                                                settings,
                                                                RaptorConverters.ConvertFilter(request.Filter, request.ProjectId, raptorClient, overrideAssetIds: new List <long>()),
                                                                RaptorConverters.ConvertLift(request.LiftBuildSettings, TFilterLayerMethod.flmAutomatic),
                                                                out var result);

            if (raptorResult == TASNodeErrorStatus.asneOK)
            {
                return(ConvertResult(result));
            }

            throw CreateServiceException <CMVChangeSummaryExecutor>((int)raptorResult);
#endif
            }
            finally
            {
                ContractExecutionStates.ClearDynamic();
            }
        }
Esempio n. 13
0
        private ProfileResult PerformProductionDataProfilePost(ProfileProductionDataRequest request)
        {
            MemoryStream memoryStream;

            if (request.IsAlignmentDesign)
            {
                var args = ASNode.RequestAlignmentProfile.RPC.__Global.Construct_RequestAlignmentProfile_Args(
                    request.ProjectId ?? VelociraptorConstants.NO_PROJECT_ID,
                    ProfilesHelper.PROFILE_TYPE_NOT_REQUIRED,
                    request.StartStation ?? ValidationConstants3D.MIN_STATION,
                    request.EndStation ?? ValidationConstants3D.MIN_STATION,
                    RaptorConverters.DesignDescriptor(request.AlignmentDesign),
                    RaptorConverters.ConvertFilter(request.Filter, request.ProjectId, raptorClient),
                    RaptorConverters.ConvertLift(request.LiftBuildSettings, TFilterLayerMethod.flmAutomatic),
                    RaptorConverters.DesignDescriptor(request.AlignmentDesign),
                    request.ReturnAllPassesAndLayers);

                memoryStream = raptorClient.GetAlignmentProfile(args);
            }
            else
            {
                ProfilesHelper.ConvertProfileEndPositions(
                    request.GridPoints,
                    request.WGS84Points,
                    out VLPDDecls.TWGS84Point startPt,
                    out VLPDDecls.TWGS84Point endPt,
                    out bool positionsAreGrid);

                var args = ASNode.RequestProfile.RPC.__Global.Construct_RequestProfile_Args(
                    request.ProjectId ?? VelociraptorConstants.NO_PROJECT_ID,
                    ProfilesHelper.PROFILE_TYPE_NOT_REQUIRED,
                    positionsAreGrid,
                    startPt,
                    endPt,
                    RaptorConverters.ConvertFilter(request.Filter, request.ProjectId, raptorClient),
                    RaptorConverters.ConvertLift(request.LiftBuildSettings, TFilterLayerMethod.flmAutomatic),
                    RaptorConverters.DesignDescriptor(request.AlignmentDesign),
                    request.ReturnAllPassesAndLayers);

                memoryStream = raptorClient.GetProfile(args);
            }

            return(memoryStream != null
        ? ConvertProfileResult(memoryStream, request.CallId ?? Guid.NewGuid())
        : null); // TODO: return appropriate result
        }
Esempio n. 14
0
        /// <summary>
        /// Processes the summary MDP request by passing the request to Raptor and returning the result.
        /// </summary>
        /// <typeparam name="T"></typeparam>
        /// <param name="item"></param>
        /// <returns>a CMVSummaryResult if successful</returns>
        protected override async Task <ContractExecutionResult> ProcessAsyncEx <T>(T item)
        {
            try
            {
                var request = CastRequestObjectTo <MDPRequest>(item);
#if RAPTOR
                if (configStore.GetValueBool("ENABLE_TREX_GATEWAY_MDP") ?? false)
                {
#endif
                var mdpSummaryRequest = new MDPSummaryRequest(
                    request.ProjectUid.Value,
                    request.Filter,
                    request.MdpSettings.MdpTarget,
                    request.MdpSettings.OverrideTargetMDP,
                    request.MdpSettings.MaxMDPPercent,
                    request.MdpSettings.MinMDPPercent,
                    AutoMapperUtility.Automapper.Map <LiftSettings>(request.LiftBuildSettings));

                return(await trexCompactionDataProxy.SendDataPostRequest <MDPSummaryResult, MDPSummaryRequest>(mdpSummaryRequest, "/mdp/summary", customHeaders));

#if RAPTOR
            }

            string fileSpaceName = FileDescriptorExtensions.GetFileSpaceId(configStore, log);

            var raptorFilter = RaptorConverters.ConvertFilter(request.Filter, request.ProjectId, raptorClient, request.OverrideStartUtc, request.OverrideEndUtc, request.OverrideAssetIds, fileSpaceName);
            var raptorResult = raptorClient.GetMDPSummary(request.ProjectId ?? VelociraptorConstants.NO_PROJECT_ID,
                                                          ASNodeRPC.__Global.Construct_TASNodeRequestDescriptor((request.CallId ?? Guid.NewGuid()), 0, TASNodeCancellationDescriptorType.cdtMDPSummary),
                                                          ConvertSettings(request.MdpSettings),
                                                          raptorFilter,
                                                          RaptorConverters.ConvertLift(request.LiftBuildSettings, raptorFilter.LayerMethod),
                                                          out var mdpSummary);

            if (raptorResult == TASNodeErrorStatus.asneOK)
            {
                return(ConvertResult(mdpSummary));
            }

            throw CreateServiceException <SummaryMDPExecutor>((int)raptorResult);
#endif
            }
            finally
            {
                ContractExecutionStates.ClearDynamic();
            }
        }
Esempio n. 15
0
        /// <summary>
        /// Processes the summary CCA request by passing the request to Raptor and returning the result.
        /// </summary>
        protected override async Task <ContractExecutionResult> ProcessAsyncEx <T>(T item)
        {
            try
            {
                var request = CastRequestObjectTo <CCARequest>(item);
#if RAPTOR
                if (configStore.GetValueBool("ENABLE_TREX_GATEWAY_CCA") ?? false)
                {
#endif
                await PairUpAssetIdentifiers(request.ProjectUid.Value, request.Filter);
                await PairUpImportedFileIdentifiers(request.ProjectUid.Value, filter1 : request.Filter);

                var ccaSummaryRequest = new CCASummaryRequest(
                    request.ProjectUid.Value,
                    request.Filter,
                    AutoMapperUtility.Automapper.Map <OverridingTargets>(request.LiftBuildSettings),
                    AutoMapperUtility.Automapper.Map <LiftSettings>(request.LiftBuildSettings));

                return(await trexCompactionDataProxy.SendDataPostRequest <CCASummaryResult, CCASummaryRequest>(ccaSummaryRequest, "/cca/summary", customHeaders));

#if RAPTOR
            }

            var raptorFilter = RaptorConverters.ConvertFilter(request.Filter, request.ProjectId, raptorClient);

            bool success = raptorClient.GetCCASummary(request.ProjectId ?? VelociraptorConstants.NO_PROJECT_ID,
                                                      ASNodeRPC.__Global.Construct_TASNodeRequestDescriptor(request.CallId ?? Guid.NewGuid(), 0, TASNodeCancellationDescriptorType.cdtCCASummary),
                                                      raptorFilter,
                                                      RaptorConverters.ConvertLift(request.LiftBuildSettings, raptorFilter.LayerMethod),
                                                      out var ccaSummary);

            if (success)
            {
                return(ConvertResult(ccaSummary));
            }

            throw CreateServiceException <SummaryCCAExecutor>(ccaSummary.ReturnCode);
#endif
            }

            finally
            {
                ContractExecutionStates.ClearDynamic();
            }
        }
Esempio n. 16
0
        private ContractExecutionResult ProcessWithRaptor(CompactionReportGridRequest request)
        {
            var raptorFilter = RaptorConverters.ConvertFilter(request.Filter, request.ProjectId, raptorClient);

            var options = RaptorConverters.convertOptions(null, request.LiftBuildSettings, 0,
                                                          request.Filter?.LayerType ?? FilterLayerMethod.None, DisplayMode.Height, false);

            log.LogDebug($"{nameof(ProcessWithRaptor)}: About to call GetReportGrid");

            var args = ASNode.GridReport.RPC.__Global.Construct_GridReport_Args(
                request.ProjectId ?? VelociraptorConstants.NO_PROJECT_ID,
                (int)CompactionReportType.Grid,
                ASNodeRPC.__Global.Construct_TASNodeRequestDescriptor(Guid.NewGuid(), 0,
                                                                      TASNodeCancellationDescriptorType.cdtProdDataReport),
                RaptorConverters.DesignDescriptor(request.DesignFile),
                request.GridInterval,
                request.ReportElevation,
                request.ReportCutFill,
                request.ReportCMV,
                request.ReportMDP,
                request.ReportPassCount,
                request.ReportTemperature,
                (int)request.GridReportOption,
                request.StartNorthing,
                request.StartEasting,
                request.EndNorthing,
                request.EndEasting,
                request.Azimuth,
                raptorFilter,
                RaptorConverters.ConvertLift(request.LiftBuildSettings, raptorFilter.LayerMethod),
                options
                );

            int raptorResult = raptorClient.GetReportGrid(args, out var responseData);

            if (raptorResult == 1) // icsrrNoError
            {
                return(responseData.Length > 0
          ? ConvertGridResult(request, responseData)
          : CreateNullGridReturnedResult());
            }

            throw CreateServiceException <CompactionReportGridExecutor>();
        }
Esempio n. 17
0
        protected override async Task <ContractExecutionResult> ProcessAsyncEx <T>(T item)
        {
            try
            {
                var request = CastRequestObjectTo <SummarySpeedRequest>(item);
#if RAPTOR
                if (configStore.GetValueBool("ENABLE_TREX_GATEWAY_SPEED") ?? false)
                {
#endif
                await PairUpAssetIdentifiers(request.ProjectUid.Value, request.Filter);
                await PairUpImportedFileIdentifiers(request.ProjectUid.Value, filter1 : request.Filter);

                var speedSummaryRequest = new SpeedSummaryRequest(
                    request.ProjectUid.Value,
                    request.Filter,
                    request.LiftBuildSettings.MachineSpeedTarget,
                    AutoMapperUtility.Automapper.Map <LiftSettings>(request.LiftBuildSettings));

                return(await trexCompactionDataProxy.SendDataPostRequest <SpeedSummaryResult, SpeedSummaryRequest>(speedSummaryRequest, "/speed/summary", customHeaders));

#if RAPTOR
            }

            var raptorResult = raptorClient.GetSummarySpeed(request.ProjectId ?? VelociraptorConstants.NO_PROJECT_ID,
                                                            ASNodeRPC.__Global.Construct_TASNodeRequestDescriptor((request.CallId ?? Guid.NewGuid()), 0,
                                                                                                                  TASNodeCancellationDescriptorType.cdtVolumeSummary),
                                                            RaptorConverters.ConvertFilter(request.Filter, request.ProjectId, raptorClient, overrideAssetIds: new List <long>()),
                                                            RaptorConverters.ConvertLift(request.LiftBuildSettings, TFilterLayerMethod.flmNone),
                                                            out var result);

            if (raptorResult == TASNodeErrorStatus.asneOK)
            {
                return(ConvertResult(result));
            }

            throw CreateServiceException <SummarySpeedExecutor>((int)raptorResult);
#endif
            }
            finally
            {
                ContractExecutionStates.ClearDynamic();
            }
        }
Esempio n. 18
0
        protected override async Task <ContractExecutionResult> ProcessAsyncEx <T>(T item)
        {
            var request = CastRequestObjectTo <CellPassesRequest>(item);

#if RAPTOR
            if (UseTRexGateway("ENABLE_TREX_GATEWAY_CELL_PASSES"))
            {
#endif

            await PairUpAssetIdentifiers(request.ProjectUid.Value, request.filter);
            await PairUpImportedFileIdentifiers(request.ProjectUid.Value, filter1 : request.filter);

            return(await GetTRexCellPasses(request));

#if RAPTOR
        }

        bool isGridCoord  = request.probePositionGrid != null;
        bool isLatLgCoord = request.probePositionLL != null;
        double probeX     = isGridCoord ? request.probePositionGrid.x : (isLatLgCoord ? request.probePositionLL.Lon : 0);
        double probeY     = isGridCoord ? request.probePositionGrid.y : (isLatLgCoord ? request.probePositionLL.Lat : 0);

        var raptorFilter = RaptorConverters.ConvertFilter(request.filter, request.ProjectId, raptorClient, overrideAssetIds: new List <long>());

        int code = raptorClient.RequestCellProfile
                       (request.ProjectId ?? VelociraptorConstants.NO_PROJECT_ID,
                       RaptorConverters.convertCellAddress(request.cellAddress ?? new CellAddress()),
                       probeX, probeY,
                       isGridCoord,
                       RaptorConverters.ConvertLift(request.liftBuildSettings, raptorFilter.LayerMethod),
                       request.gridDataType,
                       raptorFilter,
                       out var profile);

        if (code == 1)//TICServerRequestResult.icsrrNoError
        {
            return(ConvertResult(profile));
        }

        return(null);
#endif
        }
Esempio n. 19
0
        /// <summary>
        /// Processes the summary Temperature request by passing the request to Raptor and returning the result.
        /// </summary>
        /// <typeparam name="T"></typeparam>
        /// <param name="item"></param>
        /// <returns>a TemperatureSummaryResult if successful</returns>
        protected override async Task <ContractExecutionResult> ProcessAsyncEx <T>(T item)
        {
            try
            {
                var request = CastRequestObjectTo <TemperatureRequest>(item);
#if RAPTOR
                if (configStore.GetValueBool("ENABLE_TREX_GATEWAY_TEMPERATURE") ?? false)
                {
#endif
                var temperatureSummaryRequest = new TemperatureSummaryRequest(
                    request.ProjectUid.Value,
                    request.Filter,
                    request.TemperatureSettings,
                    AutoMapperUtility.Automapper.Map <LiftSettings>(request.LiftBuildSettings));

                return(await trexCompactionDataProxy.SendDataPostRequest <TemperatureSummaryResult, TemperatureSummaryRequest>(temperatureSummaryRequest, "/temperature/summary", customHeaders));

#if RAPTOR
            }

            var raptorFilter = RaptorConverters.ConvertFilter(request.Filter, request.ProjectId, raptorClient, request.OverrideStartUTC, request.OverrideEndUTC, request.OverrideAssetIds);

            var raptorResult = raptorClient.GetTemperatureSummary(request.ProjectId ?? VelociraptorConstants.NO_PROJECT_ID,
                                                                  ASNodeRPC.__Global.Construct_TASNodeRequestDescriptor((request.CallId ?? Guid.NewGuid()), 0, TASNodeCancellationDescriptorType.cdtTemperature),
                                                                  ConvertSettings(request.TemperatureSettings),
                                                                  raptorFilter,
                                                                  RaptorConverters.ConvertLift(request.LiftBuildSettings, raptorFilter.LayerMethod),
                                                                  out var temperatureSummary);

            if (raptorResult == TASNodeErrorStatus.asneOK)
            {
                return(ConvertResult(temperatureSummary));
            }

            throw CreateServiceException <SummaryTemperatureExecutor>((int)raptorResult);
#endif
            }
            finally
            {
                ContractExecutionStates.ClearDynamic();
            }
        }
Esempio n. 20
0
        protected override ContractExecutionResult ProcessEx <T>(T item)
        {
            var request = CastRequestObjectTo <SummaryParametersBase>(item);

            bool success = raptorClient.GetSummaryThickness(request.ProjectId ?? VelociraptorConstants.NO_PROJECT_ID,
                                                            ASNodeRPC.__Global.Construct_TASNodeRequestDescriptor(request.CallId ?? Guid.NewGuid(), 0,
                                                                                                                  TASNodeCancellationDescriptorType.cdtVolumeSummary),
                                                            RaptorConverters.ConvertFilter(request.BaseFilter, request.ProjectId, raptorClient),
                                                            RaptorConverters.ConvertFilter(request.TopFilter, request.ProjectId, raptorClient),
                                                            RaptorConverters.ConvertFilter(request.AdditionalSpatialFilter, request.ProjectId, raptorClient),
                                                            RaptorConverters.ConvertLift(request.LiftBuildSettings, TFilterLayerMethod.flmAutomatic),
                                                            out var result);

            if (success)
            {
                return(ConvertResult(result));
            }

            throw CreateServiceException <SummaryThicknessExecutor>();
        }
Esempio n. 21
0
        protected override async Task <ContractExecutionResult> ProcessAsyncEx <T>(T item)
        {
            var request = CastRequestObjectTo <ElevationStatisticsRequest>(item);

#if RAPTOR
            if (UseTRexGateway("ENABLE_TREX_GATEWAY_ELEVATION") || UseTRexGateway("ENABLE_TREX_GATEWAY_TILES"))
            {
#endif
            await PairUpAssetIdentifiers(request.ProjectUid.Value, request.Filter);
            await PairUpImportedFileIdentifiers(request.ProjectUid.Value, filter1 : request.Filter);

            var elevationStatisticsRequest = new ElevationDataRequest(
                request.ProjectUid.Value,
                request.Filter,
                AutoMapperUtility.Automapper.Map <OverridingTargets>(request.LiftBuildSettings),
                AutoMapperUtility.Automapper.Map <LiftSettings>(request.LiftBuildSettings));
            return(await trexCompactionDataProxy.SendDataPostRequest <ElevationStatisticsResult, ElevationDataRequest>(elevationStatisticsRequest, "/elevationstatistics", customHeaders));

#if RAPTOR
        }

        //new TASNodeElevationStatisticsResult();

        var Filter = RaptorConverters.ConvertFilter(request.Filter, request.ProjectId, raptorClient);

        var raptorResult = raptorClient.GetElevationStatistics(request.ProjectId ?? VelociraptorConstants.NO_PROJECT_ID,
                                                               ASNodeRPC.__Global.Construct_TASNodeRequestDescriptor((Guid)(request.CallId ?? Guid.NewGuid()), 0,
                                                                                                                     TASNodeCancellationDescriptorType.cdtElevationStatistics),
                                                               Filter,
                                                               RaptorConverters.ConvertLift(request.LiftBuildSettings, TFilterLayerMethod.flmAutomatic),
                                                               out var result);

        if (raptorResult == TASNodeErrorStatus.asneOK)
        {
            return(ConvertResult(result));
        }

        throw CreateServiceException <ElevationStatisticsExecutor>((int)raptorResult);
#endif
        }
Esempio n. 22
0
        private CompactionProfileResult <CompactionSummaryVolumesProfileCell> ProcessSummaryVolumesWithRaptor(CompactionProfileProductionDataRequest request)
        {
            var alignmentDescriptor = RaptorConverters.DesignDescriptor(request.AlignmentDesign);
            var liftBuildSettings   =
                RaptorConverters.ConvertLift(request.LiftBuildSettings, TFilterLayerMethod.flmNone);
            var baseFilter             = RaptorConverters.ConvertFilter(request.BaseFilter, request.ProjectId, raptorClient);
            var topFilter              = RaptorConverters.ConvertFilter(request.TopFilter, request.ProjectId, raptorClient);
            var volumeDesignDescriptor = RaptorConverters.DesignDescriptor(request.VolumeDesignDescriptor);

            ProfilesHelper.ConvertProfileEndPositions(request.GridPoints, request.WGS84Points, out var startPt, out var endPt,
                                                      out var positionsAreGrid);

            if (request.VolumeCalcType.HasValue && request.VolumeCalcType.Value != VolumeCalcType.None)
            {
                var volCalcType = (TComputeICVolumesType)request.VolumeCalcType.Value;
                if (volCalcType == TComputeICVolumesType.ic_cvtBetween2Filters && !request.ExplicitFilters)
                {
                    RaptorConverters.AdjustFilterToFilter(ref baseFilter, topFilter);
                }

                MemoryStream memoryStream;
                if (request.IsAlignmentDesign)
                {
                    var args
                        = ASNode.RequestSummaryVolumesAlignmentProfile.RPC.__Global
                          .Construct_RequestSummaryVolumesAlignmentProfile_Args
                              (request.ProjectId ?? VelociraptorConstants.NO_PROJECT_ID,
                              ProfilesHelper.PROFILE_TYPE_NOT_REQUIRED,
                              volCalcType,
                              request.StartStation ?? ValidationConstants3D.MIN_STATION,
                              request.EndStation ?? ValidationConstants3D.MIN_STATION,
                              alignmentDescriptor,
                              baseFilter,
                              topFilter,
                              liftBuildSettings,
                              volumeDesignDescriptor);

                    memoryStream = raptorClient.GetSummaryVolumesAlignmentProfile(args);
                }
                else
                {
                    var args
                        = ASNode.RequestSummaryVolumesProfile.RPC.__Global.Construct_RequestSummaryVolumesProfile_Args(
                              request.ProjectId ?? VelociraptorConstants.NO_PROJECT_ID,
                              ProfilesHelper.PROFILE_TYPE_HEIGHT,
                              volCalcType,
                              startPt,
                              endPt,
                              positionsAreGrid,
                              baseFilter,
                              topFilter,
                              liftBuildSettings,
                              volumeDesignDescriptor);
                    memoryStream = raptorClient.GetSummaryVolumesProfile(args);
                }

                return(memoryStream != null?ConvertSummaryVolumesProfileResult(memoryStream, request.VolumeCalcType.Value) : null);
            }

            return(null);
        }
Esempio n. 23
0
        /// <summary>
        /// Processes the detailed CMV request by passing the request to Raptor and returning the result.
        /// </summary>
        protected override async Task <ContractExecutionResult> ProcessAsyncEx <T>(T item)
        {
            try
            {
                var request = CastRequestObjectTo <CMVRequest>(item);
#if RAPTOR
                if (request.IsCustomCMVTargets && (configStore.GetValueBool("ENABLE_TREX_GATEWAY_CMV") ?? false))
                {
#endif
                var settings = new CMVSettingsEx(request.CmvSettings.CmvTarget, request.CmvSettings.MaxCMV, request.CmvSettings.MaxCMVPercent,
                                                 request.CmvSettings.MinCMV, request.CmvSettings.MinCMVPercent, request.CmvSettings.OverrideTargetCMV,
                                                 (CompactionProjectSettings.DefaultSettings.customCMVTargets.ToArray()));

                await PairUpAssetIdentifiers(request.ProjectUid.Value, request.Filter);
                await PairUpImportedFileIdentifiers(request.ProjectUid.Value, filter1 : request.Filter);

                var cmvDetailsRequest = new CMVDetailsRequest(
                    request.ProjectUid.Value,
                    request.Filter,
                    settings.CustomCMVDetailTargets,
                    AutoMapperUtility.Automapper.Map <OverridingTargets>(request.LiftBuildSettings),
                    AutoMapperUtility.Automapper.Map <LiftSettings>(request.LiftBuildSettings));
                log.LogDebug($"{nameof(DetailedCMVExecutor)} trexRequest {JsonConvert.SerializeObject(cmvDetailsRequest)}");

                return(await trexCompactionDataProxy.SendDataPostRequest <CMVDetailedResult, CMVDetailsRequest>(cmvDetailsRequest, "/cmv/details", customHeaders));

#if RAPTOR
            }

            var raptorFilter = RaptorConverters.ConvertFilter(request.Filter, request.ProjectId, raptorClient, request.OverrideStartUTC, request.OverrideEndUTC, request.OverrideAssetIds);

            var externalRequestDescriptor = ASNodeRPC.__Global.Construct_TASNodeRequestDescriptor(
                request.CallId ?? Guid.NewGuid(), 0,
                TASNodeCancellationDescriptorType.cdtCMVDetailed);

            var liftBuildSettings = RaptorConverters.ConvertLift(request.LiftBuildSettings, raptorFilter.LayerMethod);

            TCMVDetails        cmvDetails;
            TASNodeErrorStatus raptorResult;

            if (!request.IsCustomCMVTargets)
            {
                raptorResult = raptorClient.GetCMVDetails(
                    request.ProjectId ?? VelociraptorConstants.NO_PROJECT_ID,
                    externalRequestDescriptor,
                    ConvertSettings(request.CmvSettings),
                    raptorFilter,
                    liftBuildSettings,
                    out cmvDetails);
            }
            else
            {
                raptorResult = raptorClient.GetCMVDetailsExt(
                    request.ProjectId ?? VelociraptorConstants.NO_PROJECT_ID,
                    externalRequestDescriptor,
                    ConvertSettingsExt((CMVSettingsEx)request.CmvSettings),
                    raptorFilter,
                    liftBuildSettings,
                    out cmvDetails);
            }

            if (raptorResult == TASNodeErrorStatus.asneOK)
            {
                return(ConvertResult(cmvDetails));
            }

            throw CreateServiceException <DetailedCMVExecutor>((int)raptorResult);
#endif
            }
            finally
            {
                ContractExecutionStates.ClearDynamic();
            }
        }