Ejemplo n.º 1
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
        }