예제 #1
0
        public void Initialize(IContainerNode firstNeighborNode, IContainerNode secondNeighborNode)
        {
            GoLayer defaultLayer = Document.DefaultLayer;

            GoSubGraphBase.ReparentToCommonSubGraph(this, (GoObject)firstNeighborNode, (GoObject)secondNeighborNode, true, defaultLayer);

            FirstNeighbor  = firstNeighborNode;
            SecondNeighbor = secondNeighborNode;
            if (FirstNeighbor == null || SecondNeighbor == null)
            {
                throw new OSPSuiteException();
            }

            //Refresh Ports names and postions after connecting both neighbors, if MultiPortContainerNodes are uses
            var multiPortFirstNeighbor  = FirstNeighbor as MultiPortContainerNode;
            var multiPortSecondNeighbor = SecondNeighbor as MultiPortContainerNode;

            if (multiPortFirstNeighbor != null)
            {
                multiPortFirstNeighbor.RefreshPort(_neighbor1Link);
            }
            if (multiPortSecondNeighbor != null)
            {
                multiPortSecondNeighbor.RefreshPort(_neighbor2Link);
            }

            AdjustPosition();
        }
예제 #2
0
 public virtual void Initialize(IBaseNode fromNode, IBaseNode toNode)
 {
     fromNode.AddLinkFrom(this);
     toNode.AddLinkTo(this);
     GoSubGraphBase.ReparentToCommonSubGraph(this, (GoObject)fromNode, (GoObject)toNode, true,
                                             ((GoObject)fromNode).Document.DefaultLayer);
 }