Exemple #1
0
        /// <summary>
        /// Serializes content from the writer
        /// </summary>
        public override void InternalFromBinary(IBinaryRawReader reader)
        {
            base.InternalFromBinary(reader);

            var version = VersionSerializationHelper.CheckVersionByte(reader, VERSION_NUMBER);

            if (version == 1)
            {
                var pointCount = reader.ReadInt();
                Points = new List <StationOffsetPoint>();
                for (int i = 0; i < pointCount; i++)
                {
                    StationOffsetPoint point = null;
                    (point = new StationOffsetPoint()).FromBinary(reader);
                    Points.Add(point);
                }
            }
        }
Exemple #2
0
        private StationOffsetRow ExtractRequiredValues(IDesignWrapper cutFillDesignWrapper, StationOffsetPoint point, ClientCellProfileLeafSubgrid clientGrid, int cellX, int cellY)
        {
            clientGrid.CalculateWorldOrigin(out double subgridWorldOriginX, out double subgridWorldOriginY);
            var cell = clientGrid.Cells[cellX, cellY];

            var result = new StationOffsetRow(point.Station, point.Offset, cell.CellYOffset + subgridWorldOriginY, cell.CellXOffset + subgridWorldOriginX);

            (IClientHeightLeafSubGrid designHeights, DesignProfilerRequestResult errorCode)getDesignHeightsResult = (null, DesignProfilerRequestResult.UnknownError);

            if (requestArgument.ReferenceDesign != null && requestArgument.ReferenceDesign.DesignID != Guid.Empty)
            {
                getDesignHeightsResult = cutFillDesignWrapper.Design.GetDesignHeightsViaLocalCompute(siteModel, cutFillDesignWrapper.Offset, clientGrid.OriginAsCellAddress(), clientGrid.CellSize);

                if (getDesignHeightsResult.errorCode != DesignProfilerRequestResult.OK || getDesignHeightsResult.designHeights == null)
                {
                    string errorMessage;
                    if (getDesignHeightsResult.errorCode == DesignProfilerRequestResult.NoElevationsInRequestedPatch)
                    {
                        errorMessage = "StationOffset Report. Call to RequestDesignElevationPatch failed due to no elevations in requested patch.";
                        Log.LogInformation(errorMessage);
                    }
                    else
                    {
                        errorMessage = $"StationOffset Report. Call to RequestDesignElevationPatch failed due to no TDesignProfilerRequestResult return code {getDesignHeightsResult.errorCode}.";
                        Log.LogWarning(errorMessage);
                    }
                }
            }

            if (cell.PassCount == 0) // Nothing for us to do, as cell is not in our areaControlSet...
            {
                return(result);
            }

            result.Elevation = requestArgument.ReportElevation ? cell.Height : Consts.NullHeight;
            result.CutFill   = (requestArgument.ReportCutFill && (getDesignHeightsResult.designHeights != null) &&
                                getDesignHeightsResult.designHeights.Cells[cellX, cellY] != Consts.NullHeight)
        ? cell.Height - getDesignHeightsResult.designHeights.Cells[cellX, cellY]
        : Consts.NullHeight;

            // CCV is equiv to CMV in this instance
            result.Cmv         = (short)(requestArgument.ReportCmv ? cell.LastPassValidCCV : CellPassConsts.NullCCV);
            result.Mdp         = (short)(requestArgument.ReportMdp ? cell.LastPassValidMDP : CellPassConsts.NullMDP);
            result.PassCount   = (short)(requestArgument.ReportPassCount ? cell.PassCount : CellPassConsts.NullPassCountValue);
            result.Temperature = (short)(requestArgument.ReportTemperature ? cell.LastPassValidTemperature : CellPassConsts.NullMaterialTemperatureValue);

            return(result);
        }