예제 #1
0
        void setPartitionSizes(TSF_EA.ElementWrapper eaElement, MDDiagramObject mdDiagramObject)
        {
            var orderedSplits = mdDiagramObject.ownedSplits.OrderBy(x => x.y).ToList();
            int i             = 0;
            int previousY     = mdDiagramObject.y;

            foreach (global::EA.Partition partition in eaElement.WrappedElement.Partitions)
            {
                //get the corresponding split
                int partitionSize = 0;
                if (orderedSplits.Count > i)
                {
                    var currentSplit = orderedSplits[i];
                    //calculate the size of this partition
                    partitionSize = currentSplit.y - previousY;
                }
                else
                {
                    //set the size to the bottom of the fragment
                    partitionSize = mdDiagramObject.bottom - previousY;
                }
                if (partitionSize > 0)
                {
                    partition.Size    = partitionSize;
                    eaElement.isDirty = true;
                }
                //up the counter
                i++;
            }
            //save the changes to the partitions by saving the EAElement
            eaElement.save();
        }
예제 #2
0
        public void addElementToDiagram(MDDiagramObject mdDiagramObject, TSF_EA.Diagram eaDiagram)
        {
            //get the EA element represented by this MDDiagramObject
            string getEAElementSQL = @"select o.Object_ID from (t_object o
						inner join t_objectproperties tv on (tv.Object_ID = o.Object_ID
															and tv.Property = 'md_guid'))
						where tv.Value = '"                         + mdDiagramObject.mdID + "'";
            var    eaElement       = this.model.getElementWrappersByQuery(getEAElementSQL).FirstOrDefault();

            if (eaElement != null)
            {
                //first check if the elemnt is already on the diagram
                if (!eaDiagram.contains(eaElement))
                {
                    //for each of the elements on the diagram create the diagramobject with the appropriate link to the elemment and geometry.
                    var newDiagramObject = eaDiagram.addToDiagram(eaElement, mdDiagramObject.x, mdDiagramObject.y, mdDiagramObject.bottom, mdDiagramObject.right);
                    //if the diagramObject is an ActivityPartition then we need to set its orientation to vertical
                    if (mdDiagramObject.umlType.StartsWith("Swimlane"))
                    {
                        newDiagramObject.setOrientation(true);
                        newDiagramObject.save();
                    }
                }
                if (mdDiagramObject.umlType == "CombinedFragment" &&
                    mdDiagramObject.ownedSplits.Any())
                {
                    //set the partitions
                    setPartitionSizes(eaElement, mdDiagramObject);
                }
            }
        }
 public void addDiagramObject(MDDiagramObject diagramObject)
 {
     this.diagramObjects.Add(diagramObject);
 }