Esempio n. 1
0
        protected override async Task <ContractExecutionResult> ProcessAsyncEx <T>(T item)
        {
            var request = item as ProjectStatisticsMultiRequest;

            log.LogInformation($"ProjectStatisticsExecutor: {JsonConvert.SerializeObject(request)}, UseTRexGateway: {UseTRexGateway("ENABLE_TREX_GATEWAY_PROJECTSTATISTICS")}");

#if RAPTOR
            if (UseTRexGateway("ENABLE_TREX_GATEWAY_PROJECTSTATISTICS") && request.ProjectUid != null)
#endif
            {
                var tRexRequest =
                    new ProjectStatisticsTRexRequest(request.ProjectUid.Value, request.ExcludedSurveyedSurfaceUids);
                var result = await trexCompactionDataProxy.SendDataPostRequest <ProjectStatisticsResult, ProjectStatisticsTRexRequest>(
                    tRexRequest, $"/sitemodels/statistics", customHeaders);

                if (!result.extents.ValidExtents)
                {
                    result.Empty();
                }
                return(result);
            }
#if RAPTOR
            bool success = raptorClient.GetDataModelStatistics(
                request.ProjectId,
                RaptorConverters.convertSurveyedSurfaceExlusionList(request.ExcludedSurveyedSurfaceIds),
                out var statistics);

            if (success)
            {
                return(ConvertProjectStatistics(statistics));
            }
#endif

            throw CreateServiceException <ProjectStatisticsExecutor>();
        }
Esempio n. 2
0
        /// <summary>
        /// Calls raptor to get project extents
        /// </summary>
        protected override async Task <ContractExecutionResult> ProcessAsyncEx <T>(T item)
        {
            try
            {
                var  request = CastRequestObjectTo <ExtentRequest>(item);
                bool success;
                BoundingBox3DGrid bbExtents = null;
#if RAPTOR
                if (UseTRexGateway("ENABLE_TREX_GATEWAY_TILES"))
                {
#endif
                var siteModelId = request.ProjectUid.ToString();

                bbExtents = await trexCompactionDataProxy.SendDataGetRequest <BoundingBox3DGrid>(siteModelId, $"/sitemodels/{siteModelId}/extents", customHeaders);

                success = bbExtents != null;
#if RAPTOR
            }
            else
            {
                success = raptorClient.GetDataModelExtents(request.ProjectId ?? VelociraptorConstants.NO_PROJECT_ID,
                                                           RaptorConverters.convertSurveyedSurfaceExlusionList(request.excludedSurveyedSurfaceIds),
                                                           out var extents);

                bbExtents = RaptorConverters.ConvertExtents(extents);
            }
#endif
                if (success)
                {
                    if (bbExtents.ValidExtents)
                    {
                        return(ProjectExtentsResult.CreateProjectExtentsResult(bbExtents));
                    }
                }

                throw CreateServiceException <ProjectExtentsSubmitter>();
            }
            finally
            {
                ContractExecutionStates.ClearDynamic(); // clear memory
            }
        }
Esempio n. 3
0
        /// <summary>
        /// Creates an instance of the ProfileProductionDataRequest class and populate it with data needed for a design profile.
        /// </summary>
        public ExportReport CreateExportRequest(
            DateTime?startUtc,
            DateTime?endUtc,
            CoordType coordType,
            ExportTypes exportType,
            string fileName,
            bool restrictSize,
            bool rawData,
            OutputTypes outputType,
            string machineNames,
            double tolerance = 0.0)
        {
            // todo once the requirement for RAPTOR build to be able to call TRex endpoints is removed
            //      this whole tangle can be unraveled
            var liftSettings = SettingsManager.CompactionLiftBuildSettings(ProjectSettings);

#if RAPTOR
            T3DBoundingWorldExtent projectExtents = new T3DBoundingWorldExtent();
            TMachine[]             machineList    = null;
            machineNameList = new string[0];

            if (exportType == ExportTypes.SurfaceExport)
            {
                raptorClient.GetDataModelExtents(ProjectId,
                                                 RaptorConverters.convertSurveyedSurfaceExlusionList(Filter?.SurveyedSurfaceExclusionList), out projectExtents);
            }
            else
            {
                TMachineDetail[] machineDetails = raptorClient.GetMachineIDs(ProjectId);

                if (machineDetails != null)
                {
                    if (!string.IsNullOrEmpty(machineNames) && machineNames != "All")
                    {
                        machineNameList = machineNames.Split(',');
                        machineDetails  = machineDetails.Where(machineDetail => machineNameList.Contains(machineDetail.Name)).ToArray();
                    }

                    machineList = machineDetails.Select(m => new TMachine {
                        AssetID = m.ID, MachineName = m.Name, SerialNo = ""
                    }).ToArray();
                }
            }

            if (!string.IsNullOrEmpty(fileName))
            {
                fileName = StripInvalidCharacters(fileName);
            }

            return(new ExportReport(
                       ProjectId,
                       ProjectUid,
                       liftSettings,
                       Filter,
                       -1,
                       null,
                       false,
                       null,
                       coordType,
                       startUtc ?? DateTime.MinValue,
                       endUtc ?? DateTime.MinValue,
                       tolerance,
                       false,
                       restrictSize,
                       rawData,
                       RaptorConverters.convertProjectExtents(projectExtents),
                       false,
                       outputType,
                       RaptorConverters.convertMachines(machineList),
                       exportType == ExportTypes.SurfaceExport,
                       fileName,
                       exportType,
                       ConvertUserPreferences(userPreferences, projectDescriptor.ProjectTimeZone)));
#else
            if (exportType == ExportTypes.SurfaceExport)
            {
                if (!string.IsNullOrEmpty(machineNames) && machineNames != "All")
                {
                    machineNameList = machineNames.Split(',');
                }
            }
            return(new ExportReport(
                       ProjectId,
                       ProjectUid,
                       liftSettings,
                       Filter,
                       -1,
                       null,
                       false,
                       null,
                       coordType,
                       startUtc ?? DateTime.MinValue,
                       endUtc ?? DateTime.MinValue,
                       tolerance,
                       false,
                       restrictSize,
                       rawData,
                       null,//project extents are retrieved in the TRex gateway as part of this request
                       false,
                       outputType,
                       null,
                       exportType == ExportTypes.SurfaceExport,
                       fileName,
                       exportType,
                       ConvertUserPreferences(userPreferences, projectDescriptor.ProjectTimeZone)));
#endif
        }