Example #1
0
        public void AdjustPositionForContainerInMove(IContainerNode node, SizeF offset)
        {
            if (!checkAdjustabilityAndRefreshPorts())
            {
                return;
            }

            NeighborLink neighborLinkToContainerInMove = null;
            NeighborLink neighborLinkToOtherContainer  = null;

            if (node.ContainsChildNode(FirstNeighbor, true))
            {
                neighborLinkToContainerInMove = _neighbor1Link;
                neighborLinkToOtherContainer  = _neighbor2Link;
            }
            if (node.ContainsChildNode(SecondNeighbor, true))
            {
                neighborLinkToContainerInMove = _neighbor2Link;
                neighborLinkToOtherContainer  = _neighbor1Link;
            }
            if (neighborLinkToContainerInMove == null)
            {
                return;
            }

            Location = mean(neighborLinkToOtherContainer.ToArrowEndPoint, neighborLinkToContainerInMove.ToArrowEndPoint + offset);
        }
Example #2
0
        private void insertExternalNeighborLinks(IContainerNode parentContainerNode, GoLayoutForceDirectedNetwork net)
        {
            foreach (var childContainerNode in parentContainerNode.GetDirectChildren <IContainerNode>())
            {
                foreach (var neighborhoodNode in childContainerNode.GetLinkedNodes <INeighborhoodNode>())
                {
                    if (!parentContainerNode.ContainsChildNode(neighborhoodNode, true))
                    {
                        var  otherContainerNode = neighborhoodNode.GetOtherContainerNode(childContainerNode);
                        var  nodeOnBoundary     = new GoLayoutForceDirectedNode();
                        var  pos         = neighborhoodNode.Location;
                        bool pointExists = GoObject.GetNearestIntersectionPoint(parentContainerNode.Bounds, otherContainerNode.Center, childContainerNode.Center, out pos);

                        if (!pointExists)
                        {
                            continue;
                        }

                        //to be not deleted due to invisible node, seems to set also the position
                        nodeOnBoundary.GoObject  = neighborhoodNode as GoObject;
                        nodeOnBoundary.IsFixed   = true;
                        nodeOnBoundary.UserFlags = NodeLayoutType.REMOTE_CONTAINER_BOUNDARY_NODE;

                        //set Position after setting GoObject, because setting GoObject seems to set position
                        nodeOnBoundary.Position = pos;
                        net.AddNode(nodeOnBoundary);
                        net.LinkNodes(net.FindNode(childContainerNode as GoObject), nodeOnBoundary, neighborhoodNode as GoObject);
                    }
                }
            }
        }