private void AddOlapNode(ConstraintGenerator generator, OverlapRemovalCluster olapParentCluster, FiNode filNode, InitialCenterDelegateType nodeCenter) { // If the node already has an mOlapNode, it's already in a cluster (in a different // hierarchy); we just add it to the new cluster. if (null != filNode.getOlapNode(IsHorizontal)) { generator.AddNodeToCluster(olapParentCluster, filNode.getOlapNode(IsHorizontal)); return; } var center = nodeCenter(filNode); // We need to create a new Node in the Generator. if (IsHorizontal) { // Add the Generator node with the X-axis coords primary, Y-axis secondary. filNode.mOlapNodeX = generator.AddNode(olapParentCluster, filNode /* userData */ , center.X, center.Y , filNode.Width, filNode.Height, filNode.stayWeight); } else { // Add the Generator node with the Y-axis coords primary, X-axis secondary. filNode.mOlapNodeY = generator.AddNode(olapParentCluster, filNode /* userData */ , center.Y, center.X , filNode.Height, filNode.Width, filNode.stayWeight); } }
private void AddStructuralConstraints() { // Add the vertical structural constraints to the auto-generated ones. foreach (var c in structuralConstraints) { if (ConstraintLevel >= c.Level) { var hc = c as HorizontalSeparationConstraint; if (hc != null && IsHorizontal) { FiNode u = (FiNode)(hc.LeftNode.AlgorithmData); FiNode v = (FiNode)(hc.RightNode.AlgorithmData); solver.AddConstraint(u.getOlapNode(IsHorizontal).Variable, v.getOlapNode(IsHorizontal).Variable, hc.Separation, hc.IsEquality); } var vc = c as VerticalSeparationConstraint; if (vc != null && !IsHorizontal) { FiNode u = (FiNode)(vc.TopNode.AlgorithmData); FiNode v = (FiNode)(vc.BottomNode.AlgorithmData); solver.AddConstraint(u.getOlapNode(IsHorizontal).Variable, v.getOlapNode(IsHorizontal).Variable, vc.Separation, vc.IsEquality); } } } }