Ejemplo n.º 1
0
        /// <summary>
        /// Ищет на текущей диаграмме коннекторы для элементов, которые принадлежат к перечисленному ПО
        /// </summary>
        /// <param name=""></param>
        /// <returns></returns>
        public static List <ConnectorData> GetDAForSoftwareOnDiagram(List <string> selectedSoftware)
        {
            List <ConnectorData> result = new List <ConnectorData>();

            foreach (EA.DiagramObject diagramObject in CurrentDiagram.DiagramObjects)
            {
                EA.Element element         = EARepository.GetElementByID(diagramObject.ElementID);
                string     elementSoftware = LibraryHelper.GetElementSoftwareName(element);

                if (selectedSoftware.Contains(elementSoftware))
                {
                    foreach (EA.Connector connector in element.Connectors)
                    {
                        EA.DiagramLink diagramLink = DiagramLinkHelper.GetDLFromConnector(connector.ConnectorID);
                        if (diagramLink != null)
                        {
                            ConnectorData connectorData = new ConnectorData(connector);
                            result.Add(connectorData);
                        }
                    }
                }
            }



            return(result);
        }
        private void tsbShow_Click(object sender, EventArgs e)
        {
            // Сначала запрашиваем стиль и пообще не передумали ли мы
            ExecResult <SetLinkStyle> setLinkStyleResult = new FLinkStyle().Execute();

            if (setLinkStyleResult.code != 0)
            {
                return;
            }

            // Проходимся по списку выделенных коннекторов
            foreach (ListViewItem item in lvConnectors.SelectedItems)
            {
                ConnectorData connectorData = (ConnectorData)item.Tag;

                EA.DiagramLink diagramLink = DiagramLinkHelper.GetDLFromConnector(connectorData.ConnectorID);
                if (diagramLink == null)
                {
                    diagramLink = DiagramLinkHelper.CreateDiagramLink(connectorData.Connector);
                }

                DiagramLinkHelper.SetDiagramLinkVisibility(diagramLink, true); // устанавливаем видимость
                item.Text = (!diagramLink.IsHidden).ToString();

                if (setLinkStyleResult.value.DoSetLinkStyle) // устанавливаем стиль линий
                {
                    DiagramLinkHelper.ApplyStyleToDL(diagramLink, setLinkStyleResult.value);
                }
            }
        }
Ejemplo n.º 3
0
        private static void linkToParent(EA.Repository Repository, EA.Diagram diagram, EA.Element sample, EA.Element parent)
        {
            foreach (EA.Connector con in sample.Connectors)
            {
                logger.log("Connector:" + con.SupplierEnd.Role);
                EA.Element related = null;

                if (sample.ElementID == con.ClientID && parent.ElementID == con.SupplierID)
                {
                    logger.log("Found parent link");
                    return;
                }
                else if (sample.ElementID == con.SupplierID && parent.ElementID == con.ClientID)
                {
                    logger.log("Found parent link");
                    return;
                }
            }

            logger.log("No  parent link found");
            EA.Connector link = sample.Connectors.AddNew("", "Association");
            link.SupplierID = parent.ElementID;
            link.Update();

            EA.DiagramLink dl = diagram.DiagramLinks.AddNew("", "");
            dl.ConnectorID = link.ConnectorID;
            sample.Connectors.Refresh();
            dl.Update();
        }
        private int AddConnector(EA.Diagram diagram, EA.Element eaElSource, EA.Element eaElDest, string strText, string strControlType, string strPath = "")
        {
            string strLogInfo = "Connector for operation: " + strText;

            EAImporter.LogMsg(EAImporter.LogMsgType.Adding, strLogInfo);

            EA.Connector eConnector = eaElSource.Connectors.AddNew(strText, strControlType);
            if (eConnector == null)
            {
                EAImporter.LogError(EAImporter.LogErrorLevel.A, strLogInfo);
                return(0);
            }

            // eConnector.Notes = strNotes;
            eConnector.SupplierID = eaElDest.ElementID;
            eConnector.Width      = 2;
            eConnector.Update();

            EA.DiagramLink eDiagramLink = diagram.DiagramLinks.AddNew(strText, strControlType);
            if (eDiagramLink == null)
            {
                EAImporter.LogError(EAImporter.LogErrorLevel.A, strLogInfo);
                return(0);
            }

            eDiagramLink.ConnectorID = eConnector.ConnectorID;
            if (strPath != "")
            {
                eDiagramLink.Path = strPath;
            }
            eDiagramLink.Update();

            EAImporter.LogMsg(EAImporter.LogMsgType.Added, strLogInfo);
            return(0);
        }
Ejemplo n.º 5
0
        private static void sync_relationship(EA.Repository Repository, EA.Diagram diagram, String connectorGuid, EA.Element source, EA.Element target, JObject jo, EA.Package pkg)
        {
            if (checkRelationship(Repository, connectorGuid, source, target))
            {
                //logger.log("Relationship exists:"+source.Name+":"+target.Name);
            }
            else
            {
                logger.log("Adding Relationship:" + source.Name + ":" + target.Name);

                //Add relationship  logger.log("No  parent link found");
                EA.Connector link = source.Connectors.AddNew("", "Association");
                link.SupplierID = target.ElementID;
                link.Update();
                source.Update();
                target.Update();

                EA.DiagramLink dl = diagram.DiagramLinks.AddNew("", "");
                dl.ConnectorID = link.ConnectorID;
                dl.Update();

                source.Connectors.Refresh();
                target.Connectors.Refresh();
            }
        }
Ejemplo n.º 6
0
        private void mergeDiagrams(EA.Repository repository, EA.Package package)
        {
            Dictionary <int, EA.DiagramObject> dobjects = new Dictionary <int, EA.DiagramObject>();
            Dictionary <int, EA.DiagramLink>   dlinks   = new Dictionary <int, EA.DiagramLink>();

            foreach (EA.Diagram diagram in package.Diagrams)
            {
                foreach (EA.DiagramObject dobject in diagram.DiagramObjects)
                {
                    dobjects[dobject.ElementID] = dobject;
                }
                foreach (EA.DiagramLink dlink in diagram.DiagramLinks)
                {
                    dlinks[dlink.ConnectorID] = dlink;
                }
            }

            EA.Diagram mdiagram = (EA.Diagram)package.Diagrams.AddNew(string.Format("{0} (Merged)", package.Name), "Custom");
            mdiagram.Update();

            // copy objects
            int       left    = 10;
            int       top     = 10;
            const int width   = 100;
            const int height  = 80;
            const int padding = 10;

            foreach (EA.DiagramObject dobject in dobjects.Values)
            {
                EA.Element element = repository.GetElementByID(dobject.ElementID);
                if ("Boundary".Equals(element.Type))
                {
                    continue;
                }

                string dimensions = string.Format("l={0};r={1};t={2};b={3};", left, left + width, top, top + height);
                left += padding + width;
                EA.DiagramObject mobject = (EA.DiagramObject)mdiagram.DiagramObjects.AddNew(dimensions, "");
                mobject.ElementID = element.ElementID;
                mobject.Update();

                if (left == 1000)
                {
                    left = 10;
                    top += height;
                }
            }
            mdiagram.Update();

            // copy links (o.a. NoteLinks)
            foreach (EA.DiagramLink dlink in dlinks.Values)
            {
                EA.DiagramLink mlink = (EA.DiagramLink)mdiagram.DiagramLinks.AddNew("", "");
                mlink.ConnectorID = dlink.ConnectorID;
                mlink.Update();
            }

            package.Update();
            repository.OpenDiagram(mdiagram.DiagramID);
        }
Ejemplo n.º 7
0
        public static EA.DiagramLink CreateDiagramLink(EA.Connector connector)
        {
            EA.DiagramLink diagramLink = CurrentDiagram.DiagramLinks.AddNew("", "");
            diagramLink.ConnectorID = connector.ConnectorID;
            diagramLink.Update();

            return(diagramLink);
        }
Ejemplo n.º 8
0
        private static int markConnectorOnDiagram(SQLConnector connector, SQLRepository repository)
        {
            int count = 0;

            try
            {
                List <String> diagramIdsOfClient   = EAUtil.getDiagramIDsOfObject(repository.GetElementByID(connector.ClientID), repository);
                List <String> diagramIdsOfSupplier = EAUtil.getDiagramIDsOfObject(repository.GetElementByID(connector.SupplierID), repository);
                List <int>    diagramIds           = new List <int>();
                foreach (String clientDiagId in diagramIdsOfClient)
                {
                    foreach (String suppDiagId in diagramIdsOfSupplier)
                    {
                        if (clientDiagId != "" && suppDiagId != "")
                        {
                            if (clientDiagId == suppDiagId)
                            {
                                diagramIds.Add(int.Parse(clientDiagId));
                                count++;
                            }
                        }
                    }
                }
                if (diagramIds.Count == 0)
                {
                    return(0);
                }

                foreach (int diagramId in diagramIds)
                {
                    EA.Diagram     diagram       = repository.GetOriginalRepository().GetDiagramByID(diagramId);
                    EA.DiagramLink diagramObject = null;
                    foreach (EA.DiagramLink diagLink in diagram.DiagramLinks)
                    {
                        if (diagLink.ConnectorID == connector.ConnectorID && diagLink.IsHidden == false)
                        {
                            diagramObject = diagLink;
                        }
                    }
                    if (diagramObject != null)
                    {
                        repository.OpenDiagram(diagramObject.DiagramID);
                        repository.GetCurrentDiagram().SelectedConnector = connector.getRealConnector();
                        repository.SaveDiagram(diagramObject.DiagramID);
                        break;
                        //repository.ReloadDiagram(diagramObject.DiagramID);
                    }
                }
            }
            catch
            {
            }

            return(count);
        }
Ejemplo n.º 9
0
        private void addTGGLinkVariableCopyToRule(EA.Connector connectorToBeCopied)
        {
            EA.Element newSource = newElementIdToNewElement[oldElementIdToNewElementId[connectorToBeCopied.ClientID]];
            EA.Element newTarget = newElementIdToNewElement[oldElementIdToNewElementId[connectorToBeCopied.SupplierID]];

            EA.Connector newConnector = newSource.Connectors.AddNew("", connectorToBeCopied.Type) as EA.Connector;
            newConnector.Stereotype       = TGGModelingMain.TggLinkVariableStereotype;
            newConnector.ClientEnd.Role   = connectorToBeCopied.ClientEnd.Role;
            newConnector.SupplierEnd.Role = connectorToBeCopied.SupplierEnd.Role;
            newConnector.SupplierID       = newTarget.ElementID;
            newConnector.ClientID         = newSource.ElementID;
            newConnector.Update();
            if (connectorToBeCopied.Stereotype == TGGModelingMain.TggLinkVariableStereotype)
            {
                foreach (EA.ConnectorTag tag in connectorToBeCopied.TaggedValues)
                {
                    EA.ConnectorTag newTag = newConnector.TaggedValues.AddNew(tag.Name, "") as EA.ConnectorTag;
                    if (!checkBoxExactCopy.Checked)
                    {
                        newTag.Value = tag.Value.Replace("create", "check_only");
                        newTag.Notes = tag.Notes.Replace("\"bindingOperator\" value=\"create", "\"bindingOperator\" value=\"check_only");
                    }
                    else
                    {
                        newTag.Value = tag.Value;
                        newTag.Notes = tag.Notes;
                    }
                    newTag.Update();
                }
            }
            EA.DiagramLink newDiagramLink = newRuleDiagram.DiagramLinks.AddNew("", newConnector.Type) as EA.DiagramLink;
            newDiagramLink.ConnectorID = newConnector.ConnectorID;
            newDiagramLink.Update();
            if (connectorToBeCopied.Stereotype != TGGModelingMain.TggLinkVariableStereotype)
            {
                LinkDialogueEntry linkEntry = new LinkDialogueEntry();
                linkEntry.direction = LinkDialogueEntryDirection.RIGHT;
                linkEntry.CorrespondingConnectorGuid = connectorToBeCopied.ConnectorGUID;
                if (newConnector.ClientEnd.Role != "")
                {
                    linkEntry.supplierRoleName = newConnector.ClientEnd.Role;
                }
                else if (newConnector.SupplierEnd.Role != "")
                {
                    linkEntry.supplierRoleName = newConnector.SupplierEnd.Role;
                }
                TGGLinkVariable tggLv = new TGGLinkVariable(repository.GetConnectorByID(newConnector.ConnectorID), repository);
                tggLv.linkDialogueEntry = linkEntry;
                if (!checkBoxExactCopy.Checked)
                {
                    tggLv.BindingOperator = SDMModeling.SDMExportWrapper.patterns.BindingOperator.CREATE;
                }
                tggLv.saveTreeToEATaggedValue(true);
            }
        }
Ejemplo n.º 10
0
 /// <summary>
 /// Searches for a DiagramObject with the same ID as the connector on the given diagram
 /// </summary>
 /// <param name="element"></param>
 /// <param name="diagram"></param>
 /// <returns>The found DiagramObject or null if there exists none</returns>
 public static EA.DiagramLink findDiagramObject(EA.Connector element, EA.Diagram diagram)
 {
     EA.DiagramLink val = null;
     foreach (EA.DiagramLink diagObj in diagram.DiagramLinks)
     {
         if (diagObj.ConnectorID == element.ConnectorID)
         {
             val = diagObj; break;
         }
     }
     return(val);
 }
Ejemplo n.º 11
0
        /// <summary>
        /// Включает/выключает показ коннекторов указанного типа на диаграмме
        /// </summary>
        /// <param name="linkType"></param>
        /// <param name="visibility"></param>
        public void SetConnectorVisibility(LinkType linkType, bool visibility = true)
        {
            // проходимся по элементам диаграммы
            foreach (EA.DiagramObject diagramObject in CurrentDiagram.DiagramObjects)
            {
                // Получаем элемент
                EA.Element diagramElement = EARepository.GetElementByID(diagramObject.ElementID);

                // Получаем коннекторы элемента
                foreach (EA.Connector connector in diagramElement.Connectors)
                {
                    // Получаем тип коннектора
                    try
                    {
                        LinkType curLinkType = LTHelper.GetConnectorType(connector);
                        if (linkType != curLinkType)
                        {
                            continue;
                        }
                    }
                    catch (Exception ex)
                    {
                        Logger.OutA("Не удалось определить тип коннектора " + ex.StackTrace, new EA.Connector[] { connector });
                        continue;
                    }

                    // проверяем, что коннектор может быть потенциально показан на диаграмме, т.е, что оба его элемента на диаграмме
                    EA.Element       secondElement   = EARepository.GetElementByID((connector.ClientID == diagramElement.ElementID) ? connector.SupplierID : connector.ClientID);
                    EA.DiagramObject secondElementDA = CurrentDiagram.GetDiagramObjectByID(secondElement.ElementID, "");
                    if (secondElementDA == null)
                    {
                        continue;
                    }

                    // Теперь смотрим на настройки видимости коннектора
                    if (LibraryHelper.IsLibrary(connector))
                    {
                        LinkType connectorlinkType = LTHelper.GetConnectorType(connector);
                        if (linkType == connectorlinkType)
                        {
                            EA.DiagramLink connectorLink = DiagramLinkHelper.GetDLForConnector(connector);
                            if (connectorLink == null)
                            {
                                connectorLink = DiagramLinkHelper.CreateDiagramLink(connector);
                                connectorLink.Update();
                            }

                            DiagramLinkHelper.SetDiagramLinkVisibility(connectorLink, visibility);
                        }
                    }
                }
            }
        }
Ejemplo n.º 12
0
        /// <summary>
        /// AddConnector
        /// </summary>
        /// <param name="diagram"></param>
        /// <param name="eElement"></param>
        /// <param name="strFullOpName"></param>
        /// <param name="strEvent"></param>
        /// <param name="iSupplierID"></param>
        /// <param name="iSeqNo"></param>
        private void AddConnector(EA.Diagram diagram, EA.Element eElement, string strFullOpName, string strEvent, int iSupplierID, int iSeqNo, string strNotes)
        {
            string strLogInfo = "Connector for operation: " + strFullOpName;

            EAImporter.LogMsg(EAImporter.LogMsgType.Adding, strLogInfo);

            EA.Connector eConnector = null;

            //for (short i = 0; i < eElement.Connectors.Count; i++)
            //{
            //    Application.DoEvents();

            //    eConnector = eElement.Connectors.GetAt(i);

            //    if (eConnector.Name == strFullOpName)
            //    {
            //        break;
            //    }
            //    else
            //    {
            //        eConnector = null;
            //    }
            //}

            if (eConnector == null)
            {
                eConnector       = eElement.Connectors.AddNew(strFullOpName, "Sequence");
                eConnector.Notes = strNotes;

                eConnector.SequenceNo       = iSeqNo;
                eConnector.SupplierID       = iSupplierID;
                eConnector.TransitionAction = "Call";
                eConnector.TransitionEvent  = "Synchronus";
                eConnector.TransitionGuard  = "params=;paramsDlg=param1;";
                eConnector.Update();

                eConnector.StartPointY = eConnector.StartPointY + 1;
                eConnector.Update();

                EAImporter.LogMsg(EAImporter.LogMsgType.Added, strLogInfo);
            }
            else
            {
                EAImporter.LogMsg(EAImporter.LogMsgType.Exists, strLogInfo);
            }

            EA.DiagramLink eDiagramLink = diagram.DiagramLinks.AddNew(strEvent, "sequence");
            eDiagramLink.ConnectorID = eConnector.ConnectorID;
            eDiagramLink.Update();

            diagram.Update();
        }
Ejemplo n.º 13
0
 static public void captureDiagramLinks(EA.Diagram diagram)
 {
     diagramLinks = new List <int>();
     foreach (object link in diagram.DiagramLinks)
     {
         EA.DiagramLink l = (EA.DiagramLink)link;
         if (!l.IsHidden)
         {
             diagramLinks.Add(l.ConnectorID);
         }
     }
     logger.log("Number of diagram links:" + diagramLinks.Count);
 }
Ejemplo n.º 14
0
        public ConnectorData(EA.DiagramLink diagramLink) : base()
        {
            ConnectorID = diagramLink.ConnectorID;

            Name      = Connector.Name;
            Notes     = Connector.Notes;
            LinkType  = LTHelper.GetConnectorType(Connector);
            FlowID    = EATVHelper.GetTaggedValue(Connector, DAConst.DP_FlowIDTag);
            SegmentID = EATVHelper.GetTaggedValue(Connector, DAConst.DP_SegmentIDTag);

            SourceElementID = Connector.ClientID;
            TargetElementID = Connector.SupplierID;
        }
Ejemplo n.º 15
0
        /// <summary>
        /// Ищет линк коннектора на текущей диаграмме
        /// </summary>
        /// <param name="connector"></param>
        /// <returns></returns>
        public static EA.DiagramLink GetDLForConnector(EA.Connector connector)
        {
            EA.DiagramLink result = null;

            foreach (EA.DiagramLink diagramLink in Context.CurrentDiagram.DiagramLinks)
            {
                if (diagramLink.ConnectorID == connector.ConnectorID)
                {
                    result = diagramLink;
                    break;
                }
            }

            return(result);
        }
Ejemplo n.º 16
0
        /// <summary>
        /// Возвращает если есть линк на текущей диаграмме для указанного коннектора
        /// </summary>
        /// <param name=""></param>
        /// <returns></returns>
        public static EA.DiagramLink GetDLFromConnector(int connectorID)
        {
            EA.DiagramLink result = null;

            EA.Collection diagramLinks = Context.CurrentDiagram.DiagramLinks;

            foreach (EA.DiagramLink diagramLink in diagramLinks)
            {
                if (diagramLink.ConnectorID == connectorID)
                {
                    result = diagramLink;
                    break;
                }
            }

            return(result);
        }
        private void tsbHide_Click(object sender, EventArgs e)
        {
            // Проходимся по списку выделенных коннекторов
            foreach (ListViewItem item in lvConnectors.SelectedItems)
            {
                ConnectorData connectorData = (ConnectorData)item.Tag;

                EA.DiagramLink diagramLink = DiagramLinkHelper.GetDLFromConnector(connectorData.ConnectorID);
                if (diagramLink == null)
                {
                    diagramLink = DiagramLinkHelper.CreateDiagramLink(connectorData.Connector);
                }

                DiagramLinkHelper.SetDiagramLinkVisibility(diagramLink, false); // устанавливаем видимость
                item.Text = (!diagramLink.IsHidden).ToString();
            }
        }
Ejemplo n.º 18
0
        private static void sync_relationship(EA.Repository Repository, EA.Diagram diagram, EA.Element source, EA.Element target, JObject jo, EA.Package pkg)
        {
            logger.log("Adding Relationship:");

            //Add relationship  logger.log("No  parent link found");
            EA.Connector link = source.Connectors.AddNew("", "Association");
            link.SupplierID = target.ElementID;
            link.Update();
            source.Update();
            target.Update();

            EA.DiagramLink dl = diagram.DiagramLinks.AddNew("", "");
            dl.ConnectorID = link.ConnectorID;
            dl.Update();

            source.Connectors.Refresh();
            target.Connectors.Refresh();
        }
Ejemplo n.º 19
0
        private EA.Connector createNewConnection(Dictionary <SQLElement, EA.DiagramObject> elementsToDiagramObjects, EA.Diagram currentDiagram, String objectName, String attributeName)
        {
            foreach (SQLElement diagramElement in elementsToDiagramObjects.Keys)
            {
                if (diagramElement.Name == objectName)
                {
                    EA.Connector connector = constraintElement.getRealElement().Connectors.AddNew(attributeName, Main.EADependencyType) as EA.Connector;
                    connector.SupplierID   = diagramElement.ElementID;
                    connector.StereotypeEx = "ConstraintLink";
                    connector.Update();

                    EA.DiagramLink diagramLink = currentDiagram.DiagramLinks.AddNew("", Main.EADependencyType) as EA.DiagramLink;
                    diagramLink.ConnectorID = connector.ConnectorID;
                    diagramLink.Update();
                    return(connector);
                }
            }
            return(null);
        }
Ejemplo n.º 20
0
        public static void ApplyStyleToDL(EA.DiagramLink diagramLink, SetLinkStyle setLinkStyle)
        {
            if (setLinkStyle.DoSetLinkStyle)
            {
                if (setLinkStyle.SetLineWidth)
                {
                    diagramLink.LineWidth = setLinkStyle.LineWidth;
                }

                if (setLinkStyle.SetColor)
                {
                    diagramLink.LineColor = (setLinkStyle.Color.B * 256 + setLinkStyle.Color.G) * 256 + setLinkStyle.Color.R;
                }

                if (setLinkStyle.SetLineStyle)
                {
                    diagramLink.LineStyle = setLinkStyle.LineStyle;
                }
            }

            diagramLink.Update();
        }
Ejemplo n.º 21
0
        /// <summary>
        /// Устанавливает видимость для нетипизированных коннекторов на диаграмме
        /// </summary>
        public void SetConnectorVisibility_Untyped(bool visibility = true)
        {
            // проходимся по элементам диаграммы
            foreach (EA.DiagramObject diagramObject in CurrentDiagram.DiagramObjects)
            {
                // Получаем элемент
                EA.Element diagramElement = EARepository.GetElementByID(diagramObject.ElementID);

                // Получаем коннекторы элемента
                foreach (EA.Connector connector in diagramElement.Connectors)
                {
                    // Проверяем тип коннектора
                    if (LibraryHelper.IsLibrary(connector))
                    {
                        continue;
                    }

                    // проверяем, что коннектор может быть потенциально показан на диаграмме, т.е, что оба его элемента на диаграмме
                    EA.Element       secondElement   = EARepository.GetElementByID((connector.ClientID == diagramElement.ElementID) ? connector.SupplierID : connector.ClientID);
                    EA.DiagramObject secondElementDA = CurrentDiagram.GetDiagramObjectByID(secondElement.ElementID, "");
                    if (secondElementDA == null)
                    {
                        continue;
                    }

                    // Получаем линк коннектора на диаграмме
                    EA.DiagramLink connectorLink = DiagramLinkHelper.GetDLForConnector(connector);
                    if (connectorLink == null)
                    {
                        continue;
                    }

                    // Устанавливаем видимость
                    DiagramLinkHelper.SetDiagramLinkVisibility(connectorLink, visibility);
                }
            }
        }
Ejemplo n.º 22
0
 public static void SetDiagramLinkVisibility(EA.DiagramLink diagramLink, bool visibility)
 {
     diagramLink.IsHidden = !visibility;
     diagramLink.Update();
 }
Ejemplo n.º 23
0
        public static EA.Connector CreateConnector(ConnectorData createNewLinkData, bool putOnDiagram = true)
        {
            EA.Connector newConnector = null;

            EA.Element firstElement  = EARepository.GetElementByID(createNewLinkData.SourceElementID);
            EA.Element secondElement = EARepository.GetElementByID(createNewLinkData.TargetElementID);

            // Определяем тип создаваемого коннектора
            string creatingConnectorType;

            switch (createNewLinkData.LinkType)
            {
            case LinkType.Communication:
            case LinkType.Deploy:
                creatingConnectorType = "Dependency";
                break;

            case LinkType.InformationFlow:
                creatingConnectorType = "InformationFlow";
                break;

            case LinkType.SoftwareClassification:
                creatingConnectorType = "Generalization";
                break;

            default:
                throw new Exception("Непредусмотренный тип коннектора при создании");
            }

            // Создаём
            newConnector = firstElement.Connectors.AddNew("", creatingConnectorType);

            if (createNewLinkData.LinkType == LinkType.InformationFlow || createNewLinkData.LinkType == LinkType.Deploy)
            {
                newConnector.Direction = "Source -> Destination";
            }
            else
            {
                newConnector.Direction = "Unspecified";
            }
            newConnector.ClientID   = firstElement.ElementID;
            newConnector.SupplierID = secondElement.ElementID;

            newConnector.Name  = createNewLinkData.Name;
            newConnector.Notes = createNewLinkData.Notes;

            newConnector.Update();

            EATVHelper.TaggedValueSet(newConnector, DAConst.DP_LibraryTag, "");
            EATVHelper.TaggedValueSet(newConnector, DAConst.DP_LinkTypeTag, Enum.GetName(typeof(LinkType), createNewLinkData.LinkType));
            EATVHelper.TaggedValueSet(newConnector, DAConst.DP_FlowIDTag, createNewLinkData.FlowID);
            EATVHelper.TaggedValueSet(newConnector, DAConst.DP_SegmentIDTag, createNewLinkData.SegmentID);
            //EAHelper.TaggedValueSet(newConnector, DAConst.DP_TempLinkTag, createNewLinkData.tempLink.ToString());
            //EAHelper.TaggedValueSet(newConnector, DAConst.DP_TempLinkDiagramIDTag, createNewLinkData.tempLink ? createNewLinkData.tempLinkDiagramID : "");


            newConnector.Update();
            newConnector.TaggedValues.Refresh();

            // Добавляем коннектор к кэш информации о коннекторах
            createNewLinkData.ConnectorID = newConnector.ConnectorID;
            Context.ConnectorData.Add(createNewLinkData.ConnectorID, createNewLinkData);

            if (putOnDiagram)
            {
                // Помещаем на диаграмму
                EA.DiagramLink diagramLink = DiagramLinkHelper.CreateDiagramLink(newConnector);
            }

            return(newConnector);
        }
Ejemplo n.º 24
0
 public DiagramLinkStyle(EA.Repository rep, EA.DiagramLink link, string type, string style, string property)
     : base(rep, type, style, property)
 {
     _link = link;
 }