Book a Demo

Author Topic: Containment relationship between DiagramObject and DiagramLink  (Read 3355 times)

priombiswas89

  • EA User
  • **
  • Posts: 47
  • Karma: +0/-0
    • View Profile
I am trying to get the containment relationship between a fragment(DiagramObject) and connector(DiagramLink). Below is the sequence diagram:
https://ibb.co/GQ2MV6H

I am trying the below code to get the coordinates of DiagramObject and DiagramLink:

Code: [Select]
foreach (EA.DiagramLink link in diag.DiagramLinks)
            {
                EA.Connector connector = rep.GetConnectorByID(link.ConnectorID);
                startX = connector.StartPointX;
                startY = connector.StartPointY;
                endX = connector.EndPointX;
                endY = connector.EndPointY;
            }
            foreach (DiagramObject diagramObj in diag.DiagramObjects)
            {
                int elementId = diagramObj.ElementID;
                EA.Element element = rep.GetElementByID(elementId);
               
                if (element.MetaType.Equals("InteractionFragment"))
                {
                    top = diagramObj.top;
                    bottom = diagramObj.bottom;
                    left = diagramObj.left;
                    right = diagramObj.right;
                    GetTypeName(element);
                }
            }

I am not sure how to compare startX, startY, endX, endY (DiagramLink) to top, bottom, left and right (DiagramObject) to check whether the diagramlinks are contained inside the diagramobject. Any kind of help will be much appreciated.

Geert Bellekens

  • EA Guru
  • *****
  • Posts: 13523
  • Karma: +574/-33
  • Make EA work for YOU!
    • View Profile
    • Enterprise Architect Consultant and Value Added Reseller
Re: Containment relationship between DiagramObject and DiagramLink
« Reply #1 on: March 22, 2021, 05:37:31 am »
There's no need to post duplicate questions. I've answered on your other one.

Geert