public SpecIfMetadata CreateMetaDataForDiagramObject(EAAPI.DiagramObject diagramObject,
                                                             EAAPI.Element element)
        {
            SpecIfMetadata result = new SpecIfMetadata();

            Shape shape = new Shape
            {
                Bounds            = new Bounds(),
                ResourceReference = new ResourceReference
                {
                    IdReference       = EaSpecIfGuidConverter.ConvertEaGuidToSpecIfGuid(element.ElementGUID),
                    RevisionReference = EaDateToRevisionConverter.ConvertDateToRevision(element.Modified)
                }
            };

            int recatangleWidth = (diagramObject.right - diagramObject.left);
            int rectangleHeight = (-diagramObject.bottom) - (-diagramObject.top);

            shape.Bounds.X      = diagramObject.left;
            shape.Bounds.Y      = (diagramObject.top * -1);
            shape.Bounds.Width  = recatangleWidth;
            shape.Bounds.Height = rectangleHeight;

            result.Shape = shape;

            return(result);
        }
        public SpecIfMetadata CreateMetaDataForDiagramLink(EAAPI.DiagramLink diagramLink,
                                                           EAAPI.Connector connector,
                                                           EAAPI.DiagramObject sourceDiagramObject,
                                                           EAAPI.DiagramObject targetDiagramObject,
                                                           EAAPI.Element sourceElement,
                                                           EAAPI.Element targetElement)

        {
            SpecIfMetadata result = new SpecIfMetadata();

            EAAPI.Element srcElement  = sourceElement;
            EAAPI.Element trgtElement = targetElement;

            string directionAttribute = null; // unspecified

            if (connector.Direction == "Source -> Destination")
            {
                directionAttribute = "unidirectional";
            }
            else if (connector.Direction == "Destination -> Source")
            {
                srcElement         = targetElement;
                trgtElement        = sourceElement;
                directionAttribute = "unidirectional";
            }
            else if (connector.Direction == "Bi-Directional")
            {
                directionAttribute = "bidirectional";
            }

            Edge edge = new Edge
            {
                Waypoints  = new List <Waypoint>(),
                References = new List <SpecIfReferenceBase>(),
                SourceResourceReference = new ResourceReference
                {
                    IdReference       = EaSpecIfGuidConverter.ConvertEaGuidToSpecIfGuid(srcElement.ElementGUID),
                    RevisionReference = EaDateToRevisionConverter.ConvertDateToRevision(srcElement.Modified)
                },
                TargetResourceReference = new ResourceReference
                {
                    IdReference       = EaSpecIfGuidConverter.ConvertEaGuidToSpecIfGuid(trgtElement.ElementGUID),
                    RevisionReference = EaDateToRevisionConverter.ConvertDateToRevision(trgtElement.Modified)
                },
                Direction = directionAttribute
            };

            edge.Waypoints = CalculateWaypointsForDiagramLink(diagramLink, sourceDiagramObject, targetDiagramObject);

            result.Edge = edge;

            return(result);
        }
        public SpecIfMetadata CreateMetaDataForDiagram(EAAPI.Diagram diagram, int height, int width)
        {
            SpecIfMetadata result = new SpecIfMetadata();

            Shape shape = new Shape
            {
                Bounds = new Bounds
                {
                    X      = 0,
                    Y      = 0,
                    Width  = width,
                    Height = height
                },
                ResourceReference = new ResourceReference
                {
                    IdReference       = EaSpecIfGuidConverter.ConvertEaGuidToSpecIfGuid(diagram.DiagramGUID),
                    RevisionReference = EaDateToRevisionConverter.ConvertDateToRevision(diagram.ModifiedDate),
                }
            };

            result.Shape = shape;

            return(result);
        }