Esempio n. 1
0
        private CompactionReportResult ConvertTRexStationOffsetResult(CompactionReportStationOffsetRequest request, Stream stream)
        {
            log.LogDebug($"{nameof(ConvertTRexStationOffsetResult)}: Retrieving response data from TRex");

            var stationOffsetReportResult = new StationOffsetReportResultPackager(ReportType.StationOffset);

            stationOffsetReportResult.Read((stream as MemoryStream)?.ToArray());

            var stationRows = new StationRow[stationOffsetReportResult.GriddedData.NumberOfRows];

            for (var i = 0; i < stationOffsetReportResult.GriddedData.NumberOfRows; i++)
            {
                var station    = stationOffsetReportResult.GriddedData.Rows[i];
                var stationRow = StationRow.Create(station, request);

                for (var j = 0; j < station.Offsets.Count; j++)
                {
                    stationRow.Offsets[j] = StationOffsetRow.CreateRow(station.Offsets[j], request);
                }

                stationRows[i] = stationRow;
            }

            var startAndEndTime     = request.Filter.StartUtc ?? DateTime.UtcNow;
            var stationOffsetReport = new StationOffsetReport(startAndEndTime, startAndEndTime, stationRows, request);

            return(CompactionReportResult.CreateExportDataResult(stationOffsetReport, 1));
        }
Esempio n. 2
0
        private CompactionReportResult ConvertStationOffsetResult(CompactionReportStationOffsetRequest request, Stream stream)
        {
            log.LogDebug($"{nameof(ConvertStationOffsetResult)}");

            // Unpack the data for the report and construct a stream containing the result
            var reportPackager = new TRaptorReportsPackager(TRaptorReportType.rrtStationOffset)
            {
                ReturnCode = TRaptorReportReturnCode.rrrcUnknownError
            };

            log.LogDebug($"{nameof(ConvertStationOffsetResult)}: Retrieving response data");
            reportPackager.ReadFromStream(stream);

            var stationRows = new StationRow[reportPackager.StationOffsetReport.NumberOfStations];

            for (var i = 0; i < reportPackager.StationOffsetReport.NumberOfStations; i++)
            {
                var station    = reportPackager.StationOffsetReport.Stations[i];
                var stationRow = StationRow.Create(station, request);

                for (var j = 0; j < station.NumberOfOffsets; j++)
                {
                    stationRow.Offsets[j] = StationOffsetRow.CreateRow(station.Offsets[j], request);
                }

                stationRows[i] = stationRow;
            }

            var startAndEndTime     = request.Filter.StartUtc ?? DateTime.UtcNow;
            var stationOffsetReport = new StationOffsetReport(startAndEndTime, startAndEndTime, stationRows, request);

            return(CompactionReportResult.CreateExportDataResult(stationOffsetReport, 1));
        }
Esempio n. 3
0
        public void Constructor_should_return_fully_populated_object()
        {
            var stationOffset = new TStationOffset
            {
                Northing    = 12.34,
                Easting     = 56.78,
                Elevation   = 90.12,
                CutFill     = 34.56,
                CMV         = 78,
                MDP         = 90,
                PassCount   = 12345,
                Temperature = 21.43,
                Position    = 54.65,
                Station     = 87.09
            };

            var request = CompactionReportStationOffsetRequest.CreateRequest(
                0, null, null, 0, null, true, true, true, true, true, true, null, null, 0, 0, 0, null, null, null
                );

            var result = StationOffsetRow.CreateRow(stationOffset, request);

            Assert.AreEqual(stationOffset.Northing, result.Northing);
            Assert.AreEqual(stationOffset.Easting, result.Easting);
            Assert.AreEqual(stationOffset.Elevation, result.Elevation);
            Assert.AreEqual(stationOffset.CutFill, result.CutFill);
            Assert.AreEqual((double)stationOffset.CMV / 10, result.CMV);
            Assert.AreEqual((double)stationOffset.MDP / 10, result.MDP);
            Assert.AreEqual(stationOffset.PassCount, result.PassCount);
            Assert.AreEqual(stationOffset.Temperature / 10, result.Temperature);
            Assert.AreEqual(stationOffset.Position, result.Offset);
            Assert.AreEqual(stationOffset.Station, result.Station);

            Assert.IsTrue(result.ElevationReport);
            Assert.IsTrue(result.CutFillReport);
            Assert.IsTrue(result.CMVReport);
            Assert.IsTrue(result.MDPReport);
            Assert.IsTrue(result.PassCountReport);
            Assert.IsTrue(result.TemperatureReport);
        }