public DeviceSymbol(NormalDevice device, DevicePin pin)
 {
     id         = device.Id;
     Assignment = String.Intern(device.Assignment);
     if (String.IsNullOrEmpty(Assignment) && device.GetAttributeValue("IncludeInOWS").Equals("1"))
     {
         Assignment = String.Intern("AssignmentForConnectingBox");
     }
     Name       = device.Name;
     isTerminal = device.IsTerminal();
     if (isTerminal)
     {
         pin.Id = device.PinIds.First();
         Name  += ":" + pin.Name;
     }
     ConnectionIds  = new List <int>();
     bigFont        = new E3Font(alignment: Alignment.Left);
     smallFont      = new E3Font(height: 2.5, alignment: Alignment.Left);
     gridStep       = 4;
     halfGridStep   = gridStep / 2;
     skewLineOffset = gridStep;
 }
        private static void GetDeviceConnectionByIdAndCableInfoById(E3Project project, HashSet <int> electricSchemeSheetIds, out Dictionary <int, DeviceConnection> deviceConnectionById, out Dictionary <int, CableInfo> cableInfoById)
        {
            CableDevice  cable       = project.GetCableDeviceById(0);
            CableCore    core        = project.GetCableCoreById(0);
            NormalDevice startDevice = project.GetNormalDeviceById(0);
            NormalDevice endDevice   = project.GetNormalDeviceById(0);
            DevicePin    startPin    = project.GetDevicePinById(0);
            DevicePin    endPin      = project.GetDevicePinById(0);
            WireCore     wire        = project.GetWireCoreById(0);

            deviceConnectionById = new Dictionary <int, DeviceConnection>();
            cableInfoById        = new Dictionary <int, CableInfo>();
            int connectionId = 0;

            foreach (int cableId in project.CableIds)
            {
                cable.Id = cableId;
                foreach (int coreId in cable.CoreIds)
                {
                    core.Id = coreId;
                    int startPinId = core.StartPinId;
                    int endPinId   = core.EndPinId;
                    if (endPinId == 0 || startPinId == 0)   // проверка на неподключенные концы
                    {
                        continue;
                    }
                    startPin.Id = startPinId;                               // id вывода
                    if (!electricSchemeSheetIds.Contains(startPin.SheetId)) // проверка на то, что вывод расположен на принципиальной схеме
                    {
                        continue;
                    }
                    endPin.Id = endPinId;
                    if (!electricSchemeSheetIds.Contains(endPin.SheetId))
                    {
                        continue;
                    }
                    startDevice.Id = startPinId;
                    endDevice.Id   = endPinId;
                    if (startDevice.Assignment.Equals(endDevice.Assignment) && !(startDevice.GetAttributeValue("IncludeInOWS").Equals("1") || endDevice.GetAttributeValue("IncludeInOWS").Equals("1")))
                    {
                        continue;
                    }
                    string signal = startPin.SignalName;
                    deviceConnectionById.Add(connectionId++, new DeviceConnection(startDevice.Id, startPin.Name, endDevice.Id, endPin.Name, cableId, signal));
                    string lengthAttribute = "Lenght_m_sp";
                    if (!cableInfoById.ContainsKey(cableId))
                    {
                        cableInfoById.Add(cableId, new CableInfo(cable, lengthAttribute));
                    }
                    cableInfoById[cableId].Signals.Add(signal);
                }
            }
            foreach (int wireId in project.WireIds)
            {
                wire.Id = wireId;
                int startPinId = wire.StartPinId;
                int endPinId   = wire.EndPinId;
                if (endPinId == 0 || startPinId == 0)   // проверка на неподключенные концы
                {
                    continue;
                }
                startPin.Id = startPinId;                               // id вывода
                if (!electricSchemeSheetIds.Contains(startPin.SheetId)) // проверка на то, что вывод расположен на принципиальной схеме
                {
                    continue;
                }
                endPin.Id = endPinId;
                if (!electricSchemeSheetIds.Contains(endPin.SheetId))
                {
                    continue;
                }
                startDevice.Id = startPinId;
                endDevice.Id   = endPinId;
                if (startDevice.Assignment.Equals(endDevice.Assignment) && !(startDevice.GetAttributeValue("IncludeInOWS").Equals("1") || endDevice.GetAttributeValue("IncludeInOWS").Equals("1")))
                {
                    continue;
                }
                string signal = startPin.SignalName;
                deviceConnectionById.Add(connectionId++, new DeviceConnection(startDevice.Id, startPin.Name, endDevice.Id, endPin.Name, wireId, signal));
                string lengthAttribute = "Lenght_m_sp";
                if (!cableInfoById.ContainsKey(wireId))
                {
                    cableInfoById.Add(wireId, new CableInfo(wire, lengthAttribute));
                }
                cableInfoById[wireId].Signals.Add(signal);
            }
        }