Exemplo n.º 1
0
        static void CreateOneToOne(Model.Node router, int nodeNumber, Dispatcher dispatcher)
        {
            var oneToOne = new Model.Node(nodeNumber, router, "oneToOne")
            {
                Description = "Linear 1:1",
            };

            var labels       = new Model.Node(1, oneToOne, "labels");
            var targetLabels = new Model.Node(1, labels, "targets");
            var sourceLabels = new Model.Node(2, labels, "sources");

            var targets = new List <Model.Signal>();
            var sources = new List <Model.Signal>();

            for (int number = 0; number < 16; number++)
            {
                var targetParameter = new Model.StringParameter(number, targetLabels, IdentOf("t", number), dispatcher, isWriteable: true)
                {
                    Value = IdentOf("OneToOne-T", number),
                };

                targets.Add(new Model.Signal(number, targetParameter));

                var sourceParameter = new Model.StringParameter(number, sourceLabels, IdentOf("s", number), dispatcher, isWriteable: true)
                {
                    Value = IdentOf("OneToOne-S", number),
                };

                sources.Add(new Model.Signal(number, sourceParameter));
            }

            var matrix = new Model.OneToOneMatrix(
                2,
                oneToOne,
                "matrix",
                dispatcher,
                targets,
                sources,
                labels);

            foreach (var target in matrix.Targets)
            {
                matrix.Connect(target, new[] { matrix.GetSource(target.Number) }, null);
            }
        }
Exemplo n.º 2
0
        GlowContainer Model.IElementVisitor <ElementToGlowOptions, GlowContainer> .Visit(Model.OneToOneMatrix element, ElementToGlowOptions state)
        {
            var glow = MatrixToGlow(element, state);

            if (state.DirFieldMask == GlowFieldFlags.All)
            {
                glow.MatrixType = GlowMatrixType.OneToOne;
            }

            return(glow);
        }