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(); }
private void PasteMapFiller(Markup markup, ObjectsMap map, Dictionary <InstanceID, InstanceID> sourceMap) { foreach (var source in sourceMap.Where(p => IsCorrect(p))) { map.AddSegment(source.Key.NetSegment, source.Value.NetSegment); } }
private void MirrorMapFiller(Markup markup, ObjectsMap map, Dictionary <InstanceID, InstanceID> sourceMap) { foreach (var source in sourceMap.Where(p => IsCorrect(p))) { if (!markup.TryGetEnter(source.Value.NetSegment, out Enter enter)) { continue; } var sourceSegment = source.Key.NetSegment; var targetSetment = source.Value.NetSegment; map.AddSegment(sourceSegment, targetSetment); map.AddMirrorEnter(enter); } }
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); }
protected void Paste() { Markup.Clear(); var map = new ObjectsMap(IsMirror); foreach (var source in SourceEnters) { var enterTarget = source.Target as TargetEnter; map.AddSegment(source.Enter.Id, enterTarget?.Enter.Id ?? 0); 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(); }