Example #1
0
        private void AddToTerminalEnds(Guid terminalId, SpanSegment spanSegment, BlockPortTerminal digramTerminal, string style)
        {
            var terminalEndHolder = new TerminalEndHolder()
            {
                TerminalId      = terminalId,
                SpanSegment     = spanSegment,
                DiagramTerminal = digramTerminal,
                Style           = style
            };

            if (_terminalEndsByTerminalId.TryGetValue(terminalId, out var terminalEndHolders))
            {
                terminalEndHolders.Add(terminalEndHolder);
            }
            else
            {
                _terminalEndsByTerminalId[terminalId] = new List <TerminalEndHolder>()
                {
                    terminalEndHolder
                };
            }
        }
        private void AddToTerminalIndex(Dictionary <Guid, List <TerminalIndexRecord> > terminalIndex, Guid terminalId, SpanEquipmentViewModel spanEquipmentViewModel, SpanSegment spanSegment, ushort structurePosition)
        {
            if (terminalId == Guid.Empty)
            {
                return;
            }

            if (terminalIndex.ContainsKey(terminalId))
            {
                terminalIndex[terminalId].Add(
                    new TerminalIndexRecord()
                {
                    SpanEquipmentViewModel = spanEquipmentViewModel,
                    SpanSegment            = spanSegment,
                    StructurePosition      = structurePosition
                }
                    );
            }
            else
            {
                terminalIndex[terminalId] = new List <TerminalIndexRecord> {
                    new TerminalIndexRecord()
                    {
                        SpanEquipmentViewModel = spanEquipmentViewModel,
                        SpanSegment            = spanSegment,
                        StructurePosition      = structurePosition
                    }
                };
            }
        }