コード例 #1
0
ファイル: BaseOrderMode.cs プロジェクト: caillou15/NodeMarkup
        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();
        }
コード例 #2
0
 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);
     }
 }
コード例 #3
0
        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);
            }
        }
コード例 #4
0
        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);
        }
コード例 #5
0
        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();
        }