コード例 #1
0
        private void PerformGpsEitherLineOrPointValidation(WorkReportTyped typedRow)
        {
            if (typedRow.StartLatitude == null || typedRow.StartLongitude == null || typedRow.FeatureType != FeatureType.PointLine)
            {
                return;
            }

            if (typedRow.EndLatitude == null)
            {
                typedRow.EndLatitude = typedRow.StartLatitude;
            }

            if (typedRow.EndLongitude == null)
            {
                typedRow.EndLongitude = typedRow.StartLongitude;
            }

            if (typedRow.StartLatitude == typedRow.EndLatitude && typedRow.StartLongitude == typedRow.EndLongitude)
            {
                typedRow.FeatureType = FeatureType.Point;
            }
            else
            {
                typedRow.FeatureType = FeatureType.Line;
            }
        }
コード例 #2
0
        private void PerformOffsetLineValidation(WorkReportTyped typedRow, Dictionary <string, List <string> > errors)
        {
            if (typedRow.StartOffset == null || typedRow.FeatureType != FeatureType.Line)
            {
                return;
            }

            if (typedRow.EndOffset != null)
            {
                if (typedRow.StartOffset >= typedRow.EndOffset)
                {
                    errors.AddItem($"{Fields.EndOffset}", "End offset must be greater than start offset");
                }
            }
            else
            {
                errors.AddItem($"{Fields.EndOffset}", "End offset must be provided");
            }
        }
コード例 #3
0
        private void PerformOffsetPointValidation(WorkReportTyped typedRow, Dictionary <string, List <string> > errors)
        {
            if (typedRow.StartOffset == null || typedRow.FeatureType != FeatureType.Point)
            {
                return;
            }

            if (typedRow.EndOffset != null)
            {
                if (typedRow.EndOffset != typedRow.StartOffset)
                {
                    errors.AddItem($"{Fields.EndOffset}", "End offset must be the same as start offset");
                }
            }
            else
            {
                typedRow.EndOffset = typedRow.StartOffset;
            }
        }
コード例 #4
0
        private void PerformGpsLineValidation(WorkReportTyped typedRow, Dictionary <string, List <string> > errors)
        {
            if (typedRow.StartLatitude == null || typedRow.StartLongitude == null || typedRow.FeatureType != FeatureType.Line)
            {
                return;
            }

            if (typedRow.EndLatitude != null && typedRow.EndLongitude != null)
            {
                if (typedRow.EndLatitude == typedRow.StartLatitude && typedRow.EndLongitude == typedRow.StartLongitude)
                {
                    errors.AddItem($"{Fields.EndLatitude}/{Fields.EndLongitude}", "The start GPS coordinates must not be the same as the end GPS coordinates");
                }
            }
            else
            {
                errors.AddItem($"{Fields.EndLatitude},{Fields.EndLongitude}", "The end GPS coordinates must be provided");
            }
        }
コード例 #5
0
        private void PerformOffsetEitherLineOrPointValidation(WorkReportTyped typedRow)
        {
            if (typedRow.StartOffset == null || typedRow.FeatureType != FeatureType.PointLine)
            {
                return;
            }

            if (typedRow.EndOffset == null)
            {
                typedRow.EndOffset = typedRow.StartOffset;
            }

            if (typedRow.StartOffset == typedRow.EndOffset)
            {
                typedRow.FeatureType = FeatureType.Point;
            }
            else
            {
                typedRow.FeatureType = FeatureType.Line;
            }
        }
コード例 #6
0
        private void PerformGpsPointValidation(WorkReportTyped typedRow, Dictionary <string, List <string> > errors)
        {
            //if start is null, it's already set to invalid, no more validation
            if (typedRow.StartLatitude == null || typedRow.StartLongitude == null || typedRow.FeatureType != FeatureType.Point)
            {
                return;
            }

            if (typedRow.EndLatitude == null)
            {
                typedRow.EndLatitude = typedRow.StartLatitude;
            }

            if (typedRow.EndLongitude == null)
            {
                typedRow.EndLongitude = typedRow.StartLongitude;
            }

            if (typedRow.EndLatitude != typedRow.StartLatitude || typedRow.EndLongitude != typedRow.StartLongitude)
            {
                errors.AddItem($"{Fields.EndLatitude}/{Fields.EndLongitude}", "Start GPS coordinates must be the same as end GPS coordinate");
            }
        }
コード例 #7
0
        private async Task <WorkReportGeometry> PerformSpatialValidationAndConversionAsync(WorkReportTyped typedRow)
        {
            var submissionRow = _submissionRows[(decimal)typedRow.RowNum];
            var workReport    = new WorkReportGeometry(typedRow, null);

            if (typedRow.SpatialData == SpatialData.Gps)
            {
                await PerformSpatialGpsValidation(workReport, submissionRow);

                SetVarianceWarningDetail(submissionRow, typedRow.HighwayUnique,
                                         GetGpsString(typedRow.StartLatitude, typedRow.StartLongitude),
                                         GetGpsString(typedRow.EndLatitude, typedRow.EndLongitude),
                                         typedRow.SpThresholdLevel);
            }
            else if (typedRow.SpatialData == SpatialData.Lrs)
            {
                await PerformSpatialLrsValidation(workReport, submissionRow);

                SetVarianceWarningDetail(submissionRow, typedRow.HighwayUnique,
                                         GetOffsetString(typedRow.StartOffset),
                                         GetOffsetString(typedRow.EndOffset),
                                         typedRow.SpThresholdLevel);
            }

            return(workReport);
        }