Пример #1
0
        public void TranslateTo(Messages.RejectedChange message)
        {
            if (message == null)
            {
                throw new ArgumentNullException(nameof(message));
            }

            message.AddRoadSegment = new Messages.AddRoadSegment
            {
                TemporaryId          = TemporaryId,
                StartNodeId          = TemporaryStartNodeId ?? StartNodeId,
                EndNodeId            = TemporaryEndNodeId ?? EndNodeId,
                Geometry             = GeometryTranslator.Translate(Geometry),
                MaintenanceAuthority = MaintenanceAuthority,
                GeometryDrawMethod   = GeometryDrawMethod,
                Morphology           = Morphology,
                Status                = Status,
                Category              = Category,
                AccessRestriction     = AccessRestriction,
                LeftSideStreetNameId  = LeftSideStreetNameId.GetValueOrDefault(),
                RightSideStreetNameId = RightSideStreetNameId.GetValueOrDefault(),
                Lanes = Lanes
                        .Select(item => new Messages.RequestedRoadSegmentLaneAttribute
                {
                    AttributeId  = item.TemporaryId,
                    Count        = item.Count,
                    Direction    = item.Direction,
                    FromPosition = item.From,
                    ToPosition   = item.To
                })
                        .ToArray(),
                Widths = Widths
                         .Select(item => new Messages.RequestedRoadSegmentWidthAttribute
                {
                    AttributeId  = item.TemporaryId,
                    Width        = item.Width,
                    FromPosition = item.From,
                    ToPosition   = item.To
                })
                         .ToArray(),
                Surfaces = Surfaces
                           .Select(item => new Messages.RequestedRoadSegmentSurfaceAttribute
                {
                    AttributeId  = item.TemporaryId,
                    Type         = item.Type,
                    FromPosition = item.From,
                    ToPosition   = item.To
                })
                           .ToArray()
            };
        }