コード例 #1
0
        private IList <ConnectionPoint> GetConnectionPoints(PositionalComponent component, LayoutOptions layoutOptions)
        {
            var description = descriptionLookup.GetDescription(component.Type);

            if (description == null)
            {
                throw new ApplicationException($"No component description available for {component.Type}");
            }

            return(connectionPositioner.PositionConnections(component, description, layoutOptions));
        }
コード例 #2
0
        public void LayoutHorizontal()
        {
            var instance = new PositionalComponent(new ComponentType(ComponentType.UnknownCollection, "test"));

            instance.Layout.Size = 100;

            var connectionGroups = new[]
            {
                new ConnectionGroup(ConditionTree.Empty, new[]
                {
                    new ConnectionDescription(new ComponentPoint(ComponentPosition.Start, ComponentPosition.Start, new Vector()),
                                              new ComponentPoint(ComponentPosition.Start, ComponentPosition.Start, new Vector(45, 0)),
                                              ConnectionEdge.Start,
                                              "Connection1"),
                })
            };

            var description = new ComponentDescription
            {
                Connections = connectionGroups
            };

            var positioned = positioner.PositionConnections(instance, description, new LayoutOptions
            {
                GridSize = 10.0
            });

            Assert.That(positioned, Has.Count.EqualTo(5));

            // First is edge
            Assert.That(positioned[0].Location, Is.EqualTo(new Point(0, 0)));
            Assert.That(positioned[0].Flags, Is.EqualTo(ConnectionFlags.Horizontal | ConnectionFlags.Edge));

            // Remaining are not edges
            for (int i = 1; i < positioned.Count; i++)
            {
                var c = positioned[i];
                Assert.That(c.Location, Is.EqualTo(new Point(i * 10, 0)));
                Assert.That(c.Flags, Is.EqualTo(ConnectionFlags.Horizontal));
            }
        }
コード例 #3
0
        private IList <ConnectionPoint> GetConnectionPoints(PositionalComponent component, LayoutOptions layoutOptions)
        {
            var description = descriptionLookup.GetDescription(component.Type);

            return(connectionPositioner.PositionConnections(component, description, layoutOptions));
        }