Esempio n. 1
0
        public void VisitDiagram(Diagram diagram)
        {
            var savedDiagram = _currentDiagram;

            _currentDiagram = (NationalInstruments.Dfir.Diagram)_map.GetDfirForModel(diagram);

            foreach (var node in diagram.Nodes)
            {
                node.AcceptVisitor(this);
            }

            foreach (var wire in diagram.Wires)
            {
                wire.AcceptVisitor(this);
            }

            _currentDiagram = savedDiagram;
        }
Esempio n. 2
0
        private void TranslateStructure(
            Structure structure,
            Func <NationalInstruments.Dfir.Diagram, NationalInstruments.Dfir.Structure> createStructure,
            Func <NationalInstruments.Dfir.Structure, NationalInstruments.Dfir.Diagram> createNestedDiagram)
        {
            var dfirStructure = createStructure(_currentDiagram);

            _map.AddMapping(structure, dfirStructure);

            _map.AddMapping(structure.NestedDiagrams.First(), dfirStructure.Diagrams.First());
            foreach (var additionalDiagram in structure.NestedDiagrams.Skip(1))
            {
                NationalInstruments.Dfir.Diagram additionalDfirDiagram = createNestedDiagram(dfirStructure);
                _map.AddMapping(additionalDiagram, additionalDfirDiagram);
            }

            foreach (BorderNode borderNode in structure.BorderNodes)
            {
                MapBorderNode(borderNode, TranslateBorderNode(borderNode, dfirStructure));
            }

            structure.NestedDiagrams.ForEach(nestedDiagram => nestedDiagram.AcceptVisitor(this));
        }