Beispiel #1
0
        /// <inheritdoc />
        public override IBorderNodeGuide GetGuide(BorderNode borderNode)
        {
            var                      max    = GetMaxXYForBorderNode(this, borderNode);
            RectangleSides           sides  = GetSidesForBorderNode(borderNode);
            var                      height = max.Y + borderNode.Height + OuterBorderThickness.Bottom;
            var                      width  = max.X + borderNode.Width + OuterBorderThickness.Right;
            RectangleBorderNodeGuide guide  = new RectangleBorderNodeGuide(
                new SMRect(0, 0, width, height),
                sides,
                BorderNodeDocking.None,
                OuterBorderThickness,
                GetAvoidRects(borderNode));

            guide.EdgeOverflow = StockDiagramGeometries.StandardTunnelOffsetForStructures;
            return(guide);
        }
Beispiel #2
0
        /// <inheritdoc />
        /// <remarks>Adapted from NationalInstruments.VI.SourceModel.Loop.GetGuide.</remarks>
        public override IBorderNodeGuide GetGuide(BorderNode borderNode)
        {
            var loopTerminateLifetimeTunnel = borderNode as LoopTerminateLifetimeTunnel;

            if (loopTerminateLifetimeTunnel != null)
            {
                var height = GetMaxXYForBorderNode(this, borderNode).Y + borderNode.Height + OuterBorderThickness.Bottom;
                List <BorderNode> except = new List <BorderNode>()
                {
                    (BorderNode)loopTerminateLifetimeTunnel.BeginLifetimeTunnel,
                    loopTerminateLifetimeTunnel
                };
                return(new TerminateLifetimeTunnelGuide(
                           new SMRect(0, 0, Width, height),
                           loopTerminateLifetimeTunnel,
                           OuterBorderThickness,
                           BorderNodes.Except(except).Select(node => node.Bounds))
                {
                    EdgeOverflow = StockDiagramGeometries.StandardTunnelOffsetForStructures
                });
            }
            else if (borderNode is LoopBorrowTunnel || borderNode is LoopConditionTunnel || borderNode is LoopIterateTunnel)
            {
                var height = GetMaxXYForBorderNode(this, borderNode).Y + borderNode.Height + OuterBorderThickness.Bottom;
                // TerminateLifetimeTunnels do all the moving, but this guide ensures the left node is not out of place or on the wrong docking side.
                RectangleBorderNodeGuide guide = new RectangleBorderNodeGuide(
                    new SMRect(0, 0, Width, height),
                    RectangleSides.Left,
                    BorderNodeDocking.None,
                    OuterBorderThickness,
                    BorderNodes.Where(node => node != borderNode).Select(node => node.Bounds));
                guide.EdgeOverflow = StockDiagramGeometries.StandardTunnelOffsetForStructures;
                return(guide);
            }
            return(base.GetGuide(borderNode));
        }