protected void Paste() { Markup.Clear(); var map = new ObjectsMap(IsMirror); foreach (var source in SourceEnters) { var enterTarget = source.Target as TargetEnter; var sourceId = source.Enter.Id; var targetId = enterTarget?.Enter.Id ?? 0; switch (Markup.Type) { case MarkupType.Node: map.AddSegment(sourceId, targetId); break; case MarkupType.Segment: map.AddNode(sourceId, targetId); break; } if (enterTarget != null) { for (var i = 0; i < source.Points.Length; i += 1) { map.AddPoint(enterTarget.Enter.Id, (byte)(i + 1), (byte)((source.Points[i].Target as Target)?.Num + 1 ?? 0)); } } } Markup.FromXml(Mod.Version, IntersectionTemplate.Data, map); Panel.UpdatePanel(); }
public ObjectsMap GetMap(ushort[] targetSegments, ushort[] tagretNodes) { var map = new ObjectsMap(); var segmentsCount = Math.Min(Segments.Length, targetSegments.Length); for (var i = 0; i < segmentsCount; i += 1) { map.AddSegment(Segments[i], targetSegments[i]); } var nodesCount = Math.Min(Nodes.Length, tagretNodes.Length); for (var i = 0; i < nodesCount; i += 1) { map.AddNode(Nodes[i], tagretNodes[i]); } return(map); }